[gtk/1422-gtkentry-s-minimum-width-is-hardcoded-to-150px] gtkentry: set minimum-width to 1 instead of 150
- From: Nelson Benítez León <nbenitez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/1422-gtkentry-s-minimum-width-is-hardcoded-to-150px] gtkentry: set minimum-width to 1 instead of 150
- Date: Sun, 21 Oct 2018 16:46:08 +0000 (UTC)
commit 0ab2d8c10c4d54d2369d8b2be85d088996f73d14
Author: Nelson Benítez León <nbenitezl gmail com>
Date: Sun Oct 21 17:07:36 2018 +0500
gtkentry: set minimum-width to 1 instead of 150
and use 150 as natural-width.
Currently there's no way for a GtkEntry to be less
than 150px wide (apart from using "width-chars" property),
this is too much for a default minimum-width, an app
developer may need to have a shorter GtkEntry, for example
when the UI it's been shrunk by the user (see [1]) or when
you want to match the size of another widget (which is less
than 150px) see [2] for Evince bug on using
gtk_combo_box_new_with_model_and_entry() for PDF forms where
GtkEntry of ComboBox is too wide and doesn't match the combo
list width.
Using "width-chars" is not a proper solution for these
cases as you may not know how short your GtkEntry will be
or the fact that using "chars" as a width size unit is not
pixel accurate.
Curious note: the commit that introduced the GtkEntry
minimum-width to be 150px is from 20 years ago, see
https://bit.ly/2ySEfK4
[1] This change was already suggested by Benjamin Otte
in a blog comment https://bit.ly/2J96wRo
[2] Fixes issue evince#1002
gtk/gtkentry.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 35995d84bb..302951e3c4 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -161,7 +161,8 @@
* .insertion-cursor.
*/
-#define MIN_ENTRY_WIDTH 150
+#define MIN_ENTRY_WIDTH 1
+#define NAT_ENTRY_WIDTH 150
#define MAX_ICONS 2
@@ -3599,7 +3600,7 @@ gtk_entry_measure (GtkCssGadget *gadget,
}
if (priv->max_width_chars < 0)
- nat = min;
+ nat = NAT_ENTRY_WIDTH;
else
nat = char_pixels * priv->max_width_chars;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]