diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-08-03 18:22:51 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-08-05 15:38:08 +0800 |
commit | 69bb4f8beb6cdb3ff99e66f0d820cc41c2898d4f (patch) | |
tree | a3e2e248239c937fae843507149fe231ccc06be1 /gdk | |
parent | 06f28af80ff57ae42f3b3a951d33e8d43e08352c (diff) | |
download | gtk+-69bb4f8beb6cdb3ff99e66f0d820cc41c2898d4f.tar.gz |
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.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/win32/gdkcairocontext-win32.c | 46 | ||||
-rw-r--r-- | gdk/win32/gdksurface-win32.c | 46 |
2 files changed, 46 insertions, 46 deletions
diff --git a/gdk/win32/gdkcairocontext-win32.c b/gdk/win32/gdkcairocontext-win32.c index 41b54deb3d..fa3b834fae 100644 --- a/gdk/win32/gdkcairocontext-win32.c +++ b/gdk/win32/gdkcairocontext-win32.c @@ -31,52 +31,6 @@ 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 * create_cairo_surface_for_layered_window (GdkWin32Surface *impl, int width, diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index ca8b765113..357bfd813e 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -5101,3 +5101,49 @@ _gdk_win32_surface_get_egl_surface (GdkSurface *surface, } #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 */ +} |