Use fullscreen-shell.xml from wayland-protocols

Use the fullscreen-shell protocol XML from the wayland-protocols
installation, and remove the one we provide ourself.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Jonas Ådahl 9 years ago committed by Pekka Paalanen
parent 4bcc54d1a5
commit 496adb3bb3
  1. 44
      Makefile.am
  2. 60
      clients/fullscreen.c
  3. 18
      clients/simple-damage.c
  4. 18
      clients/simple-dmabuf.c
  5. 18
      clients/simple-shm.c
  6. 4
      configure.ac
  7. 55
      fullscreen-shell/fullscreen-shell.c
  8. 206
      protocol/fullscreen-shell.xml
  9. 58
      src/compositor-wayland.c
  10. 36
      src/screen-share.c

@ -309,8 +309,8 @@ wayland_backend_la_SOURCES = \
src/compositor-wayland.c \
shared/helpers.h
nodist_wayland_backend_la_SOURCES = \
protocol/fullscreen-shell-protocol.c \
protocol/fullscreen-shell-client-protocol.h
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h
endif
if ENABLE_RPI_COMPOSITOR
@ -475,8 +475,8 @@ 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/fullscreen-shell-protocol.c \
protocol/fullscreen-shell-client-protocol.h \
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/ivi-application-protocol.c \
protocol/ivi-application-client-protocol.h
weston_simple_shm_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
@ -488,8 +488,8 @@ nodist_weston_simple_damage_SOURCES = \
protocol/scaler-client-protocol.h \
protocol/xdg-shell-protocol.c \
protocol/xdg-shell-client-protocol.h \
protocol/fullscreen-shell-protocol.c \
protocol/fullscreen-shell-client-protocol.h
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h
weston_simple_damage_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
weston_simple_damage_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la
@ -531,8 +531,8 @@ weston_simple_dmabuf_SOURCES = clients/simple-dmabuf.c
nodist_weston_simple_dmabuf_SOURCES = \
protocol/xdg-shell-protocol.c \
protocol/xdg-shell-client-protocol.h \
protocol/fullscreen-shell-protocol.c \
protocol/fullscreen-shell-client-protocol.h \
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/linux-dmabuf-protocol.c \
protocol/linux-dmabuf-client-protocol.h
weston_simple_dmabuf_CFLAGS = $(AM_CFLAGS) $(SIMPLE_DMABUF_CLIENT_CFLAGS)
@ -649,8 +649,8 @@ weston_transformed_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
weston_fullscreen_SOURCES = clients/fullscreen.c
nodist_weston_fullscreen_SOURCES = \
protocol/fullscreen-shell-protocol.c \
protocol/fullscreen-shell-client-protocol.h
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h
weston_fullscreen_LDADD = libtoytoolkit.la
weston_fullscreen_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
@ -763,8 +763,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/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/xdg-shell-protocol.c \
protocol/xdg-shell-client-protocol.h \
protocol/ivi-hmi-controller-protocol.c \
@ -865,8 +865,8 @@ fullscreen_shell_la_SOURCES = \
fullscreen-shell/fullscreen-shell.c \
shared/helpers.h
nodist_fullscreen_shell_la_SOURCES = \
protocol/fullscreen-shell-protocol.c \
protocol/fullscreen-shell-server-protocol.h
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-server-protocol.h
BUILT_SOURCES += $(nodist_fullscreen_shell_la_SOURCES)
endif
@ -931,8 +931,8 @@ screen_share_la_SOURCES = \
src/screen-share.c \
shared/helpers.h
nodist_screen_share_la_SOURCES = \
protocol/fullscreen-shell-protocol.c \
protocol/fullscreen-shell-client-protocol.h
protocol/fullscreen-shell-unstable-v1-protocol.c \
protocol/fullscreen-shell-unstable-v1-client-protocol.h
endif
@ -1348,7 +1348,6 @@ EXTRA_DIST += \
protocol/text-cursor-position.xml \
protocol/weston-test.xml \
protocol/xdg-shell.xml \
protocol/fullscreen-shell.xml \
protocol/presentation_timing.xml \
protocol/scaler.xml \
protocol/ivi-application.xml \
@ -1417,6 +1416,17 @@ $(DOCDIRS):
doc: $(DOXYGEN_INDICES)
.SECONDEXPANSION:
protocol/%-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/$$*/$$*-unstable-v1.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@
protocol/%-unstable-v1-server-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/$$*/$$*-unstable-v1.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) server-header < $< > $@
protocol/%-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/$$*/$$*-unstable-v1.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header < $< > $@
protocol/%-protocol.c : $(top_srcdir)/protocol/%.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@

