[fusion-commits] compiz mirror: Changes to 'master' (00c815375083262721bb1d5fcbcd42ca93f02578)

compiz at server.beryl-project.org compiz at server.beryl-project.org
Mon Jul 30 15:55:58 CEST 2007


New commits:
commit 00c815375083262721bb1d5fcbcd42ca93f02578
Author: David Reveman <davidr at novell.com>
Date:   Mon Jul 30 08:04:55 2007 -0400

    Revert "First attempt to focus the window under the pointer if 'click to focus' is not enabled."
    
    This reverts commit bdb91a3bbc0419bba228f904804a4f74b84c2da7.

commit 6494af1463f2dbe60fe16371de5a989852aa373a
Author: David Reveman <davidr at novell.com>
Date:   Mon Jul 30 07:54:15 2007 -0400

    Make sure some window is focused properly at start up.

commit 439a3707f1a35c1c50a8066c8f30a15f0e16465e
Author: David Reveman <davidr at novell.com>
Date:   Mon Jul 30 07:43:34 2007 -0400

    Clean up.

commit f47759b6fb53e407d2cc53e398734979665d3fc3
Author: David Reveman <davidr at novell.com>
Date:   Sun Jul 29 23:00:38 2007 -0400

    Restore window geometry of fullscreen and maximized windows
    before exiting.

commit bc4b3785985f4f7e7da5975697e0dcda5c21ce78
Author: David Reveman <davidr at novell.com>
Date:   Sun Jul 29 22:59:46 2007 -0400

    Use configureXWindow to move the window as moveWindow function
    is broken and will be deprecated soon.

commit 9826963238aa004c47a4951009d3343720e6bd04
Author: David Reveman <davidr at novell.com>
Date:   Sun Jul 29 22:57:59 2007 -0400

    Initialize placed variable for initially mapped windows
    in addWindow instead of addScreen.

commit e9b8822ce566aeba6bbc9a466ebe2e9cee3ae4f2
Author: David Reveman <davidr at novell.com>
Date:   Sun Jul 29 22:54:54 2007 -0400

    Use configureXWindow to move the window as moveWindow function
    is broken and will be deprecated soon.

commit d45289a09ba1d482c4790ed573cc0686c221b532
Author: David Reveman <davidr at novell.com>
Date:   Sun Jul 29 14:59:37 2007 -0400

    Map hidden windows before exiting.

commit c55038e3d2f5c63c9fe6fa4b1da82d1bb1e67242
Author: David Reveman <davidr at novell.com>
Date:   Sun Jul 29 14:56:12 2007 -0400

    Shift client window position when adding and changing
    decorations.

commit 3bcd3b2e5fd7713c345fb530c04823ceb8dea1b5
Author: David Reveman <davidr at novell.com>
Date:   Sun Jul 29 14:33:48 2007 -0400

    Don't try to bind window again if it failed previously.

commit cb00a09329da5354493b69415c14e293897b4ed5
Author: David Reveman <davidr at novell.com>
Date:   Sun Jul 29 14:33:18 2007 -0400

    We can't unset the damaged flag just because the bind failed
    as it can result in damage tracking of decorations to
    get out of sync.

commit 0b2d76ad307886d1fd7e2ccac3c51e4ed93e4af1
Author: David Reveman <davidr at novell.com>
Date:   Sun Jul 29 14:30:50 2007 -0400

    Make sure initially mapped windows are considered mapped and
    after that unmap and make sure state hint reflects the
    current state of the window in case supposed to be iconifyied.

commit 6ada227699831021bc5ca0d1a153ab0a5fb135bd
Author: David Reveman <davidr at novell.com>
Date:   Sun Jul 29 11:37:24 2007 -0400

    Initialize iconifyied windows properly.


 plugins/decoration.c |   88 +++++++++++++++++++++++++++++++++++++++++++++----
 src/display.c        |   65 +++++++++++++++++--------------------
 src/event.c          |    8 +++-
 src/screen.c         |    5 ---
 src/window.c         |   54 ++++++++++++++++++++++++-------
 5 files changed, 158 insertions(+), 62 deletions(-)


Modified: compiz/plugins/decoration.c
===================================================================
--- compiz/plugins/decoration.c
+++ compiz/plugins/decoration.c
@@ -661,6 +661,40 @@ decorCheckSize (CompWindow *w,
     return (decor->minWidth <= w->width && decor->minHeight <= w->height);
 }
 
