x11: Add private gdk_x11_drag_surface_new()

... and use it.
This commit is contained in:
Benjamin Otte 2023-04-21 20:52:58 +02:00
parent 83faacabe3
commit 486196c979
4 changed files with 15 additions and 27 deletions

View File

@ -1391,9 +1391,7 @@ gdk_x11_display_init_leader_surface (GdkX11Display *self)
gdk_event_init (display);
self->leader_gdk_surface = gdk_x11_display_create_surface (display,
GDK_SURFACE_DRAG,
NULL);
self->leader_gdk_surface = gdk_x11_drag_surface_new (display);
(_gdk_x11_surface_get_toplevel (self->leader_gdk_surface))->is_leader = TRUE;
self->leader_window = GDK_SURFACE_XID (self->leader_gdk_surface);

View File

@ -1255,18 +1255,6 @@ gdk_drag_do_leave (GdkX11Drag *drag_x11)
}
}
static GdkSurface *
create_drag_surface (GdkDisplay *display)
{
GdkSurface *surface;
surface = gdk_x11_display_create_surface (display,
GDK_SURFACE_DRAG,
NULL);
return surface;
}
static Window
_gdk_x11_display_get_drag_protocol (GdkDisplay *display,
Window xid,
@ -2000,9 +1988,7 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
display = gdk_surface_get_display (surface);
ipc_surface = gdk_x11_display_create_surface (display,
GDK_SURFACE_DRAG,
NULL);
ipc_surface = gdk_x11_drag_surface_new (display);
drag = (GdkDrag *) g_object_new (GDK_TYPE_X11_DRAG,
"surface", ipc_surface,
@ -2036,7 +2022,7 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
gdk_surface_set_is_mapped (x11_drag->ipc_surface, TRUE);
gdk_x11_surface_show (x11_drag->ipc_surface, FALSE);
x11_drag->drag_surface = create_drag_surface (display);
x11_drag->drag_surface = gdk_x11_drag_surface_new (display);
if (!drag_grab (drag))
{

View File

@ -1260,10 +1260,6 @@ gdk_x11_display_create_surface (GdkDisplay *display,
NULL);
break;
case GDK_SURFACE_DRAG:
surface = g_object_new (GDK_TYPE_X11_DRAG_SURFACE,
"display", display,
NULL);
break;
default:
g_assert_not_reached ();
break;
@ -4354,10 +4350,7 @@ create_moveresize_surface (MoveResizeData *mv_resize,
g_assert (mv_resize->moveresize_emulation_surface == NULL);
mv_resize->moveresize_emulation_surface =
gdk_x11_display_create_surface (mv_resize->display,
GDK_SURFACE_DRAG,
NULL);
mv_resize->moveresize_emulation_surface = gdk_x11_drag_surface_new (mv_resize->display);
gdk_surface_set_is_mapped (mv_resize->moveresize_emulation_surface, TRUE);
gdk_x11_surface_show (mv_resize->moveresize_emulation_surface, FALSE);
@ -5453,3 +5446,12 @@ gdk_x11_drag_surface_iface_init (GdkDragSurfaceInterface *iface)
{
iface->present = gdk_x11_drag_surface_present;
}
GdkSurface *
gdk_x11_drag_surface_new (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_X11_DRAG_SURFACE,
"display", display,
NULL);
}

View File

@ -191,6 +191,8 @@ struct _GdkToplevelX11
#endif
};
GdkSurface *gdk_x11_drag_surface_new (GdkDisplay *display);
GdkToplevelX11 *_gdk_x11_surface_get_toplevel (GdkSurface *window);
GdkCursor *_gdk_x11_surface_get_cursor (GdkSurface *window);