From e11ef64534d7faed2a2efa1f03d2b8e330b2eb6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 11 Feb 2014 16:35:22 -0800 Subject: [PATCH] compositor: Drop core ping_handler callout This was always a little iffy. At least it could have been a signal, but we now have focus signal, so lets just use that. We lose the ability to detect unresponsive clients at key event time, but we could add that back by adding a key_signal. --- desktop-shell/shell.c | 16 ++++++---------- src/compositor.c | 2 -- src/compositor.h | 2 -- src/input.c | 16 ---------------- 4 files changed, 6 insertions(+), 30 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 8c8e4eba..a47bbe70 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -1876,6 +1876,10 @@ handle_wl_shell_ping(struct shell_surface *shsurf, uint32_t serial) if (shsurf->ping_timer) return; + if (shsurf->unresponsive) { + ping_timeout_handler(shsurf); + return; + } shsurf->ping_timer = malloc(sizeof *shsurf->ping_timer); if (!shsurf->ping_timer) @@ -1975,21 +1979,14 @@ handle_pointer_focus(struct wl_listener *listener, void *data) struct weston_pointer *pointer = data; struct weston_view *view = pointer->focus; struct weston_compositor *compositor; - struct shell_surface *shsurf; uint32_t serial; if (!view) return; compositor = view->surface->compositor; - shsurf = get_shell_surface(view->surface); - - if (shsurf && shsurf->unresponsive) { - set_busy_cursor(shsurf, pointer); - } else { - serial = wl_display_next_serial(compositor->wl_display); - ping_handler(view->surface, serial); - } + serial = wl_display_next_serial(compositor->wl_display); + ping_handler(view->surface, serial); } static void @@ -5909,7 +5906,6 @@ module_init(struct weston_compositor *ec, shell->wake_listener.notify = wake_handler; wl_signal_add(&ec->wake_signal, &shell->wake_listener); - ec->ping_handler = ping_handler; ec->shell_interface.shell = shell; ec->shell_interface.create_shell_surface = create_shell_surface; ec->shell_interface.get_primary_view = get_primary_view; diff --git a/src/compositor.c b/src/compositor.c index 9de3a904..7c29d51a 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -3588,8 +3588,6 @@ weston_compositor_init(struct weston_compositor *ec, if (weston_compositor_xkb_init(ec, &xkb_names) < 0) return -1; - ec->ping_handler = NULL; - screenshooter_create(ec); text_backend_init(ec); diff --git a/src/compositor.h b/src/compositor.h index 63e4e2c6..8778affe 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -622,8 +622,6 @@ struct weston_compositor { void (*restore)(struct weston_compositor *ec); int (*authenticate)(struct weston_compositor *c, uint32_t id); - void (*ping_handler)(struct weston_surface *surface, uint32_t serial); - struct weston_launcher *launcher; uint32_t output_id_pool; diff --git a/src/input.c b/src/input.c index e20c870d..b5efe73c 100644 --- a/src/input.c +++ b/src/input.c @@ -1000,13 +1000,8 @@ notify_button(struct weston_seat *seat, uint32_t time, int32_t button, { struct weston_compositor *compositor = seat->compositor; struct weston_pointer *pointer = seat->pointer; - struct weston_surface *focus = - (struct weston_surface *) pointer->focus; - uint32_t serial = wl_display_next_serial(compositor->wl_display); if (state == WL_POINTER_BUTTON_STATE_PRESSED) { - if (compositor->ping_handler && focus) - compositor->ping_handler(focus, serial); weston_compositor_idle_inhibit(compositor); if (pointer->button_count == 0) { pointer->grab_button = button; @@ -1036,15 +1031,9 @@ notify_axis(struct weston_seat *seat, uint32_t time, uint32_t axis, { struct weston_compositor *compositor = seat->compositor; struct weston_pointer *pointer = seat->pointer; - struct weston_surface *focus = - (struct weston_surface *) pointer->focus; - uint32_t serial = wl_display_next_serial(compositor->wl_display); struct wl_resource *resource; struct wl_list *resource_list; - if (compositor->ping_handler && focus) - compositor->ping_handler(focus, serial); - weston_compositor_wake(compositor); if (!value) @@ -1260,15 +1249,10 @@ notify_key(struct weston_seat *seat, uint32_t time, uint32_t key, { struct weston_compositor *compositor = seat->compositor; struct weston_keyboard *keyboard = seat->keyboard; - struct weston_surface *focus = keyboard->focus; struct weston_keyboard_grab *grab = keyboard->grab; - uint32_t serial = wl_display_next_serial(compositor->wl_display); uint32_t *k, *end; if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { - if (compositor->ping_handler && focus) - compositor->ping_handler(focus, serial); - weston_compositor_idle_inhibit(compositor); keyboard->grab_key = key; keyboard->grab_time = time;