<focus>
<focusNew>yes</focusNew>
<followMouse>no</followMouse>
- <focusLast>yes</focusLast>
- <focusLastOnDesktop>yes</focusLastOnDesktop>
<focusDelay>0</focusDelay>
</focus>
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;
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;
}
{
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);
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;
#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);
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.
}
}
- /* 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;
+ }
}
}
}
ObDockApp *dockapp = NULL;
ObWindow *obwin = NULL;
XEvent ee, *e;
+ ObEventData *ed = data;
/* make a copy we can mangle */
ee = *ec;
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)
*/
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 */
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 */
{
GList *it;
guint old;
- XEvent e;
g_assert(num < screen_num_desktops);
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)