Skip to content

Commit

Permalink
Merge branch 'master' into tintou/mutter-44
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmhewitt committed Mar 28, 2023
2 parents b62fce6 + f751595 commit cf40f95
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 171 deletions.
25 changes: 16 additions & 9 deletions daemon/MenuDaemon.vala
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
}
}
2 changes: 2 additions & 0 deletions data/gala.appdata.xml.in
Expand Up @@ -22,6 +22,8 @@
<issues>
<issue url="https://github.com/elementary/gala/issues/913">Holding on keyboard shortcut to activate the action only once</issue>
<issue url="https://github.com/elementary/gala/issues/1229">Notification bubble appears in wrong corner on one workspace</issue>
<issue url="https://github.com/elementary/gala/issues/1347">Parity between right-clicking titlebars/headerbars on mouse and touchpad</issue>
<issue url="https://github.com/elementary/gala/issues/1387">Window menu sluggish/inoperative for apps with flathub origin</issue>
<issue url="https://github.com/elementary/gala/issues/1578">Closing a window in multitasking view closes multitasking view</issue>
<issue url="https://github.com/elementary/gala/issues/1584">When 2 windows are tiled and then resized, the inactive one gets glitched, leaving its full-sized picture as an artifact when minimized</issue>
</issues>
Expand Down
28 changes: 27 additions & 1 deletion src/InternalUtils.vala
Expand Up @@ -314,8 +314,34 @@ namespace Gala {
return result;
}

/*
* Sorts the windows by stacking order so that the window on active workspaces come first.
*/
public static SList<weak Meta.Window> sort_windows (Meta.Display display, List<Meta.Window> windows) {
var windows_on_active_workspace = new SList<Meta.Window> ();
var windows_on_other_workspaces = new SList<Meta.Window> ();
unowned var active_workspace = display.get_workspace_manager ().get_active_workspace ();
foreach (unowned var window in windows) {
if (window.get_workspace () == active_workspace) {
windows_on_active_workspace.append (window);
} else {
windows_on_other_workspaces.append (window);
}
}

var sorted_windows = new SList<weak Meta.Window> ();
var windows_on_active_workspace_sorted = display.sort_windows_by_stacking (windows_on_active_workspace);
windows_on_active_workspace_sorted.reverse ();
var windows_on_other_workspaces_sorted = display.sort_windows_by_stacking (windows_on_other_workspaces);
windows_on_other_workspaces_sorted.reverse ();
sorted_windows.concat ((owned) windows_on_active_workspace_sorted);
sorted_windows.concat ((owned) windows_on_other_workspaces_sorted);

return sorted_windows;
}

public static inline bool get_window_is_normal (Meta.Window window) {
switch (window.get_window_type ()) {
switch (window.window_type) {
case Meta.WindowType.NORMAL:
case Meta.WindowType.DIALOG:
case Meta.WindowType.MODAL_DIALOG:
Expand Down

0 comments on commit cf40f95

Please sign in to comment.