summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@XPS-U.(none)>2010-07-12 00:21:55 -0700
committerSam Spilsbury <smspillaz@XPS-U.(none)>2010-07-12 00:21:55 -0700
commit35a34e20cf425377dc05115a5e0288a16e981d83 (patch)
tree2d9769ab42e892a930ec25647b38cd8439a2d55f
parent223f65e07934349137474eba538e6f506cdee2f4 (diff)
downloadzcomp-35a34e20cf425377dc05115a5e0288a16e981d83.tar.gz
zcomp-35a34e20cf425377dc05115a5e0288a16e981d83.tar.bz2
Determine the id of the appropriate child window and pass that as "window"
for xbutton events in button actions. The previous behaviour was to pass the xbutton.window, but this was usually the frame wrapper window, which meant calls to screen->findWindow () would fail since this window was not in screen->windows ();
-rw-r--r--src/event.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/event.cpp b/src/event.cpp
index ed30e05..1d6e21e 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -617,6 +617,7 @@ bool
PrivateScreen::handleActionEvent (XEvent *event)
{
static CompOption::Vector o (8);
+ Window xid;
o.resize (8);
o[0].setName ("event_window", CompOption::TypeInt);
@@ -628,8 +629,21 @@ PrivateScreen::handleActionEvent (XEvent *event)
switch (event->type) {
case ButtonPress:
+ /* We need to determine if we clicked on a parent frame
+ * window, if so, pass the appropriate child window as
+ * "window" and the frame as "event_window"
+ */
+
+ xid = event->xbutton.window;
+
+ foreach (CompWindow *w, screen->windows ())
+ {
+ if (w->frame () == xid)
+ xid = w->id ();
+ }
+
o[0].value ().set ((int) event->xbutton.window);
- o[1].value ().set ((int) event->xbutton.window);
+ o[1].value ().set ((int) xid);
o[2].value ().set ((int) event->xbutton.state);
o[3].value ().set ((int) event->xbutton.x_root);
o[4].value ().set ((int) event->xbutton.y_root);