lmjm@doc.imperial.ac.UK (Lee McLoughlin) (02/06/90)
This is all under X.V11R4 (with fix-1 installed). I've modified the comp.sources.x xgif so that it creates a new colormap and uses it instead of the default one (patches below). On moving onto that window the new colormap is force-fed into the hardware (so all the other windows look bananas). Two xgif's work fine. As you move onto each window the whole screen gets its colormap. No prob's. Unless you modify the default colormap after putting up an xgif. For example if you do: xgif -c ball.gif & xterm -fg somenewcolor From now on twm will no longer use the xgif's colormap when you move onto it. However if you do a 'twm restart' it will once again install the xgif's window when you move onto it. I think this is a twm bug. The R3 twm seems LESS prone to it. Patches to xgif follow. You have to define CMAP to get the new code. *** /tmp/,RCSt1022537 Mon Feb 5 23:37:25 1990 --- xgif.c Mon Feb 5 23:04:03 1990 *************** *** 8,14 #define MAIN #include "xgif.h" - /*******************************************/ main(argc, argv) int argc; --- 8,13 ----- #define MAIN #include "xgif.h" /*******************************************/ main(argc, argv) int argc; *************** *** 30,35 for (i = 1; i < argc; i++) { char *strind; if (!strncmp(argv[i],"-g",2)) { /* geometry */ i++; geom = argv[i]; --- 29,41 ----- for (i = 1; i < argc; i++) { char *strind; + #ifdef CMAP + if (!strncmp(argv[i],"-c",2)) { /* Use own cmap */ + owncmap++; + continue; + } + #endif + if (!strncmp(argv[i],"-g",2)) { /* geometry */ i++; geom = argv[i]; *************** *** 92,98 } theScreen = DefaultScreen(theDisp); - theCmap = DefaultColormap(theDisp, theScreen); rootW = RootWindow(theDisp,theScreen); theGC = DefaultGC(theDisp,theScreen); fcol = WhitePixel(theDisp,theScreen); --- 98,103 ----- } theScreen = DefaultScreen(theDisp); rootW = RootWindow(theDisp,theScreen); theGC = DefaultGC(theDisp,theScreen); fcol = WhitePixel(theDisp,theScreen); *************** *** 98,103 fcol = WhitePixel(theDisp,theScreen); bcol = BlackPixel(theDisp,theScreen); theVisual = DefaultVisual(theDisp,theScreen); dispcells = DisplayCells(theDisp, theScreen); if (dispcells<=2) --- 103,114 ----- fcol = WhitePixel(theDisp,theScreen); bcol = BlackPixel(theDisp,theScreen); theVisual = DefaultVisual(theDisp,theScreen); + #ifdef CMAP + if( owncmap ) + theCmap = XCreateColormap(theDisp, rootW, theVisual, AllocNone ); + else + #endif + theCmap = DefaultColormap(theDisp, theScreen); dispcells = DisplayCells(theDisp, theScreen); if (dispcells<=2) *************** *** 313,318 xswa.background_pixel = bcol; xswa.border_pixel = fcol; xswamask = CWBackPixel | CWBorderPixel; mainW = XCreateWindow(theDisp,rootW,x,y,eWIDE,eHIGH,2,0,CopyFromParent, CopyFromParent, xswamask, &xswa); --- 324,335 ----- xswa.background_pixel = bcol; xswa.border_pixel = fcol; xswamask = CWBackPixel | CWBorderPixel; + #ifdef CMAP + if( owncmap ){ + xswa.colormap = theCmap; + xswamask |= CWColormap; + } + #endif mainW = XCreateWindow(theDisp,rootW,x,y,eWIDE,eHIGH,2,0,CopyFromParent, CopyFromParent, xswamask, &xswa); *************** *** 316,321 mainW = XCreateWindow(theDisp,rootW,x,y,eWIDE,eHIGH,2,0,CopyFromParent, CopyFromParent, xswamask, &xswa); XSetStandardProperties(theDisp,mainW,"xgif","xgif",None, argv,argc,&hints); --- 333,343 ----- mainW = XCreateWindow(theDisp,rootW,x,y,eWIDE,eHIGH,2,0,CopyFromParent, CopyFromParent, xswamask, &xswa); + + #ifdef CMAP + if( owncmap ) + XSetWindowColormap( theDisp, mainW, theCmap ); + #endif XSetStandardProperties(theDisp,mainW,"xgif","xgif",None, argv,argc,&hints); -- -- Lee McLoughlin phone: 01 589 5111 X 5037 fax: 01 581 8024 Department of Computing,Imperial College,180 Queens Gate,London SW7 2BZ, UK Janet: lmjm@uk.ac.ic.doc Uucp: lmjm@icdoc.UUCP (or ..!ukc!icdoc!lmjm) DARPA: lmjm@doc.ic.ac.uk (or lmjm%uk.ac.ic.doc@nsfnet-relay.ac.uk)
phils@ATHENA.MIT.EDU (Philip Thompson) (02/07/90)
What machine are you running on? Twm handles colormaps fine 95% of the time on our vaxes but not at all on our ibm/RTs. On vaxes, twm sometimes occasionally ignores the fact that a window with a specific colormap exists, but a restart will fix the problem. On our RTs, twm installs the colormap okay but doesn't uninstall it until the client exits - no matter what you do. This is with R4 and patches applied. As a note, here at Athena at MIT, Motif's window manager is the only one, of those available here (mwm, twm & uwm), that handles colormaps correctly all the time on vaxes and certainly on rts. Philip Thompson Computer Resource Lab, MIT