2 --- a/greeter/Login.h 2020-09-22 08:15:48.445614405 -0700
3 +++ b/greeter/Login.h 2020-09-22 08:16:04.418229439 -0700
5 # define XtNgreetFace "greetFace"
6 # define XtNfailFace "failFace"
7 # define XtNfailTimeout "failTimeout"
8 +# define XtNgrabDelay "grabDelay"
9 # define XtNsessionArgument "sessionArgument"
10 # define XtNsecureSession "secureSession"
11 # define XtNallowAccess "allowAccess"
12 --- a/greeter/LoginP.h 2020-09-22 08:16:19.588151594 -0700
13 +++ b/greeter/LoginP.h 2020-09-22 08:16:33.452749073 -0700
15 char *sessionArg; /* argument passed to session */
16 LoginFunc notify_done; /* proc to call when done */
17 int failTimeout; /* seconds til drop fail msg */
18 + int grabDelay; /* time to retry to set the input focus to the login widget */
19 XtIntervalId interval_id; /* drop fail message note */
20 Boolean secure_session; /* session is secured */
21 Boolean allow_access; /* disable access control on login */
22 --- a/greeter/Login.c 2020-09-22 08:16:45.129246397 -0700
23 +++ b/greeter/Login.c 2020-09-22 08:19:03.626851807 -0700
25 (XtPointer) "Password Change Required" },
26 {XtNfailTimeout, XtCFailTimeout, XtRInt, sizeof (int),
27 offset(failTimeout), XtRImmediate, (XtPointer) 10},
28 + {XtNgrabDelay, XtCGrabDelay, XtRInt, sizeof (int),
29 + offset(grabDelay), XtRImmediate, (XtPointer) 10},
30 {XtNnotifyDone, XtCCallback, XtRFunction, sizeof (XtPointer),
31 offset(notify_done), XtRFunction, (XtPointer) 0},
32 {XtNsessionArgument, XtCSessionArgument, XtRString, sizeof (char *),
34 ErrorMessage(ctx, w->login.passwdChangeMsg, False);
45 + s = "window is not visible";
49 + s = "window is no longer valid";
53 + s = "generic failure";
59 +static volatile int xerr;
62 +xErrorHandler(Display *d, XErrorEvent *xeep)
64 + xerr = xeep->error_code;
69 draw_it (LoginWidget w)
75 - XSetInputFocus (XtDisplay (w), XtWindow (w),
76 - RevertToPointerRoot, CurrentTime);
78 + if (XGrabKeyboard (XtDisplay (w), XtWindow (w), False, GrabModeAsync,
79 + GrabModeAsync, CurrentTime) != GrabSuccess)
81 + typedef int (*x_e_h)(Display *, XErrorEvent *);
82 + x_e_h originalHandler = XSetErrorHandler(xErrorHandler);
83 + int waitsecs = w->login.grabDelay;
86 + XSetInputFocus (XtDisplay (w), XtWindow (w),
87 + RevertToPointerRoot, CurrentTime);
88 + XSync(XtDisplay (w), False);
90 + if (xerr != BadMatch) {
94 + if (waitsecs == 0) { /* timed out */
103 + (void) XSetErrorHandler(originalHandler);
105 + if (xerr != Success) {
106 + fprintf(stderr, "%s: failed to set focus; %s\n",
107 + "greeter", xerrMessage(xerr));
113 /* Returns 0 on success, -1 on failure */
114 --- a/config/Xresources.in 2020-09-22 08:19:33.923767351 -0700
115 +++ b/config/Xresources.in 2020-09-22 08:20:02.447969714 -0700
117 Xcursor.theme: whiteglass
120 xlogin*login.translations: #override BS
121 Ctrl<Key>R: abort-display()NLBS
122 --- a/greeter/Login.h 2020-09-22 10:42:07.782375282 -0700
123 +++ b/greeter/Login.h 2020-09-22 10:43:04.572299383 -0700
125 # define XtCPasswdPrompt "PasswdPrompt"
126 # define XtCFail "Fail"
127 # define XtCFailTimeout "FailTimeout"
128 +# define XtCGrabDelay "GrabDelay"
129 # define XtCSessionArgument "SessionArgument"
130 # define XtCSecureSession "SecureSession"
131 # define XtCAllowAccess "AllowAccess"