[gtk+/composite-templates] wayland: Implement the keyboard_enter/keyboard_leave events
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/composite-templates] wayland: Implement the keyboard_enter/keyboard_leave events
- Date: Thu, 26 Jul 2012 11:51:06 +0000 (UTC)
commit 2d3242cd48ee9c37c4983067763ab43c8ac42914
Author: Rob Bradford <rob linux intel com>
Date: Mon Jul 16 13:40:55 2012 +0100
wayland: Implement the keyboard_enter/keyboard_leave events
This code is derived from the old keyboard focus change event handling.
gdk/wayland/gdkdevice-wayland.c | 45 +++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 07911b9..82ddb25 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -1162,6 +1162,29 @@ keyboard_handle_enter (void *data,
struct wl_array *keys)
{
+ GdkWaylandDevice *device = data;
+ GdkEvent *event;
+ GdkWaylandDisplay *wayland_display =
+ GDK_WAYLAND_DISPLAY (device->display);
+
+ _gdk_wayland_display_update_serial (wayland_display, serial);
+
+ device->keyboard_focus = wl_surface_get_user_data(surface);
+ g_object_ref(device->keyboard_focus);
+
+ event = gdk_event_new (GDK_FOCUS_CHANGE);
+ event->focus_change.window = g_object_ref (device->keyboard_focus);
+ event->focus_change.send_event = FALSE;
+ event->focus_change.in = TRUE;
+ gdk_event_set_device (event, device->keyboard);
+
+ GDK_NOTE (EVENTS,
+ g_message ("focus int, device %p surface %p",
+ device, device->keyboard_focus));
+
+ _gdk_wayland_display_deliver_event (device->display, event);
+
+ _gdk_wayland_window_add_focus (device->keyboard_focus);
}
static void
@@ -1170,6 +1193,28 @@ keyboard_handle_leave (void *data,
uint32_t serial,
struct wl_surface *surface)
{
+ GdkWaylandDevice *device = data;
+ GdkEvent *event;
+ GdkWaylandDisplay *wayland_display =
+ GDK_WAYLAND_DISPLAY (device->display);
+
+ _gdk_wayland_display_update_serial (wayland_display, serial);
+
+ _gdk_wayland_window_remove_focus (device->keyboard_focus);
+ event = gdk_event_new (GDK_FOCUS_CHANGE);
+ event->focus_change.window = g_object_ref (device->keyboard_focus);
+ event->focus_change.send_event = FALSE;
+ event->focus_change.in = FALSE;
+ gdk_event_set_device (event, device->keyboard);
+
+ g_object_unref(device->keyboard_focus);
+ device->keyboard_focus = NULL;
+
+ GDK_NOTE (EVENTS,
+ g_message ("focus out, device %p surface %p",
+ device, device->keyboard_focus));
+
+ _gdk_wayland_display_deliver_event (device->display, event);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]