make sure window commands operate on the right window

This commit is contained in:
markt 2007-11-23 18:41:23 +00:00
parent d482cf6a54
commit 9ed25584a1
2 changed files with 12 additions and 0 deletions

View file

@ -35,6 +35,7 @@
#include "fluxbox.hh"
#include "Keys.hh"
#include "Screen.hh"
#include "WindowCmd.hh"
#include "IntResMenuItem.hh"
#include "BoolMenuItem.hh"
@ -524,6 +525,7 @@ void Toolbar::reconfigure() {
void Toolbar::buttonPressEvent(XButtonEvent &be) {
WindowCmd<void>::setWindow(0);
if (Fluxbox::instance()->keys()->doAction(be.type, be.state, be.button,
Keys::ON_TOOLBAR))
return;
@ -557,6 +559,7 @@ void Toolbar::buttonPressEvent(XButtonEvent &be) {
}
void Toolbar::enterNotifyEvent(XCrossingEvent &ce) {
WindowCmd<void>::setWindow(0);
Fluxbox::instance()->keys()->doAction(ce.type, ce.state, 0,
Keys::ON_TOOLBAR);
if (! doAutoHide()) {

View file

@ -54,12 +54,15 @@ void WindowListCmd::execute() {
FocusControl::Focusables::iterator it = win_list.begin(),
it_end = win_list.end();
// save old value, so we can restore it later
WinClient *old = WindowCmd<void>::client();
for (; it != it_end; ++it) {
if (m_pat.match(**it) && (*it)->fbwindow()) {
WindowCmd<void>::setWindow((*it)->fbwindow());
m_cmd->execute();
}
}
WindowCmd<void>::setClient(old);
}
}
@ -70,6 +73,8 @@ bool SomeCmd::bool_execute() {
FocusControl::Focusables::iterator it = win_list.begin(),
it_end = win_list.end();
// save old value, so we can restore it later
WinClient *old = WindowCmd<void>::client();
for (; it != it_end; ++it) {
WinClient *client = dynamic_cast<WinClient *>(*it);
if (!client) continue;
@ -77,6 +82,7 @@ bool SomeCmd::bool_execute() {
if (m_cmd->bool_execute())
return true;
}
WindowCmd<void>::setClient(old);
}
return false;
}
@ -88,6 +94,8 @@ bool EveryCmd::bool_execute() {
FocusControl::Focusables::iterator it = win_list.begin(),
it_end = win_list.end();
// save old value, so we can restore it later
WinClient *old = WindowCmd<void>::client();
for (; it != it_end; ++it) {
WinClient *client = dynamic_cast<WinClient *>(*it);
if (!client) continue;
@ -95,6 +103,7 @@ bool EveryCmd::bool_execute() {
if (!m_cmd->bool_execute())
return false;
}
WindowCmd<void>::setClient(old);
}
return true;
}