[openbox] PATCH - sloppy focus
Mikael Magnusson
mangosoft at comhem.se
Sun Nov 16 05:51:40 EST 2003
is this what you meant?
Index: openbox/config.c
===================================================================
RCS file: /cvs/cvsroot/openbox/openbox/config.c,v
retrieving revision 1.69
diff -p -u -d -r1.69 config.c
--- openbox/config.c 2003/10/25 19:39:19 1.69
+++ openbox/config.c 2003/11/16 10:50:49
@@ -28,6 +28,7 @@ gboolean config_focus_new;
gboolean config_focus_follow;
guint config_focus_delay;
guint config_focus_raise;
+gboolean config_focus_first;
ObPlacePolicy config_place_policy;
@@ -204,6 +205,8 @@ static void parse_focus(ObParseInst *i,
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("focusFirst", node)))
+ config_focus_first = parse_bool(doc, n);
}
static void parse_placement(ObParseInst *i, xmlDocPtr doc, xmlNodePtr
node,
@@ -488,6 +491,7 @@ void config_startup(ObParseInst *i)
config_focus_follow = FALSE;
config_focus_delay = 0;
config_focus_raise = FALSE;
+ config_focus_first = FALSE;
parse_register(i, "focus", parse_focus, NULL);
Index: openbox/event.c
===================================================================
RCS file: /cvs/cvsroot/openbox/openbox/event.c,v
retrieving revision 1.225
diff -p -u -d -r1.225 event.c
--- openbox/event.c 2003/10/15 17:04:27 1.225
+++ openbox/event.c 2003/11/16 10:50:49
@@ -552,6 +552,9 @@ void event_enter_client(ObClient *client
if (client_normal(client) && client_can_focus(client)) {
if (config_focus_delay) {
+ if (config_focus_raise && config_focus_first &&
+ focus_client != client)
+ client_focus(client);
ob_main_loop_timeout_remove(ob_main_loop, focus_delay_func);
ob_main_loop_timeout_add(ob_main_loop,
config_focus_delay,
@@ -1205,10 +1208,14 @@ static gboolean focus_delay_func(gpointe
{
ObClient *c = data;
- if (focus_client != c) {
- client_focus(c);
- if (config_focus_raise)
- client_raise(c);
+ if (config_focus_first)
+ client_raise(c);
+ else {
+ if (focus_client != c) {
+ client_focus(c);
+ if (config_focus_raise)
+ client_raise(c);
+ }
}
return FALSE; /* no repeat */
}
--
Mikael Magnusson
More information about the openbox
mailing list