summaryrefslogtreecommitdiff
path: root/gdk/gdksurface.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-08-07 23:38:28 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-08-08 09:24:30 -0400
commitfd1033f974b87ffbdafc40ae8615408d73eb02d1 (patch)
treed9fd15c8dc180fad0a73447f5ec5906ec02afe7f /gdk/gdksurface.c
parent16505a4d1e351529f3a4ea0356bb538f1ecdb2d2 (diff)
downloadgtk+-fd1033f974b87ffbdafc40ae8615408d73eb02d1.tar.gz
surface: Add width and height properties
Diffstat (limited to 'gdk/gdksurface.c')
-rw-r--r--gdk/gdksurface.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 09bf78e20c..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,6 +524,20 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+ properties[PROP_WIDTH] =
+ g_param_spec_int ("width",
+ P_("Width"),
+ P_("Width"),
+ 0, G_MAXINT, 0,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+
+ 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);
/**
@@ -742,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;
@@ -755,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 *