Path: utzoo!attcan!uunet!seismo!dimacs.rutgers.edu!mips!sdd.hp.com!wuarchive!mit-eddie!bloom-beacon!eru!hagbard!sunic!news.funet.fi!hydra!serifos!havia From: havia@serifos.Helsinki.FI (Jyrki Havia) Newsgroups: comp.windows.x Subject: Re: X11R4 xlock (SS1 SunOS 4.03 cc fix 1-14) doesn't work Summary: A patch included Message-ID: <8215@hydra.Helsinki.FI> Date: 28 Oct 90 19:02:00 GMT References: Sender: news@cs.Helsinki.FI Distribution: comp Organization: University of Helsinki Lines: 112 In article you write: > >I have installed X11R4 on the sparcstation 1 (Sun OS 4.03) patched >with fix-1 to fix-14. Everything seems to work except for the client >"xlock". It dies with the following message: [removed... A VERY familiar message :-)] >I noticed that both the xlock on X11R4 and R3 dies the same way (On >the R4 server). Is this problem due to some backward compatibility >flag I set when compiling the whole system ? No. This is due to a bug in R3 server, and R3 xlock. As the bug get fixed, somebody forget to fix xlock, which 'used' that bug. I have made a very simple patch for xlock. You can also set the R4 server to 'bug-to-bug' compatibility mode with R3 server by executing command 'xset bc'. >Also, is there an easy way to pin point the problem from an error >message such as the one I included above? I don't know much about >programming in X. Well, as you have source code to look, the line Major opcode of failed request: 26 (X_GrabPointer) in error message gives a hint which X protocol reguest failed. Here it is XGrabPointer(...) request. I first tracked the problem down to the server, and there is sequence (something like, we do not have sources on-line) of code if (!bug_mode) { if (events BUTTON_PRESS or BUTTON_RELEASE are requested explisitly) fail } So, I looked the xlock code, and there the 4th argument to XGrabPointer is -1, ie. all bits on. THAT is a BUG! There is (In Xlib or Xprotocol ref.) a statement like: 'When grabbing the cursor, you should newer ask for Buttonxxxxxx -events, as they are implicitly requested'. Someone has read that (or it should have read from the beginning) '.. must not ..' instead of '.. should not ..'. The patch I made includes the feature, that any movement of mouse will bring the password-asking screen to life. I like that, and some of my fellows don't like it. It is easy to disbale by removign events PointerMotionMask and MotionNotify from this patch. ----- Patch follows -------- *** xlock.c.orig Mon Aug 20 16:02:22 1990 --- xlock.c Mon Aug 20 16:34:08 1990 *************** *** 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) --- 253,259 ---- GrabModeAsync, GrabModeAsync, CurrentTime); if (status != GrabSuccess) error("%s: couldn't grab keyboard! (%d)\n", status); ! status = XGrabPointer(dsp, w, True, PointerMotionMask, GrabModeAsync, GrabModeAsync, None, mycursor, CurrentTime); if (status != GrabSuccess) *************** *** 265,271 **** XChangeGrabbedCursor(cursor) Cursor cursor; { ! XGrabPointer(dsp, w, True, -1, GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime); } --- 265,271 ---- XChangeGrabbedCursor(cursor) Cursor cursor; { ! XGrabPointer(dsp, w, True, PointerMotionMask, GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime); } *************** *** 483,489 **** init(dsp, w, gc, color, inittime, count); } XNextEvent(dsp, &event); ! } while (event.type != ButtonPress && event.type != KeyPress); } void --- 483,491 ---- init(dsp, w, gc, color, inittime, count); } XNextEvent(dsp, &event); ! } while (event.type != ButtonPress && ! event.type != KeyPress && ! event.type != MotionNotify); } void ---- Jyrki Havia : havia@cc.helsinki.fi University of Helsinki, : havia@finuha Department of Computer Science : HYLKA::HAVIA