diff options
author | Markus Ongyerth <ongy@ongy.net> | 2018-04-24 08:10:45 +0200 |
---|---|---|
committer | Markus Ongyerth <ongy@ongy.net> | 2018-07-14 09:40:39 +0200 |
commit | e235f7d33621b5879a5f9a8a1d89d4a8515857c3 (patch) | |
tree | e1c8a9d3d6966753fdccf3940197929f5681bedf /rootston | |
parent | 77bac448ccac9827abfa2ab10e798295f07f3980 (diff) |
Basic tablet_v2 object lifetime
Diffstat (limited to 'rootston')
-rw-r--r-- | rootston/desktop.c | 4 | ||||
-rw-r--r-- | rootston/seat.c | 26 |
2 files changed, 30 insertions, 0 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c index 563c5938..3f9faf24 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -22,6 +22,8 @@ #include <wlr/types/wlr_xdg_output.h> #include <wlr/types/wlr_xdg_shell_v6.h> #include <wlr/types/wlr_xdg_shell.h> +#include <wlr/types/wlr_xdg_output.h> +#include <wlr/types/wlr_tablet_v2.h> #include <wlr/util/log.h> #include "rootston/layers.h" #include "rootston/seat.h" @@ -801,6 +803,8 @@ struct roots_desktop *desktop_create(struct roots_server *server, &desktop->layer_shell_surface); desktop->layer_shell_surface.notify = handle_layer_shell_surface; + desktop->tablet_v2 = wlr_tablet_v2_create(server->wl_display); + #ifdef WLR_HAS_XWAYLAND const char *cursor_theme = NULL; const char *cursor_default = ROOTS_XCURSOR_DEFAULT; diff --git a/rootston/seat.c b/rootston/seat.c index 544cfb90..455e9b00 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -8,6 +8,7 @@ #include <wlr/types/wlr_idle.h> #include <wlr/types/wlr_layer_shell.h> #include <wlr/types/wlr_xcursor_manager.h> +#include <wlr/types/wlr_tablet_v2.h> #include <wlr/util/log.h> #include "rootston/cursor.h" #include "rootston/input.h" @@ -115,6 +116,19 @@ static void handle_tool_tip(struct wl_listener *listener, void *data) { roots_cursor_handle_tool_tip(cursor, event); } +static void handle_tool_proximity(struct wl_listener *listener, void *data) { + struct roots_cursor *cursor = + wl_container_of(listener, cursor, tool_proximity); + struct roots_desktop *desktop = cursor->seat->input->server->desktop; + wlr_idle_notify_activity(desktop->idle, cursor->seat->seat); + struct wlr_event_tablet_tool_proximity *event = data; + + struct wlr_tablet_tool_tool *tool = event->tool; + if (!tool->data) { + tool->data = wlr_make_tablet_tool(desktop->tablet_v2, cursor->seat->seat, tool); + } +} + static void handle_request_set_cursor(struct wl_listener *listener, void *data) { struct roots_cursor *cursor = @@ -251,6 +265,9 @@ static void roots_seat_init_cursor(struct roots_seat *seat) { wl_signal_add(&wlr_cursor->events.tablet_tool_tip, &seat->cursor->tool_tip); seat->cursor->tool_tip.notify = handle_tool_tip; + wl_signal_add(&wlr_cursor->events.tablet_tool_proximity, &seat->cursor->tool_proximity); + seat->cursor->tool_proximity.notify = handle_tool_proximity; + wl_signal_add(&seat->seat->events.request_set_cursor, &seat->cursor->request_set_cursor); seat->cursor->request_set_cursor.notify = handle_request_set_cursor; @@ -532,6 +549,10 @@ static void seat_add_touch(struct roots_seat *seat, static void seat_add_tablet_pad(struct roots_seat *seat, struct wlr_input_device *device) { // TODO + // FIXME: This needs to be stored on the roots_tablet_tool + struct roots_desktop *desktop = seat->input->server->desktop; + (void)wlr_make_tablet_pad(desktop->tablet_v2, seat->seat, device); + } static void handle_tablet_tool_destroy(struct wl_listener *listener, @@ -568,6 +589,11 @@ static void seat_add_tablet_tool(struct roots_seat *seat, wlr_cursor_attach_input_device(seat->cursor->cursor, device); roots_seat_configure_cursor(seat); + + struct roots_desktop *desktop = seat->input->server->desktop; + + // FIXME: This needs to be stored on the roots_tablet_tool + (void)wlr_make_tablet(desktop->tablet_v2, seat->seat, device); } void roots_seat_add_device(struct roots_seat *seat, |