remove focusLast and focusLastOnDesktop

This commit is contained in:
Dana Jansens 2003-09-15 07:47:05 +00:00
parent e14a4eeee9
commit 92a6b897a0
7 changed files with 26 additions and 43 deletions

View file

@ -13,8 +13,6 @@
<focus> <focus>
<focusNew>yes</focusNew> <focusNew>yes</focusNew>
<followMouse>no</followMouse> <followMouse>no</followMouse>
<focusLast>yes</focusLast>
<focusLastOnDesktop>yes</focusLastOnDesktop>
<focusDelay>0</focusDelay> <focusDelay>0</focusDelay>
</focus> </focus>

View file

@ -8,8 +8,6 @@
gboolean config_focus_new; gboolean config_focus_new;
gboolean config_focus_follow; gboolean config_focus_follow;
gboolean config_focus_last;
gboolean config_focus_last_on_desktop;
guint config_focus_delay; guint config_focus_delay;
char *config_theme; char *config_theme;
@ -175,10 +173,6 @@ static void parse_focus(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
config_focus_new = parse_bool(doc, n); config_focus_new = parse_bool(doc, n);
if ((n = parse_find_node("followMouse", node))) if ((n = parse_find_node("followMouse", node)))
config_focus_follow = parse_bool(doc, n); 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))) if ((n = parse_find_node("focusDelay", node)))
config_focus_delay = parse_int(doc, n) * 1000; config_focus_delay = parse_int(doc, n) * 1000;
} }
@ -332,8 +326,6 @@ void config_startup(ObParseInst *i)
{ {
config_focus_new = TRUE; config_focus_new = TRUE;
config_focus_follow = FALSE; config_focus_follow = FALSE;
config_focus_last = TRUE;
config_focus_last_on_desktop = TRUE;
config_focus_delay = 0; config_focus_delay = 0;
parse_register(i, "focus", parse_focus, NULL); parse_register(i, "focus", parse_focus, NULL);

View file

@ -12,10 +12,6 @@ struct _ObParseInst;
extern gboolean config_focus_new; extern gboolean config_focus_new;
/*! Focus windows when the mouse enters them */ /*! Focus windows when the mouse enters them */
extern gboolean config_focus_follow; 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 */ /*! Timeout for focusing windows on focus follows mouse, in microseconds */
extern guint config_focus_delay; extern guint config_focus_delay;

View file

@ -36,6 +36,11 @@
#include <X11/ICE/ICElib.h> #include <X11/ICE/ICElib.h>
#endif #endif
typedef struct
{
gboolean ignored;
} ObEventData;
static void event_process(const XEvent *e, gpointer data); static void event_process(const XEvent *e, gpointer data);
static void event_handle_root(XEvent *e); static void event_handle_root(XEvent *e);
static void event_handle_menu(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) || if (INVALID_FOCUSIN(e) ||
client == NULL) { client == NULL) {
#ifdef DEBUG_FOCUS #ifdef DEBUG_FOCUS
ob_debug("FocusIn on %lx mode %d detail %d IGNORED\n", ob_debug("FocusIn on %lx mode %d detail %d IGNORED\n",
e->xfocus.window, e->xfocus.mode, e->xfocus.detail); e->xfocus.window, e->xfocus.mode, e->xfocus.detail);
#endif #endif
/* says a client was not found for the event (or a valid FocusIn /* says a client was not found for the event (or a valid FocusIn
event was not found. 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 */ ObEventData d;
event_process(&fe, NULL);
/* secret magic way of event_process telling us that no /* once all the FocusOut's have been dealt with, if
client was found for the FocusIn event. ^_^ */ there is a FocusIn still left and it is valid, then
if (fe.xfocus.window != None) { use it */
fallback = FALSE; event_process(&fe, &d);
break; 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; ObDockApp *dockapp = NULL;
ObWindow *obwin = NULL; ObWindow *obwin = NULL;
XEvent ee, *e; XEvent ee, *e;
ObEventData *ed = data;
/* make a copy we can mangle */ /* make a copy we can mangle */
ee = *ec; ee = *ec;
@ -461,8 +471,12 @@ static void event_process(const XEvent *ec, gpointer data)
event_set_lasttime(e); event_set_lasttime(e);
event_hack_mods(e); event_hack_mods(e);
if (event_ignore(e, client)) if (event_ignore(e, client)) {
if (ed)
ed->ignored = TRUE;
return; return;
} else if (ed)
ed->ignored = FALSE;
/* deal with it in the kernel */ /* deal with it in the kernel */
if (group) if (group)

View file

@ -162,11 +162,8 @@ void focus_fallback(ObFocusFallbackType type)
*/ */
focus_set_client(NULL); focus_set_client(NULL);
if (!(type == OB_FOCUS_FALLBACK_DESKTOP ? if (config_focus_follow && focus_under_pointer())
config_focus_last_on_desktop : config_focus_last)) {
if (config_focus_follow) focus_under_pointer();
return; return;
}
if (type == OB_FOCUS_FALLBACK_UNFOCUSING && old) { if (type == OB_FOCUS_FALLBACK_UNFOCUSING && old) {
/* try for transient relations */ /* try for transient relations */

View file

@ -24,7 +24,6 @@ void focus_shutdown(gboolean reconfig);
void focus_set_client(struct _ObClient *client); void focus_set_client(struct _ObClient *client);
typedef enum { typedef enum {
OB_FOCUS_FALLBACK_DESKTOP, /*!< switching desktops */
OB_FOCUS_FALLBACK_UNFOCUSING, /*!< forcefully remove focus from the OB_FOCUS_FALLBACK_UNFOCUSING, /*!< forcefully remove focus from the
current window */ current window */
OB_FOCUS_FALLBACK_NOFOCUS /*!< nothing has focus for some reason */ OB_FOCUS_FALLBACK_NOFOCUS /*!< nothing has focus for some reason */

View file

@ -398,7 +398,6 @@ void screen_set_desktop(guint num)
{ {
GList *it; GList *it;
guint old; guint old;
XEvent e;
g_assert(num < screen_num_desktops); g_assert(num < screen_num_desktops);
@ -435,18 +434,6 @@ void screen_set_desktop(guint num)
frame_hide(c->frame); 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) static void get_row_col(guint d, guint *r, guint *c)