Path: utzoo!attcan!uunet!snorkelwacker!usc!cs.utexas.edu!sun-barr!newstop!sun!wind!naughton From: naughton@wind.Sun.COM (Patrick Naughton) Newsgroups: comp.windows.x Subject: xlock patch for R4. Keywords: xlock, R4 Message-ID: <129433@sun.Eng.Sun.COM> Date: 19 Dec 89 20:43:18 GMT Sender: news@sun.Eng.Sun.COM Reply-To: naughton@sun.Eng.com (Patrick Naughton) Organization: Sun Microsystems, Mountain View Lines: 133 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