summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2007-12-23 21:33:10 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2007-12-23 21:33:10 (GMT)
commitfbc305ca80e352240b32b833e8388fb9aa99fa72 (patch)
treeea1c7d2f66b8ede4209f7299a228f36f98086393
parent1b48b749b9a376c883ff4cc2ca3e807ac85cf21f (diff)
downloadfluxbox_lack-fbc305ca80e352240b32b833e8388fb9aa99fa72.zip
fluxbox_lack-fbc305ca80e352240b32b833e8388fb9aa99fa72.tar.bz2
added focused/unfocused borders to styles
-rw-r--r--ChangeLog3
-rw-r--r--src/Ewmh.cc4
-rw-r--r--src/FbWinFrame.cc18
-rw-r--r--src/FbWinFrameTheme.cc14
-rw-r--r--src/FbWinFrameTheme.hh4
-rw-r--r--src/FocusControl.cc2
-rw-r--r--src/Screen.cc8
-rw-r--r--src/Window.cc4
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 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.0.1: 2Changes for 1.0.1:
3*07/12/23:
4 * Added new style items window.(un)focus.border{Width,Color} (Mark)
5 FbWinFrameTheme.cc/hh FbWinFrame.cc
3*07/12/21: 6*07/12/21:
4 * Added new key command :StartTabbing (Mark) 7 * Added new key command :StartTabbing (Mark)
5 Window.cc/hh CurrentWindowCmd.cc/hh 8 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,
811 FbWinFrameTheme &theme = screen->winFrameTheme(); 811 FbWinFrameTheme &theme = screen->winFrameTheme();
812 long title_h = theme.titleHeight() || 812 long title_h = theme.titleHeight() ||
813 theme.font().height() + 2*theme.bevelWidth() + 2; 813 theme.font().height() + 2*theme.bevelWidth() + 2;
814 title_h += theme.border().width(); 814 title_h += theme.border(true).width();
815 long handle_h = theme.handleWidth() + theme.border().width(); 815 long handle_h = theme.handleWidth() + theme.border(true).width();
816 long extents[4]; 816 long extents[4];
817 // our frames currently don't protrude from left/right 817 // our frames currently don't protrude from left/right
818 extents[0] = 0; 818 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) {
127 if (tabmode == EXTERNAL) { 127 if (tabmode == EXTERNAL) {
128 m_label.show(); 128 m_label.show();
129 m_tab_container.setBorderWidth(m_window.borderWidth()); 129 m_tab_container.setBorderWidth(m_window.borderWidth());
130 m_tab_container.setBorderColor(theme().border().color()); 130 m_tab_container.setBorderColor(theme().border(m_focused).color());
131 m_tab_container.setEventMask( 131 m_tab_container.setEventMask(
132 ButtonPressMask | ButtonReleaseMask | 132 ButtonPressMask | ButtonReleaseMask |
133 ButtonMotionMask | ExposureMask | 133 ButtonMotionMask | ExposureMask |
@@ -498,6 +498,12 @@ void FbWinFrame::setFocus(bool newvalue) {
498 } 498 }
499 } 499 }
500 500
501 if (m_decoration_mask & DECORM_BORDER &&
502 (theme().border(true).width() != theme().border(false).width() ||
503 theme().border(true).color().pixel() !=
504 theme().border(false).color().pixel()))
505 setBorderWidth(theme().border(newvalue).width());
506
501 applyAll(); 507 applyAll();
502 clearAll(); 508 clearAll();
503} 509}
@@ -1487,21 +1493,21 @@ void FbWinFrame::setBorderWidth(unsigned int border_width) {
1487 bw_changes += static_cast<signed>(border_width - handle().borderWidth()); 1493 bw_changes += static_cast<signed>(border_width - handle().borderWidth());
1488 1494
1489 window().setBorderWidth(border_width); 1495 window().setBorderWidth(border_width);
1490 window().setBorderColor(theme().border().color()); 1496 window().setBorderColor(theme().border(m_focused).color());
1491 1497
1492 setTabMode(NOTSET); 1498 setTabMode(NOTSET);
1493 1499
1494 titlebar().setBorderWidth(border_width); 1500 titlebar().setBorderWidth(border_width);
1495 titlebar().setBorderColor(theme().border().color()); 1501 titlebar().setBorderColor(theme().border(m_focused).color());
1496 1502
1497 handle().setBorderWidth(border_width); 1503 handle().setBorderWidth(border_width);
1498 handle().setBorderColor(theme().border().color()); 1504 handle().setBorderColor(theme().border(m_focused).color());
1499 1505
1500 gripLeft().setBorderWidth(border_width); 1506 gripLeft().setBorderWidth(border_width);
1501 gripLeft().setBorderColor(theme().border().color()); 1507 gripLeft().setBorderColor(theme().border(m_focused).color());
1502 1508
1503 gripRight().setBorderWidth(border_width); 1509 gripRight().setBorderWidth(border_width);
1504 gripRight().setBorderColor(theme().border().color()); 1510 gripRight().setBorderColor(theme().border(m_focused).color());
1505 1511
1506 if (bw_changes != 0) 1512 if (bw_changes != 0)
1507 resize(width(), height() + bw_changes); 1513 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):
51 m_title_height(*this, "window.title.height", "Window.Title.Height"), 51 m_title_height(*this, "window.title.height", "Window.Title.Height"),
52 m_bevel_width(*this, "window.bevelWidth", "Window.BevelWidth"), 52 m_bevel_width(*this, "window.bevelWidth", "Window.BevelWidth"),
53 m_handle_width(*this, "window.handleWidth", "Window.handleWidth"), 53 m_handle_width(*this, "window.handleWidth", "Window.handleWidth"),
54 m_border(*this, "window", "Window"), // for window.border* 54 m_border_focus(*this, "window.focus", "Window.Focus"),
55 m_border_unfocus(*this, "window.unfocus", "Window.Unfocus"),
55 m_button_pic_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), 56 m_button_pic_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
56 m_button_pic_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), 57 m_button_pic_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
57 m_focused_alpha(255), 58 m_focused_alpha(255),
@@ -83,10 +84,13 @@ FbWinFrameTheme::~FbWinFrameTheme() {
83} 84}
84 85
85bool FbWinFrameTheme::fallback(FbTk::ThemeItem_base &item) { 86bool FbWinFrameTheme::fallback(FbTk::ThemeItem_base &item) {
86 if (item.name() == "window.borderWidth") 87 if (item.name() == "window.focus.borderWidth" ||
87 return FbTk::ThemeManager::instance().loadItem(item, "borderWidth", "BorderWidth"); 88 item.name() == "window.unfocus.borderWidth")
88 else if (item.name() == "window.borderColor") 89 return FbTk::ThemeManager::instance().loadItem(item, "window.borderWidth", "Window.BorderWidth") ||
89 return FbTk::ThemeManager::instance().loadItem(item, "borderColor", "BorderColor"); 90 FbTk::ThemeManager::instance().loadItem(item, "borderWidth", "BorderWidth");
91 else if (item.name() == "window.focus.borderColor" || item.name() == "window.unfocus.borderColor")
92 return FbTk::ThemeManager::instance().loadItem(item, "window.borderColor", "Window.BorderColor") ||
93 FbTk::ThemeManager::instance().loadItem(item, "borderColor", "BorderColor");
90 else if (item.name() == "window.bevelWidth") 94 else if (item.name() == "window.bevelWidth")
91 return FbTk::ThemeManager::instance().loadItem(item, "bevelWidth", "bevelWidth"); 95 return FbTk::ThemeManager::instance().loadItem(item, "bevelWidth", "bevelWidth");
92 else if (item.name() == "window.handleWidth") 96 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:
84 inline Cursor bottomSideCursor() const { return m_cursor_bottom_side; } 84 inline Cursor bottomSideCursor() const { return m_cursor_bottom_side; }
85 85
86 inline Shape::ShapePlace shapePlace() const { return *m_shape_place; } 86 inline Shape::ShapePlace shapePlace() const { return *m_shape_place; }
87 inline const BorderTheme &border() const { return m_border; } 87 inline const BorderTheme &border(bool focus) const { return (focus ? m_border_focus : m_border_unfocus); }
88 88
89 unsigned int titleHeight() const { return *m_title_height; } 89 unsigned int titleHeight() const { return *m_title_height; }
90 unsigned int bevelWidth() const { return *m_bevel_width; } 90 unsigned int bevelWidth() const { return *m_bevel_width; }
@@ -109,7 +109,7 @@ private:
109 FbTk::ThemeItem<Shape::ShapePlace> m_shape_place; 109 FbTk::ThemeItem<Shape::ShapePlace> m_shape_place;
110 110
111 FbTk::ThemeItem<int> m_title_height, m_bevel_width, m_handle_width; 111 FbTk::ThemeItem<int> m_title_height, m_bevel_width, m_handle_width;
112 BorderTheme m_border; 112 BorderTheme m_border_focus, m_border_unfocus;
113 113
114 FbTk::GContext m_button_pic_focus_gc, m_button_pic_unfocus_gc; 114 FbTk::GContext m_button_pic_focus_gc, m_button_pic_unfocus_gc;
115 115
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) {
306 306
307 FluxboxWindow *foundwin = 0; 307 FluxboxWindow *foundwin = 0;
308 int weight = 999999, exposure = 0; // extreme values 308 int weight = 999999, exposure = 0; // extreme values
309 int borderW = m_screen.winFrameTheme().border().width(), 309 int borderW = win.frame().window().borderWidth(),
310 top = win.y() + borderW, 310 top = win.y() + borderW,
311 bottom = win.y() + win.height() + borderW, 311 bottom = win.y() + win.height() + borderW,
312 left = win.x() + borderW, 312 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() {
1943 int geom_w = winFrameTheme().font().textWidth(label, strlen(label)) + winFrameTheme().bevelWidth()*2; 1943 int geom_w = winFrameTheme().font().textWidth(label, strlen(label)) + winFrameTheme().bevelWidth()*2;
1944 m_geom_window.resize(geom_w, geom_h); 1944 m_geom_window.resize(geom_w, geom_h);
1945 1945
1946 m_geom_window.setBorderWidth(winFrameTheme().border().width()); 1946 m_geom_window.setBorderWidth(winFrameTheme().border(true).width());
1947 m_geom_window.setBorderColor(winFrameTheme().border().color()); 1947 m_geom_window.setBorderColor(winFrameTheme().border(true).color());
1948 1948
1949 1949
1950 Pixmap tmp = geom_pixmap; 1950 Pixmap tmp = geom_pixmap;
@@ -1981,8 +1981,8 @@ void BScreen::renderPosWindow() {
1981 int pos_w = winFrameTheme().font().textWidth("0:00000 x 0:00000", 17) + winFrameTheme().bevelWidth()*2; 1981 int pos_w = winFrameTheme().font().textWidth("0:00000 x 0:00000", 17) + winFrameTheme().bevelWidth()*2;
1982 m_pos_window.resize(pos_w, pos_h); 1982 m_pos_window.resize(pos_w, pos_h);
1983 1983
1984 m_pos_window.setBorderWidth(winFrameTheme().border().width()); 1984 m_pos_window.setBorderWidth(winFrameTheme().border(true).width());
1985 m_pos_window.setBorderColor(winFrameTheme().border().color()); 1985 m_pos_window.setBorderColor(winFrameTheme().border(true).color());
1986 1986
1987 1987
1988 Pixmap tmp = pos_pixmap; 1988 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) {
2981 2981
2982 unsigned int border_width = 0; 2982 unsigned int border_width = 0;
2983 if (decorations.border) 2983 if (decorations.border)
2984 border_width = frame().theme().border().width(); 2984 border_width = frame().theme().border(m_focused).width();
2985 2985
2986 bool client_move = false; 2986 bool client_move = false;
2987 2987
@@ -4032,7 +4032,7 @@ void FluxboxWindow::updateButtons() {
4032void FluxboxWindow::reconfigTheme() { 4032void FluxboxWindow::reconfigTheme() {
4033 4033
4034 m_frame.setBorderWidth(decorations.border ? 4034 m_frame.setBorderWidth(decorations.border ?
4035 frame().theme().border().width() : 0); 4035 frame().theme().border(m_focused).width() : 0);
4036 if (decorations.handle && frame().theme().handleWidth() != 0) 4036 if (decorations.handle && frame().theme().handleWidth() != 0)
4037 frame().showHandle(); 4037 frame().showHandle();
4038 else 4038 else