Ecore_Wayland: Don't require a current surface to retrieve pointer

position as we may not have an active window when this is requested.



SVN revision: 68731
This commit is contained in:
Christopher Michael 2012-03-05 16:50:20 +00:00
parent 2ddef61a69
commit 2ff608c90a
4 changed files with 17 additions and 7 deletions

View File

@ -275,7 +275,7 @@ EAPI void ecore_wl_sync(void);
EAPI struct wl_shm *ecore_wl_shm_get(void); EAPI struct wl_shm *ecore_wl_shm_get(void);
EAPI struct wl_display *ecore_wl_display_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_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 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); EAPI void ecore_wl_window_free(Ecore_Wl_Window *win);

View File

@ -309,15 +309,11 @@ ecore_wl_screen_size_get(int *w, int *h)
/* @since 1.2 */ /* @since 1.2 */
EAPI void 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__); LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (x) *x = 0; _ecore_wl_input_pointer_xy_get(x, y);
if (y) *y = 0;
if ((!win) || (!win->pointer_device)) return;
if (x) *x = win->pointer_device->sx;
if (y) *y = win->pointer_device->sy;
} }
/* local functions */ /* local functions */

View File

@ -76,6 +76,9 @@ static const struct wl_data_device_listener _ecore_wl_data_listener =
_ecore_wl_input_cb_data_selection _ecore_wl_input_cb_data_selection
}; };
/* local variables */
static int _pointer_x, _pointer_y;
void void
_ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id) _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); 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 */ /* local functions */
static void static void
_ecore_wl_input_cb_motion(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, int sx, int sy) _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; if (!(input = data)) return;
_pointer_x = sx;
_pointer_y = sy;
input->sx = sx; input->sx = sx;
input->sy = sy; input->sy = sy;

View File

@ -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_add(Ecore_Wl_Display *ewd, unsigned int id);
void _ecore_wl_input_del(Ecore_Wl_Input *input); 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_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); 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);