Fix keyboard handling
This commit is contained in:
parent
bee04c14bc
commit
14c420ac49
6
base.lua
6
base.lua
|
@ -125,6 +125,10 @@ local function activateKeyboard(data)
|
|||
if self and type(self) == "table" then
|
||||
data = self
|
||||
end
|
||||
if retval == false then
|
||||
data.visible = false
|
||||
capi.keygrabber.stop()
|
||||
end
|
||||
return retval
|
||||
end
|
||||
end
|
||||
|
@ -390,7 +394,7 @@ local function new(args)
|
|||
while candidate and (candidate._hidden or candidate._filter_out) and idx <= data.rowcount do
|
||||
candidate,idx = internal.items[idx + 1],idx+1
|
||||
end
|
||||
return (candidate or internal.items)
|
||||
return (candidate or internal.items[1])
|
||||
end
|
||||
|
||||
--Repaint when appearance properties change
|
||||
|
|
|
@ -163,7 +163,7 @@ local function setup_drawable(data)
|
|||
end
|
||||
function internal:set_visible(value)
|
||||
internal.w.visible = value
|
||||
if not value then
|
||||
if not value and (not data.parent_geometry or not data.parent_geometry.is_menu) then
|
||||
capi.keygrabber.stop()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,14 +37,12 @@ local function setup_drawable(data)
|
|||
data.margins={left=0,right=0,bottom=0,top=0}
|
||||
internal.layout:connect_signal("mouse::enter",function(_,geo)
|
||||
if data._embeded_parent._current_item then
|
||||
data._embeded_parent._current_item.state[base.item_flags.SELECTED] = nil
|
||||
data._embeded_parent._current_item.selected = false
|
||||
end
|
||||
end)
|
||||
internal.layout:connect_signal("mouse::leave",function(_,geo)
|
||||
if data._current_item then
|
||||
data._current_item.selected = false
|
||||
data._current_item.state[base.item_flags.SELECTED] = nil
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
|
@ -94,7 +94,6 @@ local function new_item(data,args)
|
|||
tooltip = args.tooltip or nil ,
|
||||
style = args.style or data.item_style ,
|
||||
item_layout = args.item_layout or nil ,
|
||||
selected = false ,
|
||||
overlay = args.overlay or data.overlay or nil ,
|
||||
},
|
||||
force_private = {
|
||||
|
@ -134,6 +133,11 @@ local function new_item(data,args)
|
|||
data._internal.items[#data._internal.items+1] = {}
|
||||
data._internal.items[#data._internal.items] = item
|
||||
|
||||
-- Getters
|
||||
item.get_selected = function(_)
|
||||
return item == data._current_item
|
||||
end
|
||||
|
||||
-- Setters
|
||||
item.set_selected = function(_,value,force)
|
||||
private_data.selected = value
|
||||
|
|
|
@ -27,6 +27,8 @@ local function right(data)
|
|||
data.visible = false
|
||||
data = data.parent_geometry
|
||||
return true,data
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -43,10 +45,10 @@ function module:setup_key_hooks(data)
|
|||
data:add_key_hook({}, "&" , "press", up ) -- Xephyr bug
|
||||
data:add_key_hook({}, "Down" , "press", down )
|
||||
data:add_key_hook({}, "KP_Enter", "press", down ) -- Xephyr bug
|
||||
data:add_key_hook({}, "Left" , "press", left )
|
||||
data:add_key_hook({}, "\"" , "press", left ) -- Xephyr bug
|
||||
data:add_key_hook({}, "Right" , "press", right )
|
||||
data:add_key_hook({}, "#" , "press", right ) -- Xephyr bug
|
||||
data:add_key_hook({}, "Left" , "press", right )
|
||||
data:add_key_hook({}, "\"" , "press", right ) -- Xephyr bug
|
||||
data:add_key_hook({}, "Right" , "press", left )
|
||||
data:add_key_hook({}, "#" , "press", left ) -- Xephyr bug
|
||||
end
|
||||
|
||||
--Get preferred item geometry
|
||||
|
|
Loading…
Reference in New Issue