[fusion-commits] Expo plugin: Changes to 'master' (9b098656d93b6812060d01eb5dcac95968883a5b)
maniac at server.beryl-project.org
maniac at server.beryl-project.org
Sat Aug 4 17:47:08 CEST 2007
New commits:
commit 9b098656d93b6812060d01eb5dcac95968883a5b
Author: Danny Baumann <dannybaumann at web.de>
Date: Sat Aug 4 17:46:26 2007 +0200
Use expoTermExpo when leaving expo mode to avoid code duplication.
commit 94083a3b99c9a604e511a5a34b6bc0b1a14df69b
Author: Danny Baumann <dannybaumann at web.de>
Date: Sat Aug 4 17:30:28 2007 +0200
Fix mouse pointer desynchronization on window move by synchronizing the viewport changes only on ungrab.
Also removed some unneeded code.
expo.c | 235 +++++++++++++++++++++++++++------------------------------------
1 files changed, 101 insertions(+), 134 deletions(-)
Modified: fusion/plugins/expo/expo.c
===================================================================
--- fusion/plugins/expo/expo.c
+++ fusion/plugins/expo/expo.c
@@ -97,9 +97,7 @@ typedef struct _ExpoScreen
int mouseOverViewY;
Bool anyClick;
-
Bool leaveExpo;
- Bool updateVP;
} ExpoScreen;
typedef struct _xyz_tuple
@@ -141,6 +139,94 @@ expoMoveFocusViewport (CompScreen *s,
damageScreen (s);
}
+static Bool
+expoTermExpo (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
+{
+ CompScreen *s;
+
+ if (!(state & CompActionStateCancel))
+ return FALSE;
+
+ for (s = d->screens; s; s = s->next)
+ {
+ EXPO_SCREEN (s);
+
+ if (!es->expoMode)
+ continue;
+
+ es->expoMode = FALSE;
+ es->anyClick = FALSE;
+
+ if (es->dndWindow)
+ syncWindowPosition (es->dndWindow);
+
+ es->dndState = DnDNone;
+ es->dndWindow = 0;
+
+ if (es->origVX >= 0 && es->origVY >= 0)
+ moveScreenViewport (s, s->x - es->origVX, s->y - es->origVY, TRUE);
+
+ damageScreen (s);
+ focusDefaultWindow (s->display);
+ }
+
+ return TRUE;
+}
+
+static Bool
+expoExpo (CompDisplay *d,
+ CompAction *action,
+ CompActionState state,
+ CompOption *option,
+ int nOption)
+{
+ CompScreen *s;
+ Window xid;
+
+ xid = getIntOptionNamed (option, nOption, "root", 0);
+ s = findScreenAtDisplay (d, xid);
+
+ if (s)
+ {
+ EXPO_SCREEN (s);
+
+ if (otherScreenGrabExist (s, "expo", 0))
+ return FALSE;
+
+ es->expoMode = !es->expoMode;
+
+ if (es->expoMode)
+ {
+ if (!es->grabIndex)
+ es->grabIndex = pushScreenGrab (s, None, "expo");
+
+ es->anyClick = FALSE;
+ es->dndState = DnDNone;
+ es->dndWindow = None;
+
+ es->origVX = -1;
+ es->origVY = -1;
+ es->rorigx = s->x;
+ es->rorigy = s->y;
+
+ damageScreen (s);
+ }
+ else
+ {
+ expoTermExpo (d, action, state | CompActionStateCancel,
+ option, nOption);
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
expoHandleEvent (CompDisplay *d,
XEvent *event)
@@ -182,16 +268,17 @@ expoHandleEvent (CompDisplay *d,
if (es->expoMode)
{
es->anyClick = TRUE;
- es->updateVP = TRUE;
damageScreen (s);
if (event->xbutton.button == Button1)
- {
- es->updateVP = FALSE;
es->dndState = DnDStart;
- }
else if (event->xbutton.button != Button5)
- es->leaveExpo = TRUE;
+ {
+ CompAction *action;
+
+ action = expoGetExpo (d);
+ expoTermExpo (d, action, CompActionStateCancel, NULL, 0);
+ }
}
}
break;
@@ -214,6 +301,10 @@ expoHandleEvent (CompDisplay *d,
syncWindowPosition (w);
(*s->windowUngrabNotify) (w);
+ if (es->origVX >= 0 && es->origVY >= 0)
+ moveScreenViewport (s, s->x - es->origVX,
+ s->y - es->origVY, TRUE);
+
/* update window attibutes to make sure a
moved maximized window is properly snapped
to the work area */
@@ -261,108 +352,6 @@ expoHandleEvent (CompDisplay *d,
WRAP (ed, d, handleEvent, expoHandleEvent);
}
-static Bool
-expoExpo (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
- Window xid;
-
- xid = getIntOptionNamed (option, nOption, "root", 0);
- s = findScreenAtDisplay(d, xid);
-
- if (s)
- {
- EXPO_SCREEN (s);
-
- if (otherScreenGrabExist (s, "expo", 0))
- return FALSE;
-
- es->expoMode = !es->expoMode;
- es->anyClick = FALSE;
-
- if (es->expoMode && !es->grabIndex)
- es->grabIndex = pushScreenGrab (s, None, "expo");
-
- if (es->dndWindow)
- syncWindowPosition (es->dndWindow);
-
- es->dndState = DnDNone;
- es->dndWindow = 0;
-
- if (!es->expoMode && es->origVX >= 0 && es->origVY >= 0)
- {
- while (s->x != es->origVX)
- moveScreenViewport (s, 1, 0, TRUE);
-
- while (s->y != es->origVY)
- moveScreenViewport (s, 0, 1, TRUE);
- }
-
- if (es->expoMode)
- {
- es->origVX = -1;
- es->origVY = -1;
- es->rorigx = s->x;
- es->rorigy = s->y;
- }
-
- damageScreen (s);
- focusDefaultWindow (s->display);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static Bool
-expoTermExpo (CompDisplay *d,
- CompAction *action,
- CompActionState state,
- CompOption *option,
- int nOption)
-{
- CompScreen *s;
-
- if (state != CompActionStateCancel)
- return FALSE;
-
- for (s = d->screens; s; s = s->next)
- {
- EXPO_SCREEN (s);
-
- if (!es->expoMode)
- continue;
-
- es->expoMode = FALSE;
- es->anyClick = FALSE;
-
- if (es->dndWindow)
- syncWindowPosition (es->dndWindow);
-
- es->dndState = DnDNone;
- es->dndWindow = 0;
-
- if (es->origVX >= 0 && es->origVY >= 0)
- {
- while (s->x != es->origVX)
- moveScreenViewport (s, 1, 0, TRUE);
-
- while (s->y != es->origVY)
- moveScreenViewport (s, 0, 1, TRUE);
- }
-
- damageScreen (s);
- focusDefaultWindow (s->display);
- }
-
- return TRUE;
-}
-
static void
invertTransformedVertex (CompScreen *s,
const ScreenPaintAttrib *sAttrib,
@@ -649,12 +638,8 @@ expoPaintWall (CompScreen *s,
if (es->anyClick || es->dndState != DnDNone)
{
/* Used to save last viewport interaction was in */
- if (es->origVX != i || es->origVY != j)
- {
- es->origVX = i;
- es->origVY = j;
- es->updateVP = TRUE;
- }
+ es->origVX = i;
+ es->origVY = j;
es->anyClick = FALSE;
}
}
@@ -855,25 +840,8 @@ expoDonePaintScreen (CompScreen * s)
{
EXPO_SCREEN (s);
- if (es->expoMode && es->updateVP)
+ if (es->expoMode && es->leaveExpo)
{
- CompWindow *w;
-
- for (w = s->windows; w; w = w->next)
- syncWindowPosition (w);
-
- damageScreen (s);
-
- es->origVX = es->mouseOverViewX;
- es->origVY = es->mouseOverViewY;
- es->updateVP = FALSE;
-
- while (s->x != es->mouseOverViewX)
- moveScreenViewport (s, 1, 0, TRUE);
-
- while (s->y != es->mouseOverViewY)
- moveScreenViewport (s, 0, 1, TRUE);
-
if (es->leaveExpo)
{
focusDefaultWindow (s->display);
@@ -1033,7 +1001,6 @@ expoInitScreen (CompPlugin *p,
es->anyClick = FALSE;
es->leaveExpo = FALSE;
- es->updateVP = FALSE;
es->mouseOverViewX = 0;
es->mouseOverViewY = 0;
More information about the commits
mailing list