rev |
line source |
al@19790
|
1 patch by Marc Brockschmidt to allow placing windows in certain screen
|
al@19790
|
2 quadrants using key bindings - #544538
|
al@19790
|
3 Index: openbox-3.4.11.1/data/rc.xsd
|
al@19790
|
4 ===================================================================
|
al@19790
|
5 --- openbox-3.4.11.1.orig/data/rc.xsd 2010-04-23 16:49:08.000000000 +0200
|
al@19790
|
6 +++ openbox-3.4.11.1/data/rc.xsd 2010-04-23 16:49:56.000000000 +0200
|
al@19790
|
7 @@ -171,8 +171,8 @@
|
al@19790
|
8 <xsd:element minOccurs="0" name="manageDesktops" type="ob:bool"/>
|
al@19790
|
9 </xsd:complexType>
|
al@19790
|
10 <xsd:complexType name="window_position">
|
al@19790
|
11 - <xsd:element name="x" type="ob:center_or_int"/>
|
al@19790
|
12 - <xsd:element name="y" type="ob:center_or_int"/>
|
al@19790
|
13 + <xsd:element name="x" type="ob:horizontal_center_or_int"/>
|
al@19790
|
14 + <xsd:element name="y" type="ob:vertical_center_or_int"/>
|
al@19790
|
15 <xsd:element name="monitor" type="ob:mouse_or_int"/>
|
al@19790
|
16 <xsd:element minOccurs="0" name="head" type="xsd:string"/>
|
al@19790
|
17 <xsd:attribute name="force" type="ob:bool"/>
|
al@19790
|
18 @@ -365,6 +365,20 @@
|
al@19790
|
19 <xsd:pattern value="center|0|[1-9][0-9]*"/>
|
al@19790
|
20 </xsd:restriction>
|
al@19790
|
21 </xsd:simpleType>
|
al@19790
|
22 + <xsd:simpleType name="horizontal_center_or_int">
|
al@19790
|
23 + <xsd:restriction base="xsd:string">
|
al@19790
|
24 + <!-- ob: atoi($_) unless $_ eq 'center'; -->
|
al@19790
|
25 + <!-- I think the regexp DTRT WRT atoi. -->
|
al@19790
|
26 + <xsd:pattern value="(Below|Above)?center|0|[1-9][0-9]*"/>
|
al@19790
|
27 + </xsd:restriction>
|
al@19790
|
28 + </xsd:simpleType>
|
al@19790
|
29 + <xsd:simpleType name="vertical_center_or_int">
|
al@19790
|
30 + <xsd:restriction base="xsd:string">
|
al@19790
|
31 + <!-- ob: atoi($_) unless $_ eq 'center'; -->
|
al@19790
|
32 + <!-- I think the regexp DTRT WRT atoi. -->
|
al@19790
|
33 + <xsd:pattern value="(LeftOf|RightOf)?center|0|[1-9][0-9]*"/>
|
al@19790
|
34 + </xsd:restriction>
|
al@19790
|
35 + </xsd:simpleType>
|
al@19790
|
36 <xsd:simpleType name="mouse_or_int">
|
al@19790
|
37 <xsd:restriction base="xsd:string">
|
al@19790
|
38 <!-- ob: atoi($_) unless $_ eq 'center'; -->
|
al@19790
|
39 Index: openbox-3.4.11.1/openbox/actions/moveresizeto.c
|
al@19790
|
40 ===================================================================
|
al@19790
|
41 --- openbox-3.4.11.1.orig/openbox/actions/moveresizeto.c 2010-04-23 16:49:24.000000000 +0200
|
al@19790
|
42 +++ openbox-3.4.11.1/openbox/actions/moveresizeto.c 2010-04-23 16:49:56.000000000 +0200
|
al@19790
|
43 @@ -14,6 +14,10 @@
|
al@19790
|
44 typedef struct {
|
al@19790
|
45 gboolean xcenter;
|
al@19790
|
46 gboolean ycenter;
|
al@19790
|
47 + gboolean rightofcenter;
|
al@19790
|
48 + gboolean leftofcenter;
|
al@19790
|
49 + gboolean abovecenter;
|
al@19790
|
50 + gboolean belowcenter;
|
al@19790
|
51 gboolean xopposite;
|
al@19790
|
52 gboolean yopposite;
|
al@19790
|
53 gint x;
|
al@19790
|
54 @@ -44,12 +48,22 @@
|
al@19790
|
55 }
|
al@19790
|
56
|
al@19790
|
57 static void parse_coord(xmlDocPtr doc, xmlNodePtr n, gint *pos,
|
al@19790
|
58 - gboolean *opposite, gboolean *center)
|
al@19790
|
59 + gboolean *opposite, gboolean *rightofcenter,
|
al@19790
|
60 + gboolean *leftofcenter, gboolean *abovecenter,
|
al@19790
|
61 + gboolean *belowcenter, gboolean *center)
|
al@19790
|
62 {
|
al@19790
|
63 gchar *s = parse_string(doc, n);
|
al@19790
|
64 if (g_ascii_strcasecmp(s, "current") != 0) {
|
al@19790
|
65 if (!g_ascii_strcasecmp(s, "center"))
|
al@19790
|
66 *center = TRUE;
|
al@19790
|
67 + else if (!g_ascii_strcasecmp(s, "rightofcenter"))
|
al@19790
|
68 + *rightofcenter = TRUE;
|
al@19790
|
69 + else if (!g_ascii_strcasecmp(s, "leftofcenter"))
|
al@19790
|
70 + *leftofcenter = TRUE;
|
al@19790
|
71 + else if (!g_ascii_strcasecmp(s, "belowcenter"))
|
al@19790
|
72 + *belowcenter = TRUE;
|
al@19790
|
73 + else if (!g_ascii_strcasecmp(s, "abovecenter"))
|
al@19790
|
74 + *abovecenter = TRUE;
|
al@19790
|
75 else {
|
al@19790
|
76 if (s[0] == '-')
|
al@19790
|
77 *opposite = TRUE;
|
al@19790
|
78 @@ -75,10 +89,14 @@
|
al@19790
|
79 o->monitor = CURRENT_MONITOR;
|
al@19790
|
80
|
al@19790
|
81 if ((n = parse_find_node("x", node)))
|
al@19790
|
82 - parse_coord(doc, n, &o->x, &o->xopposite, &o->xcenter);
|
al@19790
|
83 + parse_coord(doc, n, &o->x, &o->xopposite,
|
al@19790
|
84 + &o->rightofcenter, &o->leftofcenter,
|
al@19790
|
85 + &o->abovecenter, &o->belowcenter, &o->xcenter);
|
al@19790
|
86
|
al@19790
|
87 if ((n = parse_find_node("y", node)))
|
al@19790
|
88 - parse_coord(doc, n, &o->y, &o->yopposite, &o->ycenter);
|
al@19790
|
89 + parse_coord(doc, n, &o->y, &o->yopposite,
|
al@19790
|
90 + &o->rightofcenter, &o->leftofcenter,
|
al@19790
|
91 + &o->abovecenter, &o->belowcenter, &o->ycenter);
|
al@19790
|
92
|
al@19790
|
93 if ((n = parse_find_node("width", node))) {
|
al@19790
|
94 gchar *s = parse_string(doc, n);
|
al@19790
|
95 @@ -182,12 +200,16 @@
|
al@19790
|
96
|
al@19790
|
97 x = o->x;
|
al@19790
|
98 if (o->xcenter) x = (area->width - w) / 2;
|
al@19790
|
99 + else if (o->leftofcenter) x = (area->width / 2) - w;
|
al@19790
|
100 + else if (o->rightofcenter) x = area->width / 2;
|
al@19790
|
101 else if (x == G_MININT) x = c->frame->area.x - carea->x;
|
al@19790
|
102 else if (o->xopposite) x = area->width - w - x;
|
al@19790
|
103 x += area->x;
|
al@19790
|
104
|
al@19790
|
105 y = o->y;
|
al@19790
|
106 if (o->ycenter) y = (area->height - h) / 2;
|
al@19790
|
107 + else if (o->abovecenter) y = (area->height / 2) - h;
|
al@19790
|
108 + else if (o->belowcenter) y = area->height / 2;
|
al@19790
|
109 else if (y == G_MININT) y = c->frame->area.y - carea->y;
|
al@19790
|
110 else if (o->yopposite) y = area->height - h - y;
|
al@19790
|
111 y += area->y;
|