fixed bug with keys not working when using a style background

This commit is contained in:
markt 2007-03-06 19:40:38 +00:00
parent ed3731fa30
commit 40c0c7c364
3 changed files with 12 additions and 7 deletions

View file

@ -25,6 +25,7 @@
#include "FbRootWindow.hh" #include "FbRootWindow.hh"
#include "FbCommands.hh" #include "FbCommands.hh"
#include "Screen.hh"
#include "FbTk/App.hh" #include "FbTk/App.hh"
#include "FbTk/Font.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()), FbTk::Theme(image_control.screenNumber()),
m_screen(scrn),
m_background(new BackgroundItem(*this, "background", "Background")), m_background(new BackgroundItem(*this, "background", "Background")),
m_opgc(RootWindow(FbTk::App::instance()->display(), image_control.screenNumber())), m_opgc(RootWindow(FbTk::App::instance()->display(), image_control.screenNumber())),
m_image_ctrl(image_control) { m_image_ctrl(image_control) {
@ -182,11 +184,9 @@ void RootTheme::reconfigTheme() {
return; return;
} }
if (!m_background->changed()) if (!m_background->changed() || !m_screen)
return; return;
m_background->setApplied();
// style doesn't wish to change the background // style doesn't wish to change the background
if (strstr(m_background->options().c_str(), "none") != 0) if (strstr(m_background->options().c_str(), "none") != 0)
return; return;
@ -196,7 +196,9 @@ void RootTheme::reconfigTheme() {
// //
// root window helper // root window helper
FbRootWindow rootwin(screenNum()); FbRootWindow &rootwin = m_screen->rootWindow();
m_background->setApplied();
// handle background option in style // handle background option in style
std::string filename = m_background->filename(); std::string filename = m_background->filename();

View file

@ -33,6 +33,7 @@
#include <string> #include <string>
class BackgroundItem; class BackgroundItem;
class BScreen;
namespace FbTk { namespace FbTk {
class ResourceManager; class ResourceManager;
@ -45,7 +46,7 @@ public:
/// constructor /// constructor
/// @param resmanager resource manager for finding specific resources /// @param resmanager resource manager for finding specific resources
/// @param image_control for rendering background texture /// @param image_control for rendering background texture
RootTheme(FbTk::ImageControl &image_control); RootTheme(FbTk::ImageControl &image_control, BScreen *scrn = 0);
~RootTheme(); ~RootTheme();
bool fallback(FbTk::ThemeItem_base &item); bool fallback(FbTk::ThemeItem_base &item);
@ -61,6 +62,7 @@ public:
} }
private: private:
BScreen *m_screen;
BackgroundItem *m_background;///< background image/texture BackgroundItem *m_background;///< background image/texture
FbTk::GContext m_opgc; FbTk::GContext m_opgc;
FbTk::ImageControl &m_image_ctrl; ///< image control for rendering background texture FbTk::ImageControl &m_image_ctrl; ///< image control for rendering background texture

View file

@ -439,7 +439,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
cmd.execute(); 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->setFocusedAlpha(*resource.focused_alpha);
m_windowtheme->setUnfocusedAlpha(*resource.unfocused_alpha); m_windowtheme->setUnfocusedAlpha(*resource.unfocused_alpha);