From 92a6b897a047054d8fabc8fdee9233a555accb11 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 15 Sep 2003 07:47:05 +0000 Subject: [PATCH] remove focusLast and focusLastOnDesktop --- data/rc.xml | 2 -- openbox/config.c | 8 -------- openbox/config.h | 4 ---- openbox/event.c | 36 +++++++++++++++++++++++++----------- openbox/focus.c | 5 +---- openbox/focus.h | 1 - openbox/screen.c | 13 ------------- 7 files changed, 26 insertions(+), 43 deletions(-) diff --git a/data/rc.xml b/data/rc.xml index 04412efb..fab32908 100644 --- a/data/rc.xml +++ b/data/rc.xml @@ -13,8 +13,6 @@ yes no - yes - yes 0 diff --git a/openbox/config.c b/openbox/config.c index c840f83e..4251390c 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -8,8 +8,6 @@ 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 @@ static void parse_focus(ObParseInst *i, xmlDocPtr doc, xmlNodePtr 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); diff --git a/openbox/config.h b/openbox/config.h index f33a90f6..6ba88afa 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -12,10 +12,6 @@ struct _ObParseInst; 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; diff --git a/openbox/event.c b/openbox/event.c index dbb4ec68..f6d6f3b6 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -36,6 +36,11 @@ #include #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 @@ static gboolean event_ignore(XEvent *e, ObClient *client) 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 @@ static gboolean event_ignore(XEvent *e, ObClient *client) } } - /* 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 @@ static void event_process(const XEvent *ec, gpointer data) ObDockApp *dockapp = NULL; ObWindow *obwin = NULL; XEvent ee, *e; + ObEventData *ed = data; /* make a copy we can mangle */ ee = *ec; @@ -461,8 +471,12 @@ static void event_process(const XEvent *ec, gpointer data) 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) diff --git a/openbox/focus.c b/openbox/focus.c index 0d9ecf54..a7904910 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -162,11 +162,8 @@ void focus_fallback(ObFocusFallbackType type) */ 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 */ diff --git a/openbox/focus.h b/openbox/focus.h index 0caec776..6a99cf6a 100644 --- a/openbox/focus.h +++ b/openbox/focus.h @@ -24,7 +24,6 @@ void focus_shutdown(gboolean reconfig); 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 */ diff --git a/openbox/screen.c b/openbox/screen.c index f999a34b..e5640256 100644 --- a/openbox/screen.c +++ b/openbox/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 @@ void screen_set_desktop(guint num) 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) -- 2.39.2