all repos — fluxbox @ 6914d00eb772705ee9e2cced1629ac5938361cfe

custom fork of the fluxbox windowmanager

toolbar transparency
rathnor rathnor
commit

6914d00eb772705ee9e2cced1629ac5938361cfe

parent

9475d7bc8226e58a86dd90f01c56c6e0e96a4969

M ChangeLogChangeLog

@@ -1,5 +1,9 @@

(Format: Year/Month/Day) Changes for 0.9.8: +*04/01/14: + * Implement transparency for toolbar (Simon) + - can use toolbar.alpha, as well as toolbar.<tool>.alpha + ToolTheme.hh/cc IconbarTheme.hh/cc *Tool.cc Container.cc Toolbar.cc *04/01/11: * Fixed ImageControl cache problem (Henrik) ImageControl.hh/cc
M src/ButtonTool.ccsrc/ButtonTool.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: ButtonTool.cc,v 1.2 2003/12/07 16:39:43 fluxgen Exp $ +// $Id: ButtonTool.cc,v 1.3 2004/01/13 14:41:32 rathnor Exp $ #include "ButtonTool.hh"

@@ -54,6 +54,7 @@

btn.setGC(static_cast<const ButtonTheme &>(theme()).gc()); btn.setBorderColor(theme().border().color()); btn.setBorderWidth(theme().border().width()); + btn.setAlpha(theme().alpha()); Pixmap old_pm = m_cache_pm; if (!theme().texture().usePixmap()) {

@@ -81,5 +82,6 @@ if (old_pm)

m_image_ctrl.removeImage(old_pm); btn.clear(); + btn.updateTransparent(); }
M src/ClockTool.ccsrc/ClockTool.cc

@@ -20,7 +20,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: ClockTool.cc,v 1.9 2003/12/19 18:26:48 fluxgen Exp $ +// $Id: ClockTool.cc,v 1.10 2004/01/13 14:41:32 rathnor Exp $ #include "ClockTool.hh"

@@ -240,6 +240,7 @@ #endif // HAVE_STRFTIME

} m_button.clear(); + m_button.updateTransparent(); } void ClockTool::renderTheme() {

@@ -258,5 +259,7 @@

m_button.setJustify(m_theme.justify()); m_button.setBorderWidth(m_theme.border().width()); m_button.setBorderColor(m_theme.border().color()); + m_button.setAlpha(m_theme.alpha()); m_button.clear(); + m_button.updateTransparent(); }
M src/Container.ccsrc/Container.cc

@@ -20,7 +20,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: Container.cc,v 1.10 2003/12/21 16:12:19 rathnor Exp $ +// $Id: Container.cc,v 1.11 2004/01/13 14:41:32 rathnor Exp $ #include "Container.hh"

@@ -130,8 +130,10 @@

void Container::removeAll() { m_selected = 0; m_item_list.clear(); - if (!m_update_lock) + if (!m_update_lock) { clear(); + updateTransparent(); + } }

@@ -158,8 +160,10 @@ ItemList::iterator it = m_item_list.begin();

for (; pos != 0; --pos, ++it) continue; m_selected = *it; - if (m_selected) + if (m_selected) { m_selected->clear(); + m_selected->updateTransparent(); + } } }

@@ -173,8 +177,10 @@ m_align = a;

} void Container::exposeEvent(XExposeEvent &event) { - if (!m_update_lock) + if (!m_update_lock) { clearArea(event.x, event.y, event.width, event.height); + updateTransparent(event.x, event.y, event.width, event.height); + } } void Container::repositionItems() {

@@ -212,6 +218,7 @@ -borderW,

max_width_per_client + extra, height()); (*it)->clear(); + (*it)->updateTransparent(); } }
M src/GenericTool.ccsrc/GenericTool.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: GenericTool.cc,v 1.2 2003/10/26 20:11:27 fluxgen Exp $ +// $Id: GenericTool.cc,v 1.3 2004/01/13 14:41:32 rathnor Exp $ #include "GenericTool.hh" #include "FbTk/FbWindow.hh"

