From 4f6e1fdf161747d98970e141e9bfbe7b9ac8771d Mon Sep 17 00:00:00 2001 From: Camillo Lugaresi Date: Tue, 20 Nov 2012 02:52:39 -0600 Subject: [PATCH] Bug 688710 - splashscreen shouldn't be always on top on OS X Activate the "hides on deactivate" behavior for splashscreens, torn-off menus, utility windows, tooltips and notifications: when another application is brought to the front, these windows are hidden so as not to obscure it. This is the expected behavior for application-specific floating windows on OS X. (cherry picked from commit 0596f5591f36f57b99103914ba03abbed5765e8b) --- gdk/quartz/gdkwindow-quartz.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index 4165a0008c..b1bcc483f9 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -2384,13 +2384,31 @@ window_type_hint_to_shadow (GdkWindowTypeHint hint) return FALSE; } +static gboolean +window_type_hint_to_hides_on_deactivate (GdkWindowTypeHint hint) +{ + switch (hint) + { + case GDK_WINDOW_TYPE_HINT_UTILITY: + case GDK_WINDOW_TYPE_HINT_MENU: /* Torn-off menu */ + case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN: + case GDK_WINDOW_TYPE_HINT_NOTIFICATION: + case GDK_WINDOW_TYPE_HINT_TOOLTIP: + return TRUE; + + default: + break; + } + + return FALSE; +} static void gdk_quartz_window_set_type_hint (GdkWindow *window, GdkWindowTypeHint hint) { GdkWindowImplQuartz *impl; - + if (GDK_WINDOW_DESTROYED (window) || !WINDOW_IS_TOPLEVEL (window)) return; @@ -2405,6 +2423,7 @@ gdk_quartz_window_set_type_hint (GdkWindow *window, [impl->toplevel setHasShadow: window_type_hint_to_shadow (hint)]; [impl->toplevel setLevel: window_type_hint_to_level (hint)]; + [impl->toplevel setHidesOnDeactivate: window_type_hint_to_hides_on_deactivate (hint)]; } static GdkWindowTypeHint @@ -2622,6 +2641,7 @@ gdk_quartz_window_set_decorations (GdkWindow *window, defer:NO]; [impl->toplevel setHasShadow: window_type_hint_to_shadow (impl->type_hint)]; [impl->toplevel setLevel: window_type_hint_to_level (impl->type_hint)]; + [impl->toplevel setHidesOnDeactivate: window_type_hint_to_hides_on_deactivate (impl->type_hint)]; [impl->toplevel setContentView:old_view]; }