forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
69bb4f8beb
commit
c6ada2a329
@ -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>
|
||||
@ -5147,3 +5148,41 @@ gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface,
|
||||
/* Don't move iconic windows */
|
||||
/* TODO: use SetWindowPlacement() to change non-minimized window position */
|
||||
}
|
||||
|
||||
RECT
|
||||
gdk_win32_surface_handle_queued_move_resize (GdkDrawContext *draw_context)
|
||||
{
|
||||
GdkWin32CairoContext *cairo_ctx = NULL;
|
||||
GdkSurface *surface;
|
||||
GdkWin32Surface *impl;
|
||||
int scale;
|
||||
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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user