Add meta_display_set_alarm_filter()

Add a private hook for the test framework to get XSyncAlarmEvent events -
this will be used to implement XSyncCounter based synchronization
so that the test framework can deterministically wait until Mutter
has seen actions performed by an X11 client.

https://bugzilla.gnome.org/show_bug.cgi?id=736505
This commit is contained in:
Owen W. Taylor 2014-09-11 10:09:43 -04:00
parent 0706de5378
commit 44ecb1c050
3 changed files with 30 additions and 0 deletions

View File

@ -97,6 +97,10 @@ typedef enum {
META_EVENT_ROUTE_WINDOW_OP,
} MetaEventRoute;
typedef gboolean (*MetaAlarmFilter) (MetaDisplay *display,
XSyncAlarmNotifyEvent *event,
gpointer data);
struct _MetaDisplay
{
GObject parent_instance;
@ -256,6 +260,9 @@ struct _MetaDisplay
MetaGestureTracker *gesture_tracker;
ClutterEventSequence *pointer_emulating_sequence;
MetaAlarmFilter alarm_filter;
gpointer alarm_filter_data;
int composite_event_base;
int composite_error_base;
int composite_major_version;
@ -453,4 +460,8 @@ void meta_display_cancel_touch (MetaDisplay *display);
gboolean meta_display_windows_are_interactable (MetaDisplay *display);
gboolean meta_display_set_alarm_filter (MetaDisplay *display,
MetaAlarmFilter filter,
gpointer data);
#endif

View File

@ -2954,3 +2954,14 @@ meta_display_is_pointer_emulating_sequence (MetaDisplay *display,
return display->pointer_emulating_sequence == sequence;
}
gboolean
meta_display_set_alarm_filter (MetaDisplay *display,
MetaAlarmFilter filter,
gpointer data)
{
g_return_if_fail (filter == NULL || display->alarm_filter == NULL);
display->alarm_filter = filter;
display->alarm_filter_data = data;
}

View File

@ -1188,6 +1188,14 @@ handle_other_xevent (MetaDisplay *display,
meta_window_x11_update_sync_request_counter (alarm_window, new_counter_value);
bypass_gtk = TRUE; /* GTK doesn't want to see this really */
}
else
{
if (display->alarm_filter &&
display->alarm_filter (display,
(XSyncAlarmNotifyEvent*)event,
display->alarm_filter_data))
bypass_gtk = TRUE;
}
goto out;
}