| 1 | /* |
| 2 | * Copyright © 2020 Red Hat, Inc. |
| 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.1 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 | * Authors: Matthias Clasen <[email protected]> |
| 18 | */ |
| 19 | |
| 20 | #include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 21 | |
| 22 | #include "gdkprivate.h"cxx . . $ `<file>/gdk/gdkprivate.h`/ |
| 23 | #include "gdkdragsurfaceprivate.h"cxx . . $ `<file>/gdk/gdkdragsurfaceprivate.h`/ |
| 24 | #include <glib/gi18n-lib.h> |
| 25 | |
| 26 | /** |
| 27 | * GdkDragSurface: |
| 28 | * |
| 29 | * A surface that is used during DND. |
| 30 | */ |
| 31 | |
| 32 | /** |
| 33 | * GdkDragSurfaceInterface: |
| 34 | * |
| 35 | * The `GdkDragSurfaceInterface` implementation is private to GDK. |
| 36 | */ |
| 37 | |
| 38 | G_DEFINE_INTERFACEcxx . . $ `<external>/9567554376676449156/gtype.h:2078:9`! (GdkDragSurface, gdk_drag_surface, GDK_TYPE_SURFACEcxx . . $ `gdk/gdksurface.h:41:9`!) |
| 39 | |
| 40 | enumcxx . . $ $anonymous_type_5a5dd486d83ad578_0# |
| 41 | { |
| 42 | COMPUTE_SIZEcxx . . $ COMPUTE_SIZE., |
| 43 | |
| 44 | N_SIGNALScxx . . $ N_SIGNALS. |
| 45 | }; |
| 46 | |
| 47 | static guintcxx . . $ guint# signalscxx . . $ signals.[N_SIGNALScxx . . $ N_SIGNALS.] = { 0 }; |
| 48 | |
| 49 | void |
| 50 | gdk_drag_surface_notify_compute_sizecxx . . $ gdk_drag_surface_notify_compute_size(6a4437b1a8a28fb1). (GdkDragSurfacecxx . . $ GdkDragSurface# *surface, |
| 51 | GdkDragSurfaceSizecxx . . $ GdkDragSurfaceSize# *size) |
| 52 | { |
| 53 | g_signal_emitcxx . . $ g_signal_emit(cc3f7c2ba1c6a182). (surface, signalscxx . . $ signals.[COMPUTE_SIZEcxx . . $ COMPUTE_SIZE.], 0, size); |
| 54 | } |
| 55 | |
| 56 | static gbooleancxx . . $ gboolean# |
| 57 | gdk_drag_surface_default_presentcxx . . $ gdk_drag_surface_default_present(248ed9352d839e26). (GdkDragSurfacecxx . . $ GdkDragSurface# *drag_surface, |
| 58 | int width, |
| 59 | int height) |
| 60 | { |
| 61 | return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!; |
| 62 | } |
| 63 | |
| 64 | static void |
| 65 | gdk_drag_surface_default_initcxx . . $ gdk_drag_surface_default_init(b6451acd8cc183b3). (GdkDragSurfaceInterfacecxx . . $ GdkDragSurfaceInterface# *iface) |
| 66 | { |
| 67 | iface->presentcxx . . $ _GdkDragSurfaceInterface#present. = gdk_drag_surface_default_presentcxx . . $ gdk_drag_surface_default_present(248ed9352d839e26).; |
| 68 | |
| 69 | /** |
| 70 | * GdkDragSurface::compute-size: |
| 71 | * @surface: a `GdkDragSurface` |
| 72 | * @size: (type Gdk.DragSurfaceSize): the size of the drag surface |
| 73 | * |
| 74 | * Emitted when the size for the surface needs to be computed, when it is |
| 75 | * present. |
| 76 | * |
| 77 | * This signal will normally be emitted during the native surface layout |
| 78 | * cycle when the surface size needs to be recomputed. |
| 79 | * |
| 80 | * It is the responsibility of the drag surface user to handle this signal |
| 81 | * and compute the desired size of the surface, storing the computed size |
| 82 | * in the [[email protected]] object that is passed to the signal |
| 83 | * handler, using [[email protected]_size]. |
| 84 | * |
| 85 | * Failing to set a size so will result in an arbitrary size being used as |
| 86 | * a result. |
| 87 | * |
| 88 | * Since: 4.12 |
| 89 | */ |
| 90 | signalscxx . . $ signals.[COMPUTE_SIZEcxx . . $ COMPUTE_SIZE.] = |
| 91 | g_signal_newcxx . . $ g_signal_new(b0aa5e8090fb95c0). (I_cxx . . $ `gdk/gdkprivate.h:35:9`!("compute-size"), |
| 92 | GDK_TYPE_DRAG_SURFACEcxx . . $ `gdk/gdkdragsurface.h:30:9`!, |
| 93 | G_SIGNAL_RUN_LASTcxx . . $ G_SIGNAL_RUN_LAST., |
| 94 | 0, |
| 95 | 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`!, |
| 96 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 97 | G_TYPE_NONEcxx . . $ `<external>/9567554376676449156/gtype.h:72:9`!, 1, |
| 98 | GDK_TYPE_DRAG_SURFACE_SIZEcxx . . $ `gdk/gdkdragsurfacesize.h:31:9`!); |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * gdk_drag_surface_present: |
| 103 | * @drag_surface: the `GdkDragSurface` to show |
| 104 | * @width: the unconstrained drag_surface width to layout |
| 105 | * @height: the unconstrained drag_surface height to layout |
| 106 | * |
| 107 | * Present @drag_surface. |
| 108 | * |
| 109 | * Returns: %FALSE if it failed to be presented, otherwise %TRUE. |
| 110 | */ |
| 111 | gbooleancxx . . $ gboolean# |
| 112 | gdk_drag_surface_presentcxx . . $ gdk_drag_surface_present(248ed9352d839e26). (GdkDragSurfacecxx . . $ GdkDragSurface# *drag_surface, |
| 113 | int width, |
| 114 | int height) |
| 115 | { |
| 116 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GDK_IS_DRAG_SURFACE (drag_surface), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 117 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (width > 0, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 118 | g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (height > 0, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 119 | |
| 120 | return GDK_DRAG_SURFACE_GET_IFACEcxx . . $ GDK_DRAG_SURFACE_GET_IFACE(af3a4fa0d600acc0). (drag_surface)->presentcxx . . $ _GdkDragSurfaceInterface#present. (drag_surface, width, height); |
| 121 | } |