diff options
Diffstat (limited to 'openbox/screen.c')
| -rw-r--r-- | openbox/screen.c | 115 |
1 files changed, 58 insertions, 57 deletions
diff --git a/openbox/screen.c b/openbox/screen.c index e8a175d1..d89bf856 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -90,10 +90,10 @@ static gboolean replace_wm(void) Time timestamp; wm_sn = g_strdup_printf("WM_S%d", ob_screen); - wm_sn_atom = XInternAtom(ob_display, wm_sn, FALSE); + wm_sn_atom = XInternAtom(obt_display, wm_sn, FALSE); g_free(wm_sn); - current_wm_sn_owner = XGetSelectionOwner(ob_display, wm_sn_atom); + current_wm_sn_owner = XGetSelectionOwner(obt_display, wm_sn_atom); if (current_wm_sn_owner == screen_support_win) current_wm_sn_owner = None; if (current_wm_sn_owner) { @@ -105,8 +105,8 @@ static gboolean replace_wm(void) obt_display_ignore_errors(TRUE); /* We want to find out when the current selection owner dies */ - XSelectInput(ob_display, current_wm_sn_owner, StructureNotifyMask); - XSync(ob_display, FALSE); + XSelectInput(obt_display, current_wm_sn_owner, StructureNotifyMask); + XSync(obt_display, FALSE); obt_display_ignore_errors(FALSE); if (obt_display_error_occured) @@ -115,10 +115,10 @@ static gboolean replace_wm(void) timestamp = event_get_server_time(); - XSetSelectionOwner(ob_display, wm_sn_atom, screen_support_win, + XSetSelectionOwner(obt_display, wm_sn_atom, screen_support_win, timestamp); - if (XGetSelectionOwner(ob_display, wm_sn_atom) != screen_support_win) { + if (XGetSelectionOwner(obt_display, wm_sn_atom) != screen_support_win) { g_message(_("Could not acquire window manager selection on screen %d"), ob_screen); return FALSE; @@ -131,7 +131,7 @@ static gboolean replace_wm(void) const gulong timeout = G_USEC_PER_SEC * 15; /* wait for 15s max */ while (wait < timeout) { - if (XCheckWindowEvent(ob_display, current_wm_sn_owner, + if (XCheckWindowEvent(obt_display, current_wm_sn_owner, StructureNotifyMask, &event) && event.type == DestroyNotify) break; @@ -146,7 +146,7 @@ static gboolean replace_wm(void) } /* Send client message indicating that we are now the WM */ - prop_message(RootWindow(ob_display, ob_screen), prop_atoms.manager, + prop_message(RootWindow(obt_display, ob_screen), prop_atoms.manager, timestamp, wm_sn_atom, screen_support_win, 0, SubstructureNotifyMask); @@ -164,30 +164,30 @@ gboolean screen_annex(void) /* create the netwm support window */ attrib.override_redirect = TRUE; attrib.event_mask = PropertyChangeMask; - screen_support_win = XCreateWindow(ob_display, - RootWindow(ob_display, ob_screen), + screen_support_win = XCreateWindow(obt_display, + RootWindow(obt_display, ob_screen), -100, -100, 1, 1, 0, CopyFromParent, InputOutput, CopyFromParent, CWEventMask | CWOverrideRedirect, &attrib); - XMapWindow(ob_display, screen_support_win); - XLowerWindow(ob_display, screen_support_win); + XMapWindow(obt_display, screen_support_win); + XLowerWindow(obt_display, screen_support_win); if (!replace_wm()) { - XDestroyWindow(ob_display, screen_support_win); + XDestroyWindow(obt_display, screen_support_win); return FALSE; } obt_display_ignore_errors(TRUE); - XSelectInput(ob_display, RootWindow(ob_display, ob_screen), + XSelectInput(obt_display, RootWindow(obt_display, ob_screen), ROOT_EVENTMASK); obt_display_ignore_errors(FALSE); if (obt_display_error_occured) { g_message(_("A window manager is already running on screen %d"), ob_screen); - XDestroyWindow(ob_display, screen_support_win); + XDestroyWindow(obt_display, screen_support_win); return FALSE; } @@ -195,11 +195,11 @@ gboolean screen_annex(void) /* set the OPENBOX_PID hint */ pid = getpid(); - PROP_SET32(RootWindow(ob_display, ob_screen), + PROP_SET32(RootWindow(obt_display, ob_screen), openbox_pid, cardinal, pid); /* set supporting window */ - PROP_SET32(RootWindow(ob_display, ob_screen), + PROP_SET32(RootWindow(obt_display, ob_screen), net_supporting_wm_check, window, screen_support_win); /* set properties on the supporting window */ @@ -300,7 +300,7 @@ gboolean screen_annex(void) supported[i++] = prop_atoms.ob_control; g_assert(i == num_support); - PROP_SETA32(RootWindow(ob_display, ob_screen), + PROP_SETA32(RootWindow(obt_display, ob_screen), net_supported, atom, supported, num_support); g_free(supported); @@ -333,13 +333,13 @@ static void screen_tell_ksplash(void) hear it anyways. perhaps it is for old ksplash. or new ksplash. or something. oh well. */ e.xclient.type = ClientMessage; - e.xclient.display = ob_display; - e.xclient.window = RootWindow(ob_display, ob_screen); + e.xclient.display = obt_display; + e.xclient.window = RootWindow(obt_display, ob_screen); e.xclient.message_type = - XInternAtom(ob_display, "_KDE_SPLASH_PROGRESS", False ); + XInternAtom(obt_display, "_KDE_SPLASH_PROGRESS", False ); e.xclient.format = 8; strcpy(e.xclient.data.b, "wm started"); - XSendEvent(ob_display, RootWindow(ob_display, ob_screen), + XSendEvent(obt_display, RootWindow(obt_display, ob_screen), False, SubstructureNotifyMask, &e ); } @@ -364,7 +364,7 @@ void screen_startup(gboolean reconfig) screen_resize(); /* have names already been set for the desktops? */ - if (PROP_GETSS(RootWindow(ob_display, ob_screen), + if (PROP_GETSS(RootWindow(obt_display, ob_screen), net_desktop_names, utf8, &names)) { g_strfreev(names); @@ -387,7 +387,8 @@ void screen_startup(gboolean reconfig) names[i] = g_strdup(it->data); /* set the root window property */ - PROP_SETSS(RootWindow(ob_display, ob_screen), net_desktop_names,names); + PROP_SETSS(RootWindow(obt_display, ob_screen), + net_desktop_names,names); g_strfreev(names); } @@ -397,7 +398,7 @@ void screen_startup(gboolean reconfig) this will also set the default names from the config file up for desktops that don't have names yet */ screen_num_desktops = 0; - if (PROP_GET32(RootWindow(ob_display, ob_screen), + if (PROP_GET32(RootWindow(obt_display, ob_screen), net_number_of_desktops, cardinal, &d)) screen_set_num_desktops(d); /* restore from session if possible */ @@ -408,7 +409,7 @@ void screen_startup(gboolean reconfig) screen_desktop = screen_num_desktops; /* something invalid */ /* start on the current desktop when a wm was already running */ - if (PROP_GET32(RootWindow(ob_display, ob_screen), + if (PROP_GET32(RootWindow(obt_display, ob_screen), net_current_desktop, cardinal, &d) && d < screen_num_desktops) { @@ -423,7 +424,7 @@ void screen_startup(gboolean reconfig) /* don't start in showing-desktop mode */ screen_showing_desktop = FALSE; - PROP_SET32(RootWindow(ob_display, ob_screen), + PROP_SET32(RootWindow(obt_display, ob_screen), net_showing_desktop, cardinal, screen_showing_desktop); if (session_desktop_layout_present && @@ -442,17 +443,17 @@ void screen_shutdown(gboolean reconfig) if (reconfig) return; - XSelectInput(ob_display, RootWindow(ob_display, ob_screen), + XSelectInput(obt_display, RootWindow(obt_display, ob_screen), NoEventMask); /* we're not running here no more! */ - PROP_ERASE(RootWindow(ob_display, ob_screen), openbox_pid); + PROP_ERASE(RootWindow(obt_display, ob_screen), openbox_pid); /* not without us */ - PROP_ERASE(RootWindow(ob_display, ob_screen), net_supported); + PROP_ERASE(RootWindow(obt_display, ob_screen), net_supported); /* don't keep this mode */ - PROP_ERASE(RootWindow(ob_display, ob_screen), net_showing_desktop); + PROP_ERASE(RootWindow(obt_display, ob_screen), net_showing_desktop); - XDestroyWindow(ob_display, screen_support_win); + XDestroyWindow(obt_display, screen_support_win); g_strfreev(screen_desktop_names); screen_desktop_names = NULL; @@ -465,8 +466,8 @@ void screen_resize(void) GList *it; gulong geometry[2]; - w = WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)); - h = HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen)); + w = WidthOfScreen(ScreenOfDisplay(obt_display, ob_screen)); + h = HeightOfScreen(ScreenOfDisplay(obt_display, ob_screen)); if (w == oldw && h == oldh) return; @@ -475,7 +476,7 @@ void screen_resize(void) /* Set the _NET_DESKTOP_GEOMETRY hint */ screen_physical_size.width = geometry[0] = w; screen_physical_size.height = geometry[1] = h; - PROP_SETA32(RootWindow(ob_display, ob_screen), + PROP_SETA32(RootWindow(obt_display, ob_screen), net_desktop_geometry, cardinal, geometry, 2); if (ob_state() == OB_STATE_STARTING) @@ -500,12 +501,12 @@ void screen_set_num_desktops(guint num) old = screen_num_desktops; screen_num_desktops = num; - PROP_SET32(RootWindow(ob_display, ob_screen), + PROP_SET32(RootWindow(obt_display, ob_screen), net_number_of_desktops, cardinal, num); /* set the viewport hint */ viewport = g_new0(gulong, num * 2); - PROP_SETA32(RootWindow(ob_display, ob_screen), + PROP_SETA32(RootWindow(obt_display, ob_screen), net_desktop_viewport, cardinal, viewport, num * 2); g_free(viewport); @@ -601,7 +602,7 @@ void screen_set_desktop(guint num, gboolean dofocus) if (previous == num) return; - PROP_SET32(RootWindow(ob_display, ob_screen), + PROP_SET32(RootWindow(obt_display, ob_screen), net_current_desktop, cardinal, num); /* This whole thing decides when/how to save the screen_last_desktop so @@ -1091,7 +1092,7 @@ void screen_update_layout(void) screen_desktop_layout.rows = 1; screen_desktop_layout.columns = screen_num_desktops; - if (PROP_GETA32(RootWindow(ob_display, ob_screen), + if (PROP_GETA32(RootWindow(obt_display, ob_screen), net_desktop_layout, cardinal, &data, &num)) { if (num == 3 || num == 4) { @@ -1136,7 +1137,7 @@ void screen_update_desktop_names(void) g_strfreev(screen_desktop_names); screen_desktop_names = NULL; - if (PROP_GETSS(RootWindow(ob_display, ob_screen), + if (PROP_GETSS(RootWindow(obt_display, ob_screen), net_desktop_names, utf8, &screen_desktop_names)) for (i = 0; screen_desktop_names[i] && i < screen_num_desktops; ++i); else @@ -1163,7 +1164,7 @@ void screen_update_desktop_names(void) /* if we changed any names, then set the root property so we can all agree on the names */ - PROP_SETSS(RootWindow(ob_display, ob_screen), net_desktop_names, + PROP_SETSS(RootWindow(obt_display, ob_screen), net_desktop_names, screen_desktop_names); } @@ -1231,7 +1232,7 @@ void screen_show_desktop(gboolean show, ObClient *show_only) } show = !!show; /* make it boolean */ - PROP_SET32(RootWindow(ob_display, ob_screen), + PROP_SET32(RootWindow(obt_display, ob_screen), net_showing_desktop, cardinal, show); } @@ -1239,15 +1240,15 @@ void screen_install_colormap(ObClient *client, gboolean install) { if (client == NULL || client->colormap == None) { if (install) - XInstallColormap(ob_display, RrColormap(ob_rr_inst)); + XInstallColormap(obt_display, RrColormap(ob_rr_inst)); else - XUninstallColormap(ob_display, RrColormap(ob_rr_inst)); + XUninstallColormap(obt_display, RrColormap(ob_rr_inst)); } else { obt_display_ignore_errors(TRUE); if (install) - XInstallColormap(ob_display, client->colormap); + XInstallColormap(obt_display, client->colormap); else - XUninstallColormap(ob_display, client->colormap); + XUninstallColormap(obt_display, client->colormap); obt_display_ignore_errors(FALSE); } } @@ -1297,8 +1298,8 @@ static void get_xinerama_screens(Rect **xin_areas, guint *nxin) if (ob_debug_xinerama) { g_print("Using fake xinerama !\n"); - gint w = WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)); - gint h = HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen)); + gint w = WidthOfScreen(ScreenOfDisplay(obt_display, ob_screen)); + gint h = HeightOfScreen(ScreenOfDisplay(obt_display, ob_screen)); *nxin = 2; *xin_areas = g_new(Rect, *nxin + 1); RECT_SET((*xin_areas)[0], 0, 0, w/2, h); @@ -1308,7 +1309,7 @@ static void get_xinerama_screens(Rect **xin_areas, guint *nxin) else if (obt_display_extension_xinerama) { guint i; gint n; - XineramaScreenInfo *info = XineramaQueryScreens(ob_display, &n); + XineramaScreenInfo *info = XineramaQueryScreens(obt_display, &n); *nxin = n; *xin_areas = g_new(Rect, *nxin + 1); for (i = 0; i < *nxin; ++i) @@ -1321,8 +1322,8 @@ static void get_xinerama_screens(Rect **xin_areas, guint *nxin) *nxin = 1; *xin_areas = g_new(Rect, *nxin + 1); RECT_SET((*xin_areas)[0], 0, 0, - WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)), - HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen))); + WidthOfScreen(ScreenOfDisplay(obt_display, ob_screen)), + HeightOfScreen(ScreenOfDisplay(obt_display, ob_screen))); } /* returns one extra with the total area in it */ @@ -1456,7 +1457,7 @@ void screen_update_areas(void) /* all the work areas are not used here, only the ones for the first monitor are */ - PROP_SETA32(RootWindow(ob_display, ob_screen), net_workarea, cardinal, + PROP_SETA32(RootWindow(obt_display, ob_screen), net_workarea, cardinal, dims, 4 * screen_num_desktops); /* the area has changed, adjust all the windows if they need it */ @@ -1698,10 +1699,10 @@ Rect* screen_physical_area_active(void) void screen_set_root_cursor(void) { if (sn_app_starting()) - XDefineCursor(ob_display, RootWindow(ob_display, ob_screen), + XDefineCursor(obt_display, RootWindow(obt_display, ob_screen), ob_cursor(OB_CURSOR_BUSYPOINTER)); else - XDefineCursor(ob_display, RootWindow(ob_display, ob_screen), + XDefineCursor(obt_display, RootWindow(obt_display, ob_screen), ob_cursor(OB_CURSOR_POINTER)); } @@ -1712,12 +1713,12 @@ gboolean screen_pointer_pos(gint *x, gint *y) guint u; gboolean ret; - ret = !!XQueryPointer(ob_display, RootWindow(ob_display, ob_screen), + ret = !!XQueryPointer(obt_display, RootWindow(obt_display, ob_screen), &w, &w, x, y, &i, &i, &u); if (!ret) { - for (i = 0; i < ScreenCount(ob_display); ++i) + for (i = 0; i < ScreenCount(obt_display); ++i) if (i != ob_screen) - if (XQueryPointer(ob_display, RootWindow(ob_display, i), + if (XQueryPointer(obt_display, RootWindow(obt_display, i), &w, &w, x, y, &i, &i, &u)) break; } |
