From 8e63ffdabdc3be3ad355dcaddd47d8e71c510739 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 28 Sep 2003 09:01:04 +0000 Subject: [PATCH] add option for under-mouse placement --- openbox/config.c | 18 ++++++++++++++++++ openbox/config.h | 3 +++ openbox/place.c | 2 +- openbox/place.h | 8 +++++++- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/openbox/config.c b/openbox/config.c index aebf433f..2c787e4b 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -29,6 +29,8 @@ gboolean config_focus_follow; guint config_focus_delay; guint config_focus_raise; +ObPlacePolicy config_place_policy; + char *config_theme; gchar *config_title_layout; @@ -207,6 +209,18 @@ static void parse_focus(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, config_focus_raise = parse_bool(doc, n); } +static void parse_placement(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, + void *d) +{ + xmlNodePtr n; + + node = node->children; + + if ((n = parse_find_node("policy", node))) + if (parse_contains("UnderMouse", doc, n)) + config_place_policy = OB_PLACE_POLICY_MOUSE; +} + static void parse_theme(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, void *d) { @@ -478,6 +492,10 @@ void config_startup(ObParseInst *i) parse_register(i, "focus", parse_focus, NULL); + config_place_policy = OB_PLACE_POLICY_SMART; + + parse_register(i, "placement", parse_placement, NULL); + config_theme = NULL; config_title_layout = g_strdup("NLIMC"); diff --git a/openbox/config.h b/openbox/config.h index 465bff45..a2cfce3b 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -21,6 +21,7 @@ #include "misc.h" #include "stacking.h" +#include "place.h" #include @@ -36,6 +37,8 @@ extern guint config_focus_delay; focus follows mouse */ extern guint config_focus_raise; +extern ObPlacePolicy config_place_policy; + /*! When true windows' contents are refreshed while they are resized; otherwise they are not updated until the resize is complete */ extern gboolean config_redraw_resize; diff --git a/openbox/place.c b/openbox/place.c index 044743bc..19fa597a 100644 --- a/openbox/place.c +++ b/openbox/place.c @@ -374,7 +374,7 @@ void place_client(ObClient *client, gint *x, gint *y) return; if (place_transient(client, x, y) || place_dialog(client, x, y) || - ((config_focus_follow && config_focus_new) ? + ((config_place_policy == OB_PLACE_POLICY_MOUSE) ? place_under_mouse(client, x, y) : place_smart(client, x, y, SMART_FULL) || place_smart(client, x, y, SMART_GROUP) || diff --git a/openbox/place.h b/openbox/place.h index 02372320..1d35888c 100644 --- a/openbox/place.h +++ b/openbox/place.h @@ -23,6 +23,12 @@ struct _ObClient; -void place_client(ObClient *client, gint *x, gint *y); +typedef enum +{ + OB_PLACE_POLICY_SMART, + OB_PLACE_POLICY_MOUSE +} ObPlacePolicy; + +void place_client(struct _ObClient *client, gint *x, gint *y); #endif -- 2.45.2