summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2011-01-26 14:10:27 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-01-26 14:10:27 +0800
commit087f52341eca9ec0e7ddaa36e1bba2fbf0041cdf (patch)
tree441694e01868fc890261c651b40cbe97abb8be52
parent081e136b3616b3b9203817af32d3a0e3774d78de (diff)
downloadmobileperf-087f52341eca9ec0e7ddaa36e1bba2fbf0041cdf.tar.gz
mobileperf-087f52341eca9ec0e7ddaa36e1bba2fbf0041cdf.tar.bz2
Fix windows jumping around when clicking on parts that trigger move
Since we no longer have an unconditional passive grab on Button1 for active and raised windows, we need to check if a client sent us a _NET_WM_MOVERESIZE ClientMessage and update the pointer buffer on that. Also clean up the pointer buffer handling code again - reduce the number of roundtrips required. Remove debug message.
-rw-r--r--include/core/core.h2
-rw-r--r--include/core/screen.h2
-rw-r--r--include/core/window.h3
-rw-r--r--plugins/move/src/move.cpp14
-rw-r--r--plugins/resize/src/resize.cpp16
-rw-r--r--src/event.cpp1
-rw-r--r--src/screen.cpp25
7 files changed, 36 insertions, 27 deletions
diff --git a/include/core/core.h b/include/core/core.h
index 40f2eec..0e677d1 100644
--- a/include/core/core.h
+++ b/include/core/core.h
@@ -26,7 +26,7 @@
#ifndef _COMPIZ_CORE_H
#define _COMPIZ_CORE_H
-#define CORE_ABIVERSION 20080618
+#define CORE_ABIVERSION 20110126
#include <stdio.h>
#include <assert.h>
diff --git a/include/core/screen.h b/include/core/screen.h
index a36599b..99919ac 100644
--- a/include/core/screen.h
+++ b/include/core/screen.h
@@ -55,8 +55,10 @@ extern ModifierHandler *modHandler;
extern int lastPointerX;
extern int lastPointerY;
+extern unsigned int lastPointerMods;
extern int pointerX;
extern int pointerY;
+extern unsigned int pointerMods;
#define NOTIFY_CREATE_MASK (1 << 0)
#define NOTIFY_DELETE_MASK (1 << 1)
diff --git a/include/core/window.h b/include/core/window.h
index 08b6e68..6f1ea1b 100644
--- a/include/core/window.h
+++ b/include/core/window.h
@@ -369,8 +369,6 @@ class CompWindow :
int mapNum () const;
- CompStruts * struts ();
-
int & saveMask ();
XWindowChanges & saveWc ();
@@ -513,6 +511,7 @@ class CompWindow :
static void freePluginClassIndex (unsigned int index);
bool updateStruts ();
+ CompStruts *struts ();
WRAPABLE_HND (0, WindowInterface, void, getOutputExtents,
CompWindowExtents&);
diff --git a/plugins/move/src/move.cpp b/plugins/move/src/move.cpp
index 300d337..351ef7e 100644
--- a/plugins/move/src/move.cpp
+++ b/plugins/move/src/move.cpp
@@ -568,7 +568,6 @@ MoveScreen::handleEvent (XEvent *event)
if (w)
{
CompOption::Vector o;
- int xRoot, yRoot;
o.push_back (CompOption ("window", CompOption::TypeInt));
o[0].value ().set ((int) event->xclient.window);
@@ -584,19 +583,12 @@ MoveScreen::handleEvent (XEvent *event)
}
else
{
- unsigned int mods;
- Window root, child;
- int i;
-
- XQueryPointer (screen->dpy (), screen->root (),
- &root, &child, &xRoot, &yRoot,
- &i, &i, &mods);
/* TODO: not only button 1 */
- if (mods & Button1Mask)
+ if (pointerMods & Button1Mask)
{
o.push_back (CompOption ("modifiers", CompOption::TypeInt));
- o[2].value ().set ((int) mods);
+ o[2].value ().set ((int) pointerMods);
o.push_back (CompOption ("x", CompOption::TypeInt));
o[3].value ().set ((int) event->xclient.data.l[0]);
@@ -611,7 +603,7 @@ MoveScreen::handleEvent (XEvent *event)
moveInitiate (&optionGetInitiateButton (),
CompAction::StateInitButton, o);
- moveHandleMotionEvent (screen, xRoot, yRoot);
+ moveHandleMotionEvent (screen, pointerX, pointerY);
}
}
}
diff --git a/plugins/resize/src/resize.cpp b/plugins/resize/src/resize.cpp
index 7371e0b..2d7ad86 100644
--- a/plugins/resize/src/resize.cpp
+++ b/plugins/resize/src/resize.cpp
@@ -296,8 +296,6 @@ getOutputForEdge (int windowOutput, unsigned int touch, bool skipFirst)
while (co != -1);
}
- fprintf (stderr, "constraining to %i\n", ret);
-
return ret;
}
@@ -1279,17 +1277,9 @@ ResizeScreen::handleEvent (XEvent *event)
ResizeDownMask | ResizeLeftMask,
ResizeLeftMask,
};
- unsigned int mods;
- Window root, child;
- int xRoot, yRoot, i;
-
- XQueryPointer (screen->dpy (),
- screen->root (),
- &root, &child, &xRoot, &yRoot,
- &i, &i, &mods);
/* TODO: not only button 1 */
- if (mods & Button1Mask)
+ if (pointerMods & Button1Mask)
{
o.push_back (CompOption ("modifiers",
CompOption::TypeInt));
@@ -1302,7 +1292,7 @@ ResizeScreen::handleEvent (XEvent *event)
o.push_back (CompOption ("button",
CompOption::TypeInt));
- o[2].value ().set ((int) mods);
+ o[2].value ().set ((int) pointerMods);
o[3].value ().set
((int) event->xclient.data.l[0]);
o[4].value ().set
@@ -1318,7 +1308,7 @@ ResizeScreen::handleEvent (XEvent *event)
CompAction::StateInitButton, o);
ResizeScreen::get (screen)->
- handleMotionEvent (xRoot, yRoot);
+ handleMotionEvent (pointerX, pointerY);
}
}
}
diff --git a/src/event.cpp b/src/event.cpp
index 2cf55b4..7ab5843 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -1008,6 +1008,7 @@ CompScreen::handleEvent (XEvent *event)
w = findWindow (priv->activeWindow);
if (w)
priv->setCurrentOutput (w->outputDevice ());
+ break;
default:
break;
}
diff --git a/src/screen.cpp b/src/screen.cpp
index 2c25c07..f52bebf 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -71,8 +71,10 @@ CompOutput *targetOutput;
int lastPointerX = 0;
int lastPointerY = 0;
+unsigned int lastPointerMods = 0;
int pointerX = 0;
int pointerY = 0;
+unsigned int pointerMods = 0;
#define MwmHintsFunctions (1L << 0)
#define MwmHintsDecorations (1L << 1)
@@ -752,27 +754,49 @@ PrivateScreen::processEvents ()
case ButtonRelease:
pointerX = event.xbutton.x_root;
pointerY = event.xbutton.y_root;
+ pointerMods = event.xbutton.state;
break;
case KeyPress:
case KeyRelease:
pointerX = event.xkey.x_root;
pointerY = event.xkey.y_root;
+ pointerMods = event.xbutton.state;
break;
case MotionNotify:
pointerX = event.xmotion.x_root;
pointerY = event.xmotion.y_root;
+ pointerMods = event.xbutton.state;
break;
case EnterNotify:
case LeaveNotify:
pointerX = event.xcrossing.x_root;
pointerY = event.xcrossing.y_root;
+ pointerMods = event.xbutton.state;
break;
case ClientMessage:
if (event.xclient.message_type == Atoms::xdndPosition)
{
pointerX = event.xclient.data.l[2] >> 16;
pointerY = event.xclient.data.l[2] & 0xffff;
+ /* FIXME: Xdnd provides us no way of getting the pointer mods
+ * without doing XQueryPointer, which is a round-trip */
+ pointerMods = 0;
}
+ else if (event.xclient.message_type == Atoms::wmMoveResize)
+ {
+ int i;
+ Window child, root;
+ /* _NET_WM_MOVERESIZE is most often sent by clients who provide
+ * a special "grab space" on a window for the user to initiate
+ * adjustment by the window manager. Since we don't have a
+ * passive grab on Button1 for active and raised windows, we
+ * need to update the pointer buffer here */
+
+ XQueryPointer (screen->dpy (), screen->root (),
+ &root, &child, &pointerX, &pointerY,
+ &i, &i, &pointerMods);
+ }
+ break;
default:
break;
}
@@ -785,6 +809,7 @@ PrivateScreen::processEvents ()
lastPointerX = pointerX;
lastPointerY = pointerY;
+ lastPointerMods = pointerMods;
}
}