Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package qtile for openSUSE:Factory checked in at 2024-09-16 17:46:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qtile (Old) and /work/SRC/openSUSE:Factory/.qtile.new.29891 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "qtile" Mon Sep 16 17:46:21 2024 rev:31 rq:1201444 version:0.28.1 Changes: -------- --- /work/SRC/openSUSE:Factory/qtile/qtile.changes 2024-08-16 12:24:33.777308660 +0200 +++ /work/SRC/openSUSE:Factory/.qtile.new.29891/qtile.changes 2024-09-16 17:46:25.069360334 +0200 @@ -1,0 +2,5 @@ +Mon Sep 16 13:30:59 UTC 2024 - Soc Virnyl Estela <obs@uncomfyhalomacro.pl> + +- Add ./workaround-new-cairocffi-api.patch from https://github.com/qtile/qtile/pull/4991 + +------------------------------------------------------------------- New: ---- workaround-new-cairocffi-api.patch BETA DEBUG BEGIN: New: - Add ./workaround-new-cairocffi-api.patch from https://github.com/qtile/qtile/pull/4991 BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qtile.spec ++++++ --- /var/tmp/diff_new_pack.PuvwVw/_old 2024-09-16 17:46:26.957439290 +0200 +++ /var/tmp/diff_new_pack.PuvwVw/_new 2024-09-16 17:46:26.957439290 +0200 @@ -30,6 +30,7 @@ Source0: https://files.pythonhosted.org/packages/source/q/%{name}/%{name}-%{version}.tar.gz Source1: %{name}-rpmlintrc Source3: %{name}-portals.conf +Patch1: https://github.com/qtile/qtile/pull/4991.patch#/workaround-new-cairocffi-api... BuildRequires: fdupes BuildRequires: gcc BuildRequires: gdk-pixbuf-loader-rsvg ++++++ workaround-new-cairocffi-api.patch ++++++ From 928e71d4d4e30b790289f045ee5a376d6a700b11 Mon Sep 17 00:00:00 2001 From: elParaguayo <elparaguayocode@gmail.com> Date: Fri, 6 Sep 2024 06:28:39 +0100 Subject: [PATCH] Always use `decode_to_image_surface` for images cairo 1.18.2 broke the `Img` object as we tried to create images using `ImageSurface.create_from_png` first. However, `cairocffi.pixbuf.decode_to_image_surface` seems to work for all formats so we can just use that. Fixed #4987 --- libqtile/images.py | 12 +----------- test/test_images.py | 13 +++++-------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/libqtile/images.py b/libqtile/images.py index 45c5f0be1c..aa73090927 100644 --- a/libqtile/images.py +++ b/libqtile/images.py @@ -18,7 +18,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import io import os from collections import namedtuple @@ -35,7 +34,7 @@ class LoadingError(Exception): _SurfaceInfo = namedtuple("_SurfaceInfo", ("surface", "file_type")) -def _decode_to_image_surface(bytes_img, width=None, height=None): +def get_cairo_surface(bytes_img, width=None, height=None): try: surf, fmt = cairocffi.pixbuf.decode_to_image_surface(bytes_img, width, height) return _SurfaceInfo(surf, fmt) @@ -51,15 +50,6 @@ def _decode_to_image_surface(bytes_img, width=None, height=None): return _SurfaceInfo(surf, fmt) -def get_cairo_surface(bytes_img, width=None, height=None): - try: - surf = cairocffi.ImageSurface.create_from_png(io.BytesIO(bytes_img)) - return _SurfaceInfo(surf, "png") - except (MemoryError, OSError): - pass - return _decode_to_image_surface(bytes_img, width, height) - - def get_cairo_pattern(surface, width=None, height=None, theta=0.0): """Return a SurfacePattern from an ImageSurface. diff --git a/test/test_images.py b/test/test_images.py index 53997da57f..8b612e3644 100644 --- a/test/test_images.py +++ b/test/test_images.py @@ -122,18 +122,15 @@ def test_pattern(self, path_n_bytes_image): img = images.Img(bytes_image) assert isinstance(img.pattern, cairocffi.SurfacePattern) - def test_pattern_resize(self, path_n_bytes_image_pngs): + def test_surface_resize(self, path_n_bytes_image_pngs): path, bytes_image = path_n_bytes_image_pngs img = images.Img.from_path(path) - assert isinstance(img.pattern, cairocffi.SurfacePattern) - t_matrix = img.pattern.get_matrix().as_tuple() - assert_approx_equal(t_matrix, (1.0, 0.0, 0.0, 1.0)) + original_width = img.width + original_height = img.height img.width = 2.0 * img.default_size.width - t_matrix = img.pattern.get_matrix().as_tuple() - assert_approx_equal(t_matrix, (0.5, 0.0, 0.0, 1.0)) + assert img.surface.get_width() == 2 * original_width img.height = 3.0 * img.default_size.height - t_matrix = img.pattern.get_matrix().as_tuple() - assert_approx_equal(t_matrix, (0.5, 0.0, 0.0, 1.0 / 3.0)) + assert img.surface.get_height() == 3 * original_height def test_pattern_rotate(self, path_n_bytes_image): path, bytes_image = path_n_bytes_image