Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!apple!oliveb!ames!ai.etl.army.mil!mike From: mike@ai.etl.army.mil (Mike McDonnell) Newsgroups: comp.windows.x Subject: Problem with new widget colormap Message-ID: <296@ai.etl.army.mil> Date: 29 Apr 89 17:36:45 GMT Reply-To: mike@ai.etl.army.mil. (Mike McDonnell) Distribution: na Organization: USAETL, Fort Belvoir, Virginia Lines: 44 How can I change the colormap associated with a widget? Here are some code fragments showing attempts, with comments. Widget w is a core widget inside a form widget. Widget w is used to display an image. { XSetWindowAttributes swattr; disp = XtDisplay(w); win = XtWindow(w); cmap = make_new_colormap(disp, win); /* Works just fine. */ XInstallColormap(disp, cmap); /* screen flickers briefly */ /* this works the first time and then royally screws things up!! */ /* XSetWindowColormap(disp, DefaultRootWindow(disp), cmap); /* */ swattr.backing_store = Always; /* This works. */ swattr.colormap = cmap; /* This does not "take"; server resets? */ swattr.event_mask |= (ColormapChangeMask | EnterWindowMask); XChangeWindowAttributes(disp, win, CWBackingStore | CWColormap | CWEventMask, &swattr); XSetWindowColormap(disp, win, cmap); /* This doesn't do squat. */ } Running the >>second<< time with the colormap set to the root window gives the following error (which I find confusing): X Protocol error: BadMatch, invalid parameter attributes Major opcode of failed request: 1 (X_CreateWindow) Minor opcode of failed request: 0 Resource id in failed request: 0x8006b Serial number of failed request: 74 Current serial number in output stream: 92 This error persists even when I recompile the code with the assignment of the colormap to the root window commented out, as shown in the code fragment above. I have to kill the server to clear the error condition. HELP! -- Mike McDonnell at the U.S. Army Engineer Topographic Laboratories, Bldg. 2592 Fort Belvoir, VA 22060-5546 TEL:(202)355-2716 NET: mike@ai.etl.army.mil