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
This commit is contained in:
Руслан Ижбулатов 2018-06-16 18:24:56 +00:00
parent 6e085b3bf1
commit 8a1106c639

View File

@ -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;