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

DragDropAction: Activate click signal on release #1560

Merged
merged 4 commits into from
Feb 22, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 12 additions & 17 deletions lib/DragDropAction.vala
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,13 @@ namespace Gala {

public override bool handle_event (Event event) {
if (!(DragDropActionType.SOURCE in drag_type)) {
return false;
return Gdk.EVENT_PROPAGATE;
}

switch (event.get_type ()) {
case EventType.BUTTON_PRESS:
if (event.get_button () != 1) {
actor_clicked (event.get_button ());
return false;
}

if (grabbed_actor != null) {
return false;
return Gdk.EVENT_PROPAGATE;
}

grab_actor (actor, event.get_device ());
Expand All @@ -210,7 +205,7 @@ namespace Gala {
last_x = x;
last_y = y;

return true;
return Gdk.EVENT_STOP;

case EventType.BUTTON_RELEASE:
if (!dragging) {
Expand All @@ -226,15 +221,15 @@ namespace Gala {
ungrab_actor ();
clicked = false;
dragging = false;
return true;
return Gdk.EVENT_STOP;
} else if (dragging) {
if (hovered != null) {
finish ();
} else {
cancel ();
}

return true;
return Gdk.EVENT_STOP;
}
break;

Expand Down Expand Up @@ -278,7 +273,7 @@ namespace Gala {
if (grabbed_device != null &&
device != grabbed_device &&
device.get_device_type () != InputDeviceType.KEYBOARD_DEVICE) {
return false;
return Gdk.EVENT_PROPAGATE;
}

switch (event.get_type ()) {
Expand All @@ -298,7 +293,7 @@ namespace Gala {
if (handle == null) {
ungrab_actor ();
critical ("No handle has been returned by the started signal, aborting drag.");
return false;
return Gdk.EVENT_PROPAGATE;
}

clicked = false;
Expand All @@ -322,7 +317,7 @@ namespace Gala {
}
}
}
return true;
return Gdk.EVENT_STOP;
} else if (dragging) {
handle.x -= last_x - x;
handle.y -= last_y - y;
Expand All @@ -342,7 +337,7 @@ namespace Gala {

// didn't change, no need to do anything
if (actor == hovered)
return true;
return Gdk.EVENT_STOP;

if (action == null) {
// apparently we left ours if we had one before
Expand All @@ -351,7 +346,7 @@ namespace Gala {
hovered = null;
}

return true;
return Gdk.EVENT_STOP;
}

// signal the previous one that we left it
Expand All @@ -363,15 +358,15 @@ namespace Gala {
hovered = actor;
emit_crossed (hovered, true);

return true;
return Gdk.EVENT_STOP;
}

break;
default:
break;
}

return false;
return Gdk.EVENT_PROPAGATE;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Widgets/WorkspaceClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ namespace Gala {

background = new FramedBackground (display);
background.reactive = true;
background.button_press_event.connect (() => {
background.button_release_event.connect (() => {
selected (true);
return false;
return Gdk.EVENT_PROPAGATE;
});

window_container = new WindowCloneContainer (wm, gesture_tracker);
Expand Down