all repos — openbox @ e048751f914d16cb6346f7e7ca6532eaae44ce31

openbox fork - make it a bit more like ryudo

add center option to placement section
Mikael Magnusson mikachu@comhem.se
commit

e048751f914d16cb6346f7e7ca6532eaae44ce31

parent

774b32f14ed63ee5da4613ba6c1399c54972614d

5 files changed, 16 insertions(+), 2 deletions(-)

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

@@ -32,6 +32,9 @@

<placement> <policy>Smart</policy> <!-- 'Smart' or 'UnderMouse' --> + <center>yes</center> + <!-- whether to place windows in the center of the free area found or + the top left corner --> </placement> <theme>
M data/rc.xsddata/rc.xsd

@@ -53,6 +53,7 @@ <xsd:annotation>

<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:complexType> <xsd:complexType name="theme"> <xsd:element minOccurs="0" name="name" type="xsd:string"/>
M openbox/config.copenbox/config.c

@@ -36,6 +36,7 @@ gboolean config_focus_last;

gboolean config_focus_under_mouse; ObPlacePolicy config_place_policy; +gboolean config_place_center; gchar *config_theme; gboolean config_theme_keepborder;

@@ -495,6 +496,8 @@

if ((n = parse_find_node("policy", node))) 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); } static void parse_theme(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,

@@ -869,6 +872,7 @@

parse_register(i, "focus", parse_focus, NULL); config_place_policy = OB_PLACE_POLICY_SMART; + config_place_center = TRUE; parse_register(i, "placement", parse_placement, NULL);
M openbox/config.hopenbox/config.h

@@ -76,6 +76,8 @@ */

extern gboolean config_focus_under_mouse; extern ObPlacePolicy config_place_policy; +/*! Place windows in the center of the free area */ +extern gboolean config_place_center; /*! When true windows' contents are refreshed while they are resized; otherwise they are not updated until the resize is complete */
M openbox/place.copenbox/place.c

@@ -326,8 +326,12 @@ if (maxit) {

Rect *r = maxit->data; /* center it in the area */ - *x = r->x + (r->width - c->frame->area.width) / 2; - *y = r->y + (r->height - c->frame->area.height) / 2; + *x = r->x; + *y = r->y; + if (config_place_center) { + *x += (r->width - c->frame->area.width) / 2; + *y += (r->height - c->frame->area.height) / 2; + } ret = TRUE; }