switch FbWinFrameTheme to use FocusableTheme
@@ -50,8 +50,8 @@
CommandDialog::CommandDialog(BScreen &screen, const string &title, const string precommand) : FbTk::FbWindow(screen.rootWindow().screenNumber(), 0, 0, 200, 1, ExposureMask), - m_textbox(*this, screen.winFrameTheme()->font(), ""), - m_label(*this, screen.winFrameTheme()->font(), title), + m_textbox(*this, screen.focusedWinFrameTheme()->font(), ""), + m_label(*this, screen.focusedWinFrameTheme()->font(), title), m_gc(m_textbox), m_screen(screen), m_move_x(0),@@ -190,12 +190,12 @@ }
void CommandDialog::render() { Pixmap tmp = m_pixmap; - if (!m_screen.winFrameTheme()->focusedIconbarTheme().texture().usePixmap()) { - m_label.setBackgroundColor(m_screen.winFrameTheme()->focusedIconbarTheme().texture().color()); + if (!m_screen.focusedWinFrameTheme()->iconbarTheme().texture().usePixmap()) { + m_label.setBackgroundColor(m_screen.focusedWinFrameTheme()->iconbarTheme().texture().color()); m_pixmap = 0; } else { m_pixmap = m_screen.imageControl().renderImage(m_label.width(), m_label.height(), - m_screen.winFrameTheme()->focusedIconbarTheme().texture()); + m_screen.focusedWinFrameTheme()->iconbarTheme().texture()); m_label.setBackgroundPixmap(m_pixmap); }@@ -210,7 +210,7 @@
// setup label // we listen to motion notify too m_label.setEventMask(m_label.eventMask() | ButtonPressMask | ButtonMotionMask); - m_label.setGC(m_screen.winFrameTheme()->focusedIconbarTheme().text().textGC()); + m_label.setGC(m_screen.focusedWinFrameTheme()->iconbarTheme().text().textGC()); m_label.show(); // setup text box
@@ -974,8 +974,8 @@ return true;
} else if (ce.message_type == m_net->request_frame_extents) { if (!screen) return true; - FbTk::ThemeProxy<FbWinFrameTheme> &theme = screen->winFrameTheme(); - unsigned int bw = theme->border(true).width(); + FbTk::ThemeProxy<FbWinFrameTheme> &theme = screen->focusedWinFrameTheme(); + unsigned int bw = theme->border().width(); long title_h = theme->titleHeight() || theme->font().height() + 2*theme->bevelWidth() + 2 + 2*bw; long handle_h = theme->handleWidth() + 2*bw;
@@ -28,9 +28,10 @@ #include "FbTk/SimpleCommand.hh"
#include "FbTk/Compose.hh" #include "FbTk/Transparent.hh" #include "FbTk/CompareEqual.hh" + #include "FbWinFrameTheme.hh" #include "Screen.hh" - +#include "FocusableTheme.hh" #include "IconButton.hh" #include <algorithm>@@ -40,7 +41,7 @@ using std::mem_fun;
using std::string; FbWinFrame::FbWinFrame(BScreen &screen, - FbTk::ThemeProxy<FbWinFrameTheme> &theme, + FocusableTheme<FbWinFrameTheme> &theme, FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, int x, int y,@@ -90,8 +91,8 @@ m_need_render(true),
m_button_size(1), m_height_before_shade(1), m_shaded(false), - m_focused_alpha(AlphaAcc(*theme, &FbWinFrameTheme::focusedAlpha)), - m_unfocused_alpha(AlphaAcc(*theme, &FbWinFrameTheme::unfocusedAlpha)), + m_focused_alpha(AlphaAcc(*theme.focusedTheme(), &FbWinFrameTheme::alpha)), + m_unfocused_alpha(AlphaAcc(*theme.unfocusedTheme(), &FbWinFrameTheme::alpha)), m_shape(m_window, theme->shapePlace()), m_disable_themeshape(false) { init();@@ -119,7 +120,7 @@ // reparent tab container
if (tabmode == EXTERNAL) { m_label.show(); m_tab_container.setBorderWidth(m_window.borderWidth()); - m_tab_container.setBorderColor(theme()->border(m_focused).color()); + m_tab_container.setBorderColor(theme()->border().color()); m_tab_container.setEventMask( ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | ExposureMask |@@ -486,10 +487,11 @@ }
} 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()); + (theme().focusedTheme()->border().width() != + theme().unfocusedTheme()->border().width() || + theme().focusedTheme()->border().color().pixel() != + theme().unfocusedTheme()->border().color().pixel())) + setBorderWidth(theme()->border().width()); applyAll(); clearAll();@@ -1125,22 +1127,22 @@ return;
} // render pixmaps - render(theme()->titleFocusTexture(), m_title_focused_color, + render(theme().focusedTheme()->titleTexture(), m_title_focused_color, m_title_focused_pm, m_titlebar.width(), m_titlebar.height()); - render(theme()->titleUnfocusTexture(), m_title_unfocused_color, + render(theme().unfocusedTheme()->titleTexture(), m_title_unfocused_color, m_title_unfocused_pm, m_titlebar.width(), m_titlebar.height()); //!! TODO: don't render label if internal tabs - render(theme()->focusedIconbarTheme()->texture(), m_label_focused_color, - m_label_focused_pm, + render(theme().focusedTheme()->iconbarTheme()->texture(), + m_label_focused_color, m_label_focused_pm, m_label.width(), m_label.height()); - render(theme()->unfocusedIconbarTheme()->texture(), m_label_unfocused_color, - m_label_unfocused_pm, + render(theme().unfocusedTheme()->iconbarTheme()->texture(), + m_label_unfocused_color, m_label_unfocused_pm, m_label.width(), m_label.height()); }@@ -1151,13 +1153,13 @@ m_need_render = true;
return; } - const FbTk::Texture *tc_focused = &theme()->focusedIconbarTheme()->texture(); - const FbTk::Texture *tc_unfocused = &theme()->unfocusedIconbarTheme()->texture(); + const FbTk::Texture *tc_focused = &theme().focusedTheme()->iconbarTheme()->texture(); + const FbTk::Texture *tc_unfocused = &theme().unfocusedTheme()->iconbarTheme()->texture(); if (m_tabmode == EXTERNAL && tc_focused->type() & FbTk::Texture::PARENTRELATIVE) - tc_focused = &theme()->titleFocusTexture(); + tc_focused = &theme().focusedTheme()->titleTexture(); if (m_tabmode == EXTERNAL && tc_unfocused->type() & FbTk::Texture::PARENTRELATIVE) - tc_unfocused = &theme()->titleUnfocusTexture(); + tc_unfocused = &theme().unfocusedTheme()->titleTexture(); render(*tc_focused, m_tabcontainer_focused_color, m_tabcontainer_focused_pm,@@ -1186,12 +1188,8 @@ m_titlebar.setAlpha(alpha);
m_label.setAlpha(alpha); if (m_tabmode != INTERNAL) { - m_label.setGC(m_focused ? - theme()->focusedIconbarTheme()->text().textGC() : - theme()->unfocusedIconbarTheme()->text().textGC()); - m_label.setJustify(m_focused ? - theme()->focusedIconbarTheme()->text().justify() : - theme()->unfocusedIconbarTheme()->text().justify()); + m_label.setGC(theme()->iconbarTheme()->text().textGC()); + m_label.setJustify(theme()->iconbarTheme()->text().justify()); if (label_pm != 0) m_label.setBackgroundPixmap(label_pm);@@ -1217,18 +1215,19 @@ m_need_render = true;
return; } - render(theme()->handleFocusTexture(), m_handle_focused_color, + render(theme().focusedTheme()->handleTexture(), m_handle_focused_color, m_handle_focused_pm, m_handle.width(), m_handle.height()); - render(theme()->handleUnfocusTexture(), m_handle_unfocused_color, + render(theme().unfocusedTheme()->handleTexture(), m_handle_unfocused_color, m_handle_unfocused_pm, m_handle.width(), m_handle.height()); - render(theme()->gripFocusTexture(), m_grip_focused_color, m_grip_focused_pm, + render(theme().focusedTheme()->gripTexture(), m_grip_focused_color, + m_grip_focused_pm, m_grip_left.width(), m_grip_left.height()); - render(theme()->gripUnfocusTexture(), m_grip_unfocused_color, + render(theme().unfocusedTheme()->gripTexture(), m_grip_unfocused_color, m_grip_unfocused_pm, m_grip_left.width(), m_grip_left.height());@@ -1283,11 +1282,11 @@ m_need_render = true;
return; } - render(theme()->buttonFocusTexture(), m_button_color, + render(theme().focusedTheme()->buttonTexture(), m_button_color, m_button_pm, m_button_size, m_button_size); - render(theme()->buttonUnfocusTexture(), m_button_unfocused_color, + render(theme().unfocusedTheme()->buttonTexture(), m_button_unfocused_color, m_button_unfocused_pm, m_button_size, m_button_size);@@ -1351,24 +1350,14 @@ btn.setPressedPixmap(m_button_pressed_pm);
else btn.setPressedColor(m_button_pressed_color); - if (focused()) { // focused - btn.setAlpha(getAlpha(true)); - - btn.setGC(theme()->buttonPicFocusGC()); - if (m_button_pm) - btn.setBackgroundPixmap(m_button_pm); - else - btn.setBackgroundColor(m_button_color); - } else { // unfocused - btn.setAlpha(getAlpha(false)); - - btn.setGC(theme()->buttonPicUnfocusGC()); - if (m_button_unfocused_pm) - btn.setBackgroundPixmap(m_button_unfocused_pm); - else - btn.setBackgroundColor(m_button_unfocused_color); - } - + Pixmap pm = m_focused ? m_button_pm : m_button_unfocused_pm; + btn.setAlpha(getAlpha(m_focused)); + btn.setGC(theme()->buttonPicGC()); + if (pm) + btn.setBackgroundPixmap(pm); + else + btn.setBackgroundColor(m_focused ? m_button_color + : m_button_unfocused_color); } void FbWinFrame::render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm,@@ -1460,21 +1449,21 @@ if (m_use_handle)
bw_changes += static_cast<signed>(border_width - handle().borderWidth()); window().setBorderWidth(border_width); - window().setBorderColor(theme()->border(m_focused).color()); + window().setBorderColor(theme()->border().color()); setTabMode(NOTSET); titlebar().setBorderWidth(border_width); - titlebar().setBorderColor(theme()->border(m_focused).color()); + titlebar().setBorderColor(theme()->border().color()); handle().setBorderWidth(border_width); - handle().setBorderColor(theme()->border(m_focused).color()); + handle().setBorderColor(theme()->border().color()); gripLeft().setBorderWidth(border_width); - gripLeft().setBorderColor(theme()->border(m_focused).color()); + gripLeft().setBorderColor(theme()->border().color()); gripRight().setBorderWidth(border_width); - gripRight().setBorderColor(theme()->border(m_focused).color()); + gripRight().setBorderColor(theme()->border().color()); if (bw_changes != 0) resize(width(), height() + bw_changes);
@@ -40,13 +40,13 @@ class FbWinFrameTheme;
class BScreen; class IconButton; class Focusable; +template <class T> class FocusableTheme; namespace FbTk { class ImageControl; class Command; class Texture; class XLayer; -template <class T> class ThemeProxy; } /// holds a window frame with a client window@@ -96,7 +96,7 @@ DECOR_TAB = DECORM_BORDER|DECORM_MENU|DECORM_TAB
}; /// create a top level window - FbWinFrame(BScreen &screen, FbTk::ThemeProxy<FbWinFrameTheme> &theme, + FbWinFrame(BScreen &screen, FocusableTheme<FbWinFrameTheme> &theme, FbTk::ImageControl &imgctrl, FbTk::XLayer &layer, int x, int y,@@ -255,7 +255,7 @@ const FbTk::FbWindow &gripRight() const { return m_grip_right; }
FbTk::FbWindow &gripRight() { return m_grip_right; } bool focused() const { return m_focused; } bool isShaded() const { return m_shaded; } - FbTk::ThemeProxy<FbWinFrameTheme> &theme() const { return m_theme; } + FocusableTheme<FbWinFrameTheme> &theme() const { return m_theme; } /// @return titlebar height unsigned int titlebarHeight() const { return (m_use_titlebar?m_titlebar.height()+m_window.borderWidth():0); } unsigned int handleHeight() const { return (m_use_handle?m_handle.height()+m_window.borderWidth():0); }@@ -314,7 +314,7 @@ void init();
BScreen &m_screen; - FbTk::ThemeProxy<FbWinFrameTheme> &m_theme; ///< theme to be used + FocusableTheme<FbWinFrameTheme> &m_theme; ///< theme to be used FbTk::ImageControl &m_imagectrl; ///< Image control for rendering /** @name windows
@@ -26,39 +26,26 @@ #include "IconbarTheme.hh"
#include <X11/cursorfont.h> -FbWinFrameTheme::FbWinFrameTheme(int screen_num): +FbWinFrameTheme::FbWinFrameTheme(int screen_num, const std::string &extra, + const std::string &altextra): FbTk::Theme(screen_num), - m_title_focus(*this, "window.title.focus", "Window.Title.Focus"), - m_title_unfocus(*this, "window.title.unfocus", "Window.Title.Unfocus"), - - m_handle_focus(*this, "window.handle.focus", "Window.Handle.Focus"), - m_handle_unfocus(*this, "window.handle.unfocus", "Window.Handle.Unfocus"), - - m_button_focus(*this, "window.button.focus", "Window.Button.Focus"), - m_button_unfocus(*this, "window.button.unfocus", "Window.Button.Unfocus"), + m_title(*this, "window.title" + extra, "Window.Title" + altextra), + m_handle(*this, "window.handle" + extra, "Window.Handle" + altextra), + m_button(*this, "window.button" + extra, "Window.Button" + altextra), m_button_pressed(*this, "window.button.pressed", "Window.Button.Pressed"), - - m_grip_focus(*this, "window.grip.focus", "Window.Grip.Focus"), - m_grip_unfocus(*this, "window.grip.unfocus", "Window.Grip.Unfocus"), - - m_button_focus_color(*this, "window.button.focus.picColor", "Window.Button.Focus.PicColor"), - m_button_unfocus_color(*this, "window.button.unfocus.picColor", "Window.Button.Unfocus.PicColor"), - + m_grip(*this, "window.grip" + extra, "Window.Grip" + altextra), + m_button_color(*this, "window.button" + extra + ".picColor", + "Window.Button" + altextra + ".PicColor"), m_font(*this, "window.font", "Window.Font"), m_shape_place(*this, "window.roundCorners", "Window.RoundCorners"), 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_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), - m_unfocused_alpha(255), - m_focused_iconbar_theme(screen_num, "window.label.focus", - "Window.Label.Unfocus"), - m_unfocused_iconbar_theme(screen_num, "window.label.unfocus", - "Window.Label.Unfocus") { + m_border(*this, "window" + extra, "Window" + altextra), + m_button_pic_gc(RootWindow(FbTk::App::instance()->display(), screen_num)), + m_alpha(255), + m_iconbar_theme(screen_num, "window.label" + extra, + "Window.Label" + altextra) { *m_title_height = 0; // set defaults@@ -111,10 +98,7 @@ *m_handle_width = 200;
else if (*m_handle_width < 0) *m_handle_width = 1; - m_button_pic_focus_gc.setForeground(*m_button_focus_color); - m_button_pic_unfocus_gc.setForeground(*m_button_unfocus_color); - - m_focused_iconbar_theme.reconfigTheme(); - m_unfocused_iconbar_theme.reconfigTheme(); + m_button_pic_gc.setForeground(*m_button_color); + m_iconbar_theme.reconfigTheme(); }
@@ -31,41 +31,28 @@ #include "FbTk/GContext.hh"
#include "FbTk/Shape.hh" #include "IconbarTheme.hh" +#include <string> class FbWinFrameTheme: public FbTk::Theme, public FbTk::ThemeProxy<FbWinFrameTheme> { public: - explicit FbWinFrameTheme(int screen_num); + explicit FbWinFrameTheme(int screen_num, const std::string &extra, + const std::string &altextra); ~FbWinFrameTheme(); /** @name textures */ //@{ - const FbTk::Texture &titleFocusTexture() const { return *m_title_focus; } - const FbTk::Texture &titleUnfocusTexture() const { return *m_title_unfocus; } - - const FbTk::Texture &handleFocusTexture() const { return *m_handle_focus; } - const FbTk::Texture &handleUnfocusTexture() const { return *m_handle_unfocus; } - - const FbTk::Texture &buttonFocusTexture() const { return *m_button_focus; } - const FbTk::Texture &buttonUnfocusTexture() const { return *m_button_unfocus; } + const FbTk::Texture &titleTexture() const { return *m_title; } + const FbTk::Texture &handleTexture() const { return *m_handle; } + const FbTk::Texture &buttonTexture() const { return *m_button; } const FbTk::Texture &buttonPressedTexture() const { return *m_button_pressed; } - - const FbTk::Texture &gripFocusTexture() const { return *m_grip_focus; } - const FbTk::Texture &gripUnfocusTexture() const { return *m_grip_unfocus; } + const FbTk::Texture &gripTexture() const { return *m_grip; } //@} - /** - @name colors - */ - //@{ - const FbTk::Color &buttonFocuscolor() const { return *m_button_focus_color; } - const FbTk::Color &buttonUnfocuscolor() const { return *m_button_unfocus_color; } - //@} + const FbTk::Color &buttonColor() const { return *m_button_color; } FbTk::Font &font() { return *m_font; } - - GC buttonPicFocusGC() const { return m_button_pic_focus_gc.gc(); } - GC buttonPicUnfocusGC() const { return m_button_pic_unfocus_gc.gc(); } + GC buttonPicGC() const { return m_button_pic_gc.gc(); } bool fallback(FbTk::ThemeItem_base &item); void reconfigTheme();@@ -81,19 +68,16 @@ Cursor topSideCursor() const { return m_cursor_top_side; }
Cursor bottomSideCursor() const { return m_cursor_bottom_side; } FbTk::Shape::ShapePlace shapePlace() const { return *m_shape_place; } - const FbTk::BorderTheme &border(bool focus) const { return (focus ? m_border_focus : m_border_unfocus); } + const FbTk::BorderTheme &border() const { return m_border; } unsigned int titleHeight() const { return *m_title_height; } unsigned int bevelWidth() const { return *m_bevel_width; } unsigned int handleWidth() const { return *m_handle_width; } - unsigned char focusedAlpha() const { return m_focused_alpha; } - unsigned char unfocusedAlpha() const { return m_unfocused_alpha; } - void setFocusedAlpha(unsigned char alpha) { m_focused_alpha = alpha; } - void setUnfocusedAlpha(unsigned char alpha) { m_unfocused_alpha = alpha; } + unsigned char alpha() const { return m_alpha; } + void setAlpha(unsigned char alpha) { m_alpha = alpha; } - IconbarTheme &focusedIconbarTheme() { return m_focused_iconbar_theme; } - IconbarTheme &unfocusedIconbarTheme() { return m_unfocused_iconbar_theme; } + IconbarTheme &iconbarTheme() { return m_iconbar_theme; } virtual FbTk::Subject &reconfigSig() { return FbTk::Theme::reconfigSig(); } virtual const FbTk::Subject &reconfigSig() const { return FbTk::Theme::reconfigSig(); }@@ -102,20 +86,17 @@ virtual FbWinFrameTheme &operator *() { return *this; }
virtual const FbWinFrameTheme &operator *() const { return *this; } private: - 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_button_focus_color, m_button_unfocus_color; + FbTk::ThemeItem<FbTk::Texture> m_title, m_handle, m_button, + m_button_pressed, m_grip; + FbTk::ThemeItem<FbTk::Color> m_button_color; FbTk::ThemeItem<FbTk::Font> m_font; FbTk::ThemeItem<FbTk::Shape::ShapePlace> m_shape_place; FbTk::ThemeItem<int> m_title_height, m_bevel_width, m_handle_width; - FbTk::BorderTheme m_border_focus, m_border_unfocus; + FbTk::BorderTheme m_border; - FbTk::GContext m_button_pic_focus_gc, m_button_pic_unfocus_gc; + FbTk::GContext m_button_pic_gc; Cursor m_cursor_move; Cursor m_cursor_lower_left_angle;@@ -126,10 +107,9 @@ Cursor m_cursor_left_side;
Cursor m_cursor_right_side; Cursor m_cursor_top_side; Cursor m_cursor_bottom_side; - unsigned char m_focused_alpha; - unsigned char m_unfocused_alpha; + unsigned char m_alpha; - IconbarTheme m_focused_iconbar_theme, m_unfocused_iconbar_theme; + IconbarTheme m_iconbar_theme; }; #endif // FBWINFRAMETHEME_HH
@@ -321,11 +321,12 @@ m_reconfigure_sig(*this), // reconfigure signal
m_resize_sig(*this), m_bg_change_sig(*this), m_layermanager(num_layers), - m_windowtheme(new FbWinFrameTheme(scrn)), + m_focused_windowtheme(new FbWinFrameTheme(scrn, ".focus", ".Focus")), + m_unfocused_windowtheme(new FbWinFrameTheme(scrn, ".unfocus", ".Unfocus")), // the order of windowtheme and winbutton theme is important // because winbutton need to rescale the pixmaps in winbutton theme // after fbwinframe have resized them - m_winbutton_theme(new WinButtonTheme(scrn, *m_windowtheme)), + m_winbutton_theme(new WinButtonTheme(scrn, *m_focused_windowtheme)), m_menutheme(new FbTk::MenuTheme(scrn)), m_root_window(scrn), m_geom_window(m_root_window,@@ -425,8 +426,8 @@
m_root_theme.reset(new RootTheme(imageControl())); m_root_theme->reconfigTheme(); - m_windowtheme->setFocusedAlpha(*resource.focused_alpha); - m_windowtheme->setUnfocusedAlpha(*resource.unfocused_alpha); + focusedWinFrameTheme()->setAlpha(*resource.focused_alpha); + unfocusedWinFrameTheme()->setAlpha(*resource.unfocused_alpha); m_menutheme->setAlpha(*resource.menu_alpha); m_menutheme->setMenuMode(*resource.menu_mode); // clamp values@@ -445,7 +446,7 @@ m_menutheme->setDelayClose(*resource.menu_delay_close);
imageControl().setDither(*resource.image_dither); - winFrameTheme()->reconfigSig().attach(this);// for geom window + focusedWinFrameTheme()->reconfigSig().attach(this);// for geom window geom_visible = false;@@ -867,8 +868,8 @@
void BScreen::reconfigure() { Fluxbox *fluxbox = Fluxbox::instance(); - m_windowtheme->setFocusedAlpha(*resource.focused_alpha); - m_windowtheme->setUnfocusedAlpha(*resource.unfocused_alpha); + focusedWinFrameTheme()->setAlpha(*resource.focused_alpha); + unfocusedWinFrameTheme()->setAlpha(*resource.unfocused_alpha); m_menutheme->setAlpha(*resource.menu_alpha); m_menutheme->setMenuMode(*resource.menu_mode);@@ -1301,7 +1302,6 @@ if (workspace)
workspace->updateClientmenu(); } else { win = new FluxboxWindow(*winclient, - winFrameTheme(), *layerManager().getLayer(Layer::NORMAL)); if (!win->isManaged()) {@@ -1339,7 +1339,6 @@ return 0;
} FluxboxWindow *win = new FluxboxWindow(client, - winFrameTheme(), *layerManager().getLayer(Layer::NORMAL)); #ifdef SLIT@@ -1793,13 +1792,12 @@ sprintf(label, "X:%5d x Y:%5d", x, y);
m_pos_window.clear(); - winFrameTheme()->font().drawText(m_pos_window, - screenNumber(), - winFrameTheme()->focusedIconbarTheme().text().textGC(), - label, strlen(label), - winFrameTheme()->bevelWidth(), - winFrameTheme()->bevelWidth() + - winFrameTheme()->font().ascent()); + focusedWinFrameTheme()->font().drawText(m_pos_window, screenNumber(), + focusedWinFrameTheme()->iconbarTheme().text().textGC(), + label, strlen(label), + focusedWinFrameTheme()->bevelWidth(), + focusedWinFrameTheme()->bevelWidth() + + focusedWinFrameTheme()->font().ascent()); }@@ -1845,13 +1843,12 @@
m_geom_window.clear(); //!! TODO: geom window again?! repeated - winFrameTheme()->font().drawText(m_geom_window, - screenNumber(), - winFrameTheme()->focusedIconbarTheme().text().textGC(), - label, strlen(label), - winFrameTheme()->bevelWidth(), - winFrameTheme()->bevelWidth() + - winFrameTheme()->font().ascent()); + focusedWinFrameTheme()->font().drawText(m_geom_window, screenNumber(), + focusedWinFrameTheme()->iconbarTheme().text().textGC(), + label, strlen(label), + focusedWinFrameTheme()->bevelWidth(), + focusedWinFrameTheme()->bevelWidth() + + focusedWinFrameTheme()->font().ascent()); }@@ -1908,32 +1905,39 @@ _FB_XTEXT(Screen, GeometrySpacing,
"W: %04d x H: %04d", "Representative maximum sized text for width and height dialog").c_str(), 0, 0); - int geom_h = winFrameTheme()->font().height() + winFrameTheme()->bevelWidth()*2; - int geom_w = winFrameTheme()->font().textWidth(label, strlen(label)) + winFrameTheme()->bevelWidth()*2; + int geom_h = focusedWinFrameTheme()->font().height() + + focusedWinFrameTheme()->bevelWidth()*2; + int geom_w = focusedWinFrameTheme()->font().textWidth(label, strlen(label)) + + focusedWinFrameTheme()->bevelWidth()*2; m_geom_window.resize(geom_w, geom_h); - m_geom_window.setBorderWidth(winFrameTheme()->border(true).width()); - m_geom_window.setBorderColor(winFrameTheme()->border(true).color()); + m_geom_window.setBorderWidth(focusedWinFrameTheme()->border().width()); + m_geom_window.setBorderColor(focusedWinFrameTheme()->border().color()); Pixmap tmp = geom_pixmap; - if (winFrameTheme()->focusedIconbarTheme().texture().type() & FbTk::Texture::PARENTRELATIVE) { - if (!winFrameTheme()->titleFocusTexture().usePixmap()) { + if (focusedWinFrameTheme()->iconbarTheme().texture().type() & + FbTk::Texture::PARENTRELATIVE) { + if (!focusedWinFrameTheme()->titleTexture().usePixmap()) { geom_pixmap = None; - m_geom_window.setBackgroundColor(winFrameTheme()->titleFocusTexture().color()); + m_geom_window.setBackgroundColor( + focusedWinFrameTheme()->titleTexture().color()); } else { - geom_pixmap = imageControl().renderImage(m_geom_window.width(), m_geom_window.height(), - winFrameTheme()->titleFocusTexture()); + geom_pixmap = imageControl().renderImage(m_geom_window.width(), + m_geom_window.height(), + focusedWinFrameTheme()->titleTexture()); m_geom_window.setBackgroundPixmap(geom_pixmap); } } else { - if (!winFrameTheme()->focusedIconbarTheme().texture().usePixmap()) { + if (!focusedWinFrameTheme()->iconbarTheme().texture().usePixmap()) { geom_pixmap = None; - m_geom_window.setBackgroundColor(winFrameTheme()->focusedIconbarTheme().texture().color()); + m_geom_window.setBackgroundColor( + focusedWinFrameTheme()->iconbarTheme().texture().color()); } else { - geom_pixmap = imageControl().renderImage(m_geom_window.width(), m_geom_window.height(), - winFrameTheme()->focusedIconbarTheme().texture()); + geom_pixmap = imageControl().renderImage(m_geom_window.width(), + m_geom_window.height(), + focusedWinFrameTheme()->iconbarTheme().texture()); m_geom_window.setBackgroundPixmap(geom_pixmap); } }@@ -1946,32 +1950,40 @@
void BScreen::renderPosWindow() { - int pos_h = winFrameTheme()->font().height() + winFrameTheme()->bevelWidth()*2; - int pos_w = winFrameTheme()->font().textWidth("0:00000 x 0:00000", 17) + winFrameTheme()->bevelWidth()*2; + int pos_h = focusedWinFrameTheme()->font().height() + + focusedWinFrameTheme()->bevelWidth()*2; + int pos_w = focusedWinFrameTheme()->font().textWidth("0:00000 x 0:00000", + 17) + + focusedWinFrameTheme()->bevelWidth()*2; m_pos_window.resize(pos_w, pos_h); - m_pos_window.setBorderWidth(winFrameTheme()->border(true).width()); - m_pos_window.setBorderColor(winFrameTheme()->border(true).color()); + m_pos_window.setBorderWidth(focusedWinFrameTheme()->border().width()); + m_pos_window.setBorderColor(focusedWinFrameTheme()->border().color()); Pixmap tmp = pos_pixmap; - if (winFrameTheme()->focusedIconbarTheme().texture().type() & FbTk::Texture::PARENTRELATIVE) { - if (!winFrameTheme()->titleFocusTexture().usePixmap()) { + if (focusedWinFrameTheme()->iconbarTheme().texture().type() & + FbTk::Texture::PARENTRELATIVE) { + if (!focusedWinFrameTheme()->titleTexture().usePixmap()) { pos_pixmap = None; - m_pos_window.setBackgroundColor(winFrameTheme()->titleFocusTexture().color()); + m_pos_window.setBackgroundColor( + focusedWinFrameTheme()->titleTexture().color()); } else { - pos_pixmap = imageControl().renderImage(m_pos_window.width(), m_pos_window.height(), - winFrameTheme()->titleFocusTexture()); + pos_pixmap = imageControl().renderImage(m_pos_window.width(), + m_pos_window.height(), + focusedWinFrameTheme()->titleTexture()); m_pos_window.setBackgroundPixmap(pos_pixmap); } } else { - if (!winFrameTheme()->focusedIconbarTheme().texture().usePixmap()) { + if (!focusedWinFrameTheme()->iconbarTheme().texture().usePixmap()) { pos_pixmap = None; - m_pos_window.setBackgroundColor(winFrameTheme()->focusedIconbarTheme().texture().color()); + m_pos_window.setBackgroundColor( + focusedWinFrameTheme()->iconbarTheme().texture().color()); } else { - pos_pixmap = imageControl().renderImage(m_pos_window.width(), m_pos_window.height(), - winFrameTheme()->focusedIconbarTheme().texture()); + pos_pixmap = imageControl().renderImage(m_pos_window.width(), + m_pos_window.height(), + focusedWinFrameTheme()->iconbarTheme().texture()); m_pos_window.setBackgroundPixmap(pos_pixmap); } }
@@ -273,8 +273,11 @@ void saveWorkspaces(int w) { *resource.workspaces = w; }
void saveMenu(FbTk::Menu &menu) { m_rootmenu_list.push_back(&menu); } - FbTk::ThemeProxy<FbWinFrameTheme> &winFrameTheme() { return *m_windowtheme.get(); } - const FbTk::ThemeProxy<FbWinFrameTheme> &winFrameTheme() const { return *m_windowtheme.get(); } + FbTk::ThemeProxy<FbWinFrameTheme> &focusedWinFrameTheme() { return *m_focused_windowtheme.get(); } + const FbTk::ThemeProxy<FbWinFrameTheme> &focusedWinFrameTheme() const { return *m_focused_windowtheme.get(); } + FbTk::ThemeProxy<FbWinFrameTheme> &unfocusedWinFrameTheme() { return *m_unfocused_windowtheme.get(); } + const FbTk::ThemeProxy<FbWinFrameTheme> &unfocusedWinFrameTheme() const { return *m_unfocused_windowtheme.get(); } + FbTk::ThemeProxy<FbTk::MenuTheme> &menuTheme() { return *m_menutheme.get(); } const FbTk::ThemeProxy<FbTk::MenuTheme> &menuTheme() const { return *m_menutheme.get(); } const FbTk::ThemeProxy<RootTheme> &rootTheme() const { return *m_root_theme.get(); }@@ -514,7 +517,8 @@
WorkspaceNames m_workspace_names; Workspaces m_workspaces_list; - std::auto_ptr<FbWinFrameTheme> m_windowtheme; + std::auto_ptr<FbWinFrameTheme> m_focused_windowtheme, + m_unfocused_windowtheme; std::auto_ptr<WinButtonTheme> m_winbutton_theme; std::auto_ptr<FbTk::MenuTheme> m_menutheme; std::auto_ptr<RootTheme> m_root_theme;
@@ -261,8 +261,7 @@
int FluxboxWindow::s_num_grabs = 0; -FluxboxWindow::FluxboxWindow(WinClient &client, - FbTk::ThemeProxy<FbWinFrameTheme> &tm, FbTk::XLayer &layer): +FluxboxWindow::FluxboxWindow(WinClient &client, FbTk::XLayer &layer): Focusable(client.screen(), this), oplock(false), m_hintsig(*this),@@ -291,14 +290,18 @@ m_click_focus(true),
m_old_pos_x(0), m_old_pos_y(0), m_old_width(1), m_old_height(1), m_last_button_x(0), m_last_button_y(0), - m_frame(client.screen(), tm, client.screen().imageControl(), layer, 0, 0, 100, 100), + m_theme(*this, screen().focusedWinFrameTheme(), + screen().unfocusedWinFrameTheme()), + m_frame(client.screen(), m_theme, client.screen().imageControl(), layer, + 0, 0, 100, 100), m_placed(false), m_layernum(layer.getLayerNum()), m_old_layernum(0), m_parent(client.screen().rootWindow()), m_resize_corner(RIGHTBOTTOM) { - tm.reconfigSig().attach(this); + screen().focusedWinFrameTheme().reconfigSig().attach(this); + screen().unfocusedWinFrameTheme().reconfigSig().attach(this); init();@@ -3022,7 +3025,7 @@ frame().clientArea().setBorderWidth(0); // client area bordered by other things
unsigned int border_width = 0; if (decorations.border) - border_width = frame().theme()->border(m_focused).width(); + border_width = frame().theme()->border().width(); bool client_move = false;@@ -4073,7 +4076,7 @@ */
void FluxboxWindow::reconfigTheme() { m_frame.setBorderWidth(decorations.border ? - frame().theme()->border(m_focused).width() : 0); + frame().theme()->border().width() : 0); if (decorations.handle && frame().theme()->handleWidth() != 0) frame().showHandle(); else@@ -4129,9 +4132,8 @@ }
void FluxboxWindow::associateClient(WinClient &client) { IconButton *btn = new IconButton(frame().tabcontainer(), - frame().theme()->focusedIconbarTheme(), - frame().theme()->unfocusedIconbarTheme(), - client); + frame().theme().focusedTheme()->iconbarTheme(), + frame().theme().unfocusedTheme()->iconbarTheme(), client); frame().createTab(*btn); FbTk::RefCount<FbTk::Command> setcmd(new SetClientCmd(client));
@@ -33,6 +33,7 @@ #include "FbTk/EventHandler.hh"
#include "FbTk/XLayerItem.hh" #include "FbWinFrame.hh" #include "Focusable.hh" +#include "FocusableTheme.hh" #include "WinButton.hh" #include <sys/time.h>@@ -150,8 +151,7 @@
typedef std::list<WinClient *> ClientList; /// create a window from a client - FluxboxWindow(WinClient &client, - FbTk::ThemeProxy<FbWinFrameTheme> &tm, FbTk::XLayer &layer); + FluxboxWindow(WinClient &client, FbTk::XLayer &layer); virtual ~FluxboxWindow();@@ -610,6 +610,8 @@ int m_old_pos_x, m_old_pos_y; ///< old position so we can restore from maximized
unsigned int m_old_width, m_old_height; ///< old size so we can restore from maximized state int m_last_button_x, ///< last known x position of the mouse button m_last_button_y; ///< last known y position of the mouse button + + FocusableTheme<FbWinFrameTheme> m_theme; FbWinFrame m_frame; ///< the actuall window frame bool m_placed; ///< determine whether or not we should place the window