diff --git a/src/Configmenu.cc b/src/Configmenu.cc index da1b7017..4ea127d5 100644 --- a/src/Configmenu.cc +++ b/src/Configmenu.cc @@ -106,10 +106,6 @@ Configmenu::Configmenu(bt::Application &app, unsigned int screen, new ConfigPlacementmenu(app, screen, bscreen); ConfigDithermenu *dithermenu = new ConfigDithermenu(app, screen, bscreen); - Toolbarmenu *toolbarmenu = - new Toolbarmenu(app, screen, _bscreen); - Slitmenu *slitmenu = - new Slitmenu(app, screen, _bscreen); insertItem("Focus Model", focusmenu, FocusModel); insertItem("Window Placement", placementmenu, WindowPlacement); @@ -121,8 +117,8 @@ Configmenu::Configmenu(bt::Application &app, unsigned int screen, insertItem("Focus Last Window on Workspace", FocusLastWindowOnWorkspace); insertItem("Disable Bindings with Scroll Lock", DisableBindings); insertSeparator(); - insertItem("Toolbar Options", toolbarmenu, ToolbarOptions); - insertItem("Slit Options", slitmenu, SlitOptions); + insertItem("Toolbar Options", bscreen->toolbarmenu(), ToolbarOptions); + insertItem("Slit Options", bscreen->slitmenu(), SlitOptions); } diff --git a/src/Screen.cc b/src/Screen.cc index f2e5922c..ffa89c08 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -28,7 +28,9 @@ #include "Iconmenu.hh" #include "Rootmenu.hh" #include "Slit.hh" +#include "Slitmenu.hh" #include "Toolbar.hh" +#include "Toolbarmenu.hh" #include "Window.hh" #include "WindowGroup.hh" #include "Windowmenu.hh" @@ -118,13 +120,18 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : updateGeomWindow(); - configmenu = - new Configmenu(*blackbox, screen_info.screenNumber(), this); _iconmenu = new Iconmenu(*blackbox, screen_info.screenNumber(), this); + _slitmenu = + new Slitmenu(*blackbox, screen_info.screenNumber(), this); + _toolbarmenu = + new Toolbarmenu(*blackbox, screen_info.screenNumber(), this); workspacemenu = new Workspacemenu(*blackbox, screen_info.screenNumber(), this); + configmenu = + new Configmenu(*blackbox, screen_info.screenNumber(), this); + if (_resource.numberOfWorkspaces() == 0) // there is always 1 workspace _resource.saveWorkspaces(1); diff --git a/src/Screen.hh b/src/Screen.hh index ad211305..36ea16b4 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -43,7 +43,9 @@ class Configmenu; class Iconmenu; class Rootmenu; class Slit; +class Slitmenu; class Toolbar; +class Toolbarmenu; class Windowmenu; class Workspace; class Workspacemenu; @@ -65,6 +67,8 @@ private: Configmenu *configmenu; Iconmenu *_iconmenu; Rootmenu *rootmenu; + Slitmenu *_slitmenu; + Toolbarmenu *_toolbarmenu; Windowmenu *_windowmenu; Workspacemenu *workspacemenu; @@ -136,6 +140,10 @@ public: inline Iconmenu *iconmenu(void) const { return _iconmenu; } + inline Slitmenu *slitmenu(void) const + { return _slitmenu; } + inline Toolbarmenu *toolbarmenu(void) const + { return _toolbarmenu; } Windowmenu *windowmenu(BlackboxWindow *win); diff --git a/src/Slit.cc b/src/Slit.cc index 429ca926..a08d94a9 100644 --- a/src/Slit.cc +++ b/src/Slit.cc @@ -53,8 +53,6 @@ Slit::Slit(BScreen *scr) { timer = new bt::Timer(blackbox, this); timer->setTimeout(blackbox->resource().autoRaiseDelay()); - slitmenu = new Slitmenu(*blackbox, screen->screenNumber(), screen); - XSetWindowAttributes attrib; unsigned long create_mask = CWColormap | CWEventMask; attrib.colormap = screen->screenInfo().colormap(); @@ -86,7 +84,6 @@ Slit::~Slit(void) { XDestroyWindow(display, frame.window); delete timer; - delete slitmenu; } @@ -316,8 +313,6 @@ void Slit::reconfigure(void) { } break; } - - slitmenu->reconfigure(); } @@ -478,7 +473,8 @@ void Slit::buttonPressEvent(const XButtonEvent * const event) { screen->lowerWindow(this); break; case Button3: - slitmenu->popup(event->x_root, event->y_root, screen->availableArea()); + screen->slitmenu()->popup(event->x_root, event->y_root, + screen->availableArea()); break; } } @@ -501,9 +497,11 @@ void Slit::leaveNotifyEvent(const XCrossingEvent * const /*unused*/) { return; if (hidden) { - if (timer->isTiming()) timer->stop(); - } else if (! slitmenu->isVisible()) { - if (! timer->isTiming()) timer->start(); + if (timer->isTiming()) + timer->stop(); + } else if (! screen->slitmenu()->isVisible()) { + if (! timer->isTiming()) + timer->start(); } } diff --git a/src/Slit.hh b/src/Slit.hh index 306051e6..94dac6f4 100644 --- a/src/Slit.hh +++ b/src/Slit.hh @@ -30,9 +30,6 @@ #include "BlackboxResource.hh" #include "Screen.hh" -// forward declarations -class Slitmenu; - class Slit : public StackEntity, public bt::TimeoutHandler, public bt::EventHandler, public bt::NoCopy { @@ -56,7 +53,6 @@ private: bt::Netwm::Strut strut; SlitClientList clientList; - Slitmenu *slitmenu; struct SlitFrame { Pixmap pixmap; @@ -68,8 +64,6 @@ private: void updateStrut(void); - friend class Slitmenu; - public: Slit(BScreen *scr); virtual ~Slit(void); diff --git a/src/Toolbar.cc b/src/Toolbar.cc index de34c56c..4a9e5f29 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -71,8 +71,6 @@ Toolbar::Toolbar(BScreen *scrn) { editing = False; new_name_pos = 0; - toolbarmenu = new Toolbarmenu(*blackbox, _screen->screenNumber(), _screen); - display = blackbox->XDisplay(); XSetWindowAttributes attrib; unsigned long create_mask = CWColormap | CWOverrideRedirect | CWEventMask; @@ -178,7 +176,6 @@ Toolbar::~Toolbar(void) { delete hide_timer; delete clock_timer; - delete toolbarmenu; } @@ -384,8 +381,6 @@ void Toolbar::reconfigure(void) { style->button_width, style->button_width, True); XClearArea(display, frame.nwbutton, 0, 0, style->button_width, style->button_width, True); - - toolbarmenu->reconfigure(); } @@ -637,8 +632,8 @@ void Toolbar::buttonPressEvent(const XButtonEvent * const event) { windowmenu->popup(event->x_root, event->y_root, _screen->availableArea()); } else { - toolbarmenu->popup(event->x_root, event->y_root, - _screen->availableArea()); + _screen->toolbarmenu()->popup(event->x_root, event->y_root, + _screen->availableArea()); } } } diff --git a/src/Toolbar.hh b/src/Toolbar.hh index 06a8f6d6..e5f29943 100644 --- a/src/Toolbar.hh +++ b/src/Toolbar.hh @@ -30,9 +30,6 @@ #include "Screen.hh" -// forward declarations -class Toolbarmenu; - class Toolbar : public StackEntity, public bt::TimeoutHandler, public bt::EventHandler, public bt::NoCopy { @@ -54,7 +51,6 @@ private: Blackbox *blackbox; BScreen *_screen; bt::Timer *clock_timer, *hide_timer; - Toolbarmenu *toolbarmenu; bt::Netwm::Strut strut; std::string new_workspace_name;