diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Keys.cc | 8 | ||||
-rw-r--r-- | src/Slit.cc | 33 |
2 files changed, 32 insertions, 9 deletions
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 | ||
945 | void Slit::buttonPressEvent(XButtonEvent &be) { | 948 | void 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 | ||
981 | void Slit::enterNotifyEvent(XCrossingEvent &ce) { | 995 | void 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 | ||
1000 | void Slit::configureRequestEvent(XConfigureRequestEvent &event) { | 1019 | void Slit::configureRequestEvent(XConfigureRequestEvent &event) { |