]> Dogcows Code - chaz/openbox/commitdiff
remove the ob_root var, its redundant of what Xlib already provides
authorDana Jansens <danakj@orodu.net>
Thu, 10 Jul 2003 19:01:41 +0000 (19:01 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 10 Jul 2003 19:01:41 +0000 (19:01 +0000)
15 files changed:
openbox/client.c
openbox/dock.c
openbox/event.c
openbox/focus.c
openbox/frame.c
openbox/grab.c
openbox/menu.c
openbox/moveresize.c
openbox/openbox.c
openbox/openbox.h
openbox/popup.c
openbox/prop.c
openbox/screen.c
openbox/stacking.c
openbox/startup.c

index 0dab31d0727ee845c43e4ddab6e176522a6b6870..644198a77393c785137760a10da6398a777f4937 100644 (file)
@@ -67,7 +67,8 @@ void client_set_list()
     } else
        windows = NULL;
 
-    PROP_SETA32(ob_root, net_client_list, window, (guint32*)windows, size);
+    PROP_SETA32(RootWindow(ob_display, ob_screen),
+                net_client_list, window, (guint32*)windows, size);
 
     if (windows)
        g_free(windows);
@@ -113,7 +114,8 @@ void client_manage_all()
     XWMHints *wmhints;
     XWindowAttributes attrib;
 
