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 <jason@jlekstrand.net>
This commit is contained in:
parent
946a9489bf
commit
428c24e25e
@ -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
|
||||
|
||||
|
@ -35,12 +35,14 @@
|
||||
#include <wayland-client.h>
|
||||
#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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user