summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2010-08-28 14:09:07 +0800
committerSam Spilsbury <smspillaz@gmail.com>2010-08-28 14:09:07 +0800
commit975054ead1392e777c07a8ffc3fd91f54fcaf77e (patch)
treefd51001f0c3d7c4c050cc2b0c6392e5f84218d18 /src/window.cpp
parent243ab2d5ee7bb864c0bf4f4a08580659eb28e104 (diff)
downloadunity-window-decorator-975054ead1392e777c07a8ffc3fd91f54fcaf77e.tar.gz
unity-window-decorator-975054ead1392e777c07a8ffc3fd91f54fcaf77e.tar.bz2
Better checking if the window is destroyed and use the default visual
and colormap, unless the window has request an ARGB one, in which case use that (like metacity). This fixes problems with windows which set incorrect colormap/visual combinations in their XSetWindowAttribs, like some SDL windows such as frozen-bubble and SDL/testwm
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 02b998a..46a55d8 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -4969,7 +4969,6 @@ CompWindow::CompWindow (Window id,
if (!XGetWindowAttributes (screen->dpy (), id, &priv->attrib))
setDefaultWindowAttributes (&priv->attrib);
-
priv->serverGeometry.set (priv->attrib.x, priv->attrib.y,
priv->attrib.width, priv->attrib.height,
priv->attrib.border_width);
@@ -5506,42 +5505,57 @@ PrivateWindow::reparent ()
Display *dpy = screen->dpy ();
CompWindow *sibling = window->next ? window->next : window->prev;
bool above = window->next ? false : true;
-
+ Window root_ret, parent_ret;
+ Window *children_ret;
+ unsigned int nchildren_ret;
+ unsigned int uidummy;
+ int idummy;
+ int nvisuals_return;
+ Visual *visual = DefaultVisual (screen->dpy (),
+ screen->screenNum ());
+ Colormap cmap = DefaultColormap (screen->dpy (),
+ screen->screenNum ());
if (frame || attrib.override_redirect)
return false;
XSync (dpy, false);
+ XGrabServer (dpy);
- if (XCheckTypedWindowEvent (dpy, id, DestroyNotify, &e))
+ if (!XGetGeometry (screen->dpy (), id, &root_ret, &idummy, &idummy, &uidummy, &uidummy, &uidummy, &uidummy) ||
+ !XGetWindowAttributes (dpy, id, &wa))
{
- XPutBackEvent (dpy, &e);
- return false;
+ XUngrabServer (dpy);
+ XSync (dpy, false);
+ return false;
}
- XGrabServer (dpy);
XChangeSaveSet (dpy, id, SetModeInsert);
XSelectInput (dpy, id, NoEventMask);
XSelectInput (dpy, screen->root (), NoEventMask);
- XGetWindowAttributes (dpy, id, &wa);
-
xwc.border_width = 0;
XConfigureWindow (dpy, id, CWBorderWidth, &xwc);
mask = CWBorderPixel | CWColormap | CWBackPixmap;
+ if (attrib.depth == 32)
+ {
+ cmap = attrib.colormap;
+ visual = attrib.visual;
+ }
+
attr.background_pixmap = None;
attr.border_pixel = 0;
- attr.colormap = attrib.colormap;
+ attr.colormap = cmap;
frame = XCreateWindow (dpy, screen->root (), 0, 0,
- 1, 1, 0, attrib.depth,
- InputOutput, attrib.visual, mask, &attr);
+ sg.width (), sg.height (), 0, attrib.depth,
+ InputOutput, visual, mask, &attr);
wrapper = XCreateWindow (dpy, frame, 0, 0,
sg.width (), sg.height (), 0, attrib.depth,
- InputOutput, attrib.visual, mask, &attr);
+ InputOutput, visual, mask, &attr);
XGrabButton (dpy, AnyButton, AnyModifier, frame, true,
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
@@ -5661,4 +5675,5 @@ PrivateWindow::unreparent ()
wrapper = None;
frame = None;
- window->windowNotify (CompWindowNotifyUnreparent);}
+ window->windowNotify (CompWindowNotifyUnreparent);
+}