add OnWindow modifier to keys file

This commit is contained in:
markt 2007-10-15 18:05:28 +00:00
parent 7e4f8a3853
commit 72130f350e
5 changed files with 28 additions and 2 deletions

View file

@ -1,5 +1,8 @@
(Format: Year/Month/Day)
Changes for 1.0.1:
*07/10/15:
* Added OnWindow modifier to keys file (Mark)
Keys.cc Window.cc Screen.cc CurrentWindowCmd.cc
*07/10/14:
* Added support for transient windows in window patterns, e.g.
(transient=yes|no), defaulting to "no" for the apps file (Mark)

View file

@ -26,6 +26,7 @@
#include "fluxbox.hh"
#include "Window.hh"
#include "WindowCmd.hh"
#include "Screen.hh"
#include "WinClient.hh"
@ -33,7 +34,7 @@
void WindowHelperCmd::execute() {
m_win = 0;
if (FocusControl::focusedFbWindow()) // guarantee that fbwindow() exists too
if (WindowCmd<void>::window() || FocusControl::focusedFbWindow())
real_execute();
}
@ -44,7 +45,11 @@ void WindowHelperCmd::execute(FluxboxWindow &win) {
FluxboxWindow &WindowHelperCmd::fbwindow() {
// will exist from execute above
return (m_win ? *m_win : *FocusControl::focusedFbWindow());
if (m_win)
return *m_win;
FluxboxWindow *tmp = WindowCmd<void>::window();
if (tmp) return *tmp;
return *FocusControl::focusedFbWindow();
}
void CurrentWindowCmd::real_execute() {

View file

@ -301,6 +301,8 @@ bool Keys::addBinding(const string &linebuffer) {
context |= ON_DESKTOP;
else if (strcasecmp("ontoolbar", val[argc].c_str()) == 0)
context |= ON_TOOLBAR;
else if (strcasecmp("onwindow", val[argc].c_str()) == 0)
context |= ON_WINDOW;
else if (strcasecmp("NONE",val[argc].c_str())) {
// check if it's a mouse button
if (!strcasecmp(val[argc].substr(0,5).c_str(), "mouse") &&

View file

@ -30,6 +30,7 @@
#include "fluxbox.hh"
#include "Keys.hh"
#include "Window.hh"
#include "WindowCmd.hh"
#include "Workspace.hh"
#include "Layer.hh"
@ -827,6 +828,7 @@ void BScreen::propertyNotify(Atom atom) {
void BScreen::keyPressEvent(XKeyEvent &ke) {
if (!m_typing_ahead) {
WindowCmd<void>::setWindow(FocusControl::focusedFbWindow());
Fluxbox::instance()->keys()->doAction(ke.type, ke.state, ke.keycode,
Keys::GLOBAL|Keys::ON_DESKTOP);
return;
@ -882,6 +884,7 @@ void BScreen::buttonPressEvent(XButtonEvent &be) {
imageControl().installRootColormap();
Keys *keys = Fluxbox::instance()->keys();
WindowCmd<void>::setWindow(FocusControl::focusedFbWindow());
keys->doAction(be.type, be.state, be.button, Keys::GLOBAL|Keys::ON_DESKTOP);
}

View file

@ -28,6 +28,7 @@
#include "WinClient.hh"
#include "fluxbox.hh"
#include "Keys.hh"
#include "Screen.hh"
#include "FbWinFrameTheme.hh"
#include "FbAtoms.hh"
@ -285,6 +286,9 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm,
else
screen().focusControl().addFocusWinBack(*this);
Fluxbox::instance()->keys()->registerWindow(frame().window().window(),
Keys::ON_WINDOW);
}
@ -292,6 +296,8 @@ FluxboxWindow::~FluxboxWindow() {
if (WindowCmd<void>::window() == this)
WindowCmd<void>::setWindow(0);
Fluxbox::instance()->keys()->unregisterWindow(frame().window().window());
#ifdef DEBUG
const char* title = m_client ? m_client->title().c_str() : "" ;
cerr<<__FILE__<<"("<<__LINE__<<"): starting ~FluxboxWindow("<<this<<","<<title<<")"<<endl;
@ -2576,6 +2582,13 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
m_last_button_x = be.x_root;
m_last_button_y = be.y_root;
// check keys file first
WindowCmd<void>::setWindow(this);
if (Fluxbox::instance()->keys()->doAction(be.type, be.state, be.button,
Keys::ON_WINDOW)) {
return;
}
// check frame events first
frame().buttonPressEvent(be);