From 08f7baab26b686937130ec6f8851570782160b12 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Sun, 29 Jun 2014 17:57:20 +0200 Subject: ecore_win32: discard WM_MOUSEMOVE message if it has the same mouse coordinates than the previous one. See link in commit for an explanation --- src/lib/ecore_win32/ecore_win32.c | 16 ++++++++++++++-- src/lib/ecore_win32/ecore_win32_private.h | 4 +++- src/lib/ecore_win32/ecore_win32_window.c | 2 ++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/lib/ecore_win32/ecore_win32.c b/src/lib/ecore_win32/ecore_win32.c index c6312a34b9..2c20ae9bdb 100644 --- a/src/lib/ecore_win32/ecore_win32.c +++ b/src/lib/ecore_win32/ecore_win32.c @@ -144,10 +144,22 @@ _ecore_win32_window_procedure(HWND window, RECT rect; Ecore_Win32_Window *w = NULL; - INF("moue move message"); - w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA); + /* + * Windows can send several WM_MOUSEMOVE messages, see: + * http://blogs.msdn.com/b/oldnewthing/archive/2003/10/01/55108.aspx + * so we discard those which have the same mouse coordinates + */ + if ((w->drag.current_mouse_x == GET_X_LPARAM(data_param)) && + (w->drag.current_mouse_y == GET_Y_LPARAM(data_param))) + return 0; + + w->drag.current_mouse_x = GET_X_LPARAM(data_param); + w->drag.current_mouse_y = GET_Y_LPARAM(data_param); + + INF("mouse move message"); + if (w->drag.dragging) { POINT pt; diff --git a/src/lib/ecore_win32/ecore_win32_private.h b/src/lib/ecore_win32/ecore_win32_private.h index 759ea79b92..af2d86a558 100644 --- a/src/lib/ecore_win32/ecore_win32_private.h +++ b/src/lib/ecore_win32/ecore_win32_private.h @@ -114,13 +114,15 @@ struct _Ecore_Win32_Window } shape; struct { - DWORD type; + DWORD type; int x; int y; int w; int h; int px; int py; + int current_mouse_x; + int current_mouse_y; unsigned int dragging : 1; } drag; diff --git a/src/lib/ecore_win32/ecore_win32_window.c b/src/lib/ecore_win32/ecore_win32_window.c index 81c6c52c5c..00b7ff21e3 100644 --- a/src/lib/ecore_win32/ecore_win32_window.c +++ b/src/lib/ecore_win32/ecore_win32_window.c @@ -143,6 +143,8 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent, w->drag.y = y; w->drag.w = rect.right - rect.left; w->drag.h = rect.bottom - rect.top; + w->drag.current_mouse_x = -32768; + w->drag.current_mouse_y = -32768; return w; } -- cgit v1.2.1