summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-08-08 14:44:52 +0000
committerMatthias Clasen <mclasen@redhat.com>2020-08-08 14:44:52 +0000
commit8725fd308baf67119da35a549541a8f999725256 (patch)
tree66f1fee65d704407618fb8ec93bc47e6f732a876
parentc40e23bde6f8632f831ae75a52c20612b2955362 (diff)
parentfd1033f974b87ffbdafc40ae8615408d73eb02d1 (diff)
downloadgtk+-8725fd308baf67119da35a549541a8f999725256.tar.gz
Merge branch 'surface-size' into 'master'
Surface size See merge request GNOME/gtk!2415
-rw-r--r--gdk/gdkpopup.c28
-rw-r--r--gdk/gdksurface.c47
2 files changed, 55 insertions, 20 deletions
diff --git a/gdk/gdkpopup.c b/gdk/gdkpopup.c
index 8feacd4a9b..735567fc32 100644
--- a/gdk/gdkpopup.c
+++ b/gdk/gdkpopup.c
@@ -34,6 +34,15 @@
G_DEFINE_INTERFACE (GdkPopup, gdk_popup, GDK_TYPE_SURFACE)
+enum
+{
+ POPUP_LAYOUT_CHANGED,
+
+ N_SIGNALS
+};
+
+static guint signals[N_SIGNALS] = { 0 };
+
static gboolean
gdk_popup_default_present (GdkPopup *popup,
int width,
@@ -88,6 +97,25 @@ gdk_popup_default_init (GdkPopupInterface *iface)
P_("The parent surface"),
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * GdkPopup::popup-layout-changed
+ * @popup: the #GdkSurface that was laid out
+ *
+ * Emitted when the layout of a popup surface has changed, e.g. if the popup
+ * layout was reactive and after the parent moved causing the popover to end
+ * up partially off-screen.
+ */
+ signals[POPUP_LAYOUT_CHANGED] =
+ g_signal_new (g_intern_static_string ("popup-layout-changed"),
+ GDK_TYPE_POPUP,
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+ G_TYPE_NONE,
+ 0);
}
/**
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 7049d3c560..db48e34f5a 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -84,6 +84,8 @@ enum {
PROP_DISPLAY,
PROP_FRAME_CLOCK,
PROP_MAPPED,
+ PROP_WIDTH,
+ PROP_HEIGHT,
LAST_PROP
};
@@ -522,27 +524,21 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
- g_object_class_install_properties (object_class, LAST_PROP, properties);
+ properties[PROP_WIDTH] =
+ g_param_spec_int ("width",
+ P_("Width"),
+ P_("Width"),
+ 0, G_MAXINT, 0,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
- /**
- * GdkSurface::popup-layout-changed
- * @surface: the #GdkSurface that was laid out
- *
- * Emitted when the layout of a popup @surface has changed, e.g. if the popup
- * layout was reactive and after the parent moved causing the popover to end
- * up partially off-screen.
- *
- */
- signals[POPUP_LAYOUT_CHANGED] =
- g_signal_new (g_intern_static_string ("popup-layout-changed"),
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- 0,
- NULL,
- NULL,
- NULL,
- G_TYPE_NONE,
- 0);
+ properties[PROP_HEIGHT] =
+ g_param_spec_int ("height",
+ P_("Height"),
+ P_("Height"),
+ 0, G_MAXINT, 0,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, LAST_PROP, properties);
/**
* GdkSurface::size-changed:
@@ -762,6 +758,14 @@ gdk_surface_get_property (GObject *object,
g_value_set_boolean (value, GDK_SURFACE_IS_MAPPED (surface));
break;
+ case PROP_WIDTH:
+ g_value_set_int (value, surface->width);
+ break;
+
+ case PROP_HEIGHT:
+ g_value_set_int (value, surface->height);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -775,6 +779,9 @@ _gdk_surface_update_size (GdkSurface *surface)
for (l = surface->draw_contexts; l; l = l->next)
gdk_draw_context_surface_resized (l->data);
+
+ g_object_notify (G_OBJECT (surface), "width");
+ g_object_notify (G_OBJECT (surface), "height");
}
static GdkSurface *