gl/wayland: prefix shell(_surface) with wl_

This will help us make the distinction later with xdg-shell and other
possible protocols that need to be supported.
This commit is contained in:
Niels De Graef 2018-12-14 14:28:26 +01:00 committed by Matthew Waters
parent 91863b071f
commit 808e712767
4 changed files with 24 additions and 23 deletions

View file

@ -51,7 +51,8 @@ registry_handle_global (void *data, struct wl_registry *registry,
display->subcompositor = display->subcompositor =
wl_registry_bind (registry, name, &wl_subcompositor_interface, 1); wl_registry_bind (registry, name, &wl_subcompositor_interface, 1);
} else if (g_strcmp0 (interface, "wl_shell") == 0) { } else if (g_strcmp0 (interface, "wl_shell") == 0) {
display->shell = wl_registry_bind (registry, name, &wl_shell_interface, 1); display->wl_shell =
wl_registry_bind (registry, name, &wl_shell_interface, 1);
} }
} }
@ -91,7 +92,7 @@ gst_gl_display_wayland_finalize (GObject * object)
{ {
GstGLDisplayWayland *display_wayland = GST_GL_DISPLAY_WAYLAND (object); GstGLDisplayWayland *display_wayland = GST_GL_DISPLAY_WAYLAND (object);
g_clear_pointer (&display_wayland->shell, wl_shell_destroy); g_clear_pointer (&display_wayland->wl_shell, wl_shell_destroy);
/* Cause eglTerminate() to occur before wl_display_disconnect() /* Cause eglTerminate() to occur before wl_display_disconnect()
* https://bugzilla.gnome.org/show_bug.cgi?id=787293 */ * https://bugzilla.gnome.org/show_bug.cgi?id=787293 */

View file

@ -56,7 +56,7 @@ struct _GstGLDisplayWayland
struct wl_registry *registry; struct wl_registry *registry;
struct wl_compositor *compositor; struct wl_compositor *compositor;
struct wl_subcompositor *subcompositor; struct wl_subcompositor *subcompositor;
struct wl_shell *shell; struct wl_shell *wl_shell;
/* <private> */ /* <private> */
gboolean foreign_display; gboolean foreign_display;

View file

@ -140,11 +140,11 @@ pointer_handle_button (void *data, struct wl_pointer *pointer, uint32_t serial,
window_egl->display.serial = serial; window_egl->display.serial = serial;
if (button == BTN_LEFT && state_w == WL_POINTER_BUTTON_STATE_PRESSED) if (button == BTN_LEFT && state_w == WL_POINTER_BUTTON_STATE_PRESSED)
wl_shell_surface_move (window_egl->window.shell_surface, wl_shell_surface_move (window_egl->window.wl_shell_surface,
window_egl->display.seat, serial); window_egl->display.seat, serial);
if (button == BTN_RIGHT && state_w == WL_POINTER_BUTTON_STATE_PRESSED) if (button == BTN_RIGHT && state_w == WL_POINTER_BUTTON_STATE_PRESSED)
wl_shell_surface_resize (window_egl->window.shell_surface, wl_shell_surface_resize (window_egl->window.wl_shell_surface,
window_egl->display.seat, serial, edges); window_egl->display.seat, serial, edges);
} }
@ -194,37 +194,37 @@ static const struct wl_seat_listener seat_listener = {
}; };
#endif #endif
static void static void
handle_ping (void *data, struct wl_shell_surface *shell_surface, handle_ping (void *data, struct wl_shell_surface *wl_shell_surface,
uint32_t serial) uint32_t serial)
{ {
GstGLWindowWaylandEGL *window_egl = data; GstGLWindowWaylandEGL *window_egl = data;
GST_TRACE_OBJECT (window_egl, "ping received serial %u", serial); GST_TRACE_OBJECT (window_egl, "ping received serial %u", serial);
wl_shell_surface_pong (shell_surface, serial); wl_shell_surface_pong (wl_shell_surface, serial);
} }
static void window_resize (GstGLWindowWaylandEGL * window_egl, guint width, static void window_resize (GstGLWindowWaylandEGL * window_egl, guint width,
guint height); guint height);
static void static void
handle_configure (void *data, struct wl_shell_surface *shell_surface, handle_configure (void *data, struct wl_shell_surface *wl_shell_surface,
uint32_t edges, int32_t width, int32_t height) uint32_t edges, int32_t width, int32_t height)
{ {
GstGLWindowWaylandEGL *window_egl = data; GstGLWindowWaylandEGL *window_egl = data;
GST_DEBUG ("configure event on surface %p, %ix%i", shell_surface, width, GST_DEBUG ("configure event on surface %p, %ix%i", wl_shell_surface, width,
height); height);
window_resize (window_egl, width, height); window_resize (window_egl, width, height);
} }
static void static void
handle_popup_done (void *data, struct wl_shell_surface *shell_surface) handle_popup_done (void *data, struct wl_shell_surface *wl_shell_surface)
{ {
} }
static const struct wl_shell_surface_listener shell_surface_listener = { static const struct wl_shell_surface_listener wl_shell_surface_listener = {
handle_ping, handle_ping,
handle_configure, handle_configure,
handle_popup_done handle_popup_done
@ -237,9 +237,9 @@ destroy_surfaces (GstGLWindowWaylandEGL * window_egl)
wl_subsurface_destroy (window_egl->window.subsurface); wl_subsurface_destroy (window_egl->window.subsurface);
window_egl->window.subsurface = NULL; window_egl->window.subsurface = NULL;
} }
if (window_egl->window.shell_surface) { if (window_egl->window.wl_shell_surface) {
wl_shell_surface_destroy (window_egl->window.shell_surface); wl_shell_surface_destroy (window_egl->window.wl_shell_surface);
window_egl->window.shell_surface = NULL; window_egl->window.wl_shell_surface = NULL;
} }
if (window_egl->window.surface) { if (window_egl->window.surface) {
wl_surface_destroy (window_egl->window.surface); wl_surface_destroy (window_egl->window.surface);
@ -289,20 +289,20 @@ create_surfaces (GstGLWindowWaylandEGL * window_egl)
} }
} else { } else {
shell_window: shell_window:
if (!window_egl->window.shell_surface) { if (!window_egl->window.wl_shell_surface) {
window_egl->window.shell_surface = window_egl->window.wl_shell_surface =
wl_shell_get_shell_surface (display->shell, wl_shell_get_shell_surface (display->wl_shell,
window_egl->window.surface); window_egl->window.surface);
if (window_egl->window.queue) if (window_egl->window.queue)
wl_proxy_set_queue ((struct wl_proxy *) window_egl-> wl_proxy_set_queue ((struct wl_proxy *) window_egl->
window.shell_surface, window_egl->window.queue); window.wl_shell_surface, window_egl->window.queue);
wl_shell_surface_add_listener (window_egl->window.shell_surface, wl_shell_surface_add_listener (window_egl->window.wl_shell_surface,
&shell_surface_listener, window_egl); &wl_shell_surface_listener, window_egl);
wl_shell_surface_set_title (window_egl->window.shell_surface, wl_shell_surface_set_title (window_egl->window.wl_shell_surface,
"OpenGL Renderer"); "OpenGL Renderer");
wl_shell_surface_set_toplevel (window_egl->window.shell_surface); wl_shell_surface_set_toplevel (window_egl->window.wl_shell_surface);
} }
} }

View file

@ -65,7 +65,7 @@ struct window {
struct wl_event_queue *queue; struct wl_event_queue *queue;
struct wl_surface *surface; struct wl_surface *surface;
struct wl_shell_surface *shell_surface; struct wl_shell_surface *wl_shell_surface;
struct wl_egl_window *native; struct wl_egl_window *native;
struct wl_surface *foreign_surface; struct wl_surface *foreign_surface;
struct wl_subsurface *subsurface; struct wl_subsurface *subsurface;