Revert "Revert "ecore_win: fix the incorrect mouse cursor position.""
authorChunEon Park <hermet@hermet.pe.kr>
Tue, 25 Aug 2015 10:32:29 +0000 (19:32 +0900)
committerChunEon Park <hermet@hermet.pe.kr>
Tue, 25 Aug 2015 10:35:45 +0000 (19:35 +0900)
This reverts commit 3ce8860dab29ba6d0849ed1ecbbc72bbe0e11773.

Apply only to mouse wheel case. Button press/release wans't problem actually.
If I correct, this is caused because of different nature of window systems.
Anyway our Ecore_Event_Mouse values should keep consistency among the various systems.

src/lib/ecore_win32/ecore_win32_event.c

index f9d29a1..99ad2d4 100644 (file)
@@ -1421,10 +1421,13 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg,
                                        int                        button)
 {
    Ecore_Win32_Window *window;
+   RECT rect = { 0, 0, 0, 0 };
 
    INF("mouse button pressed");
 
    window = (Ecore_Win32_Window *)GetWindowLongPtr(msg->window, GWLP_USERDATA);
+   if (!GetWindowRect(window->window, &rect))
+     ERR("GetWindowRect() failed!");
 
    if (button > 3)
      {
@@ -1438,8 +1441,10 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg,
         e->direction = 0;
         /* wheel delta is positive or negative, never 0 */
         e->z = GET_WHEEL_DELTA_WPARAM(msg->window_param) > 0 ? -1 : 1;
-        e->x = GET_X_LPARAM(msg->data_param);
-        e->y = GET_Y_LPARAM(msg->data_param);
+        e->x = GET_X_LPARAM(msg->data_param) - rect.left;
+        e->y = GET_Y_LPARAM(msg->data_param) - rect.top;
+        e->root.x = rect.left;
+        e->root.y = rect.top;
         e->timestamp = msg->timestamp;
         e->modifiers = _ecore_win32_modifiers_get();
 
@@ -1460,6 +1465,8 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg,
            e->event_window = e->window;
            e->x = GET_X_LPARAM(msg->data_param);
            e->y = GET_Y_LPARAM(msg->data_param);
+           e->root.x = rect.left;
+           e->root.y = rect.top;
            e->timestamp = msg->timestamp;
            e->modifiers = _ecore_win32_modifiers_get();
 
@@ -1488,6 +1495,8 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg,
            e->buttons = button;
            e->x = GET_X_LPARAM(msg->data_param);
            e->y = GET_Y_LPARAM(msg->data_param);
+           e->root.x = rect.left;
+           e->root.y = rect.top;
            e->timestamp = msg->timestamp;
            e->modifiers = _ecore_win32_modifiers_get();