Co-authored-by: Lucas Schwiderski <4508454+sclu1034@users.noreply.github.com> Co-authored-by: Rene Kievits <crylia@protonmail.com> Co-authored-by: Lucas Schwiderski <4508454+sclu1034@users.noreply.github.com>
This commit is contained in:
parent
17eee18d8b
commit
90460b47d3
|
@ -14,6 +14,7 @@ This document was last updated at commit v4.3-197-g9085ed631.
|
|||
|
||||
## New features
|
||||
|
||||
* `mousegrabber` can now take `nil` as a cursor to not change the cursor at all.
|
||||
* `awful.screen` now has a `request::wallpaper` and a
|
||||
`request::desktop_decoration` signal. They make some workflow implementation
|
||||
cleaner.
|
||||
|
|
|
@ -88,7 +88,8 @@ mousegrabber_handleevent(lua_State *L, int x, int y, uint16_t mask)
|
|||
*
|
||||
*
|
||||
* @tparam function func A callback function as described above.
|
||||
* @tparam string cursor The name of a X cursor to use while grabbing.
|
||||
* @tparam string|nil cursor The name of an X cursor to use while grabbing or `nil`
|
||||
* to not change the cursor.
|
||||
* @noreturn
|
||||
* @staticfct run
|
||||
*/
|
||||
|
@ -98,23 +99,28 @@ luaA_mousegrabber_run(lua_State *L)
|
|||
if(globalconf.mousegrabber != LUA_REFNIL)
|
||||
luaL_error(L, "mousegrabber already running");
|
||||
|
||||
uint16_t cfont = xcursor_font_fromstr(luaL_checkstring(L, 2));
|
||||
xcb_cursor_t cursor = XCB_NONE;
|
||||
|
||||
if(cfont)
|
||||
if(!lua_isnil(L, 2))
|
||||
{
|
||||
xcb_cursor_t cursor = xcursor_new(globalconf.cursor_ctx, cfont);
|
||||
|
||||
luaA_registerfct(L, 1, &globalconf.mousegrabber);
|
||||
|
||||
if(!mousegrabber_grab(cursor))
|
||||
uint16_t cfont = xcursor_font_fromstr(luaL_checkstring(L, 2));
|
||||
if(!cfont)
|
||||
{
|
||||
luaA_unregister(L, &globalconf.mousegrabber);
|
||||
luaL_error(L, "unable to grab mouse pointer");
|
||||
luaA_warn(L, "invalid cursor");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
luaA_warn(L, "invalid cursor");
|
||||
|
||||
cursor = xcursor_new(globalconf.cursor_ctx, cfont);
|
||||
}
|
||||
|
||||
luaA_registerfct(L, 1, &globalconf.mousegrabber);
|
||||
|
||||
if(!mousegrabber_grab(cursor))
|
||||
{
|
||||
luaA_unregister(L, &globalconf.mousegrabber);
|
||||
luaL_error(L, "unable to grab mouse pointer");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue