} 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);
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++) {
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;
}
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,
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();
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);
/* 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)
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);
} 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);
}
{
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;
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) {
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) {
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);
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);
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];
#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)
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
/*! 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;
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);
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);
}
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",
/* 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,
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");
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;
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;
/* 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();
{
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);
/* 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;
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 */
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;
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)
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;
}
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);
}
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);
{
#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
}
}
- 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);
}
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);
}