From: devilhorns Date: Mon, 5 Mar 2012 16:50:20 +0000 (+0000) Subject: Ecore_Wayland: Don't require a current surface to retrieve pointer X-Git-Tag: 2.0_alpha~62^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8dc0c39d7174b87e5cb8bb7d1588fe87cc0060d0;p=framework%2Fuifw%2Fecore.git Ecore_Wayland: Don't require a current surface to retrieve pointer position as we may not have an active window when this is requested. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@68731 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h b/src/lib/ecore_wayland/Ecore_Wayland.h index d032d33..22608fd 100644 --- a/src/lib/ecore_wayland/Ecore_Wayland.h +++ b/src/lib/ecore_wayland/Ecore_Wayland.h @@ -275,7 +275,7 @@ EAPI void ecore_wl_sync(void); EAPI struct wl_shm *ecore_wl_shm_get(void); EAPI struct wl_display *ecore_wl_display_get(void); EAPI void ecore_wl_screen_size_get(int *w, int *h); -EAPI void ecore_wl_pointer_xy_get(Ecore_Wl_Window *win, int *x, int *y); +EAPI void ecore_wl_pointer_xy_get(int *x, int *y); EAPI Ecore_Wl_Window *ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buffer_type); EAPI void ecore_wl_window_free(Ecore_Wl_Window *win); diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c index 4af5d89..724b453 100644 --- a/src/lib/ecore_wayland/ecore_wl.c +++ b/src/lib/ecore_wayland/ecore_wl.c @@ -309,15 +309,11 @@ ecore_wl_screen_size_get(int *w, int *h) /* @since 1.2 */ EAPI void -ecore_wl_pointer_xy_get(Ecore_Wl_Window *win, int *x, int *y) +ecore_wl_pointer_xy_get(int *x, int *y) { LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (x) *x = 0; - if (y) *y = 0; - if ((!win) || (!win->pointer_device)) return; - if (x) *x = win->pointer_device->sx; - if (y) *y = win->pointer_device->sy; + _ecore_wl_input_pointer_xy_get(x, y); } /* local functions */ diff --git a/src/lib/ecore_wayland/ecore_wl_input.c b/src/lib/ecore_wayland/ecore_wl_input.c index 398a45a..56a463d 100644 --- a/src/lib/ecore_wayland/ecore_wl_input.c +++ b/src/lib/ecore_wayland/ecore_wl_input.c @@ -76,6 +76,9 @@ static const struct wl_data_device_listener _ecore_wl_data_listener = _ecore_wl_input_cb_data_selection }; +/* local variables */ +static int _pointer_x, _pointer_y; + void _ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id) { @@ -125,6 +128,13 @@ _ecore_wl_input_del(Ecore_Wl_Input *input) free(input); } +void +_ecore_wl_input_pointer_xy_get(int *x, int *y) +{ + if (x) *x = _pointer_x; + if (y) *y = _pointer_y; +} + /* local functions */ static void _ecore_wl_input_cb_motion(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, int sx, int sy) @@ -135,6 +145,9 @@ _ecore_wl_input_cb_motion(void *data, struct wl_input_device *input_device __UNU if (!(input = data)) return; + _pointer_x = sx; + _pointer_y = sy; + input->sx = sx; input->sy = sy; diff --git a/src/lib/ecore_wayland/ecore_wl_private.h b/src/lib/ecore_wayland/ecore_wl_private.h index a1dc24f..31956a1 100644 --- a/src/lib/ecore_wayland/ecore_wl_private.h +++ b/src/lib/ecore_wayland/ecore_wl_private.h @@ -74,6 +74,7 @@ void _ecore_wl_output_del(Ecore_Wl_Output *output); void _ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id); void _ecore_wl_input_del(Ecore_Wl_Input *input); +void _ecore_wl_input_pointer_xy_get(int *x, int *y); void _ecore_wl_dnd_add(Ecore_Wl_Input *input, struct wl_data_device *data_device, unsigned int id); void _ecore_wl_dnd_enter(void *data, struct wl_data_device *data_device __UNUSED__, unsigned int timestamp __UNUSED__, struct wl_surface *surface, int x, int y, struct wl_data_offer *offer);