libweston-desktop: implement the new xdg_shell (stable) protocol
Some clients like the mpv video player now request the xdg_shell protocol so these will fail if the compositor only provides the xdg_shell_unstable_v6 protocol. Compositors like mir and gnome provide both protocols. The two protocols are very similar therefore the code in xdg-shell-v6.c has been refactored to work with the new xdg_shell protocol and now resides in xdg-shell.c. Pekka: - split the patch - fix continued line alignment Daniel - allow anchor_rect to initially have zero dimensions - account for get_popup allowing NULL parent surface Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com> Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
2d4cc4f4dd
commit
d8d9f5e6e1
@ -132,15 +132,19 @@ libweston_desktop_@LIBWESTON_MAJOR@_la_SOURCES = \
|
||||
libweston-desktop/surface.c \
|
||||
libweston-desktop/wl-shell.c \
|
||||
libweston-desktop/xdg-shell-v6.c \
|
||||
libweston-desktop/xdg-shell.c \
|
||||
libweston-desktop/xwayland.c
|
||||
|
||||
nodist_libweston_desktop_@LIBWESTON_MAJOR@_la_SOURCES = \
|
||||
protocol/xdg-shell-unstable-v6-protocol.c \
|
||||
protocol/xdg-shell-unstable-v6-server-protocol.h
|
||||
protocol/xdg-shell-unstable-v6-server-protocol.h \
|
||||
protocol/xdg-shell-protocol.c \
|
||||
protocol/xdg-shell-server-protocol.h
|
||||
|
||||
BUILT_SOURCES += $(nodist_libweston_desktop_@LIBWESTON_MAJOR@_la_SOURCES)
|
||||
|
||||
libweston-desktop-@LIBWESTON_MAJOR@.la libweston-desktop/libweston_desktop_@LIBWESTON_MAJOR@_la-xdg-shell-v6.lo: protocol/xdg-shell-unstable-v6-server-protocol.h
|
||||
libweston-desktop-@LIBWESTON_MAJOR@.la libweston-desktop/libweston_desktop_@LIBWESTON_MAJOR@_la-xdg-wm-shell.lo: protocol/xdg-shell-server-protocol.h
|
||||
|
||||
if SYSTEMD_NOTIFY_SUPPORT
|
||||
module_LTLIBRARIES += systemd-notify.la
|
||||
|
@ -227,11 +227,15 @@ void
|
||||
weston_desktop_destroy_request(struct wl_client *client,
|
||||
struct wl_resource *resource);
|
||||
struct wl_global *
|
||||
weston_desktop_xdg_wm_base_create(struct weston_desktop *desktop,
|
||||
struct wl_display *display);
|
||||
struct wl_global *
|
||||
weston_desktop_xdg_shell_v6_create(struct weston_desktop *desktop,
|
||||
struct wl_display *display);
|
||||
struct wl_global *
|
||||
weston_desktop_wl_shell_create(struct weston_desktop *desktop,
|
||||
struct wl_display *display);
|
||||
|
||||
void
|
||||
weston_desktop_xwayland_init(struct weston_desktop *desktop);
|
||||
|
||||
|
@ -40,7 +40,8 @@ struct weston_desktop {
|
||||
struct weston_compositor *compositor;
|
||||
struct weston_desktop_api api;
|
||||
void *user_data;
|
||||
struct wl_global *xdg_shell_v6;
|
||||
struct wl_global *xdg_wm_base; /* Stable protocol xdg_shell replaces xdg_shell_unstable_v6 */
|
||||
struct wl_global *xdg_shell_v6; /* Unstable xdg_shell_unstable_v6 protocol. */
|
||||
struct wl_global *wl_shell;
|
||||
};
|
||||
|
||||
@ -69,6 +70,13 @@ weston_desktop_create(struct weston_compositor *compositor,
|
||||
MIN(sizeof(struct weston_desktop_api), api->struct_size);
|
||||
memcpy(&desktop->api, api, desktop->api.struct_size);
|
||||
|
||||
desktop->xdg_wm_base =
|
||||
weston_desktop_xdg_wm_base_create(desktop, display);
|
||||
if (desktop->xdg_wm_base == NULL) {
|
||||
weston_desktop_destroy(desktop);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
desktop->xdg_shell_v6 =
|
||||
weston_desktop_xdg_shell_v6_create(desktop, display);
|
||||
if (desktop->xdg_shell_v6 == NULL) {
|
||||
@ -98,6 +106,8 @@ weston_desktop_destroy(struct weston_desktop *desktop)
|
||||
wl_global_destroy(desktop->wl_shell);
|
||||
if (desktop->xdg_shell_v6 != NULL)
|
||||
wl_global_destroy(desktop->xdg_shell_v6);
|
||||
if (desktop->xdg_wm_base != NULL)
|
||||
wl_global_destroy(desktop->xdg_wm_base);
|
||||
|
||||
free(desktop);
|
||||
}
|
||||
|
@ -5,9 +5,12 @@ srcs_libdesktop = [
|
||||
'surface.c',
|
||||
'xwayland.c',
|
||||
'wl-shell.c',
|
||||
'xdg-shell.c',
|
||||
'xdg-shell-v6.c',
|
||||
xdg_shell_unstable_v6_server_protocol_h,
|
||||
xdg_shell_unstable_v6_protocol_c,
|
||||
xdg_shell_server_protocol_h,
|
||||
xdg_shell_protocol_c,
|
||||
]
|
||||
lib_desktop = shared_library(
|
||||
'weston-desktop-@0@'.format(libweston_major),
|
||||
|
1476
libweston-desktop/xdg-shell.c
Normal file
1476
libweston-desktop/xdg-shell.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -36,6 +36,7 @@ generated_protocols = [
|
||||
[ 'weston-touch-calibration', 'internal' ],
|
||||
[ 'xdg-output', 'v1' ],
|
||||
[ 'xdg-shell', 'v6' ],
|
||||
[ 'xdg-shell', 'stable' ],
|
||||
]
|
||||
|
||||
foreach proto: generated_protocols
|
||||
|
Loading…
Reference in New Issue
Block a user