diff --git a/objects/selection_acquire.c b/objects/selection_acquire.c index 11395813e..46868b113 100644 --- a/objects/selection_acquire.c +++ b/objects/selection_acquire.c @@ -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, diff --git a/tests/test-selection-transfer.lua b/tests/test-selection-transfer.lua index 8a8777205..018caa8d6 100644 --- a/tests/test-selection-transfer.lua +++ b/tests/test-selection-transfer.lua @@ -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()