mirror of
https://github.com/brl/mutter.git
synced 2025-07-24 10:28:02 +00:00
Prepare for making MetaX11Display conditional
- Stop using CurrentTime, introduce META_CURRENT_TIME - Use g_get_monotonic_time () instead of relying on an X server running and making roundtrip to it https://bugzilla.gnome.org/show_bug.cgi?id=759538
This commit is contained in:

committed by
Jonas Ådahl

parent
0a8ae8417c
commit
8e7e1eeef5
@@ -595,21 +595,24 @@ enable_compositor (MetaDisplay *display)
|
||||
{
|
||||
MetaX11Display *x11_display = display->x11_display;
|
||||
|
||||
if (!META_X11_DISPLAY_HAS_COMPOSITE (x11_display) ||
|
||||
!META_X11_DISPLAY_HAS_DAMAGE (x11_display))
|
||||
if (x11_display)
|
||||
{
|
||||
meta_warning ("Missing %s extension required for compositing",
|
||||
!META_X11_DISPLAY_HAS_COMPOSITE (x11_display) ?
|
||||
"composite" : "damage");
|
||||
return;
|
||||
}
|
||||
if (!META_X11_DISPLAY_HAS_COMPOSITE (x11_display) ||
|
||||
!META_X11_DISPLAY_HAS_DAMAGE (x11_display))
|
||||
{
|
||||
meta_warning ("Missing %s extension required for compositing",
|
||||
!META_X11_DISPLAY_HAS_COMPOSITE (x11_display) ?
|
||||
"composite" : "damage");
|
||||
return;
|
||||
}
|
||||
|
||||
int version = (x11_display->composite_major_version * 10) +
|
||||
x11_display->composite_minor_version;
|
||||
if (version < 3)
|
||||
{
|
||||
meta_warning ("Your version of COMPOSITE is too old.");
|
||||
return;
|
||||
int version = (x11_display->composite_major_version * 10) +
|
||||
x11_display->composite_minor_version;
|
||||
if (version < 3)
|
||||
{
|
||||
meta_warning ("Your version of COMPOSITE is too old.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!display->compositor)
|
||||
@@ -743,7 +746,7 @@ meta_display_open (void)
|
||||
++i;
|
||||
}
|
||||
|
||||
display->current_time = CurrentTime;
|
||||
display->current_time = META_CURRENT_TIME;
|
||||
display->sentinel_counter = 0;
|
||||
|
||||
display->grab_resize_timeout_id = 0;
|
||||
@@ -826,7 +829,8 @@ meta_display_open (void)
|
||||
|
||||
enable_compositor (display);
|
||||
|
||||
meta_x11_display_create_guard_window (display->x11_display);
|
||||
if (display->x11_display)
|
||||
meta_x11_display_create_guard_window (display->x11_display);
|
||||
|
||||
/* Set up touch support */
|
||||
display->gesture_tracker = meta_gesture_tracker_new ();
|
||||
@@ -849,7 +853,7 @@ meta_display_open (void)
|
||||
else
|
||||
meta_x11_display_focus_the_no_focus_window (display->x11_display, timestamp);
|
||||
}
|
||||
else
|
||||
else if (display->x11_display)
|
||||
meta_x11_display_focus_the_no_focus_window (display->x11_display, timestamp);
|
||||
|
||||
meta_idle_monitor_init_dbus ();
|
||||
@@ -1182,7 +1186,11 @@ meta_display_get_current_time (MetaDisplay *display)
|
||||
guint32
|
||||
meta_display_get_current_time_roundtrip (MetaDisplay *display)
|
||||
{
|
||||
return meta_x11_display_get_current_time_roundtrip (display->x11_display);
|
||||
if (meta_is_wayland_compositor ())
|
||||
/* Xwayland uses monotonic clock, so lets use it here as well */
|
||||
return (guint32) (g_get_monotonic_time () / 1000);
|
||||
else
|
||||
return meta_x11_display_get_current_time_roundtrip (display->x11_display);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1270,7 +1278,9 @@ meta_display_sync_wayland_input_focus (MetaDisplay *display)
|
||||
MetaWindow *focus_window = NULL;
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaStage *stage = META_STAGE (meta_backend_get_stage (backend));
|
||||
gboolean is_focus_xwindow =
|
||||
gboolean is_focus_xwindow = FALSE;
|
||||
|
||||
if (display->x11_display)
|
||||
meta_x11_display_xwindow_is_a_no_focus_window (display->x11_display,
|
||||
display->x11_display->focus_xwindow);
|
||||
|
||||
@@ -1352,7 +1362,7 @@ meta_display_timestamp_too_old (MetaDisplay *display,
|
||||
* timestamp_too_old_or_in_future).
|
||||
*/
|
||||
|
||||
if (*timestamp == CurrentTime)
|
||||
if (*timestamp == META_CURRENT_TIME)
|
||||
{
|
||||
*timestamp = meta_display_get_current_time_roundtrip (display);
|
||||
return FALSE;
|
||||
|
Reference in New Issue
Block a user