diff options
author | William Jon McCann <william.jon.mccann@gmail.com> | 2013-07-10 12:13:12 -0400 |
---|---|---|
committer | William Jon McCann <william.jon.mccann@gmail.com> | 2013-07-11 17:08:15 -0400 |
commit | 4b5a389e88af7e7a1fa9e33294642dcfbc2832ec (patch) | |
tree | ef289dc9f45dd789af45d33ab7249a618d568196 /gtk/gtkentry.c | |
parent | dae6afc847110b533e95b4df318d7e2163a53809 (diff) | |
download | gtk+-4b5a389e88af7e7a1fa9e33294642dcfbc2832ec.tar.gz |
Deprecate and ignore gtk-entry-password-hint-timeout
This feature offers a number of benefits related to providing
feedback to the user when the password is masked. Some experts have
argued that password masking is harmful. I tend to agree with this
setting providing a better and more moderate solution. Some agree:
https://www.schneier.com/blog/archives/2009/07/the_pros_and_co.html
In order to further lessen the impact I've only enabled the feature
on the primary display since the likelyhood of a non-primary display
being visible by others is higher.
Diffstat (limited to 'gtk/gtkentry.c')
-rw-r--r-- | gtk/gtkentry.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 581a7b3287..1b7cf0fa5f 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -120,6 +120,7 @@ #define MIN_ENTRY_WIDTH 150 #define DRAW_TIMEOUT 20 #define PASSWORD_HINT_MAX 8 +#define PASSWORD_HINT_TIMEOUT 600 #define MAX_ICONS 2 @@ -5136,7 +5137,6 @@ buffer_inserted_text (GtkEntryBuffer *buffer, GtkEntry *entry) { GtkEntryPrivate *priv = entry->priv; - guint password_hint_timeout; guint current_pos; gint selection_bound; @@ -5153,11 +5153,18 @@ buffer_inserted_text (GtkEntryBuffer *buffer, /* Calculate the password hint if it needs to be displayed. */ if (n_chars == 1 && !priv->visible) { - g_object_get (gtk_widget_get_settings (GTK_WIDGET (entry)), - "gtk-entry-password-hint-timeout", &password_hint_timeout, - NULL); + GdkScreen *screen; + gint primary_num; + gint monitor_num; + + screen = gtk_widget_get_screen (GTK_WIDGET (entry)); + primary_num = gdk_screen_get_primary_monitor (screen); + monitor_num = gdk_screen_get_monitor_at_window (screen, priv->text_area); - if (password_hint_timeout > 0) + /* Only show password hint on the primary monitor to help avoid + showing passwords on presentations and the like. Would be + better if we had an explicit presentation mode. */ + if (primary_num == monitor_num) { GtkEntryPasswordHint *password_hint = g_object_get_qdata (G_OBJECT (entry), quark_password_hint); @@ -5171,7 +5178,7 @@ buffer_inserted_text (GtkEntryBuffer *buffer, password_hint->position = position; if (password_hint->source_id) g_source_remove (password_hint->source_id); - password_hint->source_id = gdk_threads_add_timeout (password_hint_timeout, + password_hint->source_id = gdk_threads_add_timeout (PASSWORD_HINT_TIMEOUT, (GSourceFunc)gtk_entry_remove_password_hint, entry); } } |