Unless XInstallColormap is called, Xephyr does not use the new color map, even if it is associated to a window.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52742 Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- This also helps with bug 46666, but there are still a lot of graphics problems with that game and it's not clear to me whether or not they're related to the color palette. --- dlls/winex11.drv/desktop.c | 5 +++++ dlls/winex11.drv/opengl.c | 3 +++ dlls/winex11.drv/palette.c | 1 + dlls/winex11.drv/window.c | 4 ++++ dlls/winex11.drv/x11drv_main.c | 1 + 5 files changed, 14 insertions(+)
diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index 0ac538d06ed..b563487e801 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -349,10 +349,15 @@ BOOL CDECL X11DRV_create_desktop( UINT width, UINT height ) win_attr.cursor = XCreateFontCursor( display, XC_top_left_arrow );
if (default_visual.visual != DefaultVisual( display, DefaultScreen(display) )) + { win_attr.colormap = XCreateColormap( display, DefaultRootWindow(display), default_visual.visual, AllocNone ); + XInstallColormap( display, win_attr.colormap ); + } else + { win_attr.colormap = None; + }
win = XCreateWindow( display, DefaultRootWindow(display), 0, 0, width, height, 0, default_visual.depth, InputOutput, default_visual.visual, diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 567205f742c..2756ed5fe92 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -458,7 +458,10 @@ static BOOL X11DRV_WineGL_InitOpenglInfo(void)
root = RootWindow( gdi_display, vis->screen ); if (vis->visual != DefaultVisual( gdi_display, vis->screen )) + { attr.colormap = XCreateColormap( gdi_display, root, vis->visual, AllocNone ); + XInstallColormap( gdi_display, attr.colormap ); + } if ((win = XCreateWindow( gdi_display, root, -1, -1, 1, 1, 0, vis->depth, InputOutput, vis->visual, CWBorderPixel | CWOverrideRedirect | CWColormap, &attr ))) XMapWindow( gdi_display, win ); diff --git a/dlls/winex11.drv/palette.c b/dlls/winex11.drv/palette.c index 8fbd7820c95..845f01902fc 100644 --- a/dlls/winex11.drv/palette.c +++ b/dlls/winex11.drv/palette.c @@ -304,6 +304,7 @@ int X11DRV_PALETTE_Init(void) XFreeColormap( gdi_display, default_colormap ); default_colormap = XCreateColormap( gdi_display, root_window, default_visual.visual, AllocAll ); + XInstallColormap( gdi_display, default_colormap ); if (default_colormap) { X11DRV_PALETTE_PaletteFlags |= X11DRV_PALETTE_PRIVATE; diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 36fb41ac710..818310d5461 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1520,6 +1520,7 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual ) (visual->class == PseudoColor || visual->class == GrayScale || visual->class == DirectColor) ? AllocAll : AllocNone ); + XInstallColormap( gdi_display, data->client_colormap ); attr.colormap = data->client_colormap; attr.bit_gravity = NorthWestGravity; attr.win_gravity = NorthWestGravity; @@ -1579,7 +1580,10 @@ static void create_whole_window( struct x11drv_win_data *data ) data->shaped = (win_rgn != 0);
if (data->vis.visualid != default_visual.visualid) + { data->whole_colormap = XCreateColormap( data->display, root_window, data->vis.visual, AllocNone ); + XInstallColormap( data->display, data->whole_colormap ); + }
mask = get_window_attributes( data, &attr );
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index 32beb84a009..8de464aa8bd 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -558,6 +558,7 @@ static void init_visuals( Display *display, int screen ) default_visual.bits_per_rgb = default_visual.visual->bits_per_rgb; } default_colormap = XCreateColormap( display, root_window, default_visual.visual, AllocNone ); + XInstallColormap( display, default_colormap );
TRACE( "default visual %lx class %u argb %lx\n", default_visual.visualid, default_visual.class, argb_visual.visualid );
Alex Henrie alexhenrie24@gmail.com writes:
Unless XInstallColormap is called, Xephyr does not use the new color map, even if it is associated to a window.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52742 Signed-off-by: Alex Henrie alexhenrie24@gmail.com
This is supposed to be done by the window manager, when the window has focus.
On Mon, Mar 28, 2022 at 2:18 AM Alexandre Julliard julliard@winehq.org wrote:
Alex Henrie alexhenrie24@gmail.com writes:
Unless XInstallColormap is called, Xephyr does not use the new color map, even if it is associated to a window.
This is supposed to be done by the window manager, when the window has focus.
Ah, so THAT'S the trick. Thanks! I've added a note about needing a window manager with palette support to the instructions at https://wiki.winehq.org/256_Color_Mode
-Alex