From: Dana Jansens Date: Thu, 10 Jul 2003 18:44:27 +0000 (+0000) Subject: replace the focus_backup with the screen_support_win, we dont need 2 offscreen windows. X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=d1d84711a2684c47c688cc7d015741bd484151fb;p=chaz%2Fopenbox replace the focus_backup with the screen_support_win, we dont need 2 offscreen windows. --- diff --git a/openbox/focus.c b/openbox/focus.c index f330e527..3927272c 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -21,29 +21,14 @@ ObClient *focus_client = NULL; GList **focus_order = NULL; /* these lists are created when screen_startup sets the number of desktops */ -Window focus_backup = None; - static ObClient *focus_cycle_target = NULL; static Popup *focus_cycle_popup = NULL; void focus_startup() { - /* create the window which gets focus when no clients get it. Have to - make it override-redirect so we don't try manage it, since it is - mapped. */ - XSetWindowAttributes attrib; focus_client = NULL; - attrib.override_redirect = TRUE; - focus_backup = XCreateWindow(ob_display, ob_root, - -100, -100, 1, 1, 0, - CopyFromParent, InputOutput, CopyFromParent, - CWOverrideRedirect, &attrib); - XMapRaised(ob_display, focus_backup); - - /* do this *after* focus_backup is created, since it is used for - stacking */ focus_cycle_popup = popup_new(TRUE); /* start with nothing focused */ @@ -62,8 +47,6 @@ void focus_shutdown() popup_free(focus_cycle_popup); focus_cycle_popup = NULL; - XDestroyWindow(ob_display, focus_backup); - /* reset focus to root */ XSetInputFocus(ob_display, PointerRoot, RevertToPointerRoot, event_lasttime); @@ -94,7 +77,7 @@ void focus_set_client(ObClient *client) if (client == NULL) { /* when nothing will be focused, send focus to the backup target */ - XSetInputFocus(ob_display, focus_backup, RevertToPointerRoot, + XSetInputFocus(ob_display, screen_support_win, RevertToPointerRoot, event_lasttime); XSync(ob_display, FALSE); } diff --git a/openbox/focus.h b/openbox/focus.h index a7f70a0e..8c5b1ad8 100644 --- a/openbox/focus.h +++ b/openbox/focus.h @@ -6,9 +6,6 @@ struct _ObClient; -/*! The window which gets focus when nothing else will be focused */ -extern Window focus_backup; - /*! The client which is currently focused */ extern struct _ObClient *focus_client; diff --git a/openbox/screen.c b/openbox/screen.c index 90c874ac..69082460 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -30,23 +30,22 @@ 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 ObTimer *sn_timer = NULL; +static ObTimer *sn_timer; static void sn_event_func(SnMonitorEvent *event, void *data); #endif @@ -55,8 +54,9 @@ static void set_root_cursor(); gboolean screen_annex() { + XSetWindowAttributes attrib; pid_t pid; - int i, num_support; + gint i, num_support; guint32 *supported; xerror_set_ignore(TRUE); @@ -79,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; @@ -212,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) diff --git a/openbox/screen.h b/openbox/screen.h index 4df32be1..7008854a 100644 --- a/openbox/screen.h +++ b/openbox/screen.h @@ -16,6 +16,8 @@ extern guint screen_num_monitors; extern guint screen_desktop; /*! Are we in showing-desktop mode? */ extern gboolean screen_showing_desktop; +/*! The support window also used for focus and stacking */ +extern Window screen_support_win; typedef struct DesktopLayout { ObOrientation orientation; diff --git a/openbox/stacking.c b/openbox/stacking.c index 3a556fc4..c9dcb0b7 100644 --- a/openbox/stacking.c +++ b/openbox/stacking.c @@ -1,5 +1,6 @@ #include "openbox.h" #include "prop.h" +#include "screen.h" #include "focus.h" #include "client.h" #include "group.h" @@ -53,7 +54,7 @@ static void do_restack(GList *wins, GList *before) win = g_new(Window, g_list_length(wins) + 1); if (before == stacking_list) - win[0] = focus_backup; + win[0] = screen_support_win; else if (!before) win[0] = window_top(g_list_last(stacking_list)->data); else @@ -267,7 +268,7 @@ void stacking_add(ObWindow *win) ObStackingLayer l; GList *wins; - g_assert(focus_backup != None); /* make sure I dont break this in the + g_assert(screen_support_win != None); /* make sure I dont break this in the future */ l = window_layer(win); diff --git a/plugins/keyboard/keyboard.c b/plugins/keyboard/keyboard.c index 0fc43e83..caee0dc1 100644 --- a/plugins/keyboard/keyboard.c +++ b/plugins/keyboard/keyboard.c @@ -1,4 +1,5 @@ #include "kernel/focus.h" +#include "kernel/screen.h" #include "kernel/frame.h" #include "kernel/dispatch.h" #include "kernel/openbox.h" @@ -103,7 +104,7 @@ static void grab_keys(gboolean grab) { GList *it; - grab_for_window(focus_backup, grab); + grab_for_window(screen_support_win, grab); for (it = client_list; it; it = g_list_next(it)) grab_for_window(((ObClient*)it->data)->frame->window, grab); }