Commit f1cfd23c authored by William Hua's avatar William Hua

mir: pass motion events down to transient children

parent e2320678
......@@ -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__ */
......@@ -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...");
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment