[gtk: 1/2] macos: Skip running `showAndMakeKey` when a window is minimized by user action
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] macos: Skip running `showAndMakeKey` when a window is minimized by user action
- Date: Mon, 4 Apr 2022 18:53:20 +0000 (UTC)
commit d3cf7088b31965371a11d47a872fa1a4005eaa00
Author: sumibi-yakitori <nekosoft360 gmail com>
Date: Sat Apr 2 21:29:27 2022 +0900
macos: Skip running `showAndMakeKey` when a window is minimized by user action
When a window is minimized by user action, the `showAndMakeKey` method is not executed when idle. This
prevents the window from being un-minimized immediately.
And allow programmatic minimization of a window by un-minimizing them in
`_gdk_macos_toplevel_surface_present`
Closes #4811
gdk/macos/gdkmacosdisplay.c | 3 ++-
gdk/macos/gdkmacostoplevelsurface.c | 15 +++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/gdk/macos/gdkmacosdisplay.c b/gdk/macos/gdkmacosdisplay.c
index d85a744563..41be42cfbe 100644
--- a/gdk/macos/gdkmacosdisplay.c
+++ b/gdk/macos/gdkmacosdisplay.c
@@ -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;
diff --git a/gdk/macos/gdkmacostoplevelsurface.c b/gdk/macos/gdkmacostoplevelsurface.c
index 1759077563..a26f9727a2 100644
--- a/gdk/macos/gdkmacostoplevelsurface.c
+++ b/gdk/macos/gdkmacostoplevelsurface.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]