selection_acquire: Change the API to a table
As requested in the review, instead of just having a single string argument, selection_acquire() now has a table as its argument. It searches the string under the "selection" key here. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
c3338c5a74
commit
01bd2d1896
|
@ -139,7 +139,10 @@ luaA_selection_acquire_new(lua_State *L)
|
|||
xcb_atom_t name_atom;
|
||||
selection_acquire_t *selection;
|
||||
|
||||
name = luaL_checklstring(L, 2, &name_length);
|
||||
luaA_checktable(L, 2);
|
||||
lua_pushliteral(L, "selection");
|
||||
lua_gettable(L, 2);
|
||||
name = luaL_checklstring(L, -1, &name_length);
|
||||
|
||||
/* Get the atom identifying the selection */
|
||||
reply = xcb_intern_atom_reply(globalconf.connection,
|
||||
|
|
|
@ -66,20 +66,20 @@ end
|
|||
runner.run_steps{
|
||||
function()
|
||||
-- Get the selection
|
||||
local s = assert(selection_acquire("CLIPBOARD"),
|
||||
local s = assert(selection_acquire{ selection = "CLIPBOARD" },
|
||||
"Failed to acquire the clipboard selection")
|
||||
|
||||
-- Steal selection ownership from ourselves and test that it works
|
||||
local s_released
|
||||
s:connect_signal("release", function() s_released = true end)
|
||||
|
||||
selection = assert(selection_acquire("CLIPBOARD"),
|
||||
selection = assert(selection_acquire{ selection = "CLIPBOARD" },
|
||||
"Failed to acquire the clipboard selection")
|
||||
|
||||
assert(s_released)
|
||||
|
||||
-- Now test selection transfers
|
||||
selection = assert(selection_acquire("CLIPBOARD"),
|
||||
selection = assert(selection_acquire{ selection = "CLIPBOARD" },
|
||||
"Failed to acquire the clipboard selection")
|
||||
selection:connect_signal("request", function(_, target, transfer)
|
||||
if target == "TARGETS" then
|
||||
|
@ -108,7 +108,7 @@ runner.run_steps{
|
|||
continue = false
|
||||
|
||||
-- Now test piece-wise selection transfers
|
||||
selection = assert(selection_acquire("CLIPBOARD"),
|
||||
selection = assert(selection_acquire{ selection = "CLIPBOARD" },
|
||||
"Failed to acquire the clipboard selection")
|
||||
selection:connect_signal("request", function(_, target, transfer)
|
||||
if target == "TARGETS" then
|
||||
|
@ -148,7 +148,7 @@ runner.run_steps{
|
|||
continue = false
|
||||
|
||||
-- Now test a huge transfer
|
||||
selection = assert(selection_acquire("CLIPBOARD"),
|
||||
selection = assert(selection_acquire{ selection = "CLIPBOARD" },
|
||||
"Failed to acquire the clipboard selection")
|
||||
selection:connect_signal("request", function(_, target, transfer)
|
||||
if target == "TARGETS" then
|
||||
|
@ -212,7 +212,7 @@ runner.run_steps{
|
|||
continue = false
|
||||
|
||||
-- Test for "release" signal when we lose selection
|
||||
selection = assert(selection_acquire("CLIPBOARD"),
|
||||
selection = assert(selection_acquire{ selection = "CLIPBOARD" },
|
||||
"Failed to acquire the clipboard selection")
|
||||
selection:connect_signal("release", function() selection_released = true end)
|
||||
awesome.sync()
|
||||
|
|
Loading…
Reference in New Issue