From 9a6e6be785c45470177f2282c80748b93f53d972 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 18 Apr 2023 16:38:57 +0200 Subject: [PATCH] macos: Create drag surface directly Do not go via macos_surface_new(). --- gdk/macos/gdkmacosdragsurface-private.h | 1 - gdk/macos/gdkmacosdragsurface.c | 8 +++++++- gdk/macos/gdkmacossurface.c | 9 ++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gdk/macos/gdkmacosdragsurface-private.h b/gdk/macos/gdkmacosdragsurface-private.h index bb9bea97e1..516562bc3c 100644 --- a/gdk/macos/gdkmacosdragsurface-private.h +++ b/gdk/macos/gdkmacosdragsurface-private.h @@ -32,7 +32,6 @@ typedef struct _GdkMacosDragSurfaceClass GdkMacosDragSurfaceClass; GType _gdk_macos_drag_surface_get_type (void); GdkMacosSurface *_gdk_macos_drag_surface_new (GdkMacosDisplay *display, - GdkFrameClock *frame_clock, int x, int y, int width, diff --git a/gdk/macos/gdkmacosdragsurface.c b/gdk/macos/gdkmacosdragsurface.c index dd6d5e520e..b5041f7067 100644 --- a/gdk/macos/gdkmacosdragsurface.c +++ b/gdk/macos/gdkmacosdragsurface.c @@ -25,6 +25,8 @@ #include "gdkmacosdisplay-private.h" #include "gdkmacosutils-private.h" +#include "gdk/gdkframeclockidleprivate.h" + struct _GdkMacosDragSurface { GdkMacosSurface parent_instance; @@ -73,7 +75,6 @@ _gdk_macos_drag_surface_init (GdkMacosDragSurface *self) GdkMacosSurface * _gdk_macos_drag_surface_new (GdkMacosDisplay *display, - GdkFrameClock *frame_clock, int x, int y, int width, @@ -81,6 +82,7 @@ _gdk_macos_drag_surface_new (GdkMacosDisplay *display, { GDK_BEGIN_MACOS_ALLOC_POOL; + GdkFrameClock *frame_clock; GdkMacosWindow *window; GdkMacosSurface *self; NSScreen *screen; @@ -113,12 +115,16 @@ _gdk_macos_drag_surface_new (GdkMacosDisplay *display, [window setBackgroundColor:[NSColor clearColor]]; [window setDecorated:NO]; + frame_clock = _gdk_frame_clock_idle_new (); + self = g_object_new (GDK_TYPE_MACOS_DRAG_SURFACE, "display", display, "frame-clock", frame_clock, "native", window, NULL); + g_object_unref (frame_clock); + GDK_END_MACOS_ALLOC_POOL; return g_steal_pointer (&self); diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c index 1c2008a521..92e61d52f3 100644 --- a/gdk/macos/gdkmacossurface.c +++ b/gdk/macos/gdkmacossurface.c @@ -429,10 +429,8 @@ gdk_macos_surface_drag_begin (GdkSurface *surface, gdk_macos_device_query_state (device, surface, NULL, &px, &py, NULL); _gdk_macos_surface_get_root_coords (GDK_MACOS_SURFACE (surface), &sx, &sy); - drag_surface = _gdk_macos_surface_new (GDK_MACOS_DISPLAY (surface->display), - GDK_SURFACE_DRAG, - NULL, - sx, sy, 1, 1); + drag_surface = _gdk_macos_drag_surface_new (GDK_MACOS_DISPLAY (surface->display), + sx, sy, 1, 1); drag = g_object_new (GDK_TYPE_MACOS_DRAG, "drag-surface", drag_surface, "surface", surface, @@ -640,9 +638,6 @@ _gdk_macos_surface_new (GdkMacosDisplay *display, break; case GDK_SURFACE_DRAG: - ret = _gdk_macos_drag_surface_new (display, frame_clock, x, y, width, height); - break; - default: g_warn_if_reached (); ret = NULL; -- 2.30.2