All pastes #358659 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-02-16 10:45 UTC
rendered paste body
Index: src/wall.c
===================================================================
--- src/wall.c	(Revision 4092)
+++ src/wall.c	(Arbeitskopie)
@@ -380,7 +380,57 @@
 		if (ws->expoMode)
 		{
 			if (event->xbutton.button == Button1)
-				ws->dndState = DnDStart;
+			{
+				int origView = s->x;
+				int origViewY = s->y;
+				CompWindow *w;
+
+				ws->dndState = DnDNone;
+
+				moveScreenViewport(s, s->x, s->y, FALSE);
+
+				for (w = s->reverseWindows; w; w = w->prev)
+				{
+					if (w->destroyed)
+						continue;
+
+					if (!w->shaded && (w->attrib.map_state != IsViewable || !w->damaged))
+						continue;
+
+					if (w->state & CompWindowStateOffscreenMask)
+						continue;
+
+					if (w->type & CompWindowTypeNormalMask)
+					{
+						if (ws->newCursorX < WIN_X(w) || ws->newCursorX > WIN_X(w) + WIN_W(w))
+							continue;
+						if (ws->newCursorY < WIN_Y(w) || ws->newCursorY > WIN_Y(w) + WIN_H(w))
+							continue;
+
+						ws->dndState = DnDDuring;
+						ws->dndWindow = w;
+						(*w->screen->windowGrabNotify) (w, ws->newCursorX, ws->newCursorY, 0,
+								CompWindowGrabMoveMask | CompWindowGrabButtonMask);
+						break;
+					}
+				}
+				if (ws->dndWindow)
+				{
+					raiseWindow(ws->dndWindow);
+					moveInputFocusToWindow(ws->dndWindow);
+				}
+
+				moveScreenViewport(s, -origView, -origViewY, FALSE);
+
+				for (w = s->windows; w; w = w->next)
+				{
+					WALL_WINDOW(w);
+					ww->hovered = FALSE;
+				}
+
+				ws->prevCursorX = ws->newCursorX;
+				ws->prevCursorY = ws->newCursorY;
+			}
 			else if (event->xbutton.button != Button5)
 			{
 				CompWindow *w;
@@ -427,7 +477,7 @@
 			ws->dndState = DnDNone;
 			ws->dndWindow = NULL;
 		}
-		break; // FIXME: I'm not sure this break is needed, but I think so
+		break; 
 	case ClientMessage:
 		if (event->xclient.message_type == d->winActiveAtom)
 		{
@@ -1746,7 +1796,7 @@
 		int dy = ws->newCursorY - ws->prevCursorY;
 
 		if (ws->dndWindow && !ws->stickyWindow)
-			moveWindow(ws->dndWindow, dx, dy, TRUE, TRUE);
+			moveWindow(ws->dndWindow, dx, dy, TRUE, FALSE); //!!!
 
 		ws->prevCursorX = ws->newCursorX;
 		ws->prevCursorY = ws->newCursorY;
@@ -1754,68 +1804,6 @@
 
 		damageScreen(s);
 	}
-
-	if (ws->dndState != DnDStart)
-		return;
-
-	int origView = s->x;
-	int origViewY = s->y;
-
-	// needs to be moved into handle event
-	moveScreenViewport(s, s->x, s->y, FALSE);
-
-	CompWindow *w;
-
-	for (w = s->reverseWindows; w; w = w->prev)
-	{
-		if (w->destroyed)
-			continue;
-
-		if (!w->shaded)
-		{
-			if (w->attrib.map_state != IsViewable || !w->damaged)
-				continue;
-		}
-
-		if (w->state & CompWindowStateOffscreenMask)
-			continue;
-
-		if (w->type & CompWindowTypeNormalMask)
-		{
-			if (ws->newCursorX < WIN_X(w) ||
-				ws->newCursorX > WIN_X(w) + WIN_W(w))
-				continue;
-			if (ws->newCursorY < WIN_Y(w) ||
-				ws->newCursorY > WIN_Y(w) + WIN_H(w))
-				continue;
-			ws->dndState = DnDDuring;
-			ws->dndWindow = w;
-			(*w->screen->windowGrabNotify) (w, ws->newCursorX, ws->newCursorY, 0,
-					CompWindowGrabMoveMask | CompWindowGrabButtonMask);
-			break;
-		}
-	}
-	if (ws->dndWindow)
-	{
-		raiseWindow(ws->dndWindow);
-		moveInputFocusToWindow(ws->dndWindow);
-	}
-
-	moveScreenViewport(s, -origView, -origViewY, FALSE);
-
-	for (w = s->windows; w; w = w->next)
-	{
-		WALL_WINDOW(w);
-		ww->hovered = FALSE;
-	}
-
-	if (ws->dndState == DnDStart)	// No window is hovered
-		ws->dndState = DnDNone;
-
-	ws->prevCursorX = ws->newCursorX;
-	ws->prevCursorY = ws->newCursorY;
-
-	//damageScreen(s);
 }
 
 static void wallDisplayInitOptions(WallDisplay * wd)