aboutsummaryrefslogtreecommitdiff
path: root/src/Toolbar.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Toolbar.cc')
-rw-r--r--src/Toolbar.cc30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 92ab81a..bfaec94 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -31,6 +31,7 @@
31#include "Keys.hh" 31#include "Keys.hh"
32#include "Screen.hh" 32#include "Screen.hh"
33#include "ScreenPlacement.hh" 33#include "ScreenPlacement.hh"
34#include "SystemTray.hh"
34#include "WindowCmd.hh" 35#include "WindowCmd.hh"
35 36
36#include "Strut.hh" 37#include "Strut.hh"
@@ -512,14 +513,39 @@ void Toolbar::reconfigure() {
512 513
513 514
514void Toolbar::buttonPressEvent(XButtonEvent &be) { 515void Toolbar::buttonPressEvent(XButtonEvent &be) {
516 Display *dpy = Fluxbox::instance()->display();
517 if (be.subwindow) {
518 // Do not intercept mouse events that are meant for the tray icon
519 if (SystemTray::doesControl(be.subwindow)) {
520 XAllowEvents(dpy, ReplayPointer, CurrentTime);
521 return;
522 }
523#if 0
524 // Unfortunately, the subwindow isn't exactly a reliable source here, so
525 // we COULD query the pointer (what will usually return the systray itself) and
526 // check that as well. NOTICE that due to the async nature of X11, the
527 // pointer might have moved and the result isn't correct either.
528 Window wr, wc; int junk; unsigned int ujunk;
529 XQueryPointer(dpy, be.window, &wr, &wc, &junk, &junk, &junk, &junk, &ujunk);
530 if (SystemTray::doesControl(wc)) {
531 XAllowEvents(dpy, ReplayPointer, CurrentTime);
532 return;
533 }
534#endif
535 }
536
515 if (Fluxbox::instance()->keys()->doAction(be.type, be.state, be.button, 537 if (Fluxbox::instance()->keys()->doAction(be.type, be.state, be.button,
516 Keys::ON_TOOLBAR, 0, be.time)) 538 Keys::ON_TOOLBAR, 0, be.time)) {
539 XAllowEvents(dpy, SyncPointer, CurrentTime);
517 return; 540 return;
541 }
518 542
519 if (be.button == 1) 543 if (be.button == 1)
520 raise(); 544 raise();
521 if (be.button != 2) 545 if (be.button != 2 || be.subwindow) { // only handle direct toolbar MMBs
546 XAllowEvents(dpy, ReplayPointer, CurrentTime);
522 return; 547 return;
548 }
523 549
524 screen() 550 screen()
525 .placementStrategy() 551 .placementStrategy()