Fix set_menu()

This commit is contained in:
Emmanuel Lepage Vallee 2014-01-08 23:32:42 -05:00
parent a1144564ab
commit 69d5aac0fa
2 changed files with 3 additions and 2 deletions

View File

@ -43,7 +43,7 @@ The most simple kind of menus, contexts one, can be created like this:
-- To add the menu to a widget: -- To add the menu to a widget:
local mytextbox = wibox.widget.textbox() local mytextbox = wibox.widget.textbox()
mytextbox:set_menu(m,3) -- 3 = right mouse button, 1 = left mouse button mytextbox:set_menu(menu,3) -- 3 = right mouse button, 1 = left mouse button
``` ```
In this example, a simple 3 item menu is created with a dynamically generated In this example, a simple 3 item menu is created with a dynamically generated

View File

@ -11,7 +11,8 @@ end
local function set_menu(self,menu,button) local function set_menu(self,menu,button)
if not menu then return end if not menu then return end
local b,current,bt = button or 1,self:buttons(),aw_button({},b,function(geo) local b = button or 1
local current,bt = self:buttons(),aw_button({},b,function(geo)
local m = menu local m = menu
if type(menu) == "function" then if type(menu) == "function" then
if self._tmp_menu and self._tmp_menu.visible then if self._tmp_menu and self._tmp_menu.visible then