summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-16 10:49:59 +0000
committermaniac <maniac@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2007-02-16 10:49:59 +0000
commit1352172f7fd539b3367362f260350ce5e859e223 (patch)
tree8bb682fea4cf55fc4dc67286a0c6d1ae2cd60a13
parentededa16504b85675e71facf9661c676a455bd713 (diff)
downloadmarex-dev-1352172f7fd539b3367362f260350ce5e859e223.tar.gz
marex-dev-1352172f7fd539b3367362f260350ce5e859e223.tar.bz2
wall plugin: moved DnD initiation into handleEvent
git-svn-id: file:///beryl/trunk@4094 d7aaf104-2d23-0410-ae22-9d23157bf5a3
-rw-r--r--beryl-plugins/src/wall.c118
1 files changed, 53 insertions, 65 deletions
diff --git a/beryl-plugins/src/wall.c b/beryl-plugins/src/wall.c
index 10c9ff9..1bfe619 100644
--- a/beryl-plugins/src/wall.c
+++ b/beryl-plugins/src/wall.c
@@ -380,7 +380,57 @@ static void wallHandleEvent(CompDisplay * d, XEvent * event)
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 @@ static void wallHandleEvent(CompDisplay * d, XEvent * event)
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 @@ static void wallDonePaintScreen(CompScreen * s)
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 @@ static void wallDonePaintScreen(CompScreen * s)
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)