added [mouse] pattern, matches against prop HEAD and the mouse position

This commit is contained in:
fluxgen 2007-10-22 18:29:33 +00:00
parent 1748e8ec25
commit c2badda58a
2 changed files with 25 additions and 0 deletions

View file

@ -1,6 +1,12 @@
(Format: Year/Month/Day)
Changes for 1.0.1:
*07/10/22:
* Added option "mouse" to client pattern ( Henrik )
This is usefull for xinerama. For example:
Mod1 Tab :NextWindow (head=[mouse])
This will cycle focus through windows that are on the same head as
the mouse pointer.
ClientPattern.cc
* Fixed crash bug at restart. ( Henrik )
Window.cc
* Replaced modKey with new commands StartMoving and StartResizing (Mark)

View file

@ -275,6 +275,25 @@ bool ClientPattern::match(const Focusable &win) const {
getProperty((*it)->prop, *focused))
return false;
}
} else if ((*it)->prop == HEAD &&
(*it)->orig == "[mouse]") {
// use the mouse position to determine which
// head to compare the window to
int x, y;
int win_x, win_y; // not used
Window root, child; // not used
unsigned int mask; // not used
if ( ! XQueryPointer(FbTk::App::instance()->display(),
win.screen().rootWindow().window(),
&root, &child, &x, &y,
&win_x, &win_y, &mask) ) {
return false;
}
char num[32];
sprintf(num, "%d", win.screen().getHead(x, y));
if (getProperty((*it)->prop, win) != num)
return false;
} else if (!(*it)->regexp.match(getProperty((*it)->prop, win)))
return false;
}