Hello, Here is attached a patch which fixes bug FS#444 introduced by commit cb43b5a. The submenus should now be properly displayed when opened near the edge of the screen.
It also handles menu borders differently as requested by FS#456, the gaps between menu items should now be border_width instead of border_width*2. I did not split this commit for the 2 fixes because they both deal with the set_coords function. Cheers, -- Damien Leone GPG: 0x82EB4DDF
From 62fd21eb012396774507324964e7d6afa8ed9cc4 Mon Sep 17 00:00:00 2001 From: Damien Leone <[email protected]> Date: Sun, 22 Feb 2009 15:48:23 +0100 Subject: [PATCH] awful.menu: fix submenus coords and fix border gaps between menu items --- lib/awful/menu.lua.in | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/awful/menu.lua.in b/lib/awful/menu.lua.in index 3c1ee5a..83bdcd5 100644 --- a/lib/awful/menu.lua.in +++ b/lib/awful/menu.lua.in @@ -193,23 +193,25 @@ local function set_coords(menu, screen_idx) local screen_w = s_geometry.x + s_geometry.width local screen_h = s_geometry.y + s_geometry.height + local i_h = menu.h - menu.theme.border_width + local m_h = (i_h * #menu.items) + menu.theme.border_width + if menu.parent then menu.w = menu.parent.w menu.h = menu.parent.h - local p_w = menu.h * (menu.num - 1) - local m_h = menu.h * #menu.items - local m_w = menu.w + local p_w = i_h * (menu.num - 1) + local m_w = menu.w - menu.theme.border_width + menu.y = menu.parent.y + p_w + m_h > screen_h and screen_h - m_h or menu.parent.y + p_w - menu.x = menu.parent.x + menu.w > screen_w and menu.parent.x - m_w or menu.parent.x + m_w + menu.x = menu.parent.x + m_w*2 > screen_w and menu.parent.x - m_w or menu.parent.x + m_w else local m_coords = capi.mouse.coords() + local m_w = menu.w menu.y = m_coords.y < s_geometry.y and s_geometry.y or m_coords.y menu.x = m_coords.x < s_geometry.x and s_geometry.x or m_coords.x - local m_h = menu.h * #menu.items - local m_w = menu.w menu.y = menu.y + m_h > screen_h and screen_h - m_h or menu.y menu.x = menu.x + m_w > screen_w and screen_w - m_w or menu.x end @@ -225,7 +227,7 @@ function show(menu) width = menu.w, height = menu.h, x = menu.x, - y = menu.y + (num - 1) * menu.h + y = menu.y + (num - 1) * (menu.h - menu.theme.border_width) }) item.screen = screen_index end -- 1.5.6.5
signature.asc
Description: Digital signature
