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

Use different cursors for dnd #1782

Merged
merged 3 commits into from
Oct 26, 2023
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
7 changes: 7 additions & 0 deletions plugins/pip/PopupWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,15 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
}

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

return this;
}

private void on_move_end () {
reactive = true;
update_screen_position ();
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
}

#if HAS_MUTTER45
Expand All @@ -245,6 +248,8 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
grab = resize_button.get_stage ().grab (resize_button);
resize_button.event.connect (on_resize_event);

wm.get_display ().set_cursor (Meta.Cursor.SE_RESIZE);

return Clutter.EVENT_PROPAGATE;
}

Expand Down Expand Up @@ -303,6 +308,8 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
resizing = false;

update_screen_position ();

wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
}

private void on_allocation_changed () {
Expand Down
6 changes: 6 additions & 0 deletions src/Widgets/IconGroup.vala
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ namespace Gala {
// disable reactivity so that workspace thumbs can get events
reactive = false;

wm.get_display ().set_cursor (Meta.Cursor.DND_IN_DRAG);

return this;
}

Expand All @@ -534,11 +536,15 @@ namespace Gala {
} else {
drag_canceled ();
}

wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
}

private void drag_canceled () {
get_parent ().remove_child (this);
restore_group ();

wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
}

private void restore_group () {
Expand Down
8 changes: 8 additions & 0 deletions src/Widgets/WindowClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ public class Gala.WindowClone : Clutter.Actor {
close_button.opacity = 0;
window_title.opacity = 0;

wm.get_display ().set_cursor (Meta.Cursor.DND_IN_DRAG);

return this;
}

Expand Down Expand Up @@ -726,6 +728,8 @@ public class Gala.WindowClone : Clutter.Actor {
icon_group.remove_window (window, false);
}
}

wm.get_display ().set_cursor (hovered ? Meta.Cursor.DND_MOVE: Meta.Cursor.DND_IN_DRAG);
}

/**
Expand Down Expand Up @@ -799,6 +803,8 @@ public class Gala.WindowClone : Clutter.Actor {
// if we're dropped at the place where we came from interpret as cancel
drag_canceled ();
}

wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
}

/**
Expand Down Expand Up @@ -826,6 +832,8 @@ public class Gala.WindowClone : Clutter.Actor {

set_window_icon_position (slot.width, slot.height, monitor_scale_factor);
window_icon.restore_easing_state ();

wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
}

private void set_window_icon_position (float window_width, float window_height, float scale_factor, bool aligned = true) {
Expand Down