@@ -78,7 +78,9 @@ }

void GenericTool::renderTheme() { + m_window->setAlpha(theme().alpha()); m_window->clear(); + m_window->updateTransparent(); } void GenericTool::update(FbTk::Subject *subj) {
M src/IconbarTheme.ccsrc/IconbarTheme.cc

@@ -20,7 +20,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: IconbarTheme.cc,v 1.7 2003/08/29 00:48:41 fluxgen Exp $ +// $Id: IconbarTheme.cc,v 1.8 2004/01/13 14:41:32 rathnor Exp $ #include "IconbarTheme.hh" #include "FbTk/App.hh"

@@ -37,7 +37,8 @@ m_unfocused_border(*this, name + ".unfocused", altname + ".Unfocused"),

m_border(*this, name, altname), m_focused_text(*this, name + ".focused", altname + ".Focused"), m_unfocused_text(*this, name + ".unfocused", altname + ".Unfocused"), - m_name(name) { + m_name(name), + m_alpha(*this, name+".alpha", altname+".Alpha") { FbTk::ThemeManager::instance().loadTheme(*this);

@@ -103,9 +104,11 @@ else if (item.name() == m_name + ".focused.textColor") {

return tm.loadItem(item, "window.label.focus.textColor", "Window.Label.Focus.TextColor"); - } else if (item.name() == m_name + ".unfocused.textColor") + } else if (item.name() == m_name + ".unfocused.textColor") { return tm.loadItem(item, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor"); - + } else if (item.name() == m_name + ".alpha") { + return tm.loadItem(item, "toolbar.alpha", "Toolbar.Alpha"); + } return false; }
M src/IconbarTheme.hhsrc/IconbarTheme.hh

@@ -20,7 +20,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: IconbarTheme.hh,v 1.5 2003/08/19 21:26:45 fluxgen Exp $ +// $Id: IconbarTheme.hh,v 1.6 2004/01/13 14:41:32 rathnor Exp $ #ifndef ICONBARTHEME_HH #define ICONBARTHEME_HH

@@ -51,12 +51,14 @@

const FbTk::Texture &focusedTexture() const { return *m_focused_texture; } const FbTk::Texture &unfocusedTexture() const { return *m_unfocused_texture; } const FbTk::Texture &emptyTexture() const { return *m_empty_texture; } + inline unsigned char alpha() const { return *m_alpha; } private: FbTk::ThemeItem<FbTk::Texture> m_focused_texture, m_unfocused_texture, m_empty_texture; BorderTheme m_focused_border, m_unfocused_border, m_border; TextTheme m_focused_text, m_unfocused_text; std::string m_name; + FbTk::ThemeItem<int> m_alpha; }; #endif // ICONBARTHEME_HH
M src/IconbarTool.ccsrc/IconbarTool.cc

@@ -20,7 +20,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: IconbarTool.cc,v 1.28 2004/01/10 01:19:13 rathnor Exp $ +// $Id: IconbarTool.cc,v 1.29 2004/01/13 14:41:32 rathnor Exp $ #include "IconbarTool.hh"

@@ -576,6 +576,7 @@ m_screen.imageControl().removeImage(tmp);

m_icon_container.setBorderWidth(m_theme.border().width()); m_icon_container.setBorderColor(m_theme.border().color()); + m_icon_container.setAlpha(m_theme.alpha()); // update buttons IconList::iterator icon_it = m_icon_list.begin();

@@ -587,6 +588,7 @@

void IconbarTool::renderButton(IconButton &button) { button.setPixmap(*m_rc_use_pixmap); + button.setAlpha(m_theme.alpha()); // if we're rendering a button, there must be a back button. // The last button is always the regular width

@@ -628,6 +630,7 @@ button.setBorderColor(m_theme.unfocusedBorder().color());

} button.clear(); + button.updateTransparent(); } void IconbarTool::deleteIcons() {
M src/ToolTheme.ccsrc/ToolTheme.cc

@@ -20,7 +20,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: ToolTheme.cc,v 1.4 2003/08/29 00:46:18 fluxgen Exp $ +// $Id: ToolTheme.cc,v 1.5 2004/01/13 14:41:32 rathnor Exp $ #include "ToolTheme.hh"

@@ -28,7 +28,8 @@ ToolTheme::ToolTheme(int screen_num, const std::string &name, const std::string &altname):

FbTk::Theme(screen_num), TextTheme(*this, name, altname), m_texture(*this, name, altname), - m_border(*this, name, altname) { + m_border(*this, name, altname), + m_alpha(*this, name+".alpha", altname+".Alpha") { }

@@ -46,6 +47,10 @@ if (item.name().find(".justify") != std::string::npos) {

return FbTk::ThemeManager::instance().loadItem(item, "toolbar.justify", "Toolbar.Justify"); + } else if (item.name().find(".alpha") != std::string::npos) { + return FbTk::ThemeManager::instance().loadItem(item, + "toolbar.alpha", + "Toolbar.Alpha"); } return false;
M src/ToolTheme.hhsrc/ToolTheme.hh

@@ -20,7 +20,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: ToolTheme.hh,v 1.4 2003/08/29 00:45:41 fluxgen Exp $ +// $Id: ToolTheme.hh,v 1.5 2004/01/13 14:41:32 rathnor Exp $ #ifndef TOOLTHEME_HH #define TOOLTHEME_HH

@@ -34,6 +34,8 @@

#include <X11/Xlib.h> #include <string> +class ToolbarTheme; + /// Handles toolbar item theme for text and texture class ToolTheme: public FbTk::Theme, public TextTheme { public:

@@ -46,6 +48,7 @@ void reconfigTheme();

// textures const FbTk::Texture &texture() const { return *m_texture; } const BorderTheme &border() const { return m_border; } + inline unsigned char alpha() const { return *m_alpha; } protected: FbTk::ThemeItem<FbTk::Texture> &textureTheme() { return m_texture; }

@@ -53,6 +56,7 @@

private: FbTk::ThemeItem<FbTk::Texture> m_texture; BorderTheme m_border; + FbTk::ThemeItem<int> m_alpha; }; #endif // TOOLTHEME_HH
M src/Toolbar.ccsrc/Toolbar.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: Toolbar.cc,v 1.135 2004/01/11 16:08:57 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.136 2004/01/13 14:41:32 rathnor Exp $ #include "Toolbar.hh"

@@ -450,7 +450,9 @@ screen().imageControl().removeImage(tmp);

frame.window.setBorderColor(theme().border().color()); frame.window.setBorderWidth(theme().border().width()); + frame.window.setAlpha(theme().alpha()); frame.window.clear(); + frame.window.updateTransparent(); if (theme().shape() && m_shape.get()) m_shape->update();

@@ -543,6 +545,8 @@ void Toolbar::exposeEvent(XExposeEvent &ee) {

if (ee.window == frame.window) { frame.window.clearArea(ee.x, ee.y, ee.width, ee.height); + frame.window.updateTransparent(ee.x, ee.y, + ee.width, ee.height); } }

@@ -920,6 +924,7 @@ }

// unlock m_resize_lock = false; frame.window.clear(); + frame.window.updateTransparent(); }
M src/WorkspaceNameTool.ccsrc/WorkspaceNameTool.cc

@@ -20,7 +20,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: WorkspaceNameTool.cc,v 1.6 2003/12/07 16:39:43 fluxgen Exp $ +// $Id: WorkspaceNameTool.cc,v 1.7 2004/01/13 14:41:32 rathnor Exp $ #include "WorkspaceNameTool.hh"

@@ -123,5 +123,7 @@

m_button.setJustify(m_theme.justify()); m_button.setBorderWidth(m_theme.border().width()); m_button.setBorderColor(m_theme.border().color()); + m_button.setAlpha(m_theme.alpha()); m_button.clear(); + m_button.updateTransparent(); }