diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2011-07-21 20:12:16 -0700 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-03-27 09:31:59 -0400 |
commit | 0eafdf5a26ffb9c17a4f4a8420c65e0cbeddee9b (patch) | |
tree | fd8703e766682b9f822822696feb4bb727781490 | |
parent | 6aee3077a3262839a570320754f3da2d372f542d (diff) |
xwayland: Redirect toplevel windows one by one
Avoids ServerClient resources on the root window and thus
fixes the crash on shutdown.
-rw-r--r-- | composite/compalloc.c | 10 | ||||
-rw-r--r-- | composite/compositeext.h | 4 | ||||
-rw-r--r-- | hw/xfree86/xwayland/xwayland-window.c | 27 |
3 files changed, 21 insertions, 20 deletions
diff --git a/composite/compalloc.c b/composite/compalloc.c index d1f7e53e4..d60165efd 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -268,6 +268,11 @@ compRestoreWindow (WindowPtr pWin, PixmapPtr pPixmap) } } +int CompositeRedirectWindow (WindowPtr pWin, int update) +{ + return compRedirectWindow (serverClient, pWin, update); +} + /* * Free one of the per-client per-window resources, clearing * redirect and the per-window pointer as appropriate @@ -436,11 +441,6 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update) return Success; } -int CompositeRedirectSubwindows (WindowPtr pWin, int update) -{ - return compRedirectSubwindows (serverClient, pWin, update); -} - /* * Free one of the per-client per-subwindows resources, * which frees one redirect per subwindow diff --git a/composite/compositeext.h b/composite/compositeext.h index c1e915ae1..0168cdc93 100644 --- a/composite/compositeext.h +++ b/composite/compositeext.h @@ -34,7 +34,7 @@ extern _X_EXPORT Bool CompositeRegisterAlternateVisuals(ScreenPtr pScreen, VisualID *vids, int nVisuals); -extern _X_EXPORT int CompositeRedirectSubwindows(WindowPtr pWin, - int update); +extern _X_EXPORT int CompositeRedirectWindow(WindowPtr pWin, + int update); #endif /* _COMPOSITEEXT_H_ */ diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c index f16571330..fd28d18e4 100644 --- a/hw/xfree86/xwayland/xwayland-window.c +++ b/hw/xfree86/xwayland/xwayland-window.c @@ -97,22 +97,23 @@ xwl_create_window(WindowPtr window) xwl_screen->CreateWindow = screen->CreateWindow; screen->CreateWindow = xwl_create_window; - if (!(xwl_screen->flags & XWL_FLAGS_ROOTLESS) || - window->parent != NULL) + if (!(xwl_screen->flags & XWL_FLAGS_ROOTLESS)) return ret; - len = snprintf(buffer, sizeof buffer, "_NET_WM_CM_S%d", screen->myNum); - name = MakeAtom(buffer, len, TRUE); - rc = AddSelection(&selection, name, serverClient); - if (rc != Success) - return ret; - - selection->lastTimeChanged = currentTime; - selection->window = window->drawable.id; - selection->pWin = window; - selection->client = serverClient; + if (window == screen->root) { + len = snprintf(buffer, sizeof buffer, "_NET_WM_CM_S%d", screen->myNum); + name = MakeAtom(buffer, len, TRUE); + rc = AddSelection(&selection, name, serverClient); + if (rc != Success) + return ret; - CompositeRedirectSubwindows(window, CompositeRedirectManual); + selection->lastTimeChanged = currentTime; + selection->window = window->drawable.id; + selection->pWin = window; + selection->client = serverClient; + } else if (window->parent == screen->root) { + CompositeRedirectWindow(window, CompositeRedirectManual); + } return ret; } |