all repos — fluxbox @ 15b41a3c35992c61abba76a21cf3731b066a898e

custom fork of the fluxbox windowmanager

add window.label.active theme items
rathnor rathnor
commit

15b41a3c35992c61abba76a21cf3731b066a898e

parent

d84054ec5d1678f055bb90f2bf21d5709b385fdd

6 files changed, 94 insertions(+), 30 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,5 +1,12 @@

(Format: Year/Month/Day) Changes for 0.9.7: +*03/12/09: + * New theme items: (Simon) + window.label.active: <texture> + window.label.active.textColor: <color> + For highlighting the active (visible) tab when not in focus. + - fixes bug with unfocused windows not getting unfocus.textColor + FbWinFrame.hh/cc FbWinFrameTheme.hh/cc *03/12/08: * fbsetbg now remembers -u option and it also has (Han) a new -U option which does the same thing without remembering
M src/FbWinFrame.ccsrc/FbWinFrame.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: FbWinFrame.cc,v 1.63 2003/12/07 16:39:43 fluxgen Exp $ +// $Id: FbWinFrame.cc,v 1.64 2003/12/09 08:48:08 rathnor Exp $ #include "FbWinFrame.hh"

@@ -235,7 +235,7 @@ if (currentLabel()) {

if (newvalue) // focused renderButtonFocus(*m_current_label); else // unfocused - renderButtonUnfocus(*m_current_label); + renderButtonActive(*m_current_label); } renderTitlebar();

@@ -287,6 +287,9 @@ if (found_it != m_labelbuttons.end())

return; m_labelbuttons.push_back(&btn); + + if (currentLabel() == 0) + setLabelButtonFocus(btn); } void FbWinFrame::removeLabelButton(FbTk::TextButton &btn) {

@@ -355,7 +358,10 @@ renderButtonUnfocus(*m_current_label);

m_current_label = *it; // current focused button - renderButtonFocus(*m_current_label); + if (m_focused) + renderButtonFocus(*m_current_label); + else + renderButtonActive(*m_current_label); } void FbWinFrame::setClientWindow(FbTk::FbWindow &win) {

@@ -688,6 +694,7 @@ if (m_shape.get())

m_shape->update(); // titlebar stuff rendered already by reconftitlebar + } void FbWinFrame::setUseShape(bool value) {

@@ -833,6 +840,11 @@ render(m_theme.labelUnfocusTexture(), m_label_unfocused_color,

m_label_unfocused_pm, m_label.width(), m_label.height()); + render(m_theme.labelActiveTexture(), m_label_active_color, + m_label_active_pm, + m_label.width(), m_label.height()); + + // finaly set up pixmaps for titlebar windows Pixmap label_pm = None; Pixmap title_pm = None;

@@ -973,7 +985,7 @@ m_handle.showSubwindows();

// clear pixmaps m_title_focused_pm = m_title_unfocused_pm = 0; - m_label_focused_pm = m_label_unfocused_pm = 0; + m_label_focused_pm = m_label_unfocused_pm = m_label_active_pm = 0; m_handle_focused_pm = m_handle_unfocused_pm = 0; m_button_pm = m_button_unfocused_pm = m_button_pressed_pm = 0; m_grip_unfocused_pm = m_grip_focused_pm = 0;

@@ -1049,19 +1061,21 @@ else

title_color = m_title_focused_color; } else { - getUnfocusPixmap(label_pm, title_pm, - label_color, title_color); + getActiveLabelPixmap(label_pm, title_pm, + label_color, title_color); } } -void FbWinFrame::getUnfocusPixmap(Pixmap &label_pm, Pixmap &title_pm, +// only called if not focused +void FbWinFrame::getActiveLabelPixmap(Pixmap &label_pm, Pixmap &title_pm, FbTk::Color &label_color, FbTk::Color &title_color) { - if (m_label_unfocused_pm != 0) { - label_pm = m_label_unfocused_pm; - } else - label_color = m_label_unfocused_color; + + if (m_label_active_pm != 0) + label_pm = m_label_active_pm; + else + label_color = m_label_active_color; if (m_title_unfocused_pm != 0) title_pm = m_title_unfocused_pm;

@@ -1081,9 +1095,12 @@

LabelList::iterator btn_it = m_labelbuttons.begin(); LabelList::iterator btn_it_end = m_labelbuttons.end(); for (; btn_it != btn_it_end; ++btn_it) { - if (*btn_it == m_current_label) - renderButtonFocus(**btn_it); - else + if (*btn_it == m_current_label) { + if (m_focused) + renderButtonFocus(**btn_it); + else + renderButtonActive(**btn_it); + } else renderButtonUnfocus(**btn_it); }

@@ -1136,15 +1153,34 @@ button.setAlpha(theme().alpha());

if (m_label_focused_pm != 0) { // already set - if (button.backgroundPixmap() == m_label_focused_pm) - return; - button.setBackgroundPixmap(m_label_focused_pm); + if (button.backgroundPixmap() != m_label_focused_pm) + button.setBackgroundPixmap(m_label_focused_pm); } else button.setBackgroundColor(m_label_focused_color); button.clear(); } +void FbWinFrame::renderButtonActive(FbTk::TextButton &button) { + + button.setGC(theme().labelTextActiveGC()); + button.setJustify(theme().justify()); + button.setBorderWidth(1); + button.setAlpha(theme().alpha()); + + if (m_label_active_pm == 0) + m_label_active_pm = m_label_unfocused_pm; + + if (m_label_active_pm != 0) { + // already set + if (button.backgroundPixmap() != m_label_active_pm) + button.setBackgroundPixmap(m_label_active_pm); + } else + button.setBackgroundColor(m_label_active_color); + + button.clear(); +} + void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) { button.setGC(theme().labelTextUnfocusGC());

@@ -1154,9 +1190,8 @@ button.setAlpha(theme().alpha());

if (m_label_unfocused_pm != 0) { // already set - if (button.backgroundPixmap() == m_label_unfocused_pm) - return; - button.setBackgroundPixmap(m_label_unfocused_pm); + if (button.backgroundPixmap() != m_label_unfocused_pm) + button.setBackgroundPixmap(m_label_unfocused_pm); } else button.setBackgroundColor(m_label_unfocused_color);
M src/FbWinFrame.hhsrc/FbWinFrame.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: FbWinFrame.hh,v 1.24 2003/10/28 02:17:02 rathnor Exp $ +// $Id: FbWinFrame.hh,v 1.25 2003/12/09 08:48:08 rathnor Exp $ #ifndef FBWINFRAME_HH #define FBWINFRAME_HH

@@ -197,14 +197,18 @@ //@{

void renderTitlebar(); void renderHandles(); void renderButtons(); + // focused => has focus void renderButtonFocus(FbTk::TextButton &button); + // unfocus => has no focus, label not the active one void renderButtonUnfocus(FbTk::TextButton &button); + // active => doesn't have keybaord focus, but is the active tab + void renderButtonActive(FbTk::TextButton &button); void renderLabel(); /// renders to pixmap or sets color void render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm, unsigned int width, unsigned int height); - void getUnfocusPixmap(Pixmap &label_pm, Pixmap &title_pm, - FbTk::Color &label_color, FbTk::Color &title_color); + void getActiveLabelPixmap(Pixmap &label_pm, Pixmap &title_pm, + FbTk::Color &label_color, FbTk::Color &title_color); void getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm, FbTk::Color &label_color, FbTk::Color &title_color); void renderLabelButtons();

@@ -256,6 +260,8 @@ Pixmap m_label_focused_pm; ///< pixmap for focused label

FbTk::Color m_label_focused_color; ///< color for focused label Pixmap m_label_unfocused_pm; ///< pixmap for unfocused label FbTk::Color m_label_unfocused_color; ///< color for unfocued label + Pixmap m_label_active_pm; ///< pixmap for active label + FbTk::Color m_label_active_color; ///< color for active label FbTk::Color m_handle_focused_color, m_handle_unfocused_color; Pixmap m_handle_focused_pm, m_handle_unfocused_pm;
M src/FbWinFrameTheme.ccsrc/FbWinFrameTheme.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: FbWinFrameTheme.cc,v 1.13 2003/09/29 12:53:58 rathnor Exp $ +// $Id: FbWinFrameTheme.cc,v 1.14 2003/12/09 08:48:08 rathnor Exp $ #include "FbWinFrameTheme.hh" #include "App.hh"

@@ -27,11 +27,13 @@

#include <X11/cursorfont.h> #include <iostream> +using namespace std; FbWinFrameTheme::FbWinFrameTheme(int screen_num): FbTk::Theme(screen_num), m_label_focus(*this, "window.label.focus", "Window.Label.Focus"), m_label_unfocus(*this, "window.label.unfocus", "Window.Label.Unfocus"), + m_label_active(*this, "window.label.active", "Window.Label.Active"), m_title_focus(*this, "window.title.focus", "Window.Title.Focus"), m_title_unfocus(*this, "window.title.unfocus", "Window.Title.Unfocus"),

@@ -48,6 +50,7 @@ m_grip_unfocus(*this, "window.grip.unfocus", "Window.Grip.Unfocus"),

m_label_focus_color(*this, "window.label.focus.textColor", "Window.Label.Focus.TextColor"), m_label_unfocus_color(*this, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor"), + m_label_active_color(*this, "window.label.active.textColor", "Window.Label.Active.TextColor"), m_frame_focus_color(*this, "window.frame.focusColor", "Window.Frame.FocusColor"), m_frame_unfocus_color(*this, "window.frame.unfocusColor", "Window.Frame.UnfocusColor"),

@@ -65,6 +68,7 @@ m_handle_width(*this, "window.handleWidth", "Window.handleWidth"),

m_border(*this, "window", "Window"), // for window.border* m_label_text_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), m_label_text_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), + m_label_text_active_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), m_button_pic_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), m_button_pic_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)) {

@@ -80,6 +84,8 @@ m_cursor_lower_left_angle = XCreateFontCursor(disp, XC_ll_angle);

m_cursor_lower_right_angle = XCreateFontCursor(disp, XC_lr_angle); m_cursor_upper_right_angle = XCreateFontCursor(disp, XC_ur_angle); m_cursor_upper_left_angle = XCreateFontCursor(disp, XC_ul_angle); + + reconfigTheme(); } FbWinFrameTheme::~FbWinFrameTheme() {

@@ -95,6 +101,11 @@ else if (item.name() == "window.bevelWidth")

return FbTk::ThemeManager::instance().loadItem(item, "bevelWidth", "bevelWidth"); else if (item.name() == "window.handleWidth") return FbTk::ThemeManager::instance().loadItem(item, "handleWidth", "HandleWidth"); + else if (item.name() == "window.label.active") + return FbTk::ThemeManager::instance().loadItem(item, "window.label.unfocus", "Window.Label.Unfocus"); + else if (item.name() == "window.label.active.textColor") + return FbTk::ThemeManager::instance().loadItem(item, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor"); + return false; }

@@ -117,6 +128,7 @@ *m_handle_width = 1;

m_label_text_focus_gc.setForeground(*m_label_focus_color); m_label_text_unfocus_gc.setForeground(*m_label_unfocus_color); + m_label_text_active_gc.setForeground(*m_label_active_color); m_button_pic_focus_gc.setForeground(*m_button_focus_color); m_button_pic_unfocus_gc.setForeground(*m_button_unfocus_color);
M src/FbWinFrameTheme.hhsrc/FbWinFrameTheme.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: FbWinFrameTheme.hh,v 1.12 2003/09/29 12:53:58 rathnor Exp $ +// $Id: FbWinFrameTheme.hh,v 1.13 2003/12/09 08:48:08 rathnor Exp $ #ifndef FBWINFRAMETHEME_HH #define FBWINFRAMETHEME_HH

@@ -45,6 +45,7 @@ */

//@{ const FbTk::Texture &labelFocusTexture() const { return *m_label_focus; } const FbTk::Texture &labelUnfocusTexture() const { return *m_label_unfocus; } + const FbTk::Texture &labelActiveTexture() const { return *m_label_active; } const FbTk::Texture &titleFocusTexture() const { return *m_title_focus; } const FbTk::Texture &titleUnfocusTexture() const { return *m_title_unfocus; }

@@ -66,6 +67,8 @@ */

//@{ const FbTk::Color &labelFocusColor() const { return *m_label_focus_color; } const FbTk::Color &labelUnfocusColor() const { return *m_label_unfocus_color; } + const FbTk::Color &labelActiveColor() const { return *m_label_active_color; } + const FbTk::Color &frameFocuscolor() const { return *m_frame_focus_color; } const FbTk::Color &frameUnfocuscolor() const { return *m_frame_unfocus_color; } const FbTk::Color &buttonFocuscolor() const { return *m_button_focus_color; }

@@ -78,6 +81,7 @@ FbTk::Justify justify() const { return *m_textjustify; }

GC labelTextFocusGC() const { return m_label_text_focus_gc.gc(); } GC labelTextUnfocusGC() const { return m_label_text_unfocus_gc.gc(); } + GC labelTextActiveGC() const { return m_label_text_active_gc.gc(); } GC buttonPicFocusGC() const { return m_button_pic_focus_gc.gc(); } GC buttonPicUnfocusGC() const { return m_button_pic_unfocus_gc.gc(); }

@@ -102,13 +106,13 @@ unsigned int bevelWidth() const { return *m_bevel_width; }

unsigned int handleWidth() const { return *m_handle_width; } private: - FbTk::ThemeItem<FbTk::Texture> m_label_focus, m_label_unfocus; + FbTk::ThemeItem<FbTk::Texture> m_label_focus, m_label_unfocus, m_label_active; FbTk::ThemeItem<FbTk::Texture> m_title_focus, m_title_unfocus; FbTk::ThemeItem<FbTk::Texture> m_handle_focus, m_handle_unfocus; FbTk::ThemeItem<FbTk::Texture> m_button_focus, m_button_unfocus, m_button_pressed; FbTk::ThemeItem<FbTk::Texture> m_grip_focus, m_grip_unfocus; - FbTk::ThemeItem<FbTk::Color> m_label_focus_color, m_label_unfocus_color; + FbTk::ThemeItem<FbTk::Color> m_label_focus_color, m_label_unfocus_color, m_label_active_color; FbTk::ThemeItem<FbTk::Color> m_frame_focus_color, m_frame_unfocus_color; FbTk::ThemeItem<FbTk::Color> m_button_focus_color, m_button_unfocus_color;

@@ -119,7 +123,7 @@

FbTk::ThemeItem<int> m_alpha, m_title_height, m_bevel_width, m_handle_width; BorderTheme m_border; - FbTk::GContext m_label_text_focus_gc, m_label_text_unfocus_gc; + FbTk::GContext m_label_text_focus_gc, m_label_text_unfocus_gc, m_label_text_active_gc; FbTk::GContext m_button_pic_focus_gc, m_button_pic_unfocus_gc; FbTk::Subject m_theme_change;
M src/main.ccsrc/main.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: main.cc,v 1.24 2003/10/02 16:14:41 rathnor Exp $ +// $Id: main.cc,v 1.25 2003/12/09 08:48:08 rathnor Exp $ #include "fluxbox.hh" #include "I18n.hh"

@@ -181,7 +181,7 @@ cout<<"Fluxbox "<<__fluxbox_version<<" : (c) 2001-2003 Henrik Kinnunen "<<endl<<endl;

exit(0); } else if (strcmp(argv[i], "-log") == 0 ) { if (i + 1 >= argc) { - cerr<<"error: '-log' need an argument"<<endl; + cerr<<"error: '-log' needs an argument"<<endl; exit(1); } log_filename = argv[++i];