diff options
author | Daniel Atallah <datallah@pidgin.im> | 2010-02-19 19:27:23 +0000 |
---|---|---|
committer | Daniel Atallah <datallah@pidgin.im> | 2010-02-19 19:27:23 +0000 |
commit | 4ac25928ac1da7b00078ae778ea2481c84f7b108 (patch) | |
tree | 6b7df8484645d309364cbe1f202730ebf75c3635 /pidgin/win32 | |
parent | ae26eda03649d8f26ad3c0aa60d18d147da1907b (diff) | |
download | pidgin-4ac25928ac1da7b00078ae778ea2481c84f7b108.tar.gz |
Avoid looking up functions by name that will be present on all supported Windows versions.
Diffstat (limited to 'pidgin/win32')
-rw-r--r-- | pidgin/win32/gtkwin32dep.c | 61 |
1 files changed, 15 insertions, 46 deletions
diff --git a/pidgin/win32/gtkwin32dep.c b/pidgin/win32/gtkwin32dep.c index aebfce15a0..3041cc4963 100644 --- a/pidgin/win32/gtkwin32dep.c +++ b/pidgin/win32/gtkwin32dep.c @@ -47,8 +47,6 @@ #include "zlib.h" #include "untar.h" -#include <libintl.h> - #include "gtkwin32dep.h" #include "win32dep.h" #include "gtkconv.h" @@ -64,8 +62,6 @@ HINSTANCE dll_hInstance = 0; HWND messagewin_hwnd; static int gtkwin32_handle; -typedef BOOL (CALLBACK* LPFNFLASHWINDOWEX)(PFLASHWINFO); -static LPFNFLASHWINDOWEX MyFlashWindowEx = NULL; static gboolean pwm_handles_connections = TRUE; @@ -308,6 +304,7 @@ static gboolean stop_flashing(GtkWidget *widget, GdkEventFocus *event, gpointer void winpidgin_window_flash(GtkWindow *window, gboolean flash) { GdkWindow * gdkwin; + FLASHWINFO info; g_return_if_fail(window != NULL); @@ -319,25 +316,19 @@ winpidgin_window_flash(GtkWindow *window, gboolean flash) { if(GDK_WINDOW_DESTROYED(gdkwin)) return; - if(MyFlashWindowEx) { - FLASHWINFO info; - - memset(&info, 0, sizeof(FLASHWINFO)); - info.cbSize = sizeof(FLASHWINFO); - info.hwnd = GDK_WINDOW_HWND(gdkwin); - if (flash) { - DWORD flashCount; - info.uCount = 3; - if (SystemParametersInfo(SPI_GETFOREGROUNDFLASHCOUNT, 0, &flashCount, 0)) - info.uCount = flashCount; - info.dwFlags = FLASHW_ALL | FLASHW_TIMER; - } else - info.dwFlags = FLASHW_STOP; - info.dwTimeout = 0; - - MyFlashWindowEx(&info); + memset(&info, 0, sizeof(FLASHWINFO)); + info.cbSize = sizeof(FLASHWINFO); + info.hwnd = GDK_WINDOW_HWND(gdkwin); + if (flash) { + DWORD flashCount; + info.uCount = 3; + if (SystemParametersInfo(SPI_GETFOREGROUNDFLASHCOUNT, 0, &flashCount, 0)) + info.uCount = flashCount; + info.dwFlags = FLASHW_ALL | FLASHW_TIMER; } else - FlashWindow(GDK_WINDOW_HWND(gdkwin), flash); + info.dwFlags = FLASHW_STOP; + info.dwTimeout = 0; + } void @@ -399,8 +390,6 @@ void winpidgin_init(HINSTANCE hint) { messagewin_hwnd = winpidgin_message_window_init(); - MyFlashWindowEx = (LPFNFLASHWINDOWEX) wpurple_find_and_loadproc("user32.dll", "FlashWindowEx"); - purple_debug_info("winpidgin", "winpidgin_init end\n"); } @@ -436,36 +425,16 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { return TRUE; } -typedef HMONITOR WINAPI _MonitorFromWindow(HWND, DWORD); -typedef BOOL WINAPI _GetMonitorInfo(HMONITOR, LPMONITORINFO); - static gboolean get_WorkingAreaRectForWindow(HWND hwnd, RECT *workingAreaRc) { - static _MonitorFromWindow *the_MonitorFromWindow; - static _GetMonitorInfo *the_GetMonitorInfo; - static gboolean initialized = FALSE; HMONITOR monitor; MONITORINFO info; - if(!initialized) { - the_MonitorFromWindow = (_MonitorFromWindow*) - wpurple_find_and_loadproc("user32", "MonitorFromWindow"); - the_GetMonitorInfo = (_GetMonitorInfo*) - wpurple_find_and_loadproc("user32", "GetMonitorInfoA"); - initialized = TRUE; - } - - if(!the_MonitorFromWindow) - return FALSE; - - if(!the_GetMonitorInfo) - return FALSE; - - monitor = the_MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY); + monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY); info.cbSize = sizeof(info); - if(!the_GetMonitorInfo(monitor, &info)) + if(!GetMonitorInfo(monitor, &info)) return FALSE; CopyRect(workingAreaRc, &(info.rcWork)); |