aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Maese <memaese@hotmail.com>2018-12-13 23:41:21 -0600
committerAlex Maese <memaese@hotmail.com>2018-12-21 12:20:48 -0600
commit09bdbf24f4fc44cfbb9bd6079a1d7cd08edaefdb (patch)
tree2de113082300840930c7e89af5388e040199d29e
parentf4cf3c08865e39e88061c96e823b2893a68a433f (diff)
Removed relative pointers from wlr_seat
-rw-r--r--include/wlr/types/wlr_relative_pointer_v1.h5
-rw-r--r--include/wlr/types/wlr_seat.h1
-rw-r--r--rootston/cursor.c32
-rw-r--r--types/seat/wlr_seat.c4
-rw-r--r--types/seat/wlr_seat_pointer.c22
-rw-r--r--types/wlr_relative_pointer_v1.c9
6 files changed, 40 insertions, 33 deletions
diff --git a/include/wlr/types/wlr_relative_pointer_v1.h b/include/wlr/types/wlr_relative_pointer_v1.h
index 24b20003..1fd6e610 100644
--- a/include/wlr/types/wlr_relative_pointer_v1.h
+++ b/include/wlr/types/wlr_relative_pointer_v1.h
@@ -25,8 +25,9 @@
*/
struct wlr_relative_pointer_manager_v1 {
- struct wl_list resources;
struct wl_global *global;
+ struct wl_list resources;
+ struct wl_list relative_pointers;
struct {
struct wl_signal destroy;
@@ -52,7 +53,9 @@ struct wlr_relative_pointer_manager_v1 {
struct wlr_relative_pointer_v1 {
struct wl_resource *resource;
+ struct wlr_seat *seat;
struct wl_resource *pointer;
+ struct wl_list link; // wlr_relative_pointer_manager_v1::relative_pointers
struct {
struct wl_signal destroy;
diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h
index 9865ecdd..48c48d73 100644
--- a/include/wlr/types/wlr_seat.h
+++ b/include/wlr/types/wlr_seat.h
@@ -27,7 +27,6 @@ struct wlr_seat_client {
// lists of wl_resource
struct wl_list resources;
struct wl_list pointers;
- struct wl_list relative_pointers_v1;
struct wl_list keyboards;
struct wl_list touches;
struct wl_list data_devices;
diff --git a/rootston/cursor.c b/rootston/cursor.c
index 4c5fdb36..87f35435 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -305,12 +305,39 @@ static void roots_cursor_press_button(struct roots_cursor *cursor,
}
}
+static void notify_relative_motion(struct roots_seat *seat, uint64_t time_msec,
+ double dx, double dy, double dx_unaccel, double dy_unaccel) {
+
+ struct wlr_relative_pointer_manager_v1 *relative_pointer_manager =
+ seat->input->server->desktop->relative_pointer_manager;
+
+ struct wlr_seat_client *client = seat->seat->pointer_state.focused_client;
+ if (client == NULL) {
+ return;
+ }
+
+ struct wl_resource *resource;
+ wl_resource_for_each(resource, &relative_pointer_manager->relative_pointers) {
+
+ struct wlr_relative_pointer_v1 *pointer =
+ wlr_relative_pointer_v1_from_resource(resource);
+ if (pointer == NULL) {
+ continue;
+ }
+
+ wlr_relative_pointer_v1_send_relative_motion(pointer, time_msec,
+ dx, dy, dx_unaccel, dy_unaccel);
+ wl_pointer_send_frame(pointer->pointer);
+ }
+
+}
+
void roots_cursor_handle_motion(struct roots_cursor *cursor,
struct wlr_event_pointer_motion *event) {
double dx = event->delta_x;
double dy = event->delta_y;
- wlr_seat_pointer_notify_relative_motion(cursor->seat->seat,
+ notify_relative_motion(cursor->seat,
(uint64_t)event->time_msec * 1000, dx, dy, dx, dy);
if (cursor->active_constraint) {
@@ -354,7 +381,8 @@ void roots_cursor_handle_motion_absolute(struct roots_cursor *cursor,
double dx = lx - cursor->cursor->x;
double dy = ly - cursor->cursor->y;
- wlr_seat_pointer_notify_relative_motion(cursor->seat->seat,
+
+ notify_relative_motion(cursor->seat,
(uint64_t)event->time_msec * 1000, dx, dy, dx, dy);
if (cursor->pointer_view) {
diff --git a/types/seat/wlr_seat.c b/types/seat/wlr_seat.c
index 688bfc94..8b1d67fd 100644
--- a/types/seat/wlr_seat.c
+++ b/types/seat/wlr_seat.c
@@ -79,9 +79,6 @@ static void seat_client_handle_resource_destroy(
wl_resource_for_each_safe(resource, tmp, &client->pointers) {
wl_resource_destroy(resource);
}
- wl_resource_for_each_safe(resource, tmp, &client->relative_pointers_v1) {
- wl_resource_destroy(resource);
- }
wl_resource_for_each_safe(resource, tmp, &client->keyboards) {
wl_resource_destroy(resource);
}
@@ -134,7 +131,6 @@ static void seat_handle_bind(struct wl_client *client, void *_wlr_seat,
seat_client->seat = wlr_seat;
wl_list_init(&seat_client->resources);
wl_list_init(&seat_client->pointers);
- wl_list_init(&seat_client->relative_pointers_v1);
wl_list_init(&seat_client->keyboards);
wl_list_init(&seat_client->touches);
wl_list_init(&seat_client->data_devices);
diff --git a/types/seat/wlr_seat_pointer.c b/types/seat/wlr_seat_pointer.c
index 8e5fa4db..936ac0dc 100644
--- a/types/seat/wlr_seat_pointer.c
+++ b/types/seat/wlr_seat_pointer.c
@@ -305,28 +305,6 @@ void wlr_seat_pointer_notify_motion(struct wlr_seat *wlr_seat, uint32_t time,
grab->interface->motion(grab, time, sx, sy);
}
-void wlr_seat_pointer_notify_relative_motion(struct wlr_seat *wlr_seat,
- uint64_t time, double dx, double dy,
- double dx_unaccel, double dy_unaccel) {
- struct wlr_seat_client *client = wlr_seat->pointer_state.focused_client;
- if (client == NULL) {
- return;
- }
-
- struct wl_resource *resource;
- wl_resource_for_each(resource, &client->relative_pointers_v1) {
- struct wlr_relative_pointer_v1 *relative_pointer =
- wlr_relative_pointer_v1_from_resource(resource);
- if (relative_pointer == NULL) {
- continue;
- }
-
- wlr_relative_pointer_v1_send_relative_motion(relative_pointer, time,
- dx, dy, dx_unaccel, dy_unaccel);
- pointer_send_frame(relative_pointer->pointer);
- }
-}
-
uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat,
uint32_t time, uint32_t button, uint32_t state) {
clock_gettime(CLOCK_MONOTONIC, &wlr_seat->last_event);
diff --git a/types/wlr_relative_pointer_v1.c b/types/wlr_relative_pointer_v1.c
index ed01b433..ef937829 100644
--- a/types/wlr_relative_pointer_v1.c
+++ b/types/wlr_relative_pointer_v1.c
@@ -98,18 +98,20 @@ static void relative_pointer_manager_v1_handle_get_relative_pointer(struct wl_cl
}
relative_pointer->resource = relative_pointer_resource;
+ relative_pointer->seat = seat_client->seat;
relative_pointer->pointer = pointer;
wl_signal_init(&relative_pointer->events.destroy);
- wl_list_insert(&seat_client->relative_pointers_v1,
- wl_resource_get_link(relative_pointer_resource));
-
wl_resource_set_implementation(relative_pointer_resource, &relative_pointer_v1_impl,
relative_pointer, relative_pointer_v1_handle_resource_destroy);
struct wlr_relative_pointer_manager_v1 *relative_pointer_manager =
relative_pointer_manager_from_resource(resource);
+
+ wl_list_insert(&relative_pointer_manager->relative_pointers,
+ wl_resource_get_link(relative_pointer_resource));
+
wlr_signal_emit_safe(&relative_pointer_manager->events.new_relative_pointer,
relative_pointer);
@@ -174,6 +176,7 @@ struct wlr_relative_pointer_manager_v1 *wlr_relative_pointer_manager_v1_create(s
}
wl_list_init(&relative_pointer_manager->resources);
+ wl_list_init(&relative_pointer_manager->relative_pointers);
relative_pointer_manager->global = wl_global_create(display,
&zwp_relative_pointer_manager_v1_interface, RELATIVE_POINTER_MANAGER_VERSION,