Do not use GetProcAddress for FlashWindowEx

It's available since Windows XP
This commit is contained in:
Luca Bacci 2022-01-02 18:28:50 +01:00
parent c77272a7d7
commit 4f7d18a28f
No known key found for this signature in database
GPG Key ID: 8E3C8D989C98883D

View File

@ -1333,33 +1333,22 @@ gdk_win32_surface_set_urgency_hint (GdkSurface *window,
gboolean urgent) gboolean urgent)
{ {
FLASHWINFO flashwinfo; FLASHWINFO flashwinfo;
typedef BOOL (WINAPI *PFN_FlashWindowEx) (FLASHWINFO*);
PFN_FlashWindowEx flashWindowEx = NULL;
g_return_if_fail (GDK_IS_SURFACE (window)); g_return_if_fail (GDK_IS_SURFACE (window));
if (GDK_SURFACE_DESTROYED (window)) if (GDK_SURFACE_DESTROYED (window))
return; return;
flashWindowEx = (PFN_FlashWindowEx) GetProcAddress (GetModuleHandle ("user32.dll"), "FlashWindowEx"); flashwinfo.cbSize = sizeof (flashwinfo);
flashwinfo.hwnd = GDK_SURFACE_HWND (window);
if (flashWindowEx) if (urgent)
{ flashwinfo.dwFlags = FLASHW_ALL | FLASHW_TIMER;
flashwinfo.cbSize = sizeof (flashwinfo);
flashwinfo.hwnd = GDK_SURFACE_HWND (window);
if (urgent)
flashwinfo.dwFlags = FLASHW_ALL | FLASHW_TIMER;
else
flashwinfo.dwFlags = FLASHW_STOP;
flashwinfo.uCount = 0;
flashwinfo.dwTimeout = 0;
flashWindowEx (&flashwinfo);
}
else else
{ flashwinfo.dwFlags = FLASHW_STOP;
FlashWindow (GDK_SURFACE_HWND (window), urgent); flashwinfo.uCount = 0;
} flashwinfo.dwTimeout = 0;
FlashWindowEx (&flashwinfo);
} }
static gboolean static gboolean