From 3b74db467b7f628ad45ee319424448a02dc052ec Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sun, 19 Nov 2017 09:33:55 -0500 Subject: data-device: wlr-drag-icon --- include/rootston/seat.h | 16 ---------------- include/wlr/types/wlr_data_device.h | 25 +++++++++++++++++++++++-- include/wlr/types/wlr_seat.h | 2 ++ 3 files changed, 25 insertions(+), 18 deletions(-) (limited to 'include') diff --git a/include/rootston/seat.h b/include/rootston/seat.h index aebd4399..dad8bbc4 100644 --- a/include/rootston/seat.h +++ b/include/rootston/seat.h @@ -4,27 +4,11 @@ #include "rootston/input.h" #include "rootston/keyboard.h" -struct roots_drag_icon { - struct wlr_surface *surface; - struct wl_list link; // roots_seat::drag_icons - bool mapped; - - bool is_pointer; - int32_t touch_id; - - int32_t sx; - int32_t sy; - - struct wl_listener surface_destroy; - struct wl_listener surface_commit; -}; - struct roots_seat { struct roots_input *input; struct wlr_seat *seat; struct roots_cursor *cursor; struct wl_list link; - struct wl_list drag_icons; // coordinates of the first touch point if it exists int32_t touch_id; diff --git a/include/wlr/types/wlr_data_device.h b/include/wlr/types/wlr_data_device.h index 189ab59b..7ee6cec1 100644 --- a/include/wlr/types/wlr_data_device.h +++ b/include/wlr/types/wlr_data_device.h @@ -53,6 +53,27 @@ struct wlr_data_source { } events; }; +struct wlr_drag_icon { + struct wlr_surface *surface; + struct wlr_seat_client *client; + struct wl_list link; // wlr_seat::drag_icons + bool mapped; + + bool is_pointer; + int32_t touch_id; + + int32_t sx; + int32_t sy; + + struct { + struct wl_signal destroy; + } events; + + struct wl_listener surface_destroy; + struct wl_listener surface_commit; + struct wl_listener seat_client_unbound; +}; + struct wlr_drag { struct wlr_seat_pointer_grab pointer_grab; struct wlr_seat_keyboard_grab keyboard_grab; @@ -64,7 +85,7 @@ struct wlr_drag { bool is_pointer_grab; - struct wlr_surface *icon; + struct wlr_drag_icon *icon; struct wlr_surface *focus; struct wlr_data_source *source; @@ -72,9 +93,9 @@ struct wlr_drag { int32_t grab_touch_id; struct wl_listener point_destroy; - struct wl_listener icon_destroy; struct wl_listener source_destroy; struct wl_listener seat_client_unbound; + struct wl_listener icon_destroy; }; /** diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index dbd03401..b5c06718 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -165,6 +165,8 @@ struct wlr_seat { struct wl_global *wl_global; struct wl_display *display; struct wl_list clients; + struct wl_list drag_icons; // wlr_drag_icon::link + char *name; uint32_t capabilities; struct timespec last_event; -- cgit v1.2.3 From 90d2eca218be2beff2465433f0d2937a3d4de267 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sun, 19 Nov 2017 10:07:30 -0500 Subject: rootston: xwayland ready listener --- include/rootston/desktop.h | 1 + rootston/main.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index b809db43..10e5bbc6 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -50,6 +50,7 @@ struct roots_desktop { #ifdef HAS_XWAYLAND struct wlr_xwayland *xwayland; struct wl_listener xwayland_surface; + struct wl_listener xwayland_ready; #endif }; diff --git a/rootston/main.c b/rootston/main.c index 814d3aef..46548094 100644 --- a/rootston/main.c +++ b/rootston/main.c @@ -59,8 +59,9 @@ int main(int argc, char **argv) { ready(NULL, NULL); #else if (server.desktop->xwayland != NULL) { - struct wl_listener xwayland_ready = { .notify = ready }; - wl_signal_add(&server.desktop->xwayland->events.ready, &xwayland_ready); + wl_signal_add(&server.desktop->xwayland->events.ready, + &server.desktop->xwayland_ready); + server.desktop->xwayland_ready.notify = ready; } else { ready(NULL, NULL); } -- cgit v1.2.3 From bd8cdf1e9ff0ba6a0e8f7c36fec7f7540c94fded Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sun, 19 Nov 2017 10:20:32 -0500 Subject: rootston: remove grab listeners --- include/rootston/cursor.h | 18 ------------------ rootston/cursor.c | 16 ---------------- rootston/seat.c | 48 ----------------------------------------------- 3 files changed, 82 deletions(-) (limited to 'include') diff --git a/include/rootston/cursor.h b/include/rootston/cursor.h index f0c9be89..e2a371bf 100644 --- a/include/rootston/cursor.h +++ b/include/rootston/cursor.h @@ -53,12 +53,6 @@ struct roots_cursor { struct wl_listener tool_axis; struct wl_listener tool_tip; - struct wl_listener pointer_grab_begin; - struct wl_listener pointer_grab_end; - - struct wl_listener touch_grab_begin; - struct wl_listener touch_grab_end; - struct wl_listener request_set_cursor; }; @@ -96,16 +90,4 @@ void roots_cursor_handle_tool_tip(struct roots_cursor *cursor, void roots_cursor_handle_request_set_cursor(struct roots_cursor *cursor, struct wlr_seat_pointer_request_set_cursor_event *event); -void roots_cursor_handle_pointer_grab_begin(struct roots_cursor *cursor, - struct wlr_seat_pointer_grab *grab); - -void roots_cursor_handle_pointer_grab_end(struct roots_cursor *cursor, - struct wlr_seat_pointer_grab *grab); - -void roots_cursor_handle_touch_grab_begin(struct roots_cursor *cursor, - struct wlr_seat_touch_grab *grab); - -void roots_cursor_handle_touch_grab_end(struct roots_cursor *cursor, - struct wlr_seat_touch_grab *grab); - #endif diff --git a/rootston/cursor.c b/rootston/cursor.c index d0b40876..e2615bec 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -354,19 +354,3 @@ void roots_cursor_handle_request_set_cursor(struct roots_cursor *cursor, event->hotspot_y); cursor->cursor_client = event->seat_client->client; } - -void roots_cursor_handle_pointer_grab_begin(struct roots_cursor *cursor, - struct wlr_seat_pointer_grab *grab) { -} - -void roots_cursor_handle_pointer_grab_end(struct roots_cursor *cursor, - struct wlr_seat_pointer_grab *grab) { -} - -void roots_cursor_handle_touch_grab_begin(struct roots_cursor *cursor, - struct wlr_seat_touch_grab *grab) { -} - -void roots_cursor_handle_touch_grab_end(struct roots_cursor *cursor, - struct wlr_seat_touch_grab *grab) { -} diff --git a/rootston/seat.c b/rootston/seat.c index 96c6fb0d..c24ee787 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -96,38 +96,6 @@ static void handle_request_set_cursor(struct wl_listener *listener, roots_cursor_handle_request_set_cursor(cursor, event); } -static void handle_pointer_grab_begin(struct wl_listener *listener, - void *data) { - struct roots_cursor *cursor = - wl_container_of(listener, cursor, pointer_grab_begin); - struct wlr_seat_pointer_grab *grab = data; - roots_cursor_handle_pointer_grab_begin(cursor, grab); -} - -static void handle_pointer_grab_end(struct wl_listener *listener, - void *data) { - struct roots_cursor *cursor = - wl_container_of(listener, cursor, pointer_grab_end); - struct wlr_seat_pointer_grab *grab = data; - roots_cursor_handle_pointer_grab_end(cursor, grab); -} - -static void handle_touch_grab_begin(struct wl_listener *listener, - void *data) { - struct roots_cursor *cursor = - wl_container_of(listener, cursor, touch_grab_begin); - struct wlr_seat_touch_grab *grab = data; - roots_cursor_handle_touch_grab_begin(cursor, grab); -} - -static void handle_touch_grab_end(struct wl_listener *listener, - void *data) { - struct roots_cursor *cursor = - wl_container_of(listener, cursor, touch_grab_end); - struct wlr_seat_touch_grab *grab = data; - roots_cursor_handle_touch_grab_end(cursor, grab); -} - static void seat_reset_device_mappings(struct roots_seat *seat, struct wlr_input_device *device) { struct wlr_cursor *cursor = seat->cursor->cursor; @@ -249,22 +217,6 @@ static void roots_seat_init_cursor(struct roots_seat *seat) { wl_signal_add(&seat->seat->events.request_set_cursor, &seat->cursor->request_set_cursor); seat->cursor->request_set_cursor.notify = handle_request_set_cursor; - - wl_signal_add(&seat->seat->events.pointer_grab_begin, - &seat->cursor->pointer_grab_begin); - seat->cursor->pointer_grab_begin.notify = handle_pointer_grab_begin; - - wl_signal_add(&seat->seat->events.pointer_grab_end, - &seat->cursor->pointer_grab_end); - seat->cursor->pointer_grab_end.notify = handle_pointer_grab_end; - - wl_signal_add(&seat->seat->events.touch_grab_begin, - &seat->cursor->touch_grab_begin); - seat->cursor->touch_grab_begin.notify = handle_touch_grab_begin; - - wl_signal_add(&seat->seat->events.touch_grab_end, - &seat->cursor->touch_grab_end); - seat->cursor->touch_grab_end.notify = handle_touch_grab_end; } struct roots_seat *roots_seat_create(struct roots_input *input, char *name) { -- cgit v1.2.3 From af23192ede63243b057ac9d98fd796e609e668a2 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sun, 19 Nov 2017 11:10:27 -0500 Subject: wlr-seat: remove client bound and unbound signal --- include/wlr/types/wlr_data_device.h | 4 ++-- include/wlr/types/wlr_seat.h | 7 ++++--- types/wlr_data_device.c | 35 +++++++++++++++-------------------- types/wlr_seat.c | 7 ++----- 4 files changed, 23 insertions(+), 30 deletions(-) (limited to 'include') diff --git a/include/wlr/types/wlr_data_device.h b/include/wlr/types/wlr_data_device.h index 7ee6cec1..12b25e45 100644 --- a/include/wlr/types/wlr_data_device.h +++ b/include/wlr/types/wlr_data_device.h @@ -71,7 +71,7 @@ struct wlr_drag_icon { struct wl_listener surface_destroy; struct wl_listener surface_commit; - struct wl_listener seat_client_unbound; + struct wl_listener seat_client_destroy; }; struct wlr_drag { @@ -94,7 +94,7 @@ struct wlr_drag { struct wl_listener point_destroy; struct wl_listener source_destroy; - struct wl_listener seat_client_unbound; + struct wl_listener seat_client_destroy; struct wl_listener icon_destroy; }; diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index b5c06718..6d59315b 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -21,6 +21,10 @@ struct wlr_seat_client { struct wl_resource *touch; struct wl_resource *data_device; + struct { + struct wl_signal destroy; + } events; + struct wl_list link; }; @@ -182,9 +186,6 @@ struct wlr_seat { struct wl_listener selection_data_source_destroy; struct { - struct wl_signal client_bound; - struct wl_signal client_unbound; - struct wl_signal pointer_grab_begin; struct wl_signal pointer_grab_end; diff --git a/types/wlr_data_device.c b/types/wlr_data_device.c index 91f31c97..a8d69cc0 100644 --- a/types/wlr_data_device.c +++ b/types/wlr_data_device.c @@ -352,15 +352,13 @@ static void data_device_release(struct wl_client *client, wl_resource_destroy(resource); } -static void drag_client_seat_unbound(struct wl_listener *listener, void *data) { +static void handle_drag_seat_client_destroy(struct wl_listener *listener, + void *data) { struct wlr_drag *drag = - wl_container_of(listener, drag, seat_client_unbound); - struct wlr_seat_client *unbound_client = data; + wl_container_of(listener, drag, seat_client_destroy); - if (drag->focus_client == unbound_client) { - drag->focus_client = NULL; - wl_list_remove(&drag->seat_client_unbound.link); - } + drag->focus_client = NULL; + wl_list_remove(&drag->seat_client_destroy.link); } static void wlr_drag_set_focus(struct wlr_drag *drag, @@ -370,7 +368,7 @@ static void wlr_drag_set_focus(struct wlr_drag *drag, } if (drag->focus_client && drag->focus_client->data_device) { - wl_list_remove(&drag->seat_client_unbound.link); + wl_list_remove(&drag->seat_client_destroy.link); wl_data_device_send_leave(drag->focus_client->data_device); drag->focus_client = NULL; drag->focus = NULL; @@ -430,9 +428,9 @@ static void wlr_drag_set_focus(struct wlr_drag *drag, drag->focus = surface; drag->focus_client = focus_client; - drag->seat_client_unbound.notify = drag_client_seat_unbound; - wl_signal_add(&focus_client->seat->events.client_unbound, - &drag->seat_client_unbound); + drag->seat_client_destroy.notify = handle_drag_seat_client_destroy; + wl_signal_add(&focus_client->events.destroy, + &drag->seat_client_destroy); } static void wlr_drag_end(struct wlr_drag *drag) { @@ -622,7 +620,7 @@ static void wlr_drag_icon_destroy(struct wlr_drag_icon *icon) { wl_signal_emit(&icon->events.destroy, icon); wl_list_remove(&icon->surface_commit.link); wl_list_remove(&icon->surface_destroy.link); - wl_list_remove(&icon->seat_client_unbound.link); + wl_list_remove(&icon->seat_client_destroy.link); wl_list_remove(&icon->link); free(icon); } @@ -642,15 +640,12 @@ static void handle_drag_icon_surface_commit(struct wl_listener *listener, icon->sy += icon->surface->current->sy; } -static void handle_drag_icon_seat_client_unbound(struct wl_listener *listener, +static void handle_drag_icon_seat_client_destroy(struct wl_listener *listener, void *data) { struct wlr_drag_icon *icon = - wl_container_of(listener, icon, seat_client_unbound); - struct wlr_seat_client *client = data; + wl_container_of(listener, icon, seat_client_destroy); - if (client == icon->client) { - wlr_drag_icon_destroy(icon); - } + wlr_drag_icon_destroy(icon); } static struct wlr_drag_icon *wlr_drag_icon_create( @@ -676,8 +671,8 @@ static struct wlr_drag_icon *wlr_drag_icon_create( wl_signal_add(&icon->surface->events.commit, &icon->surface_commit); icon->surface_commit.notify = handle_drag_icon_surface_commit; - wl_signal_add(&client->seat->events.client_unbound, &icon->seat_client_unbound); - icon->seat_client_unbound.notify = handle_drag_icon_seat_client_unbound; + wl_signal_add(&client->events.destroy, &icon->seat_client_destroy); + icon->seat_client_destroy.notify = handle_drag_icon_seat_client_destroy; return icon; } diff --git a/types/wlr_seat.c b/types/wlr_seat.c index 3bdd11ef..ff1cbf7f 100644 --- a/types/wlr_seat.c +++ b/types/wlr_seat.c @@ -181,7 +181,7 @@ static void wl_seat_get_touch(struct wl_client *client, static void wlr_seat_client_resource_destroy(struct wl_resource *resource) { struct wlr_seat_client *client = wl_resource_get_user_data(resource); - wl_signal_emit(&client->seat->events.client_unbound, client); + wl_signal_emit(&client->events.destroy, client); if (client == client->seat->pointer_state.focused_client) { client->seat->pointer_state.focused_client = NULL; @@ -240,7 +240,7 @@ static void wl_seat_bind(struct wl_client *client, void *_wlr_seat, wl_seat_send_name(seat_client->wl_resource, wlr_seat->name); } wl_seat_send_capabilities(seat_client->wl_resource, wlr_seat->capabilities); - wl_signal_emit(&wlr_seat->events.client_bound, seat_client); + wl_signal_init(&seat_client->events.destroy); } static void default_pointer_enter(struct wlr_seat_pointer_grab *grab, @@ -406,9 +406,6 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) { wl_list_init(&wlr_seat->clients); wl_list_init(&wlr_seat->drag_icons); - wl_signal_init(&wlr_seat->events.client_bound); - wl_signal_init(&wlr_seat->events.client_unbound); - wl_signal_init(&wlr_seat->events.request_set_cursor); wl_signal_init(&wlr_seat->events.selection); -- cgit v1.2.3