Reimplement _NET_WM_SYNC_REQUEST inside X11 backend

Deprecate gdk_window_enable_synchronized_configure() and
gdk_window_configure_done() and make them no-ops. Implement the
handling of _NET_WM_SYNC_REQUEST in terms of the frame cycle -
we know that all processing will be finished in the next frame
cycle after the ConfigureNotify is received.
This commit is contained in:
Owen W. Taylor 2012-12-19 12:49:32 -05:00
parent 8865ebcc80
commit 645b5f398d
9 changed files with 31 additions and 158 deletions

View File

@ -1294,20 +1294,6 @@ gdk_broadway_window_begin_move_drag (GdkWindow *window,
}
static void
gdk_broadway_window_enable_synchronized_configure (GdkWindow *window)
{
if (!GDK_IS_WINDOW_IMPL_BROADWAY (window->impl))
return;
}
static void
gdk_broadway_window_configure_finished (GdkWindow *window)
{
if (!WINDOW_IS_TOPLEVEL (window))
return;
}
static gboolean
gdk_broadway_window_beep (GdkWindow *window)
{
@ -1499,8 +1485,6 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
impl_class->set_functions = gdk_broadway_window_set_functions;
impl_class->begin_resize_drag = gdk_broadway_window_begin_resize_drag;
impl_class->begin_move_drag = gdk_broadway_window_begin_move_drag;
impl_class->enable_synchronized_configure = gdk_broadway_window_enable_synchronized_configure;
impl_class->configure_finished = gdk_broadway_window_configure_finished;
impl_class->set_opacity = gdk_broadway_window_set_opacity;
impl_class->set_composited = gdk_broadway_window_set_composited;
impl_class->destroy_notify = gdk_broadway_window_destroy_notify;

View File

@ -11215,44 +11215,28 @@ gdk_window_begin_move_drag (GdkWindow *window,
* gdk_window_enable_synchronized_configure:
* @window: a toplevel #GdkWindow
*
* Indicates that the application will cooperate with the window
* system in synchronizing the window repaint with the window
* manager during resizing operations. After an application calls
* this function, it must call gdk_window_configure_finished() every
* time it has finished all processing associated with a set of
* Configure events. Toplevel GTK+ windows automatically use this
* protocol.
*
* On X, calling this function makes @window participate in the
* _NET_WM_SYNC_REQUEST window manager protocol.
* Does nothing, present only for compatiblity.
*
* Since: 2.6
* Deprecated: 3.8: this function is no longer needed
**/
void
gdk_window_enable_synchronized_configure (GdkWindow *window)
{
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->enable_synchronized_configure (window);
}
/**
* gdk_window_configure_finished:
* @window: a toplevel #GdkWindow
*
* Signal to the window system that the application has finished
* handling Configure events it has received. Window Managers can
* use this to better synchronize the frame repaint with the
* application. GTK+ applications will automatically call this
* function when appropriate.
*
* This function can only be called if gdk_window_enable_synchronized_configure()
* was called previously.
* Does nothing, present only for compatiblity.
*
* Since: 2.6
* Deprecated: 3.8: this function is no longer needed
**/
void
gdk_window_configure_finished (GdkWindow *window)
{
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->configure_finished (window);
}
/**

View File

@ -884,7 +884,9 @@ void gdk_window_constrain_size (GdkGeometry *geometry,
gint *new_width,
gint *new_height);
GDK_DEPRECATED_IN_3_8
void gdk_window_enable_synchronized_configure (GdkWindow *window);
GDK_DEPRECATED_IN_3_8
void gdk_window_configure_finished (GdkWindow *window);
GdkWindow *gdk_get_default_root_window (void);

View File

@ -3002,16 +3002,6 @@ gdk_quartz_window_set_group (GdkWindow *window,
/* FIXME: Implement */
}
static void
gdk_quartz_window_enable_synchronized_configure (GdkWindow *window)
{
}
static void
gdk_quartz_window_configure_finished (GdkWindow *window)
{
}
static void
gdk_quartz_window_destroy_notify (GdkWindow *window)
{
@ -3129,8 +3119,6 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
impl_class->set_functions = gdk_quartz_window_set_functions;
impl_class->begin_resize_drag = gdk_quartz_window_begin_resize_drag;
impl_class->begin_move_drag = gdk_quartz_window_begin_move_drag;
impl_class->enable_synchronized_configure = gdk_quartz_window_enable_synchronized_configure;
impl_class->configure_finished = gdk_quartz_window_configure_finished;
impl_class->set_opacity = gdk_quartz_window_set_opacity;
impl_class->destroy_notify = gdk_quartz_window_destroy_notify;
impl_class->register_dnd = _gdk_quartz_window_register_dnd;

View File

@ -1468,21 +1468,6 @@ gdk_wayland_window_begin_move_drag (GdkWindow *window,
gdk_device_ungrab (device, timestamp);
}
static void
gdk_wayland_window_enable_synchronized_configure (GdkWindow *window)
{
}
static void
gdk_wayland_window_configure_finished (GdkWindow *window)
{
if (!WINDOW_IS_TOPLEVEL (window))
return;
if (!GDK_IS_WINDOW_IMPL_WAYLAND (window->impl))
return;
}
static void
gdk_wayland_window_set_opacity (GdkWindow *window,
gdouble opacity)
@ -1666,8 +1651,6 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
impl_class->set_functions = gdk_wayland_window_set_functions;
impl_class->begin_resize_drag = gdk_wayland_window_begin_resize_drag;
impl_class->begin_move_drag = gdk_wayland_window_begin_move_drag;
impl_class->enable_synchronized_configure = gdk_wayland_window_enable_synchronized_configure;
impl_class->configure_finished = gdk_wayland_window_configure_finished;
impl_class->set_opacity = gdk_wayland_window_set_opacity;
impl_class->set_composited = gdk_wayland_window_set_composited;
impl_class->destroy_notify = gdk_wayland_window_destroy_notify;

View File

@ -3248,18 +3248,6 @@ gdk_win32_window_lookup_for_display (GdkDisplay *display,
return (GdkWindow*) gdk_win32_handle_table_lookup (anid);
}
static void
gdk_win32_window_enable_synchronized_configure (GdkWindow *window)
{
/* nothing - no window manager to cooperate with */
}
static void
gdk_win32_window_configure_finished (GdkWindow *window)
{
/* nothing - no window manager to cooperate with */
}
static void
gdk_win32_window_set_opacity (GdkWindow *window,
gdouble opacity)
@ -3618,8 +3606,6 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
impl_class->begin_resize_drag = gdk_win32_window_begin_resize_drag;
impl_class->begin_move_drag = gdk_win32_window_begin_move_drag;
impl_class->enable_synchronized_configure = gdk_win32_window_enable_synchronized_configure;
impl_class->configure_finished = gdk_win32_window_configure_finished;
impl_class->set_opacity = gdk_win32_window_set_opacity;
//impl_class->set_composited = gdk_win32_window_set_composited;
impl_class->destroy_notify = gdk_win32_window_destroy_notify;

View File

@ -344,7 +344,21 @@ gdk_x11_window_begin_frame (GdkWindow *window)
impl->toplevel->in_frame = TRUE;
hook_surface_changed (window);
if (impl->toplevel->configure_counter_value != 0 &&
impl->toplevel->configure_counter_value_is_extended)
{
impl->toplevel->current_counter_value = impl->toplevel->configure_counter_value;
if ((impl->toplevel->current_counter_value % 2) == 1)
impl->toplevel->current_counter_value += 1;
impl->toplevel->configure_counter_value = 0;
window_pre_damage (window);
}
else
{
hook_surface_changed (window);
}
}
static void
@ -407,6 +421,16 @@ gdk_x11_window_end_frame (GdkWindow *window)
unhook_surface_changed (window);
if (impl->toplevel->configure_counter_value != 0 &&
!impl->toplevel->configure_counter_value_is_extended)
{
set_sync_counter (GDK_WINDOW_XDISPLAY (window),
impl->toplevel->update_counter,
impl->toplevel->configure_counter_value);
impl->toplevel->configure_counter_value = 0;
}
if (!impl->toplevel->frame_pending)
gdk_frame_timings_set_complete (timings, TRUE);
}
@ -5074,72 +5098,6 @@ gdk_x11_window_begin_move_drag (GdkWindow *window,
emulate_move_drag (window, device, button, root_x, root_y, timestamp);
}
static void
gdk_x11_window_enable_synchronized_configure (GdkWindow *window)
{
GdkWindowImplX11 *impl;
if (!GDK_IS_WINDOW_IMPL_X11 (window->impl))
return;
impl = GDK_WINDOW_IMPL_X11 (window->impl);
if (!impl->use_synchronized_configure)
{
/* This basically means you want to do fancy X specific stuff, so
ensure we have a native window */
gdk_window_ensure_native (window);
impl->use_synchronized_configure = TRUE;
ensure_sync_counter (window);
}
}
static void
gdk_x11_window_configure_finished (GdkWindow *window)
{
GdkWindowImplX11 *impl;
if (!WINDOW_IS_TOPLEVEL (window))
return;
impl = GDK_WINDOW_IMPL_X11 (window->impl);
if (!impl->use_synchronized_configure)
return;
#ifdef HAVE_XSYNC
if (!GDK_WINDOW_DESTROYED (window))
{
GdkDisplay *display = GDK_WINDOW_DISPLAY (window);
GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window);
if (toplevel && toplevel->update_counter != None &&
GDK_X11_DISPLAY (display)->use_sync &&
toplevel->configure_counter_value != 0)
{
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->configure_counter_value = 0;
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
}
static gboolean
gdk_x11_window_beep (GdkWindow *window)
{
@ -5411,8 +5369,6 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
impl_class->set_functions = gdk_x11_window_set_functions;
impl_class->begin_resize_drag = gdk_x11_window_begin_resize_drag;
impl_class->begin_move_drag = gdk_x11_window_begin_move_drag;
impl_class->enable_synchronized_configure = gdk_x11_window_enable_synchronized_configure;
impl_class->configure_finished = gdk_x11_window_configure_finished;
impl_class->set_opacity = gdk_x11_window_set_opacity;
impl_class->set_composited = gdk_x11_window_set_composited;
impl_class->destroy_notify = gdk_x11_window_destroy_notify;

View File

@ -72,7 +72,6 @@ struct _GdkWindowImplX11
guint no_bg : 1; /* Set when the window background is temporarily
* unset during resizing and scaling */
guint override_redirect : 1;
guint use_synchronized_configure : 1;
cairo_surface_t *cairo_surface;

View File

@ -5164,7 +5164,6 @@ gtk_window_realize (GtkWidget *widget)
gtk_style_context_set_background (gtk_widget_get_style_context (widget), gdk_window);
gdk_window_enable_synchronized_configure (gdk_window);
return;
}
@ -5238,8 +5237,6 @@ gtk_window_realize (GtkWidget *widget)
gdk_window = gdk_window_new (parent_window, &attributes, attributes_mask);
gtk_widget_set_window (widget, gdk_window);
gdk_window_enable_synchronized_configure (gdk_window);
gtk_widget_register_window (widget, gdk_window);
context = gtk_widget_get_style_context (widget);
@ -5580,7 +5577,6 @@ gtk_window_configure_event (GtkWidget *widget,
if (GTK_WIDGET_CLASS (gtk_window_parent_class)->configure_event)
return GTK_WIDGET_CLASS (gtk_window_parent_class)->configure_event (widget, event);
gdk_window_configure_finished (gtk_widget_get_window (widget));
return FALSE;
}
@ -5614,7 +5610,6 @@ gtk_window_configure_event (GtkWidget *widget,
(allocation.width == event->width &&
allocation.height == event->height))
{
gdk_window_configure_finished (gtk_widget_get_window (widget));
return TRUE;
}
@ -7153,10 +7148,6 @@ gtk_window_move_resize (GtkWindow *window)
set_grip_position (window);
update_grip_visibility (window);
gdk_window_process_updates (gdk_window, TRUE);
gdk_window_configure_finished (gdk_window);
/* If the configure request changed, it means that
* we either:
* 1) coincidentally changed hints or widget properties