implement ON_SLIT actions
On the run, make it raise on left-clicks (like the toolbar) The enum already existed ;-) REQUEST: 113
This commit is contained in:
parent
4545f4dac8
commit
2678060eae
3 changed files with 36 additions and 10 deletions
|
@ -62,6 +62,9 @@ There are also some special modifiers that refer to mouse button events:::
|
|||
*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*;;
|
||||
|
|
|
@ -396,6 +396,8 @@ bool Keys::addBinding(const string &linebuffer) {
|
|||
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 @@ bool Keys::addBinding(const string &linebuffer) {
|
|||
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 @@ bool Keys::addBinding(const string &linebuffer) {
|
|||
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)) {
|
||||
|
|
35
src/Slit.cc
35
src/Slit.cc
|
@ -36,6 +36,7 @@
|
|||
#include "FbTk/MemFun.hh"
|
||||
|
||||
#include "FbCommands.hh"
|
||||
#include "Keys.hh"
|
||||
#include "Layer.hh"
|
||||
#include "LayerMenu.hh"
|
||||
#include "FbTk/Layer.hh"
|
||||
|
@ -275,6 +276,8 @@ Slit::Slit(BScreen &scr, FbTk::Layer &layer, const char *filename)
|
|||
|
||||
|
||||
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::handleEvent(XEvent &event) {
|
|||
}
|
||||
|
||||
void Slit::buttonPressEvent(XButtonEvent &be) {
|
||||
if (be.window != frame.window.window())
|
||||
return;
|
||||
Display *dpy = Fluxbox::instance()->display();
|
||||
const bool myMenuWasVisible = m_slitmenu.isVisible();
|
||||
|
||||
if (be.button == Button3) {
|
||||
if (! m_slitmenu.isVisible()) {
|
||||
screen().placementStrategy()
|
||||
.placeAndShowMenu(m_slitmenu, be.x_root, be.y_root, false);
|
||||
} else
|
||||
m_slitmenu.hide();
|
||||
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 == 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::updateCrossingState() {
|
|||
}
|
||||
|
||||
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 @@ void Slit::leaveNotifyEvent(XCrossingEvent &event) {
|
|||
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) {
|
||||
|
|
Loading…
Reference in a new issue