diff --git a/lib/Utils.vala b/lib/Utils.vala index 834aa3398..521ea85d6 100644 --- a/lib/Utils.vala +++ b/lib/Utils.vala @@ -284,9 +284,7 @@ namespace Gala { } if ( - (window.window_type == Meta.WindowType.NORMAL - || window.window_type == Meta.WindowType.DIALOG - || window.window_type == Meta.WindowType.MODAL_DIALOG) + get_window_is_normal (window) && (!on_primary || (on_primary && window.is_on_primary_monitor ()))) { n ++; } @@ -454,5 +452,16 @@ namespace Gala { public static uint get_animation_duration (uint duration) { return Meta.Prefs.get_gnome_animations () ? duration : 0; } + + public static inline bool get_window_is_normal (Meta.Window window) { + switch (window.window_type) { + case Meta.WindowType.NORMAL: + case Meta.WindowType.DIALOG: + case Meta.WindowType.MODAL_DIALOG: + return true; + default: + return false; + } + } } } diff --git a/plugins/pip/PopupWindow.vala b/plugins/pip/PopupWindow.vala index de0c6ab5f..250e63cec 100644 --- a/plugins/pip/PopupWindow.vala +++ b/plugins/pip/PopupWindow.vala @@ -45,13 +45,6 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor { height = src_height * ratio; } - private static bool get_window_is_normal (Meta.Window window) { - var window_type = window.get_window_type (); - return window_type == Meta.WindowType.NORMAL - || window_type == Meta.WindowType.DIALOG - || window_type == Meta.WindowType.MODAL_DIALOG; - } - public PopupWindow (Meta.Display display, Meta.WindowActor window_actor) { Object (display: display, window_actor: window_actor); } @@ -320,8 +313,8 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor { private void update_window_focus () { unowned Meta.Window focus_window = display.get_focus_window (); - if ((focus_window != null && !get_window_is_normal (focus_window)) - || (previous_focus != null && !get_window_is_normal (previous_focus))) { + if ((focus_window != null && !Utils.get_window_is_normal (focus_window)) + || (previous_focus != null && !Utils.get_window_is_normal (previous_focus))) { previous_focus = focus_window; return; } diff --git a/src/WindowManager.vala b/src/WindowManager.vala index eb9256db9..96362a717 100644 --- a/src/WindowManager.vala +++ b/src/WindowManager.vala @@ -613,7 +613,7 @@ namespace Gala { var xwin = window.get_xwindow (); #endif if (xwin == bottom_xwin - || !InternalUtils.get_window_is_normal (window) + || !Utils.get_window_is_normal (window) || window.minimized) { return; } @@ -1339,7 +1339,7 @@ namespace Gala { if (!Meta.Prefs.get_gnome_animations ()) { map_completed (actor); - if (InternalUtils.get_window_is_normal (window) && window.get_layer () == Meta.StackLayer.BOTTOM) { + if (Utils.get_window_is_normal (window) && window.get_layer () == Meta.StackLayer.BOTTOM) { show_bottom_stack_window (window); } diff --git a/src/WindowTracker.vala b/src/WindowTracker.vala index 4912130b5..b68871a5f 100644 --- a/src/WindowTracker.vala +++ b/src/WindowTracker.vala @@ -331,7 +331,7 @@ public class Gala.WindowTracker : GLib.Object { private void on_unmanaged (Meta.Window window) { disassociate_window (window); - if (InternalUtils.get_window_is_normal (window)) { + if (Utils.get_window_is_normal (window)) { windows_changed (); } } @@ -350,7 +350,7 @@ public class Gala.WindowTracker : GLib.Object { app.add_window (window); window_to_app.insert (window, app); - if (InternalUtils.get_window_is_normal (window)) { + if (Utils.get_window_is_normal (window)) { windows_changed (); } }