mir: pass motion events down to transient children
This commit is contained in:
parent
e2320678ae
commit
f1cfd23cd2
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user