Rename surface constructors

We want to use a gdk_surface_new_popup for popups,
and align the constructor names with the surface
types, so rename

gdk_surface_new_popup -> gdk_surface_new_temp
gdk_surface_new_popup_full -> gdk_surface_new_popup

The temp surface type will disappear eventually.
This commit is contained in:
Matthias Clasen 2019-04-21 16:51:10 +00:00
parent 0571fc265b
commit d2951d3aac
16 changed files with 36 additions and 33 deletions

View File

@ -179,8 +179,8 @@ GdkSurfaceEdge
GdkSurfaceTypeHint
GdkSurfaceState
gdk_surface_new_toplevel
gdk_surface_new_temp
gdk_surface_new_popup
gdk_surface_new_child
gdk_surface_destroy
gdk_surface_get_surface_type
gdk_surface_get_display

View File

@ -265,9 +265,8 @@
<para>
The gdk_window_new() function has been replaced by a number of more
specialized constructors: gdk_surface_new_toplevel(), gdk_surface_new_popup(),
gdk_surface_new_temp(), gdk_surface_new_child(), gdk_surface_new_input(),
gdk_wayland_surface_new_subsurface(). Use the appropriate ones to create
your windows.
gdk_surface_new_temp(), gdk_wayland_surface_new_subsurface().
Use the appropriate ones to create your windows.
</para>
<para>
Native and foreign subwindows are no longer supported. These concepts were

View File

@ -1083,7 +1083,7 @@ create_moveresize_surface (MoveResizeData *mv_resize,
g_assert (mv_resize->moveresize_emulation_surface == NULL);
mv_resize->moveresize_emulation_surface = gdk_surface_new_popup (mv_resize->display, &rect);
mv_resize->moveresize_emulation_surface = gdk_surface_new_temp (mv_resize->display, &rect);
gdk_surface_show (mv_resize->moveresize_emulation_surface);

View File

@ -476,6 +476,7 @@ _gdk_surface_update_size (GdkSurface *surface)
static GdkSurface *
gdk_surface_new (GdkDisplay *display,
GdkSurfaceType surface_type,
GdkSurface *parent,
int x,
int y,
int width,
@ -500,7 +501,7 @@ gdk_surface_new (GdkDisplay *display,
gdk_surface_set_frame_clock (surface, frame_clock);
g_object_unref (frame_clock);
gdk_display_create_surface_impl (display, surface, NULL);
gdk_display_create_surface_impl (display, surface, parent);
surface->impl_surface = surface;
g_signal_connect (display, "seat-removed", G_CALLBACK (seat_removed_cb), surface);
@ -514,8 +515,7 @@ gdk_surface_new (GdkDisplay *display,
* @width: width of new surface
* @height: height of new surface
*
* Creates a new toplevel surface. The surface will be managed by the surface
* manager.
* Creates a new toplevel surface.
*
* Returns: (transfer full): the new #GdkSurface
**/
@ -526,33 +526,35 @@ gdk_surface_new_toplevel (GdkDisplay *display,
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return gdk_surface_new (display, GDK_SURFACE_TOPLEVEL, 0, 0, width, height);
return gdk_surface_new (display, GDK_SURFACE_TOPLEVEL,
NULL, 0, 0, width, height);
}
/**
* gdk_surface_new_popup: (constructor)
* gdk_surface_new_temp: (constructor)
* @display: the display to create the surface on
* @position: position of the surface on screen
*
* Creates a new toplevel popup surface. The surface will bypass surface
* management.
* Creates a new temporary surface.
* The surface will bypass surface management.
*
* Returns: (transfer full): the new #GdkSurface
**/
GdkSurface *
gdk_surface_new_popup (GdkDisplay *display,
gdk_surface_new_temp (GdkDisplay *display,
const GdkRectangle *position)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (position != NULL, NULL);
return gdk_surface_new (display, GDK_SURFACE_TEMP,
NULL,
position->x, position->y,
position->width, position->height);
}
/**
* gdk_surface_new_popup_full: (constructor)
* gdk_surface_new_popup: (constructor)
* @display: the display to create the surface on
* @parent: the parent surface to attach the surface to
*
@ -564,7 +566,7 @@ gdk_surface_new_popup (GdkDisplay *display,
* Returns: (transfer full): a new #GdkSurface
*/
GdkSurface *
gdk_surface_new_popup_full (GdkDisplay *display,
gdk_surface_new_popup (GdkDisplay *display,
GdkSurface *parent)
{
GdkSurface *surface;
@ -572,7 +574,9 @@ gdk_surface_new_popup_full (GdkDisplay *display,
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (GDK_IS_SURFACE (parent), NULL);
surface = gdk_surface_new (display, GDK_SURFACE_TEMP, 0, 0, 100, 100);
surface = gdk_surface_new (display, GDK_SURFACE_TEMP,
NULL, 0, 0, 100, 100);
gdk_surface_set_transient_for (surface, parent);
gdk_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_MENU);

View File

@ -49,7 +49,7 @@ typedef struct _GdkGeometry GdkGeometry;
typedef enum
{
GDK_SURFACE_TOPLEVEL,
GDK_SURFACE_TEMP
GDK_SURFACE_TEMP,
} GdkSurfaceType;
/* Size restriction enumeration.
@ -435,10 +435,10 @@ GdkSurface * gdk_surface_new_toplevel (GdkDisplay *display,
int width,
int height);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_surface_new_popup (GdkDisplay *display,
GdkSurface * gdk_surface_new_temp (GdkDisplay *display,
const GdkRectangle *position);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_surface_new_popup_full (GdkDisplay *display,
GdkSurface * gdk_surface_new_popup (GdkDisplay *display,
GdkSurface *parent);
GDK_AVAILABLE_IN_ALL

View File

@ -208,7 +208,7 @@ create_dnd_surface (GdkDisplay *display)
{
GdkSurface *surface;
surface = gdk_surface_new_popup (display, &(GdkRectangle) { 0, 0, 100, 100 });
surface = gdk_surface_new_temp (display, &(GdkRectangle) { 0, 0, 100, 100 });
gdk_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_DND);

View File

@ -432,7 +432,7 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
ndevices, ncursors));
#endif
/* Create a dummy window to receive wintab events */
wintab_window = gdk_surface_new_popup (display, &(GdkRectangle) { -100, -100, 2, 2 });
wintab_window = gdk_surface_new_temp (display, &(GdkRectangle) { -100, -100, 2, 2 });
g_object_ref (wintab_window);
for (devix = 0; devix < ndevices; devix++)

View File

@ -1700,7 +1700,7 @@ create_drag_surface (GdkDisplay *display)
{
GdkSurface *surface;
surface = gdk_surface_new_popup (display, &(GdkRectangle) { 0, 0, 100, 100 });
surface = gdk_surface_new_temp (display, &(GdkRectangle) { 0, 0, 100, 100 });
gdk_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_DND);

View File

@ -1489,7 +1489,7 @@ gdk_x11_display_open (const gchar *display_name)
{
GdkRectangle rect = { -100, -100, 1, 1 };
display_x11->leader_gdk_surface = gdk_surface_new_popup (display, &rect);
display_x11->leader_gdk_surface = gdk_surface_new_temp (display, &rect);
}
(_gdk_x11_surface_get_toplevel (display_x11->leader_gdk_surface))->is_leader = TRUE;

View File

@ -1324,7 +1324,7 @@ create_drag_surface (GdkDisplay *display)
{
GdkSurface *surface;
surface = gdk_surface_new_popup (display, &(GdkRectangle) { 0, 0, 100, 100 });
surface = gdk_surface_new_temp (display, &(GdkRectangle) { 0, 0, 100, 100 });
gdk_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_DND);
@ -2053,7 +2053,7 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
display = gdk_surface_get_display (surface);
ipc_surface = gdk_surface_new_popup (display, &(GdkRectangle) { -99, -99, 1, 1 });
ipc_surface = gdk_surface_new_temp (display, &(GdkRectangle) { -99, -99, 1, 1 });
drag = (GdkDrag *) g_object_new (GDK_TYPE_X11_DRAG,
"surface", ipc_surface,

View File

@ -4108,7 +4108,7 @@ create_moveresize_surface (MoveResizeData *mv_resize,
g_assert (mv_resize->moveresize_emulation_surface == NULL);
mv_resize->moveresize_emulation_surface = gdk_surface_new_popup (mv_resize->display, &rect);
mv_resize->moveresize_emulation_surface = gdk_surface_new_temp (mv_resize->display, &rect);
gdk_surface_show (mv_resize->moveresize_emulation_surface);
status = gdk_seat_grab (gdk_device_get_seat (mv_resize->device),

View File

@ -2200,7 +2200,7 @@ menu_grab_transfer_surface_get (GtkMenu *menu)
if (!surface)
{
GdkRectangle rect = { -100, -100, 1, 1 };
surface = gdk_surface_new_popup (gtk_widget_get_display (GTK_WIDGET (menu)), &rect);
surface = gdk_surface_new_temp (gtk_widget_get_display (GTK_WIDGET (menu)), &rect);
gdk_surface_show (surface);

View File

@ -479,7 +479,7 @@ gtk_popover_realize (GtkWidget *widget)
display = gtk_widget_get_display (priv->relative_to);
priv->surface = gdk_surface_new_popup_full (display, gtk_widget_get_surface (priv->relative_to));
priv->surface = gdk_surface_new_popup (display, gtk_widget_get_surface (priv->relative_to));
gtk_widget_set_surface (widget, priv->surface);
gdk_surface_set_widget (priv->surface, widget);

View File

@ -5690,7 +5690,7 @@ gtk_window_realize (GtkWidget *widget)
allocation.height);
break;
case GTK_WINDOW_POPUP:
surface = gdk_surface_new_popup (gtk_widget_get_display (widget), &allocation);
surface = gdk_surface_new_temp (gtk_widget_get_display (widget), &allocation);
break;
default:
g_error (G_STRLOC": Unknown window type %d!", priv->type);

View File

@ -106,7 +106,7 @@ test_type (gconstpointer data)
instance = G_OBJECT (g_object_ref (gtk_settings_get_default ()));
else if (g_type_is_a (type, GDK_TYPE_SURFACE))
{
instance = G_OBJECT (g_object_ref (gdk_surface_new_popup (display,
instance = G_OBJECT (g_object_ref (gdk_surface_new_temp (display,
&(GdkRectangle) { 0, 0, 100, 100 })));
}
else if (g_type_is_a (type, GTK_TYPE_FILTER_LIST_MODEL))

View File

@ -406,7 +406,7 @@ test_type (gconstpointer data)
instance = G_OBJECT (g_object_ref (gtk_settings_get_default ()));
else if (g_type_is_a (type, GDK_TYPE_SURFACE))
{
instance = G_OBJECT (g_object_ref (gdk_surface_new_popup (display,
instance = G_OBJECT (g_object_ref (gdk_surface_new_temp (display,
&(GdkRectangle) { 0, 0, 100, 100 })));
}
else if (g_str_equal (g_type_name (type), "GdkX11Cursor"))