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>
<focusNew>yes</focusNew>
<followMouse>no</followMouse>
<focusLast>yes</focusLast>
<focusLastOnDesktop>yes</focusLastOnDesktop>
<focusDelay>0</focusDelay>
</focus>

View file

@ -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);

View file

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

View file

@ -36,6 +36,11 @@
#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);
@ -372,17 +377,21 @@ 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) {
{
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;
}
}
}
}
if (fallback) {
#ifdef DEBUG_FOCUS
ob_debug("no valid FocusIn and no FocusOut events found, "
@ -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)

View file

@ -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 */

View file

@ -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 */

View file

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