headers = $(wildcard *.h)
CFLAGS=$(shell pkg-config --cflags xcb-composite xcb-damage glib-2.0) -ggdb -W -Wall
-LIBS=$(shell pkg-config --libs xcb-composite xcb-damage glib-2.0)
+LIBS=$(shell pkg-config --libs xcb-composite xcb-damage glib-2.0) # -lefence
dcompmgr: $(objs)
$(CC) -o $@ $^ $(LIBS) $(LDFLAGS)
{
xcb_create_notify_event_t *cev;
d_screen_t *sc;
+ d_window_t *w;
cev = (xcb_create_notify_event_t*)ev;
sc = display_screen_from_root(dpy, cev->parent);
if (!sc) break;
- screen_add_window(sc, cev->window);
+ w = screen_add_window(sc, cev->window);
+ printf("created 0x%x\n", w);
break;
}
case XCB_DESTROY_NOTIFY:
sc = display_screen_from_root(dpy, dev->event);
if (!sc) break;
w = screen_find_window(sc, dev->window);
+ printf("destroyed 0x%x\n", w);
vis = window_is_mapped(w);
sc->window_hide(w);
screen_remove_window(sc, w);
else {
sc->window_hide(w);
screen_remove_window(sc, w);
+ printf("reparent lost 0x%x\n", w);
}
screen_refresh(w->sc);
break;
sc = display_screen_from_root(dpy, mev->event);
if (!sc) break;
w = screen_find_window(sc, mev->window);
+ printf("mapping 0x%x\n", w);
sc->window_show(w);
screen_refresh(w->sc);
break;
run(dpy);
+ {
+ /* make everything hidden */
+ d_list_it_t *sc_it;
+
+ for (sc_it = list_top(dpy->screens); sc_it; sc_it = sc_it->next) {
+ d_screen_t *sc = sc_it->data;
+ d_list_it_t *it;
+ for (it = list_top(sc->stacking); it; it = it->next)
+ sc->window_hide(it->data);
+ }
+ }
+
cleanup_functions(dpy);
display_unref(dpy);
#define dc__display_h
#include <xcb/xcb.h>
+//#include <efence.h>
#include <glib.h>
for (it = list_top(list); it; it = next) {
d_plugin_data_t *pd = it->data;
next = it->next;
- if (pd->id == id) list_delete_link(list, it);
+ if (pd->id == id) {
+ list_delete_link(list, it);
+ plugin_data_free(pd);
+ }
}
}
typedef struct {
xcb_render_picture_t picture;
+ gboolean waiting_picture;
xcb_void_cookie_t ck_picture;
} window_data_t;
xcb_render_free_picture(sc->dpy->conn, d->overlay_picture);
xcb_render_free_picture(sc->dpy->conn, d->overlay_buffer);
free(d);
+ screen_remove_plugin_data(sc, plugin_id);
}
void
wd = malloc(sizeof(window_data_t));
wd->picture = XCB_NONE;
- wd->ck_picture.sequence = 0;
+ wd->waiting_picture = FALSE;
window_add_plugin_data(w, plugin_id, wd);
window_ref(w);
static xcb_render_picture_t
render_get_picture(d_window_t *w, window_data_t *wd)
{
- if (wd->ck_picture.sequence) {
+ if (wd->waiting_picture) {
xcb_generic_error_t *err;
//printf("** checking create picture 0x%x\n", w->id);
err = xcb_request_check(w->sc->dpy->conn, wd->ck_picture);
printf("error creating picture for window 0x%x\n", w->id);
free(err);
}
- wd->ck_picture.sequence = 0;
+ wd->waiting_picture = FALSE;
}
//printf("returning picture 0x%x for window 0x%x\n", wd->picture, w->id);
return wd->picture;
wd->picture, px, format,
XCB_RENDER_CP_SUBWINDOW_MODE,
&vals);
+ wd->waiting_picture = TRUE;
}
}
screen_unref(d_screen_t *sc)
{
if (sc && --sc->ref == 0) {
+ d_list_it_t *it;
+
g_hash_table_unref(sc->winhash);
+ for (it = list_top(sc->stacking); it; it = it->next)
+ window_unref(it->data);
list_unref(sc->stacking);
list_unref(sc->plugin_data);
free(sc);
sck = xcb_get_selection_owner(sc->dpy->conn, arep->atom);
srep = xcb_get_selection_owner_reply(sc->dpy->conn, sck, NULL);
taken = srep->owner == w;
+ free(srep);
if (taken && screen_init(sc)) {
screen_add_existing_windows(sc);
ret = TRUE;
ret = FALSE;
}
}
+ g_free(arep);
xcb_ungrab_server(sc->dpy->conn);
xcb_flush(sc->dpy->conn);
xcb_damage_damage_t damage;
+ gboolean waiting_attr;
xcb_get_window_attributes_cookie_t ck_get_attr;
+ gboolean waiting_geom;
xcb_get_geometry_cookie_t ck_get_geom;
+ gboolean waiting_pixmap;
xcb_void_cookie_t ck_get_pixmap;
} d_window_priv_t;
screen_stacking_add(sc, (d_window_t*)w);
w->ck_get_attr = xcb_get_window_attributes(sc->dpy->conn, id);
+ w->waiting_attr = TRUE;
+
w->ck_get_geom = xcb_get_geometry(sc->dpy->conn, id);
+ w->waiting_geom = TRUE;
- w->ck_get_pixmap.sequence = 0;
+ w->waiting_pixmap = FALSE;
w->plugin_data = list_new();
{
xcb_pixmap_t p;
+ if (window_is_zombie((d_window_t*)w)) return;
+
/* XXX can we save it for until we get the new pixmap? */
if ((p = window_get_pixmap((d_window_t*)w))) {
xcb_free_pixmap(w->sc->dpy->conn, p);
w->ck_get_pixmap =
xcb_composite_name_window_pixmap_checked(w->sc->dpy->conn,
w->id, w->pixmap);
+ w->waiting_pixmap = TRUE;
xcb_flush(w->sc->dpy->conn);
}
window_is_input_only(d_window_t *pubw)
{
d_window_priv_t *w = (d_window_priv_t*)pubw;
- if (w->ck_get_attr.sequence)
+ if (w->waiting_attr)
window_get_attributes_reply(w);
return w->input_only;
}
int *border_width)
{
d_window_priv_t *w = (d_window_priv_t*)pubw;
- if (w->ck_get_geom.sequence)
+ if (w->waiting_geom)
window_get_geometry_reply(w);
*x = w->x;
*y = w->y;
printf("error getting attributes for window 0x%x\n", w->id);
free(err);
}
- w->ck_get_attr.sequence = 0;
+ w->waiting_attr = 0;
}
static void
printf("error getting geometry for window 0x%x\n", w->id);
free(err);
}
- w->ck_get_geom.sequence = 0;
+ w->waiting_geom = 0;
}
gboolean
window_is_mapped(d_window_t *pubw)
{
d_window_priv_t *w = (d_window_priv_t*)pubw;
- if (w->ck_get_attr.sequence)
+ if (w->waiting_attr)
window_get_attributes_reply(w);
return w->mapped;
}
{
d_window_priv_t *w = (d_window_priv_t*)pubw;
- if (w->ck_get_pixmap.sequence) {
+ if (w->waiting_pixmap) {
xcb_generic_error_t *err;
//printf("** checking get pixmap 0x%x\n", w->id);
err = xcb_request_check(w->sc->dpy->conn, w->ck_get_pixmap);
printf("error getting named pixmap for window 0x%x\n", w->id);
free(err);
}
- w->ck_get_pixmap.sequence = 0;
+ w->waiting_pixmap = FALSE;
}
//printf("returning pixmap 0x%x for window 0x%x\n", w->pixmap, w->id);
return w->pixmap;
window_get_visual(d_window_t *pubw)
{
d_window_priv_t *w = (d_window_priv_t*)pubw;
- if (w->ck_get_attr.sequence)
+ if (w->waiting_attr)
window_get_attributes_reply(w);
return w->visual;
}
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;
+ if (w->waiting_geom)
+ w->waiting_geom = FALSE;
w->x = x;
w->y = y;
w->w = width;