[mutter/wip/wayland] wayland: Add a hack to give focus to Wayland clients on mouse clicks
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/wayland] wayland: Add a hack to give focus to Wayland clients on mouse clicks
- Date: Mon, 23 Jan 2012 16:24:52 +0000 (UTC)
commit 46d4ae4fccea31cd18c6d2521068c5ced2d8b07d
Author: Neil Roberts <neil linux intel com>
Date: Mon Jan 23 16:00:58 2012 +0000
wayland: Add a hack to give focus to Wayland clients on mouse clicks
The rest of the Mutter code doesn't really know about surfaces from
Wayland clients so nothing will give them keyboard focus. This adds a
temporary hack to give them keyboard focus whenever a button press
event is sent to a surface with no corresponding X id.
src/wayland/meta-wayland.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index c7f0a80..1cbaaa9 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -386,7 +386,7 @@ meta_wayland_compositor_set_input_focus (MetaWaylandCompositor *compositor,
(struct wl_surface *) surface,
get_time ());
wl_data_device_set_keyboard_focus ((struct wl_input_device *)
- compositor->input_device);
+ compositor->input_device);
}
static void
@@ -1093,6 +1093,26 @@ event_cb (ClutterActor *stage,
if (device->pointer_focus == NULL)
meta_wayland_stage_set_default_cursor (META_WAYLAND_STAGE (stage));
+ /* HACK: for now, the surfaces from Wayland clients aren't
+ integrated into Mutter's stacking and Mutter won't give them
+ focus on mouse clicks. As a hack to work around this we can just
+ give them input focus on mouse clicks so we can at least test the
+ keyboard support */
+ if (event->type == CLUTTER_BUTTON_PRESS)
+ {
+ MetaWaylandSurface *surface = (MetaWaylandSurface *) device->current;
+
+ /* Only focus surfaces that wouldn't be handled by the
+ corresponding X events */
+ if (surface && surface->xid == 0)
+ {
+ wl_input_device_set_keyboard_focus (device,
+ (struct wl_surface *) surface,
+ event->any.time);
+ wl_data_device_set_keyboard_focus (device);
+ }
+ }
+
display = meta_get_display ();
if (!display)
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]