aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-07-19 03:59:56 (GMT)
committerrathnor <rathnor>2003-07-19 03:59:56 (GMT)
commita827c24e36aa3cf42566fe44dde5848df7679d14 (patch)
treec92a16e1fa0eab7feb6c5f0caeee5b2e11460443 /src
parent2e3bd41f4e0e5d10c65888b277f944d75938fab8 (diff)
downloadfluxbox_pavel-a827c24e36aa3cf42566fe44dde5848df7679d14.zip
fluxbox_pavel-a827c24e36aa3cf42566fe44dde5848df7679d14.tar.bz2
fix alpha setting for menus when multiple screens by moving from static in menu
to part of MenuTheme
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/Menu.cc19
-rw-r--r--src/FbTk/Menu.hh9
-rw-r--r--src/FbTk/MenuTheme.cc6
-rw-r--r--src/FbTk/MenuTheme.hh8
-rw-r--r--src/Screen.cc6
5 files changed, 26 insertions, 22 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index c9943b3..3674ae1 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Menu.cc,v 1.28 2003/07/10 11:57:37 fluxgen Exp $ 25// $Id: Menu.cc,v 1.29 2003/07/19 03:59:56 rathnor Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -77,7 +77,6 @@ namespace FbTk {
77 77
78static Menu *shown = 0; 78static Menu *shown = 0;
79 79
80unsigned char Menu::s_alpha = 255;
81Menu *Menu::s_focused = 0; 80Menu *Menu::s_focused = 0;
82 81
83Menu::Menu(MenuTheme &tm, int screen_num, ImageControl &imgctrl): 82Menu::Menu(MenuTheme &tm, int screen_num, ImageControl &imgctrl):
@@ -92,7 +91,7 @@ Menu::Menu(MenuTheme &tm, int screen_num, ImageControl &imgctrl):
92 m_border_width(0), 91 m_border_width(0),
93 m_themeobserver(*this), 92 m_themeobserver(*this),
94 m_trans(new Transparent(getRootPixmap(screen_num), 0, 93 m_trans(new Transparent(getRootPixmap(screen_num), 0,
95 s_alpha, screen_num)), 94 tm.alpha(), screen_num)),
96 m_need_update(true) { 95 m_need_update(true) {
97 96
98 // make sure we get updated when the theme is reloaded 97 // make sure we get updated when the theme is reloaded
@@ -139,7 +138,7 @@ Menu::Menu(MenuTheme &tm, int screen_num, ImageControl &imgctrl):
139 138
140 m_root_pm = getRootPixmap(screen_num); 139 m_root_pm = getRootPixmap(screen_num);
141 m_trans->setSource(m_root_pm, screen_num); 140 m_trans->setSource(m_root_pm, screen_num);
142 m_trans->setAlpha(s_alpha); 141 m_trans->setAlpha(alpha());
143 142
144 //set attributes for menu window 143 //set attributes for menu window
145 unsigned long attrib_mask = CWOverrideRedirect | CWEventMask; 144 unsigned long attrib_mask = CWOverrideRedirect | CWEventMask;
@@ -952,8 +951,8 @@ void Menu::drawItem(unsigned int index, bool highlight, bool clear, bool render_
952 item_x, item_y, 951 item_x, item_y,
953 menu.item_w, menu.item_h, False); 952 menu.item_w, menu.item_h, False);
954 953
955 if (m_trans->alpha() != s_alpha) 954 if (m_trans->alpha() != alpha())
956 m_trans->setAlpha(s_alpha); 955 m_trans->setAlpha(alpha());
957 if (m_trans.get() && render_trans) { 956 if (m_trans.get() && render_trans) {
958 957
959 if (m_trans->alpha() != 255) { 958 if (m_trans->alpha() != 255) {
@@ -1338,8 +1337,8 @@ void Menu::reconfigure() {
1338 menu.window.setBorderWidth(m_border_width); 1337 menu.window.setBorderWidth(m_border_width);
1339 menu.title.setBorderWidth(m_border_width); 1338 menu.title.setBorderWidth(m_border_width);
1340 1339
1341 if (m_trans.get() && m_trans->alpha() != s_alpha) 1340 if (m_trans.get() && m_trans->alpha() != alpha())
1342 m_trans->setAlpha(s_alpha); 1341 m_trans->setAlpha(alpha());
1343 1342
1344 update(); 1343 update();
1345} 1344}
@@ -1348,8 +1347,8 @@ void Menu::renderTransFrame() {
1348 if (m_trans.get() == 0 || moving) 1347 if (m_trans.get() == 0 || moving)
1349 return; 1348 return;
1350 1349
1351 if (m_trans->alpha() != s_alpha) 1350 if (m_trans->alpha() != alpha())
1352 m_trans->setAlpha(s_alpha); 1351 m_trans->setAlpha(alpha());
1353 1352
1354 if (m_trans->alpha() != 255) { 1353 if (m_trans->alpha() != 255) {
1355 1354
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh
index 5ddd617..013c478 100644
--- a/src/FbTk/Menu.hh
+++ b/src/FbTk/Menu.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Menu.hh,v 1.18 2003/07/10 11:55:49 fluxgen Exp $ 25// $Id: Menu.hh,v 1.19 2003/07/19 03:59:56 rathnor Exp $
26 26
27#ifndef FBTK_MENU_HH 27#ifndef FBTK_MENU_HH
28#define FBTK_MENU_HH 28#define FBTK_MENU_HH
@@ -39,11 +39,11 @@
39#include "Observer.hh" 39#include "Observer.hh"
40#include "XLayerItem.hh" 40#include "XLayerItem.hh"
41#include "FbPixmap.hh" 41#include "FbPixmap.hh"
42#include "MenuTheme.hh"
42 43
43namespace FbTk { 44namespace FbTk {
44 45
45class MenuItem; 46class MenuItem;
46class MenuTheme;
47class ImageControl; 47class ImageControl;
48class Transparent; 48class Transparent;
49 49
@@ -95,8 +95,6 @@ public:
95 void disableTitle(); 95 void disableTitle();
96 void enableTitle(); 96 void enableTitle();
97 97
98 static void setAlpha(unsigned char alpha) { s_alpha = alpha; }
99
100 /** 98 /**
101 @name event handlers 99 @name event handlers
102 */ 100 */
@@ -153,7 +151,7 @@ public:
153 bool isItemSelected(unsigned int index) const; 151 bool isItemSelected(unsigned int index) const;
154 bool isItemEnabled(unsigned int index) const; 152 bool isItemEnabled(unsigned int index) const;
155 const MenuTheme &theme() const { return m_theme; } 153 const MenuTheme &theme() const { return m_theme; }
156 static unsigned char alpha() { return s_alpha; } 154 inline unsigned char alpha() const { return m_theme.alpha(); }
157 static Menu *focused() { return s_focused; } 155 static Menu *focused() { return s_focused; }
158 /// @return menuitem at index 156 /// @return menuitem at index
159 inline const MenuItem *find(unsigned int index) const { return menuitems[index]; } 157 inline const MenuItem *find(unsigned int index) const { return menuitems[index]; }
@@ -218,7 +216,6 @@ private:
218 ThemeObserver m_themeobserver; 216 ThemeObserver m_themeobserver;
219 std::auto_ptr<Transparent> m_trans; 217 std::auto_ptr<Transparent> m_trans;
220 Drawable m_root_pm; 218 Drawable m_root_pm;
221 static unsigned char s_alpha;
222 static Menu *s_focused; ///< holds current input focused menu, so one can determine if a menu is focused 219 static Menu *s_focused; ///< holds current input focused menu, so one can determine if a menu is focused
223 FbPixmap m_frame_pm; 220 FbPixmap m_frame_pm;
224 bool m_need_update; 221 bool m_need_update;
diff --git a/src/FbTk/MenuTheme.cc b/src/FbTk/MenuTheme.cc
index 640a408..7035dca 100644
--- a/src/FbTk/MenuTheme.cc
+++ b/src/FbTk/MenuTheme.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: MenuTheme.cc,v 1.7 2003/04/26 22:10:53 fluxgen Exp $ 22// $Id: MenuTheme.cc,v 1.8 2003/07/19 03:59:56 rathnor Exp $
23 23
24#include "MenuTheme.hh" 24#include "MenuTheme.hh"
25 25
@@ -51,7 +51,9 @@ MenuTheme::MenuTheme(int screen_num):
51 m_border_width(*this, "borderWidth", "BorderWidth"), 51 m_border_width(*this, "borderWidth", "BorderWidth"),
52 m_bevel_width(*this, "bevelWidth", "BevelWidth"), 52 m_bevel_width(*this, "bevelWidth", "BevelWidth"),
53 m_border_color(*this, "borderColor", "BorderColor"), 53 m_border_color(*this, "borderColor", "BorderColor"),
54 m_display(FbTk::App::instance()->display()) { 54 m_display(FbTk::App::instance()->display()),
55 m_alpha(255)
56{
55 57
56 Window rootwindow = RootWindow(m_display, screen_num); 58 Window rootwindow = RootWindow(m_display, screen_num);
57 59
diff --git a/src/FbTk/MenuTheme.hh b/src/FbTk/MenuTheme.hh
index b39b824..dd03910 100644
--- a/src/FbTk/MenuTheme.hh
+++ b/src/FbTk/MenuTheme.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: MenuTheme.hh,v 1.6 2003/05/04 21:01:43 fluxgen Exp $ 22// $Id: MenuTheme.hh,v 1.7 2003/07/19 03:59:56 rathnor Exp $
23 23
24#ifndef FBTK_MENUTHEME_HH 24#ifndef FBTK_MENUTHEME_HH
25#define FBTK_MENUTHEME_HH 25#define FBTK_MENUTHEME_HH
@@ -86,6 +86,10 @@ public:
86 86
87 unsigned int borderWidth() const { return *m_border_width; } 87 unsigned int borderWidth() const { return *m_border_width; }
88 unsigned int bevelWidth() const { return *m_bevel_width; } 88 unsigned int bevelWidth() const { return *m_bevel_width; }
89
90 inline unsigned char alpha() const { return m_alpha; }
91 void setAlpha(unsigned char alpha) { m_alpha = alpha; }
92
89 const FbTk::Color &borderColor() const { return *m_border_color; } 93 const FbTk::Color &borderColor() const { return *m_border_color; }
90 FbTk::Subject &themeChangeSig() { return m_theme_change_sig; } 94 FbTk::Subject &themeChangeSig() { return m_theme_change_sig; }
91 /// attach observer 95 /// attach observer
@@ -107,6 +111,8 @@ private:
107 Display *m_display; 111 Display *m_display;
108 GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc; 112 GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc;
109 FbTk::Subject m_theme_change_sig; 113 FbTk::Subject m_theme_change_sig;
114
115 unsigned char m_alpha;
110}; 116};
111 117
112}; // end namespace FbTk 118}; // end namespace FbTk
diff --git a/src/Screen.cc b/src/Screen.cc
index 64ce672..2e05b9c 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.203 2003/07/18 15:40:55 rathnor Exp $ 25// $Id: Screen.cc,v 1.204 2003/07/19 03:59:55 rathnor Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -341,7 +341,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
341 // load this screens resources 341 // load this screens resources
342 fluxbox->load_rc(*this); 342 fluxbox->load_rc(*this);
343 343
344 FbTk::Menu::setAlpha(*resource.menu_alpha); 344 m_menutheme->setAlpha(*resource.menu_alpha);
345 345
346 imageControl().setDither(*resource.image_dither); 346 imageControl().setDither(*resource.image_dither);
347 347
@@ -594,7 +594,7 @@ void BScreen::reconfigure() {
594#ifdef DEBUG 594#ifdef DEBUG
595 cerr<<__FILE__<<"("<<__LINE__<<"): BScreen::reconfigure"<<endl; 595 cerr<<__FILE__<<"("<<__LINE__<<"): BScreen::reconfigure"<<endl;
596#endif // DEBUG 596#endif // DEBUG
597 FbTk::Menu::setAlpha(*resource.menu_alpha); 597 m_menutheme->setAlpha(*resource.menu_alpha);
598 Fluxbox::instance()->loadRootCommand(*this); 598 Fluxbox::instance()->loadRootCommand(*this);
599 599
600 // setup windowtheme, toolbartheme for antialias 600 // setup windowtheme, toolbartheme for antialias