#9 Backport `screenshot: Grab screenshot during paint on X11` from upstream
Closed a year ago by luk1337. Opened a year ago by luk1337.
rpms/ luk1337/gnome-shell f33  into  f33

@@ -0,0 +1,92 @@ 

+ From d5fb557b3f804751ce03e643653c0fd041a37be8 Mon Sep 17 00:00:00 2001

+ From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>

+ Date: Mon, 14 Dec 2020 14:11:37 +0000

+ Subject: [PATCH] screenshot: Grab screenshot during paint on X11

+ 

+ We might not be able to directly paint the stage to an offscreen, if

+ there currently is a fullscreen unredirected window. To make it possible

+ to take a screenshot in this situation, disable unredirecting, queue a

+ frame, and take a screenshot after having painted that frame, before we

+ go back being unredirected.

+ 

+ Don't do this on Wayland because it's a waste.

+ 

+ Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1453

+ 

+ 

+ (cherry picked from commit c09be8b0a9395f5ce0c4210356f6532bd3bfa0c4)

+ 

+ Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1536>

+ ---

+  src/shell-screenshot.c | 34 +++++++++++++++++++++++++++++++++-

+  1 file changed, 33 insertions(+), 1 deletion(-)

+ 

+ diff --git a/src/shell-screenshot.c b/src/shell-screenshot.c

+ index 2505fc11dabd..1545b86a70cb 100644

+ --- a/src/shell-screenshot.c

+ +++ b/src/shell-screenshot.c

+ @@ -32,6 +32,7 @@ struct _ShellScreenshotPrivate

+    ShellGlobal *global;

+  

+    GOutputStream *stream;

+ +  ShellScreenshotFlag flags;

+  

+    GDateTime *datetime;

+  

+ @@ -338,6 +339,22 @@ finish_screenshot (ShellScreenshot        *screenshot,

+    return TRUE;

+  }

+  

+ +static void

+ +on_after_paint (ClutterStage     *stage,

+ +                ClutterStageView *view,

+ +                GTask            *result)

+ +{

+ +  ShellScreenshot *screenshot = g_task_get_task_data (result);

+ +  ShellScreenshotPrivate *priv = screenshot->priv;

+ +  MetaDisplay *display = shell_global_get_display (priv->global);

+ +

+ +  g_signal_handlers_disconnect_by_func (stage, on_after_paint, result);

+ +

+ +  grab_screenshot (screenshot, priv->flags, result);

+ +

+ +  meta_enable_unredirect_for_display (display);

+ +}

+ +

+  /**

+   * shell_screenshot_screenshot:

+   * @screenshot: the #ShellScreenshot

+ @@ -382,6 +399,7 @@ shell_screenshot_screenshot (ShellScreenshot     *screenshot,

+  

+    result = g_task_new (screenshot, NULL, callback, user_data);

+    g_task_set_source_tag (result, shell_screenshot_screenshot);

+ +  g_task_set_task_data (result, screenshot, NULL);

+  

+    priv->stream = g_object_ref (stream);

+  

+ @@ -389,7 +407,21 @@ shell_screenshot_screenshot (ShellScreenshot     *screenshot,

+    if (include_cursor)

+      flags |= SHELL_SCREENSHOT_FLAG_INCLUDE_CURSOR;

+  

+ -  grab_screenshot (screenshot, flags, result);

+ +  if (meta_is_wayland_compositor ())

+ +    {

+ +      grab_screenshot (screenshot, flags, result);

+ +    }

+ +  else

+ +    {

+ +      MetaDisplay *display = shell_global_get_display (priv->global);

+ +      ClutterStage *stage = shell_global_get_stage (priv->global);

+ +

+ +      meta_disable_unredirect_for_display (display);

+ +      clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));

+ +      priv->flags = flags;

+ +      g_signal_connect (stage, "after-paint",

+ +                        G_CALLBACK (on_after_paint), result);

+ +    }

+  }

+  

+  /**

+ -- 

+ 2.29.2

+ 

file modified
+6 -1
@@ -1,6 +1,6 @@ 

  Name:           gnome-shell

  Version:        3.38.2

- Release:        2%{?dist}

+ Release:        3%{?dist}

  Summary:        Window management and application launching for GNOME

  

  License:        GPLv2+
@@ -13,6 +13,8 @@ 

  

  Patch2: 0001-Revert-appDisplay-baseAppView-Cleanup-animate.patch

  

+ Patch3: 0001-screenshot-Grab-screenshot-during-paint-on-X11.patch

+ 

  %define eds_version 3.33.1

  %define gnome_desktop_version 3.35.91

  %define glib2_version 2.56.0
@@ -219,6 +221,9 @@ 

  %{_mandir}/man1/gnome-shell.1*

  

  %changelog

+ * Mon Dec 14 2020 Łukasz Patron <priv.luk@gmail.com> - 3.38.2-3

+ - Fix X11 screenshots for full screen apps/games (issue #1453)

+ 

  * Fri Dec 11 2020 Florian Müllner <fmuellner@redhat.com> - 3.38.2-2

  - Fix vanishing app picker icons

  

no initial comment

Hey, this patch addresses https://gitlab.gnome.org/GNOME/mutter/-/issues/1453 that many people been facing on F33, it'd be nice to have it merged here ^.^

rebased onto 33baff2

a year ago

rebased onto f422f80

a year ago

I merged it after swapping the patch with the one that was cherry-picked to the upstream gnome-3-38 branch.

However, there's something that's broken with the f33 build root for s390x that's preventing it from getting built: https://koji.fedoraproject.org/koji/taskinfo?taskID=57464658

Seems like Pagure didn't pick up the merge through the command line.

Pull-Request has been closed by rishi

a year ago

Pull-Request has been closed by luk1337

a year ago