display_unref(d_display_t *dpy)
{
if (dpy && --dpy->ref == 0) {
+ int i;
xcb_disconnect(dpy->conn);
+
+ for (i = 0; i < dpy->nscreens; ++i)
+ screen_free(&dpy->screens[i]);
free(dpy->screens);
free(dpy);
}
#include "screen.h"
#include "display.h"
+#include "list.h"
#include "window.h"
#include "gettext.h"
#include <string.h>
xcb_composite_get_overlay_window_cookie_t overlay_ck;
xcb_composite_get_overlay_window_reply_t *overlay_rep;
- sc->winhash = g_hash_table_new((GHashFunc)window_hash,
- (GCompareFunc)window_compare);
-
redir_ck =
xcb_composite_redirect_subwindows(sc->dpy->conn, sc->super.root,
XCB_COMPOSITE_REDIRECT_MANUAL);
mask = ROOT_MASK;
xcb_change_window_attributes(sc->dpy->conn, sc->super.root,
XCB_CW_EVENT_MASK, &mask);
+
+ sc->winhash = g_hash_table_new((GHashFunc)window_hash,
+ (GCompareFunc)window_compare);
+ sc->stacking = list_new();
+
return TRUE;
}
+void screen_free(d_screen_t *sc)
+{
+ g_hash_table_unref(sc->winhash);
+ list_unref(sc->stacking);
+}
+
void
screen_add_window(d_screen_t *sc, xcb_window_t wid)
{
struct d_window;
struct d_display;
+struct d_list;
/* inherits from xcb_screen_t */
typedef struct d_screen {
xcb_window_t overlay;
GHashTable *winhash;
+ struct d_list *stacking;
} d_screen_t;
/*! Tries to register on the screen given by @sc. If it succeeds, it fills
in @sc and returns TRUE, otherwise it returns FALSE.
*/
gboolean screen_register(struct d_display *dpy, int num, d_screen_t *sc);
+void screen_free(d_screen_t *sc);
void screen_add_window(d_screen_t *sc, xcb_window_t wid);
void screen_remove_window(d_screen_t *sc, struct d_window *w);