gtk3/gtk3-password-hint-timeout.patch
Richard Brown 4d2441b3ac Accepting request 196032 from home:dimstar:branches:GNOME:Factory
PATCH-FEATURE-OPENSUSE gtk3-password-hint-timeout.patch dimstar@opensuse.org -- Revert commit 4b5a38, re-introduce gtk-entry-password-hint-timeout

OBS-URL: https://build.opensuse.org/request/show/196032
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gtk3?expand=0&rev=127
2013-08-26 14:39:37 +00:00

92 lines
4.1 KiB
Diff

From 4b5a389e88af7e7a1fa9e33294642dcfbc2832ec Mon Sep 17 00:00:00 2001
From: William Jon McCann <william.jon.mccann@gmail.com>
Date: Wed, 10 Jul 2013 16:13:12 +0000
Subject: 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.
---
Index: gtk+-3.9.12/gtk/gtkentry.c
===================================================================
--- gtk+-3.9.12.orig/gtk/gtkentry.c
+++ gtk+-3.9.12/gtk/gtkentry.c
@@ -117,7 +117,6 @@
#define MIN_ENTRY_WIDTH 150
#define DRAW_TIMEOUT 20
#define PASSWORD_HINT_MAX 8
-#define PASSWORD_HINT_TIMEOUT 600
#define MAX_ICONS 2
@@ -5177,6 +5176,7 @@ buffer_inserted_text (GtkEntryBuffer *bu
GtkEntry *entry)
{
GtkEntryPrivate *priv = entry->priv;
+ guint password_hint_timeout;
guint current_pos;
gint selection_bound;
@@ -5193,18 +5193,11 @@ buffer_inserted_text (GtkEntryBuffer *bu
/* Calculate the password hint if it needs to be displayed. */
if (n_chars == 1 && !priv->visible)
{
- 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);
-
- /* 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)
+ g_object_get (gtk_widget_get_settings (GTK_WIDGET (entry)),
+ "gtk-entry-password-hint-timeout", &password_hint_timeout,
+ NULL);
+
+ if (password_hint_timeout > 0)
{
GtkEntryPasswordHint *password_hint = g_object_get_qdata (G_OBJECT (entry),
quark_password_hint);
@@ -5218,7 +5211,7 @@ buffer_inserted_text (GtkEntryBuffer *bu
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);
}
}
Index: gtk+-3.9.12/gtk/gtksettings.c
===================================================================
--- gtk+-3.9.12.orig/gtk/gtksettings.c
+++ gtk+-3.9.12/gtk/gtksettings.c
@@ -1327,16 +1327,14 @@ gtk_settings_class_init (GtkSettingsClas
* last char. 600 is a good value for enabling it.
*
* Since: 2.10
- *
- * Deprecated: 3.10: This setting is ignored
*/
result = settings_install_property_parser (class,
g_param_spec_uint ("gtk-entry-password-hint-timeout",
P_("Password Hint Timeout"),
P_("How long to show the last input character in hidden entries"),
0, G_MAXUINT,
- 600,
- GTK_PARAM_READWRITE | G_PARAM_DEPRECATED),
+ 600,
+ GTK_PARAM_READWRITE),
NULL);
g_assert (result == PROP_ENTRY_PASSWORD_HINT_TIMEOUT);