-    XQueryTree(ob_display, ob_root, &w, &w, &children, &nchild);
+    XQueryTree(ob_display, RootWindow(ob_display, ob_screen),
+               &w, &w, &children, &nchild);
 
     /* remove all icon windows from the list */
     for (i = 0; i < nchild; i++) {
@@ -700,7 +702,7 @@ void client_update_transient_for(ObClient *self)
                    group */
                 if (t == self->group->leader ||
                     t == None ||
-                    t == ob_root) {
+                    t == RootWindow(ob_display, ob_screen)) {
                     /* window is a transient for its group! */
                     c = OB_TRAN_GROUP;
                 }
index ccea0ad03428451d4c3eaa25c84858a058bc39f0..5d110353fcd84cf3807d09c5fc5faa4937edfad9 100644 (file)
@@ -27,7 +27,8 @@ void dock_startup()
 
     attrib.event_mask = DOCK_EVENT_MASK;
     attrib.override_redirect = True;
-    dock->frame = XCreateWindow(ob_display, ob_root, 0, 0, 1, 1, 0,
+    dock->frame = XCreateWindow(ob_display, RootWindow(ob_display, ob_screen),
+                                0, 0, 1, 1, 0,
                                 RrDepth(ob_rr_inst), InputOutput,
                                 RrVisual(ob_rr_inst),
                                 CWOverrideRedirect | CWEventMask,
@@ -134,7 +135,8 @@ void dock_remove(ObDockApp *app, gboolean reparent)
     g_hash_table_remove(window_map, &app->icon_win);
 
     if (reparent)
-       XReparentWindow(ob_display, app->icon_win, ob_root, app->x, app->y);
+       XReparentWindow(ob_display, app->icon_win,
+                        RootWindow(ob_display, ob_screen), app->x, app->y);
 
     dock->dock_apps = g_list_remove(dock->dock_apps, app);
     dock_configure();
index cb8babf078d2a059de071a728e0d53c8ccfd654b..d80f755c11212fca6420ecbbcbda987dc204c738 100644 (file)
@@ -486,7 +486,7 @@ static void event_process(XEvent *e)
        event_handle_dockapp(dockapp, e);
     else if (dock)
        event_handle_dock(dock, e);
-    else if (window == ob_root)
+    else if (window == RootWindow(ob_display, ob_screen))
        event_handle_root(e);
     else if (e->type == MapRequest)
        client_manage(window);
index 3927272c5b6cabad247bff0339c1bca1a147d99e..6177bc9a68455946c1557cd0a9ba42572cc6cd8f 100644 (file)
@@ -96,7 +96,8 @@ void focus_set_client(ObClient *client)
     /* set the NET_ACTIVE_WINDOW hint, but preserve it on shutdown */
     if (ob_state != OB_STATE_EXITING) {
         active = client ? client->window : None;
-        PROP_SET32(ob_root, net_active_window, window, active);
+        PROP_SET32(RootWindow(ob_display, ob_screen),
+                   net_active_window, window, active);
     }
 
     if (focus_client != NULL)
index decebbce85581d2819b8f1416c79dbbc0b722ac7..82e7f90b12dcb68aa9c6366e5c86ba3b91d05e99 100644 (file)
@@ -48,7 +48,8 @@ ObFrame *frame_new()
     mask = CWOverrideRedirect | CWEventMask;
     attrib.event_mask = FRAME_EVENTMASK;
     attrib.override_redirect = TRUE;
-    self->window = createWindow(ob_root, mask, &attrib);
+    self->window = createWindow(RootWindow(ob_display, ob_screen),
+                                mask, &attrib);
 
     mask = 0;
     self->plate = createWindow(self->window, mask, &attrib);
@@ -395,7 +396,8 @@ void frame_release_client(ObFrame *self, ObClient *client)
     } else {
        /* according to the ICCCM - if the client doesn't reparent itself,
           then we will reparent the window to root for them */
-       XReparentWindow(ob_display, client->window, ob_root,
+       XReparentWindow(ob_display, client->window,
+                        RootWindow(ob_display, ob_screen),
                        client->area.x,
                        client->area.y);
     }
@@ -582,7 +584,7 @@ ObFrameContext frame_context(ObClient *client, Window win)
 {
     ObFrame *self;
 
-    if (win == ob_root) return OB_FRAME_CONTEXT_ROOT;
+    if (win == RootWindow(ob_display, ob_screen)) return OB_FRAME_CONTEXT_ROOT;
     if (client == NULL) return OB_FRAME_CONTEXT_NONE;
     if (win == client->window) return OB_FRAME_CONTEXT_CLIENT;
 
index 3f87f3b0b7d07568a563c8d715e0c3e6307d61af..2d8877841fd1145de68b7eb59fbceb21291f460a 100644 (file)
@@ -20,8 +20,9 @@ gboolean grab_keyboard(gboolean grab)
 
     if (grab) {
         if (kgrabs++ == 0)
-            ret = XGrabKeyboard(ob_display, ob_root, FALSE, GrabModeAsync,
-                                GrabModeAsync, event_lasttime) == Success;
+            ret = XGrabKeyboard(ob_display, RootWindow(ob_display, ob_screen),
+                                FALSE, GrabModeAsync, GrabModeAsync,
+                                event_lasttime) == Success;
         else
             ret = TRUE;
     } else if (kgrabs > 0) {
@@ -39,10 +40,10 @@ gboolean grab_pointer(gboolean grab, ObCursor cur)
 
     if (grab) {
         if (pgrabs++ == 0)
-            ret = XGrabPointer(ob_display, ob_root, False, GRAB_PTR_MASK,
-                               GrabModeAsync, GrabModeAsync, FALSE,
-                               ob_cursor(cur),
-                               event_lasttime) == Success;
+            ret = XGrabPointer(ob_display, RootWindow(ob_display, ob_screen),
+                               False, GRAB_PTR_MASK, GrabModeAsync,
+                               GrabModeAsync, FALSE,
+                               ob_cursor(cur), event_lasttime) == Success;
         else
             ret = TRUE;
     } else if (pgrabs > 0) {
index c12fadf999b10b218675c2737eea34d6071dd12e..aef0356d4bc603e3b447b5ff3dcf19f32580ba20 100644 (file)
@@ -212,7 +212,7 @@ Menu *menu_new_full(char *label, char *name, Menu *parent,
 
     attrib.override_redirect = TRUE;
     attrib.event_mask = FRAME_EVENTMASK;
-    self->frame = createWindow(ob_root,
+    self->frame = createWindow(RootWindow(ob_display, ob_screen),
                                CWOverrideRedirect|CWEventMask, &attrib);
     attrib.event_mask = TITLE_EVENTMASK;
     self->title = createWindow(self->frame, CWEventMask, &attrib);
index 97837295d9e6df8a7b7ff99e5fbc9ee61d571afd..96eac5cff418f2f116a0ee6d170050577ab12988 100644 (file)
@@ -42,7 +42,9 @@ void moveresize_startup()
     popup_size_to_string(popup, "W:  0000  W:  0000");
 
     attrib.save_under = True;
-    opaque_window.win = XCreateWindow(ob_display, ob_root, 0, 0, 1, 1, 0,
+    opaque_window.win = XCreateWindow(ob_display,
+                                      RootWindow(ob_display, ob_screen),
+                                      0, 0, 1, 1, 0,
                                       RrDepth(ob_rr_inst), InputOutput,
                                       RrVisual(ob_rr_inst),
                                       CWSaveUnder, &attrib);
index 55f3d0420444aaf161346902e6d5b33ebba95904..65669652f8dc4d3339438d616265c558f4f59b90 100644 (file)
@@ -59,7 +59,6 @@ RrInstance *ob_rr_inst;
 RrTheme    *ob_rr_theme;
 Display    *ob_display;
 gint        ob_screen;
-Window      ob_root;
 ObState     ob_state;
 Cursor      ob_cursors[OB_NUM_CURSORS];
 KeyCode     ob_keys[OB_NUM_KEYS];
@@ -147,7 +146,6 @@ int main(int argc, char **argv)
 #endif
 
     ob_screen = DefaultScreen(ob_display);
-    ob_root = RootWindow(ob_display, ob_screen);
 
     ob_rr_inst = RrInstanceNew(ob_display, ob_screen);
     if (ob_rr_inst == NULL)
@@ -550,7 +548,8 @@ gboolean ob_pointer_pos(int *x, int *y)
     int i;
     guint u;
 
-    return !!XQueryPointer(ob_display, ob_root, &w, &w, x, y, &i, &i, &u);
+    return !!XQueryPointer(ob_display, RootWindow(ob_display, ob_screen),
+                           &w, &w, x, y, &i, &i, &u);
 }
 
 #ifdef USE_SM
index c6a2f2104c085cd40ab1786244af36088d6db85e..93ee4813c89ae2744ceab7ffd099026fa127ff7b 100644 (file)
@@ -26,8 +26,6 @@ SnDisplay *ob_sn_display;
 
 /*! The number of the screen on which we're running */
 extern gint     ob_screen;
-/*! The root window */
-extern Window   ob_root;
 
 /* The state of execution of the window manager */
 extern ObState ob_state;
index ba1aed0b4fbdd388560fe9787f126142bdc8f62c..cc4a605d42e419a320f962b9ff4144c8062e1f34 100644 (file)
@@ -42,7 +42,7 @@ Popup *popup_new(gboolean hasicon)
     self->a_bg = self->a_icon = self->a_text = NULL;
 
     attrib.override_redirect = True;
-    self->bg = XCreateWindow(ob_display, ob_root,
+    self->bg = XCreateWindow(ob_display, RootWindow(ob_display, ob_screen),
                              0, 0, 1, 1, 0, RrDepth(ob_rr_inst),
                              InputOutput, RrVisual(ob_rr_inst),
                              CWOverrideRedirect, &attrib);
index 2c67c20121cdad55afe3dc700b048eb31658c526..5cc101092a2819ebfeaecc7ff29a38929c3dac2b 100644 (file)
@@ -407,6 +407,6 @@ void prop_message(Window about, Atom messagetype, long data0, long data1,
     ce.xclient.data.l[1] = data1;
     ce.xclient.data.l[2] = data2;
     ce.xclient.data.l[3] = data3;
-    XSendEvent(ob_display, ob_root, FALSE,
+    XSendEvent(ob_display, RootWindow(ob_display, ob_screen), FALSE,
               SubstructureNotifyMask | SubstructureRedirectMask, &ce);
 }
index 69082460814198ddc621d4b37fd37ba41b0cfc3e..67863d17dfded474f33af7c078a0d67f7e68e25f 100644 (file)
@@ -61,7 +61,8 @@ gboolean screen_annex()
 
     xerror_set_ignore(TRUE);
     xerror_occured = FALSE;
-    XSelectInput(ob_display, ob_root, ROOT_EVENTMASK);
+    XSelectInput(ob_display, RootWindow(ob_display, ob_screen),
+                 ROOT_EVENTMASK);
     xerror_set_ignore(FALSE);
     if (xerror_occured) {
         g_message("A window manager is already running on screen %d",
@@ -76,11 +77,13 @@ gboolean screen_annex()
 
     /* set the OPENBOX_PID hint */
     pid = getpid();
-    PROP_SET32(ob_root, openbox_pid, cardinal, pid);
+    PROP_SET32(RootWindow(ob_display, ob_screen),
+               openbox_pid, cardinal, pid);
 
     /* create the netwm support window */
     attrib.override_redirect = TRUE;
-    screen_support_win = XCreateWindow(ob_display, ob_root,
+    screen_support_win = XCreateWindow(ob_display,
+                                       RootWindow(ob_display, ob_screen),
                                        -100, -100, 1, 1, 0,
                                        CopyFromParent, InputOutput,
                                        CopyFromParent,
@@ -88,7 +91,8 @@ gboolean screen_annex()
     XMapRaised(ob_display, screen_support_win);
 
     /* set supporting window */
-    PROP_SET32(ob_root, net_supporting_wm_check, window, screen_support_win);
+    PROP_SET32(RootWindow(ob_display, ob_screen),
+               net_supporting_wm_check, window, screen_support_win);
 
     /* set properties on the supporting window */
     PROP_SETS(screen_support_win, net_wm_name, "Openbox");
@@ -165,7 +169,8 @@ gboolean screen_annex()
   supported[] = prop_atoms.net_wm_action_stick;
 */
 
-    PROP_SETA32(ob_root, net_supported, atom, supported, num_support);
+    PROP_SETA32(RootWindow(ob_display, ob_screen),
+                net_supported, atom, supported, num_support);
     g_free(supported);
 
     return TRUE;
@@ -185,7 +190,8 @@ void screen_startup()
     for (i = 0, it = config_desktops_names; it; ++i, it = it->next)
         screen_desktop_names[i] = it->data; /* dont strdup */
     screen_desktop_names[i] = NULL;
-    PROP_SETSS(ob_root, net_desktop_names, screen_desktop_names);
+    PROP_SETSS(RootWindow(ob_display, ob_screen),
+               net_desktop_names, screen_desktop_names);
     g_free(screen_desktop_names); /* dont free the individual strings */
     screen_desktop_names = NULL;
 
@@ -198,7 +204,8 @@ void screen_startup()
 
     /* don't start in showing-desktop mode */
     screen_showing_desktop = FALSE;
-    PROP_SET32(ob_root, net_showing_desktop, cardinal, screen_showing_desktop);
+    PROP_SET32(RootWindow(ob_display, ob_screen),
+               net_showing_desktop, cardinal, screen_showing_desktop);
 
     screen_update_layout();
 
@@ -213,11 +220,14 @@ void screen_shutdown()
 {
     Rect **r;
 
-    XSelectInput(ob_display, ob_root, NoEventMask);
+    XSelectInput(ob_display, RootWindow(ob_display, ob_screen), NoEventMask);
 
-    PROP_ERASE(ob_root, openbox_pid); /* we're not running here no more! */
-    PROP_ERASE(ob_root, net_supported); /* not without us */
-    PROP_ERASE(ob_root, net_showing_desktop); /* don't keep this mode */
+    /* we're not running here no more! */
+    PROP_ERASE(RootWindow(ob_display, ob_screen), openbox_pid);
+    /* not without us */
+    PROP_ERASE(RootWindow(ob_display, ob_screen), net_supported);
+    /* don't keep this mode */
+    PROP_ERASE(RootWindow(ob_display, ob_screen), net_showing_desktop);
 
     XDestroyWindow(ob_display, screen_support_win);
 
@@ -244,7 +254,8 @@ void screen_resize()
     /* Set the _NET_DESKTOP_GEOMETRY hint */
     screen_physical_size.width = geometry[0] = w;
     screen_physical_size.height = geometry[1] = h;
-    PROP_SETA32(ob_root, net_desktop_geometry, cardinal, geometry, 2);
+    PROP_SETA32(RootWindow(ob_display, ob_screen),
+                net_desktop_geometry, cardinal, geometry, 2);
 
     if (ob_state == OB_STATE_STARTING)
        return;
@@ -266,11 +277,13 @@ void screen_set_num_desktops(guint num)
 
     old = screen_num_desktops;
     screen_num_desktops = num;
-    PROP_SET32(ob_root, net_number_of_desktops, cardinal, num);
+    PROP_SET32(RootWindow(ob_display, ob_screen),
+               net_number_of_desktops, cardinal, num);
 
     /* set the viewport hint */
     viewport = g_new0(guint32, num * 2);
-    PROP_SETA32(ob_root, net_desktop_viewport, cardinal, viewport, num * 2);
+    PROP_SETA32(RootWindow(ob_display, ob_screen),
+                net_desktop_viewport, cardinal, viewport, num * 2);
     g_free(viewport);
 
     /* the number of rows/columns will differ */
@@ -316,7 +329,8 @@ void screen_set_desktop(guint num)
 
     old = screen_desktop;
     screen_desktop = num;
-    PROP_SET32(ob_root, net_current_desktop, cardinal, num);
+    PROP_SET32(RootWindow(ob_display, ob_screen),
+               net_current_desktop, cardinal, num);
 
     if (old == num) return;
 
@@ -366,7 +380,8 @@ void screen_update_layout()
     guint num;
     gboolean valid = FALSE;
 
-    if (PROP_GETA32(ob_root, net_desktop_layout, cardinal, &data, &num)) {
+    if (PROP_GETA32(RootWindow(ob_display, ob_screen),
+                    net_desktop_layout, cardinal, &data, &num)) {
         if (num == 3 || num == 4) {
 
             if (data[0] == prop_atoms.net_wm_orientation_vert)
@@ -444,7 +459,8 @@ void screen_update_desktop_names()
     g_strfreev(screen_desktop_names);
     screen_desktop_names = NULL;
 
-    if (PROP_GETSS(ob_root, net_desktop_names, utf8, &screen_desktop_names))
+    if (PROP_GETSS(RootWindow(ob_display, ob_screen),
+                   net_desktop_names, utf8, &screen_desktop_names))
         for (i = 0; screen_desktop_names[i] && i <= screen_num_desktops; ++i);
     else
         i = 0;
@@ -496,7 +512,8 @@ void screen_show_desktop(gboolean show)
     }
 
     show = !!show; /* make it boolean */
-    PROP_SET32(ob_root, net_showing_desktop, cardinal, show);
+    PROP_SET32(RootWindow(ob_display, ob_screen),
+               net_showing_desktop, cardinal, show);
 
     dispatch_ob(Event_Ob_ShowDesktop, show, 0);
 }
@@ -689,7 +706,7 @@ void screen_update_areas()
             dims[(i * 4) + 3] = area[i][screen_num_monitors].height;
         }
     }
-    PROP_SETA32(ob_root, net_workarea, cardinal,
+    PROP_SETA32(RootWindow(ob_display, ob_screen), net_workarea, cardinal,
                dims, 4 * screen_num_desktops);
 
     g_free(dims);
@@ -728,10 +745,12 @@ static void set_root_cursor()
 {
 #ifdef USE_LIBSN
         if (sn_busy_cnt)
-            XDefineCursor(ob_display, ob_root, ob_cursor(OB_CURSOR_BUSY));
+            XDefineCursor(ob_display, RootWindow(ob_display, ob_screen),
+                          ob_cursor(OB_CURSOR_BUSY));
         else
 #endif
-            XDefineCursor(ob_display, ob_root, ob_cursor(OB_CURSOR_POINTER));
+            XDefineCursor(ob_display, RootWindow(ob_display, ob_screen),
+                          ob_cursor(OB_CURSOR_POINTER));
 }
 
 #ifdef USE_LIBSN
index c15f38308da452d89f7fc420649ec03595d2f739..5b9b37b2958134e1a4d7dace6c466cc3206c1346 100644 (file)
@@ -30,8 +30,8 @@ void stacking_set_list()
         }
     }
 
-    PROP_SETA32(ob_root, net_client_list_stacking, window,
-                (guint32*)windows, i);
+    PROP_SETA32(RootWindow(ob_display, ob_screen),
+                net_client_list_stacking, window, (guint32*)windows, i);
 
     g_free(windows);
 }
index 6d381ff53eb5e795ae9205aacc09087f6c2935ab..8b6259a7a0a1088edbef0089f1d3c760491f06b2 100644 (file)
@@ -13,8 +13,11 @@ guint32  startup_desktop = 0;
 void startup_save()
 {
     /* save the stacking order on startup! */
-    PROP_GETA32(ob_root, net_client_list_stacking, window,
+    PROP_GETA32(RootWindow(ob_display, ob_screen),
+                net_client_list_stacking, window,
                 (guint32**)&startup_stack_order, &startup_stack_size);
-    PROP_GET32(ob_root, net_active_window, window, &startup_active);
-    PROP_GET32(ob_root, net_current_desktop, cardinal, &startup_desktop);
+    PROP_GET32(RootWindow(ob_display, ob_screen),
+               net_active_window, window, &startup_active);
+    PROP_GET32(RootWindow(ob_display, ob_screen),
+               net_current_desktop, cardinal, &startup_desktop);
 }
This page took 0.049311 seconds and 4 git commands to generate.