input: For serial generation get the display from the compositor
This removes the use of wl_client_get_display() where the client is
derived from the focussed resource. This starts the removal of the
assumption of a single resource on a client that would be notified about
events on the focussed surface.
diff --git a/src/shell.c b/src/shell.c
index ebe9b9f..8f2be78 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -2056,13 +2056,12 @@
struct wl_resource *resource;
struct shell_seat *shseat =
container_of(grab, struct shell_seat, popup_grab.grab);
- struct wl_display *display;
+ struct wl_display *display = shseat->seat->compositor->wl_display;
enum wl_pointer_button_state state = state_w;
uint32_t serial;
resource = grab->pointer->focus_resource;
if (resource) {
- display = wl_client_get_display(wl_resource_get_client(resource));
serial = wl_display_get_serial(display);
wl_pointer_send_button(resource, serial, time, button, state);
} else if (state == WL_POINTER_BUTTON_STATE_RELEASED &&
@@ -4125,8 +4124,9 @@
uint32_t key, uint32_t state)
{
struct debug_binding_grab *db = (struct debug_binding_grab *) grab;
+ struct weston_compositor *ec = db->seat->compositor;
+ struct wl_display *display = ec->wl_display;
struct wl_resource *resource;
- struct wl_display *display;
uint32_t serial;
int send = 0, terminate = 0;
int check_binding = 1;
@@ -4161,8 +4161,6 @@
}
if (check_binding) {
- struct weston_compositor *ec = db->seat->compositor;
-
if (weston_compositor_run_debug_binding(ec, db->seat, time,
key, state)) {
/* We ran a binding so swallow the press and keep the
@@ -4182,7 +4180,6 @@
resource = grab->keyboard->focus_resource;
if (resource) {
- display = wl_client_get_display(wl_resource_get_client(resource));
serial = wl_display_next_serial(display);
wl_keyboard_send_key(resource, serial, time, key, state);
}