1- //
2- // Copyright (C) 2013 Tom Beckmann
3- //
4- // This program is free software: you can redistribute it and/or modify
5- // it under the terms of the GNU General Public License as published by
6- // the Free Software Foundation, either version 3 of the License, or
7- // (at your option) any later version.
8- //
9- // This program is distributed in the hope that it will be useful,
10- // but WITHOUT ANY WARRANTY; without even the implied warranty of
11- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12- // GNU General Public License for more details.
13- //
14- // You should have received a copy of the GNU General Public License
15- // along with this program. If not, see <http://www.gnu.org/licenses/>.
16- //
17-
18- using Clutter ;
1+ /*
2+ * SPDX-License-Identifier: GPL-3.0-or-later
3+ * SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io)
4+ * 2013 Tom Beckmann
5+ */
196
207namespace Gala {
218 [Flags ]
@@ -26,8 +13,8 @@ namespace Gala {
2613
2714 public class DragDropAction : Clutter .Action {
2815 // DO NOT keep a reference otherwise we get a ref cycle
29- private static Gee . HashMap<string,Gee .LinkedList<unowned Actor > > ? sources = null ;
30- private static Gee . HashMap<string,Gee .LinkedList<unowned Actor > > ? destinations = null ;
16+ private static Gee . HashMap<string,Gee .LinkedList<unowned Clutter . Actor >> ? sources = null ;
17+ private static Gee . HashMap<string,Gee .LinkedList<unowned Clutter . Actor >> ? destinations = null ;
3118
3219 /**
3320 * A drag has been started. You have to connect to this signal and
@@ -37,7 +24,7 @@ namespace Gala {
3724 * @param y The global y coordinate where the action was activated
3825 * @return A ClutterActor that serves as handle
3926 */
40- public signal Actor ? drag_begin (float x , float y );
27+ public signal Clutter . Actor ? drag_begin (float x , float y );
4128
4229 /**
4330 * A drag has been canceled. You may want to consider cleaning up
@@ -50,27 +37,27 @@ namespace Gala {
5037 *
5138 * @param actor The actor on which the drag finished
5239 */
53- public signal void drag_end (Actor actor );
40+ public signal void drag_end (Clutter . Actor actor );
5441
5542 /**
5643 * The destination has been crossed
5744 *
5845 * @param target the target actor that is crossing the destination
5946 * @param hovered indicates whether the actor is now hovered or not
6047 */
61- public signal void crossed (Actor ? target , bool hovered );
48+ public signal void crossed (Clutter . Actor ? target , bool hovered );
6249
6350 /**
6451 * Emitted on the source when a destination is crossed.
6552 *
6653 * @param destination The destination actor that has been crossed
6754 * @param hovered Whether the actor is now hovered or has just been left
6855 */
69- public signal void destination_crossed (Actor destination , bool hovered );
56+ public signal void destination_crossed (Clutter . Actor destination , bool hovered );
7057
7158 /**
7259 * The source has been clicked, but the movement was not larger than
73- * the drag threshold. Useful if the source is also activable .
60+ * the drag threshold. Useful if the source is also activatable .
7461 *
7562 * @param button The button which was pressed
7663 */
@@ -86,7 +73,7 @@ namespace Gala {
8673 */
8774 public string drag_id { get ; construct; }
8875
89- public Actor ? handle { get ; private set ; }
76+ public Clutter . Actor ? handle { get ; private set ; }
9077 /**
9178 * Indicates whether a drag action is currently active
9279 */
@@ -98,20 +85,20 @@ namespace Gala {
9885 */
9986 public bool allow_bubbling { get ; set ; default = true ; }
10087
101- public Actor ? hovered { private get ; set ; default = null ; }
88+ public Clutter . Actor ? hovered { private get ; set ; default = null ; }
10289
10390 private bool clicked = false ;
10491 private float last_x;
10592 private float last_y;
10693
107- private Grab ? grab = null ;
108- private static unowned Actor ? grabbed_actor = null ;
109- private InputDevice ? grabbed_device = null ;
94+ private Clutter . Grab ? grab = null ;
95+ private static unowned Clutter . Actor ? grabbed_actor = null ;
96+ private Clutter . InputDevice ? grabbed_device = null ;
11097 private ulong on_event_id = 0 ;
11198
11299 static construct {
113- sources = new Gee .HashMap<string,Gee .LinkedList<unowned Actor > > ();
114- destinations = new Gee .HashMap<string,Gee .LinkedList<unowned Actor > > ();
100+ sources = new Gee .HashMap<string,Gee .LinkedList<unowned Clutter . Actor >> ();
101+ destinations = new Gee .HashMap<string,Gee .LinkedList<unowned Clutter . Actor >> ();
115102 }
116103
117104 /**
@@ -132,7 +119,7 @@ namespace Gala {
132119 }
133120 }
134121
135- public override void set_actor (Actor ? new_actor ) {
122+ public override void set_actor (Clutter . Actor ? new_actor ) {
136123 if (actor != null ) {
137124 release_actor (actor);
138125 }
@@ -144,7 +131,7 @@ namespace Gala {
144131 base . set_actor (new_actor);
145132 }
146133
147- private void release_actor (Actor actor ) {
134+ private void release_actor (Clutter . Actor actor ) {
148135 if (DragDropActionType . SOURCE in drag_type) {
149136
150137 var source_list = sources. @get (drag_id);
@@ -159,12 +146,12 @@ namespace Gala {
159146 actor. destroy. disconnect (release_actor);
160147 }
161148
162- private void connect_actor (Actor actor ) {
149+ private void connect_actor (Clutter . Actor actor ) {
163150 if (DragDropActionType . SOURCE in drag_type) {
164151
165152 var source_list = sources. @get (drag_id);
166153 if (source_list == null ) {
167- source_list = new Gee .LinkedList<unowned Actor > ();
154+ source_list = new Gee .LinkedList<unowned Clutter . Actor > ();
168155 sources. @set (drag_id, source_list);
169156 }
170157
@@ -174,7 +161,7 @@ namespace Gala {
174161 if (DragDropActionType . DESTINATION in drag_type) {
175162 var dest_list = destinations[drag_id];
176163 if (dest_list == null ) {
177- dest_list = new Gee .LinkedList<unowned Actor > ();
164+ dest_list = new Gee .LinkedList<unowned Clutter . Actor > ();
178165 destinations[drag_id] = dest_list;
179166 }
180167
@@ -184,19 +171,19 @@ namespace Gala {
184171 actor. destroy. connect (release_actor);
185172 }
186173
187- private void emit_crossed (Actor destination , bool is_hovered ) {
174+ private void emit_crossed (Clutter . Actor destination , bool is_hovered ) {
188175 get_drag_drop_action (destination). crossed (actor, is_hovered);
189176 destination_crossed (destination, is_hovered);
190177 }
191178
192- public override bool handle_event (Event event ) {
179+ public override bool handle_event (Clutter . Event event ) {
193180 if (! (DragDropActionType . SOURCE in drag_type)) {
194181 return Clutter . EVENT_PROPAGATE ;
195182 }
196183
197184 switch (event. get_type ()) {
198- case EventType . BUTTON_PRESS:
199- case EventType . TOUCH_BEGIN:
185+ case Clutter . EventType . BUTTON_PRESS:
186+ case Clutter . EventType . TOUCH_BEGIN:
200187 if (! is_valid_touch_event (event)) {
201188 return Clutter . EVENT_PROPAGATE ;
202189 }
@@ -223,7 +210,7 @@ namespace Gala {
223210 return base . handle_event (event);
224211 }
225212
226- private void grab_actor (Actor actor , InputDevice device ) {
213+ private void grab_actor (Clutter . Actor actor , Clutter . InputDevice device ) {
227214 if (grabbed_actor != null ) {
228215 critical (" Tried to grab an actor with a grab already in progress" );
229216 }
@@ -255,20 +242,20 @@ namespace Gala {
255242
256243 if (grabbed_device != null &&
257244 device != grabbed_device &&
258- device. get_device_type () != InputDeviceType . KEYBOARD_DEVICE ) {
245+ device. get_device_type () != Clutter . InputDeviceType . KEYBOARD_DEVICE ) {
259246 return Clutter . EVENT_PROPAGATE ;
260247 }
261248
262249 switch (event. get_type ()) {
263- case EventType . KEY_PRESS:
264- if (event. get_key_symbol () == Key . Escape ) {
250+ case Clutter . EventType . KEY_PRESS:
251+ if (event. get_key_symbol () == Clutter . Key . Escape ) {
265252 cancel ();
266253 }
267254
268255 return Clutter . EVENT_STOP ;
269256
270- case EventType . BUTTON_RELEASE:
271- case EventType . TOUCH_END:
257+ case Clutter . EventType . BUTTON_RELEASE:
258+ case Clutter . EventType . TOUCH_END:
272259 if (! is_valid_touch_event (event)) {
273260 return Clutter . EVENT_PROPAGATE ;
274261 }
@@ -303,8 +290,8 @@ namespace Gala {
303290
304291 return Clutter . EVENT_STOP ;
305292
306- case EventType . MOTION:
307- case EventType . TOUCH_UPDATE:
293+ case Clutter . EventType . MOTION:
294+ case Clutter . EventType . TOUCH_UPDATE:
308295 if (! is_valid_touch_event (event)) {
309296 return Clutter . EVENT_PROPAGATE ;
310297 }
@@ -354,7 +341,7 @@ namespace Gala {
354341 last_y = y;
355342
356343 var stage = actor. get_stage ();
357- var actor = stage. get_actor_at_pos (PickMode . REACTIVE , (int ) x, (int ) y);
344+ var actor = stage. get_actor_at_pos (Clutter . PickMode . REACTIVE , (int ) x, (int ) y);
358345 DragDropAction action = null ;
359346 // if we're allowed to bubble and this actor is not a destination, check its parents
360347 if (actor != null && (action = get_drag_drop_action (actor)) == null && allow_bubbling) {
@@ -404,7 +391,7 @@ namespace Gala {
404391 *
405392 * @return the DragDropAction instance on this actor or NULL
406393 */
407- private DragDropAction ? get_drag_drop_action (Actor actor ) {
394+ private DragDropAction ? get_drag_drop_action (Clutter . Actor actor ) {
408395 DragDropAction ? drop_action = null ;
409396
410397 foreach (var action in actor. get_actions ()) {
0 commit comments