aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-12-03 00:33:30 (GMT)
committerfluxgen <fluxgen>2003-12-03 00:33:30 (GMT)
commit5e9b6453f0d71c64f18e8082d53f9a42e2b3ae66 (patch)
tree6ac6f11bd46e55a5ce8f1e24e14ad4584d357c23
parent8971b068ac4ab9a74bccfee93b3314a83b3cbc15 (diff)
downloadfluxbox_pavel-5e9b6453f0d71c64f18e8082d53f9a42e2b3ae66.zip
fluxbox_pavel-5e9b6453f0d71c64f18e8082d53f9a42e2b3ae66.tar.bz2
removed ToolbarHandler
-rw-r--r--src/Makefile.am2
-rw-r--r--src/Toolbar.cc42
-rw-r--r--src/Toolbar.hh9
-rw-r--r--src/fluxbox.cc20
-rw-r--r--src/fluxbox.hh5
5 files changed, 50 insertions, 28 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 92f0626..a468961 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -60,7 +60,7 @@ REGEXP_SOURCE = RegExp.hh RegExp.cc ClientPattern.hh ClientPattern.cc
60endif 60endif
61endif 61endif
62if TOOLBAR_SRC 62if TOOLBAR_SRC
63TOOLBAR_SOURCE = Toolbar.hh Toolbar.cc ToolbarHandler.hh ToolbarHandler.cc \ 63TOOLBAR_SOURCE = Toolbar.hh Toolbar.cc \
64 ToolbarTheme.hh ToolbarTheme.cc ToolbarItem.hh ToolbarItem.cc \ 64 ToolbarTheme.hh ToolbarTheme.cc ToolbarItem.hh ToolbarItem.cc \
65 ClockTool.hh ClockTool.cc \ 65 ClockTool.hh ClockTool.cc \
66 WorkspaceNameTool.hh WorkspaceNameTool.cc WorkspaceNameTheme.hh \ 66 WorkspaceNameTool.hh WorkspaceNameTool.cc WorkspaceNameTheme.hh \
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 9b76ed6..23aab97 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Toolbar.cc,v 1.126 2003/10/31 10:37:09 rathnor Exp $ 25// $Id: Toolbar.cc,v 1.127 2003/12/03 00:32:13 fluxgen Exp $
26 26
27#include "Toolbar.hh" 27#include "Toolbar.hh"
28 28
@@ -186,21 +186,23 @@ Toolbar::Frame::~Frame() {
186 evm.remove(window); 186 evm.remove(window);
187} 187}
188 188
189Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t width): 189Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width):
190 m_hidden(false), 190 m_hidden(false),
191 frame(*this, scrn.screenNumber()), 191 frame(*this, scrn.screenNumber()),
192 m_window_pm(0), 192 m_window_pm(0),
193 m_screen(scrn), 193 m_screen(scrn),
194 m_toolbarmenu(menu),
195 m_placementmenu(*scrn.menuTheme(),
196 scrn.screenNumber(), scrn.imageControl(),
197 *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())),
198 m_layermenu(*scrn.menuTheme(), 194 m_layermenu(*scrn.menuTheme(),
199 scrn.screenNumber(), 195 scrn.screenNumber(),
200 scrn.imageControl(), 196 scrn.imageControl(),
201 *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), 197 *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()),
202 this, 198 this,
203 true), 199 true),
200 m_placementmenu(*scrn.menuTheme(),
201 scrn.screenNumber(), scrn.imageControl(),
202 *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())),
203 m_toolbarmenu(*scrn.menuTheme(),
204 scrn.screenNumber(), scrn.imageControl(),
205 *scrn.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())),
204 m_theme(scrn.screenNumber()), 206 m_theme(scrn.screenNumber()),
205 m_layeritem(frame.window, layer), 207 m_layeritem(frame.window, layer),
206 m_tool_factory(scrn), 208 m_tool_factory(scrn),
@@ -270,6 +272,10 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi
270 272
271Toolbar::~Toolbar() { 273Toolbar::~Toolbar() {
272 FbTk::EventManager::instance()->remove(window()); 274 FbTk::EventManager::instance()->remove(window());
275 // remove menu items before we delete tools so we dont end up
276 // with dangling pointers to old submenu items (internal menus)
277 // from the tools
278 menu().removeAll();
273 279
274 deleteItems(); 280 deleteItems();
275 clearStrut(); 281 clearStrut();
@@ -445,7 +451,7 @@ void Toolbar::reconfigure() {
445 451
446 rearrangeItems(); 452 rearrangeItems();
447 453
448 m_toolbarmenu.reconfigure(); 454 menu().reconfigure();
449 // we're done with all resizing and stuff now we can request a new 455 // we're done with all resizing and stuff now we can request a new
450 // area to be reserved on screen 456 // area to be reserved on screen
451 updateStrut(); 457 updateStrut();
@@ -458,26 +464,26 @@ void Toolbar::buttonPressEvent(XButtonEvent &be) {
458 if (be.button != 3) 464 if (be.button != 3)
459 return; 465 return;
460 466
461 if (! m_toolbarmenu.isVisible()) { 467 if (! menu().isVisible()) {
462 int x, y; 468 int x, y;
463 469
464 x = be.x_root - (m_toolbarmenu.width() / 2); 470 x = be.x_root - (menu().width() / 2);
465 y = be.y_root - (m_toolbarmenu.height() / 2); 471 y = be.y_root - (menu().height() / 2);
466 472
467 if (x < 0) 473 if (x < 0)
468 x = 0; 474 x = 0;
469 else if (x + m_toolbarmenu.width() > screen().width()) 475 else if (x + menu().width() > screen().width())
470 x = screen().width() - m_toolbarmenu.width(); 476 x = screen().width() - menu().width();
471 477
472 if (y < 0) 478 if (y < 0)
473 y = 0; 479 y = 0;
474 else if (y + m_toolbarmenu.height() > screen().height()) 480 else if (y + menu().height() > screen().height())
475 y = screen().height() - m_toolbarmenu.height(); 481 y = screen().height() - menu().height();
476 482
477 m_toolbarmenu.move(x, y); 483 menu().move(x, y);
478 m_toolbarmenu.show(); 484 menu().show();
479 } else 485 } else
480 m_toolbarmenu.hide(); 486 menu().hide();
481 487
482} 488}
483 489
@@ -512,7 +518,7 @@ void Toolbar::leaveNotifyEvent(XCrossingEvent &not_used) {
512 if (isHidden()) { 518 if (isHidden()) {
513 if (m_hide_timer.isTiming()) 519 if (m_hide_timer.isTiming())
514 m_hide_timer.stop(); 520 m_hide_timer.stop();
515 } else if (! m_toolbarmenu.isVisible() && ! m_hide_timer.isTiming()) 521 } else if (! menu().isVisible() && ! m_hide_timer.isTiming())
516 m_hide_timer.start(); 522 m_hide_timer.start();
517 523
518} 524}
diff --git a/src/Toolbar.hh b/src/Toolbar.hh
index 3fa042f..a25077c 100644
--- a/src/Toolbar.hh
+++ b/src/Toolbar.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Toolbar.hh,v 1.48 2003/10/13 23:49:12 fluxgen Exp $ 25// $Id: Toolbar.hh,v 1.49 2003/12/03 00:31:40 fluxgen Exp $
26 26
27#ifndef TOOLBAR_HH 27#ifndef TOOLBAR_HH
28#define TOOLBAR_HH 28#define TOOLBAR_HH
@@ -71,7 +71,7 @@ public:
71 }; 71 };
72 72
73 /// Create a toolbar on the screen with specific width 73 /// Create a toolbar on the screen with specific width
74 Toolbar(BScreen &screen, FbTk::XLayer &layer, FbTk::Menu &menu, size_t width = 200); 74 Toolbar(BScreen &screen, FbTk::XLayer &layer, size_t width = 200);
75 75
76 virtual ~Toolbar(); 76 virtual ~Toolbar();
77 77
@@ -162,9 +162,10 @@ private:
162 BScreen &m_screen; ///< screen connection 162 BScreen &m_screen; ///< screen connection
163 163
164 FbTk::Timer m_hide_timer; ///< timer to for auto hide toolbar 164 FbTk::Timer m_hide_timer; ///< timer to for auto hide toolbar
165 FbTk::Menu &m_toolbarmenu; 165
166 FbMenu m_placementmenu;
167 LayerMenu<Toolbar> m_layermenu; 166 LayerMenu<Toolbar> m_layermenu;
167 FbMenu m_placementmenu, m_toolbarmenu;
168
168 169
169 // themes 170 // themes
170 ToolbarTheme m_theme; 171 ToolbarTheme m_theme;
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 7b6f0b8..e63a121 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: fluxbox.cc,v 1.201 2003/10/28 02:17:03 rathnor Exp $ 25// $Id: fluxbox.cc,v 1.202 2003/12/03 00:30:22 fluxgen Exp $
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28 28
@@ -68,7 +68,8 @@
68#endif // REMEMBER 68#endif // REMEMBER
69#ifdef USE_TOOLBAR 69#ifdef USE_TOOLBAR
70#include "Toolbar.hh" 70#include "Toolbar.hh"
71#include "ToolbarHandler.hh" 71#else
72class Toolbar { };
72#endif // USE_TOOLBAR 73#endif // USE_TOOLBAR
73 74
74// X headers 75// X headers
@@ -552,7 +553,8 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
552 553
553 m_screen_list.push_back(screen); 554 m_screen_list.push_back(screen);
554#ifdef USE_TOOLBAR 555#ifdef USE_TOOLBAR
555 m_atomhandler.push_back(new ToolbarHandler(*screen)); 556 m_toolbars.push_back(new Toolbar(*screen,
557 *screen->layerManager().getLayer(Fluxbox::instance()->getNormalLayer())));
556#endif // USE_TOOLBAR 558#endif // USE_TOOLBAR
557 559
558 // attach screen signals to this 560 // attach screen signals to this
@@ -565,9 +567,12 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
565 for (size_t atomh=0; atomh<m_atomhandler.size(); ++atomh) { 567 for (size_t atomh=0; atomh<m_atomhandler.size(); ++atomh) {
566 m_atomhandler[atomh]->initForScreen(*screen); 568 m_atomhandler[atomh]->initForScreen(*screen);
567 } 569 }
570
568 revertFocus(*screen, false); // make sure focus style is correct 571 revertFocus(*screen, false); // make sure focus style is correct
569 572
570 } 573 } // end init screens
574
575
571 m_keyscreen = m_mousescreen = m_screen_list.front(); 576 m_keyscreen = m_mousescreen = m_screen_list.front();
572 577
573 if (m_screen_list.size() == 0) { 578 if (m_screen_list.size() == 0) {
@@ -605,12 +610,19 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
605 610
606 611
607Fluxbox::~Fluxbox() { 612Fluxbox::~Fluxbox() {
613 // destroy toolbars
614 while (!m_toolbars.empty()) {
615 delete m_toolbars.back();
616 m_toolbars.pop_back();
617 }
618
608 // destroy atomhandlers 619 // destroy atomhandlers
609 while (!m_atomhandler.empty()) { 620 while (!m_atomhandler.empty()) {
610 delete m_atomhandler.back(); 621 delete m_atomhandler.back();
611 m_atomhandler.pop_back(); 622 m_atomhandler.pop_back();
612 } 623 }
613 624
625
614 clearMenuFilenames(); 626 clearMenuFilenames();
615} 627}
616 628
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index 5fc01e0..fe20625 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: fluxbox.hh,v 1.74 2003/10/05 06:28:47 rathnor Exp $ 25// $Id: fluxbox.hh,v 1.75 2003/12/03 00:29:39 fluxgen Exp $
26 26
27#ifndef FLUXBOX_HH 27#ifndef FLUXBOX_HH
28#define FLUXBOX_HH 28#define FLUXBOX_HH
@@ -65,6 +65,7 @@ class WinClient;
65class Keys; 65class Keys;
66class BScreen; 66class BScreen;
67class FbAtoms; 67class FbAtoms;
68class Toolbar;
68 69
69 70
70/// main class for the window manager. 71/// main class for the window manager.
@@ -310,6 +311,8 @@ private:
310 static Fluxbox::Titlebar s_titlebar_left[], s_titlebar_right[]; 311 static Fluxbox::Titlebar s_titlebar_left[], s_titlebar_right[];
311 static Fluxbox *s_singleton; 312 static Fluxbox *s_singleton;
312 std::vector<AtomHandler *> m_atomhandler; 313 std::vector<AtomHandler *> m_atomhandler;
314 std::vector<Toolbar *> m_toolbars;
315
313 bool m_starting; 316 bool m_starting;
314 bool m_shutdown; 317 bool m_shutdown;
315 int m_server_grabs; 318 int m_server_grabs;