Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!boulder!stan!toml From: toml@Solbourne.COM (Tom LaStrange) Newsgroups: comp.windows.x Subject: Re: Proper way to set the root window's colormap? Message-ID: <2763@ninja.Solbourne.COM> Date: 12 Oct 89 22:00:11 GMT References: <40151@bu-cs.BU.EDU> Organization: Solbourne Computer Inc., Longmont, Co. Lines: 51 > I need to know what the "proper" way to set the root window's colormap > and/or pixmap is. I am currently just setting the window attributes, > which works under some window managers but appears to confuse others > terribly. What is the "right" way? Very good question. From some of the work we have done here, we too have found that setting the colormap of the root window to be a desirable thing to do. If you have a bunch of clients that wish to use a standard colormap such as RGB_BEST_MAP, it is useful to set that colormap on the root window so that applications can use it rather than creating there own. Since most applications create their windows while simply inheriting the colormap of their parent this should not present too many problems. There is a problem however in current window managers. Here is the problem, at least with twm: When the window manager starts up, it uses DefaultColormap(dpy, screen) as the colormap to install when the pointer is on the root window. It also uses this colormap when allocating colors for title bars, menus, etc. Basically the colormap currently in the root window's attributes is ignored. What should probably be done is for the window manager to find out what colormap is currently in the root window's attributes and install it and use it for its default colormap. This also requires that the window manager watch for colormap changes on the root window. What this buys the user is the ability to set a standard colormap (such as RGB_BEST_MAP) on the root window and have all clients, including the window manager, use it instead of the default colormap. This eliminates the "technicolor" flashing as the user moves between applications that are using this standard common colormap. This is not a difficult change, we have already changed the yet to be unveiled swm (Solbourne Window Manager) to do just what I have described and have noticed no problems whatsoever. I would also be more than happy to provide a patch for twm to allow this functionality. One other interesting problem arises. Since most Xt clients inherit the colormap of the root window, setting that colormap to a standard colormap may cause problems. A standard colormap may not have any cells that can be changed. This causes Xt clients to fail when trying to allocate a named color. Solbourne's Xt clients have been fixed so that they use the closest color available when no color cells can be allocated. We expect MIT to provide a similar fix in the future. -- Tom LaStrange Solbourne Computer Inc. ARPA: toml@Solbourne.COM 1900 Pike Rd. UUCP: ...!{boulder,nbires,sun}!stan!toml Longmont, CO 80501