From 8a1106c6394805bfdd6d5a7e39d2f37a40959d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?= =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= Date: Sat, 16 Jun 2018 18:24:56 +0000 Subject: [PATCH] W32: Use correct hinstance values According to the old new thing[0], we should use the instance handle of the GDK/GTK DLL when registering GDK-specific types in the system. Using the instance handle for the whole application in these circumstances is not an error, but can potentially clash with the types registered by the application itself. Also, extract window class icons from the GDK/GTK DLL, not from the application executable. [0]: https://blogs.msdn.microsoft.com/oldnewthing/20050418-59/?p=35873 --- gdk/win32/gdksurface-win32.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index 8b3cfa15bd..ce10a17055 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -401,7 +401,7 @@ RegisterGdkClass (GdkSurfaceType wtype, GdkSurfaceTypeHint wtype_hint) wcl.lpfnWndProc = _gdk_win32_surface_procedure; wcl.cbClsExtra = 0; wcl.cbWndExtra = 0; - wcl.hInstance = _gdk_app_hmodule; + wcl.hInstance = _gdk_dll_hinstance; wcl.hIcon = 0; wcl.hIconSm = 0; @@ -410,7 +410,7 @@ RegisterGdkClass (GdkSurfaceType wtype, GdkSurfaceTypeHint wtype_hint) { gchar sLoc [MAX_PATH+1]; - if (0 != GetModuleFileName (_gdk_app_hmodule, sLoc, MAX_PATH)) + if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH)) { ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1); @@ -682,7 +682,7 @@ _gdk_win32_display_create_surface_impl (GdkDisplay *display, window_width, window_height, hparent, NULL, - _gdk_app_hmodule, + _gdk_dll_hinstance, window); if (GDK_SURFACE_HWND (window) != hwndNew) { @@ -3176,7 +3176,7 @@ RegisterGdkDumbClass () wcl.lpfnWndProc = DefWindowProcW; wcl.cbClsExtra = 0; wcl.cbWndExtra = 0; - wcl.hInstance = _gdk_app_hmodule; + wcl.hInstance = _gdk_dll_hinstance; wcl.hIcon = 0; wcl.hIconSm = 0; wcl.lpszMenuName = NULL; @@ -3217,7 +3217,7 @@ ensure_snap_indicator_exists (GdkW32DragMoveResizeContext *context) 0, 0, NULL, NULL, - _gdk_app_hmodule, + _gdk_dll_hinstance, NULL); context->shape_indicator = handle;