Merge branch 'sumibi-yakitori/fix-minimize-window-macos' into 'main'

macos: Fix problem that window cannot be minimized by user operation

Closes #4811

See merge request GNOME/gtk!4613
This commit is contained in:
Christian Hergert 2022-04-04 18:53:19 +00:00
commit d75147db0a
2 changed files with 17 additions and 1 deletions

View File

@ -434,7 +434,8 @@ select_key_in_idle_cb (gpointer data)
{
GdkMacosSurface *surface = iter->data;
if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (surface)))
if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (surface)) &&
([surface->window styleMask] & NSWindowStyleMaskMiniaturizable) == 0)
{
[surface->window showAndMakeKey:YES];
break;

View File

@ -82,6 +82,19 @@ _gdk_macos_toplevel_surface_unmaximize (GdkMacosToplevelSurface *self)
[window zoom:window];
}
static void
_gdk_macos_toplevel_surface_unminimize (GdkMacosToplevelSurface *self)
{
NSWindow *window;
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (self));
window = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (self));
if ([window isMiniaturized])
[window deminiaturize:window];
}
static void
_gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
GdkToplevelLayout *layout)
@ -202,6 +215,8 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
_gdk_macos_toplevel_surface_unfullscreen (self);
}
_gdk_macos_toplevel_surface_unminimize (self);
if (!GDK_MACOS_SURFACE (self)->did_initial_present)
{
int x = 0, y = 0;