From fbc305ca80e352240b32b833e8388fb9aa99fa72 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Sun, 23 Dec 2007 13:33:10 -0800 Subject: added focused/unfocused borders to styles --- ChangeLog | 3 +++ src/Ewmh.cc | 4 ++-- src/FbWinFrame.cc | 18 ++++++++++++------ src/FbWinFrameTheme.cc | 14 +++++++++----- src/FbWinFrameTheme.hh | 4 ++-- src/FocusControl.cc | 2 +- src/Screen.cc | 8 ++++---- src/Window.cc | 4 ++-- 8 files changed, 35 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f39d79..b3bf7f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ (Format: Year/Month/Day) Changes for 1.0.1: +*07/12/23: + * Added new style items window.(un)focus.border{Width,Color} (Mark) + FbWinFrameTheme.cc/hh FbWinFrame.cc *07/12/21: * Added new key command :StartTabbing (Mark) Window.cc/hh CurrentWindowCmd.cc/hh diff --git a/src/Ewmh.cc b/src/Ewmh.cc index 6f0d829..0091981 100644 --- a/src/Ewmh.cc +++ b/src/Ewmh.cc @@ -811,8 +811,8 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, FbWinFrameTheme &theme = screen->winFrameTheme(); long title_h = theme.titleHeight() || theme.font().height() + 2*theme.bevelWidth() + 2; - title_h += theme.border().width(); - long handle_h = theme.handleWidth() + theme.border().width(); + title_h += theme.border(true).width(); + long handle_h = theme.handleWidth() + theme.border(true).width(); long extents[4]; // our frames currently don't protrude from left/right extents[0] = 0; diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 266ddea..e96b72f 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -127,7 +127,7 @@ bool FbWinFrame::setTabMode(TabMode tabmode) { if (tabmode == EXTERNAL) { m_label.show(); m_tab_container.setBorderWidth(m_window.borderWidth()); - m_tab_container.setBorderColor(theme().border().color()); + m_tab_container.setBorderColor(theme().border(m_focused).color()); m_tab_container.setEventMask( ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | ExposureMask | @@ -498,6 +498,12 @@ void FbWinFrame::setFocus(bool newvalue) { } } + if (m_decoration_mask & DECORM_BORDER && + (theme().border(true).width() != theme().border(false).width() || + theme().border(true).color().pixel() != + theme().border(false).color().pixel())) + setBorderWidth(theme().border(newvalue).width()); + applyAll(); clearAll(); } @@ -1487,21 +1493,21 @@ void FbWinFrame::setBorderWidth(unsigned int border_width) { bw_changes += static_cast(border_width - handle().borderWidth()); window().setBorderWidth(border_width); - window().setBorderColor(theme().border().color()); + window().setBorderColor(theme().border(m_focused).color()); setTabMode(NOTSET); titlebar().setBorderWidth(border_width); - titlebar().setBorderColor(theme().border().color()); + titlebar().setBorderColor(theme().border(m_focused).color()); handle().setBorderWidth(border_width); - handle().setBorderColor(theme().border().color()); + handle().setBorderColor(theme().border(m_focused).color()); gripLeft().setBorderWidth(border_width); - gripLeft().setBorderColor(theme().border().color()); + gripLeft().setBorderColor(theme().border(m_focused).color()); gripRight().setBorderWidth(border_width); - gripRight().setBorderColor(theme().border().color()); + gripRight().setBorderColor(theme().border(m_focused).color()); if (bw_changes != 0) resize(width(), height() + bw_changes); diff --git a/src/FbWinFrameTheme.cc b/src/FbWinFrameTheme.cc index 1175297..624c242 100644 --- a/src/FbWinFrameTheme.cc +++ b/src/FbWinFrameTheme.cc @@ -51,7 +51,8 @@ FbWinFrameTheme::FbWinFrameTheme(int screen_num): m_title_height(*this, "window.title.height", "Window.Title.Height"), m_bevel_width(*this, "window.bevelWidth", "Window.BevelWidth"), m_handle_width(*this, "window.handleWidth", "Window.handleWidth"), - m_border(*this, "window", "Window"), // for window.border* + m_border_focus(*this, "window.focus", "Window.Focus"), + m_border_unfocus(*this, "window.unfocus", "Window.Unfocus"), m_button_pic_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), m_button_pic_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), m_focused_alpha(255), @@ -83,10 +84,13 @@ FbWinFrameTheme::~FbWinFrameTheme() { } bool FbWinFrameTheme::fallback(FbTk::ThemeItem_base &item) { - if (item.name() == "window.borderWidth") - return FbTk::ThemeManager::instance().loadItem(item, "borderWidth", "BorderWidth"); - else if (item.name() == "window.borderColor") - return FbTk::ThemeManager::instance().loadItem(item, "borderColor", "BorderColor"); + if (item.name() == "window.focus.borderWidth" || + item.name() == "window.unfocus.borderWidth") + return FbTk::ThemeManager::instance().loadItem(item, "window.borderWidth", "Window.BorderWidth") || + FbTk::ThemeManager::instance().loadItem(item, "borderWidth", "BorderWidth"); + else if (item.name() == "window.focus.borderColor" || item.name() == "window.unfocus.borderColor") + return FbTk::ThemeManager::instance().loadItem(item, "window.borderColor", "Window.BorderColor") || + FbTk::ThemeManager::instance().loadItem(item, "borderColor", "BorderColor"); else if (item.name() == "window.bevelWidth") return FbTk::ThemeManager::instance().loadItem(item, "bevelWidth", "bevelWidth"); else if (item.name() == "window.handleWidth") diff --git a/src/FbWinFrameTheme.hh b/src/FbWinFrameTheme.hh index a48f8b6..c68c418 100644 --- a/src/FbWinFrameTheme.hh +++ b/src/FbWinFrameTheme.hh @@ -84,7 +84,7 @@ public: inline Cursor bottomSideCursor() const { return m_cursor_bottom_side; } inline Shape::ShapePlace shapePlace() const { return *m_shape_place; } - inline const BorderTheme &border() const { return m_border; } + inline const BorderTheme &border(bool focus) const { return (focus ? m_border_focus : m_border_unfocus); } unsigned int titleHeight() const { return *m_title_height; } unsigned int bevelWidth() const { return *m_bevel_width; } @@ -109,7 +109,7 @@ private: FbTk::ThemeItem m_shape_place; FbTk::ThemeItem m_title_height, m_bevel_width, m_handle_width; - BorderTheme m_border; + BorderTheme m_border_focus, m_border_unfocus; FbTk::GContext m_button_pic_focus_gc, m_button_pic_unfocus_gc; diff --git a/src/FocusControl.cc b/src/FocusControl.cc index ae5b5e3..426c026 100644 --- a/src/FocusControl.cc +++ b/src/FocusControl.cc @@ -306,7 +306,7 @@ void FocusControl::dirFocus(FluxboxWindow &win, FocusDir dir) { FluxboxWindow *foundwin = 0; int weight = 999999, exposure = 0; // extreme values - int borderW = m_screen.winFrameTheme().border().width(), + int borderW = win.frame().window().borderWidth(), top = win.y() + borderW, bottom = win.y() + win.height() + borderW, left = win.x() + borderW, diff --git a/src/Screen.cc b/src/Screen.cc index eab425b..4f42539 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -1943,8 +1943,8 @@ void BScreen::renderGeomWindow() { int geom_w = winFrameTheme().font().textWidth(label, strlen(label)) + winFrameTheme().bevelWidth()*2; m_geom_window.resize(geom_w, geom_h); - m_geom_window.setBorderWidth(winFrameTheme().border().width()); - m_geom_window.setBorderColor(winFrameTheme().border().color()); + m_geom_window.setBorderWidth(winFrameTheme().border(true).width()); + m_geom_window.setBorderColor(winFrameTheme().border(true).color()); Pixmap tmp = geom_pixmap; @@ -1981,8 +1981,8 @@ void BScreen::renderPosWindow() { int pos_w = winFrameTheme().font().textWidth("0:00000 x 0:00000", 17) + winFrameTheme().bevelWidth()*2; m_pos_window.resize(pos_w, pos_h); - m_pos_window.setBorderWidth(winFrameTheme().border().width()); - m_pos_window.setBorderColor(winFrameTheme().border().color()); + m_pos_window.setBorderWidth(winFrameTheme().border(true).width()); + m_pos_window.setBorderColor(winFrameTheme().border(true).color()); Pixmap tmp = pos_pixmap; diff --git a/src/Window.cc b/src/Window.cc index 54f6915..9b3c3ce 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -2981,7 +2981,7 @@ void FluxboxWindow::applyDecorations(bool initial) { unsigned int border_width = 0; if (decorations.border) - border_width = frame().theme().border().width(); + border_width = frame().theme().border(m_focused).width(); bool client_move = false; @@ -4032,7 +4032,7 @@ void FluxboxWindow::updateButtons() { void FluxboxWindow::reconfigTheme() { m_frame.setBorderWidth(decorations.border ? - frame().theme().border().width() : 0); + frame().theme().border(m_focused).width() : 0); if (decorations.handle && frame().theme().handleWidth() != 0) frame().showHandle(); else -- cgit v0.11.2