Article View: comp.windows.x
Article #36472twm and colormaps problem.
From: Lee McLoughlin
Date: Mon, 05 Feb 1990 23:46
Date: Mon, 05 Feb 1990 23:46
158 lines
5141 bytes
5141 bytes
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)
Technical Details
Message-ID:
<9002052346.aa02349@tgould.doc.ic.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!bloom-beacon!doc.imperial.ac.UK!lmjmShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!bloom-beacon!doc.imperial.ac.UK!lmjm From: lmjm@doc.imperial.ac.UK (Lee McLoughlin) Newsgroups: comp.windows.x Subject: twm and colormaps problem. Message-ID: <9002052346.aa02349@tgould.doc.ic.ac.uk> Date: 5 Feb 90 23:46:54 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 158