make the internal window type more easily inheritable
authorDana Jansens <danakj@orodu.net>
Thu, 7 Feb 2008 00:40:21 +0000 (19:40 -0500)
committerDana Jansens <danakj@orodu.net>
Thu, 14 Feb 2008 19:24:07 +0000 (14:24 -0500)
openbox/focus_cycle_indicator.c
openbox/window.c
openbox/window.h

index 7c5d529..79de673 100644 (file)
@@ -59,23 +59,23 @@ void focus_cycle_indicator_startup(gboolean reconfig)
 
     if (reconfig) return;
 
 
     if (reconfig) return;
 
-    focus_indicator.top.obwin.type = Window_Internal;
-    focus_indicator.left.obwin.type = Window_Internal;
-    focus_indicator.right.obwin.type = Window_Internal;
-    focus_indicator.bottom.obwin.type = Window_Internal;
+    focus_indicator.top.type = Window_Internal;
+    focus_indicator.left.type = Window_Internal;
+    focus_indicator.right.type = Window_Internal;
+    focus_indicator.bottom.type = Window_Internal;
 
     attr.override_redirect = True;
     attr.background_pixel = BlackPixel(ob_display, ob_screen);
 
     attr.override_redirect = True;
     attr.background_pixel = BlackPixel(ob_display, ob_screen);
-    focus_indicator.top.win =
+    focus_indicator.top.window =
         create_window(RootWindow(ob_display, ob_screen),
                       CWOverrideRedirect | CWBackPixel, &attr);
         create_window(RootWindow(ob_display, ob_screen),
                       CWOverrideRedirect | CWBackPixel, &attr);
-    focus_indicator.left.win =
+    focus_indicator.left.window =
         create_window(RootWindow(ob_display, ob_screen),
                       CWOverrideRedirect | CWBackPixel, &attr);
         create_window(RootWindow(ob_display, ob_screen),
                       CWOverrideRedirect | CWBackPixel, &attr);
-    focus_indicator.right.win =
+    focus_indicator.right.window =
         create_window(RootWindow(ob_display, ob_screen),
                       CWOverrideRedirect | CWBackPixel, &attr);
         create_window(RootWindow(ob_display, ob_screen),
                       CWOverrideRedirect | CWBackPixel, &attr);
-    focus_indicator.bottom.win =
+    focus_indicator.bottom.window =
         create_window(RootWindow(ob_display, ob_screen),
                       CWOverrideRedirect | CWBackPixel, &attr);
 
         create_window(RootWindow(ob_display, ob_screen),
                       CWOverrideRedirect | CWBackPixel, &attr);
 
@@ -83,13 +83,13 @@ void focus_cycle_indicator_startup(gboolean reconfig)
     stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.left));
     stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.right));
     stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.bottom));
     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.win,
+    g_hash_table_insert(window_map, &focus_indicator.top.window,
                         &focus_indicator.top);
                         &focus_indicator.top);
-    g_hash_table_insert(window_map, &focus_indicator.left.win,
+    g_hash_table_insert(window_map, &focus_indicator.left.window,
                         &focus_indicator.left);
                         &focus_indicator.left);
-    g_hash_table_insert(window_map, &focus_indicator.right.win,
+    g_hash_table_insert(window_map, &focus_indicator.right.window,
                         &focus_indicator.right);
                         &focus_indicator.right);
-    g_hash_table_insert(window_map, &focus_indicator.bottom.win,
+    g_hash_table_insert(window_map, &focus_indicator.bottom.window,
                         &focus_indicator.bottom);
 
     color_white = RrColorNew(ob_rr_inst, 0xff, 0xff, 0xff);
                         &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);
 
 
     RrAppearanceFree(a_focus_indicator);
 
-    g_hash_table_remove(window_map, &focus_indicator.top.win);
-    g_hash_table_remove(window_map, &focus_indicator.left.win);
-    g_hash_table_remove(window_map, &focus_indicator.right.win);
-    g_hash_table_remove(window_map, &focus_indicator.bottom.win);
+    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);
 
     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));
 
 
     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.win);
-    XDestroyWindow(ob_display, focus_indicator.left.win);
-    XDestroyWindow(ob_display, focus_indicator.right.win);
-    XDestroyWindow(ob_display, focus_indicator.bottom.win);
+    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);
 }
 
 void focus_cycle_draw_indicator(ObClient *c)
 }
 
 void focus_cycle_draw_indicator(ObClient *c)
@@ -141,10 +141,10 @@ void focus_cycle_draw_indicator(ObClient *c)
         /* kill enter events cause by this unmapping */
         ignore_start = event_start_ignore_all_enters();
 
         /* kill enter events cause by this unmapping */
         ignore_start = event_start_ignore_all_enters();
 
-        XUnmapWindow(ob_display, focus_indicator.top.win);
-        XUnmapWindow(ob_display, focus_indicator.left.win);
-        XUnmapWindow(ob_display, focus_indicator.right.win);
-        XUnmapWindow(ob_display, focus_indicator.bottom.win);
+        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);
 
         event_end_ignore_all_enters(ignore_start);
 
 
         event_end_ignore_all_enters(ignore_start);
 
@@ -170,7 +170,7 @@ void focus_cycle_draw_indicator(ObClient *c)
         /* kill enter events cause by this moving */
         ignore_start = event_start_ignore_all_enters();
 
         /* kill enter events cause by this moving */
         ignore_start = event_start_ignore_all_enters();
 
