From ab1bc689b82f8c7d619fe1cd7baee93acfa1ef08 Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 08:27:49 +0200 Subject: [PATCH 01/20] tests: fix GtkBuilder signal callback prototypes Based on the Guix gtk2-fix-builder-test.patch. The callbacks are connected to notify-style signals and must take a GParamSpec pointer, not a GParamSpec by value. This avoids stack/register ABI problems on platforms such as ppc64el. --- gtk/tests/builder.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gtk/tests/builder.c b/gtk/tests/builder.c index ebba220e9..121012704 100644 --- a/gtk/tests/builder.c +++ b/gtk/tests/builder.c @@ -132,7 +132,7 @@ static int object = 0; static int object_after = 0; void /* exported for GtkBuilder */ -signal_normal (GtkWindow *window, GParamSpec spec) +signal_normal (GtkWindow *window, GParamSpec *spec) { g_assert (GTK_IS_WINDOW (window)); g_assert (normal == 0); @@ -142,7 +142,7 @@ signal_normal (GtkWindow *window, GParamSpec spec) } void /* exported for GtkBuilder */ -signal_after (GtkWindow *window, GParamSpec spec) +signal_after (GtkWindow *window, GParamSpec *spec) { g_assert (GTK_IS_WINDOW (window)); g_assert (normal == 1); @@ -152,7 +152,7 @@ signal_after (GtkWindow *window, GParamSpec spec) } void /* exported for GtkBuilder */ -signal_object (GtkButton *button, GParamSpec spec) +signal_object (GtkButton *button, GParamSpec *spec) { g_assert (GTK_IS_BUTTON (button)); g_assert (object == 0); @@ -162,7 +162,7 @@ signal_object (GtkButton *button, GParamSpec spec) } void /* exported for GtkBuilder */ -signal_object_after (GtkButton *button, GParamSpec spec) +signal_object_after (GtkButton *button, GParamSpec *spec) { g_assert (GTK_IS_BUTTON (button)); g_assert (object == 1); @@ -172,28 +172,28 @@ signal_object_after (GtkButton *button, GParamSpec spec) } void /* exported for GtkBuilder */ -signal_first (GtkButton *button, GParamSpec spec) +signal_first (GtkButton *button, GParamSpec *spec) { g_assert (normal == 0); normal = 10; } void /* exported for GtkBuilder */ -signal_second (GtkButton *button, GParamSpec spec) +signal_second (GtkButton *button, GParamSpec *spec) { g_assert (normal == 10); normal = 20; } void /* exported for GtkBuilder */ -signal_extra (GtkButton *button, GParamSpec spec) +signal_extra (GtkButton *button, GParamSpec *spec) { g_assert (normal == 20); normal = 30; } void /* exported for GtkBuilder */ -signal_extra2 (GtkButton *button, GParamSpec spec) +signal_extra2 (GtkButton *button, GParamSpec *spec) { g_assert (normal == 30); normal = 40; From be9c6f513ef172a9cf641134b614ea1d4f3baa9d Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 08:34:50 +0200 Subject: [PATCH 02/20] gtkrc: search XDG data dirs for themes Based on the Guix gtk2-theme-paths.patch by Jookia. Keep the existing ~/.themes and gtk_rc_get_theme_dir() lookup paths, but check g_get_system_data_dirs() in between so profile- and prefix-based theme installations can be found. --- gtk/gtkrc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c index 7bfbea85c..d316a0d90 100644 --- a/gtk/gtkrc.c +++ b/gtk/gtkrc.c @@ -808,6 +808,8 @@ gtk_rc_parse_named (GtkRcContext *context, gchar *path = NULL; const gchar *home_dir; gchar *subpath; + const gchar * const *xdg_data_dirs; + gint i; if (type) subpath = g_strconcat ("gtk-2.0-", type, @@ -829,6 +831,22 @@ gtk_rc_parse_named (GtkRcContext *context, } } + if (!path) + { + xdg_data_dirs = g_get_system_data_dirs (); + for (i = 0; xdg_data_dirs[i]; i++) + { + path = g_build_filename (xdg_data_dirs[i], "themes", name, subpath, NULL); + if (g_file_test (path, G_FILE_TEST_EXISTS)) + break; + else + { + g_free (path); + path = NULL; + } + } + } + if (!path) { gchar *theme_dir = gtk_rc_get_theme_dir (); From 7fa38dd2dfc39494b4c28511fbaa7546e2571bb1 Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 09:15:53 +0200 Subject: [PATCH 03/20] build: disable GNU visibility aliases on Apple platforms Based on the MacPorts patch-aliases.diff. Keep the existing GNU visibility alias generation on other platforms, but avoid it on Apple targets where this alias mechanism is not suitable. --- gdk/makegdkalias.pl | 2 +- gtk/makegtkalias.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gdk/makegdkalias.pl b/gdk/makegdkalias.pl index 97a6e6007..27646cc0a 100755 --- a/gdk/makegdkalias.pl +++ b/gdk/makegdkalias.pl @@ -14,7 +14,7 @@ print < -#ifdef G_HAVE_GNUC_VISIBILITY +#if defined(G_HAVE_GNUC_VISIBILITY) && !defined(__APPLE__) EOF diff --git a/gtk/makegtkalias.pl b/gtk/makegtkalias.pl index 3f956b05e..67ec7c973 100755 --- a/gtk/makegtkalias.pl +++ b/gtk/makegtkalias.pl @@ -14,7 +14,7 @@ print < -#ifdef G_HAVE_GNUC_VISIBILITY +#if defined(G_HAVE_GNUC_VISIBILITY) && !defined(__APPLE__) EOF From 9899e80a8e7215064dd11d488360642600353580 Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 09:16:45 +0200 Subject: [PATCH 04/20] quartz: add newer macOS version constants Based on the MacPorts patch-gdkquartz-osx-versions.diff. Extend the Quartz OS version enum so later macOS-specific code can distinguish Catalina, Big Sur, Monterey, Ventura, Sonoma, and Sequoia while preserving the existing older constants. --- gdk/quartz/gdkquartz.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gdk/quartz/gdkquartz.h b/gdk/quartz/gdkquartz.h index 8206db019..42aac50b9 100644 --- a/gdk/quartz/gdkquartz.h +++ b/gdk/quartz/gdkquartz.h @@ -54,7 +54,13 @@ typedef enum GDK_OSX_SIERRA = 12, GDK_OSX_HIGH_SIERRA = 13, GDK_OSX_MOJAVE = 14, - GDK_OSX_CURRENT = 14, + GDK_OSX_CATALINA = 15, + GDK_OSX_BIG_SUR = 16, + GDK_OSX_MONTEREY = 17, + GDK_OSX_VENTURA = 18, + GDK_OSX_SONOMA = 19, + GDK_OSX_SEQUOIA = 20, + GDK_OSX_CURRENT = 20, GDK_OSX_NEW = 99 } GdkOSXVersion; From b5516b9b02c8a07066fa1898c111b341a5b6e991 Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 09:27:16 +0200 Subject: [PATCH 05/20] quartz: avoid focus locking on Mojave and newer Based on part of the MacPorts Big Sur performance patch for GIMP issue 5989. The NSView focus-locking API is deprecated on newer macOS releases and can cause expensive redraw behaviour. Keep the old path for older macOS versions, but avoid lockFocusIfCanDraw/unlockFocus on Mojave and newer. --- gdk/quartz/gdkdrawable-quartz.c | 3 ++- gdk/quartz/gdkwindow-quartz.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c index 11dd12737..eb520f08d 100644 --- a/gdk/quartz/gdkdrawable-quartz.c +++ b/gdk/quartz/gdkdrawable-quartz.c @@ -893,7 +893,8 @@ gdk_quartz_drawable_release_context (GdkDrawable *drawable, if (window_impl->in_paint_rect_count == 0) { _gdk_quartz_drawable_flush (drawable); - [window_impl->view unlockFocus]; + if (gdk_quartz_osx_version () < GDK_OSX_MOJAVE) + [window_impl->view unlockFocus]; } } else if (GDK_IS_PIXMAP_IMPL_QUARTZ (drawable)) diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index 6c7a2facb..205fd85e6 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -104,7 +104,8 @@ gdk_window_impl_quartz_get_context (GdkDrawable *drawable, * and for widgets that send fake expose events like the arrow * buttons in spinbuttons or the position marker in rulers. */ - if (window_impl->in_paint_rect_count == 0) + if (window_impl->in_paint_rect_count == 0 && + gdk_quartz_osx_version () < GDK_OSX_MOJAVE) { if (![window_impl->view lockFocusIfCanDraw]) return NULL; From c844f13c1a8534347683a4cb3b572a250b8890ec Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 09:29:27 +0200 Subject: [PATCH 06/20] quartz: map macOS 11 and newer to internal OS versions Based on part of the MacPorts Big Sur performance patch for GIMP issue 5989. GTK2 represents macOS 10.x releases by their minor version. Read the major version as well and map macOS 11 and newer into the same sequence so Big Sur and later releases can be detected correctly. --- gdk/quartz/gdkglobals-quartz.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gdk/quartz/gdkglobals-quartz.c b/gdk/quartz/gdkglobals-quartz.c index f013f2830..4e596eef5 100644 --- a/gdk/quartz/gdkglobals-quartz.c +++ b/gdk/quartz/gdkglobals-quartz.c @@ -34,9 +34,20 @@ gdk_quartz_osx_version (void) if (minor == GDK_OSX_UNSUPPORTED) { - OSErr err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&minor); + gint32 major = GDK_OSX_UNSUPPORTED; + OSErr err = Gestalt (gestaltSystemVersionMajor, (SInt32*)&major); g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED); + + err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&minor); + g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED); + + /* GTK2 encodes macOS 10.x releases by their minor version. + * Map macOS 11+ into the same sequence: + * 11 -> 16, 12 -> 17, 13 -> 18, ... + */ + if (major > 10) + minor = major + 5; } if (minor < GDK_OSX_MIN) From 0e992486949f3a958d96fb6607ed449a92efbb40 Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 09:32:30 +0200 Subject: [PATCH 07/20] quartz: use CGContext accessor on Yosemite and newer Based on part of the MacPorts Big Sur performance patch for GIMP issue 5989. Use the modern NSGraphicsContext CGContext accessor on Yosemite and newer, matching the existing Quartz window code, while preserving graphicsPort for older macOS versions. --- gtk/gtkquartz.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gtk/gtkquartz.c b/gtk/gtkquartz.c index 87ba87745..caf8404f8 100644 --- a/gtk/gtkquartz.c +++ b/gtk/gtkquartz.c @@ -67,7 +67,10 @@ _gtk_quartz_create_image_from_pixbuf (GdkPixbuf *pixbuf) } [nsimage lockFocus]; - context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; + if (gdk_quartz_osx_version () < GDK_OSX_YOSEMITE) + context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; + else + context = [[NSGraphicsContext currentContext] CGContext]; CGContextDrawImage (context, CGRectMake (0, 0, pixbuf_width, pixbuf_height), image); [nsimage unlockFocus]; From 92c319ab4e3f86ac0a7efc1df552d5835ea6f7cd Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 09:41:36 +0200 Subject: [PATCH 08/20] quartz: avoid screen update suppression on Mojave and newer Based on part of the MacPorts Big Sur performance patch for GIMP issue 5989. NSDisableScreenUpdates and NSEnableScreenUpdates are deprecated on newer macOS releases. Keep using them for older macOS versions, but avoid them on Mojave and newer. --- gdk/quartz/gdkwindow-quartz.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index 205fd85e6..5c1bde0cd 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -469,7 +469,8 @@ _gdk_windowing_before_process_all_updates (void) { in_process_all_updates = TRUE; - NSDisableScreenUpdates (); + if (gdk_quartz_osx_version () < GDK_OSX_MOJAVE) + NSDisableScreenUpdates (); } void @@ -503,7 +504,8 @@ _gdk_windowing_after_process_all_updates (void) in_process_all_updates = FALSE; - NSEnableScreenUpdates (); + if (gdk_quartz_osx_version () < GDK_OSX_MOJAVE) + NSEnableScreenUpdates (); } static void From d43c7a964f70384578f71e411eeb2864281e3931 Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 09:49:48 +0200 Subject: [PATCH 09/20] quartz: request 8-bit layer contents on Big Sur and newer Based on part of the MacPorts Big Sur performance patch for GIMP issue 5989. Use a dynamic Objective-C call to request 8-bit layer contents on macOS 11 and newer, avoiding a hard QuartzCore/CALayer compile-time dependency and preserving old behaviour on older macOS releases. --- gdk/quartz/GdkQuartzView.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gdk/quartz/GdkQuartzView.c b/gdk/quartz/GdkQuartzView.c index 368e040ec..bad737da2 100644 --- a/gdk/quartz/GdkQuartzView.c +++ b/gdk/quartz/GdkQuartzView.c @@ -599,6 +599,25 @@ gdk_screen_get_rgba_colormap (_gdk_screen); } +-(void)viewWillDraw +{ + /* macOS 11 (Big Sur) and newer may use a higher precision backing + * format for layer contents. For GTK2's 8-bit drawing this can add + * avoidable conversion overhead. Use a dynamic Objective-C call here + * instead of a hard QuartzCore/CALayer dependency, so old SDKs and old + * macOS targets keep building and keep their old behaviour. + */ + if (gdk_quartz_osx_version () >= GDK_OSX_BIG_SUR) + { + id layer = [self layer]; + + if (layer && [layer respondsToSelector: @selector(setContentsFormat:)]) + [layer setValue: @"RGBA8Uint" forKey: @"contentsFormat"]; + } + + [super viewWillDraw]; +} + -(void)drawRect: (NSRect)rect { GdkRectangle gdk_rect; From d75686a8642d38318199de014169f2370f98977d Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 09:54:51 +0200 Subject: [PATCH 10/20] quartz: avoid extra content invalidation on Big Sur and newer Based on part of the MacPorts Big Sur performance patch for GIMP issue 5989. Keep the existing Mojave-era setNeedsDisplay workaround for macOS 10.14 and 10.15, but avoid the extra full-window invalidation on Big Sur and newer where it can cause expensive redraw behaviour. --- gdk/quartz/gdkwindow-quartz.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index 5c1bde0cd..38ada80b2 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -491,8 +491,9 @@ _gdk_windowing_after_process_all_updates (void) /* 10.14 needs to be told that the view needs to be redrawn, see * https://gitlab.gnome.org/GNOME/gtk/issues/1479 */ - if (gdk_quartz_osx_version() >= GDK_OSX_MOJAVE) - [[nswindow contentView] setNeedsDisplay:YES]; + if (gdk_quartz_osx_version () >= GDK_OSX_MOJAVE && + gdk_quartz_osx_version () < GDK_OSX_BIG_SUR) + [[nswindow contentView] setNeedsDisplay:YES]; [nswindow enableFlushWindow]; [nswindow flushWindow]; [nswindow release]; From 682bbbe69d2345f38935709a797fac6840db35ce Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 09:59:26 +0200 Subject: [PATCH 11/20] quartz: avoid extra resize-idle updates on Big Sur and newer Based on part of the MacPorts Big Sur performance patch for GIMP issue 5989. Keep the existing gdk_window_process_all_updates() call for non-Quartz targets and for older macOS releases, but avoid this extra resize-idle update path on Big Sur and newer where it can contribute to expensive full-window redraw behaviour. --- gtk/gtkcontainer.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 2f7007fd2..e4c98c8c2 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -40,6 +40,9 @@ #include "gtktoolbar.h" #include #include +#ifdef GDK_WINDOWING_QUARTZ +#include "gdk/quartz/gdkquartz.h" +#endif #include "gtkalias.h" @@ -1357,7 +1360,16 @@ gtk_container_idle_sizer (gpointer data) gtk_container_check_resize (GTK_CONTAINER (widget)); } +#ifdef GDK_WINDOWING_QUARTZ + /* macOS 11 and newer can trigger expensive full-window redraws here. + * Keep the traditional update processing path for older Quartz targets, + * but let the normal GDK update idle handle updates on Big Sur and newer. + */ + if (gdk_quartz_osx_version () < GDK_OSX_BIG_SUR) + gdk_window_process_all_updates (); +#else gdk_window_process_all_updates (); +#endif return FALSE; } From 99aba6bf1d7f123ddd0be75e62e9065e86f760de Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 10:06:34 +0200 Subject: [PATCH 12/20] win32: improve mouse window lookup through transparent children Based on the MSYS2 0013_fix_mouse_events.patch. Use CWP_SKIPTRANSPARENT while walking from the desktop window, but stop skipping transparent windows after the first level so transparent child windows are still considered correctly. --- gdk/win32/gdkwindow-win32.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c index b7ea0404a..1a21a1b67 100644 --- a/gdk/win32/gdkwindow-win32.c +++ b/gdk/win32/gdkwindow-win32.c @@ -2767,6 +2767,10 @@ _gdk_windowing_window_at_pointer (GdkDisplay *display, * WindowFromPoint() can find our windows, we follow similar logic * here, and ignore invisible and disabled windows. */ + UINT cwp_flags = CWP_SKIPDISABLED | + CWP_SKIPINVISIBLE | + CWP_SKIPTRANSPARENT; + hwnd = GetDesktopWindow (); do { window = gdk_win32_handle_table_lookup ((GdkNativeWindow) hwnd); @@ -2777,8 +2781,7 @@ _gdk_windowing_window_at_pointer (GdkDisplay *display, break; screen_to_client (hwnd, screen_pt, &client_pt); - hwndc = ChildWindowFromPointEx (hwnd, client_pt, CWP_SKIPDISABLED | - CWP_SKIPINVISIBLE); + hwndc = ChildWindowFromPointEx (hwnd, client_pt, cwp_flags); /* Verify that we're really inside the client area of the window */ if (hwndc != hwnd) @@ -2789,6 +2792,8 @@ _gdk_windowing_window_at_pointer (GdkDisplay *display, hwndc = hwnd; } + /* Only ignore top-level transparent windows */ + cwp_flags &= ~CWP_SKIPTRANSPARENT; } while (hwndc != hwnd && (hwnd = hwndc, 1)); } From ccf110219cdf44cc4bae19cbe45bd8efb32153bc Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 10:07:25 +0200 Subject: [PATCH 13/20] icontheme: detect SVG icons by extension on Win32 Based on the MSYS2 0022-icontheme-win32-detect-SVG-files-by-extension.patch. Some Windows systems report .svg files with a generic or incorrect content type. On Win32, fall back to the .svg extension so SVG icons can still be detected. --- gtk/gtkicontheme.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index 0d4435c72..f8aaf9a3b 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -2945,6 +2945,10 @@ icon_info_ensure_scale_and_pixbuf (GtkIconInfo *icon_info, if (mime_type && strcmp (mime_type, "image/svg+xml") == 0) is_svg = TRUE; +#ifdef G_OS_WIN32 + else if (content_type && strcmp (content_type, ".svg") == 0) + is_svg = TRUE; +#endif } g_object_unref (file_info); From 30d4541d98fd6c2b9a929672dc892414b26638f8 Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 10:08:01 +0200 Subject: [PATCH 14/20] win32: initialize key state before updating keymap Based on the MSYS2 0023-gdkkeys-win32.c-fix-initialisation-of-key_state-in-u.patch. Clear the key_state array before using it during keymap updates so stale state cannot affect layout handling, including Japanese IME input. --- gdk/win32/gdkkeys-win32.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gdk/win32/gdkkeys-win32.c b/gdk/win32/gdkkeys-win32.c index d8ab30347..9a34083c4 100644 --- a/gdk/win32/gdkkeys-win32.c +++ b/gdk/win32/gdkkeys-win32.c @@ -692,6 +692,7 @@ update_keymap (GdkKeymap *gdk_keymap) if (hkls_len != keymap->layout_handles->len) keymap->keysym_tab = g_renew (guint, keymap->keysym_tab, keysym_tab_size); + memset (key_state, 0, sizeof(key_state)); memset (keymap->keysym_tab, 0, keysym_tab_size); g_array_set_size (keymap->layout_handles, hkls_len); g_array_set_size (keymap->options, hkls_len); From ea118685a9e5fbdf24942f2d20499acea8cebb56 Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 10:09:36 +0200 Subject: [PATCH 15/20] win32: quote icon cache manifest in resource file Based on the MSYS2 0024-gtk-update-icon-cache-rc-quote.patch. Quote the manifest path when generating the gtk-update-icon-cache resource file so windres parses it correctly. --- gtk/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 8f5e496a3..c3c9a1493 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -1139,7 +1139,7 @@ $(GTK_UPDATE_ICON_CACHE_MANIFEST): echo '' ) >$@ $(GTK_UPDATE_ICON_CACHE_RC): - (echo -e '#include \nCREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST '$(GTK_UPDATE_ICON_CACHE_MANIFEST)) >$@ + (echo -e '#include \nCREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "'$(GTK_UPDATE_ICON_CACHE_MANIFEST)'"') >$@ $(GTK_UPDATE_ICON_CACHE_MANIFEST_OBJECT): $(GTK_UPDATE_ICON_CACHE_RC) $(GTK_UPDATE_ICON_CACHE_MANIFEST) $(WINDRES) --input $< --output $@ --output-format=coff From ac4bf63e24c1434a749f57dbd4bf16a7f6c91407 Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 10:19:49 +0200 Subject: [PATCH 16/20] introspection: pass compiler and GTK DLL path to scanner Based on the MSYS2 0009-give-cc-to-gir-scanner.mingw.patch and 0010-put-gtk-dll-into-path.mingw.patch. Pass CC to g-ir-scanner and add the GTK build directory to PATH while scanning GTK, so MinGW builds can run the scanner with the just-built DLLs. --- gdk/Makefile.am | 2 ++ gtk/Makefile.am | 3 +++ 2 files changed, 5 insertions(+) diff --git a/gdk/Makefile.am b/gdk/Makefile.am index 1b186afa1..35dbc026c 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -2,6 +2,8 @@ include $(top_srcdir)/Makefile.decl -include $(INTROSPECTION_MAKEFILE) INTROSPECTION_GIRS = +INTROSPECTION_SCANNER_ENV = \ + CC="$(CC)" INTROSPECTION_SCANNER_ARGS = \ --warn-all \ --add-include-path=../gdk diff --git a/gtk/Makefile.am b/gtk/Makefile.am index c3c9a1493..f9a8472b9 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -2,6 +2,9 @@ include $(top_srcdir)/Makefile.decl -include $(INTROSPECTION_MAKEFILE) INTROSPECTION_GIRS = +INTROSPECTION_SCANNER_ENV = \ + CC="$(CC)" \ + PATH="$(builddir):$(builddir)/.libs:$${PATH}:" INTROSPECTION_SCANNER_ARGS = \ --warn-all \ --add-include-path=../gdk From 73360271b8de717f547a337e49f375b78f50a061 Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 10:48:27 +0200 Subject: [PATCH 17/20] introspection: add GdkWin32 GIR generation Based on the MSYS2 0011-gir-for-gdkwin32.mingw.patch. Add Win32 backend sources to introspection when building the Win32 target and generate GdkWin32-2.0.gir alongside the common Gdk-2.0 GIR. --- gdk/Makefile.am | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/gdk/Makefile.am b/gdk/Makefile.am index 35dbc026c..1b4cd9b50 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -215,6 +215,11 @@ Gdk_2_0_gir_CFLAGS = \ -I$(top_builddir) \ -I$(top_builddir)/gdk \ $(INCLUDES) + +if OS_WIN32 +Gdk_2_0_gir_CFLAGS += -I$(srcdir)/win32 -I$(srcdir) +endif + INTROSPECTION_GIRS += Gdk-2.0.gir if USE_X11 @@ -270,6 +275,62 @@ introspection_files += $(filter-out x11/gdkx.h, $(x11_introspection_files)) endif # USE_X11 +if OS_WIN32 +win32_introspection_files = \ + win32/gdkapplaunchcontext-win32.c \ + win32/gdkcolor-win32.c \ + win32/gdkcursor-win32.c \ + win32/gdkdisplay-win32.c \ + win32/gdkdnd-win32.c \ + win32/gdkdrawable-win32.c \ + win32/gdkdrawable-win32.h \ + win32/gdkevents-win32.c \ + win32/gdkfont-win32.c \ + win32/gdkgc-win32.c \ + win32/gdkgeometry-win32.c \ + win32/gdkglobals-win32.c \ + win32/gdkimage-win32.c \ + win32/gdkim-win32.c \ + win32/gdkinput.c \ + win32/gdkinput-win32.c \ + win32/gdkinput-win32.h \ + win32/gdkkeys-win32.c \ + win32/gdkmain-win32.c \ + win32/gdkpixmap-win32.c \ + win32/gdkpixmap-win32.h \ + win32/gdkprivate-win32.h \ + win32/gdkproperty-win32.c \ + win32/gdkscreen-win32.c \ + win32/gdkselection-win32.c \ + win32/gdkspawn-win32.c \ + win32/gdktestutils-win32.c \ + win32/gdkvisual-win32.c \ + win32/gdkwin32.h \ + win32/gdkwin32id.c \ + win32/gdkwindow-win32.c \ + win32/gdkwindow-win32.h + +GdkWin32-2.0.gir: $(gdktargetlib) Gdk-2.0.gir Makefile +GdkWin32_2_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=Gdk --symbol-prefix=gdk --include-uninstalled=Gdk-2.0.gir +GdkWin32_2_0_gir_INCLUDES = Gio-2.0 Gdk-2.0 GdkPixbuf-2.0 Pango-1.0 +GdkWin32_2_0_gir_LIBS = $(gdktargetlib) +GdkWin32_2_0_gir_FILES = $(win32_introspection_files) +GdkWin32_2_0_gir_EXPORT_PACKAGES = gdk-win32-2.0 +GdkWin32_2_0_gir_CFLAGS = \ + -DGDK_COMPILATION \ + -I$(top_srcdir) \ + -I$(top_builddir) \ + -I$(top_builddir)/gdk \ + -I$(srcdir)/win32 \ + -I$(srcdir) \ + $(INCLUDES) \ + -L$(top_builddir)/gdk +INTROSPECTION_GIRS += GdkWin32-2.0.gir + +introspection_files += $(filter-out win32/gdkwin32.h, $(win32_introspection_files)) + +endif # OS_WIN32 + girdir = $(datadir)/gir-1.0 gir_DATA = $(INTROSPECTION_GIRS) From 7a1874a0cca7c7137e54dcbabbf72a951564a606 Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 10:48:39 +0200 Subject: [PATCH 18/20] introspection: include Win32 keymap declarations Add gdkwin32keys.h to the Win32 introspection source list so exported Win32 keymap APIs are visible in GdkWin32-2.0.gir. The corresponding gdk_win32_keymap_get_type() and gdk_win32_keymap_check_compose() symbols are already exported, so this keeps the GIR closer to the installed Win32 API surface. --- gdk/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/gdk/Makefile.am b/gdk/Makefile.am index 1b4cd9b50..f9804aa85 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -307,6 +307,7 @@ win32_introspection_files = \ win32/gdkvisual-win32.c \ win32/gdkwin32.h \ win32/gdkwin32id.c \ + win32/gdkwin32keys.h \ win32/gdkwindow-win32.c \ win32/gdkwindow-win32.h From b82fd012594dc1066b7dc7868ca35bc19690705b Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Wed, 13 May 2026 10:55:56 +0200 Subject: [PATCH 19/20] docs: use top_srcdir for GDK X11 header reference Based on the MSYS2 0005-Fix-header-ref.all.patch. Use an explicit top_srcdir-relative path for gdkx.h in the GDK reference documentation instead of a fragile relative path. --- docs/reference/gdk/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/gdk/Makefile.am b/docs/reference/gdk/Makefile.am index c0facc151..43a67508c 100644 --- a/docs/reference/gdk/Makefile.am +++ b/docs/reference/gdk/Makefile.am @@ -37,7 +37,7 @@ IGNORE_HFILES= \ # Extra files to add when scanning (relative to $srcdir) EXTRA_HFILES= \ - ../../../gdk/x11/gdkx.h + $(top_srcdir)/gdk/x11/gdkx.h # CFLAGS and LDFLAGS for compiling scan program. Only needed # if $(DOC_MODULE).types is non-empty. From d8fe4bb226ebf160695094f438ffe0c710959f83 Mon Sep 17 00:00:00 2001 From: Daemonratte Date: Mon, 3 Aug 2026 14:49:45 +0200 Subject: [PATCH 20/20] fix alias check for out-of-tree builds --- gtk/aliasfilescheck.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gtk/aliasfilescheck.sh b/gtk/aliasfilescheck.sh index 31b49d451..59faa2326 100755 --- a/gtk/aliasfilescheck.sh +++ b/gtk/aliasfilescheck.sh @@ -5,7 +5,14 @@ if test "x$gtk_all_c_sources" = x; then exit 1 fi -grep 'IN_FILE' ${srcdir-.}/gtk.symbols | sed 's/.*(//;s/).*//' | grep __ | sort -u > expected-files -{ cd ${srcdir-.}; grep '^ *# *define __' $gtk_all_c_sources; } | sed 's/.*define //;s/ *$//' | sort > actual-files +srcdir=${srcdir-.} + +grep 'IN_FILE' "$srcdir/gtk.symbols" | sed 's/^[^(]*(//;s/).*//;s/__GTK_MARSHAL_MARSHAL_C__/__gtk_marshal_MARSHAL_C__/' | grep __ | sort -u > expected-files +{ + for file in $gtk_all_c_sources; do + test -f "$file" || file="$srcdir/$file" + grep '^ *# *define __' "$file" + done +} | sed 's/.*define //;s/ *$//;s/__GTK_MARSHAL_MARSHAL_C__/__gtk_marshal_MARSHAL_C__/' | sort > actual-files diff expected-files actual-files && rm -f expected-files actual-files