summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-07-10 19:01:41 +0000
committerDana Jansens <danakj@orodu.net>2003-07-10 19:01:41 +0000
commit35418ca0fcd3fd28ef579f4435b8bad3b7c87f04 (patch)
tree07182e5626a01baf752ec13a57d7ab3eabe8f967 /openbox
parentec908528cf2abad9d2b968db9c8f7287ef5f54fe (diff)
remove the ob_root var, its redundant of what Xlib already provides
Diffstat (limited to 'openbox')
-rw-r--r--openbox/client.c8
-rw-r--r--openbox/dock.c6
-rw-r--r--openbox/event.c2
-rw-r--r--openbox/focus.c3
-rw-r--r--openbox/frame.c8
-rw-r--r--openbox/grab.c13
-rw-r--r--openbox/menu.c2
-rw-r--r--openbox/moveresize.c4
-rw-r--r--openbox/openbox.c5
-rw-r--r--openbox/openbox.h2
-rw-r--r--openbox/popup.c2
-rw-r--r--openbox/prop.c2
-rw-r--r--openbox/screen.c61
-rw-r--r--openbox/stacking.c4
-rw-r--r--openbox/startup.c9
15 files changed, 80 insertions, 51 deletions
diff --git a/openbox/client.c b/openbox/client.c
index 0dab31d0..644198a7 100644
--- a/openbox/client.c
+++ b/openbox/client.c
@@ -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;
}
diff --git a/openbox/dock.c b/openbox/dock.c
index ccea0ad0..5d110353 100644
--- a/openbox/dock.c
+++ b/openbox/dock.c
@@ -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();
diff --git a/openbox/event.c b/openbox/event.c
index cb8babf0..d80f755c 100644
--- a/openbox/event.c
+++ b/openbox/event.c
@@ -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);
diff --git a/openbox/focus.c b/openbox/focus.c
index 3927272c..6177bc9a 100644
--- a/openbox/focus.c
+++ b/openbox/focus.c
@@ -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)
diff --git a/openbox/frame.c b/openbox/frame.c
index decebbce..82e7f90b 100644
--- a/openbox/frame.c
+++ b/openbox/frame.c
@@ -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;
diff --git a/openbox/grab.c b/openbox/grab.c
index 3f87f3b0..2d887784 100644
--- a/openbox/grab.c
+++ b/openbox/grab.c
@@ -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) {
diff --git a/openbox/menu.c b/openbox/menu.c
index c12fadf9..aef0356d 100644
--- a/openbox/menu.c
+++ b/openbox/menu.c
@@ -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);
diff --git a/openbox/moveresize.c b/openbox/moveresize.c
index 97837295..96eac5cf 100644
--- a/openbox/moveresize.c
+++ b/openbox/moveresize.c
@@ -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);
diff --git a/openbox/openbox.c b/openbox/openbox.c
index 55f3d042..65669652 100644
--- a/openbox/openbox.c
+++ b/openbox/openbox.c
@@ -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
diff --git a/openbox/openbox.h b/openbox/openbox.h
index c6a2f210..93ee4813 100644
--- a/openbox/openbox.h
+++ b/openbox/openbox.h
@@ -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;
diff --git a/openbox/popup.c b/openbox/popup.c
index ba1aed0b..cc4a605d 100644
--- a/openbox/popup.c
+++ b/openbox/popup.c
@@ -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);
diff --git a/openbox/prop.c b/openbox/prop.c
index 2c67c201..5cc10109 100644
--- a/openbox/prop.c
+++ b/openbox/prop.c
@@ -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);
}
diff --git a/openbox/screen.c b/openbox/screen.c
index 69082460..67863d17 100644
--- a/openbox/screen.c
+++ b/openbox/screen.c
@@ -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
diff --git a/openbox/stacking.c b/openbox/stacking.c
index c15f3830..5b9b37b2 100644
--- a/openbox/stacking.c
+++ b/openbox/stacking.c
@@ -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);
}
diff --git a/openbox/startup.c b/openbox/startup.c
index 6d381ff5..8b6259a7 100644
--- a/openbox/startup.c
+++ b/openbox/startup.c
@@ -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);
}