Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!yale!think!news!salem From: salem@mandala.think.com (Jim Salem) Newsgroups: comp.windows.x Subject: Re: xloadimage under X11R4 on SPARCstation 1 Message-ID: Date: 28 Feb 90 21:04:11 GMT References: <1031@fs1.ee.ubc.ca> <1990Feb22.011720.15485@world.std.com> <1192@swbatl.UUCP> Sender: news@Think.COM Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 92 In-reply-to: mhorstm@swbatl.UUCP's message of 22 Feb 90 05:35:09 GMT In article <1192@swbatl.UUCP> mhorstm@swbatl.UUCP (3417) writes: >I am also having trouble with twm and xloadimage. It seems that twm refuses >to load the colormap sometimes. But if I restart twm, the image will be >displayed fine, with the correct colormap! Yes. This is due to an obscure bug in twm, I fixed and reported to x-bugs last week. Here is the bug report : X Window System Bug Report xbugs@expo.lcs.mit.edu VERSION: R4 CLIENT MACHINE and OPERATING SYSTEM: Sun 4/110 running SunOS 4.0.3 DISPLAY TYPE: any WINDOW MANAGER: twm AREA: twm SYNOPSIS: Pull right menus break colormap installation. DESCRIPTION: Once a "pull right" menu is displayed by twm, twm no longer installs the color maps of windows underneath the cursor. This is a serious problem. This happens because the pull-right code in UpdateMenu calls PopUpMenu which in turn calls InstallRootColormap. However, at the conclusion of the menu code UninstallRootColormap is called only once no matter how many times InstallRootColormap has been called. Thus, the InstallWindowColormaps code never installs the color map because Scr->cmapInfo.root_pushes is always positive. REPEAT BY: 1) Run twm as the window manager. 2) Map a window that has its own colormap. I used the xxim program to do this (contrib/clients/xim) as well as one of our own. 3) Select a pull-right TWM menu. The default TWM doesn't have one but this is easily created E.G. button = :root : f.menu "test" menu "test" { "Submenu" f.menu "test2"} menu "test2" {"You have now lost" f.beep} 4) Note that the colormaps are no longer being installed. There is no way for the user to fix this outside of restarting twm. SAMPLE FIX: salem@mandala% diff -cb menus.c.orig menus.c *** menus.c.orig Fri Feb 16 06:46:32 1990 --- menus.c Fri Feb 16 07:00:30 1990 *************** *** 548,553 **** --- 548,561 ---- PopUpMenu (ActiveItem->sub, (savex + (ActiveMenu->width >> 1)), (savey + ActiveItem->item_num * Scr->EntryHeight + (Scr->EntryHeight >> 1)), False); + /* PATCH: salem@think.com 2/16/90 + We have to make sure that the color map installs are + properly nested, which they weren't. Since PopUpMenu + calls InstallRootColormap every time but + UninstallRootColormap is called only once at the end, we + insert a UninstallRootColormap here to keep the nesting + the same. This was broken, now it's a kludge. */ + UninstallRootColormap(); } else if (!badItem) { XBell (dpy, 0); badItem = ActiveItem; ------------------------------------------------------------------------------ -- jim (salem@think.com) -- -- Jim Salem Thinking Machines Corporation, Cambridge, MA 617-876-1111 salem@think.com mit-eddie!think!salem, rutgers!think!salem, harvard!think!salem