[gtk: 1/2] macOS: fix #2436 raise transient window on focus
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] macOS: fix #2436 raise transient window on focus
- Date: Tue, 19 Jan 2021 11:56:55 +0000 (UTC)
commit 59806eee384bbd4ac277f39412a0c31e793d9b5c
Author: Thomas Holder <thomas thomas-holder de>
Date: Tue Jan 19 09:31:00 2021 +0100
macOS: fix #2436 raise transient window on focus
Ported from gtk-3-24 e278f3890540ad59eaccf32fd90fe49416e1f7f2
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2436
gdk/macos/gdkmacosdisplay.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
---
diff --git a/gdk/macos/gdkmacosdisplay.c b/gdk/macos/gdkmacosdisplay.c
index be2d111c59..ea07215794 100644
--- a/gdk/macos/gdkmacosdisplay.c
+++ b/gdk/macos/gdkmacosdisplay.c
@@ -547,6 +547,20 @@ _gdk_macos_display_surface_resigned_key (GdkMacosDisplay *self,
_gdk_macos_display_clear_sorting (self);
}
+/* Raises a transient window.
+ */
+static void
+raise_transient (GdkMacosSurface *surface)
+{
+ GdkMacosSurface *parent_surface = GDK_MACOS_SURFACE (GDK_SURFACE (surface)->transient_for);
+
+ NSWindow *parent = _gdk_macos_surface_get_native (parent_surface);
+ NSWindow *window = _gdk_macos_surface_get_native (surface);
+
+ [parent removeChildWindow:window];
+ [parent addChildWindow:window ordered:NSWindowAbove];
+}
+
void
_gdk_macos_display_surface_became_main (GdkMacosDisplay *self,
GdkMacosSurface *surface)
@@ -559,6 +573,9 @@ _gdk_macos_display_surface_became_main (GdkMacosDisplay *self,
g_queue_push_head_link (&self->main_surfaces, &surface->main);
+ if (GDK_SURFACE (surface)->transient_for)
+ raise_transient (surface);
+
_gdk_macos_display_clear_sorting (self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]