From: Tor H. B. <tor...@gm...> - 2012-08-12 22:33:31
|
Small patch to allow passing a sizepolicy to mod_menu.menu and mod_menu.grabmenu. By setting {sizepolicy='center'} you get the menu in the center of the mplex. This is, to me at least, often nicer than in the corner. -- diff --git a/mod_menu/grabmenu.c b/mod_menu/grabmenu.c index d490b39..27244d0 100644 --- a/mod_menu/grabmenu.c +++ b/mod_menu/grabmenu.c @@ -94,7 +94,7 @@ WMenu *mod_menu_do_grabmenu(WMPlex *mplex, ExtlFn handler, ExtlTab tab, MPLEX_ATTACH_LEVEL| MPLEX_ATTACH_UNNUMBERED| MPLEX_ATTACH_SIZEPOLICY); - par.szplcy=SIZEPOLICY_FULL_BOUNDS; + extl_table_gets_sizepolicy(param, "sizepolicy", &par.szplcy); par.level=STACKING_LEVEL_MODAL1+2; menu=(WMenu*)mplex_do_attach_new(mplex, &par, diff --git a/mod_menu/mkmenu.c b/mod_menu/mkmenu.c index d9775b6..8322859 100644 --- a/mod_menu/mkmenu.c +++ b/mod_menu/mkmenu.c @@ -50,7 +50,7 @@ WMenu *mod_menu_do_menu(WMPlex *mplex, ExtlFn handler, ExtlTab tab, MPLEX_ATTACH_LEVEL| MPLEX_ATTACH_UNNUMBERED| MPLEX_ATTACH_SIZEPOLICY); - par.szplcy=SIZEPOLICY_FULL_BOUNDS; + extl_table_gets_sizepolicy(param, "sizepolicy", &par.szplcy); par.level=STACKING_LEVEL_MODAL1+2; return (WMenu*)mplex_do_attach_new(mplex, &par, diff --git a/mod_menu/mod_menu.lua b/mod_menu/mod_menu.lua index b999c5a..2b6bc99 100644 --- a/mod_menu/mod_menu.lua +++ b/mod_menu/mod_menu.lua @@ -52,6 +52,7 @@ end -- \var{param}. The initial entry can be specified as the field -- \var{initial} as an integer starting from 1. Menus can be made -- to use a bigger style by setting the field \var{big} to \code{true}. +-- Also takes the field \var{sizepolicy}. function mod_menu.menu(mplex, sub, menu_or_name, param) local function menu_stdmenu(m, s, menu) return ioncore.unsqueeze(mod_menu.do_menu(m, s, menu, param)) -- Tor Hedin Brønner |