aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lübking <thomas.luebking@gmail.com>2016-09-13 07:37:46 (GMT)
committerMathias Gumz <akira@fluxbox.org>2016-09-21 18:52:14 (GMT)
commit2678060eae574f3ff0858cd7907feaeb3c1f43df (patch)
tree4fb4fb7ab2f256566354767aecb34b1b9672ecb0
parent4545f4dac81f61b7e99769006888a8688eeb542c (diff)
downloadfluxbox-2678060eae574f3ff0858cd7907feaeb3c1f43df.zip
fluxbox-2678060eae574f3ff0858cd7907feaeb3c1f43df.tar.bz2
implement ON_SLIT actions
On the run, make it raise on left-clicks (like the toolbar) The enum already existed ;-) REQUEST: 113
-rw-r--r--doc/asciidoc/fluxbox-keys.txt3
-rw-r--r--src/Keys.cc8
-rw-r--r--src/Slit.cc33
3 files changed, 35 insertions, 9 deletions
diff --git a/doc/asciidoc/fluxbox-keys.txt b/doc/asciidoc/fluxbox-keys.txt
index b7ae264..26a148b 100644
--- a/doc/asciidoc/fluxbox-keys.txt
+++ b/doc/asciidoc/fluxbox-keys.txt
@@ -62,6 +62,9 @@ There are also some special modifiers that refer to mouse button events:::
62*OnToolbar*;; 62*OnToolbar*;;
63 The mouse cursor is over the toolbar (which is normally at the bottom 63 The mouse cursor is over the toolbar (which is normally at the bottom
64 of the screen). 64 of the screen).
65*OnSlit*;;
66 The mouse cursor is over the mystic slit (the thing that collects dock type
67 windows).
65*OnWindow*;; 68*OnWindow*;;
66 The mouse cursor is over a window. 69 The mouse cursor is over a window.
67*OnTitlebar*;; 70*OnTitlebar*;;
diff --git a/src/Keys.cc b/src/Keys.cc
index 846edea..774cd05 100644
--- a/src/Keys.cc
+++ b/src/Keys.cc
@@ -396,6 +396,8 @@ bool Keys::addBinding(const string &linebuffer) {
396 context |= ON_DESKTOP; 396 context |= ON_DESKTOP;
397 else if (arg == "ontoolbar") 397 else if (arg == "ontoolbar")
398 context |= ON_TOOLBAR; 398 context |= ON_TOOLBAR;
399 else if (arg == "onslit")
400 context |= ON_SLIT;
399 else if (arg == "onwindow") 401 else if (arg == "onwindow")
400 context |= ON_WINDOW; 402 context |= ON_WINDOW;
401 else if (arg == "ontitlebar") 403 else if (arg == "ontitlebar")
@@ -431,12 +433,12 @@ bool Keys::addBinding(const string &linebuffer) {
431 type = FocusIn; 433 type = FocusIn;
432 } else if (arg == "mouseover") { 434 } else if (arg == "mouseover") {
433 type = EnterNotify; 435 type = EnterNotify;
434 if (!(context & (ON_WINDOW|ON_TOOLBAR))) 436 if (!(context & (ON_WINDOW|ON_TOOLBAR|ON_SLIT)))
435 context |= ON_WINDOW; 437 context |= ON_WINDOW;
436 key = 0; 438 key = 0;
437 } else if (arg == "mouseout") { 439 } else if (arg == "mouseout") {
438 type = LeaveNotify; 440 type = LeaveNotify;
439 if (!(context & (ON_WINDOW|ON_TOOLBAR))) 441 if (!(context & (ON_WINDOW|ON_TOOLBAR|ON_SLIT)))
440 context |= ON_WINDOW; 442 context |= ON_WINDOW;
441 key = 0; 443 key = 0;
442 444
@@ -451,6 +453,8 @@ bool Keys::addBinding(const string &linebuffer) {
451 context = ON_TITLEBAR; 453 context = ON_TITLEBAR;
452 else if (strstr(arg.c_str(), "bar")) 454 else if (strstr(arg.c_str(), "bar"))
453 context = ON_TOOLBAR; 455 context = ON_TOOLBAR;
456 else if (strstr(arg.c_str(), "slit"))
457 context = ON_SLIT;
454 else if (strstr(arg.c_str(), "ow")) 458 else if (strstr(arg.c_str(), "ow"))
455 context = ON_WINDOW; 459 context = ON_WINDOW;
456 } else if (extractKeyFromString(arg, "click", key)) { 460 } else if (extractKeyFromString(arg, "click", key)) {
diff --git a/src/Slit.cc b/src/Slit.cc
index 37c3b1f..a7bd50f 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -36,6 +36,7 @@
36#include "FbTk/MemFun.hh" 36#include "FbTk/MemFun.hh"
37 37
38#include "FbCommands.hh" 38#include "FbCommands.hh"
39#include "Keys.hh"
39#include "Layer.hh" 40#include "Layer.hh"
40#include "LayerMenu.hh" 41#include "LayerMenu.hh"
41#include "FbTk/Layer.hh" 42#include "FbTk/Layer.hh"
@@ -275,6 +276,8 @@ Slit::Slit(BScreen &scr, FbTk::Layer &layer, const char *filename)
275 276
276 277
277 FbTk::EventManager::instance()->add(*this, frame.window); 278 FbTk::EventManager::instance()->add(*this, frame.window);
279 FbTk::EventManager::instance()->addParent(*this, window());
280 Fluxbox::instance()->keys()->registerWindow(window().window(), *this, Keys::ON_SLIT);
278 281
279 if (FbTk::Transparent::haveComposite()) { 282 if (FbTk::Transparent::haveComposite()) {
280 frame.window.setOpaque(*m_rc_alpha); 283 frame.window.setOpaque(*m_rc_alpha);
@@ -943,16 +946,27 @@ void Slit::handleEvent(XEvent &event) {
943} 946}
944 947
945void Slit::buttonPressEvent(XButtonEvent &be) { 948void Slit::buttonPressEvent(XButtonEvent &be) {
946 if (be.window != frame.window.window()) 949 Display *dpy = Fluxbox::instance()->display();
950 const bool myMenuWasVisible = m_slitmenu.isVisible();
951
952 FbTk::Menu::hideShownMenu();
953
954 if (Fluxbox::instance()->keys()->doAction(be.type, be.state, be.button,
955 Keys::ON_SLIT, 0, be.time)) {
956 XAllowEvents(dpy, SyncPointer, CurrentTime);
947 return; 957 return;
958 }
959
960 if (be.button == 1)
961 frame.window.raise();
948 962
949 if (be.button == Button3) { 963 if (be.button != Button3) {
950 if (! m_slitmenu.isVisible()) { 964 XAllowEvents(dpy, ReplayPointer, CurrentTime);
951 screen().placementStrategy() 965 return;
952 .placeAndShowMenu(m_slitmenu, be.x_root, be.y_root, false);
953 } else
954 m_slitmenu.hide();
955 } 966 }
967
968 if (!myMenuWasVisible)
969 screen().placementStrategy().placeAndShowMenu(m_slitmenu, be.x_root, be.y_root, false);
956} 970}
957 971
958 972
@@ -979,6 +993,8 @@ void Slit::updateCrossingState() {
979} 993}
980 994
981void Slit::enterNotifyEvent(XCrossingEvent &ce) { 995void Slit::enterNotifyEvent(XCrossingEvent &ce) {
996 Fluxbox::instance()->keys()->doAction(ce.type, ce.state, 0, Keys::ON_SLIT);
997
982 if (!m_rc_auto_hide && isHidden()) { 998 if (!m_rc_auto_hide && isHidden()) {
983 toggleHidden(); 999 toggleHidden();
984 } 1000 }
@@ -995,6 +1011,9 @@ void Slit::leaveNotifyEvent(XCrossingEvent &event) {
995 if (!m_timer.isTiming() && (m_rc_auto_hide && !isHidden()) || 1011 if (!m_timer.isTiming() && (m_rc_auto_hide && !isHidden()) ||
996 (m_rc_auto_raise && m_layeritem->getLayerNum() != m_rc_layernum->getNum())) 1012 (m_rc_auto_raise && m_layeritem->getLayerNum() != m_rc_layernum->getNum()))
997 m_timer.start(); 1013 m_timer.start();
1014
1015 if (!isHidden())
1016 Fluxbox::instance()->keys()->doAction(event.type, event.state, 0, Keys::ON_SLIT);
998} 1017}
999 1018
1000void Slit::configureRequestEvent(XConfigureRequestEvent &event) { 1019void Slit::configureRequestEvent(XConfigureRequestEvent &event) {