]> Dogcows Code - chaz/openbox/commitdiff
make menus optionally vertically centered, and enable by default, see bug #2746
authorMikael Magnusson <mikachu@comhem.se>
Wed, 2 Aug 2006 17:25:32 +0000 (17:25 +0000)
committerMikael Magnusson <mikachu@comhem.se>
Wed, 2 Aug 2006 17:25:32 +0000 (17:25 +0000)
data/rc.xml.in
data/rc.xsd
openbox/config.c
openbox/config.h
openbox/menuframe.c

index 238bfd525c7ba391efdf4544bfa4330e7592affd..3593f9f606d46eef4c0936390470375b97dfcf7f 100644 (file)
   <warpPointer>yes</warpPointer>
   <xorStyle>yes</xorStyle>
   <hideDelay>250</hideDelay>
+  <middle>yes</middle>
   <submenuShowDelay>0</submenuShowDelay>
   <desktopMenuIcons>yes</desktopMenuIcons>
   <!-- -->
index 9f548313ae8df3a96a7cb010346c547bc149f0e8..018d6a26612d0db75b69f2184787bddc58685b77 100644 (file)
             <xs:element minOccurs="0" name="warpPointer" type="ob:bool"/>
             <xs:element minOccurs="0" name="xorStyle" type="ob:bool"/>
             <xs:element minOccurs="0" name="hideDelay" type="xs:integer"/>
+            <xs:element minOccurs="0" name="middle" type="ob:bool"/>
             <xs:element minOccurs="0" name="submenuShowDelay" type="xs:integer"/>
             <xs:element minOccurs="0" name="desktopMenuIcons" type="ob:bool"/>
         </xs:sequence>
index 574d13ee7ff8fb730a857935c24b35b41b856453..d986ac1b3111b57a82d90ca0ce924f653a5c3550 100644 (file)
@@ -72,14 +72,14 @@ gint config_mouse_dclicktime;
 gboolean config_menu_warppointer;
 gboolean config_menu_xorstyle;
 guint    config_menu_hide_delay;
+gboolean config_menu_middle;
 guint    config_submenu_show_delay;
 gboolean config_menu_client_list_icons;
 
 GSList *config_menu_files;
 
-gint config_resist_win;
-gint config_resist_edge;
-
+gint     config_resist_win;
+gint     config_resist_edge;
 gboolean config_resist_layers_below;
 
 GSList *config_per_app_settings;
@@ -596,6 +596,8 @@ static void parse_menu(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
             config_menu_xorstyle = parse_bool(doc, n);
         if ((n = parse_find_node("hideDelay", node)))
             config_menu_hide_delay = parse_int(doc, n);
+        if ((n = parse_find_node("middle", node)))
+            config_menu_middle = parse_bool(doc, n);
         if ((n = parse_find_node("submenuShowDelay", node)))
             config_submenu_show_delay = parse_int(doc, n);
         if ((n = parse_find_node("desktopMenuIcons", node)))
@@ -793,6 +795,7 @@ void config_startup(ObParseInst *i)
     config_menu_warppointer = TRUE;
     config_menu_xorstyle = TRUE;
     config_menu_hide_delay = 250;
+    config_menu_middle = TRUE;
     config_submenu_show_delay = 0;
     config_menu_client_list_icons = TRUE;
     config_menu_files = NULL;
index 29f8d081afdd3e862a7685845657a18381e43f27..e68bc12e77180a7762a62b98a4deea332c567e3b 100644 (file)
@@ -122,6 +122,8 @@ extern gboolean config_menu_warppointer;
 extern gboolean config_menu_xorstyle;
 /*! delay for hiding menu when opening */
 extern guint    config_menu_hide_delay;
+/*! Center menus vertically about the parent entry */
+extern gboolean config_menu_middle;
 /*! delay before opening a submenu */
 extern guint    config_submenu_show_delay;
 /*! show icons in client_list_menu */
index 99b7dceebc0436c21e7f3c6155316b841bf303dd..120f4c385c89e9a75fa2d9e4d16c10e83181c5a2 100644 (file)
@@ -628,6 +628,16 @@ gboolean menu_frame_show(ObMenuFrame *self, ObMenuFrame *parent)
     menu_frame_update(self);
 
     menu_frame_visible = g_list_prepend(menu_frame_visible, self);
+    
+    if (config_menu_middle) {
+        if (self->parent)
+            menu_frame_move(self, self->area.x, self->area.y
+                                                - self->area.height/2
+                                                + self->item_h/2);
+        else if (self->show_title)
+            menu_frame_move(self, self->area.x - self->area.width/2,
+                            self->area.y - self->title_h*3/4);
+    }
 
     menu_frame_move_on_screen(self);
 
@@ -780,10 +790,14 @@ void menu_entry_frame_show_submenu(ObMenuEntryFrame *self)
     f = menu_frame_new(self->entry->data.submenu.submenu,
                        self->frame->client);
     menu_frame_move(f,
-                    self->frame->area.x + self->frame->area.width
-                    - ob_rr_theme->menu_overlap - ob_rr_theme->bwidth,
-                    self->frame->area.y + self->frame->title_h +
-                    self->area.y + ob_rr_theme->menu_overlap);
+                    self->frame->area.x
+                  + self->frame->area.width
+                  - ob_rr_theme->menu_overlap
+                  - ob_rr_theme->bwidth,
+                    self->frame->area.y
+                  + self->frame->title_h
+                  + self->area.y
+                  + (config_menu_middle ? 1 : ob_rr_theme->menu_overlap));
     menu_frame_show(f, self->frame);
 }
 
This page took 0.03468 seconds and 4 git commands to generate.