@ -35,7 +35,7 @@
#include <linux/input.h>
#include <wayland-client.h>
#include "window.h"
#include "fullscreen-shell-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
struct fs_output {
struct wl_list link;
@ -46,8 +46,8 @@ struct fullscreen {
struct display *display;
struct window *window;
struct widget *widget;
struct _wl_fullscreen_shell *fshell;
enum _wl_fullscreen_shell_present_method present_method;
struct zwp_fullscreen_shell_v1 *fshell;
enum zwp_fullscreen_shell_v1_present_method present_method;
int width, height;
int fullscreen;
float pointer_x, pointer_y;
@ -293,10 +293,10 @@ key_handler(struct window *window, struct input *input, uint32_t time,
if (fullscreen->current_output)
wl_output = output_get_wl_output(fullscreen->current_output->output);
fullscreen->present_method = (fullscreen->present_method + 1) % 5;
_wl_fullscreen_shell_present_surface(fullscreen->fshell,
window_get_wl_surface(fullscreen->window),
fullscreen->present_method,
wl_output);
zwp_fullscreen_shell_v1_present_surface(fullscreen->fshell,
window_get_wl_surface(fullscreen->window),
fullscreen->present_method,
wl_output);
window_schedule_redraw(window);
break;
@ -308,8 +308,8 @@ key_handler(struct window *window, struct input *input, uint32_t time,
wl_output = fsout ? output_get_wl_output(fsout->output) : NULL;
/* Clear the current presentation */
_wl_fullscreen_shell_present_surface(fullscreen->fshell, NULL,
0, wl_output);
zwp_fullscreen_shell_v1_present_surface(fullscreen->fshell, NULL,
0, wl_output);
if (fullscreen->current_output) {
if (fullscreen->current_output->link.next == &fullscreen->output_list)
@ -324,10 +324,10 @@ key_handler(struct window *window, struct input *input, uint32_t time,
fullscreen->current_output = fsout;
wl_output = fsout ? output_get_wl_output(fsout->output) : NULL;
_wl_fullscreen_shell_present_surface(fullscreen->fshell,
window_get_wl_surface(fullscreen->window),
fullscreen->present_method,
wl_output);
zwp_fullscreen_shell_v1_present_surface(fullscreen->fshell,
window_get_wl_surface(fullscreen->window),
fullscreen->present_method,
wl_output);
window_schedule_redraw(window);
break;
@ -338,10 +338,10 @@ key_handler(struct window *window, struct input *input, uint32_t time,
wl_output = NULL;
if (fullscreen->current_output)
wl_output = output_get_wl_output(fullscreen->current_output->output);
_wl_fullscreen_shell_mode_feedback_destroy(
_wl_fullscreen_shell_present_surface_for_mode(fullscreen->fshell,
window_get_wl_surface(fullscreen->window),
wl_output, 0));
zwp_fullscreen_shell_mode_feedback_v1_destroy(
zwp_fullscreen_shell_v1_present_surface_for_mode(fullscreen->fshell,
window_get_wl_surface(fullscreen->window),
wl_output, 0));
window_schedule_redraw(window);
break;
@ -420,13 +420,13 @@ touch_handler(struct widget *widget, struct input *input,
}
static void
fshell_capability_handler(void *data, struct _wl_fullscreen_shell *fshell,
fshell_capability_handler(void *data, struct zwp_fullscreen_shell_v1 *fshell,
uint32_t capability)
{
struct fullscreen *fullscreen = data;
switch (capability) {
case _WL_FULLSCREEN_SHELL_CAPABILITY_CURSOR_PLANE:
case ZWP_FULLSCREEN_SHELL_V1_CAPABILITY_CURSOR_PLANE:
fullscreen->draw_cursor = 0;
break;
default:
@ -434,7 +434,7 @@ fshell_capability_handler(void *data, struct _wl_fullscreen_shell *fshell,
}
}
struct _wl_fullscreen_shell_listener fullscreen_shell_listener = {
struct zwp_fullscreen_shell_v1_listener fullscreen_shell_listener = {
fshell_capability_handler
};
@ -471,13 +471,13 @@ global_handler(struct display *display, uint32_t id, const char *interface,
{
struct fullscreen *fullscreen = data;
if (strcmp(interface, "_wl_fullscreen_shell") == 0) {
if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
fullscreen->fshell = display_bind(display, id,
&_wl_fullscreen_shell_interface,
&zwp_fullscreen_shell_v1_interface,
1);
_wl_fullscreen_shell_add_listener(fullscreen->fshell,
&fullscreen_shell_listener,
fullscreen);
zwp_fullscreen_shell_v1_add_listener(fullscreen->fshell,
&fullscreen_shell_listener,
fullscreen);
}
}
@ -490,7 +490,7 @@ int main(int argc, char *argv[])
fullscreen.width = 640;
fullscreen.height = 480;
fullscreen.fullscreen = 0;
fullscreen.present_method = _WL_FULLSCREEN_SHELL_PRESENT_METHOD_DEFAULT;
fullscreen.present_method = ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_DEFAULT;
wl_list_init(&fullscreen.output_list);
fullscreen.current_output = NULL;
@ -525,10 +525,10 @@ int main(int argc, char *argv[])
if (fullscreen.fshell) {
fullscreen.window = window_create_custom(d);
_wl_fullscreen_shell_present_surface(fullscreen.fshell,
window_get_wl_surface(fullscreen.window),
fullscreen.present_method,
NULL);
zwp_fullscreen_shell_v1_present_surface(fullscreen.fshell,
window_get_wl_surface(fullscreen.window),
fullscreen.present_method,
NULL);
/* If we get the CURSOR_PLANE capability, we'll change this */
fullscreen.draw_cursor = 1;
} else {

@ -38,7 +38,7 @@
#include <wayland-client.h>
#include "shared/os-compatibility.h"
#include "xdg-shell-client-protocol.h"
#include "fullscreen-shell-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
#include "scaler-client-protocol.h"
int print_debug = 0;
@ -50,7 +50,7 @@ struct display {
struct wl_compositor *compositor;
struct wl_scaler *scaler;
struct xdg_shell *shell;
struct _wl_fullscreen_shell *fshell;
struct zwp_fullscreen_shell_v1 *fshell;
struct wl_shm *shm;
uint32_t formats;
};
@ -294,10 +294,10 @@ create_window(struct display *display, int width, int height,
xdg_surface_set_title(window->xdg_surface, "simple-damage");
} else if (display->fshell) {
_wl_fullscreen_shell_present_surface(display->fshell,
window->surface,
_WL_FULLSCREEN_SHELL_PRESENT_METHOD_DEFAULT,
NULL);
zwp_fullscreen_shell_v1_present_surface(display->fshell,
window->surface,
ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_DEFAULT,
NULL);
} else {
assert(0);
}
@ -677,9 +677,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) {
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
d->fshell = wl_registry_bind(registry,
id, &_wl_fullscreen_shell_interface, 1);
id, &zwp_fullscreen_shell_v1_interface, 1);
} else if (strcmp(interface, "wl_shm") == 0) {
d->shm = wl_registry_bind(registry,
id, &wl_shm_interface, 1);
@ -742,7 +742,7 @@ destroy_display(struct display *display)
xdg_shell_destroy(display->shell);
if (display->fshell)
_wl_fullscreen_shell_release(display->fshell);
zwp_fullscreen_shell_v1_release(display->fshell);
if (display->scaler)
wl_scaler_destroy(display->scaler);

@ -41,7 +41,7 @@
#include <wayland-client.h>
#include "xdg-shell-client-protocol.h"
#include "fullscreen-shell-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
#include "linux-dmabuf-client-protocol.h"
struct display {
@ -49,7 +49,7 @@ struct display {
struct wl_registry *registry;
struct wl_compositor *compositor;
struct xdg_shell *shell;
struct _wl_fullscreen_shell *fshell;
struct zwp_fullscreen_shell_v1 *fshell;
struct zlinux_dmabuf *dmabuf;
int xrgb8888_format_found;
};
@ -336,10 +336,10 @@ create_window(struct display *display, int width, int height)
xdg_surface_set_title(window->xdg_surface, "simple-dmabuf");
} else if (display->fshell) {
_wl_fullscreen_shell_present_surface(display->fshell,
window->surface,
_WL_FULLSCREEN_SHELL_PRESENT_METHOD_DEFAULT,
NULL);
zwp_fullscreen_shell_v1_present_surface(display->fshell,
window->surface,
ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_DEFAULT,
NULL);
} else {
assert(0);
}
@ -473,9 +473,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) {
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
d->fshell = wl_registry_bind(registry,
id, &_wl_fullscreen_shell_interface, 1);
id, &zwp_fullscreen_shell_v1_interface, 1);
} else if (strcmp(interface, "zlinux_dmabuf") == 0) {
d->dmabuf = wl_registry_bind(registry,
id, &zlinux_dmabuf_interface, 1);
@ -539,7 +539,7 @@ destroy_display(struct display *display)
xdg_shell_destroy(display->shell);
if (display->fshell)
_wl_fullscreen_shell_release(display->fshell);
zwp_fullscreen_shell_v1_release(display->fshell);
if (display->compositor)
wl_compositor_destroy(display->compositor);

@ -36,7 +36,7 @@
#include <wayland-client.h>
#include "shared/os-compatibility.h"
#include "xdg-shell-client-protocol.h"
#include "fullscreen-shell-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
#include <sys/types.h>
#include "ivi-application-client-protocol.h"
@ -47,7 +47,7 @@ struct display {
struct wl_registry *registry;
struct wl_compositor *compositor;
struct xdg_shell *shell;
struct _wl_fullscreen_shell *fshell;
struct zwp_fullscreen_shell_v1 *fshell;
struct wl_shm *shm;
uint32_t formats;
struct ivi_application *ivi_application;
@ -180,10 +180,10 @@ create_window(struct display *display, int width, int height)
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);
zwp_fullscreen_shell_v1_present_surface(display->fshell,
window->surface,
ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_DEFAULT,
NULL);
} else if (display->ivi_application ) {
uint32_t id_ivisurf = IVI_SURFACE_ID + (uint32_t)getpid();
window->ivi_surface =
@ -374,9 +374,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) {
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
d->fshell = wl_registry_bind(registry,
id, &_wl_fullscreen_shell_interface, 1);
id, &zwp_fullscreen_shell_v1_interface, 1);
} else if (strcmp(interface, "wl_shm") == 0) {
d->shm = wl_registry_bind(registry,
id, &wl_shm_interface, 1);
@ -483,7 +483,7 @@ destroy_display(struct display *display)
xdg_shell_destroy(display->shell);
if (display->fshell)
_wl_fullscreen_shell_release(display->fshell);
zwp_fullscreen_shell_v1_release(display->fshell);
if (display->compositor)
wl_compositor_destroy(display->compositor);

@ -181,6 +181,10 @@ fi
PKG_CHECK_MODULES(LIBINPUT_BACKEND, [libinput >= 0.8.0])
PKG_CHECK_MODULES(COMPOSITOR, [$COMPOSITOR_MODULES])
PKG_CHECK_MODULES(WAYLAND_PROTOCOLS, [wayland-protocols >= 0.1.0],
[ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`])
AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
AC_ARG_ENABLE(wayland-compositor, [ --enable-wayland-compositor],,
enable_wayland_compositor=yes)
AM_CONDITIONAL(ENABLE_WAYLAND_COMPOSITOR,

@ -33,7 +33,7 @@
#include <assert.h>
#include "compositor.h"
#include "fullscreen-shell-server-protocol.h"
#include "fullscreen-shell-unstable-v1-server-protocol.h"
#include "shared/helpers.h"
struct fullscreen_shell {
@ -61,7 +61,7 @@ struct fs_output {
struct wl_resource *mode_feedback;
int presented_for_mode;
enum _wl_fullscreen_shell_present_method method;
enum zwp_fullscreen_shell_v1_present_method method;
int32_t framerate;
} pending;
@ -72,7 +72,7 @@ struct fs_output {
struct weston_transform transform; /* matrix from x, y */
int presented_for_mode;
enum _wl_fullscreen_shell_present_method method;
enum zwp_fullscreen_shell_v1_present_method method;
uint32_t framerate;
};
@ -198,7 +198,7 @@ create_black_surface(struct weston_compositor *ec, struct fs_output *fsout,
static void
fs_output_set_surface(struct fs_output *fsout, struct weston_surface *surface,
enum _wl_fullscreen_shell_present_method method,
enum zwp_fullscreen_shell_v1_present_method method,
int32_t framerate, int presented_for_mode);
static void
fs_output_apply_pending(struct fs_output *fsout);
@ -405,12 +405,12 @@ fs_output_configure_simple(struct fs_output *fsout,
surface_aspect = (float) surf_width / (float) surf_height;
switch (fsout->method) {
case _WL_FULLSCREEN_SHELL_PRESENT_METHOD_DEFAULT:
case _WL_FULLSCREEN_SHELL_PRESENT_METHOD_CENTER:
case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_DEFAULT:
case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_CENTER:
fs_output_center_view(fsout);
break;
case _WL_FULLSCREEN_SHELL_PRESENT_METHOD_ZOOM:
case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_ZOOM:
if (output_aspect < surface_aspect)
fs_output_scale_view(fsout,
output->width,
@ -421,7 +421,7 @@ fs_output_configure_simple(struct fs_output *fsout,
output->height);
break;
case _WL_FULLSCREEN_SHELL_PRESENT_METHOD_ZOOM_CROP:
case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_ZOOM_CROP:
if (output_aspect < surface_aspect)
fs_output_scale_view(fsout,
output->height * surface_aspect,
@ -432,7 +432,7 @@ fs_output_configure_simple(struct fs_output *fsout,
output->width / surface_aspect);
break;
case _WL_FULLSCREEN_SHELL_PRESENT_METHOD_STRETCH:
case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_STRETCH:
fs_output_scale_view(fsout, output->width, output->height);
break;
default:
@ -498,7 +498,7 @@ fs_output_configure_for_mode(struct fs_output *fsout,
/* The mode switch failed. Clear the pending and
* reconfigure as per normal */
if (fsout->pending.mode_feedback) {
_wl_fullscreen_shell_mode_feedback_send_mode_failed(
zwp_fullscreen_shell_mode_feedback_v1_send_mode_failed(
fsout->pending.mode_feedback);
wl_resource_destroy(fsout->pending.mode_feedback);
fsout->pending.mode_feedback = NULL;
@ -509,7 +509,7 @@ fs_output_configure_for_mode(struct fs_output *fsout,
}
if (fsout->pending.mode_feedback) {
_wl_fullscreen_shell_mode_feedback_send_mode_successful(
zwp_fullscreen_shell_mode_feedback_v1_send_mode_successful(
fsout->pending.mode_feedback);
wl_resource_destroy(fsout->pending.mode_feedback);
fsout->pending.mode_feedback = NULL;
@ -605,7 +605,7 @@ fs_output_clear_pending(struct fs_output *fsout)
return;
if (fsout->pending.mode_feedback) {
_wl_fullscreen_shell_mode_feedback_send_present_cancelled(
zwp_fullscreen_shell_mode_feedback_v1_send_present_cancelled(
fsout->pending.mode_feedback);
wl_resource_destroy(fsout->pending.mode_feedback);
fsout->pending.mode_feedback = NULL;
@ -617,7 +617,7 @@ fs_output_clear_pending(struct fs_output *fsout)
static void
fs_output_set_surface(struct fs_output *fsout, struct weston_surface *surface,
enum _wl_fullscreen_shell_present_method method,
enum zwp_fullscreen_shell_v1_present_method method,
int32_t framerate, int presented_for_mode)
{
fs_output_clear_pending(fsout);
@ -677,15 +677,15 @@ fullscreen_shell_present_surface(struct wl_client *client,
surface = surface_res ? wl_resource_get_user_data(surface_res) : NULL;
switch(method) {
case _WL_FULLSCREEN_SHELL_PRESENT_METHOD_DEFAULT:
case _WL_FULLSCREEN_SHELL_PRESENT_METHOD_CENTER:
case _WL_FULLSCREEN_SHELL_PRESENT_METHOD_ZOOM:
case _WL_FULLSCREEN_SHELL_PRESENT_METHOD_ZOOM_CROP:
case _WL_FULLSCREEN_SHELL_PRESENT_METHOD_STRETCH:
case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_DEFAULT:
case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_CENTER:
case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_ZOOM:
case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_ZOOM_CROP:
case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_STRETCH:
break;
default:
wl_resource_post_error(resource,
_WL_FULLSCREEN_SHELL_ERROR_INVALID_METHOD,
ZWP_FULLSCREEN_SHELL_V1_ERROR_INVALID_METHOD,
"Invalid presentation method");
}
@ -745,7 +745,7 @@ fullscreen_shell_present_surface_for_mode(struct wl_client *client,
fsout->pending.mode_feedback =
wl_resource_create(client,
&_wl_fullscreen_shell_mode_feedback_interface,
&zwp_fullscreen_shell_mode_feedback_v1_interface,
1, feedback_id);
wl_resource_set_implementation(fsout->pending.mode_feedback, NULL,
fsout, mode_feedback_destroyed);
@ -759,7 +759,7 @@ fullscreen_shell_present_surface_for_mode(struct wl_client *client,
}
}
struct _wl_fullscreen_shell_interface fullscreen_shell_implementation = {
struct zwp_fullscreen_shell_v1_interface fullscreen_shell_implementation = {
fullscreen_shell_release,
fullscreen_shell_present_surface,
fullscreen_shell_present_surface_for_mode,
@ -799,19 +799,20 @@ bind_fullscreen_shell(struct wl_client *client, void *data, uint32_t version,
wl_client_add_destroy_listener(client, &shell->client_destroyed);
}
resource = wl_resource_create(client, &_wl_fullscreen_shell_interface,
resource = wl_resource_create(client,
&zwp_fullscreen_shell_v1_interface,
1, id);
wl_resource_set_implementation(resource,
&fullscreen_shell_implementation,
shell, NULL);
if (shell->compositor->capabilities & WESTON_CAP_CURSOR_PLANE)
_wl_fullscreen_shell_send_capability(resource,
_WL_FULLSCREEN_SHELL_CAPABILITY_CURSOR_PLANE);
zwp_fullscreen_shell_v1_send_capability(resource,
ZWP_FULLSCREEN_SHELL_V1_CAPABILITY_CURSOR_PLANE);
if (shell->compositor->capabilities & WESTON_CAP_ARBITRARY_MODES)
_wl_fullscreen_shell_send_capability(resource,
_WL_FULLSCREEN_SHELL_CAPABILITY_ARBITRARY_MODES);
zwp_fullscreen_shell_v1_send_capability(resource,
ZWP_FULLSCREEN_SHELL_V1_CAPABILITY_ARBITRARY_MODES);
}
WL_EXPORT int
@ -846,7 +847,7 @@ module_init(struct weston_compositor *compositor,
seat_created(NULL, seat);
wl_global_create(compositor->wl_display,
&_wl_fullscreen_shell_interface, 1, shell,
&zwp_fullscreen_shell_v1_interface, 1, shell,
bind_fullscreen_shell);
return 0;

@ -1,206 +0,0 @@
<protocol name="fullscreen_shell">
<interface name="_wl_fullscreen_shell" version="1">
<description summary="Displays a single surface per output">
Displays a single surface per output.
This interface provides a mechanism for a single client to display
simple full-screen surfaces. While there technically may be multiple
clients bound to this interface, only one of those clients should be
shown at a time.
To present a surface, the client uses either the present_surface or
present_surface_for_mode requests. Presenting a surface takes effect
on the next wl_surface.commit. See the individual requests for
details about scaling and mode switches.
The client can have at most one surface per output at any time.
Requesting a surface be presented on an output that already has a
surface replaces the previously presented surface. Presenting a null
surface removes its content and effectively disables the output.
Exactly what happens when an output is "disabled" is
compositor-specific. The same surface may be presented on multiple
outputs simultaneously.
Once a surface is presented on an output, it stays on that output
until either the client removes it or the compositor destroys the
output. This way, the client can update the output's contents by
simply attaching a new buffer.
</description>
<request name="release" type="destructor">
<description summary="release the wl_fullscreen_shell interface">
Release the binding from the wl_fullscreen_shell interface
This destroys the server-side object and frees this binding. If
the client binds to wl_fullscreen_shell multiple times, it may wish
to free some of those bindings.
</description>
</request>
<enum name="capability">
<description summary="capabilities advertised by the compositor">
Various capabilities that can be advertised by the compositor. They
are advertised one-at-a-time when the wl_fullscreen_shell interface is
bound. See the wl_fullscreen_shell.capability event for more details.
ARBITRARY_MODE:
This is a hint to the client that indicates that the compositor is
capable of setting practically any mode on its outputs. If this
capability is provided, wl_fullscreen_shell.present_surface_for_mode
will almost never fail and clients should feel free to set whatever
mode they like. If the compositor does not advertise this, it may
still support some modes that are not advertised through wl_global.mode
but it is less likely.
CURSOR_PLANE:
This is a hint to the client that indicates that the compositor can
handle a cursor surface from the client without actually compositing.
This may be because of a hardware cursor plane or some other mechanism.
If the compositor does not advertise this capability then setting
wl_pointer.cursor may degrade performance or be ignored entirely. If
CURSOR_PLANE is not advertised, it is recommended that the client draw
its own cursor and set wl_pointer.cursor(NULL).
</description>
<entry name="arbitrary_modes" value="1" summary="compositor is capable of almost any output mode"/>
<entry name="cursor_plane" value="2" summary="compositor has a separate cursor plane"/>
</enum>
<event name="capability">
<description summary="advertises a capability of the compositor">
Advertises a single capability of the compositor.
When the wl_fullscreen_shell interface is bound, this event is emitted
once for each capability advertised. Valid capabilities are given by
the wl_fullscreen_shell.capability enum. If clients want to take
advantage of any of these capabilities, they should use a
wl_display.sync request immediately after binding to ensure that they
receive all the capability events.
</description>
<arg name="capabilty" type="uint"/>
</event>
<enum name="present_method">
<description summary="different method to set the surface fullscreen">
Hints to indicate to the compositor how to deal with a conflict
between the dimensions of the surface and the dimensions of the
output. The compositor is free to ignore this parameter.
</description>
<entry name="default" value="0" summary="no preference, apply default policy"/>
<entry name="center" value="1" summary="center the surface on the output"/>
<entry name="zoom" value="2" summary="scale the surface, preserving aspect ratio, to the largest size that will fit on the output" />
<entry name="zoom_crop" value="3" summary="scale the surface, preserving aspect ratio, to fully fill the output cropping if needed" />
<entry name="stretch" value="4" summary="scale the surface to the size of the output ignoring aspect ratio" />
</enum>
<request name="present_surface">
<description summary="present surface for display">
Present a surface on the given output.
If the output is null, the compositor will present the surface on
whatever display (or displays) it thinks best. In particular, this
may replace any or all surfaces currently presented so it should
not be used in combination with placing surfaces on specific
outputs.
The method parameter is a hint to the compositor for how the surface
is to be presented. In particular, it tells the compositor how to
handle a size mismatch between the presented surface and the
output. The compositor is free to ignore this parameter.
The "zoom", "zoom_crop", and "stretch" methods imply a scaling
operation on the surface. This will override any kind of output
scaling, so the buffer_scale property of the surface is effectively
ignored.
</description>
<arg name="surface" type="object" interface="wl_surface" allow-null="true"/>
<arg name="method" type="uint"/>
<arg name="output" type="object" interface="wl_output" allow-null="true"/>
</request>
<request name="present_surface_for_mode">
<description summary="present surface for display at a particular mode">
Presents a surface on the given output for a particular mode.
If the current size of the output differs from that of the surface,
the compositor will attempt to change the size of the output to
match the surface. The result of the mode-switch operation will be
returned via the provided wl_fullscreen_shell_mode_feedback object.
If the current output mode matches the one requested or if the
compositor successfully switches the mode to match the surface,
then the mode_successful event will be sent and the output will
contain the contents of the given surface. If the compositor
cannot match the output size to the surface size, the mode_failed
will be sent and the output will contain the contents of the
previously presented surface (if any). If another surface is
presented on the given output before either of these has a chance
to happen, the present_cancelled event will be sent.
Due to race conditions and other issues unknown to the client, no
mode-switch operation is guaranteed to succeed. However, if the
mode is one advertised by wl_output.mode or if the compositor
advertises the ARBITRARY_MODES capability, then the client should
expect that the mode-switch operation will usually succeed.
If the size of the presented surface changes, the resulting output
is undefined. The compositor may attempt to change the output mode
to compensate. However, there is no guarantee that a suitable mode
will be found and the client has no way to be notified of success
or failure.
The framerate parameter specifies the desired framerate for the
output in mHz. The compositor is free to ignore this parameter. A
value of 0 indicates that the client has no preference.
If the value of wl_output.scale differs from wl_surface.buffer_scale,
then the compositor may choose a mode that matches either the buffer
size or the surface size. In either case, the surface will fill the
output.
</description>
<arg name="surface" type="object" interface="wl_surface"/>
<arg name="output" type="object" interface="wl_output"/>
<arg name="framerate" type="int"/>
<arg name="feedback" type="new_id" interface="_wl_fullscreen_shell_mode_feedback"/>
</request>
<enum name="error">
<description summary="wl_fullscreen_shell error values">
These errors can be emitted in response to wl_fullscreen_shell requests
</description>
<entry name="invalid_method" value="0" summary="present_method is not known"/>
</enum>
</interface>
<interface name="_wl_fullscreen_shell_mode_feedback" version="1">
<event name="mode_successful">
<description summary="mode switch succeeded">
This event indicates that the attempted mode switch operation was
successful. A surface of the size requested in the mode switch
will fill the output without scaling.
Upon receiving this event, the client should destroy the
wl_fullscreen_shell_mode_feedback object.
</description>
</event>
<event name="mode_failed">
<description summary="mode switch failed">
This event indicates that the attempted mode switch operation
failed. This may be because the requested output mode is not
possible or it may mean that the compositor does not want to allow it.
Upon receiving this event, the client should destroy the
wl_fullscreen_shell_mode_feedback object.
</description>
</event>
<event name="present_cancelled">
<description summary="mode switch cancelled">
This event indicates that the attempted mode switch operation was
cancelled. Most likely this is because the client requested a
second mode switch before the first one completed.
Upon receiving this event, the client should destroy the
wl_fullscreen_shell_mode_feedback object.
</description>
</event>
</interface>
</protocol>

@ -46,7 +46,7 @@
#include "shared/image-loader.h"
#include "shared/os-compatibility.h"
#include "shared/cairo-util.h"
#include "fullscreen-shell-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
#include "presentation_timing-server-protocol.h"
#include "linux-dmabuf.h"
@ -61,7 +61,7 @@ struct wayland_backend {
struct wl_registry *registry;
struct wl_compositor *compositor;
struct wl_shell *shell;
struct _wl_fullscreen_shell *fshell;
struct zwp_fullscreen_shell_v1 *fshell;
struct wl_shm *shm;
struct wl_list output_list;
@ -813,9 +813,9 @@ wayland_output_set_fullscreen(struct wayland_output *output,
wl_shell_surface_set_fullscreen(output->parent.shell_surface,
method, framerate, target);
} else if (b->parent.fshell) {
_wl_fullscreen_shell_present_surface(b->parent.fshell,
output->parent.surface,
method, target);
zwp_fullscreen_shell_v1_present_surface(b->parent.fshell,
output->parent.surface,
method, target);
}
}
@ -851,7 +851,7 @@ enum mode_status {
static void
mode_feedback_successful(void *data,
struct _wl_fullscreen_shell_mode_feedback *fb)
struct zwp_fullscreen_shell_mode_feedback_v1 *fb)
{
enum mode_status *value = data;
@ -861,7 +861,7 @@ mode_feedback_successful(void *data,
}
static void
mode_feedback_failed(void *data, struct _wl_fullscreen_shell_mode_feedback *fb)
mode_feedback_failed(void *data, struct zwp_fullscreen_shell_mode_feedback_v1 *fb)
{
enum mode_status *value = data;
@ -871,7 +871,7 @@ mode_feedback_failed(void *data, struct _wl_fullscreen_shell_mode_feedback *fb)
}
static void
mode_feedback_cancelled(void *data, struct _wl_fullscreen_shell_mode_feedback *fb)
mode_feedback_cancelled(void *data, struct zwp_fullscreen_shell_mode_feedback_v1 *fb)
{
enum mode_status *value = data;
@ -880,7 +880,7 @@ mode_feedback_cancelled(void *data, struct _wl_fullscreen_shell_mode_feedback *f
*value = MODE_STATUS_CANCEL;
}
struct _wl_fullscreen_shell_mode_feedback_listener mode_feedback_listener = {
struct zwp_fullscreen_shell_mode_feedback_v1_listener mode_feedback_listener = {
mode_feedback_successful,
mode_feedback_failed,
mode_feedback_cancelled,
@ -894,7 +894,7 @@ wayland_output_switch_mode(struct weston_output *output_base,
struct wayland_backend *b;
struct wl_surface *old_surface;
struct weston_mode *old_mode;
struct _wl_fullscreen_shell_mode_feedback *mode_feedback;
struct zwp_fullscreen_shell_mode_feedback_v1 *mode_feedback;
enum mode_status mode_status;
int ret = 0;
@ -931,13 +931,13 @@ wayland_output_switch_mode(struct weston_output *output_base,
wayland_output_resize_surface(output);
mode_feedback =
_wl_fullscreen_shell_present_surface_for_mode(b->parent.fshell,
output->parent.surface,
output->parent.output,
mode->refresh);
_wl_fullscreen_shell_mode_feedback_add_listener(mode_feedback,
&mode_feedback_listener,
&mode_status);
zwp_fullscreen_shell_v1_present_surface_for_mode(b->parent.fshell,
output->parent.surface,
output->parent.output,
mode->refresh);
zwp_fullscreen_shell_mode_feedback_v1_add_listener(mode_feedback,
&mode_feedback_listener,
&mode_status);
/* This should kick-start things again */
output->parent.draw_initial_frame = 1;
@ -947,7 +947,7 @@ wayland_output_switch_mode(struct weston_output *output_base,
while (mode_status == MODE_STATUS_UNKNOWN && ret >= 0)
ret = wl_display_dispatch(b->parent.wl_display);
_wl_fullscreen_shell_mode_feedback_destroy(mode_feedback);
zwp_fullscreen_shell_mode_feedback_v1_destroy(mode_feedback);
if (mode_status == MODE_STATUS_FAIL) {
output->base.current_mode = old_mode;
@ -1194,15 +1194,15 @@ wayland_output_create_for_parent_output(struct wayland_backend *b,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER,
mode->refresh, poutput->global);
} else if (b->parent.fshell) {
_wl_fullscreen_shell_present_surface(b->parent.fshell,
output->parent.surface,
_WL_FULLSCREEN_SHELL_PRESENT_METHOD_CENTER,
poutput->global);
_wl_fullscreen_shell_mode_feedback_destroy(
_wl_fullscreen_shell_present_surface_for_mode(b->parent.fshell,
output->parent.surface,
poutput->global,
mode->refresh));
zwp_fullscreen_shell_v1_present_surface(b->parent.fshell,
output->parent.surface,
ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_CENTER,
poutput->global);
zwp_fullscreen_shell_mode_feedback_v1_destroy(
zwp_fullscreen_shell_v1_present_surface_for_mode(b->parent.fshell,
output->parent.surface,
poutput->global,
mode->refresh));
}
return output;
@ -1819,10 +1819,10 @@ registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
b->parent.shell =
wl_registry_bind(registry, name,
&wl_shell_interface, 1);
} else if (strcmp(interface, "_wl_fullscreen_shell") == 0) {
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
b->parent.fshell =
wl_registry_bind(registry, name,
&_wl_fullscreen_shell_interface, 1);
&zwp_fullscreen_shell_v1_interface, 1);
} else if (strcmp(interface, "wl_seat") == 0) {
display_add_seat(b, name, version);
} else if (strcmp(interface, "wl_output") == 0) {

@ -42,7 +42,7 @@
#include "compositor.h"
#include "shared/helpers.h"
#include "shared/os-compatibility.h"
#include "fullscreen-shell-client-protocol.h"
#include "fullscreen-shell-unstable-v1-client-protocol.h"
struct shared_output {
struct weston_output *output;
@ -55,11 +55,11 @@ struct shared_output {
struct wl_compositor *compositor;
struct wl_shm *shm;
uint32_t shm_formats;
struct _wl_fullscreen_shell *fshell;
struct zwp_fullscreen_shell_v1 *fshell;
struct wl_output *output;
struct wl_surface *surface;
struct wl_callback *frame_cb;
struct _wl_fullscreen_shell_mode_feedback *mode_feedback;
struct zwp_fullscreen_shell_mode_feedback_v1 *mode_feedback;
} parent;
struct wl_event_source *event_source;
@ -697,10 +697,12 @@ registry_handle_global(void *data, struct wl_registry *registry,
wl_registry_bind(registry,
id, &wl_shm_interface, 1);
wl_shm_add_listener(so->parent.shm, &shm_listener, so);
} else if (strcmp(interface, "_wl_fullscreen_shell") == 0) {
} else if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
so->parent.fshell =
wl_registry_bind(registry,
id, &_wl_fullscreen_shell_interface, 1);
id,
&zwp_fullscreen_shell_v1_interface,
1);
}
}
@ -750,25 +752,25 @@ output_destroyed(struct wl_listener *l, void *data)
}
static void
mode_feedback_ok(void *data, struct _wl_fullscreen_shell_mode_feedback *fb)
mode_feedback_ok(void *data, struct zwp_fullscreen_shell_mode_feedback_v1 *fb)
{
struct shared_output *so = data;
_wl_fullscreen_shell_mode_feedback_destroy(so->parent.mode_feedback);
zwp_fullscreen_shell_mode_feedback_v1_destroy(so->parent.mode_feedback);
}
static void
mode_feedback_failed(void *data, struct _wl_fullscreen_shell_mode_feedback *fb)
mode_feedback_failed(void *data, struct zwp_fullscreen_shell_mode_feedback_v1 *fb)
{
struct shared_output *so = data;
_wl_fullscreen_shell_mode_feedback_destroy(so->parent.mode_feedback);
zwp_fullscreen_shell_mode_feedback_v1_destroy(so->parent.mode_feedback);
weston_log("Screen share failed: present_surface_for_mode failed\n");
shared_output_destroy(so);
}
struct _wl_fullscreen_shell_mode_feedback_listener mode_feedback_listener = {
struct zwp_fullscreen_shell_mode_feedback_v1_listener mode_feedback_listener = {
mode_feedback_ok,
mode_feedback_failed,
mode_feedback_ok,
@ -919,17 +921,17 @@ shared_output_create(struct weston_output *output, int parent_fd)
}
so->parent.mode_feedback =
_wl_fullscreen_shell_present_surface_for_mode(so->parent.fshell,
so->parent.surface,
so->parent.output,
output->current_mode->refresh);
zwp_fullscreen_shell_v1_present_surface_for_mode(so->parent.fshell,
so->parent.surface,
so->parent.output,
output->current_mode->refresh);
if (!so->parent.mode_feedback) {
weston_log("Screen share failed: %m\n");
goto err_display;
}
_wl_fullscreen_shell_mode_feedback_add_listener(so->parent.mode_feedback,
&mode_feedback_listener,
so);
zwp_fullscreen_shell_mode_feedback_v1_add_listener(so->parent.mode_feedback,
&mode_feedback_listener,
so);
loop = wl_display_get_event_loop(output->compositor->wl_display);

Loading…
Cancel
Save