diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-03-14 17:25:55 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-03-14 17:25:55 -0400 |
commit | dd4293b67ab1b586ba49d52eb83b49412cefaabe (patch) | |
tree | 868ab10e316dcdf5ba281382af1c8b7d72873f8d | |
parent | 24ec2cc6a67bba6b2898c9a55d554dae76c5bc76 (diff) | |
download | gtk+-x11-damage-reporting.tar.gz |
x11: Fix damage reportingx11-damage-reporting
-rw-r--r-- | gdk/x11/gdksurface-x11.c | 44 | ||||
-rw-r--r-- | gdk/x11/gdksurface-x11.h | 1 |
2 files changed, 27 insertions, 18 deletions
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c index 92a0a23d6c..b7abd5135e 100644 --- a/gdk/x11/gdksurface-x11.c +++ b/gdk/x11/gdksurface-x11.c @@ -179,19 +179,29 @@ _gdk_x11_surface_get_toplevel (GdkSurface *surface) /** * _gdk_x11_surface_update_size: - * @impl: a #GdkX11Surface. - * + * @impl: a #GdkX11Surface + * * Updates the state of the surface (in particular the drawable's * cairo surface) when its size has changed. **/ -void -_gdk_x11_surface_update_size (GdkX11Surface *impl) +static void +_gdk_x11_surface_update_size (GdkX11Surface *impl, + int width, + int height) { + GdkSurface *surface = GDK_SURFACE (impl); + + if (surface->width == width && surface->height == height) + return; + + surface->width = width; + surface->height = height; + _gdk_surface_update_size (surface); + if (impl->cairo_surface) - { - cairo_xlib_surface_set_size (impl->cairo_surface, - impl->unscaled_width, impl->unscaled_height); - } + cairo_xlib_surface_set_size (impl->cairo_surface, + impl->unscaled_width, + impl->unscaled_height); } static void @@ -385,10 +395,9 @@ gdk_x11_surface_compute_size (GdkSurface *surface) if (surface->resize_count == 0) { - surface->width = impl->next_layout.configured_width; - surface->height = impl->next_layout.configured_height; - _gdk_surface_update_size (surface); - _gdk_x11_surface_update_size (impl); + _gdk_x11_surface_update_size (impl, + impl->next_layout.configured_width, + impl->next_layout.configured_height); } impl->next_layout.surface_geometry_dirty = FALSE; @@ -396,11 +405,9 @@ gdk_x11_surface_compute_size (GdkSurface *surface) } else { - surface->width = impl->next_layout.configured_width; - surface->height = impl->next_layout.configured_height; - - _gdk_surface_update_size (surface); - _gdk_x11_surface_update_size (impl); + _gdk_x11_surface_update_size (impl, + impl->next_layout.configured_width, + impl->next_layout.configured_height); impl->next_layout.surface_geometry_dirty = FALSE; } @@ -1991,6 +1998,9 @@ _gdk_x11_surface_set_surface_scale (GdkSurface *surface, impl = GDK_X11_SURFACE (surface); + if (impl->surface_scale == scale) + return; + impl->surface_scale = scale; if (impl->cairo_surface) cairo_surface_set_device_scale (impl->cairo_surface, impl->surface_scale, impl->surface_scale); diff --git a/gdk/x11/gdksurface-x11.h b/gdk/x11/gdksurface-x11.h index 0830407dd0..89f4b12845 100644 --- a/gdk/x11/gdksurface-x11.h +++ b/gdk/x11/gdksurface-x11.h @@ -195,7 +195,6 @@ GdkToplevelX11 *_gdk_x11_surface_get_toplevel (GdkSurface *window); GdkCursor *_gdk_x11_surface_get_cursor (GdkSurface *window); -void _gdk_x11_surface_update_size (GdkX11Surface *impl); void _gdk_x11_surface_set_surface_scale (GdkSurface *window, int scale); gboolean _gdk_x11_surface_syncs_frames (GdkSurface *surface); |