Ecore_Wayland: Patches from Rob Bradford to fix ticket(s): 1030 & 1031

Ecore_Wayland: Drop the unused timestamp from the configure event
Ecore_Wayland: Port to updated Wayland API
The cursor on the pointer is now a Wayland surface rather than a buffer.



SVN revision: 72381
This commit is contained in:
Christopher Michael 2012-06-18 10:48:29 +00:00
parent 00eea12d83
commit 0c4febd6f2
4 changed files with 52 additions and 30 deletions

View File

@ -748,3 +748,18 @@
* Fixed bug in ecore-file monitoring with inotify where watching a file
that was deleted broke the world.
2012-06-15 Rob Bradford
* Ecore_Wayland: Port to latest Wayland protocol. The cursor for a
pointer is now a surface rather than a buffer.
2012-06-15 Rob Bradford
* Ecore_Wayland: Drop unused timestamp from configure event. Rationale:
- timestamp isn't used by the handler for this event
- configure event we receive from the compositor doesn't have a timestamp
- ecore_wl_window_maximized_set and ecore_wl_window_fullscreen_set had
an implicit requirement that the window had keyboard focus to retrieve
a timestamp that wasn't used. This removes that requirement and fixes
ticket #1030.

View File

@ -121,6 +121,8 @@ struct _Ecore_Wl_Input
struct wl_keyboard *keyboard;
struct wl_touch *touch;
struct wl_surface *cursor_surface;
struct wl_data_device *data_device;
Ecore_Wl_Window *pointer_focus;
@ -230,7 +232,6 @@ struct _Ecore_Wl_Event_Window_Configure
unsigned int win;
unsigned int event_win;
int x, y, w, h;
unsigned int timestamp;
};
struct _Ecore_Wl_Event_Dnd_Enter
@ -313,7 +314,7 @@ EAPI struct wl_cursor *ecore_wl_cursor_get(const char *cursor_name);
EAPI void ecore_wl_input_grab(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsigned int button);
EAPI void ecore_wl_input_ungrab(Ecore_Wl_Input *input);
EAPI void ecore_wl_input_pointer_set(Ecore_Wl_Input *input, struct wl_buffer *buffer, int hot_x, int hot_y);
EAPI void ecore_wl_input_pointer_set(Ecore_Wl_Input *input, struct wl_surface *surface, int hot_x, int hot_y);
EAPI void ecore_wl_input_cursor_from_name_set(Ecore_Wl_Input *input, const char *cursor_name);
EAPI void ecore_wl_input_cursor_default_restore(Ecore_Wl_Input *input);
@ -337,7 +338,7 @@ EAPI struct wl_surface *ecore_wl_window_surface_get(Ecore_Wl_Window *win);
EAPI struct wl_shell_surface *ecore_wl_window_shell_surface_get(Ecore_Wl_Window *win);
EAPI Ecore_Wl_Window *ecore_wl_window_find(unsigned int id);
EAPI void ecore_wl_window_type_set(Ecore_Wl_Window *win, Ecore_Wl_Window_Type type);
EAPI void ecore_wl_window_pointer_set(Ecore_Wl_Window *win, struct wl_buffer *buffer, int hot_x, int hot_y);
EAPI void ecore_wl_window_pointer_set(Ecore_Wl_Window *win, struct wl_surface *surface, int hot_x, int hot_y);
EAPI void ecore_wl_window_cursor_from_name_set(Ecore_Wl_Window *win, const char *cursor_name);
EAPI void ecore_wl_window_cursor_default_restore(Ecore_Wl_Window *win);
EAPI void ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window *parent);

View File

@ -142,13 +142,13 @@ ecore_wl_input_ungrab(Ecore_Wl_Input *input)
}
EAPI void
ecore_wl_input_pointer_set(Ecore_Wl_Input *input, struct wl_buffer *buffer, int hot_x, int hot_y)
ecore_wl_input_pointer_set(Ecore_Wl_Input *input, struct wl_surface *surface, int hot_x, int hot_y)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (input)
wl_pointer_attach(input->pointer, input->pointer_enter_serial,
buffer, hot_x, hot_y);
wl_pointer_set_cursor(input->pointer, input->pointer_enter_serial,
surface, hot_x, hot_y);
}
EAPI void
@ -177,9 +177,14 @@ ecore_wl_input_cursor_from_name_set(Ecore_Wl_Input *input, const char *cursor_na
cursor_image = cursor->images[0];
if ((buffer = wl_cursor_image_get_buffer(cursor_image)))
ecore_wl_input_pointer_set(input, buffer,
cursor_image->hotspot_x,
cursor_image->hotspot_y);
{
ecore_wl_input_pointer_set(input, input->cursor_surface,
cursor_image->hotspot_x,
cursor_image->hotspot_y);
wl_surface_attach(input->cursor_surface, buffer, 0, 0);
wl_surface_damage(input->cursor_surface, 0, 0,
cursor_image->width, cursor_image->height);
}
}
EAPI void
@ -220,6 +225,9 @@ _ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id)
input->seat);
wl_data_device_add_listener(input->data_device,
&_ecore_wl_data_listener, input);
input->cursor_surface =
wl_compositor_create_surface(_ecore_wl_disp->wl.compositor);
ewd->input = input;
}
@ -242,6 +250,9 @@ _ecore_wl_input_del(Ecore_Wl_Input *input)
xkb_state_unref(input->xkb.state);
if (input->xkb.keymap)
xkb_map_unref(input->xkb.keymap);
if (input->cursor_surface)
wl_surface_destroy(input->cursor_surface);
free(input);
}
@ -541,16 +552,21 @@ static void
_ecore_wl_input_cb_keyboard_modifiers(void *data, struct wl_keyboard *keyboard __UNUSED__, unsigned int serial __UNUSED__, unsigned int depressed, unsigned int latched, unsigned int locked, unsigned int group)
{
Ecore_Wl_Input *input;
xkb_mod_mask_t mask;
xkb_mod_mask_t mask = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!(input = data)) return;
xkb_state_update_mask(input->xkb.state, depressed, latched,
locked, 0, 0, group);
if (input->xkb.state)
{
xkb_state_update_mask(input->xkb.state, depressed, latched,
locked, 0, 0, group);
mask = xkb_state_serialize_mods(input->xkb.state,
mask =
xkb_state_serialize_mods(input->xkb.state,
(XKB_STATE_DEPRESSED | XKB_STATE_LATCHED));
}
input->modifiers = 0;
/* The Ecore_Event_Modifiers don't quite match the X mask bits */

View File

@ -10,7 +10,7 @@ static void _ecore_wl_window_cb_configure(void *data, struct wl_shell_surface *s
static void _ecore_wl_window_cb_popup_done(void *data, struct wl_shell_surface *shell_surface __UNUSED__);
static void _ecore_wl_window_cb_surface_enter(void *data, struct wl_surface *surface, struct wl_output *output);
static void _ecore_wl_window_cb_surface_leave(void *data, struct wl_surface *surface, struct wl_output *output);
static void _ecore_wl_window_configure_send(Ecore_Wl_Window *win, int w, int h, unsigned int timestamp);
static void _ecore_wl_window_configure_send(Ecore_Wl_Window *win, int w, int h);
static char *_ecore_wl_window_id_str_get(unsigned int win_id);
/* local variables */
@ -430,16 +430,12 @@ ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized)
}
else
{
Ecore_Wl_Input *input;
input = win->keyboard_device;
if (win->shell_surface)
wl_shell_surface_set_toplevel(win->shell_surface);
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
win->allocation = win->saved_allocation;
_ecore_wl_window_configure_send(win, win->allocation.w,
win->allocation.h, input->timestamp);
win->allocation.h);
}
}
@ -461,16 +457,12 @@ ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen)
}
else
{
Ecore_Wl_Input *input;
input = win->keyboard_device;
if (win->shell_surface)
wl_shell_surface_set_toplevel(win->shell_surface);
win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
win->allocation = win->saved_allocation;
_ecore_wl_window_configure_send(win, win->allocation.w,
win->allocation.h, input->timestamp);
win->allocation.h);
}
}
@ -541,7 +533,7 @@ ecore_wl_window_type_set(Ecore_Wl_Window *win, Ecore_Wl_Window_Type type)
}
EAPI void
ecore_wl_window_pointer_set(Ecore_Wl_Window *win, struct wl_buffer *buffer, int hot_x, int hot_y)
ecore_wl_window_pointer_set(Ecore_Wl_Window *win, struct wl_surface *surface, int hot_x, int hot_y)
{
Ecore_Wl_Input *input;
@ -550,7 +542,7 @@ ecore_wl_window_pointer_set(Ecore_Wl_Window *win, struct wl_buffer *buffer, int
if (!win) return;
if ((input = win->pointer_device))
ecore_wl_input_pointer_set(input, buffer, hot_x, hot_y);
ecore_wl_input_pointer_set(input, surface, hot_x, hot_y);
}
EAPI void
@ -614,8 +606,7 @@ _ecore_wl_window_cb_configure(void *data, struct wl_shell_surface *shell_surface
if (win->region.opaque) wl_region_destroy(win->region.opaque);
win->region.opaque = NULL;
/* FIXME: 0 timestamp here may not work. need to test */
_ecore_wl_window_configure_send(win, w, h, 0);
_ecore_wl_window_configure_send(win, w, h);
}
}
@ -651,7 +642,7 @@ _ecore_wl_window_cb_surface_leave(void *data, struct wl_surface *surface, struct
}
static void
_ecore_wl_window_configure_send(Ecore_Wl_Window *win, int w, int h, unsigned int timestamp)
_ecore_wl_window_configure_send(Ecore_Wl_Window *win, int w, int h)
{
Ecore_Wl_Event_Window_Configure *ev;
@ -664,7 +655,6 @@ _ecore_wl_window_configure_send(Ecore_Wl_Window *win, int w, int h, unsigned int
ev->y = win->allocation.y;
ev->w = w;
ev->h = h;
ev->timestamp = timestamp;
ecore_event_add(ECORE_WL_EVENT_WINDOW_CONFIGURE, ev, NULL, NULL);
}