ignore override_redirect windows for XSelectInput and get_frame_extents calls

This commit is contained in:
Christopher Jeffrey 2012-01-14 10:12:54 -06:00
parent a6afff2c4a
commit 01e978a512
1 changed files with 17 additions and 10 deletions

View File

@ -1425,7 +1425,8 @@ configure_win(Display *dpy, XConfigureEvent *ce);
static void static void
map_win(Display *dpy, Window id, map_win(Display *dpy, Window id,
unsigned long sequence, Bool fade) { unsigned long sequence, Bool fade,
Bool override_redirect) {
win *w = find_win(dpy, id); win *w = find_win(dpy, id);
if (!w) return; if (!w) return;
@ -1440,6 +1441,7 @@ map_win(Display *dpy, Window id,
/* select before reading the property /* select before reading the property
so that no property changes are lost */ so that no property changes are lost */
if (!override_redirect)
XSelectInput(dpy, id, PropertyChangeMask | FocusChangeMask); XSelectInput(dpy, id, PropertyChangeMask | FocusChangeMask);
// this causes problems for inactive transparency // this causes problems for inactive transparency
@ -1654,7 +1656,7 @@ set_opacity(Display *dpy, win *w, unsigned long opacity) {
} }
static void static void
add_win(Display *dpy, Window id, Window prev) { add_win(Display *dpy, Window id, Window prev, Bool override_redirect) {
win *new = malloc(sizeof(win)); win *new = malloc(sizeof(win));
win **p; win **p;
@ -1717,6 +1719,7 @@ add_win(Display *dpy, Window id, Window prev) {
new->top_width = 0; new->top_width = 0;
new->bottom_width = 0; new->bottom_width = 0;
if (!override_redirect)
get_frame_extents(dpy, id, get_frame_extents(dpy, id,
&new->left_width, &new->right_width, &new->left_width, &new->right_width,
&new->top_width, &new->bottom_width); &new->top_width, &new->bottom_width);
@ -1729,7 +1732,7 @@ add_win(Display *dpy, Window id, Window prev) {
if (inactive_opacity && IS_NORMAL_WIN(new)) { if (inactive_opacity && IS_NORMAL_WIN(new)) {
new->opacity = INACTIVE_OPACITY; new->opacity = INACTIVE_OPACITY;
} }
map_win(dpy, id, new->damage_sequence - 1, True); map_win(dpy, id, new->damage_sequence - 1, True, override_redirect);
} }
} }
@ -2433,7 +2436,7 @@ main(int argc, char **argv) {
&parent_return, &children, &nchildren); &parent_return, &children, &nchildren);
for (i = 0; i < nchildren; i++) { for (i = 0; i < nchildren; i++) {
add_win(dpy, children[i], i ? children[i-1] : None); add_win(dpy, children[i], i ? children[i-1] : None, False);
} }
XFree(children); XFree(children);
@ -2462,8 +2465,10 @@ main(int argc, char **argv) {
} }
#if DEBUG_EVENTS #if DEBUG_EVENTS
printf("event %10.10s serial 0x%08x window 0x%08x\n", if (ev.type != damage_event + XDamageNotify) {
ev_name(&ev), ev_serial(&ev), ev_window(&ev)); printf("event %10.10s serial 0x%08x window 0x%08x\n",
ev_name(&ev), ev_serial(&ev), ev_window(&ev));
}
#endif #endif
switch (ev.type) { switch (ev.type) {
@ -2498,8 +2503,8 @@ main(int argc, char **argv) {
break; break;
} }
case CreateNotify: case CreateNotify:
//if (ev.xcreatewindow.override_redirect) break; add_win(dpy, ev.xcreatewindow.window, 0,
add_win(dpy, ev.xcreatewindow.window, 0); ev.xcreatewindow.override_redirect);
break; break;
case ConfigureNotify: case ConfigureNotify:
configure_win(dpy, &ev.xconfigure); configure_win(dpy, &ev.xconfigure);
@ -2508,14 +2513,16 @@ main(int argc, char **argv) {
destroy_win(dpy, ev.xdestroywindow.window, True); destroy_win(dpy, ev.xdestroywindow.window, True);
break; break;
case MapNotify: case MapNotify:
map_win(dpy, ev.xmap.window, ev.xmap.serial, True); map_win(dpy, ev.xmap.window, ev.xmap.serial, True,
ev.xmap.override_redirect);
break; break;
case UnmapNotify: case UnmapNotify:
unmap_win(dpy, ev.xunmap.window, True); unmap_win(dpy, ev.xunmap.window, True);
break; break;
case ReparentNotify: case ReparentNotify:
if (ev.xreparent.parent == root) { if (ev.xreparent.parent == root) {
add_win(dpy, ev.xreparent.window, 0); add_win(dpy, ev.xreparent.window, 0,
ev.xreparent.override_redirect);
} else { } else {
destroy_win(dpy, ev.xreparent.window, True); destroy_win(dpy, ev.xreparent.window, True);
} }