diff --git a/kiwmi/input/cursor.c b/kiwmi/input/cursor.c index 0046e61..048656d 100644 --- a/kiwmi/input/cursor.c +++ b/kiwmi/input/cursor.c @@ -92,22 +92,6 @@ cursor_button_notify(struct wl_listener *listener, void *data) wlr_seat_pointer_notify_button( input->seat, event->time_msec, event->button, event->state); - - double sx; - double sy; - struct wlr_surface *surface; - - struct kiwmi_view *view = view_at( - &server->desktop, - cursor->cursor->x, - cursor->cursor->y, - &surface, - &sx, - &sy); - - if (event->state == WLR_BUTTON_PRESSED) { - focus_view(view); - } } static void diff --git a/kiwmi/luak.c b/kiwmi/luak.c index d346322..4d12886 100644 --- a/kiwmi/luak.c +++ b/kiwmi/luak.c @@ -87,8 +87,20 @@ l_kiwmi_view_close(lua_State *L) return 0; } +static int +l_kiwmi_view_focus(lua_State *L) +{ + struct kiwmi_view *view = + *(struct kiwmi_view **)luaL_checkudata(L, 1, "kiwmi_view"); + + focus_view(view); + + return 0; +} + static const luaL_Reg kiwmi_view_methods[] = { {"close", l_kiwmi_view_close}, + {"focus", l_kiwmi_view_focus}, {NULL, NULL}, };