summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Reveman <davidr@novell.com>2008-11-26 10:27:37 -0500
committerDavid Reveman <davidr@novell.com>2008-11-26 10:27:37 -0500
commit5e5057dd6879873603ad8e3f0f2e2110a35d7c4c (patch)
tree244f34793ed88e3e6e86519f8b4bdace52d3fa35
parent2fcf8f6d72e57ce81832c533337e38a66ee9b064 (diff)
Handle frame windows properly when not managing windows and add
findClientWindow functions.
-rw-r--r--include/compiz-core.h11
-rw-r--r--src/display.c17
-rw-r--r--src/event.c6
-rw-r--r--src/screen.c14
-rw-r--r--src/window.c48
5 files changed, 86 insertions, 10 deletions
diff --git a/include/compiz-core.h b/include/compiz-core.h
index d313d6a1..3f9ef0e4 100644
--- a/include/compiz-core.h
+++ b/include/compiz-core.h
@@ -1083,6 +1083,9 @@ updateIconGeometry (CompWindow *w);
Window
getClientLeader (CompWindow *w);
+Window
+getFrameWindow (CompWindow *w);
+
char *
getStartupId (CompWindow *w);
@@ -1844,6 +1847,10 @@ findWindowAtDisplay (CompDisplay *display,
Window id);
CompWindow *
+findClientWindowAtDisplay (CompDisplay *d,
+ Window id);
+
+CompWindow *
findTopLevelWindowAtDisplay (CompDisplay *d,
Window id);
@@ -2989,6 +2996,10 @@ findWindowAtScreen (CompScreen *s,
Window id);
CompWindow *
+findClientWindowAtScreen (CompScreen *s,
+ Window id);
+
+CompWindow *
findTopLevelWindowAtScreen (CompScreen *s,
Window id);
diff --git a/src/display.c b/src/display.c
index 92c1b3d3..881996f5 100644
--- a/src/display.c
+++ b/src/display.c
@@ -2736,6 +2736,23 @@ findWindowAtDisplay (CompDisplay *d,
}
CompWindow *
+findClientWindowAtDisplay (CompDisplay *d,
+ Window id)
+{
+ CompScreen *s;
+ CompWindow *w;
+
+ for (s = d->screens; s; s = s->next)
+ {
+ w = findClientWindowAtScreen (s, id);
+ if (w)
+ return w;
+ }
+
+ return 0;
+}
+
+CompWindow *
findTopLevelWindowAtDisplay (CompDisplay *d,
Window id)
{
diff --git a/src/event.c b/src/event.c
index 7209f350..f0f84615 100644
--- a/src/event.c
+++ b/src/event.c
@@ -1539,6 +1539,12 @@ handleEvent (CompDisplay *d,
if (w)
w->clientLeader = getClientLeader (w);
}
+ else if (event->xproperty.atom == d->frameWindowAtom)
+ {
+ w = findWindowAtDisplay (d, event->xproperty.window);
+ if (w && w->parent && !w->parent->substructureRedirect)
+ w->frame = getFrameWindow (w);
+ }
else if (event->xproperty.atom == d->wmIconGeometryAtom)
{
w = findWindowAtDisplay (d, event->xproperty.window);
diff --git a/src/screen.c b/src/screen.c
index 9ac035e3..7f00f23c 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2687,8 +2687,8 @@ findWindowAtScreen (CompScreen *s,
}
CompWindow *
-findTopLevelWindowAtScreen (CompScreen *s,
- Window id)
+findClientWindowAtScreen (CompScreen *s,
+ Window id)
{
CompWindow *w;
@@ -2707,6 +2707,16 @@ findTopLevelWindowAtScreen (CompScreen *s,
break;
}
+ return w;
+}
+
+CompWindow *
+findTopLevelWindowAtScreen (CompScreen *s,
+ Window id)
+{
+ CompWindow *w;
+
+ w = findClientWindowAtScreen (s, id);
if (w && w->managed)
return w;
diff --git a/src/window.c b/src/window.c
index 240d2d27..3302957a 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1163,6 +1163,33 @@ setWindowProp32 (CompDisplay *display,
(unsigned char *) &value32, 1);
}
+Window
+getFrameWindow (CompWindow *w)
+{
+ Atom actual;
+ int result, format;
+ unsigned long n, left;
+ unsigned char *data;
+
+ result = XGetWindowProperty (w->screen->display->display, w->id,
+ w->screen->display->frameWindowAtom,
+ 0L, 1L, False, XA_WINDOW, &actual, &format,
+ &n, &left, &data);
+
+ if (result == Success && n && data)
+ {
+ Window win;
+
+ memcpy (&win, data, sizeof (Window));
+ XFree ((void *) data);
+
+ if (win)
+ return win;
+ }
+
+ return None;
+}
+
static void
updateFrameWindow (CompWindow *w)
{
@@ -1410,7 +1437,7 @@ freeWindow (CompWindow *w)
destroyTexture (w->screen, w->texture);
- if (w->frame)
+ if (w->frame && w->parent->substructureRedirect)
XDestroyWindow (w->screen->display->display, w->frame);
if (w->clip)
@@ -2285,6 +2312,9 @@ addWindow (CompWindow *parent,
if (!w->clientLeader)
w->startupId = getStartupId (w);
+ if (w->parent && !w->parent->substructureRedirect)
+ w->frame = getFrameWindow (w);
+
recalcWindowType (w);
getMwmHints (d, w->id, &w->mwmFunc, &w->mwmDecor);
@@ -2581,7 +2611,7 @@ mapWindow (CompWindow *w)
updateWindowRegion (w);
updateWindowSize (w);
- if (w->frame)
+ if (w->frame && w->parent->substructureRedirect)
XMapWindow (w->screen->display->display, w->frame);
updateClientListForScreen (w->screen);
@@ -2662,7 +2692,7 @@ unmapWindow (CompWindow *w)
{
if (w->mapNum)
{
- if (w->frame && !w->shaded)
+ if (w->frame && w->parent->substructureRedirect && !w->shaded)
XUnmapWindow (w->screen->display->display, w->frame);
if (w->parent->substructureRedirect)
@@ -2781,7 +2811,7 @@ resizeWindow (CompWindow *w,
moveWindow (w, dx, dy, TRUE, TRUE);
- if (w->frame)
+ if (w->frame && w->parent->substructureRedirect)
XMoveWindow (w->screen->display->display, w->frame,
w->attrib.x - w->input.left,
w->attrib.y - w->input.top);
@@ -3576,7 +3606,8 @@ reconfigureXWindow (CompWindow *w,
XConfigureWindow (w->screen->display->display, w->id, valueMask, xwc);
- if (w->frame && (valueMask & (CWSibling | CWStackMode | CWX | CWY)))
+ if (w->frame && w->parent->substructureRedirect &&
+ (valueMask & (CWSibling | CWStackMode | CWX | CWY)))
{
XWindowChanges wc = *xwc;
@@ -4206,7 +4237,7 @@ addWindowStackChanges (CompWindow *w,
if (!sibling)
{
XLowerWindow (w->screen->display->display, w->id);
- if (w->frame)
+ if (w->frame && w->parent->substructureRedirect)
XLowerWindow (w->screen->display->display, w->frame);
}
else if (sibling->id != w->prev->id)
@@ -4766,7 +4797,8 @@ hideWindow (CompWindow *w)
w->shaded = FALSE;
- if ((w->state & CompWindowStateShadedMask) && w->frame)
+ if ((w->state & CompWindowStateShadedMask) &&
+ w->frame && w->parent->substructureRedirect)
XUnmapWindow (w->screen->display->display, w->frame);
}
@@ -4806,7 +4838,7 @@ showWindow (CompWindow *w)
{
w->shaded = TRUE;
- if (w->frame)
+ if (w->frame && w->parent->substructureRedirect)
XMapWindow (w->screen->display->display, w->frame);
if (w->height)