Skip to content

Commit 245c506

Browse files
authored
Merge branch 'main' into lenemter/explicit-namespaces
2 parents 507ea8d + 4a4197c commit 245c506

File tree

5 files changed

+19
-30
lines changed

5 files changed

+19
-30
lines changed

lib/Utils.vala

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,7 @@ namespace Gala {
284284
}
285285

286286
if (
287-
(window.window_type == Meta.WindowType.NORMAL
288-
|| window.window_type == Meta.WindowType.DIALOG
289-
|| window.window_type == Meta.WindowType.MODAL_DIALOG)
287+
get_window_is_normal (window)
290288
&& (!on_primary || (on_primary && window.is_on_primary_monitor ()))) {
291289
n ++;
292290
}
@@ -454,5 +452,16 @@ namespace Gala {
454452
public static uint get_animation_duration (uint duration) {
455453
return Meta.Prefs.get_gnome_animations () ? duration : 0;
456454
}
455+
456+
public static inline bool get_window_is_normal (Meta.Window window) {
457+
switch (window.window_type) {
458+
case Meta.WindowType.NORMAL:
459+
case Meta.WindowType.DIALOG:
460+
case Meta.WindowType.MODAL_DIALOG:
461+
return true;
462+
default:
463+
return false;
464+
}
465+
}
457466
}
458467
}

plugins/pip/PopupWindow.vala

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
4545
height = src_height * ratio;
4646
}
4747

48-
private static bool get_window_is_normal (Meta.Window window) {
49-
var window_type = window.get_window_type ();
50-
return window_type == Meta.WindowType.NORMAL
51-
|| window_type == Meta.WindowType.DIALOG
52-
|| window_type == Meta.WindowType.MODAL_DIALOG;
53-
}
54-
5548
public PopupWindow (Meta.Display display, Meta.WindowActor window_actor) {
5649
Object (display: display, window_actor: window_actor);
5750
}
@@ -320,8 +313,8 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
320313

321314
private void update_window_focus () {
322315
unowned Meta.Window focus_window = display.get_focus_window ();
323-
if ((focus_window != null && !get_window_is_normal (focus_window))
324-
|| (previous_focus != null && !get_window_is_normal (previous_focus))) {
316+
if ((focus_window != null && !Utils.get_window_is_normal (focus_window))
317+
|| (previous_focus != null && !Utils.get_window_is_normal (previous_focus))) {
325318
previous_focus = focus_window;
326319
return;
327320
}

src/InternalUtils.vala

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright 2012 Tom Beckmann
33
* Copyright 2012 Rico Tzschichholz
4-
* Copyright 2023 elementary, Inc. <https://elementary.io>
4+
* Copyright 2023-2025 elementary, Inc. <https://elementary.io>
55
* SPDX-License-Identifier: GPL-3.0-or-later
66
*/
77

@@ -275,19 +275,6 @@ namespace Gala {
275275
}
276276
}
277277

278-
/**
279-
* Returns the workspaces geometry following the only_on_primary settings.
280-
*/
281-
public static Mtk.Rectangle get_workspaces_geometry (Meta.Display display) {
282-
if (Meta.Prefs.get_workspaces_only_on_primary ()) {
283-
return display.get_monitor_geometry (display.get_primary_monitor ());
284-
} else {
285-
float screen_width, screen_height;
286-
display.get_size (out screen_width, out screen_height);
287-
return { 0, 0, (int) screen_width, (int) screen_height };
288-
}
289-
}
290-
291278
public static Clutter.ActorBox actor_box_from_rect (float x, float y, float width, float height) {
292279
var actor_box = Clutter.ActorBox ();
293280
actor_box.init_rect (x, y, width, height);

src/WindowManager.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ namespace Gala {
613613
var xwin = window.get_xwindow ();
614614
#endif
615615
if (xwin == bottom_xwin
616-
|| !InternalUtils.get_window_is_normal (window)
616+
|| !Utils.get_window_is_normal (window)
617617
|| window.minimized) {
618618
return;
619619
}
@@ -1339,7 +1339,7 @@ namespace Gala {
13391339
if (!Meta.Prefs.get_gnome_animations ()) {
13401340
map_completed (actor);
13411341

1342-
if (InternalUtils.get_window_is_normal (window) && window.get_layer () == Meta.StackLayer.BOTTOM) {
1342+
if (Utils.get_window_is_normal (window) && window.get_layer () == Meta.StackLayer.BOTTOM) {
13431343
show_bottom_stack_window (window);
13441344
}
13451345

src/WindowTracker.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public class Gala.WindowTracker : GLib.Object {
331331
private void on_unmanaged (Meta.Window window) {
332332
disassociate_window (window);
333333

334-
if (InternalUtils.get_window_is_normal (window)) {
334+
if (Utils.get_window_is_normal (window)) {
335335
windows_changed ();
336336
}
337337
}
@@ -350,7 +350,7 @@ public class Gala.WindowTracker : GLib.Object {
350350
app.add_window (window);
351351
window_to_app.insert (window, app);
352352

353-
if (InternalUtils.get_window_is_normal (window)) {
353+
if (Utils.get_window_is_normal (window)) {
354354
windows_changed ();
355355
}
356356
}

0 commit comments

Comments
 (0)