[fusion-commits] Mouse gesture viewport switcher: Changes to 'master' (35794e8bf31d5125eeba334b19ef8d459baae8dc)
onestone at server.opencompositing.org
onestone at server.opencompositing.org
Thu May 1 18:08:41 CEST 2008
New commits:
commit 35794e8bf31d5125eeba334b19ef8d459baae8dc
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date: Thu May 1 18:09:48 2008 +0200
Don't crash if s == NULL;
mswitch.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
Modified: fusion/plugins/mswitch/mswitch.c
===================================================================
--- fusion/plugins/mswitch/mswitch.c
+++ fusion/plugins/mswitch/mswitch.c
@@ -22,7 +22,7 @@
#include "mswitch_options.h"
static int x,y;
-static CompScreen *s;
+static CompScreen *s = NULL;
static void mswitchMove(CompScreen *s, int dx, int dy)
@@ -51,7 +51,8 @@ static Bool mswitchBegin(CompDisplay *d, CompAction * action,
Window xid;
xid = getIntOptionNamed(option, nOption, "root", 0);
- s = findScreenAtDisplay(d, xid);
+ if (xid)
+ s = findScreenAtDisplay(d, xid);
if (state & CompActionStateInitButton)
action->state |= CompActionStateTermButton;
@@ -68,7 +69,8 @@ static Bool mswitchTerminate(CompDisplay *d, CompAction * action,
CompActionState state, CompOption * option,
int nOption)
{
-
+ Window xid;
+
int mx = MAX(pointerX,x)-MIN(pointerX,x);
int my = MAX(pointerY,y)-MIN(pointerY,y);
@@ -92,8 +94,12 @@ static Bool mswitchTerminate(CompDisplay *d, CompAction * action,
dx *= -1;
if (pointerY < y)
dy *= -1;
-
- mswitchMove(s, dx, dy);
+
+ xid = getIntOptionNamed(option, nOption, "root", 0);
+ if (xid && s == findScreenAtDisplay(d, xid))
+ mswitchMove(s, dx, dy);
+
+ s = NULL;
action->state &= ~(CompActionStateTermKey | CompActionStateTermButton);
More information about the commits
mailing list