Skip to content

Commit b7e9520

Browse files
authored
Merge branch 'main' into leolost/window-positioner
2 parents 72d7c75 + 1e15604 commit b7e9520

File tree

1 file changed

+39
-37
lines changed

1 file changed

+39
-37
lines changed

lib/DragDropAction.vala

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -216,40 +216,6 @@ namespace Gala {
216216

217217
return Clutter.EVENT_STOP;
218218

219-
case EventType.BUTTON_RELEASE:
220-
case EventType.TOUCH_END:
221-
if (!is_valid_touch_event (event)) {
222-
return Clutter.EVENT_PROPAGATE;
223-
}
224-
225-
if (!dragging) {
226-
float x, y, ex, ey;
227-
event.get_coords (out ex, out ey);
228-
actor.get_transformed_position (out x, out y);
229-
230-
// release has happened within bounds of actor
231-
if (clicked && x < ex && x + actor.width > ex && y < ey && y + actor.height > ey) {
232-
actor_clicked (event.get_type () == BUTTON_RELEASE ? event.get_button () : Clutter.Button.PRIMARY);
233-
}
234-
235-
if (clicked) {
236-
ungrab_actor ();
237-
clicked = false;
238-
}
239-
240-
return Clutter.EVENT_STOP;
241-
} else if (dragging) {
242-
if (hovered != null) {
243-
finish ();
244-
hovered = null;
245-
} else {
246-
cancel ();
247-
}
248-
249-
return Clutter.EVENT_STOP;
250-
}
251-
break;
252-
253219
default:
254220
break;
255221
}
@@ -298,7 +264,42 @@ namespace Gala {
298264
if (event.get_key_symbol () == Key.Escape) {
299265
cancel ();
300266
}
301-
break;
267+
268+
return Clutter.EVENT_STOP;
269+
270+
case EventType.BUTTON_RELEASE:
271+
case EventType.TOUCH_END:
272+
if (!is_valid_touch_event (event)) {
273+
return Clutter.EVENT_PROPAGATE;
274+
}
275+
276+
if (dragging) {
277+
if (hovered != null) {
278+
finish ();
279+
hovered = null;
280+
} else {
281+
cancel ();
282+
}
283+
284+
return Clutter.EVENT_STOP;
285+
}
286+
287+
float x, y, ex, ey;
288+
event.get_coords (out ex, out ey);
289+
actor.get_transformed_position (out x, out y);
290+
291+
// release has happened within bounds of actor
292+
if (clicked && x < ex && x + actor.width > ex && y < ey && y + actor.height > ey) {
293+
actor_clicked (event.get_type () == BUTTON_RELEASE ? event.get_button () : Clutter.Button.PRIMARY);
294+
}
295+
296+
if (clicked) {
297+
ungrab_actor ();
298+
clicked = false;
299+
}
300+
301+
return Clutter.EVENT_STOP;
302+
302303
case EventType.MOTION:
303304
case EventType.TOUCH_UPDATE:
304305
if (!is_valid_touch_event (event)) {
@@ -338,6 +339,7 @@ namespace Gala {
338339
}
339340
}
340341
return Clutter.EVENT_STOP;
342+
341343
} else if (dragging) {
342344
handle.x -= last_x - x;
343345
handle.y -= last_y - y;
@@ -468,11 +470,11 @@ namespace Gala {
468470
var type = event.get_type ();
469471

470472
return (
473+
Meta.Util.is_wayland_compositor () ||
471474
type != Clutter.EventType.TOUCH_BEGIN &&
472475
type != Clutter.EventType.TOUCH_CANCEL &&
473476
type != Clutter.EventType.TOUCH_END &&
474-
type != Clutter.EventType.TOUCH_UPDATE ||
475-
Meta.Util.is_wayland_compositor ()
477+
type != Clutter.EventType.TOUCH_UPDATE
476478
);
477479
}
478480
}

0 commit comments

Comments
 (0)