Compare commits

...

5 Commits

Author SHA1 Message Date
Luca Bacci
65cafa32e2 Fix resizing with native Windows decorations
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5142
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5088
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5090
2024-11-15 11:12:37 +08:00
Chun-wei Fan
cfcc1b79d3 GdkWin32: Clean up gdk_win32_surface_handle_queued_move_resize()
Make that function accept a GdkSurface, not a GdkDrawContext, to make things
clearer to people.
2024-11-15 11:12:37 +08:00
Chun-wei Fan
d35e1e78ea gdksurface-win32.c: Disable AeroSnap for surface if not resizable
AeroSnap essentially resizes the surface by all means, so if a surface
is not resizable, just bail out of the operation, even though it is
triggered by a move operation.

This matches what is done in Windows.
2024-11-15 11:07:44 +08:00
Chun-wei Fan
9cf31641a5 gdk[drag|drop]-win32.c: Don't unnecessarily compute scale
The GdkWin32Display object already did that when we created it, so just
use whatever that is stored in there.
2024-11-15 11:07:44 +08:00
Chun-wei Fan
37fc7ec3af demos/gtk-demo|widget-factory: Temporarily disable gui_app attribute 2024-11-15 11:07:44 +08:00
10 changed files with 27 additions and 23 deletions

View File

@@ -239,7 +239,7 @@ executable('gtk4-demo',
c_args: demo_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
win_subsystem: 'windows',
# win_subsystem: 'windows',
link_args: extra_demo_ldflags,
install: true,
)
@@ -249,7 +249,7 @@ executable('gtk4-demo-application',
c_args: common_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
win_subsystem: 'windows',
# win_subsystem: 'windows',
link_args: extra_demo_ldflags,
install: true,
)

View File

@@ -68,7 +68,7 @@ executable('gtk4-widget-factory',
c_args: common_cflags,
dependencies: [ libgtk_dep, profile_conf_h ],
include_directories: confinc,
win_subsystem: 'windows',
# win_subsystem: 'windows',
link_args: extra_demo_ldflags,
install: true,
)

View File

@@ -68,7 +68,7 @@ gdk_win32_cairo_context_begin_frame (GdkDrawContext *draw_context,
surface = gdk_draw_context_get_surface (draw_context);
scale = gdk_surface_get_scale_factor (surface);
queued_hwnd_rect = gdk_win32_surface_handle_queued_move_resize (draw_context);
queued_hwnd_rect = gdk_win32_surface_handle_queued_move_resize (surface);
width = queued_hwnd_rect.right - queued_hwnd_rect.left;
height = queued_hwnd_rect.bottom - queued_hwnd_rect.top;

View File

@@ -795,11 +795,7 @@ gdk_drag_new (GdkDisplay *display,
NULL);
drag = GDK_DRAG (drag_win32);
if (display_win32->has_fixed_scale)
drag_win32->scale = display_win32->surface_scale;
else
drag_win32->scale = gdk_win32_display_get_monitor_scale_factor (display_win32, NULL, NULL);
drag_win32->scale = display_win32->surface_scale;
drag_win32->dnd_thread_items = display_win32->cb_dnd_items->clipdrop->dnd_thread_items;
@@ -1911,7 +1907,6 @@ gdk_win32_drag_drop_done (GdkDrag *drag,
if (success)
{
gdk_surface_hide (drag_win32->drag_surface);
return;
}

View File

@@ -177,11 +177,7 @@ gdk_drop_new (GdkDisplay *display,
"surface", surface,
NULL);
if (display_win32->has_fixed_scale)
drop_win32->scale = display_win32->surface_scale;
else
drop_win32->scale = gdk_win32_display_get_monitor_scale_factor (display_win32, NULL, NULL);
drop_win32->scale = display_win32->surface_scale;
drop_win32->protocol = protocol;
return GDK_DROP (drop_win32);

View File

@@ -114,7 +114,9 @@ gdk_win32_gl_context_egl_begin_frame (GdkDrawContext *draw_context,
GdkColorState **out_color_state,
GdkMemoryDepth *out_depth)
{
gdk_win32_surface_handle_queued_move_resize (draw_context);
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
gdk_win32_surface_handle_queued_move_resize (surface);
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_egl_parent_class)->begin_frame (draw_context, depth, update_area, out_color_state, out_depth);
}

View File

@@ -189,7 +189,7 @@ gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context,
GdkColorState **out_color_state,
GdkMemoryDepth *out_depth)
{
gdk_win32_surface_handle_queued_move_resize (draw_context);
gdk_win32_surface_handle_queued_move_resize (gdk_draw_context_get_surface (draw_context));
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, depth, update_area, out_color_state, out_depth);
}

View File

@@ -3045,6 +3045,14 @@ handle_aerosnap_move_resize (GdkSurface *surface,
int halfright = 0;
int fullup = 0;
gboolean fullup_edge = FALSE;
GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
if (context->op == GDK_WIN32_DRAGOP_MOVE)
{
if (impl->toplevel_layout != NULL &&
!gdk_toplevel_layout_get_resizable (impl->toplevel_layout))
return;
}
if (context->op == GDK_WIN32_DRAGOP_RESIZE)
switch (context->edge)
@@ -4489,8 +4497,11 @@ _gdk_win32_surface_compute_size (GdkSurface *surface)
if (!impl->drag_move_resize_context.native_move_resize_pending)
{
bool size_changed;
GdkWin32Display *display = GDK_WIN32_DISPLAY (gdk_surface_get_display (surface));
if (GDK_IS_TOPLEVEL (surface) && impl->force_recompute_size)
if (GDK_IS_TOPLEVEL (surface) &&
impl->force_recompute_size &&
!(display->display_surface_record->modal_operation_in_progress & GDK_WIN32_MODAL_OP_SIZEMOVE_MASK))
{
size_changed = width != surface->width ||
height != surface->height;
@@ -5109,14 +5120,12 @@ gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface,
}
RECT
gdk_win32_surface_handle_queued_move_resize (GdkDrawContext *draw_context)
gdk_win32_surface_handle_queued_move_resize (GdkSurface *surface)
{
GdkSurface *surface;
GdkWin32Surface *impl;
int scale;
RECT queued_hwnd_rect;
surface = gdk_draw_context_get_surface (draw_context);
impl = GDK_WIN32_SURFACE (surface);
scale = gdk_surface_get_scale_factor (surface);

View File

@@ -357,7 +357,7 @@ void gdk_win32_surface_move_resize (GdkSurface *surface,
GdkSurface *gdk_win32_drag_surface_new (GdkDisplay *display);
RECT
gdk_win32_surface_handle_queued_move_resize (GdkDrawContext *draw_context);
gdk_win32_surface_handle_queued_move_resize (GdkSurface *surface);
#ifdef HAVE_EGL
EGLSurface gdk_win32_surface_get_egl_surface (GdkSurface *surface,

View File

@@ -63,7 +63,9 @@ gdk_win32_vulkan_context_begin_frame (GdkDrawContext *draw_context,
GdkColorState **out_color_state,
GdkMemoryDepth *out_depth)
{
gdk_win32_surface_handle_queued_move_resize (draw_context);
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
gdk_win32_surface_handle_queued_move_resize (surface);
GDK_DRAW_CONTEXT_CLASS (gdk_win32_vulkan_context_parent_class)->begin_frame (draw_context, depth, update_area, out_color_state, out_depth);
}