From 9a64438a5a53624e5f5c7c3dbb5123e246693e5e Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 23 Jan 2003 07:26:32 +0000 Subject: [PATCH] set the root window, to a color for now --- otk/display.cc | 6 +++--- otk/display.hh | 6 +++--- otk/rendercontrol.cc | 7 +++++++ otk/rendercontrol.hh | 12 +++++++----- otk/renderstyle.cc | 4 ++++ otk/renderstyle.hh | 4 ++++ src/screen.cc | 1 + 7 files changed, 29 insertions(+), 11 deletions(-) diff --git a/otk/display.cc b/otk/display.cc index 68f0862b..367ee3eb 100644 --- a/otk/display.cc +++ b/otk/display.cc @@ -197,7 +197,7 @@ Display::~Display() } -const ScreenInfo* Display::screenInfo(int snum) +const ScreenInfo* Display::screenInfo(int snum) const { assert(snum >= 0); assert(snum < (signed) ScreenCount(_display)); @@ -205,7 +205,7 @@ const ScreenInfo* Display::screenInfo(int snum) } -const ScreenInfo* Display::findScreen(Window root) +const ScreenInfo* Display::findScreen(Window root) const { for (int i = 0; i < ScreenCount(_display); ++i) if (_screeninfo_list[i]->rootWindow() == root) @@ -214,7 +214,7 @@ const ScreenInfo* Display::findScreen(Window root) } -const RenderControl *Display::renderControl(int snum) +const RenderControl *Display::renderControl(int snum) const { assert(snum >= 0); assert(snum < (signed) ScreenCount(_display)); diff --git a/otk/display.hh b/otk/display.hh index ccce6ae1..28d33675 100644 --- a/otk/display.hh +++ b/otk/display.hh @@ -94,13 +94,13 @@ public: @param snum The screen number of the screen to retrieve info on @return Info on the requested screen, in a ScreenInfo class */ - const ScreenInfo* screenInfo(int snum); + const ScreenInfo* screenInfo(int snum) const; //! Find a ScreenInfo based on a root window - const ScreenInfo* findScreen(Window root); + const ScreenInfo* findScreen(Window root) const; //! Gets the RenderControl for a screen - const RenderControl *renderControl(int snum); + const RenderControl *renderControl(int snum) const; //! Returns if the display has the xkb extension available inline bool xkb() const { return _xkb; } diff --git a/otk/rendercontrol.cc b/otk/rendercontrol.cc index 50a00ffa..6b664b62 100644 --- a/otk/rendercontrol.cc +++ b/otk/rendercontrol.cc @@ -60,6 +60,13 @@ RenderControl::~RenderControl() } +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 1d9ab7e7..781c32d4 100644 --- a/otk/rendercontrol.hh +++ b/otk/rendercontrol.hh @@ -71,14 +71,16 @@ public: static RenderControl *getRenderControl(int screen); + virtual void drawRoot(const RenderColor &color) const; + //! Draws a string onto a Surface - virtual void drawString(Surface& sf, const Font& font, int x, int y, - const RenderColor& color, - const ustring& string) const; + virtual void drawString(Surface &sf, const Font &font, int x, int y, + const RenderColor &color, + const ustring &string) const; //! Draws a background onto a Surface, as specified by a RenderTexture - virtual void drawBackground(Surface& sf, - const RenderTexture& texture) const = 0; + virtual void drawBackground(Surface &sf, + const RenderTexture &texture) const = 0; }; } diff --git a/otk/renderstyle.cc b/otk/renderstyle.cc index a2cfae21..41745ea0 100644 --- a/otk/renderstyle.cc +++ b/otk/renderstyle.cc @@ -14,6 +14,8 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile) : _screen(screen), _file(stylefile) { + _root_color = new RenderColor(_screen, 0x272a2f); + _text_color_focus = new RenderColor(_screen, 0x272a2f); _text_color_unfocus = new RenderColor(_screen, 0x676869); @@ -220,6 +222,8 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile) RenderStyle::~RenderStyle() { + delete _root_color; + delete _text_color_focus; delete _text_color_unfocus; diff --git a/otk/renderstyle.hh b/otk/renderstyle.hh index d61c99da..2d2c3250 100644 --- a/otk/renderstyle.hh +++ b/otk/renderstyle.hh @@ -27,6 +27,8 @@ public: private: int _screen; std::string _file; + + RenderColor *_root_color; RenderColor *_text_color_focus; RenderColor *_text_color_unfocus; @@ -75,6 +77,8 @@ public: inline int screen() const { return _screen; } + inline RenderColor *rootColor() const { return _root_color; } + inline RenderColor *textFocusColor() const { return _text_color_focus; } inline RenderColor *textUnfocusColor() const { return _text_color_unfocus; } diff --git a/src/screen.cc b/src/screen.cc index 1de4f72a..1337038b 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -89,6 +89,7 @@ Screen::Screen(int screen) } _style.load(sconfig); */ + otk::display->renderControl(_number)->drawRoot(*_style.rootColor()); // set up notification of netwm support changeSupportedAtoms(); -- 2.45.2