xcb_destroy_notify_event_t *dev;
d_screen_t *sc;
d_window_t *w;
+ gboolean vis;
dev = (xcb_destroy_notify_event_t*)ev;
sc = display_screen_from_root(dpy, dev->event);
if (!sc) break;
w = screen_find_window(sc, dev->window);
+ vis = window_is_mapped(w);
sc->window_hide(w);
screen_remove_window(sc, w);
- printf("** refresh needed **\n");
- screen_refresh(sc);
+ if (vis) screen_refresh(sc);
break;
}
case XCB_REPARENT_NOTIFY:
sc->window_hide(w);
screen_remove_window(sc, w);
}
+ screen_refresh(w->sc);
break;
}
case XCB_MAP_NOTIFY:
if (!sc) break;
w = screen_find_window(sc, mev->window);
sc->window_show(w);
+ screen_refresh(w->sc);
break;
}
case XCB_UNMAP_NOTIFY:
if (!sc) break;
w = screen_find_window(sc, mev->window);
sc->window_hide(w);
+ screen_refresh(w->sc);
+ break;
+ }
+ case XCB_CONFIGURE_NOTIFY:
+ {
+ xcb_configure_notify_event_t *cev;
+ d_screen_t *sc;
+ d_window_t *w, *above;
+
+ cev = (xcb_configure_notify_event_t*)ev;
+ sc = display_screen_from_root(dpy, cev->event);
+ if (!sc) break;
+ w = screen_find_window(sc, cev->window);
+ sc->window_configure(w, cev->x, cev->y,
+ cev->width, cev->height, cev->border_width);
+ above = screen_find_window(sc, cev->above_sibling);
+ screen_stacking_move_above(sc, w, above);
+ screen_refresh(w->sc);
break;
}
default:
list_remove(sc->stacking, w);
}
+void
+screen_stacking_move_above(d_screen_t *sc, struct d_window *w,
+ struct d_window *above)
+{
+ d_list_it_t *wit = list_find(sc->stacking, w);
+ d_list_it_t *ait = list_find(sc->stacking, above);
+ list_move_before(sc->stacking, wit, ait);
+}
+
static void
screen_set_next_repaint(d_screen_t *sc)
{
sc->window_show = window_show;
sc->window_hide = window_hide;
sc->window_become_zombie = window_become_zombie;
-
+ sc->window_configure = window_configure;
}
void
void (*window_show)(struct d_window *w);
void (*window_hide)(struct d_window *w);
void (*window_become_zombie)(struct d_window *w);
+ void (*window_configure)(struct d_window *w, int x, int y,
+ int width, int height, int border_width);
} d_screen_t;
d_screen_t* screen_new(struct d_display *dpy, int num, xcb_screen_t *xcb);
void screen_stacking_add(d_screen_t *sc, struct d_window *w);
void screen_stacking_remove(d_screen_t *sc, struct d_window *w);
+void screen_stacking_move_above(d_screen_t *sc, struct d_window *w,
+ struct d_window *above);
void screen_setup_default_functions(d_screen_t *sc);
window_get_pixmap(d_window_t *pubw)
{
d_window_priv_t *w = (d_window_priv_t*)pubw;
+
if (w->ck_get_pixmap.sequence) {
xcb_generic_error_t *err;
//printf("** checking get pixmap 0x%x\n", w->id);
//printf("returning pixmap 0x%x for window 0x%x\n", w->pixmap, w->id);
return w->pixmap;
}
+
+void
+window_configure(d_window_t *pubw, int x, int y, int width, int height,
+ int border_width)
+{
+ d_window_priv_t *w = (d_window_priv_t*)pubw;
+
+ /* this overrides any reply from our get_geometry call */
+ if (w->ck_get_geom.sequence)
+ w->ck_get_geom.sequence = 0;
+ w->x = x;
+ w->y = y;
+ w->w = width + border_width * 2;
+ w->h = height + border_width * 2;
+}
void window_become_zombie(d_window_t *w);
+void window_configure(d_window_t *w, int x, int y, int width, int height,
+ int border_width);
+
gboolean window_is_zombie(d_window_t *w);
gboolean window_is_input_only(d_window_t *w);
gboolean window_is_mapped(d_window_t *w);