[gtk/wip/matthiasc/popup5: 157/234] Rename surface constructors
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/popup5: 157/234] Rename surface constructors
- Date: Mon, 27 May 2019 13:35:19 +0000 (UTC)
commit 90f121918d5b39cddcbb131bd2a458d88d434863
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 | 30 +++++++++++++++++-------------
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, 36 insertions(+), 33 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index 38683fd479..e3fa979d66 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 381cdd00d0..87e29441ed 100644
--- a/docs/reference/gtk/migrating-3to4.xml
+++ b/docs/reference/gtk/migrating-3to4.xml
@@ -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
diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c
index 980f4090a0..dcb6a9eb42 100644
--- a/gdk/broadway/gdksurface-broadway.c
+++ b/gdk/broadway/gdksurface-broadway.c
@@ -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);
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index bbee87659c..182df6864f 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -470,6 +470,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,
@@ -494,7 +495,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);
@@ -508,8 +509,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
**/
@@ -520,33 +520,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,
- 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);
}
/**
- * 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
*
@@ -558,15 +560,17 @@ gdk_surface_new_popup (GdkDisplay *display,
* Returns: (transfer full): a new #GdkSurface
*/
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 9d486e1543..1e8ecf3474 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 1ae6d1813b..7d17dee28f 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -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;
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c
index 5196b552ba..8c1e9869ea 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);
@@ -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,
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 802d42dfab..11c9d97755 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -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),
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 4aca9c31ec..c856ae546c 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -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);
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 98c54083c3..3f8610ea61 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -494,7 +494,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);
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 5ce9d70c5c..ca8d34e053 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -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);
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]