xdg-shell: Move "ping" and "pong" to xdg_shell, not xdg_surface

Responsivenes is a per-client thing so we move the ping/pong functionality
to xdg_shell.  Having this per-window was carries over from the EWMH
protocol, where the WM has no other way to do this.  In wayland, the
compositor can directly ping the client that owns the surface.
This commit is contained in:
Kristian Høgsberg
2014-02-11 12:22:51 -08:00
parent cbb9158162
commit 2bff94e057
5 changed files with 235 additions and 132 deletions
+11 -8
View File
@@ -264,13 +264,6 @@ init_gl(struct window *window)
glGetUniformLocation(program, "rotation");
}
static void
handle_surface_ping(void *data,
struct xdg_surface *xdg_surface, uint32_t serial)
{
xdg_surface_pong(xdg_surface, serial);
}
static void
handle_surface_configure(void *data, struct xdg_surface *surface,
int32_t width, int32_t height)
@@ -318,7 +311,6 @@ handle_surface_focused_unset(void *data, struct xdg_surface *xdg_surface)
}
static const struct xdg_surface_listener xdg_surface_listener = {
handle_surface_ping,
handle_surface_configure,
handle_surface_request_set_maximized,
handle_surface_request_unset_maximized,
@@ -715,6 +707,16 @@ static const struct wl_seat_listener seat_listener = {
seat_handle_capabilities,
};
static void
xdg_shell_ping(void *data, struct xdg_shell *shell, uint32_t serial)
{
xdg_shell_pong(shell, serial);
}
static const struct xdg_shell_listener xdg_shell_listener = {
xdg_shell_ping,
};
static void
registry_handle_global(void *data, struct wl_registry *registry,
uint32_t name, const char *interface, uint32_t version)
@@ -728,6 +730,7 @@ registry_handle_global(void *data, struct wl_registry *registry,
} else if (strcmp(interface, "xdg_shell") == 0) {
d->shell = wl_registry_bind(registry, name,
&xdg_shell_interface, 1);
xdg_shell_add_listener(d->shell, &xdg_shell_listener, d);
xdg_shell_use_unstable_version(d->shell, 1);
} else if (strcmp(interface, "wl_seat") == 0) {
d->seat = wl_registry_bind(registry, name,
+11 -7
View File
@@ -111,12 +111,6 @@ create_shm_buffer(struct display *display, struct buffer *buffer,
return 0;
}
static void
handle_ping(void *data, struct xdg_surface *surface, uint32_t serial)
{
xdg_surface_pong(surface, serial);
}
static void
handle_configure(void *data, struct xdg_surface *surface,
int32_t width, int32_t height)
@@ -154,7 +148,6 @@ handle_focused_unset(void *data, struct xdg_surface *xdg_surface)
}
static const struct xdg_surface_listener xdg_surface_listener = {
handle_ping,
handle_configure,
handle_request_set_maximized,
handle_request_unset_maximized,
@@ -328,6 +321,16 @@ struct wl_shm_listener shm_listener = {
shm_format
};
static void
xdg_shell_ping(void *data, struct xdg_shell *shell, uint32_t serial)
{
xdg_shell_pong(shell, serial);
}
static const struct xdg_shell_listener xdg_shell_listener = {
xdg_shell_ping,
};
static void
registry_handle_global(void *data, struct wl_registry *registry,
uint32_t id, const char *interface, uint32_t version)
@@ -342,6 +345,7 @@ registry_handle_global(void *data, struct wl_registry *registry,
d->shell = wl_registry_bind(registry,
id, &xdg_shell_interface, 1);
xdg_shell_use_unstable_version(d->shell, 1);
xdg_shell_add_listener(d->shell, &xdg_shell_listener, d);
} else if (strcmp(interface, "wl_shm") == 0) {
d->shm = wl_registry_bind(registry,
id, &wl_shm_interface, 1);
+11 -14
View File
@@ -3843,12 +3843,6 @@ widget_schedule_resize(struct widget *widget, int32_t width, int32_t height)
window_schedule_resize(widget->window, width, height);
}
static void
handle_surface_ping(void *data, struct xdg_surface *xdg_surface, uint32_t serial)
{
xdg_surface_pong(xdg_surface, serial);
}
static void
handle_surface_configure(void *data, struct xdg_surface *xdg_surface,
int32_t width, int32_t height)
@@ -3910,7 +3904,6 @@ handle_surface_delete(void *data, struct xdg_surface *xdg_surface)
}
static const struct xdg_surface_listener xdg_surface_listener = {
handle_surface_ping,
handle_surface_configure,
handle_surface_request_set_maximized,
handle_surface_request_unset_maximized,
@@ -4582,12 +4575,6 @@ menu_redraw_handler(struct widget *widget, void *data)
cairo_destroy(cr);
}
static void
handle_popup_ping(void *data, struct xdg_popup *xdg_popup, uint32_t serial)
{
xdg_popup_pong(xdg_popup, serial);
}
static void
handle_popup_popup_done(void *data, struct xdg_popup *xdg_popup, uint32_t serial)
{
@@ -4599,7 +4586,6 @@ handle_popup_popup_done(void *data, struct xdg_popup *xdg_popup, uint32_t serial
}
static const struct xdg_popup_listener xdg_popup_listener = {
handle_popup_ping,
handle_popup_popup_done,
};
@@ -5023,6 +5009,16 @@ struct wl_shm_listener shm_listener = {
shm_format
};
static void
xdg_shell_ping(void *data, struct xdg_shell *shell, uint32_t serial)
{
xdg_shell_pong(shell, serial);
}
static const struct xdg_shell_listener xdg_shell_listener = {
xdg_shell_ping,
};
static void
registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
const char *interface, uint32_t version)
@@ -5055,6 +5051,7 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
d->xdg_shell = wl_registry_bind(registry, id,
&xdg_shell_interface, 1);
xdg_shell_use_unstable_version(d->xdg_shell, XDG_SHELL_VERSION_CURRENT);
xdg_shell_add_listener(d->xdg_shell, &xdg_shell_listener, d);
} else if (strcmp(interface, "text_cursor_position") == 0) {
d->text_cursor_position =
wl_registry_bind(registry, id,