all repos — fluxbox @ 5e9b6453f0d71c64f18e8082d53f9a42e2b3ae66

custom fork of the fluxbox windowmanager

removed ToolbarHandler
fluxgen fluxgen
commit

5e9b6453f0d71c64f18e8082d53f9a42e2b3ae66

parent

8971b068ac4ab9a74bccfee93b3314a83b3cbc15

5 files changed, 50 insertions(+), 28 deletions(-)

jump to
M src/Makefile.amsrc/Makefile.am

@@ -60,7 +60,7 @@ REGEXP_SOURCE = RegExp.hh RegExp.cc ClientPattern.hh ClientPattern.cc

endif endif if TOOLBAR_SRC -TOOLBAR_SOURCE = Toolbar.hh Toolbar.cc ToolbarHandler.hh ToolbarHandler.cc \ +TOOLBAR_SOURCE = Toolbar.hh Toolbar.cc \ ToolbarTheme.hh ToolbarTheme.cc ToolbarItem.hh ToolbarItem.cc \ ClockTool.hh ClockTool.cc \ WorkspaceNameTool.hh WorkspaceNameTool.cc WorkspaceNameTheme.hh \
M src/Toolbar.ccsrc/Toolbar.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.cc,v 1.126 2003/10/31 10:37:09 rathnor Exp $ +// $Id: Toolbar.cc,v 1.127 2003/12/03 00:32:13 fluxgen Exp $ #include "Toolbar.hh"

@@ -186,21 +186,23 @@ // remove windows from eventmanager

evm.remove(window); } -Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t width): +Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width): m_hidden(false), frame(*this, scrn.screenNumber()), m_window_pm(0), m_screen(scrn), - m_toolbarmenu(menu), - m_placementmenu(*scrn.menuTheme(), - scrn.screenNumber(), scrn.imageControl(), - *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_layermenu(*scrn.menuTheme(), scrn.screenNumber(), scrn.imageControl(), *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), this, true), + m_placementmenu(*scrn.menuTheme(), + scrn.screenNumber(), scrn.imageControl(), + *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), + m_toolbarmenu(*scrn.menuTheme(), + scrn.screenNumber(), scrn.imageControl(), + *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), m_theme(scrn.screenNumber()), m_layeritem(frame.window, layer), m_tool_factory(scrn),

@@ -270,6 +272,10 @@ }

Toolbar::~Toolbar() { FbTk::EventManager::instance()->remove(window()); + // remove menu items before we delete tools so we dont end up + // with dangling pointers to old submenu items (internal menus) + // from the tools + menu().removeAll(); deleteItems(); clearStrut();

@@ -445,7 +451,7 @@

rearrangeItems(); - m_toolbarmenu.reconfigure(); + menu().reconfigure(); // we're done with all resizing and stuff now we can request a new // area to be reserved on screen updateStrut();

@@ -458,26 +464,26 @@ void Toolbar::buttonPressEvent(XButtonEvent &be) {

if (be.button != 3) return; - if (! m_toolbarmenu.isVisible()) { + if (! menu().isVisible()) { int x, y; - x = be.x_root - (m_toolbarmenu.width() / 2); - y = be.y_root - (m_toolbarmenu.height() / 2); + x = be.x_root - (menu().width() / 2); + y = be.y_root - (menu().height() / 2); if (x < 0) x = 0; - else if (x + m_toolbarmenu.width() > screen().width()) - x = screen().width() - m_toolbarmenu.width(); + else if (x + menu().width() > screen().width()) + x = screen().width() - menu().width(); if (y < 0) y = 0; - else if (y + m_toolbarmenu.height() > screen().height()) - y = screen().height() - m_toolbarmenu.height(); + else if (y + menu().height() > screen().height()) + y = screen().height() - menu().height(); - m_toolbarmenu.move(x, y); - m_toolbarmenu.show(); + menu().move(x, y); + menu().show(); } else - m_toolbarmenu.hide(); + menu().hide(); }

@@ -512,7 +518,7 @@

if (isHidden()) { if (m_hide_timer.isTiming()) m_hide_timer.stop(); - } else if (! m_toolbarmenu.isVisible() && ! m_hide_timer.isTiming()) + } else if (! menu().isVisible() && ! m_hide_timer.isTiming()) m_hide_timer.start(); }
M src/Toolbar.hhsrc/Toolbar.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.hh,v 1.48 2003/10/13 23:49:12 fluxgen Exp $ +// $Id: Toolbar.hh,v 1.49 2003/12/03 00:31:40 fluxgen Exp $ #ifndef TOOLBAR_HH #define TOOLBAR_HH

