2014-04-08 16:51:06 +04:00
|
|
|
//
|
2013-06-26 16:07:05 +04:00
|
|
|
// Copyright (C) 2013 Tom Beckmann
|
2014-04-08 16:51:06 +04:00
|
|
|
//
|
2013-06-26 16:07:05 +04:00
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
2014-04-08 16:51:06 +04:00
|
|
|
//
|
2013-06-26 16:07:05 +04:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
2014-04-08 16:51:06 +04:00
|
|
|
//
|
2013-06-26 16:07:05 +04:00
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2014-04-08 16:51:06 +04:00
|
|
|
//
|
2013-06-26 16:07:05 +04:00
|
|
|
|
2014-06-21 18:04:24 +04:00
|
|
|
using Clutter;
|
|
|
|
|
2020-01-09 23:29:01 +03:00
|
|
|
namespace Gala {
|
2020-01-09 22:26:30 +03:00
|
|
|
[Flags]
|
2020-01-09 23:29:01 +03:00
|
|
|
public enum DragDropActionType {
|
2020-01-09 22:26:30 +03:00
|
|
|
SOURCE,
|
|
|
|
DESTINATION
|
|
|
|
}
|
|
|
|
|
2020-01-09 23:29:01 +03:00
|
|
|
public class DragDropAction : Clutter.Action {
|
2024-06-22 19:40:11 +03:00
|
|
|
// DO NOT keep a reference otherwise we get a ref cycle
|
|
|
|
private static Gee.HashMap<string,Gee.LinkedList<unowned Actor>>? sources = null;
|
|
|
|
private static Gee.HashMap<string,Gee.LinkedList<unowned Actor>>? destinations = null;
|
2020-01-09 22:26:30 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A drag has been started. You have to connect to this signal and
|
|
|
|
* return an actor that is transformed during the drag operation.
|
|
|
|
*
|
|
|
|
* @param x The global x coordinate where the action was activated
|
|
|
|
* @param y The global y coordinate where the action was activated
|
|
|
|
* @return A ClutterActor that serves as handle
|
|
|
|
*/
|
2021-08-17 23:33:34 +03:00
|
|
|
public signal Actor? drag_begin (float x, float y);
|
2020-01-09 22:26:30 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A drag has been canceled. You may want to consider cleaning up
|
|
|
|
* your handle.
|
|
|
|
*/
|
|
|
|
public signal void drag_canceled ();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A drag action has successfully been finished.
|
|
|
|
*
|
|
|
|
* @param actor The actor on which the drag finished
|
|
|
|
*/
|
|
|
|
public signal void drag_end (Actor actor);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The destination has been crossed
|
|
|
|
*
|
|
|
|
* @param target the target actor that is crossing the destination
|
|
|
|
* @param hovered indicates whether the actor is now hovered or not
|
|
|
|
*/
|
|
|
|
public signal void crossed (Actor? target, bool hovered);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Emitted on the source when a destination is crossed.
|
|
|
|
*
|
|
|
|
* @param destination The destination actor that has been crossed
|
|
|
|
* @param hovered Whether the actor is now hovered or has just been left
|
|
|
|
*/
|
|
|
|
public signal void destination_crossed (Actor destination, bool hovered);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The source has been clicked, but the movement was not larger than
|
|
|
|
* the drag threshold. Useful if the source is also activable.
|
|
|
|
*
|
|
|
|
* @param button The button which was pressed
|
|
|
|
*/
|
|
|
|
public signal void actor_clicked (uint32 button);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the action
|
|
|
|
*/
|
|
|
|
public DragDropActionType drag_type { get; construct; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The unique id given to this drag-drop-group
|
2020-01-09 23:45:00 +03:00
|
|
|
*/
|
2020-01-09 22:26:30 +03:00
|
|
|
public string drag_id { get; construct; }
|
|
|
|
|
2024-07-10 12:55:02 +03:00
|
|
|
public Actor? handle { get; private set; }
|
2020-01-09 22:26:30 +03:00
|
|
|
/**
|
|
|
|
* Indicates whether a drag action is currently active
|
|
|
|
*/
|
|
|
|
public bool dragging { get; private set; default = false; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allow checking the parents of reactive children if they are valid destinations
|
|
|
|
* if the child is none
|
|
|
|
*/
|
|
|
|
public bool allow_bubbling { get; set; default = true; }
|
|
|
|
|
|
|
|
public Actor? hovered { private get; set; default = null; }
|
2020-01-09 23:29:01 +03:00
|
|
|
|
2023-02-18 20:32:32 +03:00
|
|
|
private bool clicked = false;
|
|
|
|
private float last_x;
|
|
|
|
private float last_y;
|
2020-01-09 22:26:30 +03:00
|
|
|
|
2023-02-18 20:32:32 +03:00
|
|
|
private Grab? grab = null;
|
|
|
|
private static unowned Actor? grabbed_actor = null;
|
|
|
|
private InputDevice? grabbed_device = null;
|
|
|
|
private ulong on_event_id = 0;
|
2022-10-06 23:32:04 +03:00
|
|
|
|
2024-07-07 08:41:34 +03:00
|
|
|
static construct {
|
|
|
|
sources = new Gee.HashMap<string,Gee.LinkedList<unowned Actor>> ();
|
|
|
|
destinations = new Gee.HashMap<string,Gee.LinkedList<unowned Actor>> ();
|
|
|
|
}
|
|
|
|
|
2020-01-09 22:26:30 +03:00
|
|
|
/**
|
|
|
|
* Create a new DragDropAction
|
|
|
|
*
|
|
|
|
* @param type The type of this actor
|
|
|
|
* @param id An ID that marks which sources can be dragged on
|
|
|
|
* which destinations. It has to be the same for all actors that
|
|
|
|
* should be compatible with each other.
|
|
|
|
*/
|
2020-01-09 23:29:01 +03:00
|
|
|
public DragDropAction (DragDropActionType type, string id) {
|
2020-01-09 22:26:30 +03:00
|
|
|
Object (drag_type : type, drag_id : id);
|
|
|
|
}
|
|
|
|
|
2020-01-09 23:29:01 +03:00
|
|
|
~DragDropAction () {
|
2024-07-07 08:41:34 +03:00
|
|
|
if (actor != null) {
|
2020-01-09 22:26:30 +03:00
|
|
|
release_actor (actor);
|
2024-07-07 08:41:34 +03:00
|
|
|
}
|
2020-01-09 22:26:30 +03:00
|
|
|
}
|
|
|
|
|
2020-01-09 23:29:01 +03:00
|
|
|
public override void set_actor (Actor? new_actor) {
|
2020-01-09 22:26:30 +03:00
|
|
|
if (actor != null) {
|
|
|
|
release_actor (actor);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (new_actor != null) {
|
|
|
|
connect_actor (new_actor);
|
|
|
|
}
|
|
|
|
|
|
|
|
base.set_actor (new_actor);
|
|
|
|
}
|
|
|
|
|
2023-02-18 20:32:32 +03:00
|
|
|
private void release_actor (Actor actor) {
|
2020-01-09 22:26:30 +03:00
|
|
|
if (DragDropActionType.SOURCE in drag_type) {
|
|
|
|
|
|
|
|
var source_list = sources.@get (drag_id);
|
|
|
|
source_list.remove (actor);
|
2020-01-09 23:45:00 +03:00
|
|
|
}
|
2020-01-09 23:29:01 +03:00
|
|
|
|
2020-01-09 22:26:30 +03:00
|
|
|
if (DragDropActionType.DESTINATION in drag_type) {
|
|
|
|
var dest_list = destinations[drag_id];
|
|
|
|
dest_list.remove (actor);
|
|
|
|
}
|
2024-06-22 19:40:11 +03:00
|
|
|
|
|
|
|
actor.destroy.disconnect (release_actor);
|
2020-01-09 22:26:30 +03:00
|
|
|
}
|
|
|
|
|
2023-02-18 20:32:32 +03:00
|
|
|
private void connect_actor (Actor actor) {
|
2020-01-09 22:26:30 +03:00
|
|
|
if (DragDropActionType.SOURCE in drag_type) {
|
|
|
|
|
|
|
|
var source_list = sources.@get (drag_id);
|
|
|
|
if (source_list == null) {
|
2024-06-22 19:40:11 +03:00
|
|
|
source_list = new Gee.LinkedList<unowned Actor> ();
|
2020-01-09 22:26:30 +03:00
|
|
|
sources.@set (drag_id, source_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
source_list.add (actor);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (DragDropActionType.DESTINATION in drag_type) {
|
|
|
|
var dest_list = destinations[drag_id];
|
|
|
|
if (dest_list == null) {
|
2024-06-22 19:40:11 +03:00
|
|
|
dest_list = new Gee.LinkedList<unowned Actor> ();
|
2020-01-09 22:26:30 +03:00
|
|
|
destinations[drag_id] = dest_list;
|
|
|
|
}
|
|
|
|
|
|
|
|
dest_list.add (actor);
|
|
|
|
}
|
2024-06-22 19:40:11 +03:00
|
|
|
|
|
|
|
actor.destroy.connect (release_actor);
|
2020-01-09 22:26:30 +03:00
|
|
|
}
|
|
|
|
|
2023-02-18 20:32:32 +03:00
|
|
|
private void emit_crossed (Actor destination, bool is_hovered) {
|
2020-01-09 22:26:30 +03:00
|
|
|
get_drag_drop_action (destination).crossed (actor, is_hovered);
|
|
|
|
destination_crossed (destination, is_hovered);
|
|
|
|
}
|
|
|
|
|
2022-10-06 23:32:04 +03:00
|
|
|
public override bool handle_event (Event event) {
|
2022-10-13 21:47:47 +03:00
|
|
|
if (!(DragDropActionType.SOURCE in drag_type)) {
|
2023-04-14 11:24:18 +03:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2022-10-13 21:47:47 +03:00
|
|
|
}
|
|
|
|
|
2022-10-06 23:32:04 +03:00
|
|
|
switch (event.get_type ()) {
|
|
|
|
case EventType.BUTTON_PRESS:
|
2024-07-07 08:41:34 +03:00
|
|
|
case EventType.TOUCH_BEGIN:
|
|
|
|
if (!is_valid_touch_event (event)) {
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
}
|
|
|
|
|
2022-10-06 23:32:04 +03:00
|
|
|
if (grabbed_actor != null) {
|
2023-04-14 11:24:18 +03:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2022-10-06 23:32:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
grab_actor (actor, event.get_device ());
|
|
|
|
clicked = true;
|
|
|
|
|
|
|
|
float x, y;
|
|
|
|
event.get_coords (out x, out y);
|
|
|
|
|
|
|
|
last_x = x;
|
|
|
|
last_y = y;
|
|
|
|
|
2023-04-14 11:24:18 +03:00
|
|
|
return Clutter.EVENT_STOP;
|
2022-10-06 23:32:04 +03:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return base.handle_event (event);
|
|
|
|
}
|
|
|
|
|
2023-02-18 20:32:32 +03:00
|
|
|
private void grab_actor (Actor actor, InputDevice device) {
|
2022-10-06 23:32:04 +03:00
|
|
|
if (grabbed_actor != null) {
|
|
|
|
critical ("Tried to grab an actor with a grab already in progress");
|
|
|
|
}
|
|
|
|
|
|
|
|
grab = actor.get_stage ().grab (actor);
|
|
|
|
grabbed_actor = actor;
|
|
|
|
grabbed_device = device;
|
|
|
|
on_event_id = actor.event.connect (on_event);
|
|
|
|
}
|
|
|
|
|
2023-02-18 20:32:32 +03:00
|
|
|
private void ungrab_actor () {
|
2022-10-06 23:32:04 +03:00
|
|
|
if (on_event_id == 0 || grabbed_actor == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (grab != null) {
|
|
|
|
grab.dismiss ();
|
|
|
|
grab = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
grabbed_device = null;
|
|
|
|
grabbed_actor.disconnect (on_event_id);
|
|
|
|
on_event_id = 0;
|
|
|
|
grabbed_actor = null;
|
|
|
|
}
|
|
|
|
|
2023-02-18 20:32:32 +03:00
|
|
|
private bool on_event (Clutter.Event event) {
|
2022-10-06 23:32:04 +03:00
|
|
|
var device = event.get_device ();
|
|
|
|
|
|
|
|
if (grabbed_device != null &&
|
|
|
|
device != grabbed_device &&
|
|
|
|
device.get_device_type () != InputDeviceType.KEYBOARD_DEVICE) {
|
2023-04-14 11:24:18 +03:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2022-10-06 23:32:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (event.get_type ()) {
|
|
|
|
case EventType.KEY_PRESS:
|
|
|
|
if (event.get_key_symbol () == Key.Escape) {
|
|
|
|
cancel ();
|
|
|
|
}
|
2024-11-02 15:18:01 +03:00
|
|
|
|
|
|
|
return Clutter.EVENT_STOP;
|
|
|
|
|
|
|
|
case EventType.BUTTON_RELEASE:
|
|
|
|
case EventType.TOUCH_END:
|
|
|
|
if (!is_valid_touch_event (event)) {
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dragging) {
|
|
|
|
if (hovered != null) {
|
|
|
|
finish ();
|
|
|
|
hovered = null;
|
|
|
|
} else {
|
|
|
|
cancel ();
|
|
|
|
}
|
|
|
|
|
|
|
|
return Clutter.EVENT_STOP;
|
|
|
|
}
|
|
|
|
|
|
|
|
float x, y, ex, ey;
|
|
|
|
event.get_coords (out ex, out ey);
|
|
|
|
actor.get_transformed_position (out x, out y);
|
|
|
|
|
|
|
|
// release has happened within bounds of actor
|
|
|
|
if (clicked && x < ex && x + actor.width > ex && y < ey && y + actor.height > ey) {
|
|
|
|
actor_clicked (event.get_type () == BUTTON_RELEASE ? event.get_button () : Clutter.Button.PRIMARY);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (clicked) {
|
|
|
|
ungrab_actor ();
|
|
|
|
clicked = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Clutter.EVENT_STOP;
|
|
|
|
|
2022-10-06 23:32:04 +03:00
|
|
|
case EventType.MOTION:
|
2024-07-07 08:41:34 +03:00
|
|
|
case EventType.TOUCH_UPDATE:
|
|
|
|
if (!is_valid_touch_event (event)) {
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
}
|
|
|
|
|
2022-10-06 23:32:04 +03:00
|
|
|
float x, y;
|
|
|
|
event.get_coords (out x, out y);
|
|
|
|
|
|
|
|
if (!dragging && clicked) {
|
|
|
|
var drag_threshold = Clutter.Settings.get_default ().dnd_drag_threshold;
|
|
|
|
if (Math.fabsf (last_x - x) > drag_threshold || Math.fabsf (last_y - y) > drag_threshold) {
|
2023-10-30 12:01:15 +03:00
|
|
|
handle = drag_begin (last_x, last_y);
|
2022-10-06 23:32:04 +03:00
|
|
|
if (handle == null) {
|
|
|
|
ungrab_actor ();
|
|
|
|
critical ("No handle has been returned by the started signal, aborting drag.");
|
2023-04-14 11:24:18 +03:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2022-10-06 23:32:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
clicked = false;
|
|
|
|
dragging = true;
|
|
|
|
|
|
|
|
ungrab_actor ();
|
|
|
|
grab_actor (handle, event.get_device ());
|
|
|
|
|
|
|
|
var source_list = sources.@get (drag_id);
|
|
|
|
if (source_list != null) {
|
|
|
|
var dest_list = destinations[drag_id];
|
|
|
|
foreach (var actor in source_list) {
|
|
|
|
// Do not unset reactivity on destinations
|
|
|
|
if (dest_list == null || actor in dest_list) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
actor.reactive = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-04-14 11:24:18 +03:00
|
|
|
return Clutter.EVENT_STOP;
|
2024-11-02 15:18:01 +03:00
|
|
|
|
2022-10-06 23:32:04 +03:00
|
|
|
} else if (dragging) {
|
|
|
|
handle.x -= last_x - x;
|
|
|
|
handle.y -= last_y - y;
|
|
|
|
last_x = x;
|
|
|
|
last_y = y;
|
|
|
|
|
|
|
|
var stage = actor.get_stage ();
|
|
|
|
var actor = stage.get_actor_at_pos (PickMode.REACTIVE, (int) x, (int) y);
|
|
|
|
DragDropAction action = null;
|
|
|
|
// if we're allowed to bubble and this actor is not a destination, check its parents
|
|
|
|
if (actor != null && (action = get_drag_drop_action (actor)) == null && allow_bubbling) {
|
|
|
|
while ((actor = actor.get_parent ()) != stage) {
|
|
|
|
if ((action = get_drag_drop_action (actor)) != null)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// didn't change, no need to do anything
|
|
|
|
if (actor == hovered)
|
2023-04-14 11:24:18 +03:00
|
|
|
return Clutter.EVENT_STOP;
|
2022-10-06 23:32:04 +03:00
|
|
|
|
|
|
|
if (action == null) {
|
|
|
|
// apparently we left ours if we had one before
|
|
|
|
if (hovered != null) {
|
|
|
|
emit_crossed (hovered, false);
|
|
|
|
hovered = null;
|
|
|
|
}
|
|
|
|
|
2023-04-14 11:24:18 +03:00
|
|
|
return Clutter.EVENT_STOP;
|
2022-10-06 23:32:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// signal the previous one that we left it
|
|
|
|
if (hovered != null) {
|
|
|
|
emit_crossed (hovered, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// tell the new one that it is hovered
|
|
|
|
hovered = actor;
|
|
|
|
emit_crossed (hovered, true);
|
|
|
|
|
2023-04-14 11:24:18 +03:00
|
|
|
return Clutter.EVENT_STOP;
|
2022-10-06 23:32:04 +03:00
|
|
|
}
|
|
|
|
|
2023-02-21 22:05:43 +03:00
|
|
|
break;
|
|
|
|
default:
|
2022-10-06 23:32:04 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2023-04-14 11:24:18 +03:00
|
|
|
return Clutter.EVENT_PROPAGATE;
|
2022-10-06 23:32:04 +03:00
|
|
|
}
|
2020-01-09 22:26:30 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Looks for a DragDropAction instance if this actor has one or NULL.
|
|
|
|
* It also checks if it is a DESTINATION and if the id matches
|
|
|
|
*
|
|
|
|
* @return the DragDropAction instance on this actor or NULL
|
|
|
|
*/
|
2023-02-18 20:32:32 +03:00
|
|
|
private DragDropAction? get_drag_drop_action (Actor actor) {
|
2020-01-09 22:26:30 +03:00
|
|
|
DragDropAction? drop_action = null;
|
|
|
|
|
|
|
|
foreach (var action in actor.get_actions ()) {
|
|
|
|
drop_action = action as DragDropAction;
|
|
|
|
if (drop_action == null
|
|
|
|
|| !(DragDropActionType.DESTINATION in drop_action.drag_type)
|
|
|
|
|| drop_action.drag_id != drag_id)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
return drop_action;
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Abort the drag
|
|
|
|
*/
|
2020-01-09 23:29:01 +03:00
|
|
|
public void cancel () {
|
2020-01-09 22:26:30 +03:00
|
|
|
cleanup ();
|
|
|
|
|
|
|
|
drag_canceled ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allows you to abort all drags currently running for a given drag-id
|
|
|
|
*/
|
2020-01-09 23:29:01 +03:00
|
|
|
public static void cancel_all_by_id (string id) {
|
2020-01-09 22:26:30 +03:00
|
|
|
var actors = sources.@get (id);
|
|
|
|
if (actors == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
foreach (var actor in actors) {
|
|
|
|
foreach (var action in actor.get_actions ()) {
|
|
|
|
var drag_action = action as DragDropAction;
|
|
|
|
if (drag_action != null && drag_action.dragging) {
|
|
|
|
drag_action.cancel ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-18 20:32:32 +03:00
|
|
|
private void finish () {
|
2020-01-09 22:26:30 +03:00
|
|
|
// make sure they reset the style or whatever they changed when hovered
|
|
|
|
emit_crossed (hovered, false);
|
|
|
|
|
|
|
|
cleanup ();
|
|
|
|
|
|
|
|
drag_end (hovered);
|
|
|
|
}
|
|
|
|
|
2023-02-18 20:32:32 +03:00
|
|
|
private void cleanup () {
|
2020-01-09 22:26:30 +03:00
|
|
|
var source_list = sources.@get (drag_id);
|
|
|
|
if (source_list != null) {
|
|
|
|
foreach (var actor in source_list) {
|
|
|
|
actor.reactive = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-06 23:32:04 +03:00
|
|
|
if (dragging) {
|
|
|
|
ungrab_actor ();
|
|
|
|
}
|
2020-01-09 22:26:30 +03:00
|
|
|
|
|
|
|
dragging = false;
|
2024-07-10 12:55:02 +03:00
|
|
|
handle = null;
|
2020-01-09 22:26:30 +03:00
|
|
|
}
|
2024-07-07 08:41:34 +03:00
|
|
|
|
|
|
|
private bool is_valid_touch_event (Clutter.Event event) {
|
|
|
|
var type = event.get_type ();
|
|
|
|
|
|
|
|
return (
|
2024-11-02 15:18:01 +03:00
|
|
|
Meta.Util.is_wayland_compositor () ||
|
2024-07-07 08:41:34 +03:00
|
|
|
type != Clutter.EventType.TOUCH_BEGIN &&
|
|
|
|
type != Clutter.EventType.TOUCH_CANCEL &&
|
|
|
|
type != Clutter.EventType.TOUCH_END &&
|
2024-11-02 15:18:01 +03:00
|
|
|
type != Clutter.EventType.TOUCH_UPDATE
|
2024-07-07 08:41:34 +03:00
|
|
|
);
|
|
|
|
}
|
2020-01-09 22:26:30 +03:00
|
|
|
}
|
2013-06-26 16:07:05 +04:00
|
|
|
}
|