From 4c78a15883a01556e85906c4616223df290d5e12 Mon Sep 17 00:00:00 2001 From: Leo Date: Tue, 28 Mar 2023 07:13:30 +0900 Subject: [PATCH] Daemon: Workaround broken window menu for some apps (#1574) Co-authored-by: Ryan Kornheisl --- daemon/MenuDaemon.vala | 25 ++++++++++++++++--------- data/gala.appdata.xml.in | 2 ++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/daemon/MenuDaemon.vala b/daemon/MenuDaemon.vala index 92beb3c1..5029aab4 100644 --- a/daemon/MenuDaemon.vala +++ b/daemon/MenuDaemon.vala @@ -276,14 +276,21 @@ namespace Gala { close_accellabel.accel_string = keybind_settings.get_strv ("close")[0]; } - window_menu.popup (null, null, (m, ref px, ref py, out push_in) => { - var scale = m.scale_factor; - px = x / scale; - // Move the menu 1 pixel outside of the pointer or else it closes instantly - // on the mouse up event - py = (y / scale) + 1; - push_in = true; - }, 3, Gdk.CURRENT_TIME); + // `opened` is used as workaround for https://github.com/elementary/gala/issues/1387 + var opened = false; + Idle.add (() => { + window_menu.popup (null, null, (m, ref px, ref py, out push_in) => { + var scale = m.scale_factor; + px = x / scale; + // Move the menu 1 pixel outside of the pointer or else it closes instantly + // on the mouse up event + py = (y / scale) + 1; + push_in = true; + opened = true; + }, Gdk.BUTTON_SECONDARY, Gdk.CURRENT_TIME); + + return opened ? Source.REMOVE : Source.CONTINUE; + }); } public void show_desktop_menu (int x, int y) throws DBusError, IOError { @@ -354,7 +361,7 @@ namespace Gala { // on the mouse up event py = (y / scale) + 1; push_in = false; - }, 3, Gdk.CURRENT_TIME); + }, Gdk.BUTTON_SECONDARY, Gdk.CURRENT_TIME); } } } diff --git a/data/gala.appdata.xml.in b/data/gala.appdata.xml.in index 2ef9906d..31cc2d1e 100644 --- a/data/gala.appdata.xml.in +++ b/data/gala.appdata.xml.in @@ -22,6 +22,8 @@ Holding on keyboard shortcut to activate the action only once Notification bubble appears in wrong corner on one workspace + Parity between right-clicking titlebars/headerbars on mouse and touchpad + Window menu sluggish/inoperative for apps with flathub origin Closing a window in multitasking view closes multitasking view When 2 windows are tiled and then resized, the inactive one gets glitched, leaving its full-sized picture as an artifact when minimized