ecore_win32: discard WM_MOUSEMOVE message if it has the same mouse coordinates than the previous one. See link in commit for an explanation

This commit is contained in:
Vincent Torri 2014-06-29 17:57:20 +02:00 committed by Cedric BAIL
parent da06260e79
commit 08f7baab26
3 changed files with 19 additions and 3 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;
}