selection_getter: Convert to use a table as argument
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
3dac3fd1d8
commit
4c82199d19
|
@ -54,8 +54,14 @@ luaA_selection_getter_new(lua_State *L)
|
|||
selection_getter_t *selection;
|
||||
xcb_atom_t name_atom, target_atom;
|
||||
|
||||
name = luaL_checklstring(L, 2, &name_length);
|
||||
target = luaL_checklstring(L, 3, &target_length);
|
||||
luaA_checktable(L, 2);
|
||||
lua_pushliteral(L, "selection");
|
||||
lua_gettable(L, 2);
|
||||
lua_pushliteral(L, "target");
|
||||
lua_gettable(L, 2);
|
||||
|
||||
name = luaL_checklstring(L, -2, &name_length);
|
||||
target = luaL_checklstring(L, -1, &target_length);
|
||||
|
||||
/* Create a selection object */
|
||||
selection = (void *) selection_getter_class.allocator(L);
|
||||
|
|
|
@ -61,7 +61,7 @@ runner.run_steps{
|
|||
|
||||
-- Now query the state of the clipboard (should be empty)
|
||||
continue = false
|
||||
local s = selection_getter("CLIPBOARD", "TARGETS")
|
||||
local s = selection_getter{ selection = "CLIPBOARD", target = "TARGETS" }
|
||||
s:connect_signal("data", function(...) error("Got unexpected data: " .. dump_return{...}) end)
|
||||
s:connect_signal("data_end", function()
|
||||
assert(not continue)
|
||||
|
@ -97,7 +97,7 @@ runner.run_steps{
|
|||
|
||||
-- Query whether the clipboard contains a text (UTF8_STRING)
|
||||
continue = false
|
||||
local s = selection_getter("CLIPBOARD", "TARGETS")
|
||||
local s = selection_getter{ selection = "CLIPBOARD", target = "TARGETS" }
|
||||
local data = nil
|
||||
s:connect_signal("data", function(_, d)
|
||||
assert(not data)
|
||||
|
@ -120,7 +120,7 @@ runner.run_steps{
|
|||
|
||||
-- Query the text in the clipboard
|
||||
continue = false
|
||||
local s = selection_getter("CLIPBOARD", "UTF8_STRING")
|
||||
local s = selection_getter{ selection = "CLIPBOARD", target = "UTF8_STRING" }
|
||||
local data = nil
|
||||
s:connect_signal("data", function(_, d)
|
||||
assert(data == nil)
|
||||
|
@ -161,7 +161,7 @@ runner.run_steps{
|
|||
|
||||
-- Query the image in the clipboard
|
||||
continue = false
|
||||
local s = selection_getter("CLIPBOARD", "image/bmp")
|
||||
local s = selection_getter{ selection = "CLIPBOARD", target = "image/bmp" }
|
||||
local data = {}
|
||||
s:connect_signal("data", function(_, d)
|
||||
table.insert(data, d)
|
||||
|
|
Loading…
Reference in New Issue