Fix up for newer draft of wm-spec

* 64-bit quantities are consistently ordered low-32-bits / high-32-bits
* data.l[4] in _NET_WM_SYNC_REQUEST indicates which counter to update
This commit is contained in:
Owen W. Taylor 2012-12-19 12:01:52 -05:00
parent 40fa28de3d
commit 8865ebcc80
3 changed files with 28 additions and 16 deletions

View File

@ -763,6 +763,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
if (!is_substructure && toplevel && display_x11->use_sync && toplevel->pending_counter_value != 0)
{
toplevel->configure_counter_value = toplevel->pending_counter_value;
toplevel->configure_counter_value_is_extended = toplevel->pending_counter_value_is_extended;
toplevel->pending_counter_value = 0;
}
#endif
@ -1107,8 +1108,8 @@ _gdk_wm_protocols_filter (GdkXEvent *xev,
guint32 d2 = xevent->xclient.data.l[2];
guint32 d3 = xevent->xclient.data.l[3];
guint64 serial = ((guint64)d0 << 32) | d1;
gint64 frame_drawn_time = ((guint64)d2 << 32) | d3;
guint64 serial = ((guint64)d1 << 32) | d0;
gint64 frame_drawn_time = ((guint64)d3 << 32) | d2;
gint64 refresh_interval, presentation_time;
GdkFrameClock *clock = gdk_window_get_frame_clock (event->any.window);
@ -1145,7 +1146,7 @@ _gdk_wm_protocols_filter (GdkXEvent *xev,
guint32 d2 = xevent->xclient.data.l[2];
guint32 d3 = xevent->xclient.data.l[3];
guint64 serial = ((guint64)d0 << 32) | d1;
guint64 serial = ((guint64)d1 << 32) | d0;
GdkFrameClock *clock = gdk_window_get_frame_clock (event->any.window);
GdkFrameTimings *timings = find_frame_timings (clock, serial);
@ -1239,6 +1240,7 @@ _gdk_wm_protocols_filter (GdkXEvent *xev,
{
#ifdef HAVE_XSYNC
toplevel->pending_counter_value = xevent->xclient.data.l[2] + ((gint64)xevent->xclient.data.l[3] << 32);
toplevel->pending_counter_value_is_extended = xevent->xclient.data.l[4] != 0;
#endif
}
return GDK_FILTER_REMOVE;

View File

@ -5117,20 +5117,25 @@ gdk_x11_window_configure_finished (GdkWindow *window)
GDK_X11_DISPLAY (display)->use_sync &&
toplevel->configure_counter_value != 0)
{
set_sync_counter (GDK_WINDOW_XDISPLAY (window),
toplevel->update_counter,
toplevel->configure_counter_value);
if (toplevel->configure_counter_value_is_extended)
{
toplevel->current_counter_value = toplevel->configure_counter_value;
if ((toplevel->current_counter_value % 2) == 1)
toplevel->current_counter_value += 1;
toplevel->current_counter_value = toplevel->configure_counter_value;
if ((toplevel->current_counter_value % 2) == 1)
toplevel->current_counter_value += 1;
toplevel->configure_counter_value = 0;
toplevel->configure_counter_value = 0;
set_sync_counter (GDK_WINDOW_XDISPLAY (window),
toplevel->extended_update_counter,
toplevel->current_counter_value);
}
set_sync_counter (GDK_WINDOW_XDISPLAY (window),
toplevel->extended_update_counter,
toplevel->current_counter_value);
}
else
{
set_sync_counter (GDK_WINDOW_XDISPLAY (window),
toplevel->update_counter,
toplevel->configure_counter_value);
}
}
}
#endif
}

View File

@ -131,7 +131,12 @@ struct _GdkToplevelX11
/* If we're expecting a response from the compositor after painting a frame */
guint frame_pending : 1;
/* Whether pending_counter_value/configure_counter_value are updates
* to the extended update counter */
guint pending_counter_value_is_extended : 1;
guint configure_counter_value_is_extended : 1;
gulong map_serial; /* Serial of last transition from unmapped */
cairo_surface_t *icon_pixmap;