all repos — fluxbox @ a827c24e36aa3cf42566fe44dde5848df7679d14

custom fork of the fluxbox windowmanager

fix alpha setting for menus when multiple screens by moving from static in menu
to part of MenuTheme
rathnor rathnor
commit

a827c24e36aa3cf42566fe44dde5848df7679d14

parent

2e3bd41f4e0e5d10c65888b277f944d75938fab8

7 files changed, 34 insertions(+), 25 deletions(-)

jump to
M BUGSBUGS

@@ -5,9 +5,6 @@

* Remember menu sometimes isn't present in window menu. Probably need to add a signal for menu reconfigures (Screen::setupWindowActions) - * MenuAlpha (at least) isn't 'per-screen' - takes the value of the - highest numbered screen. - * Window handle is invisible sometimes. * KDE support needs attention (e.g. klipper).

@@ -74,3 +71,8 @@ value on init. Also check why Fluxbox::Layer is used rather than int.

=> Fixed by reorganising the way ResourceManager works. Fluxbox::Layer is used so that we can give some layers names + * MenuAlpha (at least) isn't 'per-screen' - takes the value of the + highest numbered screen. + => Fixed, moved alpha setting into MenuTheme rather than static value + +
M ChangeLogChangeLog

@@ -1,6 +1,9 @@

(Format: Year/Month/Day) Changes for 0.9.5: *03/07/19: + * Move menu alpha setting into MenuTheme (Simon) + - fixes alpha init on multi-screened machines + MenuTheme.hh/cc Menu.hh/cc Screen.cc * Add compiled-in defaults to fluxbox -info (thanks Matt Hope) main.cc * Redo ResourceManager so that it loads resources on registration, and
M src/FbTk/Menu.ccsrc/FbTk/Menu.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.cc,v 1.28 2003/07/10 11:57:37 fluxgen Exp $ +// $Id: Menu.cc,v 1.29 2003/07/19 03:59:56 rathnor Exp $ //use GNU extensions #ifndef _GNU_SOURCE

