[gtk/present-toplevel-2: 52/79] surface: Implement GdkDragSurface
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/present-toplevel-2: 52/79] surface: Implement GdkDragSurface
- Date: Mon, 9 Mar 2020 15:35:57 +0000 (UTC)
commit 936d8495c7823ef966c34f1fac7bc9f1bbb84ba7
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Mar 3 15:57:54 2020 -0800
surface: Implement GdkDragSurface
gdk/gdksurface.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
---
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 24016663ff..777df4644a 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -40,6 +40,7 @@
#include "gdkglcontextprivate.h"
#include "gdkpopupprivate.h"
#include "gdktoplevelprivate.h"
+#include "gdkdragsurfaceprivate.h"
#include "gdk-private.h"
#include <math.h>
@@ -113,12 +114,15 @@ static GParamSpec *properties[LAST_PROP] = { NULL, };
static void gdk_surface_popup_init (GdkPopupInterface *iface);
static void gdk_surface_toplevel_init (GdkToplevelInterface *iface);
+static void gdk_surface_drag_surface_init (GdkDragSurfaceInterface *iface);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GdkSurface, gdk_surface, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GDK_TYPE_POPUP,
gdk_surface_popup_init)
G_IMPLEMENT_INTERFACE (GDK_TYPE_TOPLEVEL,
- gdk_surface_toplevel_init))
+ gdk_surface_toplevel_init)
+ G_IMPLEMENT_INTERFACE (GDK_TYPE_DRAG_SURFACE,
+ gdk_surface_drag_surface_init))
static gboolean
gdk_surface_real_beep (GdkSurface *surface)
@@ -2153,6 +2157,27 @@ gdk_surface_toplevel_init (GdkToplevelInterface *iface)
iface->show_window_menu = gdk_toplevel_surface_show_window_menu;
}
+static gboolean
+gdk_drag_surface_real_present (GdkDragSurface *drag_surface,
+ int width,
+ int height)
+{
+ GdkSurface *surface = GDK_SURFACE (drag_surface);
+
+ g_return_val_if_fail (surface->surface_type == GDK_SURFACE_TEMP, FALSE);
+
+ GDK_SURFACE_GET_CLASS (surface)->toplevel_resize (surface, width, height);
+ gdk_surface_show_internal (surface, TRUE);
+
+ return TRUE;
+}
+
+static void
+gdk_surface_drag_surface_init (GdkDragSurfaceInterface *iface)
+{
+ iface->present = gdk_drag_surface_real_present;
+}
+
static void
gdk_surface_set_cursor_internal (GdkSurface *surface,
GdkDevice *device,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]