diff --git a/graphics/x11drv/palette.c b/graphics/x11drv/palette.c index 6e330202435745e364f7279334684dfaacc3ea3a..76f23cf4a4cb01ca25662570ccc7e9f4eb4cf2ff 100644 --- a/graphics/x11drv/palette.c +++ b/graphics/x11drv/palette.c @@ -312,14 +312,28 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void) int i, j, warn = 0; int diff, r, g, b, max = 256, bp = 0, wp = 1; int step = 1; - + int defaultCM_max_copy; + Colormap defaultCM; + XColor defaultColors[256]; + + /* Copy the first bunch of colors out of the default colormap to prevent + * colormap flashing as much as possible. We're likely to get the most + * important Window Manager colors, etc in the first 128 colors */ + defaultCM = DefaultColormapOfScreen( X11DRV_GetXScreen() ); + defaultCM_max_copy = PROFILE_GetWineIniInt( "x11drv", "CopyDefaultColors", 128); + for (i = 0; i < defaultCM_max_copy; i++) + defaultColors[i].pixel = (long) i; + TSXQueryColors(display, defaultCM, &defaultColors[0], defaultCM_max_copy); + for (i = 0; i < defaultCM_max_copy; i++) + TSXAllocColor( display, X11DRV_PALETTE_PaletteXColormap, &defaultColors[i] ); + /* read "AllocSystemColors" from wine.conf */ COLOR_max = PROFILE_GetWineIniInt( "x11drv", "AllocSystemColors", 256); if (COLOR_max > 256) COLOR_max = 256; else if (COLOR_max < 20) COLOR_max = 20; TRACE("%d colors configured.\n", COLOR_max); - + TRACE("Building shared map - %i palette entries\n", X11DRV_DevCaps.sizePalette); /* Be nice and allocate system colors as read-only */ diff --git a/include/ts_xlib.h b/include/ts_xlib.h index a479550bd285fb85b18d791fa1f0702f0af08259..8a91b56351fac203f36cf1b558e359d6b744158d 100644 --- a/include/ts_xlib.h +++ b/include/ts_xlib.h @@ -106,6 +106,7 @@ extern int TSXPending(Display*); extern int TSXPutBackEvent(Display*, XEvent*); extern int TSXPutImage(Display*, Drawable, GC, XImage*, int, int, int, int, unsigned int, unsigned int); extern int TSXQueryColor(Display*, Colormap, XColor*); +extern int TSXQueryColors(Display*, Colormap, XColor*, int); extern int TSXQueryKeymap(Display*, char*); extern int TSXQueryPointer(Display*, Window, Window*, Window*, int*, int*, int*, int*, unsigned int*); extern int TSXQueryTree(Display*, Window, Window*, Window*, Window**, unsigned int*); diff --git a/tsx11/X11_calls b/tsx11/X11_calls index fdafe70e6cf06e8823132a5ee00f6c031c36717f..6c5fbd75a412c773b284a42e274e52bb87a0ac2d 100644 --- a/tsx11/X11_calls +++ b/tsx11/X11_calls @@ -109,6 +109,7 @@ XPolygonRegion XPutBackEvent XPutImage XQueryColor +XQueryColors XQueryKeymap XQueryPointer XQueryTree diff --git a/tsx11/ts_xlib.c b/tsx11/ts_xlib.c index 8685180ac125591cf7102ae2f6630db70970fe92..6fa8f3cb0b62bada2d24c491716384db6498f84f 100644 --- a/tsx11/ts_xlib.c +++ b/tsx11/ts_xlib.c @@ -811,6 +811,15 @@ int TSXQueryColor(Display* a0, Colormap a1, XColor* a2) return r; } +int TSXQueryColors(Display* a0, Colormap a1, XColor* a2, int a3) +{ + int r; + wine_tsx11_lock(); + r = XQueryColors(a0, a1, a2, a3); + wine_tsx11_unlock(); + return r; +} + int TSXQueryKeymap(Display* a0, char* a1) { int r;