Merge branch 'surface-cleanup' into 'master'

Surface cleanup

See merge request GNOME/gtk!2317
This commit is contained in:
Matthias Clasen 2020-07-30 03:43:30 +00:00
commit e8026e29b6
7 changed files with 32 additions and 37 deletions

View File

@ -190,9 +190,7 @@ gdk_surface_create_vulkan_context
gdk_surface_create_cairo_context
<SUBSECTION>
gdk_surface_queue_expose
gdk_surface_freeze_updates
gdk_surface_thaw_updates
gdk_surface_queue_render
gdk_surface_get_frame_clock
<SUBSECTION>

View File

@ -394,6 +394,10 @@ void gdk_surface_begin_move_drag (GdkSurface *surface,
int y,
guint32 timestamp);
void gdk_surface_freeze_updates (GdkSurface *surface);
void gdk_surface_thaw_updates (GdkSurface *surface);
G_END_DECLS
#endif /* __GDK_INTERNALS_H__ */

View File

@ -1355,15 +1355,15 @@ gdk_surface_paint_on_clock (GdkFrameClock *clock,
g_object_unref (surface);
}
/**
/*
* gdk_surface_invalidate_rect:
* @surface: a #GdkSurface
* @rect: (allow-none): rectangle to invalidate or %NULL to invalidate the whole
* surface
*
* A convenience wrapper around gdk_surface_invalidate_region() which
* invalidates a rectangular region. See
* gdk_surface_invalidate_region() for details.
* A convenience wrapper around gdk_surface_invalidate_region()
* which invalidates a rectangular region.
* See gdk_surface_invalidate_region() for details.
**/
void
gdk_surface_invalidate_rect (GdkSurface *surface,
@ -1406,19 +1406,17 @@ impl_surface_add_update_area (GdkSurface *impl_surface,
}
/**
* gdk_surface_queue_expose:
* gdk_surface_queue_render:
* @surface: a #GdkSurface
*
* Forces an expose event for @surface to be scheduled.
*
* If the invalid area of @surface is empty, an expose event will
* still be emitted. Its invalid region will be empty.
* Forces a #GdkSurface::render signal emission for @surface
* to be scheduled.
*
* This function is useful for implementations that track invalid
* regions on their own.
**/
void
gdk_surface_queue_expose (GdkSurface *surface)
gdk_surface_queue_render (GdkSurface *surface)
{
cairo_region_t *region;
@ -1429,17 +1427,17 @@ gdk_surface_queue_expose (GdkSurface *surface)
cairo_region_destroy (region);
}
/**
/*
* gdk_surface_invalidate_region:
* @surface: a #GdkSurface
* @region: a #cairo_region_t
*
* Adds @region to the update area for @surface. The update area is the
* region that needs to be redrawn, or dirty region.
* Adds @region to the update area for @surface. The update area is
* the region that needs to be redrawn, or dirty region.
*
* GDK will process all updates whenever the frame clock schedules a redraw,
* so theres no need to do forces redraws manually, you just need to
* invalidate regions that you know should be redrawn.
* GDK will process all updates whenever the frame clock schedules a
* redraw, so theres no need to do forces redraws manually, you just
* need to invalidate regions that you know should be redrawn.
**/
void
gdk_surface_invalidate_region (GdkSurface *surface,
@ -1469,12 +1467,12 @@ gdk_surface_invalidate_region (GdkSurface *surface,
cairo_region_destroy (visible_region);
}
/**
/*
* _gdk_surface_clear_update_area:
* @surface: a #GdkSurface.
*
* Internal function to clear the update area for a surface. This
* is called when the surface is hidden or destroyed.
* Internal function to clear the update area for a surface.
* This is called when the surface is hidden or destroyed.
**/
void
_gdk_surface_clear_update_area (GdkSurface *surface)
@ -1490,15 +1488,15 @@ _gdk_surface_clear_update_area (GdkSurface *surface)
}
}
/**
/*
* gdk_surface_freeze_updates:
* @surface: a #GdkSurface
*
* Temporarily freezes a surface such that it wont receive expose
* events. The surface will begin receiving expose events again when
* gdk_surface_thaw_updates() is called. If gdk_surface_freeze_updates()
* has been called more than once, gdk_surface_thaw_updates() must be called
* an equal number of times to begin processing exposes.
* has been called more than once, gdk_surface_thaw_updates() must be
* called an equal number of times to begin processing exposes.
**/
void
gdk_surface_freeze_updates (GdkSurface *surface)
@ -1510,7 +1508,7 @@ gdk_surface_freeze_updates (GdkSurface *surface)
_gdk_frame_clock_uninhibit_freeze (surface->frame_clock);
}
/**
/*
* gdk_surface_thaw_updates:
* @surface: a #GdkSurface
*

View File

@ -206,12 +206,7 @@ GDK_AVAILABLE_IN_ALL
void gdk_surface_beep (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_queue_expose (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_freeze_updates (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_thaw_updates (GdkSurface *surface);
void gdk_surface_queue_render (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
GdkFrameClock* gdk_surface_get_frame_clock (GdkSurface *surface);

View File

@ -3418,7 +3418,7 @@ gtk_widget_queue_draw (GtkWidget *widget)
priv->draw_needed = TRUE;
g_clear_pointer (&priv->render_node, gsk_render_node_unref);
if (GTK_IS_NATIVE (widget) && _gtk_widget_get_realized (widget))
gdk_surface_queue_expose (gtk_native_get_surface (GTK_NATIVE (widget)));
gdk_surface_queue_render (gtk_native_get_surface (GTK_NATIVE (widget)));
}
}

View File

@ -141,7 +141,7 @@ gtk_fps_overlay_force_redraw (GtkWidget *widget,
GdkFrameClock *clock,
gpointer unused)
{
gdk_surface_queue_expose (gtk_native_get_surface (gtk_widget_get_native (widget)));
gdk_surface_queue_render (gtk_native_get_surface (gtk_widget_get_native (widget)));
return G_SOURCE_REMOVE;
}
@ -251,7 +251,7 @@ gtk_fps_overlay_queue_draw (GtkInspectorOverlay *overlay)
g_hash_table_iter_init (&iter, self->infos);
while (g_hash_table_iter_next (&iter, &widget, NULL))
gdk_surface_queue_expose (gtk_native_get_surface (gtk_widget_get_native (widget)));
gdk_surface_queue_render (gtk_native_get_surface (gtk_widget_get_native (widget)));
}
static void

View File

@ -108,7 +108,7 @@ gtk_widget_updates_tick (GtkWidget *widget,
gtk_update_free (draw);
}
gdk_surface_queue_expose (gtk_native_get_surface (gtk_widget_get_native (widget)));
gdk_surface_queue_render (gtk_native_get_surface (gtk_widget_get_native (widget)));
if (draw)
{
g_queue_push_tail (updates->updates, draw);
@ -249,7 +249,7 @@ gtk_updates_overlay_queue_draw (GtkInspectorOverlay *overlay)
g_hash_table_iter_init (&iter, self->toplevels);
while (g_hash_table_iter_next (&iter, &widget, NULL))
gdk_surface_queue_expose (gtk_native_get_surface (gtk_widget_get_native (widget)));
gdk_surface_queue_render (gtk_native_get_surface (gtk_widget_get_native (widget)));
}
static void