| 1 | /* GTK - The GIMP Toolkit |
| 2 | * Copyright (C) 1995-1999 Peter Mattis, Spencer Kimball and Josh MacDonald |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library 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 GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | /* |
| 19 | * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS |
| 20 | * file for a list of people on the GTK+ Team. See the ChangeLog |
| 21 | * files for a list of changes. These files are distributed with |
| 22 | * GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
| 23 | */ |
| 24 | |
| 25 | #include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 26 | |
| 27 | #include "gtkdragsourceprivate.h"cxx . . $ `<file>/gtk/gtkdragsourceprivate.h`/ |
| 28 | |
| 29 | #include "gtkgesturedrag.h"cxx . . $ `<file>/gtk/gtkgesturedrag.h`/ |
| 30 | #include "gtkgesturesingleprivate.h"cxx . . $ `<file>/gtk/gtkgesturesingleprivate.h`/ |
| 31 | #include "gtkimagedefinitionprivate.h"cxx . . $ `<file>/gtk/gtkimagedefinitionprivate.h`/ |
| 32 | #include "gtknative.h"cxx . . $ `<file>/gtk/gtknative.h`/ |
| 33 | #include "gtkwidgetprivate.h"cxx . . $ `<file>/gtk/gtkwidgetprivate.h`/ |
| 34 | #include "gtkimageprivate.h"cxx . . $ `<file>/gtk/gtkimageprivate.h`/ |
| 35 | #include "gtkdragicon.h"cxx . . $ `<file>/gtk/gtkdragicon.h`/ |
| 36 | #include "gtkprivate.h"cxx . . $ `<file>/gtk/gtkprivate.h`/ |
| 37 | #include "gtkmarshalers.h"cxx . . $ `<file>/build/gtk/gtkmarshalers.h`/ |
| 38 | #include "gtkpicture.h"cxx . . $ `<file>/gtk/gtkpicture.h`/ |
| 39 | #include "gtksettingsprivate.h"cxx . . $ `<file>/gtk/gtksettingsprivate.h`/ |
| 40 | #include "gtkgesturesingle.h"cxx . . $ `<file>/gtk/gtkgesturesingle.h`/ |
| 41 | |
| 42 | #define MIN_TIME_TO_DNDcxx . . $ `gtk/gtkdragsource.c:42:9`! 100 |
| 43 | |
| 44 | /** |
| 45 | * GtkDragSource: |
| 46 | * |
| 47 | * An event controller to initiate Drag-And-Drop operations. |
| 48 | * |
| 49 | * `GtkDragSource` can be set up with the necessary |
| 50 | * ingredients for a DND operation ahead of time. This includes |
| 51 | * the source for the data that is being transferred, in the form |
| 52 | * of a [[email protected]], the desired action, and the icon to |
| 53 | * use during the drag operation. After setting it up, the drag |
| 54 | * source must be added to a widget as an event controller, using |
| 55 | * [[email protected]_controller]. |
| 56 | * |
| 57 | * ```c |
| 58 | * static void |
| 59 | * my_widget_init (MyWidget *self) |
| 60 | * { |
| 61 | * GtkDragSource *drag_source = gtk_drag_source_new (); |
| 62 | * |
| 63 | * g_signal_connect (drag_source, "prepare", G_CALLBACK (on_drag_prepare), self); |
| 64 | * g_signal_connect (drag_source, "drag-begin", G_CALLBACK (on_drag_begin), self); |
| 65 | * |
| 66 | * gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (drag_source)); |
| 67 | * } |
| 68 | * ``` |
| 69 | * |
| 70 | * Setting up the content provider and icon ahead of time only makes |
| 71 | * sense when the data does not change. More commonly, you will want |
| 72 | * to set them up just in time. To do so, `GtkDragSource` has |
| 73 | * [[email protected]::prepare] and [[email protected]::drag-begin] |
| 74 | * signals. |
| 75 | * |
| 76 | * The ::prepare signal is emitted before a drag is started, and |
| 77 | * can be used to set the content provider and actions that the |
| 78 | * drag should be started with. |
| 79 | * |
| 80 | * ```c |
| 81 | * static GdkContentProvider * |
| 82 | * on_drag_prepare (GtkDragSource *source, |
| 83 | * double x, |
| 84 | * double y, |
| 85 | * MyWidget *self) |
| 86 | * { |
| 87 | * // This widget supports two types of content: GFile objects |
| 88 | * // and GdkPixbuf objects; GTK will handle the serialization |
| 89 | * // of these types automatically |
| 90 | * GFile *file = my_widget_get_file (self); |
| 91 | * GdkPixbuf *pixbuf = my_widget_get_pixbuf (self); |
| 92 | * |
| 93 | * return gdk_content_provider_new_union ((GdkContentProvider *[2]) { |
| 94 | * gdk_content_provider_new_typed (G_TYPE_FILE, file), |
| 95 | * gdk_content_provider_new_typed (GDK_TYPE_PIXBUF, pixbuf), |
| 96 | * }, 2); |
| 97 | * } |
| 98 | * ``` |
| 99 | * |
| 100 | * The ::drag-begin signal is emitted after the `GdkDrag` object has |
| 101 | * been created, and can be used to set up the drag icon. |
| 102 | * |
| 103 | * ```c |
| 104 | * static void |
| 105 | * on_drag_begin (GtkDragSource *source, |
| 106 | * GdkDrag *drag, |
| 107 | * MyWidget *self) |
| 108 | * { |
| 109 | * // Set the widget as the drag icon |
| 110 | * GdkPaintable *paintable = gtk_widget_paintable_new (GTK_WIDGET (self)); |
| 111 | * gtk_drag_source_set_icon (source, paintable, 0, 0); |
| 112 | * g_object_unref (paintable); |
| 113 | * } |
| 114 | * ``` |
| 115 | * |
| 116 | * During the DND operation, `GtkDragSource` emits signals that |
| 117 | * can be used to obtain updates about the status of the operation, |
| 118 | * but it is not normally necessary to connect to any signals, |
| 119 | * except for one case: when the supported actions include |
| 120 | * %GDK_ACTION_MOVE, you need to listen for the |
| 121 | * [[email protected]::drag-end] signal and delete the |
| 122 | * data after it has been transferred. |
| 123 | */ |
| 124 | |
| 125 | struct _GtkDragSourcecxx . . $ _GtkDragSource# |
| 126 | { |
| 127 | GtkGestureSinglecxx . . $ GtkGestureSingle# parent_instancecxx . . $ _GtkDragSource#parent_instance.; |
| 128 | |
| 129 | GdkContentProvidercxx . . $ GdkContentProvider# *contentcxx . . $ _GtkDragSource#content.; |
| 130 | GdkDragActioncxx . . $ GdkDragAction# actionscxx . . $ _GtkDragSource#actions.; |
| 131 | |
| 132 | GdkPaintablecxx . . $ GdkPaintable# *paintablecxx . . $ _GtkDragSource#paintable.; |
| 133 | int hot_xcxx . . $ _GtkDragSource#hot_x.; |
| 134 | int hot_ycxx . . $ _GtkDragSource#hot_y.; |
| 135 | |
| 136 | double start_xcxx . . $ _GtkDragSource#start_x.; |
| 137 | double start_ycxx . . $ _GtkDragSource#start_y.; |
| 138 | |
| 139 | guintcxx . . $ guint# timeout_idcxx . . $ _GtkDragSource#timeout_id.; |
| 140 | |
| 141 | GdkDragcxx . . $ GdkDrag# *dragcxx . . $ _GtkDragSource#drag.; |
| 142 | }; |
| 143 | |
| 144 | struct _GtkDragSourceClasscxx . . $ _GtkDragSourceClass# |
| 145 | { |
| 146 | GtkGestureSingleClasscxx . . $ GtkGestureSingleClass# parent_classcxx . . $ _GtkDragSourceClass#parent_class.; |
| 147 | |
| 148 | GdkContentProvidercxx . . $ GdkContentProvider# *(* preparecxx . . $ _GtkDragSourceClass#prepare.) (GtkDragSourcecxx . . $ GtkDragSource# *source, |
| 149 | double x, |
| 150 | double y); |
| 151 | }; |
| 152 | |
| 153 | enumcxx . . $ $anonymous_type_53a5493d588b69c5_0# { |
| 154 | PROP_CONTENTcxx . . $ PROP_CONTENT. = 1, |
| 155 | PROP_ACTIONScxx . . $ PROP_ACTIONS., |
| 156 | NUM_PROPERTIEScxx . . $ NUM_PROPERTIES. |
| 157 | }; |
| 158 | |
| 159 | static GParamSpeccxx . . $ GParamSpec# *propertiescxx . . $ properties.[NUM_PROPERTIEScxx . . $ NUM_PROPERTIES.]; |
| 160 | |
| 161 | enumcxx . . $ $anonymous_type_53a5493d588b69c5_1# { |
| 162 | PREPAREcxx . . $ PREPARE., |
| 163 | DRAG_BEGINcxx . . $ DRAG_BEGIN., |
| 164 | DRAG_ENDcxx . . $ DRAG_END., |
| 165 | DRAG_CANCELcxx . . $ DRAG_CANCEL., |
| 166 | NUM_SIGNALScxx . . $ NUM_SIGNALS. |
| 167 | }; |
| 168 | |
| 169 | static guintcxx . . $ guint# signalscxx . . $ signals.[NUM_SIGNALScxx . . $ NUM_SIGNALS.]; |
| 170 | |
| 171 | static void gtk_drag_source_dnd_finished_cbcxx . . $ gtk_drag_source_dnd_finished_cb(78af8022a6b121a0). (GdkDragcxx . . $ GdkDrag# *drag, |
| 172 | GtkDragSourcecxx . . $ GtkDragSource# *source); |
| 173 | static void gtk_drag_source_cancel_cbcxx . . $ gtk_drag_source_cancel_cb(56e2774ea97c9166). (GdkDragcxx . . $ GdkDrag# *drag, |
| 174 | GdkDragCancelReasoncxx . . $ GdkDragCancelReason# reason, |
| 175 | GtkDragSourcecxx . . $ GtkDragSource# *source); |
| 176 | |
| 177 | static GdkContentProvidercxx . . $ GdkContentProvider# *gtk_drag_source_preparecxx . . $ gtk_drag_source_prepare(c5f705a822abab8f). (GtkDragSourcecxx . . $ GtkDragSource# *source, |
| 178 | double x, |
| 179 | double y); |
| 180 | |
| 181 | static void gtk_drag_source_drag_begincxx . . $ gtk_drag_source_drag_begin(3c6a58a4cfc55898). (GtkDragSourcecxx . . $ GtkDragSource# *source); |
| 182 | |
| 183 | G_DEFINE_TYPEcxx . . $ `<external>/9567554376676449156/gtype.h:1834:9`! (GtkDragSource, gtk_drag_source, GTK_TYPE_GESTURE_SINGLEcxx . . $ `gtk/gtkgesturesingle.h:31:9`!); |
| 184 | |
| 185 | static void |
| 186 | gtk_drag_source_initcxx . . $ gtk_drag_source_init(3c6a58a4cfc55898). (GtkDragSourcecxx . . $ GtkDragSource# *source) |
| 187 | { |
| 188 | source->actionscxx . . $ _GtkDragSource#actions. = GDK_ACTION_COPYcxx . . $ GDK_ACTION_COPY.; |
| 189 | } |
| 190 | |
| 191 | static void |
| 192 | gtk_drag_source_finalizecxx . . $ gtk_drag_source_finalize(6087475fa43034d3). (GObjectcxx . . $ GObject# *object) |
| 193 | { |
| 194 | GtkDragSourcecxx . . $ GtkDragSource# *source = GTK_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:39:9`! (object); |
| 195 | |
| 196 | g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&source->content); |
| 197 | g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&source->paintable); |
| 198 | g_clear_handle_idcxx . . $ `<external>/1856471541377536744/gmain.h:867:9`! (&source->timeout_id, g_source_remove); |
| 199 | |
| 200 | G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (gtk_drag_source_parent_class)->finalizecxx . . $ _GObjectClass#finalize. (object); |
| 201 | } |
| 202 | |
| 203 | static void |
| 204 | gtk_drag_source_set_propertycxx . . $ gtk_drag_source_set_property(d7c4bb29f36c0dc4). (GObjectcxx . . $ GObject# *object, |
| 205 | guintcxx . . $ guint# prop_id, |
| 206 | const GValuecxx . . $ GValue# *value, |
| 207 | GParamSpeccxx . . $ GParamSpec# *pspec) |
| 208 | { |
| 209 | GtkDragSourcecxx . . $ GtkDragSource# *source = GTK_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:39:9`! (object); |
| 210 | |
| 211 | switch (prop_id) |
| 212 | { |
| 213 | case PROP_CONTENTcxx . . $ PROP_CONTENT.: |
| 214 | gtk_drag_source_set_contentcxx . . $ gtk_drag_source_set_content(6847a73a1a690578). (source, g_value_get_objectcxx . . $ g_value_get_object(e12dff36056c2cce). (value)); |
| 215 | break; |
| 216 | |
| 217 | case PROP_ACTIONScxx . . $ PROP_ACTIONS.: |
| 218 | gtk_drag_source_set_actionscxx . . $ gtk_drag_source_set_actions(d33ed6181cd06da6). (source, g_value_get_flagscxx . . $ g_value_get_flags(1e175b1568bd83e1). (value)); |
| 219 | break; |
| 220 | |
| 221 | default: |
| 222 | G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (object, prop_id, pspec); |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | static void |
| 227 | gtk_drag_source_get_propertycxx . . $ gtk_drag_source_get_property(cee2c52f22407c66). (GObjectcxx . . $ GObject# *object, |
| 228 | guintcxx . . $ guint# prop_id, |
| 229 | GValuecxx . . $ GValue# *value, |
| 230 | GParamSpeccxx . . $ GParamSpec# *pspec) |
| 231 | { |
| 232 | GtkDragSourcecxx . . $ GtkDragSource# *source = GTK_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:39:9`! (object); |
| 233 | |
| 234 | switch (prop_id) |
| 235 | { |
| 236 | case PROP_CONTENTcxx . . $ PROP_CONTENT.: |
| 237 | g_value_set_objectcxx . . $ g_value_set_object(e945b84c1e9702f). (value, gtk_drag_source_get_contentcxx . . $ gtk_drag_source_get_content(e03c9394fb7afd41). (source)); |
| 238 | break; |
| 239 | |
| 240 | case PROP_ACTIONScxx . . $ PROP_ACTIONS.: |
| 241 | g_value_set_flagscxx . . $ g_value_set_flags(f81c5c84daf56975). (value, gtk_drag_source_get_actionscxx . . $ gtk_drag_source_get_actions(246e3468cd23a7f6). (source)); |
| 242 | break; |
| 243 | |
| 244 | default: |
| 245 | G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (object, prop_id, pspec); |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | static gbooleancxx . . $ gboolean# |
| 250 | gtk_drag_source_filter_eventcxx . . $ gtk_drag_source_filter_event(7ad650e377e57494). (GtkEventControllercxx . . $ GtkEventController# *controller, |
| 251 | GdkEventcxx . . $ GdkEvent# *event) |
| 252 | { |
| 253 | /* Let touchpad swipe events go through, only if they match n-points */ |
| 254 | if (gdk_event_get_event_typecxx . . $ gdk_event_get_event_type(af0289f7121992bc). (event) == GDK_TOUCHPAD_SWIPEcxx . . $ GDK_TOUCHPAD_SWIPE.) |
| 255 | { |
| 256 | guintcxx . . $ guint# n_points; |
| 257 | guintcxx . . $ guint# n_fingers; |
| 258 | |
| 259 | g_object_getcxx . . $ g_object_get(1ac911bdc4e9a14d). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (controller), "n-points", &n_points, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 260 | n_fingers = gdk_touchpad_event_get_n_fingerscxx . . $ gdk_touchpad_event_get_n_fingers(2d406c81f4428913). (event); |
| 261 | |
| 262 | if (n_fingers == n_points) |
| 263 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 264 | else |
| 265 | return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!; |
| 266 | } |
| 267 | |
| 268 | return GTK_EVENT_CONTROLLER_CLASScxx . . $ `gtk/gtkeventcontroller.h:36:9`! (gtk_drag_source_parent_class)->filter_eventcxx . . $ _GtkEventControllerClass#filter_event. (controller, event); |
| 269 | } |
| 270 | |
| 271 | static gbooleancxx . . $ gboolean# |
| 272 | drag_timeoutcxx . . $ drag_timeout(dedf1e9b1c614a07). (gpointercxx . . $ gpointer# user_data) |
| 273 | { |
| 274 | GtkDragSourcecxx . . $ GtkDragSource# *source = user_data; |
| 275 | |
| 276 | source->timeout_idcxx . . $ _GtkDragSource#timeout_id. = 0; |
| 277 | |
| 278 | return G_SOURCE_REMOVEcxx . . $ `<external>/1856471541377536744/gmain.h:475:9`!; |
| 279 | } |
| 280 | |
| 281 | static void |
| 282 | gtk_drag_source_begincxx . . $ gtk_drag_source_begin(4613efcc89ef386). (GtkGesturecxx . . $ GtkGesture# *gesture, |
| 283 | GdkEventSequencecxx . . $ GdkEventSequence# *sequence) |
| 284 | { |
| 285 | GtkDragSourcecxx . . $ GtkDragSource# *source = GTK_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:39:9`! (gesture); |
| 286 | GdkEventSequencecxx . . $ GdkEventSequence# *current; |
| 287 | |
| 288 | current = gtk_gesture_single_get_current_sequencecxx . . $ gtk_gesture_single_get_current_sequence(eacc6d2458a1513d). (GTK_GESTURE_SINGLEcxx . . $ `gtk/gtkgesturesingle.h:32:9`! (gesture)); |
| 289 | source->timeout_idcxx . . $ _GtkDragSource#timeout_id. = g_timeout_addcxx . . $ g_timeout_add(ec6d13059821d355). (MIN_TIME_TO_DNDcxx . . $ `gtk/gtkdragsource.c:42:9`!, drag_timeoutcxx . . $ drag_timeout(dedf1e9b1c614a07)., source); |
| 290 | |
| 291 | gtk_gesture_get_pointcxx . . $ gtk_gesture_get_point(c2c448b15d15778f). (gesture, current, &source->start_xcxx . . $ _GtkDragSource#start_x., &source->start_ycxx . . $ _GtkDragSource#start_y.); |
| 292 | } |
| 293 | |
| 294 | static void |
| 295 | gtk_drag_source_updatecxx . . $ gtk_drag_source_update(4613efcc89ef386). (GtkGesturecxx . . $ GtkGesture# *gesture, |
| 296 | GdkEventSequencecxx . . $ GdkEventSequence# *sequence) |
| 297 | { |
| 298 | GtkDragSourcecxx . . $ GtkDragSource# *source = GTK_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:39:9`! (gesture); |
| 299 | GtkWidgetcxx . . $ GtkWidget# *widget; |
| 300 | double x, y; |
| 301 | |
| 302 | if (!gtk_gesture_is_recognizedcxx . . $ gtk_gesture_is_recognized(7d3530d02874564). (gesture)) |
| 303 | return; |
| 304 | |
| 305 | gtk_gesture_get_pointcxx . . $ gtk_gesture_get_point(c2c448b15d15778f). (gesture, sequence, &x, &y); |
| 306 | |
| 307 | widget = gtk_event_controller_get_widgetcxx . . $ gtk_event_controller_get_widget(71aab0125320da1a). (GTK_EVENT_CONTROLLERcxx . . $ `gtk/gtkeventcontroller.h:35:9`! (gesture)); |
| 308 | |
| 309 | if (gtk_drag_check_threshold_doublecxx . . $ gtk_drag_check_threshold_double(e6a6e33a050930d2). (widget, source->start_xcxx . . $ _GtkDragSource#start_x., source->start_ycxx . . $ _GtkDragSource#start_y., x, y) && |
| 310 | !source->timeout_idcxx . . $ _GtkDragSource#timeout_id.) |
| 311 | { |
| 312 | gtk_drag_source_drag_begincxx . . $ gtk_drag_source_drag_begin(3c6a58a4cfc55898). (source); |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | static void |
| 317 | gtk_drag_source_class_initcxx . . $ gtk_drag_source_class_init(ac1a45b9ba397229). (GtkDragSourceClasscxx . . $ GtkDragSourceClass# *class) |
| 318 | { |
| 319 | GObjectClasscxx . . $ GObjectClass# *object_class = G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (class); |
| 320 | GtkEventControllerClasscxx . . $ GtkEventControllerClass# *controller_class = GTK_EVENT_CONTROLLER_CLASScxx . . $ `gtk/gtkeventcontroller.h:36:9`! (class); |
| 321 | GtkGestureClasscxx . . $ GtkGestureClass# *gesture_class = GTK_GESTURE_CLASScxx . . $ `gtk/gtkgesture.h:33:9`! (class); |
| 322 | |
| 323 | object_class->finalizecxx . . $ _GObjectClass#finalize. = gtk_drag_source_finalizecxx . . $ gtk_drag_source_finalize(6087475fa43034d3).; |
| 324 | object_class->set_propertycxx . . $ _GObjectClass#set_property. = gtk_drag_source_set_propertycxx . . $ gtk_drag_source_set_property(d7c4bb29f36c0dc4).; |
| 325 | object_class->get_propertycxx . . $ _GObjectClass#get_property. = gtk_drag_source_get_propertycxx . . $ gtk_drag_source_get_property(cee2c52f22407c66).; |
| 326 | |
| 327 | controller_class->filter_eventcxx . . $ _GtkEventControllerClass#filter_event. = gtk_drag_source_filter_eventcxx . . $ gtk_drag_source_filter_event(7ad650e377e57494).; |
| 328 | |
| 329 | gesture_class->begincxx . . $ _GtkGestureClass#begin. = gtk_drag_source_begincxx . . $ gtk_drag_source_begin(4613efcc89ef386).; |
| 330 | gesture_class->updatecxx . . $ _GtkGestureClass#update. = gtk_drag_source_updatecxx . . $ gtk_drag_source_update(4613efcc89ef386).; |
| 331 | gesture_class->endcxx . . $ _GtkGestureClass#end. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 332 | |
| 333 | class->preparecxx . . $ _GtkDragSourceClass#prepare. = gtk_drag_source_preparecxx . . $ gtk_drag_source_prepare(c5f705a822abab8f).; |
| 334 | |
| 335 | /** |
| 336 | * GtkDragSource:content: |
| 337 | * |
| 338 | * The data that is offered by drag operations from this source. |
| 339 | */ |
| 340 | propertiescxx . . $ properties.[PROP_CONTENTcxx . . $ PROP_CONTENT.] = |
| 341 | g_param_spec_objectcxx . . $ g_param_spec_object(faf99966f027a127). ("content", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 342 | GDK_TYPE_CONTENT_PROVIDERcxx . . $ `gdk/gdkcontentprovider.h:29:9`!, |
| 343 | G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. | G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`! | G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.); |
| 344 | |
| 345 | /** |
| 346 | * GtkDragSource:actions: |
| 347 | * |
| 348 | * The actions that are supported by drag operations from the source. |
| 349 | * |
| 350 | * Note that you must handle the [[email protected]::drag-end] signal |
| 351 | * if the actions include %GDK_ACTION_MOVE. |
| 352 | */ |
| 353 | propertiescxx . . $ properties.[PROP_ACTIONScxx . . $ PROP_ACTIONS.] = |
| 354 | g_param_spec_flagscxx . . $ g_param_spec_flags(8782cb85a73af5de). ("actions", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 355 | GDK_TYPE_DRAG_ACTIONcxx . . $ `build/gdk/gdkenumtypes.h:81:9`!, GDK_ACTION_COPYcxx . . $ GDK_ACTION_COPY., |
| 356 | G_PARAM_READWRITEcxx . . $ G_PARAM_READWRITE. | G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`! | G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.); |
| 357 | |
| 358 | g_object_class_install_propertiescxx . . $ g_object_class_install_properties(569d03e6a4088541). (object_class, NUM_PROPERTIEScxx . . $ NUM_PROPERTIES., propertiescxx . . $ properties.); |
| 359 | |
| 360 | /** |
| 361 | * GtkDragSource::prepare: |
| 362 | * @source: the `GtkDragSource` |
| 363 | * @x: the X coordinate of the drag starting point |
| 364 | * @y: the Y coordinate of the drag starting point |
| 365 | * |
| 366 | * Emitted when a drag is about to be initiated. |
| 367 | * |
| 368 | * It returns the `GdkContentProvider` to use for the drag that is about |
| 369 | * to start. The default handler for this signal returns the value of |
| 370 | * the [[email protected]:content] property, so if you set up that |
| 371 | * property ahead of time, you don't need to connect to this signal. |
| 372 | * |
| 373 | * Returns: (transfer full) (nullable): a `GdkContentProvider` |
| 374 | */ |
| 375 | signalscxx . . $ signals.[PREPAREcxx . . $ PREPARE.] = |
| 376 | g_signal_newcxx . . $ g_signal_new(b0aa5e8090fb95c0). (I_cxx . . $ `gdk/gdkprivate.h:35:9`!("prepare"), |
| 377 | G_TYPE_FROM_CLASScxx . . $ `<external>/9567554376676449156/gtype.h:657:9`! (class), |
| 378 | G_SIGNAL_RUN_LASTcxx . . $ G_SIGNAL_RUN_LAST., |
| 379 | G_STRUCT_OFFSETcxx . . $ `<external>/12741050725406041920/gmacros.h:1005:9`! (GtkDragSourceClass, prepare), |
| 380 | g_signal_accumulator_first_winscxx . . $ g_signal_accumulator_first_wins(76292f232a01f816)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 381 | _gtk_marshal_OBJECT__DOUBLE_DOUBLEcxx . . $ _gtk_marshal_OBJECT__DOUBLE_DOUBLE(cba270afb0f82555)., |
| 382 | GDK_TYPE_CONTENT_PROVIDERcxx . . $ `gdk/gdkcontentprovider.h:29:9`!, 2, |
| 383 | G_TYPE_DOUBLEcxx . . $ `<external>/9567554376676449156/gtype.h:159:9`!, G_TYPE_DOUBLEcxx . . $ `<external>/9567554376676449156/gtype.h:159:9`!); |
| 384 | g_signal_set_va_marshallercxx . . $ g_signal_set_va_marshaller(4fd870c04a9d6fe7). (signalscxx . . $ signals.[PREPAREcxx . . $ PREPARE.], |
| 385 | GTK_TYPE_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:38:9`!, |
| 386 | _gtk_marshal_OBJECT__DOUBLE_DOUBLEvcxx . . $ _gtk_marshal_OBJECT__DOUBLE_DOUBLEv(d309f4be92d1737c).); |
| 387 | |
| 388 | /** |
| 389 | * GtkDragSource::drag-begin: |
| 390 | * @source: the `GtkDragSource` |
| 391 | * @drag: the `GdkDrag` object |
| 392 | * |
| 393 | * Emitted on the drag source when a drag is started. |
| 394 | * |
| 395 | * It can be used to e.g. set a custom drag icon with |
| 396 | * [[email protected]_icon]. |
| 397 | */ |
| 398 | signalscxx . . $ signals.[DRAG_BEGINcxx . . $ DRAG_BEGIN.] = |
| 399 | g_signal_newcxx . . $ g_signal_new(b0aa5e8090fb95c0). (I_cxx . . $ `gdk/gdkprivate.h:35:9`!("drag-begin"), |
| 400 | G_TYPE_FROM_CLASScxx . . $ `<external>/9567554376676449156/gtype.h:657:9`! (class), |
| 401 | G_SIGNAL_RUN_LASTcxx . . $ G_SIGNAL_RUN_LAST., |
| 402 | 0, |
| 403 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 404 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 405 | G_TYPE_NONEcxx . . $ `<external>/9567554376676449156/gtype.h:72:9`!, 1, |
| 406 | GDK_TYPE_DRAGcxx . . $ `gdk/gdkdrag.h:37:9`!); |
| 407 | |
| 408 | /** |
| 409 | * GtkDragSource::drag-end: |
| 410 | * @source: the `GtkDragSource` |
| 411 | * @drag: the `GdkDrag` object |
| 412 | * @delete_data: %TRUE if the drag was performing %GDK_ACTION_MOVE, |
| 413 | * and the data should be deleted |
| 414 | * |
| 415 | * Emitted on the drag source when a drag is finished. |
| 416 | * |
| 417 | * A typical reason to connect to this signal is to undo |
| 418 | * things done in [[email protected]::prepare] or |
| 419 | * [[email protected]::drag-begin] handlers. |
| 420 | */ |
| 421 | signalscxx . . $ signals.[DRAG_ENDcxx . . $ DRAG_END.] = |
| 422 | g_signal_newcxx . . $ g_signal_new(b0aa5e8090fb95c0). (I_cxx . . $ `gdk/gdkprivate.h:35:9`!("drag-end"), |
| 423 | G_TYPE_FROM_CLASScxx . . $ `<external>/9567554376676449156/gtype.h:657:9`! (class), |
| 424 | G_SIGNAL_RUN_LASTcxx . . $ G_SIGNAL_RUN_LAST., |
| 425 | 0, |
| 426 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 427 | _gtk_marshal_VOID__OBJECT_BOOLEANcxx . . $ _gtk_marshal_VOID__OBJECT_BOOLEAN(cba270afb0f82555)., |
| 428 | G_TYPE_NONEcxx . . $ `<external>/9567554376676449156/gtype.h:72:9`!, 2, |
| 429 | GDK_TYPE_DRAGcxx . . $ `gdk/gdkdrag.h:37:9`!, |
| 430 | G_TYPE_BOOLEANcxx . . $ `<external>/9567554376676449156/gtype.h:99:9`!); |
| 431 | g_signal_set_va_marshallercxx . . $ g_signal_set_va_marshaller(4fd870c04a9d6fe7). (signalscxx . . $ signals.[DRAG_ENDcxx . . $ DRAG_END.], |
| 432 | GTK_TYPE_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:38:9`!, |
| 433 | _gtk_marshal_VOID__OBJECT_BOOLEANvcxx . . $ _gtk_marshal_VOID__OBJECT_BOOLEANv(d309f4be92d1737c).); |
| 434 | |
| 435 | /** |
| 436 | * GtkDragSource::drag-cancel: |
| 437 | * @source: the `GtkDragSource` |
| 438 | * @drag: the `GdkDrag` object |
| 439 | * @reason: information on why the drag failed |
| 440 | * |
| 441 | * Emitted on the drag source when a drag has failed. |
| 442 | * |
| 443 | * The signal handler may handle a failed drag operation based on |
| 444 | * the type of error. It should return %TRUE if the failure has been handled |
| 445 | * and the default "drag operation failed" animation should not be shown. |
| 446 | * |
| 447 | * Returns: %TRUE if the failed drag operation has been already handled |
| 448 | */ |
| 449 | signalscxx . . $ signals.[DRAG_CANCELcxx . . $ DRAG_CANCEL.] = |
| 450 | g_signal_newcxx . . $ g_signal_new(b0aa5e8090fb95c0). (I_cxx . . $ `gdk/gdkprivate.h:35:9`!("drag-cancel"), |
| 451 | G_TYPE_FROM_CLASScxx . . $ `<external>/9567554376676449156/gtype.h:657:9`! (class), |
| 452 | G_SIGNAL_RUN_LASTcxx . . $ G_SIGNAL_RUN_LAST., |
| 453 | 0, |
| 454 | _gtk_boolean_handled_accumulatorcxx . . $ _gtk_boolean_handled_accumulator(76292f232a01f816)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 455 | _gtk_marshal_BOOLEAN__OBJECT_ENUMcxx . . $ _gtk_marshal_BOOLEAN__OBJECT_ENUM(cba270afb0f82555)., |
| 456 | G_TYPE_BOOLEANcxx . . $ `<external>/9567554376676449156/gtype.h:99:9`!, 2, |
| 457 | GDK_TYPE_DRAGcxx . . $ `gdk/gdkdrag.h:37:9`!, |
| 458 | GDK_TYPE_DRAG_CANCEL_REASONcxx . . $ `build/gdk/gdkenumtypes.h:39:9`!); |
| 459 | g_signal_set_va_marshallercxx . . $ g_signal_set_va_marshaller(4fd870c04a9d6fe7). (signalscxx . . $ signals.[DRAG_CANCELcxx . . $ DRAG_CANCEL.], |
| 460 | G_TYPE_FROM_CLASScxx . . $ `<external>/9567554376676449156/gtype.h:657:9`! (class), |
| 461 | _gtk_marshal_BOOLEAN__OBJECT_ENUMvcxx . . $ _gtk_marshal_BOOLEAN__OBJECT_ENUMv(d309f4be92d1737c).); |
| 462 | } |
| 463 | |
| 464 | static GdkContentProvidercxx . . $ GdkContentProvider# * |
| 465 | gtk_drag_source_preparecxx . . $ gtk_drag_source_prepare(c5f705a822abab8f). (GtkDragSourcecxx . . $ GtkDragSource# *source, |
| 466 | double x, |
| 467 | double y) |
| 468 | { |
| 469 | if (source->actionscxx . . $ _GtkDragSource#actions. == 0) |
| 470 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 471 | |
| 472 | if (source->contentcxx . . $ _GtkDragSource#content. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 473 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 474 | |
| 475 | return g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (source->content); |
| 476 | } |
| 477 | |
| 478 | static void |
| 479 | drag_endcxx . . $ drag_end(e01b7ef71ea50db9). (GtkDragSourcecxx . . $ GtkDragSource# *source, |
| 480 | gbooleancxx . . $ gboolean# success) |
| 481 | { |
| 482 | gbooleancxx . . $ gboolean# delete_data; |
| 483 | |
| 484 | g_signal_handlers_disconnect_by_funccxx . . $ `<external>/15952772511652638895/gsignal.h:629:9`! (source->drag, gtk_drag_source_dnd_finished_cb, source); |
| 485 | g_signal_handlers_disconnect_by_funccxx . . $ `<external>/15952772511652638895/gsignal.h:629:9`! (source->drag, gtk_drag_source_cancel_cb, source); |
| 486 | |
| 487 | delete_data = success && gdk_drag_get_selected_actioncxx . . $ gdk_drag_get_selected_action(aa4300ac7f8e9c21). (source->dragcxx . . $ _GtkDragSource#drag.) == GDK_ACTION_MOVEcxx . . $ GDK_ACTION_MOVE.; |
| 488 | |
| 489 | g_signal_emitcxx . . $ g_signal_emit(cc3f7c2ba1c6a182). (source, signalscxx . . $ signals.[DRAG_ENDcxx . . $ DRAG_END.], 0, source->dragcxx . . $ _GtkDragSource#drag., delete_data); |
| 490 | |
| 491 | gdk_drag_drop_donecxx . . $ gdk_drag_drop_done(65544225f852cdcf). (source->dragcxx . . $ _GtkDragSource#drag., success); |
| 492 | g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&source->drag); |
| 493 | g_clear_handle_idcxx . . $ `<external>/1856471541377536744/gmain.h:867:9`! (&source->timeout_id, g_source_remove); |
| 494 | g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (source); |
| 495 | } |
| 496 | |
| 497 | static void |
| 498 | gtk_drag_source_dnd_finished_cbcxx . . $ gtk_drag_source_dnd_finished_cb(78af8022a6b121a0). (GdkDragcxx . . $ GdkDrag# *drag, |
| 499 | GtkDragSourcecxx . . $ GtkDragSource# *source) |
| 500 | { |
| 501 | drag_endcxx . . $ drag_end(e01b7ef71ea50db9). (source, TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!); |
| 502 | } |
| 503 | |
| 504 | static void |
| 505 | gtk_drag_source_cancel_cbcxx . . $ gtk_drag_source_cancel_cb(56e2774ea97c9166). (GdkDragcxx . . $ GdkDrag# *drag, |
| 506 | GdkDragCancelReasoncxx . . $ GdkDragCancelReason# reason, |
| 507 | GtkDragSourcecxx . . $ GtkDragSource# *source) |
| 508 | { |
| 509 | gbooleancxx . . $ gboolean# success = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 510 | |
| 511 | g_signal_emitcxx . . $ g_signal_emit(cc3f7c2ba1c6a182). (source, signalscxx . . $ signals.[DRAG_CANCELcxx . . $ DRAG_CANCEL.], 0, source->dragcxx . . $ _GtkDragSource#drag., reason, &success); |
| 512 | drag_endcxx . . $ drag_end(e01b7ef71ea50db9). (source, success); |
| 513 | } |
| 514 | |
| 515 | static void |
| 516 | gtk_drag_source_ensure_iconcxx . . $ gtk_drag_source_ensure_icon(dd1106746aeaca35). (GtkDragSourcecxx . . $ GtkDragSource# *self, |
| 517 | GdkDragcxx . . $ GdkDrag# *drag) |
| 518 | { |
| 519 | GdkContentProvidercxx . . $ GdkContentProvider# *provider; |
| 520 | GtkWidgetcxx . . $ GtkWidget# *icon, *child; |
| 521 | GdkContentFormatscxx . . $ GdkContentFormats# *formats; |
| 522 | const GTypecxx . . $ GType# *types; |
| 523 | gsizecxx . . $ gsize# i, n_types; |
| 524 | |
| 525 | icon = gtk_drag_icon_get_for_dragcxx . . $ gtk_drag_icon_get_for_drag(2c9af4878a997a4e). (drag); |
| 526 | /* If an icon has been set already, we don't need to set one. */ |
| 527 | if (gtk_drag_icon_get_childcxx . . $ gtk_drag_icon_get_child(a4e012b0f0fe7dc9). (GTK_DRAG_ICONcxx . . $ GTK_DRAG_ICON(84b57eb80dee059). (icon))) |
| 528 | return; |
| 529 | |
| 530 | if (self->paintablecxx . . $ _GtkDragSource#paintable.) |
| 531 | { |
| 532 | gtk_drag_icon_set_from_paintablecxx . . $ gtk_drag_icon_set_from_paintable(26c3715d0bf2b78c). (drag, |
| 533 | self->paintablecxx . . $ _GtkDragSource#paintable., |
| 534 | self->hot_xcxx . . $ _GtkDragSource#hot_x., |
| 535 | self->hot_ycxx . . $ _GtkDragSource#hot_y.); |
| 536 | return; |
| 537 | } |
| 538 | |
| 539 | gdk_drag_set_hotspotcxx . . $ gdk_drag_set_hotspot(aa047b667051355c). (drag, -2, -2); |
| 540 | |
| 541 | provider = gdk_drag_get_contentcxx . . $ gdk_drag_get_content(60006effaae0a2de). (drag); |
| 542 | formats = gdk_content_provider_ref_formatscxx . . $ gdk_content_provider_ref_formats(653aea2a3e0e059b). (provider); |
| 543 | types = gdk_content_formats_get_gtypescxx . . $ gdk_content_formats_get_gtypes(364326c5280fee92). (formats, &n_types); |
| 544 | for (i = 0; i < n_types; i++) |
| 545 | { |
| 546 | GValuecxx . . $ GValue# value = G_VALUE_INITcxx . . $ `<external>/17218264759549183453/gvalue.h:250:9`!; |
| 547 | |
| 548 | g_value_initcxx . . $ g_value_init(afc049a76445919c). (&value, types[i]); |
| 549 | if (gdk_content_provider_get_valuecxx . . $ gdk_content_provider_get_value(f131bc8b1035f9ef). (provider, &value, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) |
| 550 | { |
| 551 | child = gtk_drag_icon_create_widget_for_valuecxx . . $ gtk_drag_icon_create_widget_for_value(f26edb835671863b). (&value); |
| 552 | |
| 553 | if (child) |
| 554 | { |
| 555 | gtk_drag_icon_set_childcxx . . $ gtk_drag_icon_set_child(5980977888b01865). (GTK_DRAG_ICONcxx . . $ GTK_DRAG_ICON(84b57eb80dee059). (icon), child); |
| 556 | g_value_unsetcxx . . $ g_value_unset(15c06aff79890746). (&value); |
| 557 | gdk_content_formats_unrefcxx . . $ gdk_content_formats_unref(b987afd44ddd231a). (formats); |
| 558 | return; |
| 559 | } |
| 560 | } |
| 561 | g_value_unsetcxx . . $ g_value_unset(15c06aff79890746). (&value); |
| 562 | } |
| 563 | |
| 564 | gdk_content_formats_unrefcxx . . $ gdk_content_formats_unref(b987afd44ddd231a). (formats); |
| 565 | child = gtk_image_new_from_icon_namecxx . . $ gtk_image_new_from_icon_name(6d90f3ec8782e10d). ("text-x-generic"); |
| 566 | gtk_image_set_icon_sizecxx . . $ gtk_image_set_icon_size(54293298fc61f4ed). (GTK_IMAGEcxx . . $ `gtk/gtkimage.h:39:9`! (child), GTK_ICON_SIZE_LARGEcxx . . $ GTK_ICON_SIZE_LARGE.); |
| 567 | gtk_drag_icon_set_childcxx . . $ gtk_drag_icon_set_child(5980977888b01865). (GTK_DRAG_ICONcxx . . $ GTK_DRAG_ICON(84b57eb80dee059). (icon), child); |
| 568 | } |
| 569 | |
| 570 | static void |
| 571 | gtk_drag_source_drag_begincxx . . $ gtk_drag_source_drag_begin(3c6a58a4cfc55898). (GtkDragSourcecxx . . $ GtkDragSource# *source) |
| 572 | { |
| 573 | GtkWidgetcxx . . $ GtkWidget# *widget; |
| 574 | GdkDevicecxx . . $ GdkDevice# *device, *pointer; |
| 575 | GdkSeatcxx . . $ GdkSeat# *seat; |
| 576 | graphene_point_tcxx . . $ graphene_point_t# p; |
| 577 | GtkNativecxx . . $ GtkNative# *native; |
| 578 | GdkSurfacecxx . . $ GdkSurface# *surface; |
| 579 | double px, py; |
| 580 | double dx, dy; |
| 581 | GdkContentProvidercxx . . $ GdkContentProvider# *content = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 582 | |
| 583 | widget = gtk_event_controller_get_widgetcxx . . $ gtk_event_controller_get_widget(71aab0125320da1a). (GTK_EVENT_CONTROLLERcxx . . $ `gtk/gtkeventcontroller.h:35:9`! (source)); |
| 584 | device = gtk_gesture_get_devicecxx . . $ gtk_gesture_get_device(b8870bc3920be57d). (GTK_GESTUREcxx . . $ `gtk/gtkgesture.h:32:9`! (source)); |
| 585 | seat = gdk_device_get_seatcxx . . $ gdk_device_get_seat(a28d73f3effb1594). (device); |
| 586 | |
| 587 | if (device == gdk_seat_get_keyboardcxx . . $ gdk_seat_get_keyboard(bcf9d88e6a2df60a). (seat)) |
| 588 | pointer = gdk_seat_get_pointercxx . . $ gdk_seat_get_pointer(bcf9d88e6a2df60a). (seat); |
| 589 | else |
| 590 | pointer = device; |
| 591 | |
| 592 | native = gtk_widget_get_nativecxx . . $ gtk_widget_get_native(38d4aa93baea8f2d). (widget); |
| 593 | surface = gtk_native_get_surfacecxx . . $ gtk_native_get_surface(bdacbdb7fef9c16f). (native); |
| 594 | |
| 595 | if (!gtk_widget_compute_pointcxx . . $ gtk_widget_compute_point(5d725c57412b822e). (widget, GTK_WIDGETcxx . . $ `gtk/gtkwidget.h:44:9`! (native), |
| 596 | &GRAPHENE_POINT_INITcxx . . $ `<external>/9324137249738369859/graphene-point.h:50:9`! (source->start_x, source->start_y), |
| 597 | &p)) |
| 598 | return; |
| 599 | |
| 600 | gdk_surface_get_device_positioncxx . . $ gdk_surface_get_device_position(938452520d8bee25). (surface, pointer, &px, &py, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 601 | |
| 602 | dx = round (px - p.xcxx . . $ _graphene_point_t#x.); |
| 603 | dy = round (py - p.ycxx . . $ _graphene_point_t#y.); |
| 604 | |
| 605 | g_signal_emitcxx . . $ g_signal_emit(cc3f7c2ba1c6a182). (source, signalscxx . . $ signals.[PREPAREcxx . . $ PREPARE.], 0, source->start_xcxx . . $ _GtkDragSource#start_x., source->start_ycxx . . $ _GtkDragSource#start_y., &content); |
| 606 | if (!content) |
| 607 | return; |
| 608 | |
| 609 | source->dragcxx . . $ _GtkDragSource#drag. = gdk_drag_begincxx . . $ gdk_drag_begin(59900c86f044f891). (surface, pointer, content, source->actionscxx . . $ _GtkDragSource#actions., dx, dy); |
| 610 | |
| 611 | g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (content); |
| 612 | |
| 613 | if (source->dragcxx . . $ _GtkDragSource#drag. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 614 | return; |
| 615 | |
| 616 | gtk_widget_reset_controllerscxx . . $ gtk_widget_reset_controllers(d7cf858254b37903). (widget); |
| 617 | |
| 618 | g_signal_emitcxx . . $ g_signal_emit(cc3f7c2ba1c6a182). (source, signalscxx . . $ signals.[DRAG_BEGINcxx . . $ DRAG_BEGIN.], 0, source->dragcxx . . $ _GtkDragSource#drag.); |
| 619 | |
| 620 | gtk_drag_source_ensure_iconcxx . . $ gtk_drag_source_ensure_icon(dd1106746aeaca35). (source, source->dragcxx . . $ _GtkDragSource#drag.); |
| 621 | |
| 622 | /* Keep the source alive until the drag is done */ |
| 623 | g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (source); |
| 624 | |
| 625 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (source->drag, "dnd-finished", |
| 626 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (gtk_drag_source_dnd_finished_cb), source); |
| 627 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (source->drag, "cancel", |
| 628 | G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (gtk_drag_source_cancel_cb), source); |
| 629 | } |
| 630 | |
| 631 | /** |
| 632 | * gtk_drag_source_new: |
| 633 | * |
| 634 | * Creates a new `GtkDragSource` object. |
| 635 | * |
| 636 | * Returns: the new `GtkDragSource` |
| 637 | */ |
| 638 | GtkDragSourcecxx . . $ GtkDragSource# * |
| 639 | gtk_drag_source_newcxx . . $ gtk_drag_source_new(77897cffe031c7d7). (void) |
| 640 | { |
| 641 | return g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GTK_TYPE_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:38:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 642 | } |
| 643 | |
| 644 | /** |
| 645 | * gtk_drag_source_get_content: |
| 646 | * @source: a `GtkDragSource` |
| 647 | * |
| 648 | * Gets the current content provider of a `GtkDragSource`. |
| 649 | * |
| 650 | * Returns: (nullable) (transfer none): the `GdkContentProvider` of @source |
| 651 | */ |
| 652 | GdkContentProvidercxx . . $ GdkContentProvider# * |
| 653 | gtk_drag_source_get_contentcxx . . $ gtk_drag_source_get_content(e03c9394fb7afd41). (GtkDragSourcecxx . . $ GtkDragSource# *source) |
| 654 | { |
| 655 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:41:9`! (source), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 656 | |
| 657 | return source->contentcxx . . $ _GtkDragSource#content.; |
| 658 | } |
| 659 | |
| 660 | /** |
| 661 | * gtk_drag_source_set_content: |
| 662 | * @source: a `GtkDragSource` |
| 663 | * @content: (nullable): a `GdkContentProvider` |
| 664 | * |
| 665 | * Sets a content provider on a `GtkDragSource`. |
| 666 | * |
| 667 | * When the data is requested in the cause of a DND operation, |
| 668 | * it will be obtained from the content provider. |
| 669 | * |
| 670 | * This function can be called before a drag is started, |
| 671 | * or in a handler for the [[email protected]::prepare] signal. |
| 672 | * |
| 673 | * You may consider setting the content provider back to |
| 674 | * %NULL in a [[email protected]::drag-end] signal handler. |
| 675 | */ |
| 676 | void |
| 677 | gtk_drag_source_set_contentcxx . . $ gtk_drag_source_set_content(6847a73a1a690578). (GtkDragSourcecxx . . $ GtkDragSource# *source, |
| 678 | GdkContentProvidercxx . . $ GdkContentProvider# *content) |
| 679 | { |
| 680 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:41:9`! (source)); |
| 681 | |
| 682 | if (!g_set_objectcxx . . $ `<external>/1341695927569185362/gobject.h:762:9`! (&source->content, content)) |
| 683 | return; |
| 684 | |
| 685 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (source), propertiescxx . . $ properties.[PROP_CONTENTcxx . . $ PROP_CONTENT.]); |
| 686 | } |
| 687 | |
| 688 | /** |
| 689 | * gtk_drag_source_get_actions: |
| 690 | * @source: a `GtkDragSource` |
| 691 | * |
| 692 | * Gets the actions that are currently set on the `GtkDragSource`. |
| 693 | * |
| 694 | * Returns: the actions set on @source |
| 695 | */ |
| 696 | GdkDragActioncxx . . $ GdkDragAction# |
| 697 | gtk_drag_source_get_actionscxx . . $ gtk_drag_source_get_actions(246e3468cd23a7f6). (GtkDragSourcecxx . . $ GtkDragSource# *source) |
| 698 | { |
| 699 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:41:9`! (source), GDK_ACTION_NONE); |
| 700 | |
| 701 | return source->actionscxx . . $ _GtkDragSource#actions.; |
| 702 | } |
| 703 | |
| 704 | /** |
| 705 | * gtk_drag_source_set_actions: |
| 706 | * @source: a `GtkDragSource` |
| 707 | * @actions: the actions to offer |
| 708 | * |
| 709 | * Sets the actions on the `GtkDragSource`. |
| 710 | * |
| 711 | * During a DND operation, the actions are offered to potential |
| 712 | * drop targets. If @actions include %GDK_ACTION_MOVE, you need |
| 713 | * to listen to the [[email protected]::drag-end] signal and |
| 714 | * handle @delete_data being %TRUE. |
| 715 | * |
| 716 | * This function can be called before a drag is started, |
| 717 | * or in a handler for the [[email protected]::prepare] signal. |
| 718 | */ |
| 719 | void |
| 720 | gtk_drag_source_set_actionscxx . . $ gtk_drag_source_set_actions(d33ed6181cd06da6). (GtkDragSourcecxx . . $ GtkDragSource# *source, |
| 721 | GdkDragActioncxx . . $ GdkDragAction# actions) |
| 722 | { |
| 723 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:41:9`! (source)); |
| 724 | |
| 725 | if (source->actionscxx . . $ _GtkDragSource#actions. == actions) |
| 726 | return; |
| 727 | |
| 728 | source->actionscxx . . $ _GtkDragSource#actions. = actions; |
| 729 | |
| 730 | g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (source), propertiescxx . . $ properties.[PROP_ACTIONScxx . . $ PROP_ACTIONS.]); |
| 731 | } |
| 732 | |
| 733 | /** |
| 734 | * gtk_drag_source_set_icon: |
| 735 | * @source: a `GtkDragSource` |
| 736 | * @paintable: (nullable): the `GdkPaintable` to use as icon |
| 737 | * @hot_x: the hotspot X coordinate on the icon |
| 738 | * @hot_y: the hotspot Y coordinate on the icon |
| 739 | * |
| 740 | * Sets a paintable to use as icon during DND operations. |
| 741 | * |
| 742 | * The hotspot coordinates determine the point on the icon |
| 743 | * that gets aligned with the hotspot of the cursor. |
| 744 | * |
| 745 | * If @paintable is %NULL, a default icon is used. |
| 746 | * |
| 747 | * This function can be called before a drag is started, or in |
| 748 | * a [[email protected]::prepare] or |
| 749 | * [[email protected]::drag-begin] signal handler. |
| 750 | */ |
| 751 | void |
| 752 | gtk_drag_source_set_iconcxx . . $ gtk_drag_source_set_icon(d327924272dba5ff). (GtkDragSourcecxx . . $ GtkDragSource# *source, |
| 753 | GdkPaintablecxx . . $ GdkPaintable# *paintable, |
| 754 | int hot_x, |
| 755 | int hot_y) |
| 756 | { |
| 757 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:41:9`! (source)); |
| 758 | |
| 759 | g_set_objectcxx . . $ `<external>/1341695927569185362/gobject.h:762:9`! (&source->paintable, paintable); |
| 760 | |
| 761 | source->hot_xcxx . . $ _GtkDragSource#hot_x. = hot_x; |
| 762 | source->hot_ycxx . . $ _GtkDragSource#hot_y. = hot_y; |
| 763 | } |
| 764 | |
| 765 | /** |
| 766 | * gtk_drag_source_get_drag: |
| 767 | * @source: a `GtkDragSource` |
| 768 | * |
| 769 | * Returns the underlying `GdkDrag` object for an ongoing drag. |
| 770 | * |
| 771 | * Returns: (nullable) (transfer none): the `GdkDrag` of the current |
| 772 | * drag operation |
| 773 | */ |
| 774 | GdkDragcxx . . $ GdkDrag# * |
| 775 | gtk_drag_source_get_dragcxx . . $ gtk_drag_source_get_drag(d0a8e6a577aa7cc3). (GtkDragSourcecxx . . $ GtkDragSource# *source) |
| 776 | { |
| 777 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:41:9`! (source), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 778 | |
| 779 | return source->dragcxx . . $ _GtkDragSource#drag.; |
| 780 | } |
| 781 | |
| 782 | /** |
| 783 | * gtk_drag_source_drag_cancel: |
| 784 | * @source: a `GtkDragSource` |
| 785 | * |
| 786 | * Cancels a currently ongoing drag operation. |
| 787 | */ |
| 788 | void |
| 789 | gtk_drag_source_drag_cancelcxx . . $ gtk_drag_source_drag_cancel(3c6a58a4cfc55898). (GtkDragSourcecxx . . $ GtkDragSource# *source) |
| 790 | { |
| 791 | g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_DRAG_SOURCEcxx . . $ `gtk/gtkdragsource.h:41:9`! (source)); |
| 792 | |
| 793 | if (source->dragcxx . . $ _GtkDragSource#drag.) |
| 794 | { |
| 795 | gbooleancxx . . $ gboolean# success = FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 796 | |
| 797 | g_signal_emitcxx . . $ g_signal_emit(cc3f7c2ba1c6a182). (source, signalscxx . . $ signals.[DRAG_CANCELcxx . . $ DRAG_CANCEL.], 0, source->dragcxx . . $ _GtkDragSource#drag., GDK_DRAG_CANCEL_ERRORcxx . . $ GDK_DRAG_CANCEL_ERROR., &success); |
| 798 | drag_endcxx . . $ drag_end(e01b7ef71ea50db9). (source, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 799 | } |
| 800 | } |
| 801 | |
| 802 | /** |
| 803 | * gtk_drag_check_threshold: (method) |
| 804 | * @widget: a widget |
| 805 | * @start_x: X coordinate of start of drag |
| 806 | * @start_y: Y coordinate of start of drag |
| 807 | * @current_x: current X coordinate |
| 808 | * @current_y: current Y coordinate |
| 809 | * |
| 810 | * Checks to see if a drag movement has passed the GTK drag threshold. |
| 811 | * |
| 812 | * Returns: true if the drag threshold has been passed |
| 813 | */ |
| 814 | gbooleancxx . . $ gboolean# |
| 815 | gtk_drag_check_thresholdcxx . . $ gtk_drag_check_threshold(aaf15aebd3c298e4). (GtkWidgetcxx . . $ GtkWidget# *widget, |
| 816 | int start_x, |
| 817 | int start_y, |
| 818 | int current_x, |
| 819 | int current_y) |
| 820 | { |
| 821 | int drag_threshold; |
| 822 | |
| 823 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_WIDGETcxx . . $ `gtk/gtkwidget.h:46:9`! (widget), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 824 | |
| 825 | drag_threshold = gtk_settings_get_dnd_drag_thresholdcxx . . $ gtk_settings_get_dnd_drag_threshold(8c2d6b4329623181). (gtk_widget_get_settingscxx . . $ gtk_widget_get_settings(ffe4fbf99830fa29). (widget)); |
| 826 | |
| 827 | return (ABScxx . . $ `<external>/12741050725406041920/gmacros.h:981:9`! (current_x - start_x) > drag_threshold || |
| 828 | ABScxx . . $ `<external>/12741050725406041920/gmacros.h:981:9`! (current_y - start_y) > drag_threshold); |
| 829 | } |
| 830 | |
| 831 | gbooleancxx . . $ gboolean# |
| 832 | gtk_drag_check_threshold_doublecxx . . $ gtk_drag_check_threshold_double(e6a6e33a050930d2). (GtkWidgetcxx . . $ GtkWidget# *widget, |
| 833 | double start_x, |
| 834 | double start_y, |
| 835 | double current_x, |
| 836 | double current_y) |
| 837 | { |
| 838 | int drag_threshold; |
| 839 | |
| 840 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_WIDGETcxx . . $ `gtk/gtkwidget.h:46:9`! (widget), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 841 | |
| 842 | drag_threshold = gtk_settings_get_dnd_drag_thresholdcxx . . $ gtk_settings_get_dnd_drag_threshold(8c2d6b4329623181). (gtk_widget_get_settingscxx . . $ gtk_widget_get_settings(ffe4fbf99830fa29). (widget)); |
| 843 | |
| 844 | return (ABScxx . . $ `<external>/12741050725406041920/gmacros.h:981:9`! (current_x - start_x) > drag_threshold || |
| 845 | ABScxx . . $ `<external>/12741050725406041920/gmacros.h:981:9`! (current_y - start_y) > drag_threshold); |
| 846 | } |