@@ -77,7 +77,6 @@ namespace FbTk {

static Menu *shown = 0; -unsigned char Menu::s_alpha = 255; Menu *Menu::s_focused = 0; Menu::Menu(MenuTheme &tm, int screen_num, ImageControl &imgctrl):

@@ -92,7 +91,7 @@ m_alignment(ALIGNDONTCARE),

m_border_width(0), m_themeobserver(*this), m_trans(new Transparent(getRootPixmap(screen_num), 0, - s_alpha, screen_num)), + tm.alpha(), screen_num)), m_need_update(true) { // make sure we get updated when the theme is reloaded

@@ -139,7 +138,7 @@ menu.height = menu.title_h + 2 + menu.frame_h;

m_root_pm = getRootPixmap(screen_num); m_trans->setSource(m_root_pm, screen_num); - m_trans->setAlpha(s_alpha); + m_trans->setAlpha(alpha()); //set attributes for menu window unsigned long attrib_mask = CWOverrideRedirect | CWEventMask;

@@ -952,8 +951,8 @@ XClearArea(m_display, menu.frame.window(),

item_x, item_y, menu.item_w, menu.item_h, False); - if (m_trans->alpha() != s_alpha) - m_trans->setAlpha(s_alpha); + if (m_trans->alpha() != alpha()) + m_trans->setAlpha(alpha()); if (m_trans.get() && render_trans) { if (m_trans->alpha() != 255) {

@@ -1338,8 +1337,8 @@

menu.window.setBorderWidth(m_border_width); menu.title.setBorderWidth(m_border_width); - if (m_trans.get() && m_trans->alpha() != s_alpha) - m_trans->setAlpha(s_alpha); + if (m_trans.get() && m_trans->alpha() != alpha()) + m_trans->setAlpha(alpha()); update(); }

@@ -1348,8 +1347,8 @@ void Menu::renderTransFrame() {

if (m_trans.get() == 0 || moving) return; - if (m_trans->alpha() != s_alpha) - m_trans->setAlpha(s_alpha); + if (m_trans->alpha() != alpha()) + m_trans->setAlpha(alpha()); if (m_trans->alpha() != 255) {
M src/FbTk/Menu.hhsrc/FbTk/Menu.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.hh,v 1.18 2003/07/10 11:55:49 fluxgen Exp $ +// $Id: Menu.hh,v 1.19 2003/07/19 03:59:56 rathnor Exp $ #ifndef FBTK_MENU_HH #define FBTK_MENU_HH

@@ -39,11 +39,11 @@ #include "Command.hh"

#include "Observer.hh" #include "XLayerItem.hh" #include "FbPixmap.hh" +#include "MenuTheme.hh" namespace FbTk { class MenuItem; -class MenuTheme; class ImageControl; class Transparent;

@@ -95,8 +95,6 @@

void disableTitle(); void enableTitle(); - static void setAlpha(unsigned char alpha) { s_alpha = alpha; } - /** @name event handlers */

@@ -153,7 +151,7 @@ bool hasSubmenu(unsigned int index) const;

bool isItemSelected(unsigned int index) const; bool isItemEnabled(unsigned int index) const; const MenuTheme &theme() const { return m_theme; } - static unsigned char alpha() { return s_alpha; } + inline unsigned char alpha() const { return m_theme.alpha(); } static Menu *focused() { return s_focused; } /// @return menuitem at index inline const MenuItem *find(unsigned int index) const { return menuitems[index]; }

@@ -218,7 +216,6 @@

ThemeObserver m_themeobserver; std::auto_ptr<Transparent> m_trans; Drawable m_root_pm; - static unsigned char s_alpha; static Menu *s_focused; ///< holds current input focused menu, so one can determine if a menu is focused FbPixmap m_frame_pm; bool m_need_update;
M src/FbTk/MenuTheme.ccsrc/FbTk/MenuTheme.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: MenuTheme.cc,v 1.7 2003/04/26 22:10:53 fluxgen Exp $ +// $Id: MenuTheme.cc,v 1.8 2003/07/19 03:59:56 rathnor Exp $ #include "MenuTheme.hh"

@@ -51,7 +51,9 @@ m_bullet(*this, "menu.bullet", "Menu.Bullet"),

m_border_width(*this, "borderWidth", "BorderWidth"), m_bevel_width(*this, "bevelWidth", "BevelWidth"), m_border_color(*this, "borderColor", "BorderColor"), - m_display(FbTk::App::instance()->display()) { + m_display(FbTk::App::instance()->display()), + m_alpha(255) +{ Window rootwindow = RootWindow(m_display, screen_num);
M src/FbTk/MenuTheme.hhsrc/FbTk/MenuTheme.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: MenuTheme.hh,v 1.6 2003/05/04 21:01:43 fluxgen Exp $ +// $Id: MenuTheme.hh,v 1.7 2003/07/19 03:59:56 rathnor Exp $ #ifndef FBTK_MENUTHEME_HH #define FBTK_MENUTHEME_HH

@@ -86,6 +86,10 @@ FbTk::Justify bulletPos() const { return *bullet_pos; }

unsigned int borderWidth() const { return *m_border_width; } unsigned int bevelWidth() const { return *m_bevel_width; } + + inline unsigned char alpha() const { return m_alpha; } + void setAlpha(unsigned char alpha) { m_alpha = alpha; } + const FbTk::Color &borderColor() const { return *m_border_color; } FbTk::Subject &themeChangeSig() { return m_theme_change_sig; } /// attach observer

@@ -107,6 +111,8 @@

Display *m_display; GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc; FbTk::Subject m_theme_change_sig; + + unsigned char m_alpha; }; }; // end namespace FbTk
M src/Screen.ccsrc/Screen.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.203 2003/07/18 15:40:55 rathnor Exp $ +// $Id: Screen.cc,v 1.204 2003/07/19 03:59:55 rathnor Exp $ #include "Screen.hh"

@@ -341,7 +341,7 @@

// load this screens resources fluxbox->load_rc(*this); - FbTk::Menu::setAlpha(*resource.menu_alpha); + m_menutheme->setAlpha(*resource.menu_alpha); imageControl().setDither(*resource.image_dither);

@@ -594,7 +594,7 @@ void BScreen::reconfigure() {

#ifdef DEBUG cerr<<__FILE__<<"("<<__LINE__<<"): BScreen::reconfigure"<<endl; #endif // DEBUG - FbTk::Menu::setAlpha(*resource.menu_alpha); + m_menutheme->setAlpha(*resource.menu_alpha); Fluxbox::instance()->loadRootCommand(*this); // setup windowtheme, toolbartheme for antialias