hermet pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=1f1542f82404fa2262526cc3eed7b2edc622c5ce

commit 1f1542f82404fa2262526cc3eed7b2edc622c5ce
Author: ChunEon Park <her...@hermet.pe.kr>
Date:   Tue Aug 25 15:31:05 2015 +0900

    ecore_win: fix the incorrect mouse cursor position.
    
    Ecore_Event_Mouse_* x, y values are relative to the current window position
    as well as the root x, y, values are relative to the root window.
    
    previously, x,y is started from the root window and root x, y values are 
invalid.
    
    fix them
    
    @fix
---
 src/lib/ecore_win32/ecore_win32_event.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/lib/ecore_win32/ecore_win32_event.c 
b/src/lib/ecore_win32/ecore_win32_event.c
index f9d29a1..3b5100d 100644
--- a/src/lib/ecore_win32/ecore_win32_event.c
+++ b/src/lib/ecore_win32/ecore_win32_event.c
@@ -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();
 
@@ -1458,8 +1463,10 @@ 
_ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg,
 
            e->window = (Ecore_Window)window;
            e->event_window = e->window;
-           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();
 
@@ -1486,8 +1493,10 @@ 
_ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg,
            e->window = (Ecore_Window)window;
            e->event_window = e->window;
            e->buttons = button;
-           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();
 

-- 


Reply via email to