hrp@boring.cray.com (Hal Peterson) (08/12/89)
I am running 18.54 on a Sun-3/50 under SunOS 3.5, compiled with GCC 1.35. I have built it with X and with XMenu support; my server is X11R3 sample + all the patches and speedups. When I try to pop up a menu using C-S-left or C-S-middle, Emacs does nothing and stops responding to keystrokes. I believe the problem is an interaction between interrupt-driven I/O and XQueryPointer. In the X11R3 implementation, XQueryPointer expects to be able to read its own response, but instead the response gets stolen by internal_socket_read in the SIGIO handler. The patches below, which remove the call to XQueryPointer and instead use the information from the ButtonPress event, make the problem go away. While I was att it, I fixed a bug in x11fns.c which incorrectly set x-mouse-abs-pos to the same value as x-mouse-pos. These two fixes together make the popup menus work quite nicely. -- Hal Peterson Domain: hrp@cray.com Cray Research Old style: hrp%cray.com@uc.msc.umn.edu 1440 Northland Dr. UUCP: uunet!cray!hrp Mendota Hts, MN 55120 USA Telephone: +1 612 681 3145 ======================================================================== *** xmenu-DIST.c Thu Apr 6 20:36:11 1989 --- xmenu.c Fri Aug 11 15:05:36 1989 *************** *** 130,135 **** --- 130,136 ---- #ifdef X11 Window root_window, wjunk; int ijunk; + extern Lisp_Object Vx_mouse_abs_pos; #endif BLOCK_INPUT_DECLARE (); *************** *** 136,143 **** check_xterm(); #ifdef X11 root_window = RootWindow (XXdisplay, DefaultScreen(XXdisplay)); ! XQueryPointer (XXdisplay, root_window, &wjunk, &wjunk, &XMenu_xpos, ! &XMenu_ypos, &ijunk, &ijunk, &ijunk); #else XMenu_xpos = fontinfo->width * XINT(Fcar(arg)); XMenu_ypos = fontinfo->height * XINT(Fcar(Fcdr (arg))); --- 137,144 ---- check_xterm(); #ifdef X11 root_window = RootWindow (XXdisplay, DefaultScreen(XXdisplay)); ! XMenu_xpos = Fcar (Vx_mouse_abs_pos); ! XMenu_ypos = Fcar (Fcdr (Vx_mouse_abs_pos)); #else XMenu_xpos = fontinfo->width * XINT(Fcar(arg)); XMenu_ypos = fontinfo->height * XINT(Fcar(Fcdr (arg))); *** x11fns-DIST.c Fri Feb 24 05:36:01 1989 --- x11fns.c Fri Aug 11 14:56:41 1989 *************** *** 559,566 **** max (0, (event.xbutton.y-XXInternalBorder)/ XXfonth))); Vx_mouse_pos = Fcons (tempx, Fcons (tempy, Qnil)); ! /* XSET (tempx, Lisp_Int, event.xbutton.x+XXxoffset); ! XSET (tempy, Lisp_Int, event.xbutton.y+XXyoffset);*/ Vx_mouse_abs_pos = Fcons (tempx, Fcons (tempy, Qnil)); Vx_mouse_item = make_number (com_letter); mouse_cmd --- 559,566 ---- max (0, (event.xbutton.y-XXInternalBorder)/ XXfonth))); Vx_mouse_pos = Fcons (tempx, Fcons (tempy, Qnil)); ! XSET (tempx, Lisp_Int, event.xbutton.x_root); ! XSET (tempy, Lisp_Int, event.xbutton.y_root); Vx_mouse_abs_pos = Fcons (tempx, Fcons (tempy, Qnil)); Vx_mouse_item = make_number (com_letter); mouse_cmd