all repos — fluxbox @ 94e2c89053325beeb9f79d2e682adf614f636ca8

custom fork of the fluxbox windowmanager

make "force pseudotransparency" menu item work immediately
markt markt
commit

94e2c89053325beeb9f79d2e682adf614f636ca8

parent

8db2d4f26eae2d608e864aabf6218ad461c4da6b

M ChangeLogChangeLog

@@ -1,6 +1,10 @@

(Format: Year/Month/Day) Changes for 1.0rc3: *07/01/06: + * Changing session.forcePseudotransparency no longer requires restart, + also a little code cleanup in FbTk/Transparent.cc/hh + (Mark) + Slit.cc Menu.cc Toolbar.cc FbWinFrame.cc fluxbox.cc * Move triangle drawing into a generic function in FbDrawable (Simon) Make submenu triangles in MenuItems proportional to the icon size (alternate implementation of sf.net patch #1526813)
M src/FbTk/Menu.ccsrc/FbTk/Menu.cc

@@ -1099,13 +1099,17 @@

void Menu::reconfigure() { - if (FbTk::Transparent::haveComposite()) + if (FbTk::Transparent::haveComposite()) { menu.window.setOpaque(alpha()); + menu.title.setAlpha(255); + menu.frame.setAlpha(255); + } else { + menu.window.setOpaque(255); + menu.title.setAlpha(alpha()); + menu.frame.setAlpha(alpha()); + } m_need_update = true; // redraw items - - menu.title.setAlpha(alpha()); - menu.frame.setAlpha(alpha()); menu.window.setBorderColor(theme().borderColor()); menu.title.setBorderColor(theme().borderColor());
M src/FbTk/Transparent.ccsrc/FbTk/Transparent.cc

@@ -112,6 +112,7 @@

bool Transparent::s_init = false; bool Transparent::s_render = false; bool Transparent::s_composite = false; +bool Transparent::s_use_composite = false; void Transparent::init() { Display *disp = FbTk::App::instance()->display();

@@ -119,48 +120,35 @@

int major_opcode, first_event, first_error; if (XQueryExtension(disp, "RENDER", &major_opcode, - &first_event, &first_error) == False) { - s_render = false; - s_composite = false; - } else { // we have RENDER support + &first_event, &first_error)) { + // we have XRENDER support s_render = true; if (XQueryExtension(disp, "Composite", &major_opcode, - &first_event, &first_error) == False) { - s_composite = false; - } else { // we have Composite support + &first_event, &first_error)) { + // we have Composite support s_composite = true; + s_use_composite = true; } } s_init = true; } -void Transparent::usePseudoTransparent(bool no_composite) { - if (s_composite != no_composite) - return; - - s_init = false; - init(); // only use render if we have it - - if (no_composite) - s_composite = false; +void Transparent::usePseudoTransparent(bool force) { + if (!s_init) + init(); + s_use_composite = (!force && s_composite); } bool Transparent::haveComposite(bool for_real) { - if (for_real) { - Display *disp = FbTk::App::instance()->display(); - int major_opcode, first_event, first_error; + if (!s_init) + init(); - return (XQueryExtension(disp, "Composite", - &major_opcode, - &first_event, &first_error) == True); - } else { - if (!s_init) - init(); - + if (for_real) return s_composite; - } + else + return s_use_composite; } Transparent::Transparent(Drawable src, Drawable dest, unsigned char alpha, int screen_num):
M src/FbTk/Transparent.hhsrc/FbTk/Transparent.hh

@@ -53,7 +53,7 @@ Drawable source() const { return m_source; }

static bool haveComposite(bool for_real = false); static bool haveRender() { if (!s_init) init(); return s_render; } - static void usePseudoTransparent(bool no_composite); + static void usePseudoTransparent(bool force); private: void freeAlpha();

@@ -67,6 +67,7 @@

static bool s_init; static bool s_render; ///< wheter we have RENDER support static bool s_composite; ///< wheter we have Composite support + static bool s_use_composite; ///< whether or not to use Composite static void init(); };
M src/FbWinFrame.ccsrc/FbWinFrame.cc

@@ -508,9 +508,11 @@

if (FbTk::Transparent::haveRender() && theme().focusedAlpha() != theme().unfocusedAlpha()) { unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha()); if (FbTk::Transparent::haveComposite()) { + m_tab_container.setAlpha(255); m_window.setOpaque(alpha); } else { m_tab_container.setAlpha(alpha); + m_window.setOpaque(255); } }

@@ -521,9 +523,7 @@ else // unfocused

applyActiveLabel(*m_current_label); } - applyTitlebar(); - applyHandles(); - applyTabContainer(); + applyAll(); clearAll(); }

@@ -1053,6 +1053,18 @@ move(grav_x + x(), grav_y + y());

// render the theme if (isVisible()) { + // update transparency settings + if (FbTk::Transparent::haveRender()) { + unsigned char alpha = + (m_focused ? theme().focusedAlpha() : theme().unfocusedAlpha()); + if (FbTk::Transparent::haveComposite()) { + m_tab_container.setAlpha(255); + m_window.setOpaque(alpha); + } else { + m_tab_container.setAlpha(alpha); + m_window.setOpaque(255); + } + } renderAll(); applyAll(); clearAll();

@@ -1390,13 +1402,6 @@ applyButton(*m_buttons_right[i]);

} void FbWinFrame::init() { - - if (FbTk::Transparent::haveComposite()) { - if (m_focused) - m_window.setOpaque(theme().focusedAlpha()); - else - m_window.setOpaque(theme().unfocusedAlpha()); - } if (theme().handleWidth() == 0) m_use_handle = false;
M src/Slit.ccsrc/Slit.cc

@@ -707,10 +707,13 @@

if (tmp) image_ctrl.removeImage(tmp); + // could have changed types, so we must set both if (FbTk::Transparent::haveComposite()) { + frame.window.setAlpha(255); frame.window.setOpaque(*m_rc_alpha); } else { frame.window.setAlpha(*m_rc_alpha); + frame.window.setOpaque(255); } // reposition clears the bg reposition();
M src/Toolbar.ccsrc/Toolbar.cc

@@ -477,9 +477,12 @@ frame.window.setBorderColor(theme().border().color());

frame.window.setBorderWidth(theme().border().width()); bool have_composite = FbTk::Transparent::haveComposite(); + // have_composite could have changed, so we need to change both if (have_composite) { frame.window.setOpaque(alpha()); + frame.window.setAlpha(255); } else { + frame.window.setOpaque(255); frame.window.setAlpha(alpha()); } frame.window.clear();
M src/fluxbox.ccsrc/fluxbox.cc

@@ -1569,8 +1569,7 @@

if (m_rc_menufile->empty()) m_rc_menufile.setDefaultValue(); - if (FbTk::Transparent::haveComposite()) - FbTk::Transparent::usePseudoTransparent(*m_rc_pseudotrans); + FbTk::Transparent::usePseudoTransparent(*m_rc_pseudotrans); if (!m_rc_slitlistfile->empty()) { *m_rc_slitlistfile = StringUtil::expandFilename(*m_rc_slitlistfile);

@@ -1669,6 +1668,8 @@ }

void Fluxbox::real_reconfigure() { + + FbTk::Transparent::usePseudoTransparent(*m_rc_pseudotrans); ScreenList::iterator screen_it = m_screen_list.begin(); ScreenList::iterator screen_it_end = m_screen_list.end();