From 1ef805328fca0abf0841bb15af78c2b752ef7ec1 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 18 Dec 2019 16:47:31 +0100 Subject: [PATCH 1/3] builder: Allow for objects Previously, object properties had to always be set to a value. This now works without it. --- gtk/gtkbuilder.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c index c728ba6116..3f8ba5329e 100644 --- a/gtk/gtkbuilder.c +++ b/gtk/gtkbuilder.c @@ -527,7 +527,14 @@ gtk_builder_get_parameters (GtkBuilder *builder, const char *property_name = g_intern_string (prop->pspec->name); GValue property_value = G_VALUE_INIT; - if (G_IS_PARAM_SPEC_OBJECT (prop->pspec) && + if (prop->bound && (!prop->text || prop->text->len == 0)) + { + /* Ignore properties with a binding and no value since they are + * only there for to express the binding. + */ + continue; + } + else if (G_IS_PARAM_SPEC_OBJECT (prop->pspec) && (G_PARAM_SPEC_VALUE_TYPE (prop->pspec) != GDK_TYPE_PIXBUF) && (G_PARAM_SPEC_VALUE_TYPE (prop->pspec) != GDK_TYPE_TEXTURE) && (G_PARAM_SPEC_VALUE_TYPE (prop->pspec) != GDK_TYPE_PAINTABLE) && @@ -564,13 +571,6 @@ gtk_builder_get_parameters (GtkBuilder *builder, continue; } } - else if (prop->bound && (!prop->text || prop->text->len == 0)) - { - /* Ignore properties with a binding and no value since they are - * only there for to express the binding. - */ - continue; - } else if (!gtk_builder_value_from_string (builder, prop->pspec, prop->text->str, &property_value, From 3c1cca13b706351fba15f253468fb3e2bee6378e Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 6 Feb 2019 11:55:33 +0100 Subject: [PATCH 2/3] wayland: Remove function declaration for nonexisting function --- gdk/wayland/gdkwaylandsurface.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/gdk/wayland/gdkwaylandsurface.h b/gdk/wayland/gdkwaylandsurface.h index b7b73ba8ef..57decfcf3d 100644 --- a/gdk/wayland/gdkwaylandsurface.h +++ b/gdk/wayland/gdkwaylandsurface.h @@ -45,9 +45,6 @@ typedef struct _GdkWaylandSurfaceClass GdkWaylandSurfaceClass; GDK_AVAILABLE_IN_ALL GType gdk_wayland_surface_get_type (void); -GDK_AVAILABLE_IN_ALL -GdkSurface * gdk_wayland_surface_new_subsurface (GdkDisplay *display, - const GdkRectangle *position); GDK_AVAILABLE_IN_ALL struct wl_surface *gdk_wayland_surface_get_wl_surface (GdkSurface *surface); From f1d6a0a4edb2f14fea045b53bceed05ce9246f8c Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 19 Oct 2019 05:15:15 +0200 Subject: [PATCH 3/3] widget: Add gtk_widget_get_size() A little bit of convenience. --- docs/reference/gtk/gtk4-sections.txt | 1 + gtk/gtkwidget.c | 25 +++++++++++++++++++++++++ gtk/gtkwidget.h | 3 +++ 3 files changed, 29 insertions(+) diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt index 085b77d7ca..97d20ece0b 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -4011,6 +4011,7 @@ gtk_widget_get_allocation gtk_widget_get_allocated_baseline gtk_widget_get_width gtk_widget_get_height +gtk_widget_get_size gtk_widget_compute_bounds gtk_widget_compute_transform gtk_widget_compute_point diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 27bec07c23..f667a5d8d4 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -12254,6 +12254,31 @@ gtk_widget_get_height (GtkWidget *widget) return priv->height; } +/** + * gtk_widget_get_size: + * @widget: a #GtkWidget + * @orientation: the orientation to query + * + * Returns the content width or height of the widget, depending on @orientation. + * This is equivalent to calling gtk_widget_get_width() for %GTK_ORIENTATION_HORIZONTAL + * or gtk_widget_get_height() for %GTK_ORIENTATION_VERTICAL, but can be used when + * writing orientation-independent code, such as when implementing #GtkOrientable + * widgets. + * + * Returns: The size of @widget in @orientation. + */ +int +gtk_widget_get_size (GtkWidget *widget, + GtkOrientation orientation) +{ + g_return_val_if_fail (GTK_IS_WIDGET (widget), 0); + + if (orientation == GTK_ORIENTATION_HORIZONTAL) + return gtk_widget_get_width (widget); + else + return gtk_widget_get_height (widget); +} + /** * gtk_widget_class_set_layout_manager_type: * @widget_class: class to set the layout manager type for diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 278c1228c7..de0cf97ed8 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -525,6 +525,9 @@ GDK_AVAILABLE_IN_ALL int gtk_widget_get_width (GtkWidget *widget); GDK_AVAILABLE_IN_ALL int gtk_widget_get_height (GtkWidget *widget); +GDK_AVAILABLE_IN_ALL +int gtk_widget_get_size (GtkWidget *widget, + GtkOrientation orientation); GDK_AVAILABLE_IN_ALL gboolean gtk_widget_child_focus (GtkWidget *widget,