Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!ames!ucsd!sdcsvax!trantor.harris-atd.com!mac From: mac@trantor.harris-atd.com (Mike McDonald) Newsgroups: comp.windows.x Subject: XGrabPointer and ButtonPress Keywords: X Message-ID: <1481@trantor.harris-atd.com> Date: 9 Feb 89 22:49:24 GMT Organization: Advanced Technology Dept., Harris Corp., Melbourne, Fl. Lines: 58 I'm trying to write a menu using Xlib but I'm having problems with the XGrabPointer stuff. Here's the basic of my code: main() { ... XSelectInput(display, root, ButtonPressMask); while (!done) { XNextEvent(display, &event); switch (event.type) { case ButtonPress: show_menu(menu, &event); break; ... } } } show_menu(menu, event) { XChangeActivePointerGrab(display, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, None, CurrentTime); map_menu(menu); while (!done) { { XNextEvent(display, &menu_event); switch (menu_event.type) { /* process menu events */ } } } The XChangeActivePointerGrab gets the following XError: X Protocol error: BadAccess, attempt to access private resource denied Major opcode of failed request: 30 (X_ChangeActivePointerGrab) Minor opcode of failed request: 0 Resource id in failed request: 0x600006 Serial number of failed request: 87 Current serial number in output stream: 88 I've tried to do an XUngrabPointer and then a XGrabPointer but that tells me the pointer is already grabbed. I've also tried using event->time instead of CurrentTime with no luck. I'm running Xr11.3 on a Sun3/50 under SunOS3.5. I haven't gotten the patches from Expo yet if that matters. Can anybody tell me what stupid thing I'm doing wrong. Mike McDonald mac@trantor.harris-atd.com postmaster@trantor.harris-atd.com (407) 727-5060 Advanced Technology Dept. Harris Corp. M.S. 3A-1912 P.O. Box 37 Melbourne, Florida 32902