forked from enlightenment/efl
Ecore_Wayland: Updates to work with latest Wayland:
Add pointer frame callback. Add pointer surface listener. Use doubles for input surface position. Fix dnd function prototype to use wl_data_offer now. Fix dnd_add function to not use proxy_create anymore. Fix regression where window resizing down would leave artifacts. - Need to update the window allocation size before attaching the new buffer. Fix set_transient & set_popup to use the parent surface, not the shell surface. SVN revision: 73254
This commit is contained in:
parent
43af930a16
commit
5ef3b00eaf
|
@ -122,6 +122,7 @@ struct _Ecore_Wl_Input
|
||||||
struct wl_touch *touch;
|
struct wl_touch *touch;
|
||||||
|
|
||||||
struct wl_surface *cursor_surface;
|
struct wl_surface *cursor_surface;
|
||||||
|
struct wl_callback *cursor_frame_cb;
|
||||||
|
|
||||||
struct wl_data_device *data_device;
|
struct wl_data_device *data_device;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ static const struct wl_data_offer_listener _ecore_wl_data_offer_listener =
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
_ecore_wl_dnd_add(Ecore_Wl_Input *input, struct wl_data_device *data_device, unsigned int id)
|
_ecore_wl_dnd_add(Ecore_Wl_Input *input, struct wl_data_device *data_device __UNUSED__, struct wl_data_offer *offer)
|
||||||
{
|
{
|
||||||
Ecore_Wl_Dnd_Source *source;
|
Ecore_Wl_Dnd_Source *source;
|
||||||
|
|
||||||
|
@ -25,10 +25,7 @@ _ecore_wl_dnd_add(Ecore_Wl_Input *input, struct wl_data_device *data_device, uns
|
||||||
wl_array_init(&source->types);
|
wl_array_init(&source->types);
|
||||||
source->refcount = 1;
|
source->refcount = 1;
|
||||||
source->input = input;
|
source->input = input;
|
||||||
/* FIXME: Change this when wayland has typesafe wrapper for it */
|
source->offer = offer;
|
||||||
source->offer = (struct wl_data_offer *)
|
|
||||||
wl_proxy_create_for_id((struct wl_proxy *)data_device,
|
|
||||||
id, &wl_data_offer_interface);
|
|
||||||
wl_data_offer_add_listener(source->offer,
|
wl_data_offer_add_listener(source->offer,
|
||||||
&_ecore_wl_data_offer_listener, source);
|
&_ecore_wl_data_offer_listener, source);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ static void _ecore_wl_input_cb_pointer_leave(void *data, struct wl_pointer *poin
|
||||||
static void _ecore_wl_input_cb_pointer_motion(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int timestamp, wl_fixed_t sx, wl_fixed_t sy);
|
static void _ecore_wl_input_cb_pointer_motion(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int timestamp, wl_fixed_t sx, wl_fixed_t sy);
|
||||||
static void _ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int serial, unsigned int timestamp, unsigned int button, unsigned int state);
|
static void _ecore_wl_input_cb_pointer_button(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int serial, unsigned int timestamp, unsigned int button, unsigned int state);
|
||||||
static void _ecore_wl_input_cb_pointer_axis(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int timestamp, unsigned int axis, wl_fixed_t value);
|
static void _ecore_wl_input_cb_pointer_axis(void *data, struct wl_pointer *pointer __UNUSED__, unsigned int timestamp, unsigned int axis, wl_fixed_t value);
|
||||||
|
static void _ecore_wl_input_cb_pointer_frame(void *data, struct wl_callback *callback, unsigned int timestamp __UNUSED__);
|
||||||
static void _ecore_wl_input_cb_keyboard_keymap(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int format, int fd, unsigned int size);
|
static void _ecore_wl_input_cb_keyboard_keymap(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int format, int fd, unsigned int size);
|
||||||
static void _ecore_wl_input_cb_keyboard_enter(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int serial, struct wl_surface *surface, struct wl_array *keys __UNUSED__);
|
static void _ecore_wl_input_cb_keyboard_enter(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int serial, struct wl_surface *surface, struct wl_array *keys __UNUSED__);
|
||||||
static void _ecore_wl_input_cb_keyboard_leave(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int serial, struct wl_surface *surface);
|
static void _ecore_wl_input_cb_keyboard_leave(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int serial, struct wl_surface *surface);
|
||||||
|
@ -56,7 +57,7 @@ static void _ecore_wl_input_cb_touch_up(void *data, struct wl_touch *touch __UNU
|
||||||
static void _ecore_wl_input_cb_touch_motion(void *data, struct wl_touch *touch __UNUSED__, unsigned int timestamp, int id __UNUSED__, wl_fixed_t x, wl_fixed_t y);
|
static void _ecore_wl_input_cb_touch_motion(void *data, struct wl_touch *touch __UNUSED__, unsigned int timestamp, int id __UNUSED__, wl_fixed_t x, wl_fixed_t y);
|
||||||
static void _ecore_wl_input_cb_touch_frame(void *data __UNUSED__, struct wl_touch *touch __UNUSED__);
|
static void _ecore_wl_input_cb_touch_frame(void *data __UNUSED__, struct wl_touch *touch __UNUSED__);
|
||||||
static void _ecore_wl_input_cb_touch_cancel(void *data __UNUSED__, struct wl_touch *touch __UNUSED__);
|
static void _ecore_wl_input_cb_touch_cancel(void *data __UNUSED__, struct wl_touch *touch __UNUSED__);
|
||||||
static void _ecore_wl_input_cb_data_offer(void *data, struct wl_data_device *data_device, unsigned int id);
|
static void _ecore_wl_input_cb_data_offer(void *data, struct wl_data_device *data_device, struct wl_data_offer *offer);
|
||||||
static void _ecore_wl_input_cb_data_enter(void *data, struct wl_data_device *data_device, unsigned int timestamp, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *offer);
|
static void _ecore_wl_input_cb_data_enter(void *data, struct wl_data_device *data_device, unsigned int timestamp, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *offer);
|
||||||
static void _ecore_wl_input_cb_data_leave(void *data, struct wl_data_device *data_device);
|
static void _ecore_wl_input_cb_data_leave(void *data, struct wl_data_device *data_device);
|
||||||
static void _ecore_wl_input_cb_data_motion(void *data, struct wl_data_device *data_device, unsigned int timestamp, wl_fixed_t x, wl_fixed_t y);
|
static void _ecore_wl_input_cb_data_motion(void *data, struct wl_data_device *data_device, unsigned int timestamp, wl_fixed_t x, wl_fixed_t y);
|
||||||
|
@ -118,6 +119,11 @@ static const struct wl_data_device_listener _ecore_wl_data_listener =
|
||||||
_ecore_wl_input_cb_data_selection
|
_ecore_wl_input_cb_data_selection
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct wl_callback_listener _ecore_wl_pointer_surface_listener =
|
||||||
|
{
|
||||||
|
_ecore_wl_input_cb_pointer_frame
|
||||||
|
};
|
||||||
|
|
||||||
/* local variables */
|
/* local variables */
|
||||||
static int _pointer_x, _pointer_y;
|
static int _pointer_x, _pointer_y;
|
||||||
|
|
||||||
|
@ -184,6 +190,9 @@ ecore_wl_input_cursor_from_name_set(Ecore_Wl_Input *input, const char *cursor_na
|
||||||
wl_surface_attach(input->cursor_surface, buffer, 0, 0);
|
wl_surface_attach(input->cursor_surface, buffer, 0, 0);
|
||||||
wl_surface_damage(input->cursor_surface, 0, 0,
|
wl_surface_damage(input->cursor_surface, 0, 0,
|
||||||
cursor_image->width, cursor_image->height);
|
cursor_image->width, cursor_image->height);
|
||||||
|
|
||||||
|
if (!input->cursor_frame_cb)
|
||||||
|
_ecore_wl_input_cb_pointer_frame(input, NULL, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,16 +252,17 @@ _ecore_wl_input_del(Ecore_Wl_Input *input)
|
||||||
input->selection_source = NULL;
|
input->selection_source = NULL;
|
||||||
|
|
||||||
if (input->data_device) wl_data_device_destroy(input->data_device);
|
if (input->data_device) wl_data_device_destroy(input->data_device);
|
||||||
if (input->seat) wl_seat_destroy(input->seat);
|
|
||||||
wl_list_remove(&input->link);
|
|
||||||
|
|
||||||
if (input->xkb.state)
|
if (input->xkb.state)
|
||||||
xkb_state_unref(input->xkb.state);
|
xkb_state_unref(input->xkb.state);
|
||||||
if (input->xkb.keymap)
|
if (input->xkb.keymap)
|
||||||
xkb_map_unref(input->xkb.keymap);
|
xkb_map_unref(input->xkb.keymap);
|
||||||
|
|
||||||
if (input->cursor_surface)
|
if (input->cursor_surface)
|
||||||
wl_surface_destroy(input->cursor_surface);
|
wl_surface_destroy(input->cursor_surface);
|
||||||
|
|
||||||
|
wl_list_remove(&input->link);
|
||||||
|
if (input->seat) wl_seat_destroy(input->seat);
|
||||||
|
|
||||||
free(input);
|
free(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,9 +332,10 @@ _ecore_wl_input_cb_pointer_motion(void *data, struct wl_pointer *pointer __UNUSE
|
||||||
|
|
||||||
input->timestamp = timestamp;
|
input->timestamp = timestamp;
|
||||||
|
|
||||||
/* TODO: FIXME: NB: Weston window code has set pointer image here also */
|
|
||||||
if (input->pointer_focus)
|
if (input->pointer_focus)
|
||||||
_ecore_wl_input_mouse_move_send(input, input->pointer_focus, timestamp);
|
_ecore_wl_input_mouse_move_send(input, input->pointer_focus, timestamp);
|
||||||
|
|
||||||
|
ecore_wl_input_cursor_default_restore(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -375,6 +386,31 @@ _ecore_wl_input_cb_pointer_axis(void *data, struct wl_pointer *pointer __UNUSED_
|
||||||
timestamp);
|
timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ecore_wl_input_cb_pointer_frame(void *data, struct wl_callback *callback, unsigned int timestamp __UNUSED__)
|
||||||
|
{
|
||||||
|
Ecore_Wl_Input *input;
|
||||||
|
|
||||||
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
|
||||||
|
if (!(input = data)) return;
|
||||||
|
|
||||||
|
if (callback)
|
||||||
|
{
|
||||||
|
if (callback != input->cursor_frame_cb) return;
|
||||||
|
wl_callback_destroy(callback);
|
||||||
|
input->cursor_frame_cb = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: Finish me */
|
||||||
|
if (!input->cursor_frame_cb)
|
||||||
|
{
|
||||||
|
input->cursor_frame_cb = wl_surface_frame(input->cursor_surface);
|
||||||
|
wl_callback_add_listener(input->cursor_frame_cb,
|
||||||
|
&_ecore_wl_pointer_surface_listener, input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecore_wl_input_cb_keyboard_keymap(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int format, int fd, unsigned int size)
|
_ecore_wl_input_cb_keyboard_keymap(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int format, int fd, unsigned int size)
|
||||||
{
|
{
|
||||||
|
@ -596,8 +632,8 @@ _ecore_wl_input_cb_pointer_enter(void *data, struct wl_pointer *pointer __UNUSED
|
||||||
input->timestamp = (tv.tv_sec * 1000 + tv.tv_usec / 1000);
|
input->timestamp = (tv.tv_sec * 1000 + tv.tv_usec / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
input->sx = wl_fixed_to_int(sx);
|
input->sx = wl_fixed_to_double(sx);
|
||||||
input->sy = wl_fixed_to_int(sy);
|
input->sy = wl_fixed_to_double(sy);
|
||||||
input->display->serial = serial;
|
input->display->serial = serial;
|
||||||
input->pointer_enter_serial = serial;
|
input->pointer_enter_serial = serial;
|
||||||
|
|
||||||
|
@ -799,11 +835,11 @@ _ecore_wl_input_cb_touch_cancel(void *data __UNUSED__, struct wl_touch *touch __
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ecore_wl_input_cb_data_offer(void *data, struct wl_data_device *data_device, unsigned int id)
|
_ecore_wl_input_cb_data_offer(void *data, struct wl_data_device *data_device, struct wl_data_offer *offer)
|
||||||
{
|
{
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
|
||||||
_ecore_wl_dnd_add(data, data_device, id);
|
_ecore_wl_dnd_add(data, data_device, offer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -78,7 +78,7 @@ 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_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, 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);
|
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_leave(void *data, struct wl_data_device *data_device __UNUSED__);
|
void _ecore_wl_dnd_leave(void *data, struct wl_data_device *data_device __UNUSED__);
|
||||||
void _ecore_wl_dnd_motion(void *data, struct wl_data_device *data_device __UNUSED__, unsigned int timestamp __UNUSED__, int x, int y);
|
void _ecore_wl_dnd_motion(void *data, struct wl_data_device *data_device __UNUSED__, unsigned int timestamp __UNUSED__, int x, int y);
|
||||||
|
|
|
@ -270,9 +270,8 @@ ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, in
|
||||||
case ECORE_WL_WINDOW_BUFFER_TYPE_SHM:
|
case ECORE_WL_WINDOW_BUFFER_TYPE_SHM:
|
||||||
if (win->surface)
|
if (win->surface)
|
||||||
{
|
{
|
||||||
if (buffer)
|
/* if (buffer) */
|
||||||
wl_surface_attach(win->surface, buffer, x, y);
|
wl_surface_attach(win->surface, buffer, x, y);
|
||||||
|
|
||||||
wl_surface_damage(win->surface, 0, 0,
|
wl_surface_damage(win->surface, 0, 0,
|
||||||
win->allocation.w, win->allocation.h);
|
win->allocation.w, win->allocation.h);
|
||||||
|
|
||||||
|
@ -337,14 +336,14 @@ ecore_wl_window_show(Ecore_Wl_Window *win)
|
||||||
break;
|
break;
|
||||||
case ECORE_WL_WINDOW_TYPE_TRANSIENT:
|
case ECORE_WL_WINDOW_TYPE_TRANSIENT:
|
||||||
wl_shell_surface_set_transient(win->shell_surface,
|
wl_shell_surface_set_transient(win->shell_surface,
|
||||||
win->parent->shell_surface,
|
win->parent->surface,
|
||||||
win->allocation.x, win->allocation.y, 0);
|
win->allocation.x, win->allocation.y, 0);
|
||||||
break;
|
break;
|
||||||
case ECORE_WL_WINDOW_TYPE_MENU:
|
case ECORE_WL_WINDOW_TYPE_MENU:
|
||||||
wl_shell_surface_set_popup(win->shell_surface,
|
wl_shell_surface_set_popup(win->shell_surface,
|
||||||
_ecore_wl_disp->input->seat,
|
_ecore_wl_disp->input->seat,
|
||||||
_ecore_wl_disp->serial,
|
_ecore_wl_disp->serial,
|
||||||
win->parent->shell_surface,
|
win->parent->surface,
|
||||||
win->allocation.x, win->allocation.y, 0);
|
win->allocation.x, win->allocation.y, 0);
|
||||||
break;
|
break;
|
||||||
case ECORE_WL_WINDOW_TYPE_NONE:
|
case ECORE_WL_WINDOW_TYPE_NONE:
|
||||||
|
|
Loading…
Reference in New Issue