G_DEFINE_INTERFACE (GdkDragSurface, gdk_drag_surface, GDK_TYPE_SURFACE)
+enum
+{
+ COMPUTE_SIZE,
+
+ N_SIGNALS
+};
+
+static guint signals[N_SIGNALS] = { 0 };
+
+void
+gdk_drag_surface_notify_compute_size (GdkDragSurface *surface,
+ GdkDragSurfaceSize *size)
+{
+ g_signal_emit (surface, signals[COMPUTE_SIZE], 0, size);
+}
+
static gboolean
gdk_drag_surface_default_present (GdkDragSurface *drag_surface,
int width,
gdk_drag_surface_default_init (GdkDragSurfaceInterface *iface)
{
iface->present = gdk_drag_surface_default_present;
+
+ /**
+ * GdkDragSurface::compute-size:
+ * @surface: a `GdkDragSurface`
+ * @size: (type Gdk.DragSurfaceSize) (out caller-allocates): a
+ * `GdkDragSurfaceSize`
+ *
+ * Emitted when the size for the surface needs to be computed, when it is
+ * present.
+ *
+ * It will normally be emitted during the native surface layout cycle when the
+ * surface size needs to be recomputed.
+ *
+ * It is the responsibility of the drag surface user to handle this signal and
+ * compute the desired size of the surface, storing the computed size in the
+ * [struct@Gdk.DragSurfaceSize] object. Failing to do so will result in an
+ * arbitrary size being used as a result.
+ *
+ * Since: 4.12
+ */
+ signals[COMPUTE_SIZE] =
+ g_signal_new (I_("compute-size"),
+ GDK_TYPE_DRAG_SURFACE,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ NULL,
+ G_TYPE_NONE, 1,
+ GDK_TYPE_DRAG_SURFACE_SIZE);
}
/**
#define __GDK_DRAG_SURFACE_PRIVATE_H__
#include "gdkdragsurface.h"
+#include "gdkdragsurfacesize.h"
G_BEGIN_DECLS
int height);
};
+void gdk_drag_surface_notify_compute_size (GdkDragSurface *surface,
+ GdkDragSurfaceSize *size);
+
G_END_DECLS
#endif /* __GDK_DRAG_SURFACE_PRIVATE_H__ */