=== modified file 'plugins/move/move.xml.in'
--- plugins/move/move.xml.in 2010-05-25 06:26:27 +0000
+++ plugins/move/move.xml.in 2011-12-21 06:08:24 +0000
@@ -43,6 +43,13 @@
<_long>Do not update the server-side position of windows until finished moving
true
+
=== modified file 'plugins/move/src/move.cpp'
--- plugins/move/src/move.cpp 2011-10-15 11:00:51 +0000
+++ plugins/move/src/move.cpp 2011-12-21 06:08:24 +0000
@@ -96,8 +96,8 @@
ms->x = 0;
ms->y = 0;
- lastPointerX = x;
- lastPointerY = y;
+ ms->lastRootX = x;
+ ms->lastRootY = y;
sourceExternalApp =
CompOption::getBoolOptionNamed (options, "external", false);
@@ -321,8 +321,10 @@
wHeight = w->geometry ().height () +
w->geometry ().border () * 2;
- ms->x += xRoot - lastPointerX;
- ms->y += yRoot - lastPointerY;
+ ms->x += xRoot - ms->lastRootX;
+ ms->y += yRoot - ms->lastRootY;
+ ms->lastRootX = xRoot;
+ ms->lastRootY = yRoot;
if (w->type () & CompWindowTypeFullscreenMask)
{
@@ -487,20 +489,8 @@
w->move (wX + dx - w->geometry ().x (),
wY + dy - w->geometry ().y (), false);
- if (ms->optionGetLazyPositioning () &&
- ms->hasCompositing &&
- !MoveWindow::get (ms->w)->mLocked)
- {
- /* FIXME: This form of lazy positioning is broken and should
- be replaced asap. Current code exists just to avoid a
- major performance regression in the 0.5.2 release. */
- w->serverGeometry ().setX (w->geometry ().x ());
- w->serverGeometry ().setY (w->geometry ().y ());
- }
- else
- {
+ if (!ms->optionGetLazyPositioning ())
w->syncPosition ();
- }
ms->x -= dx;
ms->y -= dy;
@@ -508,30 +498,26 @@
}
}
-/* FIXME: This is a hack to prevent a race condition
- * when core is processing ConfigureNotify events. It
- * MUST be removed after 0.9.6 when we can break ABI
- * and do lazy positioning correctly ! */
+bool
+MoveScreen::updateMotion ()
+{
+ if (grab)
+ moveHandleMotionEvent (screen, pointerX, pointerY);
+ return false;
+}
void
-MoveScreen::handleCompizEvent (const char *plugin, const char *event, CompOption::Vector &options)
+MoveScreen::onMotion ()
{
- if (w)
+ if (grab && !delay.active ())
{
- if (std::string ("core") == std::string (plugin))
- {
- if (std::string ("lock_position") == std::string (event))
- {
- Window xid = CompOption::getIntOptionNamed (options, "window", 0);
- int lock = CompOption::getIntOptionNamed (options, "active", 0);
+ updateMotion ();
- if (xid == ROOTPARENT (w))
- MoveWindow::get (w)->mLocked = lock ? true : false;
- }
- }
+ int rate = optionGetSampleRate ();
+ if (rate > 0)
+ delay.start (boost::bind (&MoveScreen::updateMotion, this),
+ 1000/rate);
}
-
- screen->handleCompizEvent (plugin, event, options);
}
void
@@ -577,12 +563,12 @@
break;
case MotionNotify:
if (event->xmotion.root == screen->root ())
- moveHandleMotionEvent (screen, pointerX, pointerY);
+ onMotion ();
break;
case EnterNotify:
case LeaveNotify:
if (event->xcrossing.root == screen->root ())
- moveHandleMotionEvent (screen, pointerX, pointerY);
+ onMotion ();
break;
case ClientMessage:
if (event->xclient.message_type == Atoms::wmMoveResize)
@@ -634,7 +620,7 @@
moveInitiate (&optionGetInitiateButton (),
CompAction::StateInitButton, o);
- moveHandleMotionEvent (screen, pointerX, pointerY);
+ onMotion ();
}
}
}
@@ -721,6 +707,8 @@
PluginClassHandler (screen),
cScreen (CompositeScreen::get (screen)),
w (0),
+ lastRootX (0),
+ lastRootY (0),
region (NULL),
status (RectangleOut),
releaseButton (0),
@@ -755,6 +743,8 @@
MoveScreen::~MoveScreen ()
{
+ delay.stop ();
+
if (region)
XDestroyRegion (region);
=== modified file 'plugins/move/src/move.h'
--- plugins/move/src/move.h 2011-10-15 11:00:51 +0000
+++ plugins/move/src/move.h 2011-12-21 06:08:24 +0000
@@ -64,18 +64,21 @@
void updateOpacity ();
void handleEvent (XEvent *);
- void handleCompizEvent (const char *plugin,
- const char *event,
- CompOption::Vector &options);
bool registerPaintHandler (compiz::composite::PaintHandler *pHnd);
void unregisterPaintHandler ();
+ bool updateMotion ();
+ void onMotion ();
+
+ CompTimer delay;
CompWindow *w;
int savedX;
int savedY;
int x;
int y;
+ int lastRootX;
+ int lastRootY;
Region region;
int status;
KeyCode key[NUM_KEYS];
@@ -107,8 +110,7 @@
PluginClassHandler (window),
window (window),
gWindow (GLWindow::get (window)),
- cWindow (CompositeWindow::get (window)),
- mLocked (false)
+ cWindow (CompositeWindow::get (window))
{
if (gWindow)
GLWindowInterface::setHandler (gWindow, false);
@@ -120,8 +122,6 @@
CompWindow *window;
GLWindow *gWindow;
CompositeWindow *cWindow;
-
- bool mLocked;
};
#define MOVE_SCREEN(s) \