summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2023-04-21 20:52:58 +0200
committerBenjamin Otte <otte@redhat.com>2023-04-26 21:03:34 +0200
commit486196c979e004e745eb9f2ba3c81c1932f0d8a5 (patch)
treef13c9fdba3093a5d9cb17cede4bc4caeae65f3f5
parent83faacabe3e66d02ae32a76b718abeca05ecb985 (diff)
downloadgtk+-486196c979e004e745eb9f2ba3c81c1932f0d8a5.tar.gz
x11: Add private gdk_x11_drag_surface_new()
... and use it.
-rw-r--r--gdk/x11/gdkdisplay-x11.c4
-rw-r--r--gdk/x11/gdkdrag-x11.c18
-rw-r--r--gdk/x11/gdksurface-x11.c18
-rw-r--r--gdk/x11/gdksurface-x11.h2
4 files changed, 15 insertions, 27 deletions
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index ba03482b8c..c8786a5601 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -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);
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c
index abd2f138ab..97e0038a89 100644
--- a/gdk/x11/gdkdrag-x11.c
+++ b/gdk/x11/gdkdrag-x11.c
@@ -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))
{
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 2cb30b6ac6..fd4b29945e 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -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);
+}
+
diff --git a/gdk/x11/gdksurface-x11.h b/gdk/x11/gdksurface-x11.h
index c548cd206a..2967cf1b66 100644
--- a/gdk/x11/gdksurface-x11.h
+++ b/gdk/x11/gdksurface-x11.h
@@ -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);