summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2021-03-22 11:51:37 +0100
committerJonas Ådahl <jadahl@gmail.com>2022-01-14 09:27:07 +0100
commit66ebc660b4ab446a03f4421d02f71dcddd2a88b0 (patch)
tree47273da3e7a72d51fb3777b8ee8e4f164a772f24
parentc71cb35e9dc3cf4dc109ce64dbd7731c93018f56 (diff)
downloadgtk+-66ebc660b4ab446a03f4421d02f71dcddd2a88b0.tar.gz
wayland/surface: Use wl_surface_offset() instead of x,y of attach()
This makes the hotspot of DND surfaces work when using the Vulkan and OpenGL renderers. This bumps the CI image used to the newly built image. This is needed to install a new enough libwayland-client.so needed for wl_surface.offset. This is done by adding wayland as a meson subproject, building it on-demand if the version in the system is not new enough. As libwayland-client.so is pulled in implicitly when linking to gtk4, the compile step needs LD_LIBRARY_PATH set to make ld find the right library to link to.
-rw-r--r--.gitlab-ci.yml4
-rw-r--r--.gitlab-ci/fedora.Dockerfile2
-rw-r--r--gdk/wayland/gdkcairocontext-wayland.c2
-rw-r--r--gdk/wayland/gdkdisplay-wayland.c3
-rw-r--r--gdk/wayland/gdksurface-wayland.c21
-rw-r--r--meson.build9
-rw-r--r--subprojects/wayland.wrap8
7 files changed, 42 insertions, 7 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8b01ec772c..279faf373b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -25,7 +25,7 @@ variables:
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
- FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v35"
+ FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v36"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
.only-default:
@@ -88,7 +88,7 @@ fedora-x86_64:
- meson compile -C _build
- meson install -C _build
- PKG_CONFIG_PATH=${CI_PROJECT_DIR}/_install/lib64/pkgconfig:${CI_PROJECT_DIR}/_install/share/pkgconfig meson setup _build_hello examples/hello
- - meson compile -C _build_hello
+ - LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
- .gitlab-ci/run-tests.sh _build x11
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build waylandgles
diff --git a/.gitlab-ci/fedora.Dockerfile b/.gitlab-ci/fedora.Dockerfile
index 97ece0e7ff..31bb1697f5 100644
--- a/.gitlab-ci/fedora.Dockerfile
+++ b/.gitlab-ci/fedora.Dockerfile
@@ -95,6 +95,8 @@ RUN dnf -y install \
weston-libs \
which \
xorg-x11-server-Xvfb \
+ && dnf install -y 'dnf-command(builddep)' \
+ && dnf builddep -y wayland \
&& dnf clean all
# Enable sudo for wheel users
diff --git a/gdk/wayland/gdkcairocontext-wayland.c b/gdk/wayland/gdkcairocontext-wayland.c
index e05ea6a7d9..b75353b577 100644
--- a/gdk/wayland/gdkcairocontext-wayland.c
+++ b/gdk/wayland/gdkcairocontext-wayland.c
@@ -181,8 +181,8 @@ gdk_wayland_cairo_context_end_frame (GdkDrawContext *draw_context,
GdkWaylandCairoContext *self = GDK_WAYLAND_CAIRO_CONTEXT (draw_context);
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
- gdk_wayland_surface_attach_image (surface, self->paint_surface, painted);
gdk_wayland_surface_sync (surface);
+ gdk_wayland_surface_attach_image (surface, self->paint_surface, painted);
gdk_wayland_surface_request_frame (surface);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 2017e90518..1401d91415 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -366,7 +366,8 @@ gdk_registry_handle_global (void *data,
if (strcmp (interface, "wl_compositor") == 0)
{
display_wayland->compositor =
- wl_registry_bind (display_wayland->wl_registry, id, &wl_compositor_interface, MIN (version, 4));
+ wl_registry_bind (display_wayland->wl_registry, id,
+ &wl_compositor_interface, MIN (version, 5));
display_wayland->compositor_version = MIN (version, 4);
}
else if (strcmp (interface, "wl_shm") == 0)
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index 93498d7cb5..8836b265b8 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -935,12 +935,33 @@ gdk_wayland_surface_attach_image (GdkSurface *surface,
}
}
+static void
+gdk_wayland_surface_sync_offset (GdkSurface *surface)
+{
+ GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
+
+ if (wl_surface_get_version (impl->display_server.wl_surface) <
+ WL_SURFACE_OFFSET_SINCE_VERSION)
+ return;
+
+ if (impl->pending_buffer_offset_x == 0 &&
+ impl->pending_buffer_offset_y == 0)
+ return;
+
+ wl_surface_offset (impl->display_server.wl_surface,
+ impl->pending_buffer_offset_x,
+ impl->pending_buffer_offset_y);
+ impl->pending_buffer_offset_x = 0;
+ impl->pending_buffer_offset_y = 0;
+}
+
void
gdk_wayland_surface_sync (GdkSurface *surface)
{
gdk_wayland_surface_sync_shadow (surface);
gdk_wayland_surface_sync_opaque_region (surface);
gdk_wayland_surface_sync_input_region (surface);
+ gdk_wayland_surface_sync_offset (surface);
}
static gboolean
diff --git a/meson.build b/meson.build
index a40473c12a..c74ca09284 100644
--- a/meson.build
+++ b/meson.build
@@ -17,7 +17,7 @@ cairo_req = '>= 1.14.0'
gdk_pixbuf_req = '>= 2.30.0'
introspection_req = '>= 1.39.0'
wayland_proto_req = '>= 1.21'
-wayland_req = '>= 1.16.91'
+wayland_req = '>= 1.20.0'
graphene_req = '>= 1.9.1'
epoxy_req = '>= 1.4'
cloudproviders_req = '>= 0.3.1'
@@ -510,9 +510,12 @@ cdata.set('HAVE_PANGOFT', pangoft_dep.found())
wayland_pkgs = []
if wayland_enabled
- wlclientdep = dependency('wayland-client', version: wayland_req)
+ wlclientdep = dependency('wayland-client', version: wayland_req,
+ fallback: 'wayland',
+ default_options: ['documentation=false'])
wlprotocolsdep = dependency('wayland-protocols', version: wayland_proto_req, required: false)
- wlegldep = dependency('wayland-egl')
+ wlegldep = dependency('wayland-egl',
+ fallback: 'wayland')
if not wlprotocolsdep.found()
wlproto_dir = subproject('wayland-protocols').get_variable('wayland_protocols_srcdir')
diff --git a/subprojects/wayland.wrap b/subprojects/wayland.wrap
new file mode 100644
index 0000000000..5be67bf491
--- /dev/null
+++ b/subprojects/wayland.wrap
@@ -0,0 +1,8 @@
+[wrap-git]
+directory=wayland
+url=https://gitlab.freedesktop.org/wayland/wayland.git
+revision=main
+depth=1
+
+[provide]
+dependency_names = wayland-client, wayland-egl