From 428c24e25e3196630eaed43ce5bf7f7e00a01c74 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 2 Apr 2014 19:53:48 -0500 Subject: [PATCH] simple-shm: Add wl_fullscreen_shell support This makes simple-shm act like a very simple fullscreen shell client. This is the kind of interaction one would expect out of a boot splash screen or similar. Signed-off-by: Jason Ekstrand --- Makefile.am | 6 +++++- clients/simple-shm.c | 31 ++++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9beee99..5b6b523 100644 --- a/Makefile.am +++ b/Makefile.am @@ -389,7 +389,9 @@ demo_clients += \ weston_simple_shm_SOURCES = clients/simple-shm.c nodist_weston_simple_shm_SOURCES = \ protocol/xdg-shell-protocol.c \ - protocol/xdg-shell-client-protocol.h + protocol/xdg-shell-client-protocol.h \ + protocol/fullscreen-shell-protocol.c \ + protocol/fullscreen-shell-client-protocol.h weston_simple_shm_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS) weston_simple_shm_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la @@ -605,6 +607,8 @@ BUILT_SOURCES += \ protocol/scaler-protocol.c \ protocol/workspaces-client-protocol.h \ protocol/workspaces-protocol.c \ + protocol/fullscreen-shell-protocol.c \ + protocol/fullscreen-shell-client-protocol.h \ protocol/xdg-shell-protocol.c \ protocol/xdg-shell-client-protocol.h diff --git a/clients/simple-shm.c b/clients/simple-shm.c index 0296028..2087a0e 100644 --- a/clients/simple-shm.c +++ b/clients/simple-shm.c @@ -35,12 +35,14 @@ #include #include "../shared/os-compatibility.h" #include "xdg-shell-client-protocol.h" +#include "fullscreen-shell-client-protocol.h" struct display { struct wl_display *display; struct wl_registry *registry; struct wl_compositor *compositor; struct xdg_shell *shell; + struct _wl_fullscreen_shell *fshell; struct wl_shm *shm; uint32_t formats; }; @@ -165,14 +167,26 @@ create_window(struct display *display, int width, int height) window->width = width; window->height = height; window->surface = wl_compositor_create_surface(display->compositor); - window->xdg_surface = xdg_shell_get_xdg_surface(display->shell, - window->surface); - if (window->xdg_surface) + if (display->shell) { + window->xdg_surface = + xdg_shell_get_xdg_surface(display->shell, + window->surface); + + assert(window->xdg_surface); + xdg_surface_add_listener(window->xdg_surface, &xdg_surface_listener, window); - xdg_surface_set_title(window->xdg_surface, "simple-shm"); + xdg_surface_set_title(window->xdg_surface, "simple-shm"); + } else if (display->fshell) { + _wl_fullscreen_shell_present_surface(display->fshell, + window->surface, + _WL_FULLSCREEN_SHELL_PRESENT_METHOD_DEFAULT, + NULL); + } else { + assert(0); + } return window; } @@ -188,7 +202,8 @@ destroy_window(struct window *window) if (window->buffers[1].buffer) wl_buffer_destroy(window->buffers[1].buffer); - xdg_surface_destroy(window->xdg_surface); + if (window->xdg_surface) + xdg_surface_destroy(window->xdg_surface); wl_surface_destroy(window->surface); free(window); } @@ -346,6 +361,9 @@ registry_handle_global(void *data, struct wl_registry *registry, id, &xdg_shell_interface, 1); xdg_shell_use_unstable_version(d->shell, XDG_VERSION); xdg_shell_add_listener(d->shell, &xdg_shell_listener, d); + } else if (strcmp(interface, "_wl_fullscreen_shell") == 0) { + d->fshell = wl_registry_bind(registry, + id, &_wl_fullscreen_shell_interface, 1); } else if (strcmp(interface, "wl_shm") == 0) { d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); @@ -408,6 +426,9 @@ destroy_display(struct display *display) if (display->shell) xdg_shell_destroy(display->shell); + if (display->fshell) + _wl_fullscreen_shell_release(display->fshell); + if (display->compositor) wl_compositor_destroy(display->compositor); -- 2.7.4