From 41b2e0ced41580d377ea04a3c1c19408f2d8db13 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Sat, 30 Aug 2008 18:36:53 -0400 Subject: use FbMenu::window instead of WindowCmd<>::window for displaying items in the window menu --- src/FbMenu.cc | 13 +++++++------ src/FbMenu.hh | 1 - src/MenuCreator.cc | 8 ++++---- src/Remember.cc | 19 +++++++++---------- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/FbMenu.cc b/src/FbMenu.cc index 769241d..5bc3622 100644 --- a/src/FbMenu.cc +++ b/src/FbMenu.cc @@ -35,14 +35,11 @@ FbMenu::FbMenu(FbTk::ThemeProxy &tm, } -void FbMenu::show() { - WindowCmd::setWindow(s_window); - FbTk::Menu::show(); -} - void FbMenu::buttonPressEvent(XButtonEvent &be) { + WinClient *old = WindowCmd::client(); WindowCmd::setWindow(s_window); FbTk::Menu::buttonPressEvent(be); + WindowCmd::setClient(old); } void FbMenu::buttonReleaseEvent(XButtonEvent &be) { @@ -55,13 +52,17 @@ void FbMenu::buttonReleaseEvent(XButtonEvent &be) { screen->getHeadWidth(head), screen->getHeadHeight(head)); } - WindowCmd::setWindow(s_window); // now get on with the show + WinClient *old = WindowCmd::client(); + WindowCmd::setWindow(s_window); FbTk::Menu::buttonReleaseEvent(be); + WindowCmd::setClient(old); } void FbMenu::keyPressEvent(XKeyEvent &ke) { + WinClient *old = WindowCmd::client(); WindowCmd::setWindow(s_window); FbTk::Menu::keyPressEvent(ke); + WindowCmd::setClient(old); } diff --git a/src/FbMenu.hh b/src/FbMenu.hh index 11ed3c3..2e709fd 100644 --- a/src/FbMenu.hh +++ b/src/FbMenu.hh @@ -42,7 +42,6 @@ public: virtual ~FbMenu() { } void raise() { m_layeritem.raise(); } void lower() { m_layeritem.lower(); } - void show(); void buttonPressEvent(XButtonEvent &be); void buttonReleaseEvent(XButtonEvent &be); void keyPressEvent(XKeyEvent &ke); diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc index db9aca2..8f9b9a7 100644 --- a/src/MenuCreator.cc +++ b/src/MenuCreator.cc @@ -168,14 +168,14 @@ private: class MenuContext: public LayerObject { public: void moveToLayer(int layer_number) { - if (WindowCmd::window() == 0) + if (FbMenu::window() == 0) return; - WindowCmd::window()->moveToLayer(layer_number); + FbMenu::window()->moveToLayer(layer_number); } int layerNumber() const { - if (WindowCmd::window() == 0) + if (FbMenu::window() == 0) return -1; - return WindowCmd::window()->layerItem().getLayerNum(); + return FbMenu::window()->layerItem().getLayerNum(); } }; diff --git a/src/Remember.cc b/src/Remember.cc index 0fa778f..6a611bf 100644 --- a/src/Remember.cc +++ b/src/Remember.cc @@ -29,7 +29,6 @@ #include "FbMenu.hh" #include "FbCommands.hh" #include "fluxbox.hh" -#include "WindowCmd.hh" #include "Layer.hh" #include "FbTk/I18n.hh" @@ -250,23 +249,23 @@ public: } bool isSelected() const { - if (WindowCmd::window() == 0) + if (FbMenu::window() == 0) return false; - if (WindowCmd::window()->numClients()) // ensure it HAS clients - return Remember::instance().isRemembered(WindowCmd::window()->winClient(), m_attrib); + if (FbMenu::window()->numClients()) // ensure it HAS clients + return Remember::instance().isRemembered(FbMenu::window()->winClient(), m_attrib); else return false; } bool isEnabled() const { - if (WindowCmd::window() == 0) + if (FbMenu::window() == 0) return false; if (m_attrib != Remember::REM_JUMPWORKSPACE) return true; - else if (WindowCmd::window()->numClients()) - return (Remember::instance().isRemembered(WindowCmd::window()->winClient(), Remember::REM_WORKSPACE)); + else if (FbMenu::window()->numClients()) + return (Remember::instance().isRemembered(FbMenu::window()->winClient(), Remember::REM_WORKSPACE)); else return false; } @@ -274,11 +273,11 @@ public: void click(int button, int time, unsigned int mods) { // reconfigure only does stuff if the apps file has changed Remember::instance().checkReload(); - if (WindowCmd::window() != 0) { + if (FbMenu::window() != 0) { if (isSelected()) { - Remember::instance().forgetAttrib(WindowCmd::window()->winClient(), m_attrib); + Remember::instance().forgetAttrib(FbMenu::window()->winClient(), m_attrib); } else { - Remember::instance().rememberAttrib(WindowCmd::window()->winClient(), m_attrib); + Remember::instance().rememberAttrib(FbMenu::window()->winClient(), m_attrib); } } Remember::instance().save(); -- cgit v0.11.2