Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions data/gala.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@
</description>
<issues>
<issue url="https://github.com/elementary/gala/issues/397">Prevent PIP overlapping wingpanel?</issue>
<issue url="https://github.com/elementary/gala/issues/551">Return to original workspace if a fullscreen window is closed and there is no more windows open</issue>
<issue url="https://github.com/elementary/gala/issues/857">Toggling the active window's maximization state during multitasking view messes up the window preview size</issue>
<issue url="https://github.com/elementary/gala/issues/1967">Some apps ignore HiDPI mode</issue>
<issue url="https://github.com/elementary/gala/issues/1986">Does not return to the first virtual desktop after exiting fullscreen mode.</issue>
<issue url="https://github.com/elementary/gala/issues/2088">Invisible window clones</issue>
<issue url="https://github.com/elementary/gala/issues/2113">gnome-session-x11-services-ready.target isn't started on Wayland session</issue>
<issue url="https://github.com/elementary/gala/issues/2131">Unthemed cursor style and glitchy menus on some applications</issue>
Expand Down
63 changes: 12 additions & 51 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -1168,50 +1168,6 @@ namespace Gala {
* effects
*/

private void handle_fullscreen_window (Meta.Window window, Meta.SizeChange which_change) {
// Only handle windows which are located on the primary monitor
if (!window.is_on_primary_monitor () || !behavior_settings.get_boolean ("move-fullscreened-workspace"))
return;

// Due to how this is implemented, by relying on the functionality
// offered by the dynamic workspace handler, let's just bail out
// if that's not available.
if (!Meta.Prefs.get_dynamic_workspaces ())
return;

unowned Meta.Display display = get_display ();
var time = display.get_current_time ();
unowned Meta.Workspace win_ws = window.get_workspace ();
unowned Meta.WorkspaceManager manager = display.get_workspace_manager ();

if (which_change == Meta.SizeChange.FULLSCREEN) {
// Do nothing if the current workspace would be empty
if (Utils.get_n_windows (win_ws) <= 1)
return;

var old_ws_index = win_ws.index ();
var new_ws_index = old_ws_index + 1;
InternalUtils.insert_workspace_with_window (new_ws_index, window);

unowned var new_ws = manager.get_workspace_by_index (new_ws_index);
window.change_workspace (new_ws);
new_ws.activate_with_focus (window, time);

ws_assoc.insert (window, old_ws_index);
} else if (ws_assoc.contains (window)) {
var old_ws_index = ws_assoc.get (window);
var new_ws_index = win_ws.index ();

if (new_ws_index != old_ws_index && old_ws_index < manager.get_n_workspaces ()) {
unowned var old_ws = manager.get_workspace_by_index (old_ws_index);
window.change_workspace (old_ws);
old_ws.activate_with_focus (window, time);
}

ws_assoc.remove (window);
}
}

// must wait for size_changed to get updated frame_rect
// as which_change is not passed to size_changed, save it as instance variable
#if HAS_MUTTER45
Expand Down Expand Up @@ -1257,8 +1213,10 @@ namespace Gala {
unmaximize (actor, new_rect.x, new_rect.y, new_rect.width, new_rect.height);
break;
case Meta.SizeChange.FULLSCREEN:
maximize (actor, new_rect.x, new_rect.y, new_rect.width, new_rect.height);
break;
case Meta.SizeChange.UNFULLSCREEN:
handle_fullscreen_window (window, which_change_local);
unmaximize (actor, new_rect.x, new_rect.y, new_rect.width, new_rect.height);
break;
default:
break;
Expand Down Expand Up @@ -1347,7 +1305,8 @@ namespace Gala {
kill_window_effects (actor);

unowned var window = actor.get_meta_window ();
if (window.maximized_horizontally && behavior_settings.get_boolean ("move-maximized-workspace")) {
if (window.maximized_horizontally && behavior_settings.get_boolean ("move-maximized-workspace")
|| window.fullscreen && behavior_settings.get_boolean ("move-fullscreened-workspace")) {
move_window_to_next_ws (window);
}

Expand Down Expand Up @@ -1605,8 +1564,6 @@ namespace Gala {
public override void destroy (Meta.WindowActor actor) {
unowned var window = actor.get_meta_window ();

ws_assoc.remove (window);

actor.remove_all_transitions ();

if (NotificationStack.is_notification (window)) {
Expand Down Expand Up @@ -1728,9 +1685,7 @@ namespace Gala {
kill_window_effects (actor);
unowned var window = actor.get_meta_window ();

if (behavior_settings.get_boolean ("move-maximized-workspace")) {
move_window_to_old_ws (window);
}
move_window_to_old_ws (window);

if (window.window_type == Meta.WindowType.NORMAL) {
float offset_x, offset_y;
Expand Down Expand Up @@ -1820,6 +1775,10 @@ namespace Gala {
window.change_workspace (new_ws);
new_ws.activate_with_focus (window, time);

if (!(window in ws_assoc)) {
window.unmanaged.connect (move_window_to_old_ws);
}

ws_assoc[window] = old_ws_index;
}

Expand Down Expand Up @@ -1848,6 +1807,8 @@ namespace Gala {
}

ws_assoc.remove (window);

window.unmanaged.disconnect (move_window_to_old_ws);
}

// Cancel attached animation of an actor and reset it
Expand Down
Loading