-        XMoveResizeWindow(ob_display, focus_indicator.top.win,
+        XMoveResizeWindow(ob_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;
                           x, y, w, h);
         a_focus_indicator->texture[0].data.lineart.x1 = 0;
         a_focus_indicator->texture[0].data.lineart.y1 = h-1;
@@ -188,7 +188,7 @@ void focus_cycle_draw_indicator(ObClient *c)
         a_focus_indicator->texture[3].data.lineart.y1 = h-1;
         a_focus_indicator->texture[3].data.lineart.x2 = w - wr;
         a_focus_indicator->texture[3].data.lineart.y2 = h-1;
         a_focus_indicator->texture[3].data.lineart.y1 = h-1;
         a_focus_indicator->texture[3].data.lineart.x2 = w - wr;
         a_focus_indicator->texture[3].data.lineart.y2 = h-1;
-        RrPaint(a_focus_indicator, focus_indicator.top.win,
+        RrPaint(a_focus_indicator, focus_indicator.top.window,
                 w, h);
 
         x = c->frame->area.x;
                 w, h);
 
         x = c->frame->area.x;
@@ -196,7 +196,7 @@ void focus_cycle_draw_indicator(ObClient *c)
         w = wl;
         h = c->frame->area.height;
 
         w = wl;
         h = c->frame->area.height;
 
-        XMoveResizeWindow(ob_display, focus_indicator.left.win,
+        XMoveResizeWindow(ob_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;
                           x, y, w, h);
         a_focus_indicator->texture[0].data.lineart.x1 = w-1;
         a_focus_indicator->texture[0].data.lineart.y1 = 0;
@@ -214,7 +214,7 @@ void focus_cycle_draw_indicator(ObClient *c)
         a_focus_indicator->texture[3].data.lineart.y1 = wt-1;
         a_focus_indicator->texture[3].data.lineart.x2 = w-1;
         a_focus_indicator->texture[3].data.lineart.y2 = h - wb;
         a_focus_indicator->texture[3].data.lineart.y1 = wt-1;
         a_focus_indicator->texture[3].data.lineart.x2 = w-1;
         a_focus_indicator->texture[3].data.lineart.y2 = h - wb;
-        RrPaint(a_focus_indicator, focus_indicator.left.win,
+        RrPaint(a_focus_indicator, focus_indicator.left.window,
                 w, h);
 
         x = c->frame->area.x + c->frame->area.width - wr;
                 w, h);
 
         x = c->frame->area.x + c->frame->area.width - wr;
@@ -222,7 +222,7 @@ void focus_cycle_draw_indicator(ObClient *c)
         w = wr;
         h = c->frame->area.height ;
 
         w = wr;
         h = c->frame->area.height ;
 
-        XMoveResizeWindow(ob_display, focus_indicator.right.win,
+        XMoveResizeWindow(ob_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;
                           x, y, w, h);
         a_focus_indicator->texture[0].data.lineart.x1 = 0;
         a_focus_indicator->texture[0].data.lineart.y1 = 0;
@@ -240,7 +240,7 @@ void focus_cycle_draw_indicator(ObClient *c)
         a_focus_indicator->texture[3].data.lineart.y1 = wt-1;
         a_focus_indicator->texture[3].data.lineart.x2 = 0;
         a_focus_indicator->texture[3].data.lineart.y2 = h - wb;
         a_focus_indicator->texture[3].data.lineart.y1 = wt-1;
         a_focus_indicator->texture[3].data.lineart.x2 = 0;
         a_focus_indicator->texture[3].data.lineart.y2 = h - wb;
-        RrPaint(a_focus_indicator, focus_indicator.right.win,
+        RrPaint(a_focus_indicator, focus_indicator.right.window,
                 w, h);
 
         x = c->frame->area.x;
                 w, h);
 
         x = c->frame->area.x;
@@ -248,7 +248,7 @@ void focus_cycle_draw_indicator(ObClient *c)
         w = c->frame->area.width;
         h = wb;
 
         w = c->frame->area.width;
         h = wb;
 
-        XMoveResizeWindow(ob_display, focus_indicator.bottom.win,
+        XMoveResizeWindow(ob_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;
                           x, y, w, h);
         a_focus_indicator->texture[0].data.lineart.x1 = 0;
         a_focus_indicator->texture[0].data.lineart.y1 = 0;
@@ -266,13 +266,13 @@ void focus_cycle_draw_indicator(ObClient *c)
         a_focus_indicator->texture[3].data.lineart.y1 = 0;
         a_focus_indicator->texture[3].data.lineart.x2 = w - wr;
         a_focus_indicator->texture[3].data.lineart.y2 = 0;
         a_focus_indicator->texture[3].data.lineart.y1 = 0;
         a_focus_indicator->texture[3].data.lineart.x2 = w - wr;
         a_focus_indicator->texture[3].data.lineart.y2 = 0;
-        RrPaint(a_focus_indicator, focus_indicator.bottom.win,
+        RrPaint(a_focus_indicator, focus_indicator.bottom.window,
                 w, h);
 
                 w, h);
 
-        XMapWindow(ob_display, focus_indicator.top.win);
-        XMapWindow(ob_display, focus_indicator.left.win);
-        XMapWindow(ob_display, focus_indicator.right.win);
-        XMapWindow(ob_display, focus_indicator.bottom.win);
+        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);
 
         event_end_ignore_all_enters(ignore_start);
 
 
         event_end_ignore_all_enters(ignore_start);
 
index c5e6a4e..3dd8f5a 100644 (file)
@@ -57,7 +57,7 @@ Window window_top(ObWindow *self)
     case Window_Client:
         return ((ObClient*)self)->frame->window;
     case Window_Internal:
     case Window_Client:
         return ((ObClient*)self)->frame->window;
     case Window_Internal:
-        return ((InternalWindow*)self)->win;
+        return ((InternalWindow*)self)->window;
     }
     g_assert_not_reached();
     return None;
     }
     g_assert_not_reached();
     return None;
index a172cfc..7a905de 100644 (file)
@@ -44,8 +44,8 @@ struct _ObWindow
 /* Wrapper for internal stuff. If its struct matches this then it can be used
    as an ObWindow */
 typedef struct InternalWindow {
 /* Wrapper for internal stuff. If its struct matches this then it can be used
    as an ObWindow */
 typedef struct InternalWindow {
-    ObWindow obwin;
-    Window win;
+    Window_InternalType type;
+    Window window;
 } InternalWindow;
 
 #define WINDOW_IS_MENU(win) (((ObWindow*)win)->type == Window_Menu)
 } InternalWindow;
 
 #define WINDOW_IS_MENU(win) (((ObWindow*)win)->type == Window_Menu)