From 40c0c7c3646d854430919eff2b211e5f0c7bf780 Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 6 Mar 2007 19:40:38 +0000 Subject: fixed bug with keys not working when using a style background --- src/RootTheme.cc | 12 +++++++----- src/RootTheme.hh | 4 +++- src/Screen.cc | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/RootTheme.cc b/src/RootTheme.cc index afe0ca0..1e54368 100644 --- a/src/RootTheme.cc +++ b/src/RootTheme.cc @@ -25,6 +25,7 @@ #include "FbRootWindow.hh" #include "FbCommands.hh" +#include "Screen.hh" #include "FbTk/App.hh" #include "FbTk/Font.hh" @@ -141,8 +142,9 @@ private: }; -RootTheme::RootTheme(FbTk::ImageControl &image_control): +RootTheme::RootTheme(FbTk::ImageControl &image_control, BScreen *scrn): FbTk::Theme(image_control.screenNumber()), + m_screen(scrn), m_background(new BackgroundItem(*this, "background", "Background")), m_opgc(RootWindow(FbTk::App::instance()->display(), image_control.screenNumber())), m_image_ctrl(image_control) { @@ -182,11 +184,9 @@ void RootTheme::reconfigTheme() { return; } - if (!m_background->changed()) + if (!m_background->changed() || !m_screen) return; - m_background->setApplied(); - // style doesn't wish to change the background if (strstr(m_background->options().c_str(), "none") != 0) return; @@ -196,7 +196,9 @@ void RootTheme::reconfigTheme() { // // root window helper - FbRootWindow rootwin(screenNum()); + FbRootWindow &rootwin = m_screen->rootWindow(); + + m_background->setApplied(); // handle background option in style std::string filename = m_background->filename(); diff --git a/src/RootTheme.hh b/src/RootTheme.hh index abfea7c..63be8b0 100644 --- a/src/RootTheme.hh +++ b/src/RootTheme.hh @@ -33,6 +33,7 @@ #include class BackgroundItem; +class BScreen; namespace FbTk { class ResourceManager; @@ -45,7 +46,7 @@ public: /// constructor /// @param resmanager resource manager for finding specific resources /// @param image_control for rendering background texture - RootTheme(FbTk::ImageControl &image_control); + RootTheme(FbTk::ImageControl &image_control, BScreen *scrn = 0); ~RootTheme(); bool fallback(FbTk::ThemeItem_base &item); @@ -61,6 +62,7 @@ public: } private: + BScreen *m_screen; BackgroundItem *m_background;///< background image/texture FbTk::GContext m_opgc; FbTk::ImageControl &m_image_ctrl; ///< image control for rendering background texture diff --git a/src/Screen.cc b/src/Screen.cc index 3f3daf9..9a3ef31 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -439,7 +439,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm, cmd.execute(); } - m_root_theme.reset(new RootTheme(imageControl())); + m_root_theme.reset(new RootTheme(imageControl(), this)); + m_root_theme->reconfigTheme(); m_windowtheme->setFocusedAlpha(*resource.focused_alpha); m_windowtheme->setUnfocusedAlpha(*resource.unfocused_alpha); -- cgit v0.11.2