-SUBDIRS = po data doc otk wrap src scripts
+SUBDIRS = po data doc otk wrap src scripts tools
MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in stamp-h.in
.PHONY: doc
AC_CONFIG_FILES([Makefile po/Makefile.in
otk/Makefile
src/Makefile
+ tools/Makefile
wrap/Makefile
scripts/Makefile
doc/Makefile
rendercolor.lo
otk.py
otk.pc
+otk.lo
renderstyle.cc rendercolor.cc pseudorendercontrol.cc \
display.cc font.cc screeninfo.cc property.cc timer.cc \
eventdispatcher.cc eventhandler.cc ustring.cc \
- widget.cc application.cc label.cc appwidget.cc button.cc
+ widget.cc application.cc label.cc appwidget.cc button.cc \
+ otk.cc
#focuswidget.cc focuslabel.cc
#include "property.hh"
#include "rendercolor.hh"
#include "renderstyle.hh"
+#include "display.hh"
-extern "C" {
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-}
-
+#include <cstdlib>
#include <iostream>
namespace otk {
+extern void initialize();
+extern void destroy();
+
Application::Application(int argc, char **argv)
: EventDispatcher(),
- _display(),
_dockable(false),
_appwidget_count(0)
{
(void)argc;
(void)argv;
- _screen = DefaultScreen(*_display);
+ otk::initialize();
+
+ _screen = DefaultScreen(**display);
- Timer::initialize();
- RenderColor::initialize();
- RenderStyle::initialize();
- Property::initialize();
-
loadStyle();
}
Application::~Application()
{
- RenderStyle::destroy();
- RenderColor::destroy();
- Timer::destroy();
+ otk::destroy();
}
void Application::loadStyle(void)
#define __application_hh
#include "eventdispatcher.hh"
-#include "display.hh"
namespace otk {
private:
void loadStyle(void);
- Display _display;
int _screen;
bool _dockable;
#include "application.hh"
#include "property.hh"
#include "renderstyle.hh"
+#include "display.hh"
extern "C" {
#include <X11/Xlib.h>
--- /dev/null
+#include "display.hh"
+#include "timer.hh"
+#include "renderstyle.hh"
+#include "property.hh"
+
+namespace otk {
+
+void initialize()
+{
+ new Display();
+ Timer::initialize();
+ RenderColor::initialize();
+ RenderStyle::initialize();
+ Property::initialize();
+}
+
+void destroy()
+{
+ RenderStyle::destroy();
+ RenderColor::destroy();
+ Timer::destroy();
+ delete display;
+}
+
+}
#include "ustring.hh"
#include "widget.hh"
+namespace otk {
+void initialize();
+void destroy();
+}
+
#endif // __otk_hh
atoms.kde_net_wm_window_type_override =
create("_KDE_NET_WM_WINDOW_TYPE_OVERRIDE");
+ atoms.rootpmapid = create("_XROOTPMAP_ID");
+ atoms.esetrootid = create("ESETROOT_PMAP_ID");
+
atoms.openbox_premax = create("_OPENBOX_PREMAX");
atoms.openbox_active_window = create("_OPENBOX_ACTIVE_WINDOW");
}
Atom kde_net_wm_system_tray_window_for;
Atom kde_net_wm_window_type_override;
+ Atom rootpmapid;
+ Atom esetrootid;
+
Atom openbox_premax;
Atom openbox_active_window;
};
#include "rendertexture.hh"
extern "C" {
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif // HAVE_STDLIB_H
-
#include "../src/gettext.h"
#define _(str) gettext(str)
}
+#include <cstdlib>
+
namespace otk {
PseudoRenderControl::PseudoRenderControl(int screen)
#include "surface.hh"
#include "font.hh"
#include "ustring.hh"
+#include "property.hh"
extern "C" {
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif // HAVE_STDLIB_H
+#ifdef HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif // HAVE_SYS_WAIT_H
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif // HAVE_UNISTD_H
#include "../src/gettext.h"
#define _(str) gettext(str)
}
+#include <cstdlib>
+
namespace otk {
RenderControl *RenderControl::getRenderControl(int screen)
RenderControl::RenderControl(int screen)
: _screen(screen)
+
{
printf("Initializing RenderControl\n");
+
}
RenderControl::~RenderControl()
printf("Destroying RenderControl\n");
}
-void RenderControl::drawRoot(const RenderColor &color) const
-{
- Window root = display->screenInfo(_screen)->rootWindow();
- XSetWindowBackground(**display, root, color.pixel());
- XClearWindow(**display, root);
-}
-
void RenderControl::drawString(Surface& sf, const Font &font, int x, int y,
const RenderColor &color,
const ustring &string) const
static RenderControl *getRenderControl(int screen);
- //! Draws onto the root window
- virtual void drawRoot(const RenderColor &color) const;
-
//! Draws a background onto a Surface, as specified by a RenderTexture
/*!
This function will overwrite the entire surface.
s->_screen = screen;
s->_file = stylefile;
// pick one..
-//#define FIERON
-#define MERRY
+#define FIERON
+//#define MERRY
#ifdef FIERON
- s->_root_color = new RenderColor(screen, 0x272a2f);
+ s->_root_args = "#272a2f";
s->_text_color_focus = new RenderColor(screen, 0x272a2f);
s->_text_color_unfocus = new RenderColor(screen, 0x676869);
s->_handle_width = 4;
#else
# ifdef MERRY
- s->_root_color = new RenderColor(screen, 0x7b756a);
+ s->_root_args = "#7b756a";
s->_text_color_focus = new RenderColor(screen, 0xffffff);
s->_text_color_unfocus = new RenderColor(screen, 0xffffff);
s->_screen = screen;
s->_file = "";
- s->_root_color = new RenderColor(screen, 0);
+ s->_root_args = "#000000";
s->_text_color_focus = new RenderColor(screen, 0xffffff);
s->_text_color_unfocus = new RenderColor(screen, 0xffffff);
s->_button_color_focus = new RenderColor(screen, 0);
RenderStyle::~RenderStyle()
{
- assert(_root_color);
- delete _root_color;
-
assert(_text_color_focus);
delete _text_color_focus;
assert(_text_color_unfocus);
#include "ustring.hh"
#include <list>
+#include <string>
namespace otk {
int _screen;
ustring _file;
- RenderColor *_root_color;
+ std::string _root_args;
RenderColor *_text_color_focus;
RenderColor *_text_color_unfocus;
inline int screen() const { return _screen; }
- inline RenderColor *rootColor() const { return _root_color; }
+ inline const std::string& rootArgs() const { return _root_args; }
inline RenderColor *textFocusColor() const { return _text_color_focus; }
inline RenderColor *textUnfocusColor() const { return _text_color_unfocus; }
}
-#endif // __rendertexture_hh
+#endif // __renderstyle_hh
#include "rendertexture.hh"
extern "C" {
-#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-#endif // HAVE_STDLIB_H
-
#include "../src/gettext.h"
#define _(str) gettext(str)
}
+#include <cstdlib>
+
namespace otk {
TrueRenderControl::TrueRenderControl(int screen)
otk::EventHandler::buttonPressHandler(e);
insertPress(e);
+ printf("press queue %u pressed %u\n", _button, e.button);
+
MouseContext::MC context;
EventHandler *h = openbox->findHandler(e.window);
Frame *f = dynamic_cast<Frame*>(h);
#include <cstdio>
#include <cstdlib>
+namespace otk {
+extern void initialize();
+extern void destroy();
+}
+
namespace ob {
Openbox *openbox = (Openbox *) 0;
Openbox::Openbox(int argc, char **argv)
: otk::EventDispatcher(),
- otk::EventHandler(),
- _display()
+ otk::EventHandler()
{
struct sigaction action;
openbox = this;
- _displayreq = (char*) 0;
_argv = argv;
_shutdown = false;
_restart = false;
parseCommandLine(argc, argv);
+ otk::initialize();
+
XSynchronize(**otk::display, _sync);
// set up the signal handler
// anything that died while we were restarting won't give us a SIGCHLD
while (waitpid(-1, NULL, WNOHANG) > 0);
- otk::RenderColor::initialize();
- otk::RenderStyle::initialize();
- otk::Timer::initialize();
- otk::Property::initialize();
_actions = new Actions();
_bindings = new Bindings();
CurrentTime);
XSync(**otk::display, false);
- // this tends to block.. i honestly am not sure why. causing an x error in
- // the shutdown process unblocks it. blackbox simply did a ::exit(0), so
- // all im gunna do is the same.
- //delete _display;
-
- otk::Timer::destroy();
- otk::RenderStyle::destroy();
- otk::RenderColor::destroy();
+ otk::destroy();
}
for (int i = 1; i < argc; ++i) {
std::string arg(argv[i]);
- if (arg == "-display") {
- if (++i >= argc)
- err = true;
- else
- _displayreq = argv[i];
- } else if (arg == "-rc") {
+ if (arg == "-rc") {
if (++i >= argc)
err = true;
else
typedef std::vector<Screen *> ScreenList;
private:
- //! The display on which Openbox is running
- otk::Display _display;
-
// stuff that can be passed on the command line
//! Path to the config file to use/in use
/*!
Defaults to $(HOME)/.openbox/user.py
*/
std::string _scriptfilepath;
- //! The display requested by the user, or null to use the DISPLAY env var
- char *_displayreq;
//! The value of argv, i.e. how this application was executed
char **_argv;
//! Run the application in synchronous mode? (for debugging)
#include "python.hh"
#include "otk/display.hh"
#include "otk/property.hh"
+#include "otk/util.hh"
extern "C" {
#ifdef HAVE_UNISTD_H
// initialize the screen's style
otk::RenderStyle::setStyle(_number, _config.theme);
- otk::display->renderControl(_number)->
- drawRoot(*otk::RenderStyle::style(_number)->rootColor());
+ // draw the root window
+ otk::bexec("obsetroot " + otk::RenderStyle::style(_number)->rootArgs(),
+ _info->displayString());
// set up notification of netwm support
changeSupportedAtoms();
--- /dev/null
+.libs
+.deps
+obsetroot
+Makefile.in
+Makefile
--- /dev/null
+bin_PROGRAMS=obsetroot
+
+obsetroot_LDADD=$(XFT_LIBS) -L../otk -lotk @LIBINTL@
+obsetroot_CPPFLAGS=$(XFT_CFLAGS) -I..
+obsetroot_SOURCES=obsetroot.cc
+
+MAINTAINERCLEANFILES=Makefile.in
+
+distclean-local:
+ $(RM) *\~ *.orig *.rej .\#*
--- /dev/null
+#include <otk/otk.hh>
+
+int main(int argc, char **argv)
+{
+ otk::initialize();
+
+ int screen = DefaultScreen(**otk::display);
+
+ Pixmap old;
+ Window root = otk::display->screenInfo(screen)->rootWindow();
+
+ otk::Surface *s = new otk::Surface(screen,
+ otk::display->screenInfo(screen)->size());
+ otk::RenderTexture *tx = new otk::RenderTexture(screen, false,
+ otk::RenderTexture::Flat,
+ otk::RenderTexture::Bevel1,
+ false,
+ otk::RenderTexture::Solid,
+ false, 0x202020, 0x0000ff,
+ 0, 0);
+ otk::display->renderControl(screen)->drawBackground(*s, *tx);
+
+ otk::display->grab();
+
+ otk::display->setIgnoreErrors(true);
+ // get the current pixmap and free it
+ if (otk::Property::get(root, otk::Property::atoms.rootpmapid,
+ otk::Property::atoms.pixmap, &old) && old) {
+ XKillClient(**otk::display, old);
+ XSync(**otk::display, false);
+ XFreePixmap(**otk::display, old);
+ }
+ if (otk::Property::get(root, otk::Property::atoms.esetrootid,
+ otk::Property::atoms.pixmap, &old) && old)
+ XFreePixmap(**otk::display, old);
+ otk::display->setIgnoreErrors(false);
+
+ // XSetWindowBackground(**display, root, color.pixel());
+
+ // don't kill us when someone wants to change the background!!
+ Pixmap pixmap = XCreatePixmap(**otk::display, root, s->size().width(),
+ s->size().height(),
+ otk::display->screenInfo(screen)->depth());
+ XCopyArea(**otk::display, s->pixmap(), pixmap,
+ DefaultGC(**otk::display, screen), 0, 0,
+ s->size().width(), s->size().height(), 0, 0);
+
+ // set the new pixmap
+ XSetWindowBackgroundPixmap(**otk::display, root, pixmap);
+ XClearWindow(**otk::display, root);
+
+ otk::Property::set(root, otk::Property::atoms.rootpmapid,
+ otk::Property::atoms.pixmap, pixmap);
+ otk::Property::set(root, otk::Property::atoms.esetrootid,
+ otk::Property::atoms.pixmap, pixmap);
+
+ otk::display->ungrab();
+
+ delete tx;
+ delete s;
+
+ XSetCloseDownMode(**otk::display, RetainPermanent);
+ XKillClient(**otk::display, AllTemporary);
+
+ otk::destroy();
+}