From c2badda58a53ed00f8a53e9ce162d52669296741 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Mon, 22 Oct 2007 18:29:33 +0000 Subject: added [mouse] pattern, matches against prop HEAD and the mouse position --- ChangeLog | 6 ++++++ src/ClientPattern.cc | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/ChangeLog b/ChangeLog index eb3c57f..e4024fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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) diff --git a/src/ClientPattern.cc b/src/ClientPattern.cc index 538b708..3cb9e9f 100644 --- a/src/ClientPattern.cc +++ b/src/ClientPattern.cc @@ -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; } -- cgit v0.11.2