all repos — fluxbox @ 2678060eae574f3ff0858cd7907feaeb3c1f43df

custom fork of the fluxbox windowmanager

implement ON_SLIT actions

On the run, make it raise on left-clicks (like the toolbar)

The enum already existed ;-)

REQUEST: 113
Thomas Lübking thomas.luebking@gmail.com
commit

2678060eae574f3ff0858cd7907feaeb3c1f43df

parent

4545f4dac81f61b7e99769006888a8688eeb542c

3 files changed, 35 insertions(+), 9 deletions(-)

jump to
M doc/asciidoc/fluxbox-keys.txtdoc/asciidoc/fluxbox-keys.txt

@@ -62,6 +62,9 @@ window.

*OnToolbar*;; The mouse cursor is over the toolbar (which is normally at the bottom of the screen). +*OnSlit*;; + The mouse cursor is over the mystic slit (the thing that collects dock type + windows). *OnWindow*;; The mouse cursor is over a window. *OnTitlebar*;;
M src/Keys.ccsrc/Keys.cc

@@ -396,6 +396,8 @@ else if (arg == "ondesktop")

context |= ON_DESKTOP; else if (arg == "ontoolbar") context |= ON_TOOLBAR; + else if (arg == "onslit") + context |= ON_SLIT; else if (arg == "onwindow") context |= ON_WINDOW; else if (arg == "ontitlebar")

@@ -431,12 +433,12 @@ mod = key = 0;

type = FocusIn; } else if (arg == "mouseover") { type = EnterNotify; - if (!(context & (ON_WINDOW|ON_TOOLBAR))) + if (!(context & (ON_WINDOW|ON_TOOLBAR|ON_SLIT))) context |= ON_WINDOW; key = 0; } else if (arg == "mouseout") { type = LeaveNotify; - if (!(context & (ON_WINDOW|ON_TOOLBAR))) + if (!(context & (ON_WINDOW|ON_TOOLBAR|ON_SLIT))) context |= ON_WINDOW; key = 0;

@@ -451,6 +453,8 @@ else if (strstr(arg.c_str(), "ebar"))

context = ON_TITLEBAR; else if (strstr(arg.c_str(), "bar")) context = ON_TOOLBAR; + else if (strstr(arg.c_str(), "slit")) + context = ON_SLIT; else if (strstr(arg.c_str(), "ow")) context = ON_WINDOW; } else if (extractKeyFromString(arg, "click", key)) {
M src/Slit.ccsrc/Slit.cc

@@ -36,6 +36,7 @@ #include "FbTk/MacroCommand.hh"

#include "FbTk/MemFun.hh" #include "FbCommands.hh" +#include "Keys.hh" #include "Layer.hh" #include "LayerMenu.hh" #include "FbTk/Layer.hh"

@@ -275,6 +276,8 @@ m_timer.setCommand(ucs);

FbTk::EventManager::instance()->add(*this, frame.window); + FbTk::EventManager::instance()->addParent(*this, window()); + Fluxbox::instance()->keys()->registerWindow(window().window(), *this, Keys::ON_SLIT); if (FbTk::Transparent::haveComposite()) { frame.window.setOpaque(*m_rc_alpha);

@@ -943,16 +946,27 @@ }

} void Slit::buttonPressEvent(XButtonEvent &be) { - if (be.window != frame.window.window()) + Display *dpy = Fluxbox::instance()->display(); + const bool myMenuWasVisible = m_slitmenu.isVisible(); + + FbTk::Menu::hideShownMenu(); + + if (Fluxbox::instance()->keys()->doAction(be.type, be.state, be.button, + Keys::ON_SLIT, 0, be.time)) { + XAllowEvents(dpy, SyncPointer, CurrentTime); return; + } - if (be.button == Button3) { - if (! m_slitmenu.isVisible()) { - screen().placementStrategy() - .placeAndShowMenu(m_slitmenu, be.x_root, be.y_root, false); - } else - m_slitmenu.hide(); + if (be.button == 1) + frame.window.raise(); + + if (be.button != Button3) { + XAllowEvents(dpy, ReplayPointer, CurrentTime); + return; } + + if (!myMenuWasVisible) + screen().placementStrategy().placeAndShowMenu(m_slitmenu, be.x_root, be.y_root, false); }

@@ -979,6 +993,8 @@ }

} void Slit::enterNotifyEvent(XCrossingEvent &ce) { + Fluxbox::instance()->keys()->doAction(ce.type, ce.state, 0, Keys::ON_SLIT); + if (!m_rc_auto_hide && isHidden()) { toggleHidden(); }

@@ -995,6 +1011,9 @@

if (!m_timer.isTiming() && (m_rc_auto_hide && !isHidden()) || (m_rc_auto_raise && m_layeritem->getLayerNum() != m_rc_layernum->getNum())) m_timer.start(); + + if (!isHidden()) + Fluxbox::instance()->keys()->doAction(event.type, event.state, 0, Keys::ON_SLIT); } void Slit::configureRequestEvent(XConfigureRequestEvent &event) {