added focused/unfocused borders to styles
This commit is contained in:
parent
1b48b749b9
commit
fbc305ca80
8 changed files with 35 additions and 22 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<signed>(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);
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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<Shape::ShapePlace> m_shape_place;
|
||||
|
||||
FbTk::ThemeItem<int> 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;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue