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.
This commit is contained in:
Kristian Høgsberg 2014-02-11 16:35:22 -08:00
parent fe84a97f17
commit e11ef64534
4 changed files with 6 additions and 30 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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;