From 96db3a90edb2f2c65ad9d1572c1246e0206b45c5 Mon Sep 17 00:00:00 2001 From: Christopher Bergqvist Date: Fri, 31 Mar 2023 15:01:11 +0200 Subject: cogl+gtk: Avoid depending on GNOME Bugzilla server Checking in local patch files instead. GNOME Bugzilla has been deprecated in favor of Gitlab. Fetching patches from Bugzilla may some day start failing, so grab 'em while we can. Note that FreeCiv has moved on to GTK 3 so not sure how useful the GTK 2 patch still is. --- pkgs/development/libraries/gtk/2.x.nix | 5 +- ...ome_bugzilla_557780_306776_freeciv_darwin.patch | 54 ++++++++++++++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 pkgs/development/libraries/gtk/patches/2.0-gnome_bugzilla_557780_306776_freeciv_darwin.patch (limited to 'pkgs/development/libraries/gtk') diff --git a/pkgs/development/libraries/gtk/2.x.nix b/pkgs/development/libraries/gtk/2.x.nix index 1f66917d3b2a4..4a77afa176a63 100644 --- a/pkgs/development/libraries/gtk/2.x.nix +++ b/pkgs/development/libraries/gtk/2.x.nix @@ -46,10 +46,7 @@ stdenv.mkDerivation (finalAttrs: { ./patches/2.0-immodules.cache.patch ./patches/gtk2-theme-paths.patch ] ++ lib.optionals stdenv.isDarwin [ - (fetchpatch { - url = "https://bug557780.bugzilla-attachments.gnome.org/attachment.cgi?id=306776"; - sha256 = "0sp8f1r5c4j2nlnbqgv7s7nxa4cfwigvm033hvhb1ld652pjag4r"; - }) + ./patches/2.0-gnome_bugzilla_557780_306776_freeciv_darwin.patch ./patches/2.0-darwin-x11.patch ]; diff --git a/pkgs/development/libraries/gtk/patches/2.0-gnome_bugzilla_557780_306776_freeciv_darwin.patch b/pkgs/development/libraries/gtk/patches/2.0-gnome_bugzilla_557780_306776_freeciv_darwin.patch new file mode 100644 index 0000000000000..3b1c080abf083 --- /dev/null +++ b/pkgs/development/libraries/gtk/patches/2.0-gnome_bugzilla_557780_306776_freeciv_darwin.patch @@ -0,0 +1,54 @@ +From 8b822ab0060acdf4217f589411fe71574cbb09c0 Mon Sep 17 00:00:00 2001 +From: Daniel Trebbien +Date: Fri, 3 Jul 2015 12:08:18 -0400 +Subject: [PATCH] quartz: Bug 557780 - Missing support for depth == 1 in + gdk_image_new_for_depth() + +When the gtk2 client of Freeciv is started, an assertion failure is seen +immediately and the client stops: +"Gdk:ERROR:gdkimage-quartz.c:325:_gdk_image_new_for_depth: assertion +failed: (depth == 24 || depth == 32)" + +In this case, _gdk_image_new_for_depth() is being called from +_gdk_quartz_image_copy_to_image(). The GdkImage passed to this function +is NULL so a new GdkImage is created. However, the depth of the passed +GdkDrawable is 1 and this is passed directly as the `depth' parameter to +_gdk_image_new_for_depth(), leading to the assertion failure. + +In _gdk_quartz_image_copy_to_image(), rather than directly pass the +GdkDrawable's depth to _gdk_image_new_for_depth(), if the depth is 1, +then create the new GdkImage with depth 24. The case where the depth is +1 is already handled in _gdk_quartz_image_copy_to_image(). + +This allows the Freeciv 2.5.0 gtk2 client to start and play a game. +--- + gdk/quartz/gdkimage-quartz.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/gdk/quartz/gdkimage-quartz.c b/gdk/quartz/gdkimage-quartz.c +index 493efba..853ef61 100644 +--- a/gdk/quartz/gdkimage-quartz.c ++++ b/gdk/quartz/gdkimage-quartz.c +@@ -43,10 +43,15 @@ _gdk_quartz_image_copy_to_image (GdkDrawable *drawable, + + screen = gdk_drawable_get_screen (drawable); + if (!image) +- image = _gdk_image_new_for_depth (screen, GDK_IMAGE_FASTEST, NULL, +- width, height, +- gdk_drawable_get_depth (drawable)); +- ++ { ++ gint drawable_depth = gdk_drawable_get_depth (drawable); ++ if (drawable_depth == 1) ++ drawable_depth = 24; ++ image = _gdk_image_new_for_depth (screen, GDK_IMAGE_FASTEST, NULL, ++ width, height, ++ drawable_depth); ++ } ++ + if (GDK_IS_PIXMAP_IMPL_QUARTZ (drawable)) + { + GdkPixmapImplQuartz *pix_impl; +-- +2.3.2 (Apple Git-55) + -- cgit 1.4.1