Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!hplabs!hpda!hpdslab!hp-ptp!jkm From: jkm@hp-ptp.HP.COM (Jocelyn_Montgomery) Newsgroups: comp.windows.x Subject: XUngrabPointer isn't Message-ID: <2270001@hp-ptp.HP.COM> Date: 24 Aug 89 22:31:46 GMT Organization: HP Pacific Technology Park - Sunnyvale, Ca. Lines: 44 I am writing an application in which I want to grab the pointer, do something, then ungrab the pointer. All goes well with the grab but when I try to ungrab the pointer, it won't. I am getting a GrabInvalidTime value returned from XUngrabPointer, but I am giving it CurrentTime for both the grab and ungrab. I am running on an HP 9000/360 with 6.5 Any help is greatly appreciated! Here is the code: char buf[20]; int returnval; char *display_name = NULL; Cursor cursor; XEvent event; /* get display pointer */ display = XOpenDisplay (display_name); /* create question mark cursor */ cursor = XCreateFontCursor(display, 92); /* change cursor to question mark */ if ((returnval = XGrabPointer(display, XtWindow(questionMarkPB), True, ButtonPressMask|ButtonReleaseMask| OwnerGrabButtonMask, GrabModeAsync, GrabModeAsync, None, cursor, CurrentTime)) != 0) printf("grab error = %s\n", XGetErrorText(display, returnval, buf, sizeof (buf))); XMaskEvent(display,ButtonPressMask, &event); /* do something */ returnval = XUngrabPointer(display,CurrentTime); printf("ungrab return = %d\n", returnval); sleep(3); /* these are here so I don't hang my program when it doesn't ungrab */ exit(0); } The printf returns: ungrab return = 2. Thanks, Jocelyn Montgomery Hewlett Packard jocelyn@hp-ptp.HP.COM