Allow for cursor hiding.
This commit is contained in:
parent
cd7cfae770
commit
d055b6587e
4 changed files with 31 additions and 0 deletions
|
@ -24,6 +24,8 @@ struct kiwmi_cursor {
|
|||
struct wlr_cursor *cursor;
|
||||
struct wlr_xcursor_manager *xcursor_manager;
|
||||
|
||||
bool visible;
|
||||
|
||||
enum kiwmi_cursor_mode cursor_mode;
|
||||
|
||||
struct {
|
||||
|
|
|
@ -111,9 +111,11 @@ output_frame_notify(struct wl_listener *listener, void *data)
|
|||
struct kiwmi_output *output = wl_container_of(listener, output, frame);
|
||||
struct wlr_output *wlr_output = data;
|
||||
struct kiwmi_desktop *desktop = output->desktop;
|
||||
struct kiwmi_server *server = wl_container_of(desktop, server, desktop);
|
||||
struct wlr_output_layout *output_layout = desktop->output_layout;
|
||||
struct wlr_renderer *renderer =
|
||||
wlr_backend_get_renderer(wlr_output->backend);
|
||||
struct kiwmi_cursor *cursor = server->input.cursor;
|
||||
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
|
|
@ -278,6 +278,8 @@ cursor_create(
|
|||
wl_signal_init(&cursor->events.button_up);
|
||||
wl_signal_init(&cursor->events.motion);
|
||||
|
||||
cursor->visible = true;
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,11 +16,24 @@
|
|||
|
||||
#include "desktop/view.h"
|
||||
#include "input/cursor.h"
|
||||
#include "input/seat.h"
|
||||
#include "luak/kiwmi_lua_callback.h"
|
||||
#include "luak/kiwmi_view.h"
|
||||
#include "luak/lua_compat.h"
|
||||
#include "luak/luak.h"
|
||||
|
||||
static void
|
||||
l_kiwmi_cursor_hide(lua_State *L)
|
||||
{
|
||||
struct kiwmi_object *obj =
|
||||
*(struct kiwmi_object **)luaL_checkudata(L, 1, "kiwmi_cursor");
|
||||
struct kiwmi_cursor *cursor = obj->object;
|
||||
|
||||
wlr_cursor_set_surface(cursor->cursor, NULL, 0, 0);
|
||||
cursor->visible = false;
|
||||
wlr_seat_pointer_notify_clear_focus(cursor->server->input.seat->seat);
|
||||
}
|
||||
|
||||
static int
|
||||
l_kiwmi_cursor_pos(lua_State *L)
|
||||
{
|
||||
|
@ -35,6 +48,16 @@ l_kiwmi_cursor_pos(lua_State *L)
|
|||
return 2;
|
||||
}
|
||||
|
||||
static void
|
||||
l_kiwmi_cursor_show(lua_State *L)
|
||||
{
|
||||
struct kiwmi_object *obj =
|
||||
*(struct kiwmi_object **)luaL_checkudata(L, 1, "kiwmi_cursor");
|
||||
struct kiwmi_cursor *cursor = obj->object;
|
||||
|
||||
cursor->visible = true;
|
||||
}
|
||||
|
||||
static int
|
||||
l_kiwmi_cursor_view_at_pos(lua_State *L)
|
||||
{
|
||||
|
@ -73,8 +96,10 @@ l_kiwmi_cursor_view_at_pos(lua_State *L)
|
|||
}
|
||||
|
||||
static const luaL_Reg kiwmi_cursor_methods[] = {
|
||||
{"hide", l_kiwmi_cursor_hide},
|
||||
{"on", luaK_callback_register_dispatch},
|
||||
{"pos", l_kiwmi_cursor_pos},
|
||||
{"show", l_kiwmi_cursor_show},
|
||||
{"view_at_pos", l_kiwmi_cursor_view_at_pos},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue