#include "window.h"
-#include <glib.h>
+#include <stdlib.h>
+#include <stdio.h>
d_window_t*
window_new(xcb_window_t id, struct d_screen *sc)
{
d_window_t *w;
- w = g_new(d_window_t, 1);
+ w = malloc(sizeof(d_window_t));
w->id = id;
w->ref = 1;
w->sc = sc;
+ w->mapped = FALSE;
+
+ /* default functions */
+ w->show = window_show;
+ w->hide = window_hide;
+
+ printf("new window 0x%x\n", w->id);
+
return w;
}
window_unref(d_window_t *w)
{
if (w && --w->ref == 0) {
- g_free(w);
+ free(w);
}
}
+
+void
+window_show(d_window_t *w)
+{
+ if (w->mapped) return;
+
+ printf("show window 0x%x\n", w->id);
+
+ w->mapped = TRUE;
+}
+
+void
+window_hide(d_window_t *w)
+{
+ if (!w->mapped) return;
+
+ printf("hide window 0x%x\n", w->id);
+
+ w->mapped = FALSE;
+}