From 5a171eac2b84972d3d3c5a1dea6cebe235490239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Thu, 18 Dec 2003 12:25:22 +0000 Subject: [PATCH] If there's a MapRequest in the wrapper window, this means something has reparented an unknown window inside the wrapper, and wants to show it. This is either somebody doing something stupid, or it's a save-set saved window from some crashing application. And save-set is a bit flawed, as it in fact should reparent to root, not to the closest existing ancestor. Therefore, act like if it was reparented to root, and manage the window. Takes care of #68241. svn path=/trunk/kdebase/kwin/; revision=273671 --- events.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/events.cpp b/events.cpp index 79feaf48c1..ef569ab87c 100644 --- a/events.cpp +++ b/events.cpp @@ -324,6 +324,8 @@ bool Workspace::workspaceEvent( XEvent * e ) // a chance to reparent it back to root // since KWin can get MapRequest only for root window children and // children of WindowWrapper (=clients), the check is AFAIK useless anyway +// Note: Now the save-set support in Client::mapRequestEvent() actually requires that +// this code doesn't check the parent to be root. // if ( e->xmaprequest.parent == root ) { //###TODO store previously destroyed client ids if ( addSystemTrayWin( e->xmaprequest.window ) ) return TRUE; @@ -598,6 +600,20 @@ bool Client::mapRequestEvent( XMapRequestEvent* e ) { if( e->window != window()) { + // Special support for the save-set feature, which is a bit broken. + // If there's a window from one client embedded in another one, + // e.g. using XEMBED, and the embedder suddenly looses its X connection, + // save-set will reparent the embedded window to its closest ancestor + // that will remains. Unfortunately, with reparenting window managers, + // this is not the root window, but the frame (or in KWin's case, + // it's the wrapper for the client window). In this case, + // the wrapper will get ReparentNotify for a window it won't know, + // which will be ignored, and then it gets MapRequest, as save-set + // always maps. Returning true here means that Workspace::workspaceEvent() + // will handle this MapRequest and manage this window (i.e. act as if + // it was reparented to root window). + if( e->parent == wrapperId()) + return false; return true; // no messing with frame etc. } if( isTopMenu() && workspace()->managingTopMenus())