From 00514c3f0859a147158ddc7efbb952c0b50a3bb0 Mon Sep 17 00:00:00 2001 From: fluxgen <fluxgen> Date: Fri, 12 Sep 2003 21:34:22 +0000 Subject: using FbTk GContext --- src/RootTheme.cc | 19 +++++++------------ src/RootTheme.hh | 10 ++++++---- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/RootTheme.cc b/src/RootTheme.cc index f3695dd..6e489e1 100644 --- a/src/RootTheme.cc +++ b/src/RootTheme.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: RootTheme.cc,v 1.4 2003/08/25 16:02:24 fluxgen Exp $ +// $Id: RootTheme.cc,v 1.5 2003/09/12 21:34:22 fluxgen Exp $ #include "RootTheme.hh" @@ -31,24 +31,19 @@ RootTheme::RootTheme(int screen_num, std::string &screen_root_command): m_root_command(*this, "rootCommand", "RootCommand"), m_bevel_width(*this, "bevelWidth", "BevelWidth"), m_handle_width(*this, "handleWidth", "HandleWidth"), - m_screen_root_command(screen_root_command) { + m_screen_root_command(screen_root_command), + m_opgc(RootWindow(FbTk::App::instance()->display(), screen_num)) { *m_bevel_width = 0; *m_handle_width = 0; - - XGCValues gcv; Display *disp = FbTk::App::instance()->display(); - gcv.foreground = WhitePixel(disp, screen_num)^BlackPixel(disp, screen_num); - gcv.function = GXxor; - gcv.subwindow_mode = IncludeInferiors; - m_opgc = XCreateGC(disp, - RootWindow(disp, screen_num), - GCForeground | GCFunction | GCSubwindowMode, &gcv); + m_opgc.setForeground(WhitePixel(disp, screen_num)^BlackPixel(disp, screen_num)); + m_opgc.setFunction(GXxor); + m_opgc.setSubwindowMode(IncludeInferiors); } RootTheme::~RootTheme() { - if (m_opgc != 0) - XFreeGC(FbTk::App::instance()->display(), m_opgc); + } void RootTheme::reconfigTheme() { diff --git a/src/RootTheme.hh b/src/RootTheme.hh index 9d6cc4f..a23e439 100644 --- a/src/RootTheme.hh +++ b/src/RootTheme.hh @@ -19,15 +19,17 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: RootTheme.hh,v 1.3 2003/08/25 16:02:24 fluxgen Exp $ +// $Id: RootTheme.hh,v 1.4 2003/09/12 21:34:22 fluxgen Exp $ #ifndef ROOTTHEME_HH #define ROOTTHEME_HH #include "FbTk/Theme.hh" -#include "Color.hh" +#include "FbTk/Color.hh" +#include "FbTk/GContext.hh" #include <X11/Xlib.h> + #include <string> @@ -44,13 +46,13 @@ public: int bevelWidth() const { return *m_bevel_width; } int handleWidth() const { return *m_handle_width; } - GC opGC() const { return m_opgc; } + GC opGC() const { return m_opgc.gc(); } private: FbTk::ThemeItem<std::string> m_root_command; FbTk::ThemeItem<int> m_bevel_width, m_handle_width; std::string &m_screen_root_command; ///< string to execute and override theme rootCommand - GC m_opgc; + FbTk::GContext m_opgc; }; #endif // ROOTTHEME_HH -- cgit v0.11.2