X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fscreen.c;h=69082460814198ddc621d4b37fd37ba41b0cfc3e;hb=ec908528cf2abad9d2b968db9c8f7287ef5f54fe;hp=11d5ae13cb19d9ffaf872edf131a5693989d2609;hpb=2477a38d2f3063b697e44bf3690cf280fb26ca8a;p=chaz%2Fopenbox diff --git a/openbox/screen.c b/openbox/screen.c index 11d5ae13..69082460 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -30,53 +30,45 @@ SubstructureNotifyMask | SubstructureRedirectMask | \ ButtonPressMask | ButtonReleaseMask | ButtonMotionMask) -guint screen_num_desktops = 0; -guint screen_num_monitors = 0; -guint screen_desktop = 0; +guint screen_num_desktops; +guint screen_num_monitors; +guint screen_desktop; Size screen_physical_size; gboolean screen_showing_desktop; DesktopLayout screen_desktop_layout; -char **screen_desktop_names = NULL; +char **screen_desktop_names; +Window screen_support_win; -static Rect **area = NULL; /* array of desktop holding array of - xinerama areas */ -static Rect *monitor_area = NULL; -static Window support_window = None; +static Rect **area; /* array of desktop holding array of xinerama areas */ +static Rect *monitor_area; #ifdef USE_LIBSN static SnMonitorContext *sn_context; static int sn_busy_cnt; -static Timer *sn_timer = NULL; +static ObTimer *sn_timer; static void sn_event_func(SnMonitorEvent *event, void *data); #endif static void set_root_cursor(); -static gboolean running; -static int another_running(Display *d, XErrorEvent *e) -{ - (void)d;(void)e; - g_message("A window manager is already running on screen %d", - ob_screen); - running = TRUE; - return -1; -} - gboolean screen_annex() { - XErrorHandler old; + XSetWindowAttributes attrib; pid_t pid; - int i, num_support; + gint i, num_support; guint32 *supported; - running = FALSE; - old = XSetErrorHandler(another_running); + xerror_set_ignore(TRUE); + xerror_occured = FALSE; XSelectInput(ob_display, ob_root, ROOT_EVENTMASK); - XSync(ob_display, FALSE); - XSetErrorHandler(old); - if (running) + xerror_set_ignore(FALSE); + if (xerror_occured) { + g_message("A window manager is already running on screen %d", + ob_screen); return FALSE; + } + g_message("Managing screen %d", ob_screen); @@ -87,14 +79,21 @@ gboolean screen_annex() PROP_SET32(ob_root, openbox_pid, cardinal, pid); /* create the netwm support window */ - support_window = XCreateSimpleWindow(ob_display, ob_root, 0,0,1,1,0,0,0); + attrib.override_redirect = TRUE; + screen_support_win = XCreateWindow(ob_display, ob_root, + -100, -100, 1, 1, 0, + CopyFromParent, InputOutput, + CopyFromParent, + CWOverrideRedirect, &attrib); + XMapRaised(ob_display, screen_support_win); /* set supporting window */ - PROP_SET32(ob_root, net_supporting_wm_check, window, support_window); + PROP_SET32(ob_root, net_supporting_wm_check, window, screen_support_win); /* set properties on the supporting window */ - PROP_SETS(support_window, net_wm_name, "Openbox"); - PROP_SET32(support_window, net_supporting_wm_check, window,support_window); + PROP_SETS(screen_support_win, net_wm_name, "Openbox"); + PROP_SET32(screen_support_win, net_supporting_wm_check, + window, screen_support_win); /* set the _NET_SUPPORTED_ATOMS hint */ num_support = 61; @@ -220,7 +219,7 @@ void screen_shutdown() PROP_ERASE(ob_root, net_supported); /* not without us */ PROP_ERASE(ob_root, net_showing_desktop); /* don't keep this mode */ - XDestroyWindow(ob_display, support_window); + XDestroyWindow(ob_display, screen_support_win); g_strfreev(screen_desktop_names); for (r = area; *r; ++r) @@ -346,9 +345,13 @@ void screen_set_desktop(guint num) /* focus the last focused window on the desktop, and ignore enter events from the switch so it doesnt mess with the focus */ while (XCheckTypedEvent(ob_display, EnterNotify, &e)); +#ifdef DEBUG_FOCUS g_message("switch fallback"); - focus_fallback(Fallback_Desktop); +#endif + focus_fallback(OB_FOCUS_FALLBACK_DESKTOP); +#ifdef DEBUG_FOCUS g_message("/switch fallback"); +#endif dispatch_ob(Event_Ob_Desktop, num, old); } @@ -485,11 +488,11 @@ void screen_show_desktop(gboolean show) if (show) { /* focus desktop */ for (it = focus_order[screen_desktop]; it; it = it->next) - if (((ObClient*)it->data)->type == Type_Desktop && + if (((ObClient*)it->data)->type == OB_CLIENT_TYPE_DESKTOP && client_focus(it->data)) break; } else { - focus_fallback(Fallback_NoFocus); + focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS); } show = !!show; /* make it boolean */