making some nice batch-query stuff for initializing the display statics
[dana/dcompmgr.git] / window.c
index 269b60d..4d9bb7b 100644 (file)
--- a/window.c
+++ b/window.c
@@ -1,23 +1,24 @@
 #include "window.h"
-#include <glib.h>
-
-static void window_show(d_window_t *w);
-static void window_hide(d_window_t *w);
+#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;
 }
 
@@ -31,16 +32,26 @@ void
 window_unref(d_window_t *w)
 {
     if (w && --w->ref == 0) {
-        g_free(w);
+        free(w);
     }
 }
 
-static void
+void
 window_show(d_window_t *w)
 {
+    if (w->mapped) return;
+
+    printf("show window 0x%x\n", w->id);
+
+    w->mapped = TRUE;
 }
 
-static void
+void
 window_hide(d_window_t *w)
 {
+    if (!w->mapped) return;
+
+    printf("hide window 0x%x\n", w->id);
+
+    w->mapped = FALSE;
 }