diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-05-28 19:43:01 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-05-28 20:25:17 +0000 |
commit | 908632138c40e4711e87e64d25d6f8df6e19dd9b (patch) | |
tree | 01992aeeef6b3779e47c11c97ef8a8a381e6085f /gtk/inspector | |
parent | 84739dde99b86737a09800d11a81e2ef715c2923 (diff) | |
download | gtk+-908632138c40e4711e87e64d25d6f8df6e19dd9b.tar.gz |
inspector: Show surface and renderer
Diffstat (limited to 'gtk/inspector')
-rw-r--r-- | gtk/inspector/misc-info.c | 111 |
1 files changed, 99 insertions, 12 deletions
diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c index 4fcc929fad..90d519fed4 100644 --- a/gtk/inspector/misc-info.c +++ b/gtk/inspector/misc-info.c @@ -55,6 +55,12 @@ struct _GtkInspectorMiscInfoPrivate { GtkWidget *allocated_size; GtkWidget *baseline_row; GtkWidget *baseline; + GtkWidget *surface_row; + GtkWidget *surface; + GtkWidget *surface_button; + GtkWidget *renderer_row; + GtkWidget *renderer; + GtkWidget *renderer_button; GtkWidget *frame_clock_row; GtkWidget *frame_clock; GtkWidget *frame_clock_button; @@ -194,6 +200,26 @@ show_mnemonic_label (GtkWidget *button, GtkInspectorMiscInfo *sl) } static void +show_surface (GtkWidget *button, GtkInspectorMiscInfo *sl) +{ + GObject *surface; + + surface = (GObject *)gtk_native_get_surface (GTK_NATIVE (sl->priv->object)); + if (surface) + show_object (sl, G_OBJECT (surface), "properties"); +} + +static void +show_renderer (GtkWidget *button, GtkInspectorMiscInfo *sl) +{ + GObject *renderer; + + renderer = (GObject *)gtk_native_get_renderer (GTK_NATIVE (sl->priv->object)); + if (renderer) + show_object (sl, G_OBJECT (renderer), "properties"); +} + +static void show_frame_clock (GtkWidget *button, GtkInspectorMiscInfo *sl) { GObject *clock; @@ -204,23 +230,74 @@ show_frame_clock (GtkWidget *button, GtkInspectorMiscInfo *sl) } static void -update_frame_clock (GtkInspectorMiscInfo *sl) +update_surface (GtkInspectorMiscInfo *sl) { - GObject *clock; + if (GTK_IS_NATIVE (sl->priv->object)) + { + GObject *obj; + char *tmp; - clock = (GObject *)gtk_widget_get_frame_clock (GTK_WIDGET (sl->priv->object)); - if (clock) + gtk_widget_show (sl->priv->surface_row); + + obj = (GObject *)gtk_native_get_surface (GTK_NATIVE (sl->priv->object)); + tmp = g_strdup_printf ("%p", obj); + gtk_label_set_label (GTK_LABEL (sl->priv->surface), tmp); + g_free (tmp); + } + else + { + gtk_widget_hide (sl->priv->surface_row); + } +} + +static void +update_renderer (GtkInspectorMiscInfo *sl) +{ + if (GTK_IS_NATIVE (sl->priv->object)) { - gchar *tmp; - tmp = g_strdup_printf ("%p", clock); - gtk_label_set_label (GTK_LABEL (sl->priv->frame_clock), tmp); + GObject *obj; + char *tmp; + + gtk_widget_show (sl->priv->renderer_row); + + obj = (GObject *)gtk_native_get_surface (GTK_NATIVE (sl->priv->object)); + tmp = g_strdup_printf ("%p", obj); + gtk_label_set_label (GTK_LABEL (sl->priv->renderer), tmp); g_free (tmp); - gtk_widget_set_sensitive (sl->priv->frame_clock_button, TRUE); } else { - gtk_label_set_label (GTK_LABEL (sl->priv->frame_clock), "NULL"); - gtk_widget_set_sensitive (sl->priv->frame_clock_button, FALSE); + gtk_widget_hide (sl->priv->renderer_row); + } +} + +static void +update_frame_clock (GtkInspectorMiscInfo *sl) +{ + if (GTK_IS_ROOT (sl->priv->object)) + { + GObject *clock; + + gtk_widget_show (sl->priv->frame_clock_row); + + clock = (GObject *)gtk_widget_get_frame_clock (GTK_WIDGET (sl->priv->object)); + if (clock) + { + gchar *tmp; + tmp = g_strdup_printf ("%p", clock); + gtk_label_set_label (GTK_LABEL (sl->priv->frame_clock), tmp); + g_free (tmp); + gtk_widget_set_sensitive (sl->priv->frame_clock_button, TRUE); + } + else + { + gtk_label_set_label (GTK_LABEL (sl->priv->frame_clock), "NULL"); + gtk_widget_set_sensitive (sl->priv->frame_clock_button, FALSE); + } + } + else + { + gtk_widget_hide (sl->priv->frame_clock_row); } } @@ -281,10 +358,12 @@ update_info (gpointer data) gtk_widget_set_visible (sl->priv->realized, gtk_widget_get_realized (GTK_WIDGET (sl->priv->object))); gtk_widget_set_visible (sl->priv->is_toplevel, GTK_IS_ROOT (sl->priv->object)); gtk_widget_set_visible (sl->priv->child_visible, gtk_widget_get_child_visible (GTK_WIDGET (sl->priv->object))); - - update_frame_clock (sl); } + update_surface (sl); + update_renderer (sl); + update_frame_clock (sl); + if (GTK_IS_BUILDABLE (sl->priv->object)) { gtk_label_set_text (GTK_LABEL (sl->priv->buildable_id), @@ -522,6 +601,12 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass) gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, allocated_size); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, baseline_row); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, baseline); + gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, surface_row); + gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, surface); + gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, surface_button); + gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, renderer_row); + gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, renderer); + gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, renderer_button); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, frame_clock_row); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, frame_clock); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, frame_clock_button); @@ -546,6 +631,8 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass) gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, child_visible_row); gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, child_visible); + gtk_widget_class_bind_template_callback (widget_class, show_surface); + gtk_widget_class_bind_template_callback (widget_class, show_renderer); gtk_widget_class_bind_template_callback (widget_class, show_frame_clock); } |