From 06a66cc30446945e9d2a440de2b9a9e9f6561ead Mon Sep 17 00:00:00 2001 From: rathnor Date: Mon, 25 Aug 2003 13:15:53 +0000 Subject: fix some style initialisation issues --- ChangeLog | 2 ++ src/FbWinFrame.cc | 11 +++++++++- src/Screen.cc | 62 ++++++++++++++++++++++++++++++------------------------- src/Screen.hh | 10 ++++++--- 4 files changed, 53 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index b73f129..17adaa5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ (Format: Year/Month/Day) Changes for 0.9.5: *03/08/25: + * Fix some style initialisation issues (Simon) + Screen.hh/cc FbWinFrame.cc * Added window icon for FbRun (Henrik) fbrun.xpm, FbRun.hh/cc *03/08/24: diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index ac1db09..de87299 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWinFrame.cc,v 1.41 2003/08/24 15:39:52 fluxgen Exp $ +// $Id: FbWinFrame.cc,v 1.42 2003/08/25 13:15:53 rathnor Exp $ #include "FbWinFrame.hh" @@ -1039,10 +1039,19 @@ void FbWinFrame::setBorderWidth(unsigned int borderW) { bw_changes += (signed) borderW - handle().borderWidth(); window().setBorderWidth(borderW); + //window().setBorderColor(theme().borderColor()); + titlebar().setBorderWidth(borderW); + //titlebar().setBorderColor(theme().borderColor()); + handle().setBorderWidth(borderW); + //handle().setBorderColor(theme().borderColor()); + gripLeft().setBorderWidth(borderW); + //gripLeft().setBorderColor(theme().borderColor()); + gripRight().setBorderWidth(borderW); + //gripRight().setBorderColor(theme().borderColor()); if (bw_changes != 0) resize(width(), height() + bw_changes); diff --git a/src/Screen.cc b/src/Screen.cc index 285d30a..eeba710 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.225 2003/08/24 13:07:01 fluxgen Exp $ +// $Id: Screen.cc,v 1.226 2003/08/25 13:15:53 rathnor Exp $ #include "Screen.hh" @@ -331,6 +331,14 @@ BScreen::BScreen(FbTk::ResourceManager &rm, // load this screens resources fluxbox->load_rc(*this); + FbTk::ThemeManager::instance().load(Fluxbox::instance()->getStyleFilename()); + +#ifdef SLIT + if (slit()) // this will load theme and reconfigure slit + FbTk::ThemeManager::instance().loadTheme(slit()->theme()); +#endif // SLIT + + m_menutheme->setAlpha(*resource.menu_alpha); imageControl().setDither(*resource.image_dither); @@ -345,11 +353,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm, // create geometry window - const char *s = i18n->getMessage(FBNLS::ScreenSet, FBNLS::ScreenPositionLength, - "W: 0000 x H: 0000"); - - int geom_h = winFrameTheme().font().height() + m_root_theme->bevelWidth()*2; - int geom_w = winFrameTheme().font().textWidth(s, strlen(s)) + m_root_theme->bevelWidth()*2; + int geom_h = 10; + int geom_w = 100; // just initial, will be fixed in render XSetWindowAttributes attrib; unsigned long mask = CWBorderPixel | CWColormap | CWSaveUnder; @@ -357,6 +362,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm, attrib.colormap = rootWindow().colormap(); attrib.save_under = true; + winFrameTheme().reconfigSig().attach(this);// for geom window + m_geom_window = XCreateWindow(disp, rootWindow().window(), 0, 0, geom_w, geom_h, rootTheme().borderWidth(), rootWindow().depth(), @@ -417,13 +424,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm, m_configmenu->update(); -#ifdef SLIT - if (slit()) // this will load theme and reconfigure slit - FbTk::ThemeManager::instance().loadTheme(slit()->theme()); -#endif // SLIT - - FbTk::ThemeManager::instance().load(Fluxbox::instance()->getStyleFilename()); - // start with workspace 0 changeWorkspaceID(0); updateNetizenWorkspaceCount(); @@ -584,6 +584,13 @@ unsigned int BScreen::maxBottom(int head) const { return doFullMax() ? height() : height() - m_available_workspace_area->bottom(); } +void BScreen::update(FbTk::Subject *subj) { + // for now we're only listening to the theme sig, so no object check + // if another signal is added later, will need to differentiate here + + renderGeomWindow(); +} + void BScreen::reconfigure() { m_menutheme->setAlpha(*resource.menu_alpha); Fluxbox::instance()->loadRootCommand(*this); @@ -597,23 +604,8 @@ void BScreen::reconfigure() { // std::string theme_filename(Fluxbox::instance()->getStyleFilename()); // FbTk::ThemeManager::instance().load(theme_filename.c_str()); - I18n *i18n = I18n::instance(); - - const char *s = i18n->getMessage(FBNLS::ScreenSet, - FBNLS::ScreenPositionLength, - "W: 0000 x H: 0000"); - int l = strlen(s); - - //TODO: repeated from somewhere else? - int geom_h = winFrameTheme().font().height() + m_root_theme->bevelWidth()*2; - int geom_w = winFrameTheme().font().textWidth(s, l) + m_root_theme->bevelWidth()*2; - m_geom_window.resize(geom_w, geom_h); - renderGeomWindow(); - m_geom_window.setBorderWidth(m_root_theme->borderWidth()); - m_geom_window.setBorderColor(m_root_theme->borderColor()); - //reconfigure menus workspacemenu->reconfigure(); m_configmenu->reconfigure(); @@ -2163,6 +2155,20 @@ bool BScreen::doSkipWindow(const WinClient &winclient, int opts) { } void BScreen::renderGeomWindow() { + + const char *s = I18n::instance()->getMessage(FBNLS::ScreenSet, + FBNLS::ScreenPositionLength, + "W: 0000 x H: 0000"); + int l = strlen(s); + + int geom_h = winFrameTheme().font().height() + m_root_theme->bevelWidth()*2; + int geom_w = winFrameTheme().font().textWidth(s, l) + m_root_theme->bevelWidth()*2; + m_geom_window.resize(geom_w, geom_h); + + m_geom_window.setBorderWidth(m_root_theme->borderWidth()); + m_geom_window.setBorderColor(m_root_theme->borderColor()); + + Pixmap tmp = geom_pixmap; if (winFrameTheme().labelFocusTexture().type() & FbTk::Texture::PARENTRELATIVE) { diff --git a/src/Screen.hh b/src/Screen.hh index 6efe15d..f19c7b4 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.hh,v 1.122 2003/08/24 13:06:38 fluxgen Exp $ +// $Id: Screen.hh,v 1.123 2003/08/25 13:15:53 rathnor Exp $ #ifndef SCREEN_HH #define SCREEN_HH @@ -32,6 +32,7 @@ #include "MultLayers.hh" #include "FbRootWindow.hh" #include "NotCopyable.hh" +#include "Observer.hh" #include "fluxbox.hh" #include "MenuTheme.hh" @@ -59,13 +60,14 @@ class Menu; class ImageControl; class XLayerItem; class FbWindow; +class Subject; }; /// Handles screen connection, screen clients and workspaces /** Create workspaces, handles switching between workspaces and windows */ -class BScreen : private FbTk::NotCopyable { +class BScreen : public FbTk::Observer, private FbTk::NotCopyable { public: typedef std::vector Workspaces; typedef std::vector WorkspaceNames; @@ -153,7 +155,9 @@ public: FbTk::Subject &reconfigureSig() { return m_reconfigure_sig; } FbTk::Subject &resizeSig() { return m_resize_sig; } //@} - + + void update(FbTk::Subject *subj); + /// @return the resource value of number of workspace inline int getNumberOfWorkspaces() const { return *resource.workspaces; } -- cgit v0.11.2