[gtk+/wip/mir2: 74/75] mir: pass motion events down to transient children
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/mir2: 74/75] mir: pass motion events down to transient children
- Date: Mon, 1 Dec 2014 21:34:01 +0000 (UTC)
commit af8cf6945cea6b4257b7ca8b589efc69a8f48129
Author: William Hua <william attente ca>
Date: Mon Dec 1 08:54:13 2014 -0500
mir: pass motion events down to transient children
gdk/mir/gdkmir-private.h | 7 +++++++
gdk/mir/gdkmireventsource.c | 26 +++++++++++++++++++++++++-
gdk/mir/gdkmirwindowimpl.c | 31 +++++++++++++++++++++++++++++++
3 files changed, 63 insertions(+), 1 deletions(-)
---
diff --git a/gdk/mir/gdkmir-private.h b/gdk/mir/gdkmir-private.h
index 053615a..9361b72 100644
--- a/gdk/mir/gdkmir-private.h
+++ b/gdk/mir/gdkmir-private.h
@@ -131,4 +131,11 @@ void _gdk_mir_print_resize_event (const MirResizeEvent *event);
void _gdk_mir_print_event (const MirEvent *event);
+/* TODO: Remove once we have proper transient window support. */
+GdkWindow * _gdk_mir_window_get_transient_child (GdkWindow *window,
+ gint x,
+ gint y,
+ gint *out_x,
+ gint *out_y);
+
#endif /* __GDK_PRIVATE_MIR_H__ */
diff --git a/gdk/mir/gdkmireventsource.c b/gdk/mir/gdkmireventsource.c
index cfe36e8..20b7972 100644
--- a/gdk/mir/gdkmireventsource.c
+++ b/gdk/mir/gdkmireventsource.c
@@ -459,7 +459,31 @@ gdk_mir_event_source_convert_events (GdkMirEventSource *source)
* event was being dispatched...
*/
if (window != NULL)
- gdk_mir_event_source_queue_event (source->display, window, &event->event);
+ {
+ /* TODO: Remove once we have proper transient window support. */
+ if (event->event.type == mir_event_type_motion)
+ {
+ GdkWindow *child;
+ gint x;
+ gint y;
+
+ x = event->event.motion.pointer_coordinates[0].x;
+ y = event->event.motion.pointer_coordinates[0].y;
+
+ child = _gdk_mir_window_get_transient_child (window, x, y, &x, &y);
+
+ if (child && child != window)
+ {
+ window = child;
+
+ event->event.motion.pointer_count = MAX (event->event.motion.pointer_count, 1);
+ event->event.motion.pointer_coordinates[0].x = x;
+ event->event.motion.pointer_coordinates[0].y = y;
+ }
+ }
+
+ gdk_mir_event_source_queue_event (source->display, window, &event->event);
+ }
else
g_warning ("window was destroyed before event arrived...");
diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c
index 6431ed4..78c5111 100644
--- a/gdk/mir/gdkmirwindowimpl.c
+++ b/gdk/mir/gdkmirwindowimpl.c
@@ -910,6 +910,37 @@ gdk_mir_window_impl_set_transient_for (GdkWindow *window,
ensure_no_surface (window);
}
+/* TODO: Remove once we have proper transient window support. */
+GdkWindow *
+_gdk_mir_window_get_transient_child (GdkWindow *window,
+ gint x,
+ gint y,
+ gint *out_x,
+ gint *out_y)
+{
+ GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
+ GdkWindow *child = NULL;
+ GList *i;
+
+ if (x < window->x || x >= window->x + window->width ||
+ y < window->y || y >= window->y + window->height)
+ return NULL;
+
+ x -= window->x;
+ y -= window->y;
+
+ for (i = impl->transient_children; i && !child; i = i->next)
+ child = _gdk_mir_window_get_transient_child (i->data, x, y, out_x, out_y);
+
+ if (child)
+ return child;
+
+ *out_x = x;
+ *out_y = y;
+
+ return window;
+}
+
static void
gdk_mir_window_impl_get_frame_extents (GdkWindow *window,
GdkRectangle *rect)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]