all repos — openbox @ d1d84711a2684c47c688cc7d015741bd484151fb

openbox fork - make it a bit more like ryudo

replace the focus_backup with the screen_support_win, we dont need 2 offscreen windows.
Dana Jansens danakj@orodu.net
commit

d1d84711a2684c47c688cc7d015741bd484151fb

parent

120623d34e0cb86b4970e9744a10ba39cd5e21b7

M openbox/focus.copenbox/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 */

@@ -61,8 +46,6 @@ focus_order = NULL;

popup_free(focus_cycle_popup); focus_cycle_popup = NULL; - - XDestroyWindow(ob_display, focus_backup); /* reset focus to root */ XSetInputFocus(ob_display, PointerRoot, RevertToPointerRoot,

@@ -94,7 +77,7 @@ screen_install_colormap(client, TRUE);

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); }
M openbox/focus.hopenbox/focus.h

@@ -6,9 +6,6 @@ #include <glib.h>

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;
M openbox/screen.copenbox/screen.c

@@ -30,23 +30,22 @@ EnterWindowMask | LeaveWindowMask | \

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 @@ pid = getpid();

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 @@ 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 */ - XDestroyWindow(ob_display, support_window); + XDestroyWindow(ob_display, screen_support_win); g_strfreev(screen_desktop_names); for (r = area; *r; ++r)
M openbox/screen.hopenbox/screen.h

@@ -16,6 +16,8 @@ /*! The current desktop */

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;
M openbox/stacking.copenbox/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 @@

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 @@ {

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);
M plugins/keyboard/keyboard.cplugins/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); }