wok-next diff openbox/stuff/patches/03_place_windows_in_quadrants.patch @ rev 21727

created recipe for vbindiff
author Hans-G?nter Theisgen
date Sat Nov 21 14:32:44 2020 +0100 (2020-11-21)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/openbox/stuff/patches/03_place_windows_in_quadrants.patch	Sat Nov 21 14:32:44 2020 +0100
     1.3 @@ -0,0 +1,111 @@
     1.4 +patch by Marc Brockschmidt to allow placing windows in certain screen
     1.5 +quadrants using key bindings - #544538
     1.6 +Index: openbox-3.4.11.1/data/rc.xsd
     1.7 +===================================================================
     1.8 +--- openbox-3.4.11.1.orig/data/rc.xsd	2010-04-23 16:49:08.000000000 +0200
     1.9 ++++ openbox-3.4.11.1/data/rc.xsd	2010-04-23 16:49:56.000000000 +0200
    1.10 +@@ -171,8 +171,8 @@
    1.11 +         <xsd:element minOccurs="0" name="manageDesktops" type="ob:bool"/>
    1.12 +     </xsd:complexType>
    1.13 +     <xsd:complexType name="window_position">
    1.14 +-        <xsd:element name="x" type="ob:center_or_int"/>
    1.15 +-        <xsd:element name="y" type="ob:center_or_int"/>
    1.16 ++        <xsd:element name="x" type="ob:horizontal_center_or_int"/>
    1.17 ++        <xsd:element name="y" type="ob:vertical_center_or_int"/>
    1.18 + 	<xsd:element name="monitor" type="ob:mouse_or_int"/>	
    1.19 +         <xsd:element minOccurs="0" name="head" type="xsd:string"/>
    1.20 +         <xsd:attribute name="force" type="ob:bool"/>
    1.21 +@@ -365,6 +365,20 @@
    1.22 +             <xsd:pattern value="center|0|[1-9][0-9]*"/>
    1.23 +         </xsd:restriction>
    1.24 +     </xsd:simpleType>
    1.25 ++    <xsd:simpleType name="horizontal_center_or_int">
    1.26 ++        <xsd:restriction base="xsd:string">
    1.27 ++            <!-- ob: atoi($_) unless $_ eq 'center'; -->
    1.28 ++            <!-- I think the regexp DTRT WRT atoi. -->
    1.29 ++            <xsd:pattern value="(Below|Above)?center|0|[1-9][0-9]*"/>
    1.30 ++        </xsd:restriction>
    1.31 ++    </xsd:simpleType>
    1.32 ++    <xsd:simpleType name="vertical_center_or_int">
    1.33 ++        <xsd:restriction base="xsd:string">
    1.34 ++            <!-- ob: atoi($_) unless $_ eq 'center'; -->
    1.35 ++            <!-- I think the regexp DTRT WRT atoi. -->
    1.36 ++            <xsd:pattern value="(LeftOf|RightOf)?center|0|[1-9][0-9]*"/>
    1.37 ++        </xsd:restriction>
    1.38 ++    </xsd:simpleType>
    1.39 +     <xsd:simpleType name="mouse_or_int">
    1.40 +         <xsd:restriction base="xsd:string">
    1.41 +             <!-- ob: atoi($_) unless $_ eq 'center'; -->
    1.42 +Index: openbox-3.4.11.1/openbox/actions/moveresizeto.c
    1.43 +===================================================================
    1.44 +--- openbox-3.4.11.1.orig/openbox/actions/moveresizeto.c	2010-04-23 16:49:24.000000000 +0200
    1.45 ++++ openbox-3.4.11.1/openbox/actions/moveresizeto.c	2010-04-23 16:49:56.000000000 +0200
    1.46 +@@ -14,6 +14,10 @@
    1.47 + typedef struct {
    1.48 +     gboolean xcenter;
    1.49 +     gboolean ycenter;
    1.50 ++    gboolean rightofcenter;
    1.51 ++    gboolean leftofcenter;
    1.52 ++    gboolean abovecenter;
    1.53 ++    gboolean belowcenter;
    1.54 +     gboolean xopposite;
    1.55 +     gboolean yopposite;
    1.56 +     gint x;
    1.57 +@@ -44,12 +48,22 @@
    1.58 + }
    1.59 + 
    1.60 + static void parse_coord(xmlDocPtr doc, xmlNodePtr n, gint *pos,
    1.61 +-                        gboolean *opposite, gboolean *center)
    1.62 ++                        gboolean *opposite, gboolean *rightofcenter,
    1.63 ++                        gboolean *leftofcenter, gboolean *abovecenter,
    1.64 ++                        gboolean *belowcenter, gboolean *center)
    1.65 + {
    1.66 +     gchar *s = parse_string(doc, n);
    1.67 +     if (g_ascii_strcasecmp(s, "current") != 0) {
    1.68 +         if (!g_ascii_strcasecmp(s, "center"))
    1.69 +             *center = TRUE;
    1.70 ++        else if (!g_ascii_strcasecmp(s, "rightofcenter"))
    1.71 ++            *rightofcenter = TRUE;
    1.72 ++        else if (!g_ascii_strcasecmp(s, "leftofcenter"))
    1.73 ++            *leftofcenter = TRUE;
    1.74 ++        else if (!g_ascii_strcasecmp(s, "belowcenter"))
    1.75 ++            *belowcenter = TRUE;
    1.76 ++        else if (!g_ascii_strcasecmp(s, "abovecenter"))
    1.77 ++            *abovecenter = TRUE;
    1.78 +         else {
    1.79 +             if (s[0] == '-')
    1.80 +                 *opposite = TRUE;
    1.81 +@@ -75,10 +89,14 @@
    1.82 +     o->monitor = CURRENT_MONITOR;
    1.83 + 
    1.84 +     if ((n = parse_find_node("x", node)))
    1.85 +-        parse_coord(doc, n, &o->x, &o->xopposite, &o->xcenter);
    1.86 ++        parse_coord(doc, n, &o->x, &o->xopposite, 
    1.87 ++                    &o->rightofcenter, &o->leftofcenter,
    1.88 ++                    &o->abovecenter, &o->belowcenter, &o->xcenter);
    1.89 + 
    1.90 +     if ((n = parse_find_node("y", node)))
    1.91 +-        parse_coord(doc, n, &o->y, &o->yopposite, &o->ycenter);
    1.92 ++        parse_coord(doc, n, &o->y, &o->yopposite,
    1.93 ++                    &o->rightofcenter, &o->leftofcenter,
    1.94 ++                    &o->abovecenter, &o->belowcenter, &o->ycenter); 
    1.95 + 
    1.96 +     if ((n = parse_find_node("width", node))) {
    1.97 +         gchar *s = parse_string(doc, n);
    1.98 +@@ -182,12 +200,16 @@
    1.99 + 
   1.100 +         x = o->x;
   1.101 +         if (o->xcenter) x = (area->width - w) / 2;
   1.102 ++        else if (o->leftofcenter) x = (area->width / 2) - w;
   1.103 ++        else if (o->rightofcenter) x = area->width / 2;
   1.104 +         else if (x == G_MININT) x = c->frame->area.x - carea->x;
   1.105 +         else if (o->xopposite) x = area->width - w - x;
   1.106 +         x += area->x;
   1.107 + 
   1.108 +         y = o->y;
   1.109 +         if (o->ycenter) y = (area->height - h) / 2;
   1.110 ++        else if (o->abovecenter) y = (area->height / 2) - h;
   1.111 ++        else if (o->belowcenter) y = area->height / 2;
   1.112 +         else if (y == G_MININT) y = c->frame->area.y - carea->y;
   1.113 +         else if (o->yopposite) y = area->height - h - y;
   1.114 +         y += area->y;