diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2011-02-22 21:07:39 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2011-02-22 21:07:39 (GMT) |
commit | d11aa42ace928efc3dd1eebc8988b6bbbc005b2b (patch) | |
tree | 0574ed4eaa5092386d3cf5440c636ea586baaebe /src/FbTk | |
parent | b7e84104a695bb3628e482c4be93f6f516e46e7d (diff) | |
download | fluxbox-d11aa42ace928efc3dd1eebc8988b6bbbc005b2b.zip fluxbox-d11aa42ace928efc3dd1eebc8988b6bbbc005b2b.tar.bz2 |
bugfix: consistent use of 'int' for alpha values (#3187373)
WindowMenuAccessor returned strange alpha values if compiled
with 'g++ -Os'; unholy black magic happens if template<int> faces
functions returning only 'usigned char'.
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/Container.cc | 2 | ||||
-rw-r--r-- | src/FbTk/Container.hh | 2 | ||||
-rw-r--r-- | src/FbTk/FbWindow.cc | 8 | ||||
-rw-r--r-- | src/FbTk/FbWindow.hh | 6 | ||||
-rw-r--r-- | src/FbTk/MenuTheme.hh | 4 | ||||
-rw-r--r-- | src/FbTk/Transparent.cc | 10 | ||||
-rw-r--r-- | src/FbTk/Transparent.hh | 8 |
7 files changed, 20 insertions, 20 deletions
diff --git a/src/FbTk/Container.cc b/src/FbTk/Container.cc index e1d2e07..b944c98 100644 --- a/src/FbTk/Container.cc +++ b/src/FbTk/Container.cc | |||
@@ -440,7 +440,7 @@ void Container::for_each(std::mem_fun_t<void, FbWindow> function) { | |||
440 | std::for_each(begin(), end(), function); | 440 | std::for_each(begin(), end(), function); |
441 | } | 441 | } |
442 | 442 | ||
443 | void Container::setAlpha(unsigned char alpha) { | 443 | void Container::setAlpha(int alpha) { |
444 | FbWindow::setAlpha(alpha); | 444 | FbWindow::setAlpha(alpha); |
445 | STLUtil::forAll(m_item_list, std::bind2nd(std::mem_fun(&Button::setAlpha), alpha)); | 445 | STLUtil::forAll(m_item_list, std::bind2nd(std::mem_fun(&Button::setAlpha), alpha)); |
446 | } | 446 | } |
diff --git a/src/FbTk/Container.hh b/src/FbTk/Container.hh index bd5e3aa..f3d9bac 100644 --- a/src/FbTk/Container.hh +++ b/src/FbTk/Container.hh | |||
@@ -91,7 +91,7 @@ public: | |||
91 | bool updateLock() const { return m_update_lock; } | 91 | bool updateLock() const { return m_update_lock; } |
92 | 92 | ||
93 | void for_each(std::mem_fun_t<void, FbWindow> function); | 93 | void for_each(std::mem_fun_t<void, FbWindow> function); |
94 | void setAlpha(unsigned char alpha); // set alpha on all windows | 94 | void setAlpha(int alpha); // set alpha on all windows |
95 | 95 | ||
96 | ItemList::iterator begin() { return m_item_list.begin(); } | 96 | ItemList::iterator begin() { return m_item_list.begin(); } |
97 | ItemList::iterator end() { return m_item_list.end(); } | 97 | ItemList::iterator end() { return m_item_list.end(); } |
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc index 5b52a03..00dde66 100644 --- a/src/FbTk/FbWindow.cc +++ b/src/FbTk/FbWindow.cc | |||
@@ -171,7 +171,7 @@ void FbWindow::invalidateBackground() { | |||
171 | 171 | ||
172 | void FbWindow::updateBackground(bool only_if_alpha) { | 172 | void FbWindow::updateBackground(bool only_if_alpha) { |
173 | Pixmap newbg = m_lastbg_pm; | 173 | Pixmap newbg = m_lastbg_pm; |
174 | unsigned char alpha = 255; | 174 | int alpha = 255; |
175 | bool free_newbg = false; | 175 | bool free_newbg = false; |
176 | 176 | ||
177 | if (m_lastbg_pm == None && !m_lastbg_color_set) | 177 | if (m_lastbg_pm == None && !m_lastbg_color_set) |
@@ -344,7 +344,7 @@ void FbWindow::updateTransparent(int the_x, int the_y, unsigned int the_width, u | |||
344 | #endif // HAVE_XRENDER | 344 | #endif // HAVE_XRENDER |
345 | } | 345 | } |
346 | 346 | ||
347 | void FbWindow::setAlpha(unsigned char alpha) { | 347 | void FbWindow::setAlpha(int alpha) { |
348 | #ifdef HAVE_XRENDER | 348 | #ifdef HAVE_XRENDER |
349 | if (FbTk::Transparent::haveComposite()) { | 349 | if (FbTk::Transparent::haveComposite()) { |
350 | if (m_transparent.get() != 0) { | 350 | if (m_transparent.get() != 0) { |
@@ -371,7 +371,7 @@ void FbWindow::setAlpha(unsigned char alpha) { | |||
371 | #endif // HAVE_XRENDER | 371 | #endif // HAVE_XRENDER |
372 | } | 372 | } |
373 | 373 | ||
374 | unsigned char FbWindow::alpha() const { | 374 | int FbWindow::alpha() const { |
375 | #ifdef HAVE_XRENDER | 375 | #ifdef HAVE_XRENDER |
376 | if (m_transparent.get()) | 376 | if (m_transparent.get()) |
377 | return m_transparent->alpha(); | 377 | return m_transparent->alpha(); |
@@ -588,7 +588,7 @@ long FbWindow::eventMask() const { | |||
588 | 588 | ||
589 | } | 589 | } |
590 | 590 | ||
591 | void FbWindow::setOpaque(unsigned char alpha) { | 591 | void FbWindow::setOpaque(int alpha) { |
592 | #ifdef HAVE_XRENDER | 592 | #ifdef HAVE_XRENDER |
593 | static Atom m_alphaatom = XInternAtom(display(), "_NET_WM_WINDOW_OPACITY", False); | 593 | static Atom m_alphaatom = XInternAtom(display(), "_NET_WM_WINDOW_OPACITY", False); |
594 | unsigned long opacity = alpha * 0x1010101; | 594 | unsigned long opacity = alpha * 0x1010101; |
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh index edeffe1..9e92923 100644 --- a/src/FbTk/FbWindow.hh +++ b/src/FbTk/FbWindow.hh | |||
@@ -88,7 +88,7 @@ public: | |||
88 | unsigned int height = 0, Pixmap dest_override = None, | 88 | unsigned int height = 0, Pixmap dest_override = None, |
89 | bool override_is_offset = false); | 89 | bool override_is_offset = false); |
90 | 90 | ||
91 | void setAlpha(unsigned char alpha); | 91 | void setAlpha(int alpha); |
92 | 92 | ||
93 | virtual FbWindow &operator = (const FbWindow &win); | 93 | virtual FbWindow &operator = (const FbWindow &win); |
94 | /// assign a new X window to this | 94 | /// assign a new X window to this |
@@ -176,7 +176,7 @@ public: | |||
176 | unsigned int borderWidth() const { return m_border_width; } | 176 | unsigned int borderWidth() const { return m_border_width; } |
177 | unsigned long borderColor() const { return m_border_color; } | 177 | unsigned long borderColor() const { return m_border_color; } |
178 | unsigned int depth() const { return m_depth; } | 178 | unsigned int depth() const { return m_depth; } |
179 | unsigned char alpha() const; | 179 | int alpha() const; |
180 | int screenNumber() const; | 180 | int screenNumber() const; |
181 | long eventMask() const; | 181 | long eventMask() const; |
182 | 182 | ||
@@ -188,7 +188,7 @@ public: | |||
188 | bool operator != (const FbWindow &win) const { return m_window != win.m_window; } | 188 | bool operator != (const FbWindow &win) const { return m_window != win.m_window; } |
189 | 189 | ||
190 | // used for composite | 190 | // used for composite |
191 | void setOpaque(unsigned char alpha); | 191 | void setOpaque(int alpha); |
192 | 192 | ||
193 | void setRenderer(FbWindowRenderer &renderer) { m_renderer = &renderer; } | 193 | void setRenderer(FbWindowRenderer &renderer) { m_renderer = &renderer; } |
194 | void sendConfigureNotify(int x, int y, unsigned int width, | 194 | void sendConfigureNotify(int x, int y, unsigned int width, |
diff --git a/src/FbTk/MenuTheme.hh b/src/FbTk/MenuTheme.hh index c10615b..eb19798 100644 --- a/src/FbTk/MenuTheme.hh +++ b/src/FbTk/MenuTheme.hh | |||
@@ -107,7 +107,7 @@ public: | |||
107 | unsigned int bevelWidth() const { return *m_bevel_width; } | 107 | unsigned int bevelWidth() const { return *m_bevel_width; } |
108 | 108 | ||
109 | unsigned char alpha() const { return m_alpha; } | 109 | unsigned char alpha() const { return m_alpha; } |
110 | void setAlpha(unsigned char alpha) { m_alpha = alpha; } | 110 | void setAlpha(int alpha) { m_alpha = alpha; } |
111 | // this isn't actually a theme item | 111 | // this isn't actually a theme item |
112 | // but we'll let it be here for now, until there's a better way to | 112 | // but we'll let it be here for now, until there's a better way to |
113 | // get resources into menu | 113 | // get resources into menu |
@@ -154,7 +154,7 @@ private: | |||
154 | Display *m_display; | 154 | Display *m_display; |
155 | GContext t_text_gc, f_text_gc, u_text_gc, h_text_gc, d_text_gc, hilite_gc; | 155 | GContext t_text_gc, f_text_gc, u_text_gc, h_text_gc, d_text_gc, hilite_gc; |
156 | 156 | ||
157 | unsigned char m_alpha; | 157 | int m_alpha; |
158 | unsigned int m_delay; ///< in msec | 158 | unsigned int m_delay; ///< in msec |
159 | unsigned int m_real_title_height; ///< the calculated item height (from font and menu.titleHeight) | 159 | unsigned int m_real_title_height; ///< the calculated item height (from font and menu.titleHeight) |
160 | unsigned int m_real_item_height; ///< the calculated item height (from font and menu.itemHeight) | 160 | unsigned int m_real_item_height; ///< the calculated item height (from font and menu.itemHeight) |
diff --git a/src/FbTk/Transparent.cc b/src/FbTk/Transparent.cc index bf8a110..04fee67 100644 --- a/src/FbTk/Transparent.cc +++ b/src/FbTk/Transparent.cc | |||
@@ -43,7 +43,7 @@ using std::endl; | |||
43 | 43 | ||
44 | namespace { | 44 | namespace { |
45 | #ifdef HAVE_XRENDER | 45 | #ifdef HAVE_XRENDER |
46 | Picture createAlphaPic(Window drawable, unsigned char alpha) { | 46 | Picture createAlphaPic(Window drawable, int alpha) { |
47 | Display *disp = FbTk::App::instance()->display(); | 47 | Display *disp = FbTk::App::instance()->display(); |
48 | _FB_USES_NLS; | 48 | _FB_USES_NLS; |
49 | 49 | ||
@@ -149,7 +149,7 @@ bool Transparent::haveComposite(bool for_real) { | |||
149 | return s_use_composite; | 149 | return s_use_composite; |
150 | } | 150 | } |
151 | 151 | ||
152 | Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int screen_num): | 152 | Transparent::Transparent(Drawable src, Drawable dest, int alpha, int screen_num): |
153 | m_alpha_pic(0), m_src_pic(0), m_dest_pic(0), | 153 | m_alpha_pic(0), m_src_pic(0), m_dest_pic(0), |
154 | m_source(src), m_dest(dest), m_alpha(alpha) { | 154 | m_source(src), m_dest(dest), m_alpha(alpha) { |
155 | 155 | ||
@@ -196,7 +196,7 @@ Transparent::~Transparent() { | |||
196 | #endif // HAVE_XRENDER | 196 | #endif // HAVE_XRENDER |
197 | } | 197 | } |
198 | 198 | ||
199 | void Transparent::setAlpha(unsigned char alpha) { | 199 | void Transparent::setAlpha(int alpha) { |
200 | if (m_source == 0 || !s_render) | 200 | if (m_source == 0 || !s_render) |
201 | return; | 201 | return; |
202 | 202 | ||
@@ -254,7 +254,7 @@ void Transparent::setSource(Drawable source, int screen_num) { | |||
254 | return; | 254 | return; |
255 | // save old alpha value so we can recreate new later | 255 | // save old alpha value so we can recreate new later |
256 | // with the same value | 256 | // with the same value |
257 | unsigned char old_alpha = m_alpha; | 257 | int old_alpha = m_alpha; |
258 | if (m_alpha_pic != 0) | 258 | if (m_alpha_pic != 0) |
259 | freeAlpha(); | 259 | freeAlpha(); |
260 | 260 | ||
@@ -314,7 +314,7 @@ void Transparent::render(int src_x, int src_y, | |||
314 | #endif // HAVE_XRENDER | 314 | #endif // HAVE_XRENDER |
315 | } | 315 | } |
316 | 316 | ||
317 | void Transparent::allocAlpha(unsigned char alpha) { | 317 | void Transparent::allocAlpha(int alpha) { |
318 | #ifdef HAVE_XRENDER | 318 | #ifdef HAVE_XRENDER |
319 | if (m_source == 0 || !s_render) | 319 | if (m_source == 0 || !s_render) |
320 | return; | 320 | return; |
diff --git a/src/FbTk/Transparent.hh b/src/FbTk/Transparent.hh index 154c223..8e9d9b9 100644 --- a/src/FbTk/Transparent.hh +++ b/src/FbTk/Transparent.hh | |||
@@ -29,10 +29,10 @@ namespace FbTk { | |||
29 | /// renders to drawable together with an alpha mask | 29 | /// renders to drawable together with an alpha mask |
30 | class Transparent { | 30 | class Transparent { |
31 | public: | 31 | public: |
32 | Transparent(Drawable source, Drawable dest, unsigned char alpha, int screen_num); | 32 | Transparent(Drawable source, Drawable dest, int alpha, int screen_num); |
33 | ~Transparent(); | 33 | ~Transparent(); |
34 | /// sets alpha value | 34 | /// sets alpha value |
35 | void setAlpha(unsigned char alpha); | 35 | void setAlpha(int alpha); |
36 | /// sets source drawable | 36 | /// sets source drawable |
37 | void setSource(Drawable src, int screen_num); | 37 | void setSource(Drawable src, int screen_num); |
38 | /// sets destination drawable | 38 | /// sets destination drawable |
@@ -45,7 +45,7 @@ public: | |||
45 | int dest_x, int dest_y, | 45 | int dest_x, int dest_y, |
46 | unsigned int width, unsigned int height) const; | 46 | unsigned int width, unsigned int height) const; |
47 | 47 | ||
48 | unsigned char alpha() const { return m_alpha; } | 48 | int alpha() const { return m_alpha; } |
49 | Drawable dest() const { return m_dest; } | 49 | Drawable dest() const { return m_dest; } |
50 | Drawable source() const { return m_source; } | 50 | Drawable source() const { return m_source; } |
51 | 51 | ||
@@ -55,7 +55,7 @@ public: | |||
55 | 55 | ||
56 | private: | 56 | private: |
57 | void freeAlpha(); | 57 | void freeAlpha(); |
58 | void allocAlpha(unsigned char newval); | 58 | void allocAlpha(int newval); |
59 | unsigned long m_alpha_pic; | 59 | unsigned long m_alpha_pic; |
60 | unsigned long m_src_pic; | 60 | unsigned long m_src_pic; |
61 | unsigned long m_dest_pic; | 61 | unsigned long m_dest_pic; |