summaryrefslogtreecommitdiff
path: root/otk
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-02-14 23:05:59 +0000
committerDana Jansens <danakj@orodu.net>2003-02-14 23:05:59 +0000
commit7fe3301e7ea905a8a76d54c22751f3d8a346e28b (patch)
tree8b81be235862807c55393d35eb5830779afeecb1 /otk
parent299dc47a6b6379bba77fc489ef6825dcfe18faf5 (diff)
Add the "obsetroot" tool. Use it to set the root background.
Diffstat (limited to 'otk')
-rw-r--r--otk/.cvsignore1
-rw-r--r--otk/Makefile.am3
-rw-r--r--otk/application.cc25
-rw-r--r--otk/application.hh2
-rw-r--r--otk/appwidget.cc1
-rw-r--r--otk/otk.cc25
-rw-r--r--otk/otk.hh5
-rw-r--r--otk/property.cc3
-rw-r--r--otk/property.hh3
-rw-r--r--otk/pseudorendercontrol.cc6
-rw-r--r--otk/rendercontrol.cc22
-rw-r--r--otk/rendercontrol.hh3
-rw-r--r--otk/renderstyle.cc13
-rw-r--r--otk/renderstyle.hh7
-rw-r--r--otk/truerendercontrol.cc6
15 files changed, 74 insertions, 51 deletions
diff --git a/otk/.cvsignore b/otk/.cvsignore
index 0497be4a..7dab6bb6 100644
--- a/otk/.cvsignore
+++ b/otk/.cvsignore
@@ -41,3 +41,4 @@ rendercontrol.lo
rendercolor.lo
otk.py
otk.pc
+otk.lo
diff --git a/otk/Makefile.am b/otk/Makefile.am
index f0c2e805..dc53291f 100644
--- a/otk/Makefile.am
+++ b/otk/Makefile.am
@@ -10,7 +10,8 @@ libotk_la_SOURCES=rendercontrol.cc truerendercontrol.cc surface.cc util.cc \
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
diff --git a/otk/application.cc b/otk/application.cc
index 94842ca5..afe06f80 100644
--- a/otk/application.cc
+++ b/otk/application.cc
@@ -8,41 +8,34 @@
#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)
diff --git a/otk/application.hh b/otk/application.hh
index 848b7985..6da36d28 100644
--- a/otk/application.hh
+++ b/otk/application.hh
@@ -3,7 +3,6 @@
#define __application_hh
#include "eventdispatcher.hh"
-#include "display.hh"
namespace otk {
@@ -27,7 +26,6 @@ public:
private:
void loadStyle(void);
- Display _display;
int _screen;
bool _dockable;
diff --git a/otk/appwidget.cc b/otk/appwidget.cc
index 8b157225..5dcad7ae 100644
--- a/otk/appwidget.cc
+++ b/otk/appwidget.cc
@@ -6,6 +6,7 @@
#include "application.hh"
#include "property.hh"
#include "renderstyle.hh"
+#include "display.hh"
extern "C" {
#include <X11/Xlib.h>
diff --git a/otk/otk.cc b/otk/otk.cc
new file mode 100644
index 00000000..130e3b77
--- /dev/null
+++ b/otk/otk.cc
@@ -0,0 +1,25 @@
+#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;
+}
+
+}
diff --git a/otk/otk.hh b/otk/otk.hh
index 62788cba..74187f05 100644
--- a/otk/otk.hh
+++ b/otk/otk.hh
@@ -30,4 +30,9 @@
#include "ustring.hh"
#include "widget.hh"
+namespace otk {
+void initialize();
+void destroy();
+}
+
#endif // __otk_hh
diff --git a/otk/property.cc b/otk/property.cc
index 75f9a7cf..16b507f5 100644
--- a/otk/property.cc
+++ b/otk/property.cc
@@ -134,6 +134,9 @@ void Property::initialize()
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");
}
diff --git a/otk/property.hh b/otk/property.hh
index f773c649..e6677a64 100644
--- a/otk/property.hh
+++ b/otk/property.hh
@@ -125,6 +125,9 @@ struct Atoms {
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;
};
diff --git a/otk/pseudorendercontrol.cc b/otk/pseudorendercontrol.cc
index 7af57192..cf992924 100644
--- a/otk/pseudorendercontrol.cc
+++ b/otk/pseudorendercontrol.cc
@@ -9,14 +9,12 @@
#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)
diff --git a/otk/rendercontrol.cc b/otk/rendercontrol.cc
index a4de270a..8f932968 100644
--- a/otk/rendercontrol.cc
+++ b/otk/rendercontrol.cc
@@ -13,16 +13,23 @@
#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)
@@ -47,8 +54,10 @@ RenderControl *RenderControl::getRenderControl(int screen)
RenderControl::RenderControl(int screen)
: _screen(screen)
+
{
printf("Initializing RenderControl\n");
+
}
RenderControl::~RenderControl()
@@ -56,13 +65,6 @@ 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
diff --git a/otk/rendercontrol.hh b/otk/rendercontrol.hh
index 56f45c8a..5e21da29 100644
--- a/otk/rendercontrol.hh
+++ b/otk/rendercontrol.hh
@@ -48,9 +48,6 @@ public:
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.
diff --git a/otk/renderstyle.cc b/otk/renderstyle.cc
index d9e106ab..88c8d787 100644
--- a/otk/renderstyle.cc
+++ b/otk/renderstyle.cc
@@ -73,11 +73,11 @@ bool RenderStyle::loadStyle(RenderStyle *s, int screen,
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);
@@ -281,7 +281,7 @@ bool RenderStyle::loadStyle(RenderStyle *s, int screen,
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);
@@ -497,7 +497,7 @@ void RenderStyle::defaultStyle(RenderStyle *s, int screen)
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);
@@ -634,9 +634,6 @@ void RenderStyle::defaultStyle(RenderStyle *s, int screen)
RenderStyle::~RenderStyle()
{
- assert(_root_color);
- delete _root_color;
-
assert(_text_color_focus);
delete _text_color_focus;
assert(_text_color_unfocus);
diff --git a/otk/renderstyle.hh b/otk/renderstyle.hh
index 69c26a7f..0f512148 100644
--- a/otk/renderstyle.hh
+++ b/otk/renderstyle.hh
@@ -8,6 +8,7 @@
#include "ustring.hh"
#include <list>
+#include <string>
namespace otk {
@@ -49,7 +50,7 @@ private:
int _screen;
ustring _file;
- RenderColor *_root_color;
+ std::string _root_args;
RenderColor *_text_color_focus;
RenderColor *_text_color_unfocus;
@@ -97,7 +98,7 @@ public:
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; }
@@ -153,4 +154,4 @@ public:
}
-#endif // __rendertexture_hh
+#endif // __renderstyle_hh
diff --git a/otk/truerendercontrol.cc b/otk/truerendercontrol.cc
index 2ce771eb..42589dd3 100644
--- a/otk/truerendercontrol.cc
+++ b/otk/truerendercontrol.cc
@@ -9,14 +9,12 @@
#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)