+static int
+decorWindowShiftX (CompWindow *w)
+{
+    switch (w->sizeHints.win_gravity) {
+    case WestGravity:
+    case NorthWestGravity:
+    case SouthWestGravity:
+	return w->input.left;
+    case EastGravity:
+    case NorthEastGravity:
+    case SouthEastGravity:
+	return -w->input.right;
+    }
+
+    return 0;
+}
+
+static int
+decorWindowShiftY (CompWindow *w)
+{
+    switch (w->sizeHints.win_gravity) {
+    case NorthGravity:
+    case NorthWestGravity:
+    case NorthEastGravity:
+	return w->input.top;
+    case SouthGravity:
+    case SouthWestGravity:
+    case SouthEastGravity:
+	return -w->input.bottom;
+    }
+
+    return 0;
+}
+
 static Bool
 decorWindowUpdate (CompWindow *w,
 		   Bool	      move)
@@ -669,6 +703,9 @@ decorWindowUpdate (CompWindow *w,
     Decoration	     *old, *decor = NULL;
     Bool	     decorate = FALSE;
     CompMatch	     *match;
+    int		     moveDx, moveDy;
+    int		     oldShiftX = 0;
+    int		     oldShiftY  = 0;
 
     DECOR_DISPLAY (w->screen->display);
     DECOR_SCREEN (w->screen);
@@ -689,7 +726,7 @@ decorWindowUpdate (CompWindow *w,
     }
 
     if (w->attrib.override_redirect)
-	decorate = FALSE;
+	decorate = move = FALSE;
 
     if (decorate)
     {
@@ -732,7 +769,7 @@ decorWindowUpdate (CompWindow *w,
 	}
     }
 
-    if (!ds->dmWin)
+    if (!ds->dmWin || restartSignal || shutDown)
 	decor = NULL;
 
     if (decor == old)
@@ -741,7 +778,12 @@ decorWindowUpdate (CompWindow *w,
     damageWindowOutputExtents (w);
 
     if (old)
+    {
+	oldShiftX = decorWindowShiftX (w);
+	oldShiftY = decorWindowShiftY (w);
+
 	destroyWindowDecoration (w->screen, wd);
+    }
 
     if (decor)
     {
@@ -754,6 +796,9 @@ decorWindowUpdate (CompWindow *w,
 	else
 	    setWindowFrameExtents (w, &decor->input);
 
+	moveDx = decorWindowShiftX (w) - oldShiftX;
+	moveDy = decorWindowShiftY (w) - oldShiftY;
+
 	updateWindowOutputExtents (w);
 	damageWindowOutputExtents (w);
 	updateWindowDecorationScale (w);
@@ -761,6 +806,30 @@ decorWindowUpdate (CompWindow *w,
     else
     {
 	dw->wd = NULL;
+
+	moveDx = -oldShiftX;
+	moveDy = -oldShiftY;
+    }
+
+    if (move && (moveDx || moveDy))
+    {
+	XWindowChanges xwc;
+	unsigned int   mask = CWX | CWY;
+
+	xwc.x = w->serverX + moveDx;
+	xwc.y = w->serverY + moveDy;
+
+	if (w->state & CompWindowStateFullscreenMask)
+	    mask &= ~(CWX | CWY);
+
+	if (w->state & CompWindowStateMaximizedHorzMask)
+	    mask &= ~CWX;
+
+	if (w->state & CompWindowStateMaximizedVertMask)
+	    mask &= ~CWY;
+
+	if (mask)
+	    configureXWindow (w, mask, &xwc);
     }
 
     return TRUE;
@@ -996,7 +1065,7 @@ decorDamageWindowRect (CompWindow *w,
     DECOR_SCREEN (w->screen);
 
     if (initial)
-	decorWindowUpdate (w, FALSE);
+	decorWindowUpdate (w, TRUE);
 
     UNWRAP (ds, w->screen, damageWindowRect);
     status = (*w->screen->damageWindowRect) (w, initial, rect);
@@ -1142,7 +1211,7 @@ decorWindowResizeNotify (CompWindow *w,
 {
     DECOR_SCREEN (w->screen);
 
-    if (!decorWindowUpdate (w, FALSE))
+    if (!decorWindowUpdate (w, TRUE))
 	updateWindowDecorationScale (w);
 
     UNWRAP (ds, w->screen, windowResizeNotify);
@@ -1156,7 +1225,7 @@ decorWindowStateChangeNotify (CompWindow *w)
     DECOR_SCREEN (w->screen);
     DECOR_WINDOW (w);
 
-    if (!decorWindowUpdate (w, FALSE))
+    if (!decorWindowUpdate (w, TRUE))
     {
 	if (dw->decor)
 	{
@@ -1178,7 +1247,7 @@ decorMatchPropertyChanged (CompDisplay *d,
 {
     DECOR_DISPLAY (d);
 
-    decorWindowUpdate (w, FALSE);
+    decorWindowUpdate (w, TRUE);
 
     UNWRAP (dd, d, matchPropertyChanged);
     (*d->matchPropertyChanged) (d, w);
@@ -1191,7 +1260,7 @@ decorWindowAddNotify (CompWindow *w)
     DECOR_SCREEN (w->screen);
 
     if (w->shaded || w->attrib.map_state == IsViewable)
-	decorWindowUpdate (w, FALSE);
+	decorWindowUpdate (w, TRUE);
 
     UNWRAP (ds, w->screen, windowAddNotify);
     (*w->screen->windowAddNotify) (w);
@@ -1356,7 +1425,7 @@ decorInitWindow (CompPlugin *p,
 	decorWindowUpdateDecoration (w);
 
     if (w->added && (w->shaded || w->attrib.map_state == IsViewable))
-	decorWindowUpdate (w, FALSE);
+	decorWindowUpdate (w, TRUE);
 
     return TRUE;
 }
@@ -1367,6 +1436,9 @@ decorFiniWindow (CompPlugin *p,
 {
     DECOR_WINDOW (w);
 
+    if (!w->destroyed)
+	decorWindowUpdate (w, TRUE);
+
     if (dw->wd)
 	destroyWindowDecoration (w->screen, dw->wd);
 

Modified: compiz/src/display.c
===================================================================
--- compiz/src/display.c
+++ compiz/src/display.c
@@ -1510,6 +1510,29 @@ paintScreen (CompScreen   *s,
     }
 }
 
+static void
+mapWindowIfHidden (CompWindow *w,
+		   void       *closure)
+{
+    if (w->attrib.override_redirect || w->hidden)
+	return;
+
+    if (w->state & CompWindowStateHiddenMask)
+	XMapWindow (w->screen->display->display, w->id);
+}
+
+static void
+restoreWindowGeometryIfSaved (CompWindow *w,
+			      void       *closure)
+{
+    if (w->attrib.override_redirect)
+	return;
+
+    if (w->saveMask)
+	XConfigureWindow (w->screen->display->display, w->id, w->saveMask,
+			  &w->saveWc);
+}
+
 void
 eventLoop (void)
 {
@@ -1541,6 +1564,9 @@ eventLoop (void)
 	if (restartSignal || shutDown)
 	{
 	    while (popPlugin ());
+	    forEachWindowOnDisplay (display, restoreWindowGeometryIfSaved, 0);
+	    forEachWindowOnDisplay (display, mapWindowIfHidden, 0);
+	    XSync (display->display, False);
 	    return;
 	}
 
@@ -2507,6 +2533,10 @@ addDisplay (char *name)
 
     XGetInputFocus (dpy, &focus, &revertTo);
 
+    /* move input focus to root window so that we get a FocusIn event when
+       moving it to the default window */
+    XSetInputFocus (dpy, d->screens->root, RevertToPointerRoot, CurrentTime);
+
     if (focus == None || focus == PointerRoot)
     {
 	focusDefaultWindow (d);
@@ -2546,34 +2576,6 @@ getCurrentTimeFromDisplay (CompDisplay *d)
     return event.xproperty.time;
 }
 
-/* Attempts to focus a window located under the pointer. Returns TRUE if
- * there is a window like that. FALSE otherwise.
- */
-static Bool 
-focusPointerTarget (CompScreen *s)
-{
-    CompDisplay * d = s->display;
-    Window      tmpRoot, tmpChild;
-    CompWindow  * focus;
-    Bool        result;
-    int         x;
-
-    result = XQueryPointer (d->display, s->root, &tmpRoot, &tmpChild, 
-			    &x, &x, &x, &x, (unsigned int *)&x);
-
-    if (result && tmpChild)
-    {
-	focus = findWindowAtScreen (s, tmpChild);
-	if (focus && !(focus->wmType & 
-		       (CompWindowTypeDesktopMask | CompWindowTypeDockMask))) 
-	{
-	    moveInputFocusToWindow (focus);
-	    return TRUE;
-	}
-    }
-    return FALSE;
-}
-
 void
 focusDefaultWindow (CompDisplay *d)
 {
@@ -2581,13 +2583,6 @@ focusDefaultWindow (CompDisplay *d)
     CompWindow *w;
     CompWindow *focus = NULL;
 
-    if (!d->opt[COMP_DISPLAY_OPTION_CLICK_TO_FOCUS].value.b)
-    {
-	for (s = d->screens; s; s = s->next)
-	    if (focusPointerTarget (s))
-		return;
-    }
-
     for (s = d->screens; s; s = s->next)
     {
 	for (w = s->reverseWindows; w; w = w->prev)

Modified: compiz/src/event.c
===================================================================
--- compiz/src/event.c
+++ compiz/src/event.c
@@ -2042,8 +2042,12 @@ handleEvent (CompDisplay *d,
 				    compAddTimeout (delay, autoRaiseTimeout, d);
 			    }
 			    else
-				updateWindowAttributes (w, 
-					CompStackingUpdateModeNormal);
+			    {
+				CompStackingUpdateMode mode =
+				    CompStackingUpdateModeNormal;
+
+				updateWindowAttributes (w, mode);
+			    }
 			}
 		    }
 		}

Modified: compiz/src/screen.c
===================================================================
--- compiz/src/screen.c
+++ compiz/src/screen.c
@@ -2094,13 +2094,8 @@ addScreen (CompDisplay *display,
 	{
 	    w->activeNum = s->activeNum++;
 	    w->damaged   = TRUE;
-	    w->placed    = TRUE;
 	    w->invisible = WINDOW_INVISIBLE (w);
 	}
-	else if (w->state & CompWindowStateHiddenMask)
-	{
-	    w->placed = TRUE;
-	}
     }
 
     XFree (children);

Modified: compiz/src/window.c
===================================================================
--- compiz/src/window.c
+++ compiz/src/window.c
@@ -1234,6 +1234,10 @@ bindWindow (CompWindow *w)
     {
 	XWindowAttributes attr;
 
+	/* don't try to bind window again if it failed previously */
+	if (w->bindFailed)
+	    return FALSE;
+
 	/* We have to grab the server here to make sure that window
 	   is mapped when getting the window pixmap */
 	XGrabServer (w->screen->display->display);
@@ -1242,7 +1246,6 @@ bindWindow (CompWindow *w)
 	{
 	    XUngrabServer (w->screen->display->display);
 	    finiTexture (w->screen, w->texture);
-	    w->damaged = FALSE;
 	    w->bindFailed = TRUE;
 	    return FALSE;
 	}
@@ -2087,39 +2090,62 @@ addWindow (CompScreen *screen,
 
     if (w->attrib.map_state == IsViewable)
     {
-	w->attrib.map_state = IsUnmapped;
+	w->placed = TRUE;
 
 	if (!w->attrib.override_redirect)
 	{
 	    w->managed = TRUE;
 
-	    if (w->wmType & (CompWindowTypeDockMask |
-			     CompWindowTypeDesktopMask))
+	    if (getWmState (screen->display, w->id) == IconicState)
 	    {
-		setDesktopForWindow (w, 0xffffffff);
+		if (w->state & CompWindowStateShadedMask)
+		    w->shaded = TRUE;
+		else
+		    w->minimized = TRUE;
 	    }
 	    else
 	    {
-		if (w->desktop != 0xffffffff)
-		    w->desktop = screen->currentDesktop;
+		if (w->wmType & (CompWindowTypeDockMask |
+				 CompWindowTypeDesktopMask))
+		{
+		    setDesktopForWindow (w, 0xffffffff);
+		}
+		else
+		{
+		    if (w->desktop != 0xffffffff)
+			w->desktop = screen->currentDesktop;
 
-		setWindowProp (screen->display, w->id,
-			       screen->display->winDesktopAtom,
-			       w->desktop);
+		    setWindowProp (screen->display, w->id,
+				   screen->display->winDesktopAtom,
+				   w->desktop);
+		}
 	    }
 	}
 
+	w->attrib.map_state = IsUnmapped;
 	w->pendingMaps++;
 
 	mapWindow (w);
 
 	updateWindowAttributes (w, CompStackingUpdateModeNormal);
+
+	if (w->minimized || w->inShowDesktopMode || w->hidden || w->shaded)
+	{
+	    w->state |= CompWindowStateHiddenMask;
+
+	    w->pendingUnmaps++;
+
+	    XUnmapWindow (screen->display->display, w->id);
+
+	    changeWindowState (w, w->state);
+	}
     }
     else if (!w->attrib.override_redirect)
     {
 	if (getWmState (screen->display, w->id) == IconicState)
 	{
 	    w->managed = TRUE;
+	    w->placed  = TRUE;
 
 	    if (w->state & CompWindowStateHiddenMask)
 	    {
@@ -3943,8 +3969,12 @@ ensureWindowVisibility (CompWindow *w)
 
     if (dx || dy)
     {
-	moveWindow (w, dx, dy, TRUE, FALSE);
-	syncWindowPosition (w);
+	XWindowChanges xwc;
+
+	xwc.x = w->serverX + dx;
+	xwc.y = w->serverY + dy;
+
+	configureXWindow (w, CWX | CWY, &xwc);
     }
 }
 


More information about the commits mailing list