From a0422bfe259998dd8f72d94e3330c152f28bb273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 2 Sep 2020 06:28:03 +0200 Subject: [PATCH 1/9] inspector: Fix huge listbox rows This is handled by .rich-list --- gtk/inspector/general.c | 15 ++------ gtk/inspector/general.ui | 80 ---------------------------------------- gtk/inspector/visual.ui | 76 -------------------------------------- 3 files changed, 3 insertions(+), 168 deletions(-) diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c index ab368e2f8d..87c91504dc 100644 --- a/gtk/inspector/general.c +++ b/gtk/inspector/general.c @@ -171,12 +171,7 @@ add_check_row (GtkInspectorGeneral *gen, GtkWidget *row, *box, *label, *check; box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 40); - g_object_set (box, - "margin-start", 10 + indent, - "margin-end", 10, - "margin-top", 10, - "margin-bottom", 10, - NULL); + g_object_set (box, "margin-start", indent, NULL); label = gtk_label_new (name); gtk_widget_set_halign (label, GTK_ALIGN_START); @@ -213,12 +208,7 @@ add_label_row (GtkInspectorGeneral *gen, GtkWidget *row; box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 40); - g_object_set (box, - "margin-start", 10 + indent, - "margin-end", 10, - "margin-top", 10, - "margin-bottom", 10, - NULL); + g_object_set (box, "margin-start", indent, NULL); label = gtk_label_new (name); gtk_widget_set_halign (label, GTK_ALIGN_START); @@ -572,6 +562,7 @@ populate_monitor (gpointer item, const char *model; list = GTK_LIST_BOX (gtk_list_box_new ()); + gtk_widget_add_css_class (GTK_WIDGET (list), "rich-list"); gtk_list_box_set_selection_mode (list, GTK_SELECTION_NONE); /* XXX: add monitor # here when porting to listview */ diff --git a/gtk/inspector/general.ui b/gtk/inspector/general.ui index d2b6f00f75..86cda44b82 100644 --- a/gtk/inspector/general.ui +++ b/gtk/inspector/general.ui @@ -26,10 +26,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -56,10 +52,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -86,10 +78,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -116,10 +104,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -146,10 +130,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -189,10 +169,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -220,10 +196,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -251,10 +223,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -282,10 +250,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -313,10 +277,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -344,10 +304,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -375,10 +331,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -419,10 +371,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -450,10 +398,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -480,10 +424,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -536,10 +476,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -567,10 +503,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -611,10 +543,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -642,10 +570,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -673,10 +597,6 @@ 0 - 10 - 10 - 10 - 10 40 diff --git a/gtk/inspector/visual.ui b/gtk/inspector/visual.ui index 3a04547536..7400edc46f 100644 --- a/gtk/inspector/visual.ui +++ b/gtk/inspector/visual.ui @@ -53,10 +53,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -81,10 +77,6 @@ - 10 - 10 - 10 - 10 40 @@ -110,10 +102,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -139,10 +127,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -172,10 +156,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -201,10 +181,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -230,10 +206,6 @@ 0 - 10 - 10 - 10 - 10 20 @@ -271,10 +243,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -309,10 +277,6 @@ 0 - 10 - 10 - 10 - 10 40 @@ -339,10 +303,6 @@ - 10 - 10 - 10 - 10 40 @@ -368,10 +328,6 @@ 0 - 10 - 10 - 10 - 10 20 @@ -422,10 +378,6 @@ - 10 - 10 - 10 - 10 40 @@ -451,10 +403,6 @@ - 10 - 10 - 10 - 10 40 @@ -480,10 +428,6 @@ - 10 - 10 - 10 - 10 40 @@ -509,10 +453,6 @@ - 10 - 10 - 10 - 10 40 @@ -538,10 +478,6 @@ - 10 - 10 - 10 - 10 40 @@ -567,10 +503,6 @@ - 10 - 10 - 10 - 10 40 @@ -610,10 +542,6 @@ - 10 - 10 - 10 - 10 40 @@ -638,10 +566,6 @@ - 10 - 10 - 10 - 10 40 From 40ee7186bfe54e4cbf7c80fd027da9a7afece804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 4 Sep 2020 07:41:01 +0200 Subject: [PATCH 2/9] build: Unify two if statements They both check glib_minor_req.is_odd() --- meson.build | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/meson.build b/meson.build index aa1b6e5c77..2e9354f847 100644 --- a/meson.build +++ b/meson.build @@ -16,13 +16,9 @@ glib_micro_req = 0 if glib_minor_req.is_odd() glib_min_required = 'GLIB_VERSION_@0@_@1@'.format(glib_major_req, glib_minor_req - 1) -else - glib_min_required = 'GLIB_VERSION_@0@_@1@'.format(glib_major_req, glib_minor_req) -endif - -if glib_minor_req.is_odd() glib_max_allowed = 'GLIB_VERSION_@0@_@1@'.format(glib_major_req, glib_minor_req + 1) else + glib_min_required = 'GLIB_VERSION_@0@_@1@'.format(glib_major_req, glib_minor_req) glib_max_allowed = 'GLIB_VERSION_@0@_@1@'.format(glib_major_req, glib_minor_req) endif From 27f3600419ad49bc5bd3c2df1df1c6c07a0041c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 4 Sep 2020 08:48:45 +0200 Subject: [PATCH 3/9] listbox: Add preconditions to remove() --- gtk/gtklistbox.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c index 73a8995608..b028df0f11 100644 --- a/gtk/gtklistbox.c +++ b/gtk/gtklistbox.c @@ -2272,16 +2272,20 @@ gtk_list_box_row_visibility_changed (GtkListBox *box, * Removes a child from @box. */ void -gtk_list_box_remove (GtkListBox *box, - GtkWidget *child) +gtk_list_box_remove (GtkListBox *box, + GtkWidget *child) { - GtkWidget *widget = GTK_WIDGET (box); + GtkWidget *widget; gboolean was_visible; gboolean was_selected; GtkListBoxRow *row; GSequenceIter *iter; GSequenceIter *next; + g_return_if_fail (GTK_IS_LIST_BOX (box)); + g_return_if_fail (GTK_IS_WIDGET (child)); + + widget = GTK_WIDGET (box); was_visible = gtk_widget_get_visible (child); if (child == box->placeholder) From 87f589f738ec64fcde89b6031725f7ba3acce3d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sat, 5 Sep 2020 13:43:03 +0200 Subject: [PATCH 4/9] emojichooser: Fix typo in css class --- gtk/gtkemojichooser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c index 62a8e19f5a..55c8f328ad 100644 --- a/gtk/gtkemojichooser.c +++ b/gtk/gtkemojichooser.c @@ -54,7 +54,7 @@ * |[ * popover * ╰── box.emoji-toolbar - * ├── button.iamge-button.emoji-section + * ├── button.image-button.emoji-section * ├── ... * ╰── button.image-button.emoji-section * ]| From c8f4c8c4f02cf72e219265d3a930fe0e1a6ad470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 10 Sep 2020 05:32:47 +0200 Subject: [PATCH 5/9] filechooserwidget: Plug a memory leak g_list_store_append refs the file --- gtk/gtkfilechooserwidget.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 4d24a7c79e..39d9001541 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -5453,7 +5453,10 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser) return NULL; if (info.file_from_entry) - g_list_store_append (info.result, info.file_from_entry); + { + g_list_store_append (info.result, info.file_from_entry); + g_object_unref (info.file_from_entry); + } else if (!file_list_seen) goto file_list; else From d0f182757a9fb5254b78534d108f6da370b1c8d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 10 Sep 2020 05:59:11 +0200 Subject: [PATCH 6/9] sizegroup demo: Fix a checkbutton/togglebutton mixup --- demos/gtk-demo/sizegroup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/demos/gtk-demo/sizegroup.c b/demos/gtk-demo/sizegroup.c index db8f16e105..ec90338867 100644 --- a/demos/gtk-demo/sizegroup.c +++ b/demos/gtk-demo/sizegroup.c @@ -59,8 +59,8 @@ add_row (GtkGrid *table, } static void -toggle_grouping (GtkToggleButton *check_button, - GtkSizeGroup *size_group) +toggle_grouping (GtkCheckButton *check_button, + GtkSizeGroup *size_group) { GtkSizeGroupMode new_mode; @@ -68,7 +68,7 @@ toggle_grouping (GtkToggleButton *check_button, * here to show the effect of GTK_SIZE_GROUP_HORIZONTAL by * contrast. */ - if (gtk_toggle_button_get_active (check_button)) + if (gtk_check_button_get_active (check_button)) new_mode = GTK_SIZE_GROUP_HORIZONTAL; else new_mode = GTK_SIZE_GROUP_NONE; From a6f86d9c26b43a73104c95ee75a9ba1465ce4d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 10 Sep 2020 06:02:34 +0200 Subject: [PATCH 7/9] popover: Only destroy arrow render node if position changed --- gtk/gtkpopover.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index 5130d68ede..fd3567d8e2 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -414,14 +414,16 @@ update_popover_layout (GtkPopover *popover, } if (priv->final_position != position) - gtk_widget_queue_allocate (GTK_WIDGET (popover)); + { + gtk_widget_queue_allocate (GTK_WIDGET (popover)); + g_clear_pointer (&priv->arrow_render_node, gsk_render_node_unref); + } gtk_widget_allocate (GTK_WIDGET (popover), gdk_surface_get_width (priv->surface), gdk_surface_get_height (priv->surface), -1, NULL); - g_clear_pointer (&priv->arrow_render_node, gsk_render_node_unref); gtk_widget_queue_draw (GTK_WIDGET (popover)); } From e669433cde60068099c7c03235475673d0ed7db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Thu, 10 Sep 2020 07:01:18 +0200 Subject: [PATCH 8/9] listbox: Activate single-click rows if n_press >= 1 Quickly clicking rows should always activate the row if single-click-activation is enabled. Before, only the first click (n_press == 1) would activate the row. --- gtk/gtklistbox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c index b028df0f11..c0028d83fd 100644 --- a/gtk/gtklistbox.c +++ b/gtk/gtklistbox.c @@ -1832,9 +1832,9 @@ gtk_list_box_click_gesture_released (GtkGestureClick *gesture, { gboolean focus_on_click = gtk_widget_get_focus_on_click (GTK_WIDGET (box->active_row)); - if (n_press == 1 && box->activate_single_click) + if (box->activate_single_click) gtk_list_box_select_and_activate_full (box, box->active_row, focus_on_click); - else + else if (n_press == 2) { GdkEventSequence *sequence; GdkInputSource source; From a545fa15e4eaf1b199e8e25818eeee5bbe3ba0d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 15 Sep 2020 05:28:31 +0200 Subject: [PATCH 9/9] inspector: Remove unsued function --- gtk/inspector/fpsoverlay.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/gtk/inspector/fpsoverlay.c b/gtk/inspector/fpsoverlay.c index b68238deb1..1329738a0d 100644 --- a/gtk/inspector/fpsoverlay.c +++ b/gtk/inspector/fpsoverlay.c @@ -60,40 +60,6 @@ gtk_fps_info_free (gpointer data) g_slice_free (GtkFpsInfo, info); } -static gint64 -guess_refresh_interval (GdkFrameClock *frame_clock) -{ - gint64 interval; - gint64 i; - - interval = G_MAXINT64; - - for (i = gdk_frame_clock_get_history_start (frame_clock); - i < gdk_frame_clock_get_frame_counter (frame_clock); - i++) - { - GdkFrameTimings *t, *before; - gint64 ts, before_ts; - - t = gdk_frame_clock_get_timings (frame_clock, i); - before = gdk_frame_clock_get_timings (frame_clock, i - 1); - if (t == NULL || before == NULL) - continue; - - ts = gdk_frame_timings_get_frame_time (t); - before_ts = gdk_frame_timings_get_frame_time (before); - if (ts == 0 || before_ts == 0) - continue; - - interval = MIN (interval, ts - before_ts); - } - - if (interval == G_MAXINT64) - return 0; - - return interval; -} - static double gtk_fps_overlay_get_fps (GtkWidget *widget) {