add option for under-mouse placement
Dana Jansens danakj@orodu.net
4 files changed,
29 insertions(+),
2 deletions(-)
M
openbox/config.c
→
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;@@ -205,6 +207,18 @@ if ((n = parse_find_node("focusDelay", node)))
config_focus_delay = parse_int(doc, n) * 1000; if ((n = parse_find_node("raiseOnFocus", 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,@@ -477,6 +491,10 @@ config_focus_delay = 0;
config_focus_raise = FALSE; parse_register(i, "focus", parse_focus, NULL); + + config_place_policy = OB_PLACE_POLICY_SMART; + + parse_register(i, "placement", parse_placement, NULL); config_theme = NULL;
M
openbox/config.h
→
openbox/config.h
@@ -21,6 +21,7 @@ #define __config_h
#include "misc.h" #include "stacking.h" +#include "place.h" #include <glib.h>@@ -35,6 +36,8 @@ extern guint config_focus_delay;
/*! If windows should automatically be raised when they are focused in 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 */
M
openbox/place.c
→
openbox/place.c
@@ -374,7 +374,7 @@ if (client->positioned)
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) ||
M
openbox/place.h
→
openbox/place.h
@@ -23,6 +23,12 @@ #include <glib.h>
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