all repos — openbox @ dd740b5562806a6b4692c938ad0e903ad89b6193

openbox fork - make it a bit more like ryudo

replace the <active> placement option with <placeOn>active/mouse/any</placeOn>
Dana Jansens danakj@orodu.net
commit

dd740b5562806a6b4692c938ad0e903ad89b6193

parent

d409936faae594df7854b5b42ff707315ca33086

6 files changed, 39 insertions(+), 16 deletions(-)

jump to
M data/rc.xmldata/rc.xml

@@ -35,9 +35,10 @@ <!-- 'Smart' or 'UnderMouse' -->

<center>yes</center> <!-- whether to place windows in the center of the free area found or the top left corner --> - <active>no</active> - <!-- force new windows onto the active monitor on a multi-head system, unless - they are part of an application already on another monitor --> + <placeOn>Any</placeOn> + <!-- with Smart placement on a multi-monitor system, try to place new windows + on: 'Any' - any monitor, 'Mouse' - where the mouse is, 'Active' - where + the active window is --> </placement> <theme>
M data/rc.xsddata/rc.xsd

@@ -54,7 +54,7 @@ <xsd:documentation>defines how new windows are placed</xsd:documentation>

</xsd:annotation> <xsd:element name="policy" type="ob:placementpolicy"/> <xsd:element name="center" type="ob:bool"/> - <xsd:element name="active" type="ob:bool"/> + <xsd:element name="placeOn" type="ob:placementmonitor"/> </xsd:complexType> <xsd:complexType name="margins"> <xsd:annotation>

@@ -400,6 +400,13 @@ <xsd:simpleType name="placementpolicy">

<xsd:restriction base="xsd:string"> <xsd:enumeration value="Smart"/> <xsd:enumeration value="UnderMouse"/> + </xsd:restriction> + </xsd:simpleType> + <xsd:simpleType name="placementmonitor"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="Any"/> + <xsd:enumeration value="Mouse"/> + <xsd:enumeration value="Active"/> </xsd:restriction> </xsd:simpleType> <xsd:simpleType name="popupposition">
M openbox/config.copenbox/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 @@ if (parse_contains("UnderMouse", doc, n))

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 @@ parse_register(i, "focus", parse_focus, NULL);

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);
M openbox/config.hopenbox/config.h

@@ -78,7 +78,7 @@ /*! Place windows in the center of the free area */

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;
M openbox/place.copenbox/place.c

@@ -108,7 +108,10 @@ }

} } - 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 @@ Rect **areas;

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 @@

/* 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;
M openbox/place.hopenbox/place.h

@@ -31,6 +31,13 @@ OB_PLACE_POLICY_SMART,

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);