Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: refactor multitasking view #2051

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
7 changes: 3 additions & 4 deletions lib/DragDropAction.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Gala {
* @param y The global y coordinate where the action was activated
* @return A ClutterActor that serves as handle
*/
public signal Actor? drag_begin (float x, float y);
public signal unowned Actor? drag_begin (float x, float y);

/**
* A drag has been canceled. You may want to consider cleaning up
Expand Down Expand Up @@ -86,7 +86,7 @@ namespace Gala {
*/
public string drag_id { get; construct; }

public Actor handle { get; private set; }
public unowned Actor handle { get; private set; }
/**
* Indicates whether a drag action is currently active
*/
Expand All @@ -98,7 +98,7 @@ namespace Gala {
*/
public bool allow_bubbling { get; set; default = true; }

public Actor? hovered { private get; set; default = null; }
public unowned Actor? hovered { private get; set; default = null; }

private bool clicked = false;
private float last_x;
Expand Down Expand Up @@ -146,7 +146,6 @@ namespace Gala {

private void release_actor (Actor actor) {
if (DragDropActionType.SOURCE in drag_type) {

var source_list = sources.@get (drag_id);
source_list.remove (actor);
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/pip/PopupWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
on_allocation_changed ();
}

private Clutter.Actor on_move_begin () {
private unowned Clutter.Actor on_move_begin () {
wm.get_display ().set_cursor (Meta.Cursor.DND_IN_DRAG);

return this;
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/IconGroup.vala
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ namespace Gala {
}
}

private Clutter.Actor? drag_begin (float click_x, float click_y) {
private unowned Clutter.Actor? drag_begin (float click_x, float click_y) {
unowned Meta.WorkspaceManager manager = workspace.get_display ().get_workspace_manager ();
if (icon_container.get_n_children () < 1 &&
Meta.Prefs.get_dynamic_workspaces () &&
Expand Down
35 changes: 1 addition & 34 deletions src/Widgets/MonitorClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ namespace Gala {
public Meta.Display display { get; construct; }
public int monitor { get; construct; }
public GestureTracker gesture_tracker { get; construct; }
public WindowCloneContainer window_container { get; private set; }

private WindowCloneContainer window_container;
private BackgroundManager background;

public MonitorClone (WindowManager wm, Meta.Display display, int monitor, GestureTracker gesture_tracker) {
Expand All @@ -48,20 +48,6 @@ namespace Gala {
window_container = new WindowCloneContainer (wm, gesture_tracker, scale);
window_container.window_selected.connect ((w) => { window_selected (w); });

display.window_entered_monitor.connect (window_entered);
display.window_left_monitor.connect (window_left);

unowned GLib.List<Meta.WindowActor> window_actors = display.get_window_actors ();
foreach (unowned Meta.WindowActor window_actor in window_actors) {
if (window_actor.is_destroyed ())
continue;

unowned Meta.Window window = window_actor.get_meta_window ();
if (window.get_monitor () == monitor) {
window_entered (monitor, window);
}
}

add_child (background);
add_child (window_container);

Expand All @@ -71,11 +57,6 @@ namespace Gala {
update_allocation ();
}

~MonitorClone () {
display.window_entered_monitor.disconnect (window_entered);
display.window_left_monitor.disconnect (window_left);
}

/**
* Make sure the MonitorClone is at the location of the monitor on the stage
*/
Expand Down Expand Up @@ -105,19 +86,5 @@ namespace Gala {
window_container.restack_windows ();
window_container.close (with_gesture, is_cancel_animation);
}

private void window_left (int window_monitor, Meta.Window window) {
if (window_monitor != monitor)
return;

window_container.remove_window (window);
}

private void window_entered (int window_monitor, Meta.Window window) {
if (window_monitor != monitor || window.window_type != Meta.WindowType.NORMAL)
return;

window_container.add_window (window);
}
}
}
Loading