[gtk+/gtk-2-16] Just use TrackMouseEvent directly
- From: Tor Lillqvist <tml src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-16] Just use TrackMouseEvent directly
- Date: Thu, 2 Sep 2010 21:52:37 +0000 (UTC)
commit 9ac354e0e02a9d951688d00ff481df775520d9cd
Author: Tor Lillqvist <tml iki fi>
Date: Fri Sep 3 00:13:36 2010 +0300
Just use TrackMouseEvent directly
TrackMouseEvent is present in user32.dll in all Windows versions we
support. No need to look it up dynamically. No need to fallback to
_TrackMouseEvent from comctrl32.dll.
gdk/win32/gdkevents-win32.c | 47 +++++++++++-------------------------------
1 files changed, 13 insertions(+), 34 deletions(-)
---
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 3cdd66f..722786b 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -161,40 +161,19 @@ static void
track_mouse_event (DWORD dwFlags,
HWND hwnd)
{
- typedef BOOL (WINAPI *PFN_TrackMouseEvent) (LPTRACKMOUSEEVENT);
- static PFN_TrackMouseEvent p_TrackMouseEvent = NULL;
- static gboolean once = FALSE;
-
- if (!once)
- {
- HMODULE user32;
- HINSTANCE commctrl32;
-
- user32 = GetModuleHandle ("user32.dll");
- if ((p_TrackMouseEvent = (PFN_TrackMouseEvent)GetProcAddress (user32, "TrackMouseEvent")) == NULL)
- {
- if ((commctrl32 = LoadLibrary ("commctrl32.dll")) != NULL)
- p_TrackMouseEvent = (PFN_TrackMouseEvent)
- GetProcAddress (commctrl32, "_TrackMouseEvent");
- }
- once = TRUE;
- }
-
- if (p_TrackMouseEvent)
- {
- TRACKMOUSEEVENT tme;
- tme.cbSize = sizeof(TRACKMOUSEEVENT);
- tme.dwFlags = dwFlags;
- tme.hwndTrack = hwnd;
- tme.dwHoverTime = HOVER_DEFAULT; /* not used */
-
- if (!p_TrackMouseEvent (&tme))
- WIN32_API_FAILED ("TrackMouseEvent");
- else if (dwFlags == TME_LEAVE)
- GDK_NOTE (EVENTS, g_print(" (TrackMouseEvent %p)", hwnd));
- else if (dwFlags == TME_CANCEL)
- GDK_NOTE (EVENTS, g_print(" (cancel TrackMouseEvent %p)", hwnd));
- }
+ TRACKMOUSEEVENT tme;
+
+ tme.cbSize = sizeof(TRACKMOUSEEVENT);
+ tme.dwFlags = dwFlags;
+ tme.hwndTrack = hwnd;
+ tme.dwHoverTime = HOVER_DEFAULT; /* not used */
+
+ if (!TrackMouseEvent (&tme))
+ WIN32_API_FAILED ("TrackMouseEvent");
+ else if (dwFlags == TME_LEAVE)
+ GDK_NOTE (EVENTS, g_print(" (TrackMouseEvent %p)", hwnd));
+ else if (dwFlags == TME_CANCEL)
+ GDK_NOTE (EVENTS, g_print(" (cancel TrackMouseEvent %p)", hwnd));
}
gulong
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]