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 <mclasen@redhat.com>
18 */
19
20#include "config.h"
21
22#include "gdk-private.h"
23#include "gdkdragsurfaceprivate.h"
24#include "gdkintl.h"
25
26/**
27 * GdkDragSurface:
28 *
29 * A `GdkDragSurface` is an interface for surfaces used during DND.
30 */
31
32/**
33 * GdkDragSurfaceInterface:
34 *
35 * The `GdkDragSurfaceInterface` implementation is private to GDK.
36 */
37
38G_DEFINE_INTERFACE (GdkDragSurface, gdk_drag_surface, GDK_TYPE_SURFACE)
39
40static gboolean
41gdk_drag_surface_default_present (GdkDragSurface *drag_surface,
42 int width,
43 int height)
44{
45 return FALSE;
46}
47
48static void
49gdk_drag_surface_default_init (GdkDragSurfaceInterface *iface)
50{
51 iface->present = gdk_drag_surface_default_present;
52}
53
54/**
55 * gdk_drag_surface_present:
56 * @drag_surface: the `GdkDragSurface` to show
57 * @width: the unconstrained drag_surface width to layout
58 * @height: the unconstrained drag_surface height to layout
59 *
60 * Present @drag_surface.
61 *
62 * Returns: %FALSE if it failed to be presented, otherwise %TRUE.
63 */
64gboolean
65gdk_drag_surface_present (GdkDragSurface *drag_surface,
66 int width,
67 int height)
68{
69 g_return_val_if_fail (GDK_IS_DRAG_SURFACE (drag_surface), FALSE);
70 g_return_val_if_fail (width > 0, FALSE);
71 g_return_val_if_fail (height > 0, FALSE);
72
73 return GDK_DRAG_SURFACE_GET_IFACE (ptr: drag_surface)->present (drag_surface, width, height);
74}
75

source code of gtk/gdk/gdkdragsurface.c