Merge branch 'backport' into work
[mikachu/openbox.git] / openbox / focus_cycle_indicator.c
index 670f48e..5d7ecb3 100644 (file)
 
 static struct
 {
-    InternalWindow top;
-    InternalWindow left;
-    InternalWindow right;
-    InternalWindow bottom;
+    ObInternalWindow top;
+    ObInternalWindow left;
+    ObInternalWindow right;
+    ObInternalWindow bottom;
 } focus_indicator;
 
 static RrAppearance *a_focus_indicator;
@@ -45,7 +45,7 @@ static gboolean      visible;
 static Window create_window(Window parent, gulong mask,
                             XSetWindowAttributes *attrib)
 {
-    return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
+    return XCreateWindow(obt_display, parent, 0, 0, 1, 1, 0,
                          RrDepth(ob_rr_inst), InputOutput,
                          RrVisual(ob_rr_inst), mask, attrib);
 
@@ -59,38 +59,38 @@ void focus_cycle_indicator_startup(gboolean reconfig)
 
     if (reconfig) return;
 
-    focus_indicator.top.type = Window_Internal;
-    focus_indicator.left.type = Window_Internal;
-    focus_indicator.right.type = Window_Internal;
-    focus_indicator.bottom.type = Window_Internal;
+    focus_indicator.top.type = OB_WINDOW_CLASS_INTERNAL;
+    focus_indicator.left.type = OB_WINDOW_CLASS_INTERNAL;
+    focus_indicator.right.type = OB_WINDOW_CLASS_INTERNAL;
+    focus_indicator.bottom.type = OB_WINDOW_CLASS_INTERNAL;
 
     attr.override_redirect = True;
-    attr.background_pixel = BlackPixel(ob_display, ob_screen);
+    attr.background_pixel = BlackPixel(obt_display, ob_screen);
     focus_indicator.top.window =
-        create_window(RootWindow(ob_display, ob_screen),
+        create_window(obt_root(ob_screen),
                       CWOverrideRedirect | CWBackPixel, &attr);
     focus_indicator.left.window =
-        create_window(RootWindow(ob_display, ob_screen),
+        create_window(obt_root(ob_screen),
                       CWOverrideRedirect | CWBackPixel, &attr);
     focus_indicator.right.window =
-        create_window(RootWindow(ob_display, ob_screen),
+        create_window(obt_root(ob_screen),
                       CWOverrideRedirect | CWBackPixel, &attr);
     focus_indicator.bottom.window =
-        create_window(RootWindow(ob_display, ob_screen),
+        create_window(obt_root(ob_screen),
                       CWOverrideRedirect | CWBackPixel, &attr);
 
     stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.top));
     stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.left));
     stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.right));
     stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.bottom));
-    g_hash_table_insert(window_map, &focus_indicator.top.window,
-                        &focus_indicator.top);
-    g_hash_table_insert(window_map, &focus_indicator.left.window,
-                        &focus_indicator.left);
-    g_hash_table_insert(window_map, &focus_indicator.right.window,
-                        &focus_indicator.right);
-    g_hash_table_insert(window_map, &focus_indicator.bottom.window,
-                        &focus_indicator.bottom);
+    window_add(&focus_indicator.top.window,
+               INTERNAL_AS_WINDOW(&focus_indicator.top));
+    window_add(&focus_indicator.left.window,
+               INTERNAL_AS_WINDOW(&focus_indicator.left));
+    window_add(&focus_indicator.right.window,
+               INTERNAL_AS_WINDOW(&focus_indicator.right));
+    window_add(&focus_indicator.bottom.window,
+               INTERNAL_AS_WINDOW(&focus_indicator.bottom));
 
     color_white = RrColorNew(ob_rr_inst, 0xff, 0xff, 0xff);
 
@@ -117,20 +117,20 @@ void focus_cycle_indicator_shutdown(gboolean reconfig)
 
     RrAppearanceFree(a_focus_indicator);
 
-    g_hash_table_remove(window_map, &focus_indicator.top.window);
-    g_hash_table_remove(window_map, &focus_indicator.left.window);
-    g_hash_table_remove(window_map, &focus_indicator.right.window);
-    g_hash_table_remove(window_map, &focus_indicator.bottom.window);
+    window_remove(focus_indicator.top.window);
+    window_remove(focus_indicator.left.window);
+    window_remove(focus_indicator.right.window);
+    window_remove(focus_indicator.bottom.window);
 
     stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.top));
     stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.left));
     stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.right));
     stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.bottom));
 
