[gnu.emacs.bug] X11 Menu bug in 18.53

heiser@iis.UUCP (Gernot Heiser) (05/03/89)

[Note: I haven't been reading this newsgroup for about a month, so this may
already have been reported.]

Emacs version 18.53 when compiled for X11 with menus has the following bug: a
popup menu is clipped to emacs's window rather than moved within. The following
patches fix that:

======================= patch 1 ==========================
*** xterm.h	Tue May  2 14:31:51 1989
--- xterm.h.orig	Tue Sep  8 02:00:07 1987
***************
*** 12,18 ****
  XREPBUFFER;
  
  extern int x_edges_specified;
- extern Window XXwindow;
  
  #ifndef sigmask
  #define sigmask(no) (1L << ((no) - 1))
--- 12,17 ----
======================= end of patch 1 ==========================
======================= patch 2 ==========================
*** xmenu.c	Tue May  2 14:31:50 1989
--- xmenu.c.orig	Tue May 31 09:23:17 1988
***************
*** 217,225 ****
    char *datap;
    int ulx, uly, width, height;
    int dispwidth, dispheight;
- #ifdef X11
-   XWindowAttributes attributes;
- #endif
    
    *error = (char *) 0;		/* Initialize error pointer to null */
    if ((GXMenu = XMenuCreate( X11ONLY (XXdisplay) parent, "emacs" )) == NUL )
--- 217,222 ----
***************
*** 267,275 ****
    XMenuRecompute(X11ONLY (XXdisplay) GXMenu);
  #ifdef X11
    XXscreen = DefaultScreen(XXdisplay);
!   XGetWindowAttributes(XXdisplay, XXwindow, &attributes);
!   dispwidth = attributes.width;
!   dispheight = attributes.height;
  #else
    dispwidth = DisplayWidth();
    dispheight = DisplayHeight();
--- 264,271 ----
    XMenuRecompute(X11ONLY (XXdisplay) GXMenu);
  #ifdef X11
    XXscreen = DefaultScreen(XXdisplay);
!   width = DisplayWidth(XXdisplay, XXscreen);
!   height = DisplayHeight(XXdisplay, XXscreen);
  #else
    dispwidth = DisplayWidth();
    dispheight = DisplayHeight();
======================= end of patch 2 ==========================

[Exporting a varialbe may not be the most elegant fix but anything else would
require more extensive changes.]

There is one more menu bug which I didn't notice with X10 (using 18.49): If no
selection is made from the popup menu, after the menu vanishes the screen is
not refreshed until the next event (e.g. hitting the shift key).
-- 
Gernot Heiser                   Phone:       +41 1/256 23 48
Integrated Systems Laboratory   CSNET/ARPA:  heiser%iis.ethz.ch@relay.cs.net
ETH Zuerich                     UUCP (new):  heiser@iis.uucp
CH-8092 Zuerich, Switzerland    UUCP (old):  {uunet,mcvax,...}!iis!heiser