[gtk/wip.win32.fixes: 36/42] gdksurface-win32.c: Fix maximize and fullscreen
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip.win32.fixes: 36/42] gdksurface-win32.c: Fix maximize and fullscreen
- Date: Tue, 6 Jul 2021 09:55:26 +0000 (UTC)
commit e209eca141918bd353dab1ad19c1f9bdf52c513d
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Fri Jul 2 11:19:49 2021 +0800
gdksurface-win32.c: Fix maximize and fullscreen
We need to stop requesting for configuring when we are maximizing the
toplevel surface, or when we are making the it fullscreen, otherwise things
break due to the previous updates. We must also check the toplevel surface
state to do likewise when it is in maximized or fullscreen mode.
Also go back to using inhibit_configure instead of a new gboolean in
GdkWin32Surface.
gdk/win32/gdkevents-win32.c | 8 +++++---
gdk/win32/gdksurface-win32.c | 39 +++++++++++++++++++++++++++++++--------
gdk/win32/gdksurface-win32.h | 1 -
3 files changed, 36 insertions(+), 12 deletions(-)
---
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 2be0aac319..77051a9739 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -2831,14 +2831,16 @@ gdk_event_translate (MSG *msg,
if (!(old_state & GDK_TOPLEVEL_STATE_MINIMIZED) &&
set_bits & GDK_TOPLEVEL_STATE_MINIMIZED)
{
- impl->drag_move_resize_context.native_move_resize_pending = FALSE;
- impl->toplevel_force_resize = FALSE;
+ impl->inhibit_configure = TRUE;
gdk_surface_freeze_updates (window);
}
if (old_state & GDK_TOPLEVEL_STATE_MINIMIZED &&
unset_bits & GDK_TOPLEVEL_STATE_MINIMIZED)
- gdk_surface_thaw_updates (window);
+ {
+ impl->inhibit_configure = FALSE;
+ gdk_surface_thaw_updates (window);
+ }
gdk_surface_set_is_mapped (window, !!IsWindowVisible (msg->hwnd));
gdk_synthesize_surface_state (window, unset_bits, set_bits);
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index e9da5f6701..ec62112513 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -567,6 +567,7 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
/* We initially place it at default so that we can get the
default window positioning if we want */
window_x = window_y = CW_USEDEFAULT;
+ impl->inhibit_configure = TRUE;
}
else
{
@@ -2136,7 +2137,7 @@ discard_snapinfo (GdkSurface *window)
}
static void
-unsnap (GdkSurface *window,
+unsnap (GdkSurface *window,
GdkMonitor *monitor)
{
GdkWin32Surface *impl;
@@ -2208,7 +2209,7 @@ unsnap (GdkSurface *window,
if (GDK_IS_TOPLEVEL (window))
{
impl->drag_move_resize_context.native_move_resize_pending = FALSE;
- impl->toplevel_force_resize = FALSE;
+ impl->inhibit_configure = TRUE;
}
gdk_win32_surface_move_resize (window, rect.x, rect.y,
@@ -2328,7 +2329,7 @@ snap_up (GdkSurface *window)
if (GDK_IS_TOPLEVEL (window))
{
impl->drag_move_resize_context.native_move_resize_pending = FALSE;
- impl->toplevel_force_resize = FALSE;
+ impl->inhibit_configure = TRUE;
}
gdk_win32_surface_move_resize (window, x, y, width, height);
@@ -2360,7 +2361,7 @@ snap_left (GdkSurface *window,
if (GDK_IS_TOPLEVEL (window))
{
impl->drag_move_resize_context.native_move_resize_pending = FALSE;
- impl->toplevel_force_resize = FALSE;
+ impl->inhibit_configure = TRUE;
}
gdk_win32_surface_move_resize (window,
@@ -2395,7 +2396,7 @@ snap_right (GdkSurface *window,
if (GDK_IS_TOPLEVEL (window))
{
impl->drag_move_resize_context.native_move_resize_pending = FALSE;
- impl->toplevel_force_resize = FALSE;
+ impl->inhibit_configure = TRUE;
}
gdk_win32_surface_move_resize (window,
@@ -4154,11 +4155,16 @@ gdk_win32_surface_maximize (GdkSurface *window)
gdk_synthesize_surface_state (window,
0,
GDK_TOPLEVEL_STATE_MAXIMIZED);
+
+ impl->inhibit_configure = TRUE;
+ impl->drag_move_resize_context.native_move_resize_pending = FALSE;
}
static void
gdk_win32_surface_unmaximize (GdkSurface *window)
{
+ GdkWin32Surface *impl;
+
g_return_if_fail (GDK_IS_SURFACE (window));
if (GDK_SURFACE_DESTROYED (window))
@@ -4176,6 +4182,10 @@ gdk_win32_surface_unmaximize (GdkSurface *window)
gdk_synthesize_surface_state (window,
GDK_TOPLEVEL_STATE_MAXIMIZED,
0);
+
+ impl = GDK_WIN32_SURFACE (window);
+ impl->inhibit_configure = FALSE;
+ impl->drag_move_resize_context.native_move_resize_pending = TRUE;
}
static void
@@ -4593,15 +4603,26 @@ _gdk_win32_surface_request_layout (GdkSurface *surface)
if (GDK_IS_TOPLEVEL (surface))
{
+ gboolean maximize = FALSE;
+
surface->x = rect.left / scale;
surface->y = rect.top / scale;
/*
* We force a resize of the toplevel if it is not just created/
* presented and it did not just undergo an AeroSnap op and it
- * was not minimized.
+ * was not minimized nor minimized nor fullscreen'ed.
*/
- if (impl->toplevel_force_resize)
+ if (impl->toplevel_layout != NULL)
+ {
+ gdk_toplevel_layout_get_maximized (impl->toplevel_layout,
+ &maximize);
+ if (!maximize)
+ gdk_toplevel_layout_get_fullscreen (impl->toplevel_layout,
+ &maximize);
+ }
+
+ if (!impl->inhibit_configure && !maximize)
impl->drag_move_resize_context.native_move_resize_pending = TRUE;
}
else if (GDK_IS_POPUP (surface))
@@ -4980,7 +5001,9 @@ gdk_win32_toplevel_present (GdkToplevel *toplevel,
gdk_win32_surface_show (surface, FALSE);
maybe_notify_mapped (surface);
- impl->toplevel_force_resize = TRUE;
+
+ if (impl->inhibit_configure)
+ impl->inhibit_configure = FALSE;
}
static gboolean
diff --git a/gdk/win32/gdksurface-win32.h b/gdk/win32/gdksurface-win32.h
index 2e29427a4f..5f85c50373 100644
--- a/gdk/win32/gdksurface-win32.h
+++ b/gdk/win32/gdksurface-win32.h
@@ -337,7 +337,6 @@ struct _GdkWin32Surface
int surface_scale;
GdkToplevelLayout *toplevel_layout;
- gboolean toplevel_force_resize;
struct {
int configured_width;
int configured_height;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]