diff --git a/data/rc.xml.in b/data/rc.xml.in
index dd7c68d8..a1f27627 100644
--- a/data/rc.xml.in
+++ b/data/rc.xml.in
@@ -16,6 +16,7 @@
yes
no
+ no
0
no
@@ -31,6 +32,7 @@
4
+ 1
one
two
diff --git a/data/rc.xsd b/data/rc.xsd
index d5c3be95..f36b39f7 100644
--- a/data/rc.xsd
+++ b/data/rc.xsd
@@ -71,6 +71,7 @@
+
@@ -100,6 +101,7 @@
+
diff --git a/openbox/config.c b/openbox/config.c
index d362324c..293174df 100644
--- a/openbox/config.c
+++ b/openbox/config.c
@@ -28,6 +28,7 @@ gboolean config_focus_new;
gboolean config_focus_follow;
guint config_focus_delay;
gboolean config_focus_raise;
+gboolean config_focus_last;
ObPlacePolicy config_place_policy;
@@ -205,6 +206,8 @@ static void parse_focus(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
config_focus_delay = parse_int(doc, n) * 1000;
if ((n = parse_find_node("raiseOnFocus", node)))
config_focus_raise = parse_bool(doc, n);
+ if ((n = parse_find_node("focusLast", node)))
+ config_focus_last = parse_bool(doc, n);
}
static void parse_placement(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
@@ -494,6 +497,7 @@ void config_startup(ObParseInst *i)
config_focus_follow = FALSE;
config_focus_delay = 0;
config_focus_raise = FALSE;
+ config_focus_last = FALSE;
parse_register(i, "focus", parse_focus, NULL);
diff --git a/openbox/config.h b/openbox/config.h
index 4d3f3e5e..63ea5a6d 100644
--- a/openbox/config.h
+++ b/openbox/config.h
@@ -36,6 +36,8 @@ extern guint config_focus_delay;
/*! If windows should automatically be raised when they are focused in
focus follows mouse */
extern gboolean config_focus_raise;
+/*! Focus the last focused window, not under the mouse, in follow mouse mode */
+extern gboolean config_focus_last;
extern ObPlacePolicy config_place_policy;
diff --git a/openbox/focus.c b/openbox/focus.c
index ba6b7b67..c990cf84 100644
--- a/openbox/focus.c
+++ b/openbox/focus.c
@@ -61,10 +61,10 @@ static void focus_cycle_destructor(ObClient *client, gpointer data)
}
static Window createWindow(Window parent, gulong mask,
- XSetWindowAttributes *attrib)
+ XSetWindowAttributes *attrib)
{
return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0,
- RrDepth(ob_rr_inst), InputOutput,
+ RrDepth(ob_rr_inst), InputOutput,
RrVisual(ob_rr_inst), mask, attrib);
}
@@ -252,7 +252,7 @@ ObClient* focus_fallback_target(ObFocusFallbackType type)
if (old->transient_for) {
gboolean trans = FALSE;
- if (!config_focus_follow)
+ if (!config_focus_follow || config_focus_last)
trans = TRUE;
else {
if ((target = client_under_pointer()) &&
@@ -289,7 +289,7 @@ ObClient* focus_fallback_target(ObFocusFallbackType type)
}
}
- if (config_focus_follow) {
+ if (config_focus_follow && !config_focus_last) {
if ((target = client_under_pointer()))
if (client_normal(target) && client_can_focus(target))
return target;