diff options
author | Matthias Clasen <mclasen@redhat.com> | 2023-04-01 14:09:23 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2023-04-01 19:11:00 -0400 |
commit | ed9f0c0eb89bec8133aa3e39f69188c593cdb4a3 (patch) | |
tree | f683bb97b6c6e139457cd7db80ef2c6bad9e7f34 | |
parent | 075bea788b02c50af0fc6e8991de2f073fa80b38 (diff) | |
download | gtk+-ed9f0c0eb89bec8133aa3e39f69188c593cdb4a3.tar.gz |
inspector: Show surface scale
For Wayland surfaces, show the fractional scale
if we have it.
-rw-r--r-- | gtk/inspector/misc-info.c | 15 | ||||
-rw-r--r-- | gtk/inspector/misc-info.ui | 25 |
2 files changed, 39 insertions, 1 deletions
diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c index a9a061927e..f6a58f0882 100644 --- a/gtk/inspector/misc-info.c +++ b/gtk/inspector/misc-info.c @@ -34,7 +34,6 @@ #include "gtkbinlayout.h" #include "gtkwidgetprivate.h" - struct _GtkInspectorMiscInfo { GtkWidget parent; @@ -79,6 +78,8 @@ struct _GtkInspectorMiscInfo GtkWidget *tick_callback; GtkWidget *framerate_row; GtkWidget *framerate; + GtkWidget *scale_row; + GtkWidget *scale; GtkWidget *framecount_row; GtkWidget *framecount; GtkWidget *mapped_row; @@ -424,6 +425,15 @@ update_info (gpointer data) sl->last_frame = frame; } + if (GDK_IS_SURFACE (sl->object)) + { + char buf[64]; + + g_snprintf (buf, sizeof (buf), "%g", gdk_surface_get_scale (GDK_SURFACE (sl->object))); + + gtk_label_set_label (GTK_LABEL (sl->scale), buf); + } + return G_SOURCE_CONTINUE; } @@ -507,6 +517,7 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl, gtk_widget_set_visible (sl->buildable_id_row, GTK_IS_BUILDABLE (object)); gtk_widget_set_visible (sl->framecount_row, GDK_IS_FRAME_CLOCK (object)); gtk_widget_set_visible (sl->framerate_row, GDK_IS_FRAME_CLOCK (object)); + gtk_widget_set_visible (sl->scale_row, GDK_IS_SURFACE (object)); if (GTK_IS_WIDGET (object)) { @@ -618,6 +629,8 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass) gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, framecount); gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, framerate_row); gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, framerate); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, scale_row); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, scale); gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, mapped_row); gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, mapped); gtk_widget_class_bind_template_child (widget_class, GtkInspectorMiscInfo, realized_row); diff --git a/gtk/inspector/misc-info.ui b/gtk/inspector/misc-info.ui index 3a7696b7a4..5db3e98bf9 100644 --- a/gtk/inspector/misc-info.ui +++ b/gtk/inspector/misc-info.ui @@ -518,6 +518,31 @@ </object> </child> <child> + <object class="GtkListBoxRow" id="scale_row"> + <property name="activatable">0</property> + <child> + <object class="GtkBox"> + <property name="spacing">40</property> + <child> + <object class="GtkLabel"> + <property name="label" translatable="yes">Scale</property> + <property name="halign">start</property> + <property name="valign">baseline</property> + <property name="xalign">0</property> + <property name="hexpand">1</property> + </object> + </child> + <child> + <object class="GtkLabel" id="scale"> + <property name="halign">end</property> + <property name="valign">baseline</property> + </object> + </child> + </object> + </child> + </object> + </child> + <child> <object class="GtkListBoxRow" id="mapped_row"> <property name="activatable">0</property> <child> |