From 17a6d25393e787e2f422ee121d4f07098328acf4 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Wed, 25 Aug 2021 12:50:29 +0000 Subject: [PATCH] x11-wm/mutter: expose nested Wayland support PR: 258042 Approved by: ? --- x11-wm/mutter/Makefile | 14 ++++- x11-wm/mutter/files/patch-meson.build | 10 +++- .../files/patch-src_core_meta-context-main.c | 17 ++++++ x11-wm/mutter/files/patch-src_meson.build | 16 +++++ .../patch-src_wayland_meta-wayland-buffer.c | 58 +++++++++++++++++++ .../files/patch-src_wayland_meta-xwayland.c | 27 +++++++++ x11-wm/mutter/pkg-plist | 2 + 7 files changed, 141 insertions(+), 3 deletions(-) create mode 100644 x11-wm/mutter/files/patch-src_core_meta-context-main.c create mode 100644 x11-wm/mutter/files/patch-src_meson.build create mode 100644 x11-wm/mutter/files/patch-src_wayland_meta-wayland-buffer.c create mode 100644 x11-wm/mutter/files/patch-src_wayland_meta-xwayland.c diff --git a/x11-wm/mutter/Makefile b/x11-wm/mutter/Makefile index 3b483ecf6be2..e988c2143e5b 100644 --- a/x11-wm/mutter/Makefile +++ b/x11-wm/mutter/Makefile @@ -1,6 +1,6 @@ PORTNAME= mutter PORTVERSION= 42.4 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= x11-wm MASTER_SITES= GNOME/sources/${PORTNAME}/${PORTVERSION:C/^([0-9]+)\..*/\1/} DIST_SUBDIR= gnome @@ -53,7 +53,6 @@ MESON_ARGS= -Dlibwacom=false \ -Dsm=true \ -Dsystemd=false \ -Dtests=false \ - -Dwayland=false # Required by embedded cogl/clutter forks. MESON_ARGS+= -Dgles2_libname=libGLESv2 \ @@ -65,4 +64,15 @@ MESON_ARGS+= -Dremote_desktop=false GLIB_SCHEMAS= org.gnome.mutter.gschema.xml \ org.gnome.mutter.wayland.gschema.xml +OPTIONS_DEFINE= WAYLAND +OPTIONS_DEFAULT=WAYLAND +OPTIONS_SUB= yes + +WAYLAND_BUILD_DEPENDS= wayland-protocols>=1.25:graphics/wayland-protocols \ + xwayland-devel>0:x11-servers/xwayland-devel +WAYLAND_LIB_DEPENDS= libwayland-server.so:graphics/wayland +WAYLAND_RUN_DEPENDS= xwayland-devel>0:x11-servers/xwayland-devel +WAYLAND_USE= XORG=xau +WAYLAND_MESON_TRUE= wayland + .include diff --git a/x11-wm/mutter/files/patch-meson.build b/x11-wm/mutter/files/patch-meson.build index ba0ef1357fc9..55560ac3e736 100644 --- a/x11-wm/mutter/files/patch-meson.build +++ b/x11-wm/mutter/files/patch-meson.build @@ -1,6 +1,14 @@ --- meson.build.orig 2022-08-11 15:46:26 UTC +++ meson.build -@@ -199,11 +199,15 @@ if have_libgudev +@@ -184,6 +184,7 @@ if have_wayland + + have_wayland = get_option('wayland') + if have_wayland ++ libdrm_dep = dependency('libdrm') + wayland_server_dep = dependency('wayland-server', version: wayland_server_req) + wayland_client_dep = dependency('wayland-client', version: wayland_server_req) + wayland_protocols_dep = dependency('wayland-protocols', +@@ -199,11 +200,15 @@ if have_libgudev if have_libgudev libudev_dep = dependency('libudev', version: udev_req) gudev_dep = dependency('gudev-1.0', version: gudev_req) diff --git a/x11-wm/mutter/files/patch-src_core_meta-context-main.c b/x11-wm/mutter/files/patch-src_core_meta-context-main.c new file mode 100644 index 000000000000..773b81cea09b --- /dev/null +++ b/x11-wm/mutter/files/patch-src_core_meta-context-main.c @@ -0,0 +1,17 @@ +ld: error: undefined symbol: sd_pid_get_user_unit +>>> referenced by meta-context-main.c +>>> src/libmutter-9.so.0.0.0.p/core_meta-context-main.c.o:(meta_context_main_get_x11_display_policy) + +--- src/core/meta-context-main.c.orig 2021-09-19 13:37:45 UTC ++++ src/core/meta-context-main.c +@@ -318,8 +318,10 @@ meta_context_main_get_x11_display_policy (MetaContext + #ifdef HAVE_WAYLAND + if (context_main->options.no_x11) + return META_X11_DISPLAY_POLICY_DISABLED; ++#ifdef HAVE_LIBSYSTEMD + else if (sd_pid_get_user_unit (0, &unit) < 0) + return META_X11_DISPLAY_POLICY_MANDATORY; ++#endif + else + return META_X11_DISPLAY_POLICY_ON_DEMAND; + #else /* HAVE_WAYLAND */ diff --git a/x11-wm/mutter/files/patch-src_meson.build b/x11-wm/mutter/files/patch-src_meson.build new file mode 100644 index 000000000000..d0575c34a476 --- /dev/null +++ b/x11-wm/mutter/files/patch-src_meson.build @@ -0,0 +1,16 @@ +../src/wayland/meta-wayland-buffer.c:53:10: fatal error: 'drm_fourcc.h' file not found +#include + ^~~~~~~~~~~~~~ + +--- src/meson.build.orig 2022-08-11 15:46:26 UTC ++++ src/meson.build +@@ -118,6 +118,9 @@ if have_wayland + endif + + if have_wayland ++ mutter_lib_deps += [ ++ libdrm_dep, # drm_fourcc.h on non-Linux ++ ] + mutter_pkg_deps += [ + wayland_server_dep, + ] diff --git a/x11-wm/mutter/files/patch-src_wayland_meta-wayland-buffer.c b/x11-wm/mutter/files/patch-src_wayland_meta-wayland-buffer.c new file mode 100644 index 000000000000..7a74cec19929 --- /dev/null +++ b/x11-wm/mutter/files/patch-src_wayland_meta-wayland-buffer.c @@ -0,0 +1,58 @@ +https://gitlab.gnome.org/GNOME/mutter/-/commit/32affbf05a70 + +../src/wayland/meta-wayland-buffer.c:288:23: error: unknown type name 'MetaDrmFormatBuf' +shm_format_to_string (MetaDrmFormatBuf *format_buf, + ^ +../src/wayland/meta-wayland-buffer.c:302:16: warning: implicit declaration of function 'meta_drm_format_to_string' is invalid in C99 [-Wimplicit-function-declaration] + result = meta_drm_format_to_string (format_buf, shm_format); + ^ +../src/wayland/meta-wayland-buffer.c:323:3: error: use of undeclared identifier 'MetaDrmFormatBuf' + MetaDrmFormatBuf format_buf; + ^ +../src/wayland/meta-wayland-buffer.c:339:38: error: use of undeclared identifier 'format_buf' + shm_format_to_string (&format_buf, + ^ + +--- src/wayland/meta-wayland-buffer.c.orig 2022-08-11 15:46:26 UTC ++++ src/wayland/meta-wayland-buffer.c +@@ -304,6 +304,7 @@ shm_buffer_get_cogl_pixel_format (struct wl_shm_buffer + return TRUE; + } + ++#ifdef HAVE_NATIVE_BACKEND + static const char * + shm_format_to_string (MetaDrmFormatBuf *format_buf, + uint32_t shm_format) +@@ -325,6 +326,7 @@ shm_format_to_string (MetaDrmFormatBuf *format_buf, + + return result; + } ++#endif + + static gboolean + shm_buffer_attach (MetaWaylandBuffer *buffer, +@@ -340,7 +342,9 @@ shm_buffer_attach (MetaWaylandBuffer *buffer, + CoglTextureComponents components; + CoglBitmap *bitmap; + CoglTexture *new_texture; ++#ifdef HAVE_NATIVE_BACKEND + MetaDrmFormatBuf format_buf; ++#endif + + shm_buffer = wl_shm_buffer_get (buffer->resource); + stride = wl_shm_buffer_get_stride (shm_buffer); +@@ -353,12 +357,14 @@ shm_buffer_attach (MetaWaylandBuffer *buffer, + return FALSE; + } + ++#ifdef HAVE_NATIVE_BACKEND + meta_topic (META_DEBUG_WAYLAND, + "[wl-shm] wl_buffer@%u wl_shm_format %s -> CoglPixelFormat %s", + wl_resource_get_id (meta_wayland_buffer_get_resource (buffer)), + shm_format_to_string (&format_buf, + wl_shm_buffer_get_format (shm_buffer)), + cogl_pixel_format_to_string (format)); ++#endif + + if (*texture && + cogl_texture_get_width (*texture) == width && diff --git a/x11-wm/mutter/files/patch-src_wayland_meta-xwayland.c b/x11-wm/mutter/files/patch-src_wayland_meta-xwayland.c new file mode 100644 index 000000000000..d326b028c1b1 --- /dev/null +++ b/x11-wm/mutter/files/patch-src_wayland_meta-xwayland.c @@ -0,0 +1,27 @@ +mutter-WARNING **: failed to bind to @/tmp/.X11-unix/X0: No such file or directory + +--- src/wayland/meta-xwayland.c.orig 2022-08-11 15:46:26 UTC ++++ src/wayland/meta-xwayland.c +@@ -591,9 +591,11 @@ open_display_sockets (MetaXWaylandManager *manager, + { + int abstract_fd, unix_fd; + ++#ifdef __linux__ + abstract_fd = bind_to_abstract_socket (display_index, error); + if (abstract_fd < 0) + return FALSE; ++#endif + + unix_fd = bind_to_unix_socket (display_index, error); + if (unix_fd < 0) +@@ -601,6 +603,10 @@ open_display_sockets (MetaXWaylandManager *manager, + close (abstract_fd); + return FALSE; + } ++ ++#ifndef __linux__ ++ abstract_fd = unix_fd; ++#endif + + *abstract_fd_out = abstract_fd; + *unix_fd_out = unix_fd; diff --git a/x11-wm/mutter/pkg-plist b/x11-wm/mutter/pkg-plist index bd1422a44ee8..d85354fed100 100644 --- a/x11-wm/mutter/pkg-plist +++ b/x11-wm/mutter/pkg-plist @@ -201,6 +201,7 @@ include/mutter-10/meta/meta-shaped-texture.h include/mutter-10/meta/meta-sound-player.h include/mutter-10/meta/meta-stage.h include/mutter-10/meta/meta-startup-notification.h +%%WAYLAND%%include/mutter-10/meta/meta-wayland-client.h include/mutter-10/meta/meta-window-actor.h include/mutter-10/meta/meta-window-group.h include/mutter-10/meta/meta-window-shape.h @@ -247,6 +248,7 @@ share/GConf/gsettings/mutter-schemas.convert share/applications/mutter.desktop share/gnome-control-center/keybindings/50-mutter-navigation.xml share/gnome-control-center/keybindings/50-mutter-system.xml +%%WAYLAND%%share/gnome-control-center/keybindings/50-mutter-wayland.xml share/gnome-control-center/keybindings/50-mutter-windows.xml share/locale/am/LC_MESSAGES/mutter.mo share/locale/ar/LC_MESSAGES/mutter.mo