@@ -71,7 +71,7 @@ RIGHTCENTER, RIGHTBOTTOM, RIGHTTOP

}; /// Create a toolbar on the screen with specific width - Toolbar(BScreen &screen, FbTk::XLayer &layer, FbTk::Menu &menu, size_t width = 200); + Toolbar(BScreen &screen, FbTk::XLayer &layer, size_t width = 200); virtual ~Toolbar();

@@ -162,9 +162,10 @@

BScreen &m_screen; ///< screen connection FbTk::Timer m_hide_timer; ///< timer to for auto hide toolbar - FbTk::Menu &m_toolbarmenu; - FbMenu m_placementmenu; + LayerMenu<Toolbar> m_layermenu; + FbMenu m_placementmenu, m_toolbarmenu; + // themes ToolbarTheme m_theme;
M src/fluxbox.ccsrc/fluxbox.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.201 2003/10/28 02:17:03 rathnor Exp $ +// $Id: fluxbox.cc,v 1.202 2003/12/03 00:30:22 fluxgen Exp $ #include "fluxbox.hh"

@@ -68,7 +68,8 @@ #include "Remember.hh"

#endif // REMEMBER #ifdef USE_TOOLBAR #include "Toolbar.hh" -#include "ToolbarHandler.hh" +#else +class Toolbar { }; #endif // USE_TOOLBAR // X headers

@@ -552,7 +553,8 @@ #endif // HAVE_RANDR

m_screen_list.push_back(screen); #ifdef USE_TOOLBAR - m_atomhandler.push_back(new ToolbarHandler(*screen)); + m_toolbars.push_back(new Toolbar(*screen, + *screen->layerManager().getLayer(Fluxbox::instance()->getNormalLayer()))); #endif // USE_TOOLBAR // attach screen signals to this

@@ -565,9 +567,12 @@ // initiate atomhandler for screen specific stuff

for (size_t atomh=0; atomh<m_atomhandler.size(); ++atomh) { m_atomhandler[atomh]->initForScreen(*screen); } + revertFocus(*screen, false); // make sure focus style is correct - } + } // end init screens + + m_keyscreen = m_mousescreen = m_screen_list.front(); if (m_screen_list.size() == 0) {

@@ -605,11 +610,18 @@ }

Fluxbox::~Fluxbox() { + // destroy toolbars + while (!m_toolbars.empty()) { + delete m_toolbars.back(); + m_toolbars.pop_back(); + } + // destroy atomhandlers while (!m_atomhandler.empty()) { delete m_atomhandler.back(); m_atomhandler.pop_back(); } + clearMenuFilenames(); }
M src/fluxbox.hhsrc/fluxbox.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.hh,v 1.74 2003/10/05 06:28:47 rathnor Exp $ +// $Id: fluxbox.hh,v 1.75 2003/12/03 00:29:39 fluxgen Exp $ #ifndef FLUXBOX_HH #define FLUXBOX_HH

@@ -65,6 +65,7 @@ class WinClient;

class Keys; class BScreen; class FbAtoms; +class Toolbar; /// main class for the window manager.

@@ -310,6 +311,8 @@ //default arguments for titlebar left and right

static Fluxbox::Titlebar s_titlebar_left[], s_titlebar_right[]; static Fluxbox *s_singleton; std::vector<AtomHandler *> m_atomhandler; + std::vector<Toolbar *> m_toolbars; + bool m_starting; bool m_shutdown; int m_server_grabs;