From 9038f7b6ac89a1fd57cc20ae3b68704bcdbb9006 Mon Sep 17 00:00:00 2001 From: Leo Date: Sat, 21 Dec 2024 11:41:15 +0300 Subject: [PATCH 1/6] Prevent PiP from overlapping Wingpanel (#2185) --- data/gala.metainfo.xml.in | 1 + plugins/pip/PopupWindow.vala | 48 ++++++++---------------------------- 2 files changed, 11 insertions(+), 38 deletions(-) diff --git a/data/gala.metainfo.xml.in b/data/gala.metainfo.xml.in index 5e95a0702..03bf6bd2f 100644 --- a/data/gala.metainfo.xml.in +++ b/data/gala.metainfo.xml.in @@ -38,6 +38,7 @@ + Prevent PIP overlapping wingpanel? Toggling the active window's maximization state during multitasking view messes up the window preview size Some apps ignore HiDPI mode Invisible window clones diff --git a/plugins/pip/PopupWindow.vala b/plugins/pip/PopupWindow.vala index 61f167114..cf10a9c0d 100644 --- a/plugins/pip/PopupWindow.vala +++ b/plugins/pip/PopupWindow.vala @@ -88,20 +88,15 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor { update_size (); -#if HAS_MUTTER45 - Mtk.Rectangle monitor_rect; -#else - Meta.Rectangle monitor_rect; -#endif - get_current_monitor_rect (out monitor_rect); + var workarea_rect = display.get_workspace_manager ().get_active_workspace ().get_work_area_all_monitors (); float x_position, y_position; if (Clutter.get_default_text_direction () == Clutter.TextDirection.RTL) { - x_position = SCREEN_MARGIN + monitor_rect.x; + x_position = SCREEN_MARGIN + workarea_rect.x; } else { - x_position = monitor_rect.width + monitor_rect.x - SCREEN_MARGIN - width; + x_position = workarea_rect.x + workarea_rect.width - SCREEN_MARGIN - width; } - y_position = monitor_rect.height + monitor_rect.y - SCREEN_MARGIN - height; + y_position = workarea_rect.y + workarea_rect.height - SCREEN_MARGIN - height; set_position (x_position, y_position); @@ -431,22 +426,12 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor { private void place_window_in_screen () { off_screen = false; -#if HAS_MUTTER45 - Mtk.Rectangle monitor_rect; -#else - Meta.Rectangle monitor_rect; -#endif - get_current_monitor_rect (out monitor_rect); + var workarea_rect = display.get_workspace_manager ().get_active_workspace ().get_work_area_all_monitors (); - int monitor_x = monitor_rect.x; - int monitor_y = monitor_rect.y; - int monitor_width = monitor_rect.width; - int monitor_height = monitor_rect.height; - - var screen_limit_start_x = SCREEN_MARGIN + monitor_x; - var screen_limit_end_x = monitor_width + monitor_x - SCREEN_MARGIN - width; - var screen_limit_start_y = SCREEN_MARGIN + monitor_y; - var screen_limit_end_y = monitor_height + monitor_y - SCREEN_MARGIN - height; + var screen_limit_start_x = workarea_rect.x + SCREEN_MARGIN; + var screen_limit_end_x = workarea_rect.x + workarea_rect.width - SCREEN_MARGIN - width; + var screen_limit_start_y = workarea_rect.y + SCREEN_MARGIN; + var screen_limit_end_y = workarea_rect.y + workarea_rect.height - SCREEN_MARGIN - height; var duration = AnimationsSettings.get_animation_duration (300); @@ -467,12 +452,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor { set_easing_mode (Clutter.AnimationMode.EASE_OUT_BACK); set_easing_duration (duration); -#if HAS_MUTTER45 - Mtk.Rectangle monitor_rect; -#else - Meta.Rectangle monitor_rect; -#endif - get_current_monitor_rect (out monitor_rect); + var monitor_rect = display.get_monitor_geometry (display.get_current_monitor ()); int monitor_x = monitor_rect.x; int monitor_y = monitor_rect.y; @@ -546,14 +526,6 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor { return false; } -#if HAS_MUTTER45 - private void get_current_monitor_rect (out Mtk.Rectangle rect) { -#else - private void get_current_monitor_rect (out Meta.Rectangle rect) { -#endif - rect = display.get_monitor_geometry (display.get_current_monitor ()); - } - private void get_target_window_size (out float width, out float height) { if (clone_container.has_clip) { clone_container.get_clip (null, null, out width, out height); From cbcf70bd53db25d0d001e81f411e0606b597eee7 Mon Sep 17 00:00:00 2001 From: Leo Date: Sat, 21 Dec 2024 11:49:02 +0300 Subject: [PATCH 2/6] PiP: Fix drag and drop (#2184) --- data/gala.metainfo.xml.in | 1 + plugins/pip/PopupWindow.vala | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/data/gala.metainfo.xml.in b/data/gala.metainfo.xml.in index 03bf6bd2f..9ec779262 100644 --- a/data/gala.metainfo.xml.in +++ b/data/gala.metainfo.xml.in @@ -46,6 +46,7 @@ Unthemed cursor style and glitchy menus on some applications Crash when moving windows between workspaces and using gestures to switch Text UI based Scaling: Tiny Titlebars in XWayland Apps + PiP dragging doesn't start until after mouse is released diff --git a/plugins/pip/PopupWindow.vala b/plugins/pip/PopupWindow.vala index cf10a9c0d..c1c3b30fe 100644 --- a/plugins/pip/PopupWindow.vala +++ b/plugins/pip/PopupWindow.vala @@ -68,11 +68,6 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor { clone = new Clutter.Clone (window_actor); - move_action = new DragDropAction (DragDropActionType.SOURCE, "pip"); - move_action.drag_begin.connect (on_move_begin); - move_action.drag_canceled.connect (on_move_end); - move_action.actor_clicked.connect (activate); - clone_container = new Clutter.Actor () { scale_x = 0.35f, scale_y = 0.35f @@ -84,7 +79,12 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor { }; container.add_child (clone_container); container.add_effect (new ShadowEffect ("window")); - container.add_action (move_action); + + move_action = new DragDropAction (DragDropActionType.SOURCE, "pip"); + move_action.drag_begin.connect (on_move_begin); + move_action.drag_canceled.connect (on_move_end); + move_action.actor_clicked.connect (activate); + add_action (move_action); update_size (); From b129243b77151a5fa1282fc0d050f2c2bbfce52b Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Fri, 20 Dec 2024 16:46:59 +0000 Subject: [PATCH 3/6] Translated using Weblate (Polish) Currently translated at 100.0% (60 of 60 strings) Translation: Desktop/Gala Translate-URL: https://l10n.elementary.io/projects/desktop/gala/pl/ --- po/pl.po | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/po/pl.po b/po/pl.po index 4ec79b236..71eb1f1cd 100644 --- a/po/pl.po +++ b/po/pl.po @@ -8,17 +8,17 @@ msgstr "" "Project-Id-Version: gala\n" "Report-Msgid-Bugs-To: https://github.com/elementary/gala/issues\n" "POT-Creation-Date: 2024-12-18 21:23+0000\n" -"PO-Revision-Date: 2024-12-03 18:16+0000\n" +"PO-Revision-Date: 2024-12-21 09:16+0000\n" "Last-Translator: Marcin Serwin \n" -"Language-Team: Polish \n" +"Language-Team: Polish " +"\n" "Language: pl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 5.6.2\n" +"X-Generator: Weblate 5.8.4\n" "X-Launchpad-Export-Date: 2017-04-20 06:29+0000\n" #: daemon/DBus.vala:82 daemon-gtk3/BackgroundMenu.vala:11 @@ -127,17 +127,15 @@ msgstr "Zaktualizowano tłumaczenia" #: data/gala.metainfo.xml.in:35 msgid "Fixed rare crash when a dock window was killed" -msgstr "" +msgstr "Naprawiono rzadki crash gdy okno doku jest zabite" #: data/gala.metainfo.xml.in:36 msgid "Added interactive screenshot shortcut" -msgstr "" +msgstr "Dodano interaktywny skrót do zrzutów ekranu" #: data/gala.metainfo.xml.in:37 -#, fuzzy -#| msgid "Fix potential crash when taking screenshots" msgid "Fixed crash when using tiling shortcuts" -msgstr "Napraw możliwą awarię przy robieniu zrzutów ekranu" +msgstr "Naprawiono crash podczas korzystania ze skrótów kafelkowania" #: data/gala.metainfo.xml.in:56 msgid "Improved shadows performance" From 6d6f4b0ce588272b8f37af71b4ee3b14b98d5365 Mon Sep 17 00:00:00 2001 From: Kisaragi Hiu Date: Fri, 20 Dec 2024 08:34:48 +0000 Subject: [PATCH 4/6] Translated using Weblate (Chinese (Traditional Han script)) Currently translated at 100.0% (60 of 60 strings) Translation: Desktop/Gala Translate-URL: https://l10n.elementary.io/projects/desktop/gala/zh_Hant/ --- po/zh_TW.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/po/zh_TW.po b/po/zh_TW.po index f07f4d8d1..579575d37 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://github.com/elementary/gala/issues\n" "POT-Creation-Date: 2024-12-18 21:23+0000\n" -"PO-Revision-Date: 2024-12-09 11:10+0000\n" +"PO-Revision-Date: 2024-12-21 09:16+0000\n" "Last-Translator: Kisaragi Hiu \n" "Language-Team: Chinese (Traditional Han script) \n" @@ -125,15 +125,15 @@ msgstr "更新翻譯" #: data/gala.metainfo.xml.in:35 msgid "Fixed rare crash when a dock window was killed" -msgstr "" +msgstr "修正 dock 視窗被終止時偶爾會發生的崩潰" #: data/gala.metainfo.xml.in:36 msgid "Added interactive screenshot shortcut" -msgstr "" +msgstr "新增以互動式介面擷取畫面快照的快捷鍵" #: data/gala.metainfo.xml.in:37 msgid "Fixed crash when using tiling shortcuts" -msgstr "" +msgstr "修正使用鋪排快捷鍵時會崩潰的問題" #: data/gala.metainfo.xml.in:56 msgid "Improved shadows performance" From 84a1352d98d9b731004e0b1feb32cd8b1148f8d5 Mon Sep 17 00:00:00 2001 From: Leo Date: Sat, 21 Dec 2024 19:33:20 +0300 Subject: [PATCH 5/6] WindowManager: Only show notifications after their window was shown (#2183) Co-authored-by: Leonhard --- src/InternalUtils.vala | 10 ++++++++-- src/WindowManager.vala | 7 ++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/InternalUtils.vala b/src/InternalUtils.vala index fe761dfbc..5a2e14239 100644 --- a/src/InternalUtils.vala +++ b/src/InternalUtils.vala @@ -340,7 +340,7 @@ namespace Gala { public static void wait_for_window_actor (Meta.Window window, owned WindowActorReadyCallback callback) { unowned var window_actor = (Meta.WindowActor) window.get_compositor_private (); - if (window_actor != null) { + if (window_actor != null && window_actor.visible) { callback (window_actor); return; } @@ -348,8 +348,14 @@ namespace Gala { Idle.add (() => { window_actor = (Meta.WindowActor) window.get_compositor_private (); - if (window_actor != null) { + if (window_actor != null && window_actor.visible) { callback (window_actor); + } else if (window_actor != null) { + ulong show_handler = 0; + show_handler = window_actor.show.connect (() => { + window_actor.disconnect (show_handler); + callback (window_actor); + }); } return Source.REMOVE; diff --git a/src/WindowManager.vala b/src/WindowManager.vala index 8a1b90375..da25e4173 100644 --- a/src/WindowManager.vala +++ b/src/WindowManager.vala @@ -2120,9 +2120,10 @@ namespace Gala { // TODO: currently only notifications are handled here, other windows should be too switch_workspace_window_created_id = window_created.connect ((window) => { if (NotificationStack.is_notification (window)) { - unowned var actor = (Meta.WindowActor) window.get_compositor_private (); - clutter_actor_reparent (actor, notification_group); - notification_stack.show_notification (actor); + InternalUtils.wait_for_window_actor (window, (actor) => { + clutter_actor_reparent (actor, notification_group); + notification_stack.show_notification (actor); + }); } }); From ae33e821c9bff9820d43e98f7312f91eea94dab2 Mon Sep 17 00:00:00 2001 From: Leonhard Date: Sat, 21 Dec 2024 17:54:12 +0100 Subject: [PATCH 6/6] Introduce InternalUtils.wait_for_window_actor_visible (#2188) --- src/InternalUtils.vala | 18 +++++++++++++----- src/WindowManager.vala | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/InternalUtils.vala b/src/InternalUtils.vala index 5a2e14239..c8c044369 100644 --- a/src/InternalUtils.vala +++ b/src/InternalUtils.vala @@ -340,7 +340,7 @@ namespace Gala { public static void wait_for_window_actor (Meta.Window window, owned WindowActorReadyCallback callback) { unowned var window_actor = (Meta.WindowActor) window.get_compositor_private (); - if (window_actor != null && window_actor.visible) { + if (window_actor != null) { callback (window_actor); return; } @@ -348,17 +348,25 @@ namespace Gala { Idle.add (() => { window_actor = (Meta.WindowActor) window.get_compositor_private (); - if (window_actor != null && window_actor.visible) { + if (window_actor != null) { callback (window_actor); - } else if (window_actor != null) { + } + + return Source.REMOVE; + }); + } + + public static void wait_for_window_actor_visible (Meta.Window window, owned WindowActorReadyCallback callback) { + wait_for_window_actor (window, (window_actor) => { + if (window_actor.visible) { + callback (window_actor); + } else { ulong show_handler = 0; show_handler = window_actor.show.connect (() => { window_actor.disconnect (show_handler); callback (window_actor); }); } - - return Source.REMOVE; }); } } diff --git a/src/WindowManager.vala b/src/WindowManager.vala index da25e4173..75b488b78 100644 --- a/src/WindowManager.vala +++ b/src/WindowManager.vala @@ -2120,7 +2120,7 @@ namespace Gala { // TODO: currently only notifications are handled here, other windows should be too switch_workspace_window_created_id = window_created.connect ((window) => { if (NotificationStack.is_notification (window)) { - InternalUtils.wait_for_window_actor (window, (actor) => { + InternalUtils.wait_for_window_actor_visible (window, (actor) => { clutter_actor_reparent (actor, notification_group); notification_stack.show_notification (actor); });