summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2008-01-27 11:31:23 -0500
committerDana Jansens <danakj@orodu.net>2008-01-27 11:31:23 -0500
commitdd740b5562806a6b4692c938ad0e903ad89b6193 (patch)
tree5887b7b312cadbfac3dd02676ffa54cc04a02482 /openbox
parentd409936faae594df7854b5b42ff707315ca33086 (diff)
replace the <active> placement option with <placeOn>active/mouse/any</placeOn>
Diffstat (limited to 'openbox')
-rw-r--r--openbox/config.c16
-rw-r--r--openbox/config.h2
-rw-r--r--openbox/place.c14
-rw-r--r--openbox/place.h7
4 files changed, 27 insertions, 12 deletions
diff --git a/openbox/config.c b/openbox/config.c
index 50f6aef6..5e6387bc 100644
--- a/openbox/config.c
+++ b/openbox/config.c
@@ -36,9 +36,9 @@ gboolean config_focus_raise;
gboolean config_focus_last;
gboolean config_focus_under_mouse;
-ObPlacePolicy config_place_policy;
-gboolean config_place_center;
-gboolean config_place_active;
+ObPlacePolicy config_place_policy;
+gboolean config_place_center;
+ObPlaceMonitor config_place_monitor;
StrutPartial config_margins;
@@ -491,8 +491,12 @@ static void parse_placement(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
config_place_policy = OB_PLACE_POLICY_MOUSE;
if ((n = parse_find_node("center", node)))
config_place_center = parse_bool(doc, n);
- if ((n = parse_find_node("active", node)))
- config_place_active = parse_bool(doc, n);
+ if ((n = parse_find_node("placeOn", node))) {
+ if (parse_contains("active", doc, n))
+ config_place_monitor = OB_PLACE_MONITOR_ACTIVE;
+ else if (parse_contains("mouse", doc, n))
+ config_place_monitor = OB_PLACE_MONITOR_MOUSE;
+ }
}
static void parse_margins(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
@@ -886,7 +890,7 @@ void config_startup(ObParseInst *i)
config_place_policy = OB_PLACE_POLICY_SMART;
config_place_center = TRUE;
- config_place_active = FALSE;
+ config_place_monitor = OB_PLACE_MONITOR_ANY;
parse_register(i, "placement", parse_placement, NULL);
diff --git a/openbox/config.h b/openbox/config.h
index 50e7dfe3..75275a8b 100644
--- a/openbox/config.h
+++ b/openbox/config.h
@@ -78,7 +78,7 @@ extern ObPlacePolicy config_place_policy;
extern gboolean config_place_center;
/*! Place windows on the active monitor (unless they are part of an application
already on another monitor) */
-extern gboolean config_place_active;
+extern ObPlaceMonitor config_place_monitor;
/*! User-specified margins around the edge of the screen(s) */
extern StrutPartial config_margins;
diff --git a/openbox/place.c b/openbox/place.c
index 058bbfbe..81fb9752 100644
--- a/openbox/place.c
+++ b/openbox/place.c
@@ -108,7 +108,10 @@ static Rect **pick_head(ObClient *c)
}
}
- if (focus_client && client_normal(focus_client)) {
+ /* skip this if placing by the mouse position */
+ if (focus_client && client_normal(focus_client) &&
+ config_place_monitor != OB_PLACE_MONITOR_MOUSE)
+ {
add_choice(choice, client_monitor(focus_client));
ob_debug("placement adding choice %d for normal focused window\n",
client_monitor(focus_client));
@@ -146,7 +149,8 @@ static gboolean place_random(ObClient *client, gint *x, gint *y)
guint i;
areas = pick_head(client);
- i = config_place_active ? 0 : g_random_int_range(0, screen_num_monitors);
+ i = (config_place_monitor != OB_PLACE_MONITOR_ANY) ?
+ 0 : g_random_int_range(0, screen_num_monitors);
l = areas[i]->x;
t = areas[i]->y;
@@ -255,9 +259,9 @@ static gboolean place_nooverlap(ObClient *c, gint *x, gint *y)
/* try ignoring different things to find empty space */
for (ignore = 0; ignore < IGNORE_END && !ret; ignore++) {
/* try all monitors in order of preference, but only the first one
- if config_place_active is true */
- for (i = 0; (i < (config_place_active ? 1 : screen_num_monitors) &&
- !ret); ++i)
+ if config_place_monitor is MOUSE or ACTIVE */
+ for (i = 0; (i < (config_place_monitor != OB_PLACE_MONITOR_ANY ?
+ 1 : screen_num_monitors) && !ret); ++i)
{
GList *it;
diff --git a/openbox/place.h b/openbox/place.h
index e2f1d4e4..6a9add40 100644
--- a/openbox/place.h
+++ b/openbox/place.h
@@ -31,6 +31,13 @@ typedef enum
OB_PLACE_POLICY_MOUSE
} ObPlacePolicy;
+typedef enum
+{
+ OB_PLACE_MONITOR_ANY,
+ OB_PLACE_MONITOR_ACTIVE,
+ OB_PLACE_MONITOR_MOUSE
+} ObPlaceMonitor;
+
gboolean place_client(struct _ObClient *client, gint *x, gint *y,
struct _ObAppSettings *settings);