aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-27 17:52:08 (GMT)
committerfluxgen <fluxgen>2003-08-27 17:52:08 (GMT)
commit1c3ddb390bf8abd95fe26e5b32eac17b02453461 (patch)
tree4f176bb13046d9cb18d9c9a79c122c20e150b320 /src
parent3d5ef23a97e33a2ca9a9c24a0276a4773a6a6ea2 (diff)
downloadfluxbox_paul-1c3ddb390bf8abd95fe26e5b32eac17b02453461.zip
fluxbox_paul-1c3ddb390bf8abd95fe26e5b32eac17b02453461.tar.bz2
using GContext
Diffstat (limited to 'src')
-rw-r--r--src/FbWinFrameTheme.cc42
-rw-r--r--src/FbWinFrameTheme.hh16
2 files changed, 21 insertions, 37 deletions
diff --git a/src/FbWinFrameTheme.cc b/src/FbWinFrameTheme.cc
index 37c7898..7f6720b 100644
--- a/src/FbWinFrameTheme.cc
+++ b/src/FbWinFrameTheme.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbWinFrameTheme.cc,v 1.10 2003/08/25 16:37:50 fluxgen Exp $ 22// $Id: FbWinFrameTheme.cc,v 1.11 2003/08/27 17:52:08 fluxgen Exp $
23 23
24#include "FbWinFrameTheme.hh" 24#include "FbWinFrameTheme.hh"
25#include "App.hh" 25#include "App.hh"
@@ -61,21 +61,19 @@ FbWinFrameTheme::FbWinFrameTheme(int screen_num):
61 61
62 m_alpha(*this, "window.alpha", "Window.Alpha"), 62 m_alpha(*this, "window.alpha", "Window.Alpha"),
63 m_title_height(*this, "window.title.height", "Window.Title.Height"), 63 m_title_height(*this, "window.title.height", "Window.Title.Height"),
64 m_border(*this, "window", "Window") { // for window.border* 64 m_border(*this, "window", "Window"), // for window.border*
65 m_label_text_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
66 m_label_text_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
67 m_button_pic_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
68 m_button_pic_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)) {
65 69
66 *m_title_height = 0; 70 *m_title_height = 0;
67 // set defaults 71 // set defaults
68 m_font->load("fixed"); 72 m_font->load("fixed");
69 *m_alpha = 255; 73 *m_alpha = 255;
70 74
71 // create GCs
72 Display *disp = FbTk::App::instance()->display();
73 Window rootwin = RootWindow(disp, screen_num);
74 m_label_text_focus_gc = XCreateGC(disp, rootwin, 0, 0);
75 m_label_text_unfocus_gc = XCreateGC(disp, rootwin, 0, 0);
76 m_button_pic_focus_gc = XCreateGC(disp, rootwin, 0, 0);
77 m_button_pic_unfocus_gc = XCreateGC(disp, rootwin, 0, 0);
78 // create cursors 75 // create cursors
76 Display *disp = FbTk::App::instance()->display();
79 m_cursor_move = XCreateFontCursor(disp, XC_fleur); 77 m_cursor_move = XCreateFontCursor(disp, XC_fleur);
80 m_cursor_lower_left_angle = XCreateFontCursor(disp, XC_ll_angle); 78 m_cursor_lower_left_angle = XCreateFontCursor(disp, XC_ll_angle);
81 m_cursor_lower_right_angle = XCreateFontCursor(disp, XC_lr_angle); 79 m_cursor_lower_right_angle = XCreateFontCursor(disp, XC_lr_angle);
@@ -83,12 +81,7 @@ FbWinFrameTheme::FbWinFrameTheme(int screen_num):
83} 81}
84 82
85FbWinFrameTheme::~FbWinFrameTheme() { 83FbWinFrameTheme::~FbWinFrameTheme() {
86 // destroy GCs 84
87 Display *disp = FbTk::App::instance()->display();
88 XFreeGC(disp, m_label_text_focus_gc);
89 XFreeGC(disp, m_label_text_unfocus_gc);
90 XFreeGC(disp, m_button_pic_focus_gc);
91 XFreeGC(disp, m_button_pic_unfocus_gc);
92} 85}
93 86
94bool FbWinFrameTheme::fallback(FbTk::ThemeItem_base &item) { 87bool FbWinFrameTheme::fallback(FbTk::ThemeItem_base &item) {
@@ -106,21 +99,10 @@ void FbWinFrameTheme::reconfigTheme() {
106 else if (*m_alpha < 0) 99 else if (*m_alpha < 0)
107 *m_alpha = 0; 100 *m_alpha = 0;
108 101
109 XGCValues gcv; 102 m_label_text_focus_gc.setForeground(*m_label_focus_color);
110 unsigned long gc_value_mask = GCForeground; 103 m_label_text_unfocus_gc.setForeground(*m_label_unfocus_color);
111 Display *disp = FbTk::App::instance()->display(); 104 m_button_pic_focus_gc.setForeground(*m_button_focus_color);
112 105 m_button_pic_unfocus_gc.setForeground(*m_button_unfocus_color);
113 gcv.foreground = m_label_focus_color->pixel();
114 XChangeGC(disp, m_label_text_focus_gc, gc_value_mask, &gcv);
115
116 gcv.foreground = m_label_unfocus_color->pixel();
117 XChangeGC(disp, m_label_text_unfocus_gc, gc_value_mask, &gcv);
118
119 gcv.foreground = m_button_focus_color->pixel();
120 XChangeGC(disp, m_button_pic_focus_gc, gc_value_mask, &gcv);
121
122 gcv.foreground = m_button_unfocus_color->pixel();
123 XChangeGC(disp, m_button_pic_unfocus_gc, gc_value_mask, &gcv);
124 106
125 // notify listeners 107 // notify listeners
126 m_theme_change.notify(); 108 m_theme_change.notify();
diff --git a/src/FbWinFrameTheme.hh b/src/FbWinFrameTheme.hh
index cecf781..ef61f1a 100644
--- a/src/FbWinFrameTheme.hh
+++ b/src/FbWinFrameTheme.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbWinFrameTheme.hh,v 1.9 2003/08/25 16:37:50 fluxgen Exp $ 22// $Id: FbWinFrameTheme.hh,v 1.10 2003/08/27 17:52:08 fluxgen Exp $
23 23
24#ifndef FBWINFRAMETHEME_HH 24#ifndef FBWINFRAMETHEME_HH
25#define FBWINFRAMETHEME_HH 25#define FBWINFRAMETHEME_HH
@@ -30,6 +30,8 @@
30#include "FbTk/Color.hh" 30#include "FbTk/Color.hh"
31#include "FbTk/Theme.hh" 31#include "FbTk/Theme.hh"
32#include "FbTk/Subject.hh" 32#include "FbTk/Subject.hh"
33#include "FbTk/GContext.hh"
34
33#include "BorderTheme.hh" 35#include "BorderTheme.hh"
34#include "Shape.hh" 36#include "Shape.hh"
35 37
@@ -74,10 +76,10 @@ public:
74 76
75 FbTk::Justify justify() const { return *m_textjustify; } 77 FbTk::Justify justify() const { return *m_textjustify; }
76 78
77 GC labelTextFocusGC() const { return m_label_text_focus_gc; } 79 GC labelTextFocusGC() const { return m_label_text_focus_gc.gc(); }
78 GC labelTextUnfocusGC() const { return m_label_text_unfocus_gc; } 80 GC labelTextUnfocusGC() const { return m_label_text_unfocus_gc.gc(); }
79 GC buttonPicFocusGC() const { return m_button_pic_focus_gc; } 81 GC buttonPicFocusGC() const { return m_button_pic_focus_gc.gc(); }
80 GC buttonPicUnfocusGC() const { return m_button_pic_unfocus_gc; } 82 GC buttonPicUnfocusGC() const { return m_button_pic_unfocus_gc.gc(); }
81 83
82 bool fallback(FbTk::ThemeItem_base &item); 84 bool fallback(FbTk::ThemeItem_base &item);
83 void reconfigTheme(); 85 void reconfigTheme();
@@ -112,8 +114,8 @@ private:
112 FbTk::ThemeItem<int> m_alpha, m_title_height; 114 FbTk::ThemeItem<int> m_alpha, m_title_height;
113 BorderTheme m_border; 115 BorderTheme m_border;
114 116
115 GC m_label_text_focus_gc, m_label_text_unfocus_gc; 117 FbTk::GContext m_label_text_focus_gc, m_label_text_unfocus_gc;
116 GC m_button_pic_focus_gc, m_button_pic_unfocus_gc; 118 FbTk::GContext m_button_pic_focus_gc, m_button_pic_unfocus_gc;
117 119
118 FbTk::Subject m_theme_change; 120 FbTk::Subject m_theme_change;
119 121