all repos — openbox @ 92a6b897a047054d8fabc8fdee9233a555accb11

openbox fork - make it a bit more like ryudo

remove focusLast and focusLastOnDesktop
Dana Jansens danakj@orodu.net
commit

92a6b897a047054d8fabc8fdee9233a555accb11

parent

e14a4eeee90819b504f38bc52c99b598a15cebe4

M data/rc.xmldata/rc.xml

@@ -13,8 +13,6 @@

<focus> <focusNew>yes</focusNew> <followMouse>no</followMouse> - <focusLast>yes</focusLast> - <focusLastOnDesktop>yes</focusLastOnDesktop> <focusDelay>0</focusDelay> </focus>
M openbox/config.copenbox/config.c

@@ -8,8 +8,6 @@ #include "openbox.h"

gboolean config_focus_new; gboolean config_focus_follow; -gboolean config_focus_last; -gboolean config_focus_last_on_desktop; guint config_focus_delay; char *config_theme;

@@ -175,10 +173,6 @@ if ((n = parse_find_node("focusNew", node)))

config_focus_new = parse_bool(doc, n); if ((n = parse_find_node("followMouse", node))) config_focus_follow = parse_bool(doc, n); - if ((n = parse_find_node("focusLast", node))) - config_focus_last = parse_bool(doc, n); - if ((n = parse_find_node("focusLastOnDesktop", node))) - config_focus_last_on_desktop = parse_bool(doc, n); if ((n = parse_find_node("focusDelay", node))) config_focus_delay = parse_int(doc, n) * 1000; }

@@ -332,8 +326,6 @@ void config_startup(ObParseInst *i)

{ config_focus_new = TRUE; config_focus_follow = FALSE; - config_focus_last = TRUE; - config_focus_last_on_desktop = TRUE; config_focus_delay = 0; parse_register(i, "focus", parse_focus, NULL);
M openbox/config.hopenbox/config.h

@@ -12,10 +12,6 @@ /*! Should new windows be focused */

extern gboolean config_focus_new; /*! Focus windows when the mouse enters them */ extern gboolean config_focus_follow; -/*! Focus the last focused window as a fallback */ -extern gboolean config_focus_last; -/*! Focus the last focused window as a fallback when switching desktops */ -extern gboolean config_focus_last_on_desktop; /*! Timeout for focusing windows on focus follows mouse, in microseconds */ extern guint config_focus_delay;
M openbox/event.copenbox/event.c

@@ -36,6 +36,11 @@ #ifdef USE_SM

#include <X11/ICE/ICElib.h> #endif +typedef struct +{ + gboolean ignored; +} ObEventData; + static void event_process(const XEvent *e, gpointer data); static void event_handle_root(XEvent *e); static void event_handle_menu(XEvent *e);

@@ -289,8 +294,8 @@ */

if (INVALID_FOCUSIN(e) || client == NULL) { #ifdef DEBUG_FOCUS - ob_debug("FocusIn on %lx mode %d detail %d IGNORED\n", - e->xfocus.window, e->xfocus.mode, e->xfocus.detail); + ob_debug("FocusIn on %lx mode %d detail %d IGNORED\n", + e->xfocus.window, e->xfocus.mode, e->xfocus.detail); #endif /* says a client was not found for the event (or a valid FocusIn event was not found.

@@ -372,14 +377,18 @@ return TRUE;

} } - /* once all the FocusOut's have been dealt with, if there - is a FocusIn still left and it is valid, then use it */ - event_process(&fe, NULL); - /* secret magic way of event_process telling us that no - client was found for the FocusIn event. ^_^ */ - if (fe.xfocus.window != None) { - fallback = FALSE; - break; + { + ObEventData d; + + /* once all the FocusOut's have been dealt with, if + there is a FocusIn still left and it is valid, then + use it */ + event_process(&fe, &d); + if (!d.ignored) { + ob_debug("FocusIn was OK, so don't fallback\n"); + fallback = FALSE; + break; + } } } }

@@ -432,6 +441,7 @@ ObDock *dock = NULL;

ObDockApp *dockapp = NULL; ObWindow *obwin = NULL; XEvent ee, *e; + ObEventData *ed = data; /* make a copy we can mangle */ ee = *ec;

@@ -461,8 +471,12 @@ }

event_set_lasttime(e); event_hack_mods(e); - if (event_ignore(e, client)) + if (event_ignore(e, client)) { + if (ed) + ed->ignored = TRUE; return; + } else if (ed) + ed->ignored = FALSE; /* deal with it in the kernel */ if (group)
M openbox/focus.copenbox/focus.c

@@ -162,11 +162,8 @@ at all for them.

*/ focus_set_client(NULL); - if (!(type == OB_FOCUS_FALLBACK_DESKTOP ? - config_focus_last_on_desktop : config_focus_last)) { - if (config_focus_follow) focus_under_pointer(); + if (config_focus_follow && focus_under_pointer()) return; - } if (type == OB_FOCUS_FALLBACK_UNFOCUSING && old) { /* try for transient relations */
M openbox/focus.hopenbox/focus.h

@@ -24,7 +24,6 @@ send focus anywhere, its called by the Focus event handlers */

void focus_set_client(struct _ObClient *client); typedef enum { - OB_FOCUS_FALLBACK_DESKTOP, /*!< switching desktops */ OB_FOCUS_FALLBACK_UNFOCUSING, /*!< forcefully remove focus from the current window */ OB_FOCUS_FALLBACK_NOFOCUS /*!< nothing has focus for some reason */
M openbox/screen.copenbox/screen.c

@@ -398,7 +398,6 @@ void screen_set_desktop(guint num)

{ GList *it; guint old; - XEvent e; g_assert(num < screen_num_desktops);

@@ -435,18 +434,6 @@ if (c->frame->visible && !client_should_show(c))

frame_hide(c->frame); } } - - XSync(ob_display, FALSE); - /* 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 - ob_debug("switch fallback\n"); -#endif - focus_fallback(OB_FOCUS_FALLBACK_DESKTOP); -#ifdef DEBUG_FOCUS - ob_debug("/switch fallback\n"); -#endif } static void get_row_col(guint d, guint *r, guint *c)