naughton@wind.Sun.COM (Patrick Naughton) (12/20/89)
When you receive X11R4 (this decadeish) xlock will not work. Back when I was first writing xlock I grepped around in the sources looking for what mask I should use for the XGrabPointer() call if I wanted *all* events. While grepping for AllEvents I found this in Intrinsic.h: typedef unsigned int EventMask; #define XtAllEvents ((EventMask) -1L) So, I used -1... Come to find out that not all 32 bits in this mask are valid and the protocol specifies that there must be zeros in the invalid bits. X11R4 checks these bits and rejects the protocol request if they are non-zero where X11R1-3 did not. There is a revised version of xlock on expo:./contrib/xlock.shar.Z Here is the context diff for the changes. -Patrick ______________________________________________________________________ Patrick J. Naughton ARPA: naughton@sun.com Window Systems Group UUCP: ...!sun!naughton Sun Microsystems, Inc. AT&T: (415) 336 - 1080 *** xlock.c.orig Tue Dec 19 10:11:46 1989 --- xlock.c Tue Dec 19 10:10:10 1989 *************** *** 1,5 **** #ifndef lint ! static char sccsid[] = "@(#)xlock.c 22.4 89/09/23"; #endif /*- * xlock.c - X11 client to lock a display and show a screen saver. --- 1,5 ---- #ifndef lint ! static char sccsid[] = "@(#)xlock.c 22.5 89/12/19"; #endif /*- * xlock.c - X11 client to lock a display and show a screen saver. *************** *** 29,34 **** --- 29,36 ---- * Mountain View, CA 94043 * * Revision History: + * 19-Dec-89: Fixed bug in GrabPointer. + * Changed fontname to XLFD style. * 23-Sep-89: Added fix to allow local hostname:0 as a display. * Put empty case for Enter/Leave events. * Moved colormap installation later in startup. *************** *** 176,182 **** #define ICONW 64 #define ICONH 64 #define ICONLOOPS 600 ! #define DEFAULT_FONTNAME "LucidaSans-24" #define BACKUP_FONTNAME "fixed" #define DEFAULT_INITTIME 60 #define DEFAULT_SKIPROOT True --- 178,184 ---- #define ICONW 64 #define ICONH 64 #define ICONLOOPS 600 ! #define DEFAULT_FONTNAME "-*-lucida-medium-r-normal-sans-24-*-*-*-*-*-*-*" #define BACKUP_FONTNAME "fixed" #define DEFAULT_INITTIME 60 #define DEFAULT_SKIPROOT True *************** *** 183,188 **** --- 185,198 ---- #define DEFAULT_COUNT 100 #define DEFAULT_NICE 10 #define DEFAULT_DISPLAY ":0" + #define AllPointerEventMask \ + (ButtonPressMask | ButtonReleaseMask | \ + EnterWindowMask | LeaveWindowMask | \ + PointerMotionMask | PointerMotionHintMask | \ + Button1MotionMask | Button2MotionMask | \ + Button3MotionMask | Button4MotionMask | \ + Button5MotionMask | ButtonMotionMask | \ + KeymapStateMask) /* VARARGS1 */ void *************** *** 253,259 **** GrabModeAsync, GrabModeAsync, CurrentTime); if (status != GrabSuccess) error("%s: couldn't grab keyboard! (%d)\n", status); ! status = XGrabPointer(dsp, w, True, -1, GrabModeAsync, GrabModeAsync, None, mycursor, CurrentTime); if (status != GrabSuccess) --- 263,269 ---- GrabModeAsync, GrabModeAsync, CurrentTime); if (status != GrabSuccess) error("%s: couldn't grab keyboard! (%d)\n", status); ! status = XGrabPointer(dsp, w, True, AllPointerEventMask, GrabModeAsync, GrabModeAsync, None, mycursor, CurrentTime); if (status != GrabSuccess) *************** *** 265,271 **** XChangeGrabbedCursor(cursor) Cursor cursor; { ! XGrabPointer(dsp, w, True, -1, GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime); } --- 275,281 ---- XChangeGrabbedCursor(cursor) Cursor cursor; { ! XGrabPointer(dsp, w, True, AllPointerEventMask, GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime); } *************** *** 365,370 **** --- 375,381 ---- } break; + case KeymapNotify: case KeyRelease: case ButtonRelease: case MotionNotify: ______________________________________________________________________ Patrick J. Naughton ARPA: naughton@sun.com Window Systems Group UUCP: ...!sun!naughton Sun Microsystems, Inc. AT&T: (415) 336 - 1080
hogan@csl.sri.com (Emmett Hogan) (12/20/89)
>>>>> On 19 Dec 89 20:43:18 GMT, naughton@wind.Sun.COM (Patrick Naughton) said:
Patrick> When you receive X11R4 (this decadeish) xlock will not work.
Is it just me or does this sound ridiculous ? Patches for unreleased
software, why not just fix it before it is released ? Or if that is
infeasible, include this patch with the release, but sending it out
prior to the release of X11R4 seems a little strange to me. But,
maybe this means that R4 is all bundled up and ready to go, in which
case, where does the line start?
Just a little curious,
Emmett
--
-------------------------------------------------------------------
Emmett Hogan Computer Science Lab, SRI International
Inet: hogan@csl.sri.com
UUCP: {ames, decwrl, pyramid, sun}!fernwood!hercules!hogan
USMAIL: BN179, 333 Ravenswood Ave, Menlo Park, CA 94025
PacBell: (415)859-3232 (voice), (415)859-2844 (fax)
ICBM: 37d 27' 14" North, 122d 10' 52" West
-------------------------------------------------------------------
swick@ATHENA.MIT.EDU (Ralph R. Swick) (12/20/89)
While grepping for AllEvents I found this in Intrinsic.h: And if you'd grepped around the documentation you might have deduced that Xt defines XtAllEvents for use in precisely the situation where an invalid value is required. Moral: making assumptions based on C code in header files is dangerous. Corollary: header files should have more comments. (not fixed in R4, sorry ;-)
martin@zip.eecs.umich.edu (Martin R. Friedmann) (12/20/89)
In article <HOGAN.89Dec19143137@trollope.csl.sri.com> hogan@csl.sri.com (Emmett Hogan) writes:
Is it just me or does this sound ridiculous ? Patches for unreleased
software, why not just fix it before it is released ?
It's just you. xlock isn't MIT software. You can bet that any MIT programs
that might die in an XGrabServer (xterm does a few, xmag might too...) will be
"pre" fixed... xlock is contributed software... It may be on the tape, but
even if it's not, we want the patch. Thanks for the patch guy!!!
Marty.
--
Marty.