GDK-Win32: Move some functions around

Move gdk_win32_surface_get_queued_window_rect() and
gdk_win32_surface_apply_queued_move_resize() to gdksurface-win32.c, since these
functions are not only used for Cairo draw contexts, but is also used for GL
draw contexts, and will be used for Vulkan draw contexts.
This commit is contained in:
Chun-wei Fan
2020-08-03 18:22:51 +08:00
parent 06f28af80f
commit 69bb4f8beb
2 changed files with 46 additions and 46 deletions

View File

@@ -31,52 +31,6 @@
G_DEFINE_TYPE (GdkWin32CairoContext, gdk_win32_cairo_context, GDK_TYPE_CAIRO_CONTEXT) G_DEFINE_TYPE (GdkWin32CairoContext, gdk_win32_cairo_context, GDK_TYPE_CAIRO_CONTEXT)
void
gdk_win32_surface_get_queued_window_rect (GdkSurface *surface,
int scale,
RECT *return_window_rect)
{
RECT window_rect;
GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
_gdk_win32_get_window_client_area_rect (surface, scale, &window_rect);
/* Turn client area into window area */
_gdk_win32_adjust_client_rect (surface, &window_rect);
/* Convert GDK screen coordinates to W32 desktop coordinates */
window_rect.left -= _gdk_offset_x * impl->surface_scale;
window_rect.right -= _gdk_offset_x * impl->surface_scale;
window_rect.top -= _gdk_offset_y * impl->surface_scale;
window_rect.bottom -= _gdk_offset_y * impl->surface_scale;
*return_window_rect = window_rect;
}
void
gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface,
RECT window_rect)
{
if (!IsIconic (GDK_SURFACE_HWND (surface)))
{
GDK_NOTE (EVENTS, g_print ("Setting window position ... "));
API_CALL (SetWindowPos, (GDK_SURFACE_HWND (surface),
SWP_NOZORDER_SPECIFIED,
window_rect.left, window_rect.top,
window_rect.right - window_rect.left,
window_rect.bottom - window_rect.top,
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOREDRAW));
GDK_NOTE (EVENTS, g_print (" ... set window position\n"));
return;
}
/* Don't move iconic windows */
/* TODO: use SetWindowPlacement() to change non-minimized window position */
}
static cairo_surface_t * static cairo_surface_t *
create_cairo_surface_for_layered_window (GdkWin32Surface *impl, create_cairo_surface_for_layered_window (GdkWin32Surface *impl,
int width, int width,

View File

@@ -5101,3 +5101,49 @@ _gdk_win32_surface_get_egl_surface (GdkSurface *surface,
} }
#endif #endif
void
gdk_win32_surface_get_queued_window_rect (GdkSurface *surface,
int scale,
RECT *return_window_rect)
{
RECT window_rect;
GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
_gdk_win32_get_window_client_area_rect (surface, scale, &window_rect);
/* Turn client area into window area */
_gdk_win32_adjust_client_rect (surface, &window_rect);
/* Convert GDK screen coordinates to W32 desktop coordinates */
window_rect.left -= _gdk_offset_x * impl->surface_scale;
window_rect.right -= _gdk_offset_x * impl->surface_scale;
window_rect.top -= _gdk_offset_y * impl->surface_scale;
window_rect.bottom -= _gdk_offset_y * impl->surface_scale;
*return_window_rect = window_rect;
}
void
gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface,
RECT window_rect)
{
if (!IsIconic (GDK_SURFACE_HWND (surface)))
{
GDK_NOTE (EVENTS, g_print ("Setting window position ... "));
API_CALL (SetWindowPos, (GDK_SURFACE_HWND (surface),
SWP_NOZORDER_SPECIFIED,
window_rect.left, window_rect.top,
window_rect.right - window_rect.left,
window_rect.bottom - window_rect.top,
SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOREDRAW));
GDK_NOTE (EVENTS, g_print (" ... set window position\n"));
return;
}
/* Don't move iconic windows */
/* TODO: use SetWindowPlacement() to change non-minimized window position */
}