From d5ada973fb7ae3f6574bca63bf229992cdf5182d Mon Sep 17 00:00:00 2001 From: eabdullin Date: Tue, 28 Jan 2025 07:45:11 +0000 Subject: [PATCH] Import from CS git --- .mutter.metadata | 1 + ...rn-icons-from-WM_HINTS-pixmaps-to-ca.patch | 101 ++++++++++++++++++ SPECS/mutter.spec | 9 +- 3 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 .mutter.metadata create mode 100644 SOURCES/0001-x11-iconcache-Turn-icons-from-WM_HINTS-pixmaps-to-ca.patch diff --git a/.mutter.metadata b/.mutter.metadata new file mode 100644 index 0000000..9e3c1a4 --- /dev/null +++ b/.mutter.metadata @@ -0,0 +1 @@ +5068f43514a6212e4b5b5f7f856b7713cbc3d420 SOURCES/mutter-3.32.2.tar.xz diff --git a/SOURCES/0001-x11-iconcache-Turn-icons-from-WM_HINTS-pixmaps-to-ca.patch b/SOURCES/0001-x11-iconcache-Turn-icons-from-WM_HINTS-pixmaps-to-ca.patch new file mode 100644 index 0000000..04ad83a --- /dev/null +++ b/SOURCES/0001-x11-iconcache-Turn-icons-from-WM_HINTS-pixmaps-to-ca.patch @@ -0,0 +1,101 @@ +From eb99d91c61d1a7e33ee6c8efa47ba7214cf913e3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Wed, 4 Dec 2024 14:04:45 +0100 +Subject: [PATCH] x11/iconcache: Turn icons from WM_HINTS pixmaps to cairo + image surface + +There were two problems with how windows icons coming from WM_HINTS were handled: + +Only xlib cairo surfaces directly from Pixmap's were created, while the +gnome-shell image cache only supported handling image surfaces. Address this by +creating a cairo image surface, and paint the pixmap cairo surface onto it, +later discarding the pixmap surface. + +Cairo surfaces were only created given a matching X11 visual. This only worked +for pixmaps with a bit depth of 24 or higher, meaning bitmap pixmaps got +discarded. Address this by creating bitmap surfaces using +cairo_xlib_surface_create_for_bitmap(), then using the bitmap surface as a mask +drawing it using black on a white surface. +--- + src/x11/iconcache.c | 57 +++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 52 insertions(+), 5 deletions(-) + +diff --git a/src/x11/iconcache.c b/src/x11/iconcache.c +index 521c77b8d2..f085a5ec1b 100644 +--- a/src/x11/iconcache.c ++++ b/src/x11/iconcache.c +@@ -293,7 +293,6 @@ surface_from_pixmap (Display *xdisplay, Pixmap xpixmap, + int width, int height) + { + Window root_return; +- XVisualInfo visual_info; + int x_ret, y_ret; + unsigned int w_ret, h_ret, bw_ret, depth_ret; + +@@ -301,11 +300,59 @@ surface_from_pixmap (Display *xdisplay, Pixmap xpixmap, + &x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret)) + return NULL; + +- if (!XMatchVisualInfo (xdisplay, DefaultScreen (xdisplay), +- depth_ret, TrueColor, &visual_info)) +- return NULL; ++ if (depth_ret == 1) ++ { ++ cairo_surface_t *bitmap_surface; ++ cairo_surface_t *icon_surface; ++ cairo_t *cr; + +- return cairo_xlib_surface_create (xdisplay, xpixmap, visual_info.visual, w_ret, h_ret); ++ bitmap_surface = ++ cairo_xlib_surface_create_for_bitmap (xdisplay, ++ xpixmap, ++ DefaultScreenOfDisplay (xdisplay), ++ w_ret, ++ h_ret); ++ ++ icon_surface = cairo_surface_create_similar_image (bitmap_surface, ++ CAIRO_FORMAT_ARGB32, ++ w_ret, h_ret); ++ cr = cairo_create (icon_surface); ++ cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0); ++ cairo_fill (cr); ++ cairo_paint (cr); ++ cairo_set_source_surface (cr, bitmap_surface, 0, 0); ++ cairo_set_operator (cr, CAIRO_OPERATOR_MULTIPLY); ++ cairo_paint_with_alpha (cr, 1.0); ++ cairo_destroy (cr); ++ cairo_surface_destroy (bitmap_surface); ++ return icon_surface; ++ } ++ else ++ { ++ XVisualInfo visual_info; ++ cairo_surface_t *pixmap_surface; ++ cairo_surface_t *icon_surface; ++ cairo_t *cr; ++ ++ if (!XMatchVisualInfo (xdisplay, DefaultScreen (xdisplay), ++ depth_ret, TrueColor, &visual_info)) ++ return NULL; ++ ++ pixmap_surface = cairo_xlib_surface_create (xdisplay, ++ xpixmap, ++ visual_info.visual, ++ w_ret, ++ h_ret); ++ icon_surface = cairo_surface_create_similar_image (pixmap_surface, ++ CAIRO_FORMAT_ARGB32, ++ w_ret, h_ret); ++ cr = cairo_create (icon_surface); ++ cairo_set_source_surface (cr, pixmap_surface, 0, 0); ++ cairo_paint (cr); ++ cairo_destroy (cr); ++ cairo_surface_destroy (pixmap_surface); ++ return icon_surface; ++ } + } + + static gboolean +-- +2.44.0.501.g19981daefd.dirty + diff --git a/SPECS/mutter.spec b/SPECS/mutter.spec index d3e45b1..ec9ec4d 100644 --- a/SPECS/mutter.spec +++ b/SPECS/mutter.spec @@ -8,7 +8,7 @@ Name: mutter Version: 3.32.2 -Release: 72%{?dist} +Release: 73%{?dist} Summary: Window and compositing manager based on Clutter License: GPLv2+ @@ -217,6 +217,9 @@ Patch531: 0001-renderer-native-Queue-fail-safe-callbacks-when-mode-.patch Patch532: 0001-core-Change-MetaWaylandTextInput-event-forwarding-to.patch +# RHEL-35286 +Patch533: 0001-x11-iconcache-Turn-icons-from-WM_HINTS-pixmaps-to-ca.patch + BuildRequires: chrpath BuildRequires: pango-devel BuildRequires: startup-notification-devel @@ -358,6 +361,10 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop %{_datadir}/mutter-%{mutter_api_version}/tests %changelog +* Wed Dec 04 2024 Jonas Ã…dahl - 3.32.2-73 +- Fix handling of more WM_HINTS window icon types + Resolves: RHEL-35286 + * Mon Oct 02 2023 Jan Grulich - 3.32.2-72 - Do not use DMA buffers for screencast when the client doesn't support it - Use DMA buffers only for i195 drivers