From b2698b3a58e9e070085475c2bc862b085ae8facd Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 13 Mar 2003 01:44:27 +0000 Subject: [PATCH] On WM_MOUSEMOVE, the test whether we have actually moved (and thus 2003-03-13 Tor Lillqvist * gdk/win32/gdkevents-win32.c (gdk_event_translate): On WM_MOUSEMOVE, the test whether we have actually moved (and thus shouldn't generate an GDK event) moved after the call to propagate() and translate_mouse_coords(). Otherwise we were testing wrong values. (#108115, Allin Cottrell) (gdk_event_translate): On WM_?BUTTONUP, set current_{x,y} the same way as in WM_?BUTTONDOWN and WM_MOUSEMOVE. --- ChangeLog | 8 ++++++++ ChangeLog.pre-2-10 | 8 ++++++++ ChangeLog.pre-2-4 | 8 ++++++++ ChangeLog.pre-2-6 | 8 ++++++++ ChangeLog.pre-2-8 | 8 ++++++++ gdk/win32/gdkevents-win32.c | 27 +++++++++++++++------------ 6 files changed, 55 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 747bdf75e4..bedf1f8267 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2003-03-13 Tor Lillqvist + * gdk/win32/gdkevents-win32.c (gdk_event_translate): On + WM_MOUSEMOVE, the test whether we have actually moved (and thus + shouldn't generate an GDK event) moved after the call to + propagate() and translate_mouse_coords(). Otherwise we were + testing wrong values. (#108115, Allin Cottrell) + (gdk_event_translate): On WM_?BUTTONUP, set current_{x,y} the same + way as in WM_?BUTTONDOWN and WM_MOUSEMOVE. + * gdk/win32/gdkevents-win32.c (gdk_pointer_grab): if a grab cursor is used, must copy the HCURSOR with CopyCursor(), as it is OK to destroy the GdkCursor after calling gdk_pointer_grab(). Set the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 747bdf75e4..bedf1f8267 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,13 @@ 2003-03-13 Tor Lillqvist + * gdk/win32/gdkevents-win32.c (gdk_event_translate): On + WM_MOUSEMOVE, the test whether we have actually moved (and thus + shouldn't generate an GDK event) moved after the call to + propagate() and translate_mouse_coords(). Otherwise we were + testing wrong values. (#108115, Allin Cottrell) + (gdk_event_translate): On WM_?BUTTONUP, set current_{x,y} the same + way as in WM_?BUTTONDOWN and WM_MOUSEMOVE. + * gdk/win32/gdkevents-win32.c (gdk_pointer_grab): if a grab cursor is used, must copy the HCURSOR with CopyCursor(), as it is OK to destroy the GdkCursor after calling gdk_pointer_grab(). Set the diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 747bdf75e4..bedf1f8267 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,5 +1,13 @@ 2003-03-13 Tor Lillqvist + * gdk/win32/gdkevents-win32.c (gdk_event_translate): On + WM_MOUSEMOVE, the test whether we have actually moved (and thus + shouldn't generate an GDK event) moved after the call to + propagate() and translate_mouse_coords(). Otherwise we were + testing wrong values. (#108115, Allin Cottrell) + (gdk_event_translate): On WM_?BUTTONUP, set current_{x,y} the same + way as in WM_?BUTTONDOWN and WM_MOUSEMOVE. + * gdk/win32/gdkevents-win32.c (gdk_pointer_grab): if a grab cursor is used, must copy the HCURSOR with CopyCursor(), as it is OK to destroy the GdkCursor after calling gdk_pointer_grab(). Set the diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 747bdf75e4..bedf1f8267 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,13 @@ 2003-03-13 Tor Lillqvist + * gdk/win32/gdkevents-win32.c (gdk_event_translate): On + WM_MOUSEMOVE, the test whether we have actually moved (and thus + shouldn't generate an GDK event) moved after the call to + propagate() and translate_mouse_coords(). Otherwise we were + testing wrong values. (#108115, Allin Cottrell) + (gdk_event_translate): On WM_?BUTTONUP, set current_{x,y} the same + way as in WM_?BUTTONDOWN and WM_MOUSEMOVE. + * gdk/win32/gdkevents-win32.c (gdk_pointer_grab): if a grab cursor is used, must copy the HCURSOR with CopyCursor(), as it is OK to destroy the GdkCursor after calling gdk_pointer_grab(). Set the diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 747bdf75e4..bedf1f8267 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,13 @@ 2003-03-13 Tor Lillqvist + * gdk/win32/gdkevents-win32.c (gdk_event_translate): On + WM_MOUSEMOVE, the test whether we have actually moved (and thus + shouldn't generate an GDK event) moved after the call to + propagate() and translate_mouse_coords(). Otherwise we were + testing wrong values. (#108115, Allin Cottrell) + (gdk_event_translate): On WM_?BUTTONUP, set current_{x,y} the same + way as in WM_?BUTTONDOWN and WM_MOUSEMOVE. + * gdk/win32/gdkevents-win32.c (gdk_pointer_grab): if a grab cursor is used, must copy the HCURSOR with CopyCursor(), as it is OK to destroy the GdkCursor after calling gdk_pointer_grab(). Set the diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index eded08349c..a07dc1b2bb 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -2551,7 +2551,7 @@ gdk_event_translate (GdkDisplay *display, event->button.x = current_x = (gint16) LOWORD (msg->lParam); event->button.y = current_y = (gint16) HIWORD (msg->lParam); _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset); - event->button.x += xoffset; /* XXX translate current_x, y too? */ + event->button.x += xoffset; event->button.y += yoffset; event->button.x_root = current_x_root = msg->pt.x; event->button.y_root = current_y_root = msg->pt.y; @@ -2605,9 +2605,11 @@ gdk_event_translate (GdkDisplay *display, event->button.time = _gdk_win32_get_next_tick (msg->time); if (window != orig_window) translate_mouse_coords (orig_window, window, msg); + event->button.x = current_x = (gint16) LOWORD (msg->lParam); + event->button.y = current_y = (gint16) HIWORD (msg->lParam); _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset); - event->button.x = (gint16) LOWORD (msg->lParam) + xoffset; - event->button.y = (gint16) HIWORD (msg->lParam) + yoffset; + event->button.x += xoffset; + event->button.y += yoffset; event->button.x_root = current_x_root = msg->pt.x; event->button.y_root = current_y_root = msg->pt.y; event->button.axes = NULL; @@ -2632,15 +2634,6 @@ gdk_event_translate (GdkDisplay *display, ASSIGN_WINDOW (find_window_for_pointer_event (window, msg)); - /* If we haven't moved, don't create any event. - * Windows sends WM_MOUSEMOVE messages after button presses - * even if the mouse doesn't move. This disturbs gtk. - */ - if (window == current_window - && LOWORD (msg->lParam) == current_x - && HIWORD (msg->lParam) == current_y) - break; - /* HB: only process mouse move messages if we own the active window. */ GetWindowThreadProcessId (GetActiveWindow (), &pidActWin); GetWindowThreadProcessId (msg->hwnd, &pidThis); @@ -2668,6 +2661,16 @@ gdk_event_translate (GdkDisplay *display, event->motion.time = _gdk_win32_get_next_tick (msg->time); if (window != orig_window) translate_mouse_coords (orig_window, window, msg); + + /* If we haven't moved, don't create any event. + * Windows sends WM_MOUSEMOVE messages after button presses + * even if the mouse doesn't move. This disturbs gtk. + */ + if (window == current_window + && LOWORD (msg->lParam) == current_x + && HIWORD (msg->lParam) == current_y) + break; + event->motion.x = current_x = (gint16) LOWORD (msg->lParam); event->motion.y = current_y = (gint16) HIWORD (msg->lParam); _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset);