|
1 From 37f1a55c40ce9aaf136f1512068b04f6a5c36d48 Mon Sep 17 00:00:00 2001 |
|
2 From: Alan Coopersmith <[email protected]> |
|
3 Date: Sat, 2 Jan 2016 22:02:23 -0800 |
|
4 Subject: [PATCH] passwdTimeout pref |
|
5 |
|
6 Bug 15220000 SUNBT5077981 There should be an option to extend/disable lockout |
|
7 timer |
|
8 aka http://bugzilla.gnome.org/show_bug.cgi?id=147579 |
|
9 |
|
10 Bug 15231258 SUNBT6176524 passwdTimeoutEnable for disabled user |
|
11 |
|
12 Upstream status unknown. |
|
13 --- |
|
14 driver/XScreenSaver.ad.in | 1 + |
|
15 driver/demo-Gtk.c | 13 +++++ |
|
16 driver/lock.c | 8 ++++ |
|
17 driver/prefs.c | 6 +++ |
|
18 driver/types.h | 2 + |
|
19 driver/xscreensaver-demo.glade2.in | 98 +++++++++++++++++++++++++++++++++++++- |
|
20 6 files changed, 127 insertions(+), 1 deletion(-) |
|
21 |
|
22 diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in |
|
23 index 3e1ff8a..0a0ccf8 100644 |
|
24 --- a/driver/XScreenSaver.ad.in |
|
25 +++ b/driver/XScreenSaver.ad.in |
|
26 @@ -33,6 +33,7 @@ |
|
27 *cycle: 0:10:00 |
|
28 *lockTimeout: 0:00:00 |
|
29 *passwdTimeout: 0:02:00 |
|
30 +*passwdTimeoutEnabled: True |
|
31 *dpmsEnabled: True |
|
32 *dpmsQuickoffEnabled: False |
|
33 *dpmsStandby: 0:10:00 |
|
34 diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c |
|
35 index d4cc4a5..3d86087 100644 |
|
36 --- a/driver/demo-Gtk.c |
|
37 +++ b/driver/demo-Gtk.c |
|
38 @@ -1566,6 +1566,8 @@ flush_dialog_changes_and_save (state *s) |
|
39 |
|
40 MINUTES (&p2->timeout, "timeout_spinbutton"); |
|
41 MINUTES (&p2->cycle, "cycle_spinbutton"); |
|
42 + CHECKBOX (p2->unlock_timeout_p, "pwd_button"); /* bugid 5077981 */ |
|
43 + MINUTES (&p2->passwd_timeout, "pwd_spinbutton"); |
|
44 CHECKBOX (p2->lock_p, "lock_button"); |
|
45 MINUTES (&p2->lock_timeout, "lock_spinbutton"); |
|
46 |
|
47 @@ -1670,6 +1672,8 @@ flush_dialog_changes_and_save (state *s) |
|
48 COPY(cycle, "cycle"); |
|
49 COPY(lock_p, "lock_p"); |
|
50 COPY(lock_timeout, "lock_timeout"); |
|
51 + COPY(unlock_timeout_p,"unlock_timeout_p"); /* bugid 5077981 */ |
|
52 + COPY(passwd_timeout, "passwd_timeout"); |
|
53 |
|
54 COPY(dpms_enabled_p, "dpms_enabled_p"); |
|
55 COPY(dpms_quickoff_p, "dpms_quickoff_enabled_p"); |
|
56 @@ -2802,6 +2806,9 @@ populate_prefs_page (state *s) |
|
57 FMT_MINUTES ("timeout_spinbutton", p->timeout); |
|
58 FMT_MINUTES ("cycle_spinbutton", p->cycle); |
|
59 FMT_MINUTES ("lock_spinbutton", p->lock_timeout); |
|
60 + /* bugid 5077981 */ |
|
61 + FMT_MINUTES ("pwd_spinbutton", p->passwd_timeout); |
|
62 + |
|
63 FMT_MINUTES ("dpms_standby_spinbutton", p->dpms_standby); |
|
64 FMT_MINUTES ("dpms_suspend_spinbutton", p->dpms_suspend); |
|
65 FMT_MINUTES ("dpms_off_spinbutton", p->dpms_off); |
|
66 @@ -2814,6 +2821,7 @@ populate_prefs_page (state *s) |
|
67 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (name_to_widget (s,(NAME))),\ |
|
68 (ACTIVEP)) |
|
69 |
|
70 + TOGGLE_ACTIVE ("pwd_button", p->unlock_timeout_p); /* bugid 5077981 */ |
|
71 TOGGLE_ACTIVE ("lock_button", p->lock_p); |
|
72 #if 0 |
|
73 TOGGLE_ACTIVE ("verbose_button", p->verbose_p); |
|
74 @@ -2919,6 +2927,10 @@ populate_prefs_page (state *s) |
|
75 |
|
76 /* Blanking and Locking |
|
77 */ |
|
78 + /* bugid 5077081 */ |
|
79 + SENSITIZE ("pwd_spinbutton", p->unlock_timeout_p); |
|
80 + SENSITIZE ("pwd_mlabel", p->unlock_timeout_p); |
|
81 + |
|
82 SENSITIZE ("lock_button", can_lock_p); |
|
83 SENSITIZE ("lock_spinbutton", can_lock_p && p->lock_p); |
|
84 SENSITIZE ("lock_mlabel", can_lock_p && p->lock_p); |
|
85 @@ -3093,6 +3105,7 @@ fix_text_entry_sizes (state *s) |
|
86 # if 0 /* appears no longer necessary with Gtk 1.2.10 */ |
|
87 const char * const spinbuttons[] = { |
|
88 "timeout_spinbutton", "cycle_spinbutton", "lock_spinbutton", |
|
89 + "pwd_spinbutton", /* bugid 5077981 */ |
|
90 "dpms_standby_spinbutton", "dpms_suspend_spinbutton", |
|
91 "dpms_off_spinbutton", |
|
92 "-fade_spinbutton" }; |
|
93 diff --git a/driver/lock.c b/driver/lock.c |
|
94 index becf85b..08f0f98 100644 |
|
95 --- a/driver/lock.c |
|
96 +++ b/driver/lock.c |
|
97 @@ -1651,6 +1651,10 @@ update_passwd_window (saver_info *si, const char *printed_passwd, float ratio) |
|
98 event.xclient.data.l[1] = 0; |
|
99 event.xclient.data.l[2] = 0; |
|
100 |
|
101 + /* CR 5077981: option to disable unlock timer */ |
|
102 + if (! si->prefs.unlock_timeout_p) |
|
103 + event.xclient.data.l[1] = 1; |
|
104 + |
|
105 if (!safe_XSendEvent (si->dpy, si->passwd_dialog, False, 0L, &event)) |
|
106 fprintf (stderr, "%s: error sending ratio to lock dialog\n", blurb ()); |
|
107 } |
|
108 @@ -2358,6 +2362,10 @@ passwd_animate_timer (XtPointer closure, XtIntervalId *id) |
|
109 |
|
110 if (!pw) return; |
|
111 |
|
112 + /* CR 5077981: option to disable unlock timer */ |
|
113 + if (! si->prefs.unlock_timeout_p) |
|
114 + return; |
|
115 + |
|
116 #ifdef HAVE_XSCREENSAVER_LOCK |
|
117 /* We want to make sure dialog is up before we update countdown timer */ |
|
118 if (!si->passwd_dialog) |
|
119 diff --git a/driver/prefs.c b/driver/prefs.c |
|
120 index 55bac7b..52538a8 100644 |
|
121 --- a/driver/prefs.c |
|
122 +++ b/driver/prefs.c |
|
123 @@ -252,6 +252,7 @@ static const char * const prefs[] = { |
|
124 "lockVTs", /* not saved */ |
|
125 "lockTimeout", |
|
126 "passwdTimeout", |
|
127 + "passwdTimeoutEnabled", /* bugid 5077981 */ |
|
128 "visualID", |
|
129 "installColormap", |
|
130 "verbose", |
|
131 @@ -786,6 +787,9 @@ write_init_file (Display *dpy, |
|
132 CHECK("lockVTs") continue; /* don't save, unused */ |
|
133 CHECK("lockTimeout") type = pref_time, t = p->lock_timeout; |
|
134 CHECK("passwdTimeout") type = pref_time, t = p->passwd_timeout; |
|
135 + |
|
136 +/* bugid 5077981 */ |
|
137 + CHECK("passwdTimeoutEnabled") type = pref_bool, b = p->unlock_timeout_p; |
|
138 CHECK("visualID") type = pref_str, s = visual_name; |
|
139 CHECK("installColormap") type = pref_bool, b = p->install_cmap_p; |
|
140 CHECK("verbose") type = pref_bool, b = p->verbose_p; |
|
141 @@ -1071,6 +1075,8 @@ load_init_file (Display *dpy, saver_preferences *p) |
|
142 p->lock_timeout = 1000 * get_minutes_resource (dpy, "lockTimeout", "Time"); |
|
143 p->cycle = 1000 * get_minutes_resource (dpy, "cycle", "Time"); |
|
144 p->passwd_timeout = 1000 * get_seconds_resource (dpy, "passwdTimeout", "Time"); |
|
145 + /* bugid 5077981 */ |
|
146 + p->unlock_timeout_p = get_boolean_resource (dpy, "passwdTimeoutEnabled", "Boolean"); |
|
147 p->pointer_timeout = 1000 * get_seconds_resource (dpy, "pointerPollTime", "Time"); |
|
148 p->pointer_hysteresis = get_integer_resource (dpy, "pointerHysteresis","Integer"); |
|
149 p->notice_events_timeout = 1000*get_seconds_resource(dpy, |
|
150 diff --git a/driver/types.h b/driver/types.h |
|
151 index c77ee3f..b428f73 100644 |
|
152 --- a/driver/types.h |
|
153 +++ b/driver/types.h |
|
154 @@ -97,6 +97,8 @@ struct saver_preferences { |
|
155 Bool xsync_p; /* whether XSynchronize has been called */ |
|
156 |
|
157 Bool lock_p; /* whether to lock as well as save */ |
|
158 + Bool unlock_timeout_p; /* whether to timeout unlock dialog */ |
|
159 + /* bugid 5077981 */ |
|
160 |
|
161 Bool fade_p; /* whether to fade to black, if possible */ |
|
162 Bool unfade_p; /* whether to fade from black, if possible */ |
|
163 diff --git a/driver/xscreensaver-demo.glade2.in b/driver/xscreensaver-demo.glade2.in |
|
164 index 40e47f6..a7a06a6 100644 |
|
165 --- a/driver/xscreensaver-demo.glade2.in |
|
166 +++ b/driver/xscreensaver-demo.glade2.in |
|
167 @@ -165,7 +165,7 @@ |
|
168 <child> |
|
169 <widget class="GtkTable" id="blanking_table"> |
|
170 <property name="visible">True</property> |
|
171 - <property name="n_rows">3</property> |
|
172 + <property name="n_rows">4</property> |
|
173 <property name="n_columns">4</property> |
|
174 <property name="homogeneous">False</property> |
|
175 <property name="row_spacing">2</property> |
|
176 @@ -466,6 +466,102 @@ |
|
177 <property name="y_options"></property> |
|
178 </packing> |
|
179 </child> |
|
180 + |
|
181 + <child> |
|
182 + <widget class="GtkSpinButton" id="pwd_spinbutton"> |
|
183 + <property name="visible">True</property> |
|
184 + <property name="tooltip" translatable="yes">How long the unlock dialog waits for input before disappearing.</property> |
|
185 + <property name="can_focus">True</property> |
|
186 + <property name="climb_rate">15</property> |
|
187 + <property name="digits">0</property> |
|
188 + <property name="numeric">True</property> |
|
189 + <property name="update_policy">GTK_UPDATE_ALWAYS</property> |
|
190 + <property name="snap_to_ticks">True</property> |
|
191 + <property name="wrap">False</property> |
|
192 + <property name="adjustment">0 0 720 1 15 15</property> |
|
193 + <accessibility> |
|
194 + <atkrelation target="pwd_button" type="controlled-by"/> |
|
195 + <atkrelation target="pwd_button" type="labelled-by"/> |
|
196 + <atkrelation target="pwd_mlabel" type="labelled-by"/> |
|
197 + </accessibility> |
|
198 + <signal name="activate" handler="pref_changed_cb"/> |
|
199 + <signal name="focus_out_event" handler="pref_changed_event_cb"/> |
|
200 + <signal name="value_changed" handler="pref_changed_cb"/> |
|
201 + </widget> |
|
202 + <packing> |
|
203 + <property name="left_attach">2</property> |
|
204 + <property name="right_attach">3</property> |
|
205 + <property name="top_attach">3</property> |
|
206 + <property name="bottom_attach">4</property> |
|
207 + <property name="y_padding">10</property> |
|
208 + <property name="x_options">fill</property> |
|
209 + <property name="y_options"></property> |
|
210 + </packing> |
|
211 + </child> |
|
212 + |
|
213 + <child> |
|
214 + <widget class="GtkEventBox" id="pwd_button_eventbox"> |
|
215 + <property name="visible">True</property> |
|
216 + <property name="tooltip" translatable="yes">Whether the unlock dialog box should disappear after a timeout.</property> |
|
217 + <property name="visible_window">True</property> |
|
218 + <property name="above_child">False</property> |
|
219 + |
|
220 + <child> |
|
221 + <widget class="GtkCheckButton" id="pwd_button"> |
|
222 + <property name="visible">True</property> |
|
223 + <property name="can_focus">True</property> |
|
224 + <property name="label" translatable="yes">Timeout _Unlock After</property> |
|
225 + <property name="use_underline">True</property> |
|
226 + <property name="relief">GTK_RELIEF_NORMAL</property> |
|
227 + <property name="focus_on_click">True</property> |
|
228 + <property name="active">False</property> |
|
229 + <property name="inconsistent">False</property> |
|
230 + <property name="draw_indicator">True</property> |
|
231 + <accessibility> |
|
232 + <atkrelation target="pwd_spinbutton" type="controller-for"/> |
|
233 + <atkrelation target="pwd_spinbutton" type="label-for"/> |
|
234 + <atkrelation target="pwd_spinbutton" type="flows-to"/> |
|
235 + </accessibility> |
|
236 + <signal name="toggled" handler="pref_changed_cb"/> |
|
237 + </widget> |
|
238 + </child> |
|
239 + </widget> |
|
240 + <packing> |
|
241 + <property name="left_attach">0</property> |
|
242 + <property name="right_attach">2</property> |
|
243 + <property name="top_attach">3</property> |
|
244 + <property name="bottom_attach">4</property> |
|
245 + <property name="x_options">fill</property> |
|
246 + <property name="y_options">fill</property> |
|
247 + </packing> |
|
248 + </child> |
|
249 + |
|
250 + <child> |
|
251 + <widget class="GtkLabel" id="pwd_mlabel"> |
|
252 + <property name="visible">True</property> |
|
253 + <property name="label" translatable="yes">minutes</property> |
|
254 + <property name="use_underline">False</property> |
|
255 + <property name="use_markup">False</property> |
|
256 + <property name="justify">GTK_JUSTIFY_LEFT</property> |
|
257 + <property name="wrap">False</property> |
|
258 + <property name="selectable">False</property> |
|
259 + <property name="xalign">0</property> |
|
260 + <property name="yalign">0.5</property> |
|
261 + <property name="xpad">8</property> |
|
262 + <property name="ypad">0</property> |
|
263 + <accessibility> |
|
264 + <atkrelation target="pwd_spinbutton" type="label-for"/> |
|
265 + <atkrelation target="pwd_spinbutton" type="flows-from"/> |
|
266 + </accessibility> |
|
267 + </widget> |
|
268 + <packing> |
|
269 + <property name="left_attach">3</property> |
|
270 + <property name="right_attach">4</property> |
|
271 + <property name="top_attach">3</property> |
|
272 + <property name="bottom_attach">4</property> |
|
273 + <property name="y_options"></property> |
|
274 + </packing> |
|
275 + </child> |
|
276 </widget> |
|
277 <packing> |
|
278 <property name="left_attach">0</property> |
|
279 -- |
|
280 2.6.1 |
|
281 |