public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/gnome-kiosk] rawhide: Upstream backport: screenshot - adapt to WindowActor.get_image API change
@ 2026-08-04 5:46 Jan Grulich
0 siblings, 0 replies; only message in thread
From: Jan Grulich @ 2026-08-04 5:46 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/gnome-kiosk
Branch : rawhide
Commit : 51346fe156fad50583eb27a1dfd55711eee5a482
Author : Jan Grulich <jgrulich@redhat.com>
Date : 2026-08-04T07:39:46+02:00
Stats : +149/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/gnome-kiosk/c/51346fe156fad50583eb27a1dfd55711eee5a482?branch=rawhide
Log:
Upstream backport: screenshot - adapt to WindowActor.get_image API change
---
diff --git a/gnome-kiosk-screenshot-adapt-to-windowactor-get_image-api_change.patch b/gnome-kiosk-screenshot-adapt-to-windowactor-get_image-api_change.patch
new file mode 100644
index 0000000..ffed606
--- /dev/null
+++ b/gnome-kiosk-screenshot-adapt-to-windowactor-get_image-api_change.patch
@@ -0,0 +1,146 @@
+From 3cd7127c02acd1423bc790b335b8f0ede526a8c4 Mon Sep 17 00:00:00 2001
+From: Bilal Elmoussaoui <belmouss@redhat.com>
+Date: Wed, 11 Mar 2026 15:41:04 +0100
+Subject: [PATCH 1/2] screenshot: Adapt to WindowActor.get_image API changes
+
+Part-of: <https://gitlab.gnome.org/GNOME/gnome-kiosk/-/merge_requests/136>
+---
+ compositor/kiosk-screenshot.c | 36 ++++++++++++++++++++++++++++++++---
+ meson.build | 1 +
+ 2 files changed, 34 insertions(+), 3 deletions(-)
+
+diff --git a/compositor/kiosk-screenshot.c b/compositor/kiosk-screenshot.c
+index 954cfee..00b8815 100644
+--- a/compositor/kiosk-screenshot.c
++++ b/compositor/kiosk-screenshot.c
+@@ -6,6 +6,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+
++#include <cairo.h>
+ #include <cogl/cogl.h>
+
+ #include <meta/display.h>
+@@ -24,6 +25,16 @@
+
+ /* This code is a largely based on GNOME Shell implementation of ShellScreenshot */
+
++static cairo_user_data_key_t data_key;
++
++static void
++bitmap_unmap_and_unref (void *data)
++{
++ CoglBitmap *bitmap = data;
++ cogl_bitmap_unmap (bitmap);
++ g_object_unref (bitmap);
++}
++
+ typedef enum _KioskScreenshotFlag
+ {
+ KIOSK_SCREENSHOT_FLAG_NONE,
+@@ -544,6 +555,9 @@ grab_window_screenshot (KioskScreenshot *screenshot,
+ ClutterActor *window_actor;
+ gfloat actor_x, actor_y;
+ MtkRectangle rect;
++ g_autoptr (CoglBitmap) bitmap = NULL;
++ uint8_t *data;
++ int width, height, stride;
+
+ window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window));
+ clutter_actor_get_position (window_actor, &actor_x, &actor_y);
+@@ -555,16 +569,32 @@ grab_window_screenshot (KioskScreenshot *screenshot,
+
+ screenshot->screenshot_area = rect;
+
+- screenshot->image = meta_window_actor_get_image (META_WINDOW_ACTOR (window_actor),
+- NULL);
++ bitmap = meta_window_actor_paint_to_bitmap (META_WINDOW_ACTOR (window_actor), NULL,
++ COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT);
++ if (!bitmap) {
++ g_task_report_new_error (screenshot, on_screenshot_written, result, NULL,
++ G_IO_ERROR, G_IO_ERROR_FAILED,
++ "Capturing window failed");
++ return;
++ }
+
+- if (!screenshot->image) {
++ width = cogl_bitmap_get_width (bitmap);
++ height = cogl_bitmap_get_height (bitmap);
++ stride = cogl_bitmap_get_rowstride (bitmap);
++ data = cogl_bitmap_map (bitmap, COGL_BUFFER_ACCESS_READ, 0, NULL);
++ if (!data) {
+ g_task_report_new_error (screenshot, on_screenshot_written, result, NULL,
+ G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Capturing window failed");
+ return;
+ }
+
++ screenshot->image = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_ARGB32,
++ width, height, stride);
++ cairo_surface_set_user_data (screenshot->image, &data_key,
++ g_steal_pointer (&bitmap),
++ bitmap_unmap_and_unref);
++
+ screenshot->datetime = g_date_time_new_now_local ();
+
+ if (flags & KIOSK_SCREENSHOT_FLAG_INCLUDE_CURSOR) {
+diff --git a/meson.build b/meson.build
+index d286b47..e9df6b7 100644
+--- a/meson.build
++++ b/meson.build
+@@ -193,6 +193,7 @@ compositor_dependencies += dependency('gnome-desktop-4')
+ compositor_dependencies += dependency('gobject-2.0')
+ compositor_dependencies += dependency('ibus-1.0')
+ compositor_dependencies += dependency('gdk-pixbuf-2.0')
++compositor_dependencies += dependency('cairo')
+ compositor_dependencies += dependency(libmutter_cogl_name)
+ compositor_dependencies += dependency(libmutter_clutter_name)
+ compositor_dependencies += mutter_dependency
+--
+GitLab
+
+
+From 3ae9e8331508a8a777d3a8d096ae92d6d76ea69d Mon Sep 17 00:00:00 2001
+From: Bilal Elmoussaoui <belmouss@redhat.com>
+Date: Mon, 16 Mar 2026 00:09:05 +0100
+Subject: [PATCH 2/2] Adapt to renamed pixel format
+
+Part-of: <https://gitlab.gnome.org/GNOME/gnome-kiosk/-/merge_requests/136>
+---
+ compositor/kiosk-screenshot.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/compositor/kiosk-screenshot.c b/compositor/kiosk-screenshot.c
+index 00b8815..142d6ed 100644
+--- a/compositor/kiosk-screenshot.c
++++ b/compositor/kiosk-screenshot.c
+@@ -436,7 +436,7 @@ do_grab_screenshot (KioskScreenshot *screenshot,
+ &screenshot_rect, scale,
+ cairo_image_surface_get_data (image),
+ cairo_image_surface_get_stride (image),
+- COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT,
++ COGL_PIXEL_FORMAT_ARGB32_NATIVE,
+ NULL,
+ paint_flags,
+ &error)) {
+@@ -485,7 +485,7 @@ draw_cursor_image (KioskScreenshot *screenshot,
+ height = cogl_texture_get_height (texture);
+ stride = 4 * width;
+ data = g_new (guint8, stride * height);
+- cogl_texture_get_data (texture, COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT, stride, data);
++ cogl_texture_get_data (texture, COGL_PIXEL_FORMAT_ARGB32_NATIVE, stride, data);
+
+ /* FIXME: cairo-gl? */
+ cursor_surface = cairo_image_surface_create_for_data (data,
+@@ -570,7 +570,7 @@ grab_window_screenshot (KioskScreenshot *screenshot,
+ screenshot->screenshot_area = rect;
+
+ bitmap = meta_window_actor_paint_to_bitmap (META_WINDOW_ACTOR (window_actor), NULL,
+- COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT);
++ COGL_PIXEL_FORMAT_ARGB32_NATIVE);
+ if (!bitmap) {
+ g_task_report_new_error (screenshot, on_screenshot_written, result, NULL,
+ G_IO_ERROR, G_IO_ERROR_FAILED,
+--
+GitLab
+
diff --git a/gnome-kiosk.spec b/gnome-kiosk.spec
index 22db9ec..c50d0b4 100644
--- a/gnome-kiosk.spec
+++ b/gnome-kiosk.spec
@@ -22,6 +22,9 @@ License: GPL-2.0-or-later
URL: https://gitlab.gnome.org/GNOME/gnome-kiosk
Source0: https://download.gnome.org/sources/%{name}/%{gnome_major_version}/%{name}-%{gnome_tarball_version}.tar.xz
+# https://gitlab.gnome.org/GNOME/gnome-kiosk/-/merge_requests/136
+Patch0: gnome-kiosk-screenshot-adapt-to-windowactor-get_image-api_change.patch
+
%gnome_check_version
%if %{with x11}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-04 5:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-04 5:46 [rpms/gnome-kiosk] rawhide: Upstream backport: screenshot - adapt to WindowActor.get_image API change Jan Grulich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox