[gtk/wip/matthiasc/popup4: 81/106] Rename surface constructors
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/popup4: 81/106] Rename surface constructors
- Date: Wed, 24 Apr 2019 11:44:05 +0000 (UTC)
commit 3d59e1e7e91b27013ce210889fa9a662a3ef376e
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Apr 21 16:51:10 2019 +0000
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.
docs/reference/gdk/gdk4-sections.txt | 2 +-
docs/reference/gtk/migrating-3to4.xml | 5 ++---
gdk/broadway/gdksurface-broadway.c | 2 +-
gdk/gdksurface.c | 28 ++++++++++++++++------------
gdk/gdksurface.h | 6 +++---
gdk/wayland/gdkdrag-wayland.c | 2 +-
gdk/win32/gdkdevicemanager-win32.c | 2 +-
gdk/win32/gdkdrag-win32.c | 2 +-
gdk/x11/gdkdisplay-x11.c | 2 +-
gdk/x11/gdkdrag-x11.c | 4 ++--
gdk/x11/gdksurface-x11.c | 2 +-
gtk/gtkmenu.c | 2 +-
gtk/gtkpopover.c | 2 +-
gtk/gtkwindow.c | 2 +-
testsuite/gtk/defaultvalue.c | 2 +-
testsuite/gtk/notify.c | 2 +-
16 files changed, 35 insertions(+), 32 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index cd804617b8..7614cca655 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -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
diff --git a/docs/reference/gtk/migrating-3to4.xml b/docs/reference/gtk/migrating-3to4.xml
index e0087db3a3..e6ae7c5520 100644
--- a/docs/reference/gtk/migrating-3to4.xml
+++ b/docs/reference/gtk/migrating-3to4.xml
@@ -259,9 +259,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
diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c
index 613e6cd7c1..0eb9519982 100644
--- a/gdk/broadway/gdksurface-broadway.c
+++ b/gdk/broadway/gdksurface-broadway.c
@@ -1080,7 +1080,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);
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index efd1c394e5..411efdb097 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -454,6 +454,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,
@@ -478,7 +479,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);
@@ -492,8 +493,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
**/
@@ -504,41 +504,45 @@ 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,
- const GdkRectangle *position)
+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);
}
GdkSurface *
-gdk_surface_new_popup_full (GdkDisplay *display,
- GdkSurface *parent)
+gdk_surface_new_popup (GdkDisplay *display,
+ GdkSurface *parent)
{
GdkSurface *surface;
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);
diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h
index e1e0c53d0d..03bc5f02f3 100644
--- a/gdk/gdksurface.h
+++ b/gdk/gdksurface.h
@@ -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
diff --git a/gdk/wayland/gdkdrag-wayland.c b/gdk/wayland/gdkdrag-wayland.c
index b163a17139..6da90dca49 100644
--- a/gdk/wayland/gdkdrag-wayland.c
+++ b/gdk/wayland/gdkdrag-wayland.c
@@ -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);
diff --git a/gdk/win32/gdkdevicemanager-win32.c b/gdk/win32/gdkdevicemanager-win32.c
index cc396f0563..85be7bf06b 100644
--- a/gdk/win32/gdkdevicemanager-win32.c
+++ b/gdk/win32/gdkdevicemanager-win32.c
@@ -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++)
diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c
index 318013c2d9..f4806ac30f 100644
--- a/gdk/win32/gdkdrag-win32.c
+++ b/gdk/win32/gdkdrag-win32.c
@@ -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);
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index e37447e32f..398ce7b22c 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -1486,7 +1486,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;
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c
index 43779168ff..f40ff8de5c 100644
--- a/gdk/x11/gdkdrag-x11.c
+++ b/gdk/x11/gdkdrag-x11.c
@@ -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);
@@ -2084,7 +2084,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,
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index c5ca8a16f9..fe27a00e20 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -4084,7 +4084,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),
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 33054f719b..c66b59f056 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -2192,7 +2192,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);
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index e60eb43741..13fd55f13f 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -449,7 +449,7 @@ gtk_popover_realize (GtkWidget *widget)
gtk_widget_get_surface_allocation (priv->relative_to, &parent_rect);
- priv->surface = gdk_surface_new_popup_full (priv->display, gtk_widget_get_surface (priv->relative_to));
+ priv->surface = gdk_surface_new_popup (priv->display, gtk_widget_get_surface (priv->relative_to));
gtk_widget_set_surface (widget, priv->surface);
gdk_surface_set_widget (priv->surface, widget);
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 9b8a1b071e..1dd1e367ec 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5763,7 +5763,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);
diff --git a/testsuite/gtk/defaultvalue.c b/testsuite/gtk/defaultvalue.c
index ae7849f1c7..1ac3bdfe97 100644
--- a/testsuite/gtk/defaultvalue.c
+++ b/testsuite/gtk/defaultvalue.c
@@ -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))
diff --git a/testsuite/gtk/notify.c b/testsuite/gtk/notify.c
index e1622059da..40c16cb746 100644
--- a/testsuite/gtk/notify.c
+++ b/testsuite/gtk/notify.c
@@ -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"))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]