-    XDestroyWindow(ob_display, focus_indicator.top.window);
-    XDestroyWindow(ob_display, focus_indicator.left.window);
-    XDestroyWindow(ob_display, focus_indicator.right.window);
-    XDestroyWindow(ob_display, focus_indicator.bottom.window);
+    XDestroyWindow(obt_display, focus_indicator.top.window);
+    XDestroyWindow(obt_display, focus_indicator.left.window);
+    XDestroyWindow(obt_display, focus_indicator.right.window);
+    XDestroyWindow(obt_display, focus_indicator.bottom.window);
 }
 
 void focus_cycle_update_indicator(ObClient *c)
@@ -147,10 +147,10 @@ void focus_cycle_draw_indicator(ObClient *c)
         /* kill enter events cause by this unmapping */
         ignore_start = event_start_ignore_all_enters();
 
-        XUnmapWindow(ob_display, focus_indicator.top.window);
-        XUnmapWindow(ob_display, focus_indicator.left.window);
-        XUnmapWindow(ob_display, focus_indicator.right.window);
-        XUnmapWindow(ob_display, focus_indicator.bottom.window);
+        XUnmapWindow(obt_display, focus_indicator.top.window);
+        XUnmapWindow(obt_display, focus_indicator.left.window);
+        XUnmapWindow(obt_display, focus_indicator.right.window);
+        XUnmapWindow(obt_display, focus_indicator.bottom.window);
 
         event_end_ignore_all_enters(ignore_start);
 
@@ -176,7 +176,7 @@ void focus_cycle_draw_indicator(ObClient *c)
         /* kill enter events cause by this moving */
         ignore_start = event_start_ignore_all_enters();
 
-        XMoveResizeWindow(ob_display, focus_indicator.top.window,
+        XMoveResizeWindow(obt_display, focus_indicator.top.window,
                           x, y, w, h);
         a_focus_indicator->texture[0].data.lineart.x1 = 0;
         a_focus_indicator->texture[0].data.lineart.y1 = h-1;
@@ -202,7 +202,7 @@ void focus_cycle_draw_indicator(ObClient *c)
         w = wl;
         h = c->frame->area.height;
 
-        XMoveResizeWindow(ob_display, focus_indicator.left.window,
+        XMoveResizeWindow(obt_display, focus_indicator.left.window,
                           x, y, w, h);
         a_focus_indicator->texture[0].data.lineart.x1 = w-1;
         a_focus_indicator->texture[0].data.lineart.y1 = 0;
@@ -228,7 +228,7 @@ void focus_cycle_draw_indicator(ObClient *c)
         w = wr;
         h = c->frame->area.height ;
 
-        XMoveResizeWindow(ob_display, focus_indicator.right.window,
+        XMoveResizeWindow(obt_display, focus_indicator.right.window,
                           x, y, w, h);
         a_focus_indicator->texture[0].data.lineart.x1 = 0;
         a_focus_indicator->texture[0].data.lineart.y1 = 0;
@@ -254,7 +254,7 @@ void focus_cycle_draw_indicator(ObClient *c)
         w = c->frame->area.width;
         h = wb;
 
-        XMoveResizeWindow(ob_display, focus_indicator.bottom.window,
+        XMoveResizeWindow(obt_display, focus_indicator.bottom.window,
                           x, y, w, h);
         a_focus_indicator->texture[0].data.lineart.x1 = 0;
         a_focus_indicator->texture[0].data.lineart.y1 = 0;
@@ -275,10 +275,10 @@ void focus_cycle_draw_indicator(ObClient *c)
         RrPaint(a_focus_indicator, focus_indicator.bottom.window,
                 w, h);
 
-        XMapWindow(ob_display, focus_indicator.top.window);
-        XMapWindow(ob_display, focus_indicator.left.window);
-        XMapWindow(ob_display, focus_indicator.right.window);
-        XMapWindow(ob_display, focus_indicator.bottom.window);
+        XMapWindow(obt_display, focus_indicator.top.window);
+        XMapWindow(obt_display, focus_indicator.left.window);
+        XMapWindow(obt_display, focus_indicator.right.window);
+        XMapWindow(obt_display, focus_indicator.bottom.window);
 
         event_end_ignore_all_enters(ignore_start);