[gtk/master.win32: 3/8] gdksurface-win32.c: Add function to handle queued moves/resizes
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/master.win32: 3/8] gdksurface-win32.c: Add function to handle queued moves/resizes
- Date: Wed, 5 Aug 2020 07:38:52 +0000 (UTC)
commit d6656f0bbbc2fd0cf474de39ae069a2c70aee2c9
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Aug 5 10:36:53 2020 +0800
gdksurface-win32.c: Add function to handle queued moves/resizes
Since we need to deal with queued moves and resizes in the Cairo, GL and Vulkan
draw contexts, and the logic involved in all three of these are largely
similar, add a function gdk_win32_surface_handle_queued_move_resize() that will
handle this, which will be shared between these three types of draw contexts.
gdk/win32/gdksurface-win32.c | 41 +++++++++++++++++++++++++++++++++++++++++
gdk/win32/gdksurface-win32.h | 3 +++
2 files changed, 44 insertions(+)
---
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index 357bfd813e..a848d56304 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -45,6 +45,7 @@
#include "gdkwin32cursor.h"
#include "gdkglcontext-win32.h"
#include "gdkdisplay-win32.h"
+#include "gdkcairocontext-win32.h"
#include <cairo-win32.h>
#include <dwmapi.h>
@@ -5102,6 +5103,46 @@ _gdk_win32_surface_get_egl_surface (GdkSurface *surface,
}
#endif
+RECT
+gdk_win32_surface_handle_queued_move_resize (GdkDrawContext *draw_context)
+{
+ GdkWin32CairoContext *cairo_ctx = NULL;
+ GdkSurface *surface;
+ GdkWin32Surface *impl;
+ int scale;
+ cairo_t *cr;
+ int width, height;
+ RECT queued_window_rect;
+
+ surface = gdk_draw_context_get_surface (draw_context);
+ impl = GDK_WIN32_SURFACE (surface);
+ scale = gdk_surface_get_scale_factor (surface);
+
+ if (GDK_IS_WIN32_CAIRO_CONTEXT (draw_context))
+ {
+ cairo_ctx = GDK_WIN32_CAIRO_CONTEXT (draw_context);
+ cairo_ctx->layered = impl->layered;
+ }
+
+ gdk_win32_surface_get_queued_window_rect (surface, scale, &queued_window_rect);
+
+ /* Apply queued resizes for non-double-buffered and non-layered windows
+ * before painting them (we paint on the window DC directly,
+ * it must have the right size).
+ * Due to some poorly-undetstood issue delayed
+ * resizing of double-buffered windows can produce weird
+ * artefacts, so these are also resized before we paint.
+ */
+ if (impl->drag_move_resize_context.native_move_resize_pending &&
+ (cairo_ctx == NULL || !cairo_ctx->layered))
+ {
+ impl->drag_move_resize_context.native_move_resize_pending = FALSE;
+ gdk_win32_surface_apply_queued_move_resize (surface, queued_window_rect);
+ }
+
+ return queued_window_rect;
+}
+
void
gdk_win32_surface_get_queued_window_rect (GdkSurface *surface,
int scale,
diff --git a/gdk/win32/gdksurface-win32.h b/gdk/win32/gdksurface-win32.h
index e4f97d11be..7fb35ed764 100644
--- a/gdk/win32/gdksurface-win32.h
+++ b/gdk/win32/gdksurface-win32.h
@@ -393,6 +393,9 @@ void gdk_win32_surface_move_resize (GdkSurface *window,
int width,
int height);
+RECT
+gdk_win32_surface_handle_queued_move_resize (GdkDrawContext *draw_context);
+
void
gdk_win32_surface_get_queued_window_rect (GdkSurface *surface,
int scale,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]