From 1793546d7abc18e4703645744fec94839ad5ebad Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 21 May 2019 07:10:04 +0200 Subject: [PATCH 01/11] win32: Remove unused variables --- gdk/win32/gdksurface-win32.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index 93deebb41c..a1157b33fb 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -55,7 +55,6 @@ static void gdk_surface_impl_win32_finalize (GObject *object); static gpointer parent_class = NULL; static GSList *modal_window_stack = NULL; -static const cairo_user_data_key_t gdk_win32_cairo_key; typedef struct _FullscreenInfo FullscreenInfo; struct _FullscreenInfo @@ -746,7 +745,6 @@ gdk_win32_surface_destroy (GdkSurface *window, gboolean foreign_destroy) { GdkSurfaceImplWin32 *surface_impl = GDK_SURFACE_IMPL_WIN32 (window->impl); - GSList *tmp; g_return_if_fail (GDK_IS_SURFACE (window)); From 0877b29e8eb99327deae2b3863f15ccab0e5fd60 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 21 May 2019 07:11:03 +0200 Subject: [PATCH 02/11] win32: Actually pass y variable for y parameter --- gdk/win32/gdkdrag-win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c index 318013c2d9..9d486e1543 100644 --- a/gdk/win32/gdkdrag-win32.c +++ b/gdk/win32/gdkdrag-win32.c @@ -1733,7 +1733,7 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface, GDK_NOTE (DND, g_print ("_gdk_win32_surface_drag_begin\n")); - gdk_device_get_position (device, &px, &px); + gdk_device_get_position (device, &px, &py); x_root = round (px) + dx; y_root = round (py) + dy; From 9521af0f6ab376c4b1ca16394872dfbc6a5676b3 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 21 May 2019 07:14:21 +0200 Subject: [PATCH 03/11] window: Remove unneeded variable The variable would show up as a gcc warning in builds without X11 support. --- gtk/gtkwindow.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index fa65a9933d..44b6b8f7ec 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -8446,7 +8446,6 @@ gtk_window_set_display (GtkWindow *window, { GtkWindowPrivate *priv = gtk_window_get_instance_private (window); GtkWidget *widget; - GdkDisplay *previous_display; gboolean was_mapped; g_return_if_fail (GTK_IS_WINDOW (window)); @@ -8460,8 +8459,6 @@ gtk_window_set_display (GtkWindow *window, widget = GTK_WIDGET (window); - previous_display = priv->display; - was_mapped = _gtk_widget_get_mapped (widget); if (was_mapped) @@ -8473,14 +8470,14 @@ gtk_window_set_display (GtkWindow *window, gtk_window_set_transient_for (window, NULL); gtk_window_free_key_hash (window); - priv->display = display; #ifdef GDK_WINDOWING_X11 - g_signal_handlers_disconnect_by_func (gtk_settings_get_for_display (previous_display), + g_signal_handlers_disconnect_by_func (gtk_settings_get_for_display (priv->display), gtk_window_on_theme_variant_changed, window); g_signal_connect (gtk_settings_get_for_display (display), "notify::gtk-application-prefer-dark-theme", G_CALLBACK (gtk_window_on_theme_variant_changed), window); #endif + priv->display = display; gtk_widget_unroot (widget); gtk_widget_root (widget); From 4f0cc3086f929755d8bf3b1291f757fb634f17ae Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 21 May 2019 07:15:16 +0200 Subject: [PATCH 04/11] win32: Rename a shadowing variable --- gtk/gtkmain.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 22513d95c3..4dce1cd7e7 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -419,7 +419,6 @@ enum_locale_proc (LPTSTR locale) SUBLANGID (LANGIDFROMLCID (lcid)) == SUBLANG_DEFAULT))) { char language[100], country[100]; - char locale[300]; if (script_to_check != NULL) { @@ -467,11 +466,13 @@ enum_locale_proc (LPTSTR locale) if (GetLocaleInfo (lcid, LOCALE_SENGLANGUAGE, language, sizeof (language)) && GetLocaleInfo (lcid, LOCALE_SENGCOUNTRY, country, sizeof (country))) { - strcpy (locale, language); - strcat (locale, "_"); - strcat (locale, country); + char str[300]; - if (setlocale (LC_ALL, locale) != NULL) + strcpy (str, language); + strcat (str, "_"); + strcat (str, country); + + if (setlocale (LC_ALL, str) != NULL) setlocale_called = TRUE; } From 3ace1f5939b5a6a394def59eef3d4d472d08b6a9 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 21 May 2019 07:17:31 +0200 Subject: [PATCH 05/11] imcontextime: Remove unused variables --- gtk/gtkimcontextime.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/gtk/gtkimcontextime.c b/gtk/gtkimcontextime.c index e18795c89e..ab972c90e6 100644 --- a/gtk/gtkimcontextime.c +++ b/gtk/gtkimcontextime.c @@ -664,7 +664,6 @@ gtk_im_context_ime_focus_in (GtkIMContext *context) { GtkIMContextIME *context_ime = GTK_IM_CONTEXT_IME (context); GdkSurface *toplevel; - GtkWidget *widget = NULL; HWND hwnd; HIMC himc; @@ -721,7 +720,6 @@ gtk_im_context_ime_focus_out (GtkIMContext *context) { GtkIMContextIME *context_ime = GTK_IM_CONTEXT_IME (context); GdkSurface *toplevel; - GtkWidget *widget = NULL; HWND hwnd; HIMC himc; From b36b9323fc9e86a41369f008b255607452bb0d44 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 21 May 2019 07:17:44 +0200 Subject: [PATCH 06/11] win32: Add missing enum value to switch statement --- gtk/gtkprintoperation-win32.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c index 4f21c1f17f..ed6dfd797f 100644 --- a/gtk/gtkprintoperation-win32.c +++ b/gtk/gtkprintoperation-win32.c @@ -1211,6 +1211,7 @@ dialog_from_print_settings (GtkPrintOperation *op, switch (print_pages) { default: + case GTK_PRINT_PAGES_SELECTION: case GTK_PRINT_PAGES_ALL: printdlgex->Flags |= PD_ALLPAGES; break; From ca2bffc06024d12b65995900f2b61de09051bd8e Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 21 May 2019 07:18:50 +0200 Subject: [PATCH 07/11] imcontextime: Add missing semicolon I wonder how thoroughly this was tested... ;) --- gtk/gtkimcontextime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtkimcontextime.c b/gtk/gtkimcontextime.c index ab972c90e6..1814e7b30b 100644 --- a/gtk/gtkimcontextime.c +++ b/gtk/gtkimcontextime.c @@ -879,7 +879,7 @@ gtk_im_context_ime_set_preedit_font (GtkIMContext *context) widget = gtk_root_get_for_surface (context_ime->client_surface); if (!widget) - return + return; hwnd = gdk_win32_surface_get_impl_hwnd (context_ime->client_surface); himc = ImmGetContext (hwnd); From 5273634f478937d7edb87759a4805d336a2191c9 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 21 May 2019 07:20:45 +0200 Subject: [PATCH 08/11] tests: Use g_free(), not free() Windows doesn't like that. --- tests/rendernode.c | 2 +- tests/showrendernode.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/rendernode.c b/tests/rendernode.c index 4d69693c65..49a6c8601c 100644 --- a/tests/rendernode.c +++ b/tests/rendernode.c @@ -22,7 +22,7 @@ deserialize_error_func (const GtkCssSection *section, g_warning ("Error at %s: %s", section_str, error->message); - free (section_str); + g_free (section_str); } diff --git a/tests/showrendernode.c b/tests/showrendernode.c index bd1e502cd9..c05988c07d 100644 --- a/tests/showrendernode.c +++ b/tests/showrendernode.c @@ -117,7 +117,7 @@ deserialize_error_func (const GtkCssSection *section, g_warning ("Error at %s: %s", section_str, error->message); - free (section_str); + g_free (section_str); } int From 143bba075fe637554b7f2b41c2caf5811d5b49c5 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 21 May 2019 07:33:13 +0200 Subject: [PATCH 09/11] win32: Remove outdated workaround The function that was missing in 2016 does exist now. Fixes gcc complaining about a wrong declaration. --- gdk/win32/gdkmonitor-win32.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/gdk/win32/gdkmonitor-win32.c b/gdk/win32/gdkmonitor-win32.c index 108e5083ed..e631dc5a7e 100644 --- a/gdk/win32/gdkmonitor-win32.c +++ b/gdk/win32/gdkmonitor-win32.c @@ -144,20 +144,6 @@ typedef LONG #define MONITORINFOF_PRIMARY 1 #endif -/* MinGW-w64 does not have a prototype for function in its headers - * at the moment of writing. - */ -#if !defined (HAVE_SETUP_DI_GET_DEVICE_PROPERTY_W) -BOOL WINAPI SetupDiGetDevicePropertyW (HDEVINFO DeviceInfoSet, - PSP_DEVINFO_DATA DeviceInfoData, - const DEVPROPKEY *PropertyKey, - DEVPROPTYPE *PropertyType, - PBYTE PropertyBuffer, - DWORD PropertyBufferSize, - PDWORD RequiredSize, - DWORD Flags); -#endif - #define G_GUID_FORMAT "%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X" #define g_format_guid(guid) (guid)->Data1, \ (guid)->Data2, \ From fc9f4add92a1918002bf9ed35debdb416c41cf2c Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 21 May 2019 07:26:25 +0200 Subject: [PATCH 10/11] win32: Enable --werror in CI --- .gitlab-ci/test-msys2.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci/test-msys2.sh b/.gitlab-ci/test-msys2.sh index 3abaf9d083..c3a7e67263 100644 --- a/.gitlab-ci/test-msys2.sh +++ b/.gitlab-ci/test-msys2.sh @@ -46,6 +46,7 @@ meson \ -Denable-wayland-backend=false \ -Denable-win32-backend=true \ -Dvulkan=no \ + --werror \ _build unset CCACHE_DISABLE From e197752afe9f64ce4207ad74c0df6480b7524024 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 21 May 2019 07:46:42 +0200 Subject: [PATCH 11/11] win32: Fix meson names for defines Those have been wrong forever, but nobody cares because they get to the values we want anyway. --- .gitlab-ci/test-msys2.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci/test-msys2.sh b/.gitlab-ci/test-msys2.sh index c3a7e67263..05624265f4 100644 --- a/.gitlab-ci/test-msys2.sh +++ b/.gitlab-ci/test-msys2.sh @@ -42,9 +42,9 @@ ccache --zero-stats ccache --show-stats export CCACHE_DISABLE=true meson \ - -Denable-x11-backend=false \ - -Denable-wayland-backend=false \ - -Denable-win32-backend=true \ + -Dx11-backend=false \ + -Dwayland-backend=false \ + -Dwin32-backend=true \ -Dvulkan=no \ --werror \ _build