[gtksourceview] completionlist: use 1 for target position width
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] completionlist: use 1 for target position width
- Date: Fri, 2 Sep 2022 21:48:29 +0000 (UTC)
commit c68091e2aeda6071742c4ec87908d09cf6193147
Author: Christian Hergert <chergert redhat com>
Date: Fri Sep 2 14:43:39 2022 -0700
completionlist: use 1 for target position width
Using 0 was not really useful because it meant we could never compare the
rectangle with a previous value. gtk_popover_get_pointing_to() will always
return 1 for a width if it was set using a zero-width rect.
Using 1 means we have a stable value that can be compared across a setter
and getter for the GtkPopover.
gtksourceview/gtksourcecompletionlist.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletionlist.c b/gtksourceview/gtksourcecompletionlist.c
index c97a9bdd..3532b1b0 100644
--- a/gtksourceview/gtksourcecompletionlist.c
+++ b/gtksourceview/gtksourcecompletionlist.c
@@ -348,10 +348,13 @@ _gtk_source_completion_list_get_target_location (GtkSourceAssistant *assistant,
GTK_SOURCE_ASSISTANT_CLASS (_gtk_source_completion_list_parent_class)->get_target_location
(assistant, rect);
- /* We want to align to the beginning of the character, so set the width
- * to 0 to ensure things align correctly.
+ /* We want to align to the beginning of the character, so set the
+ * width to one to ensure that. We do not use zero here just to help
+ * ensure math is stable but also because GtkPopover's
+ * gtk_popover_set_pointing_to() would convert width to one anyway.
+ * That way the value can be compared for changes.
*/
- rect->width = 0;
+ rect->width = 1;
}
static GtkSizeRequestMode
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]