mirror of
https://github.com/reactos/wine.git
synced 2025-02-02 18:25:19 +00:00
Merged palette option processing into the main configuration code.
This commit is contained in:
parent
bb19a58a93
commit
cb538c0533
@ -53,7 +53,6 @@ static PALETTEENTRY *COLOR_sysPal; /* current system palette */
|
||||
static int COLOR_gapStart = 256;
|
||||
static int COLOR_gapEnd = -1;
|
||||
static int COLOR_gapFilled = 0;
|
||||
static int COLOR_max = 256;
|
||||
|
||||
Colormap X11DRV_PALETTE_PaletteXColormap = 0;
|
||||
UINT16 X11DRV_PALETTE_PaletteFlags = 0;
|
||||
@ -134,22 +133,6 @@ int X11DRV_PALETTE_Init(void)
|
||||
X11DRV_PALETTE_PaletteFlags |= X11DRV_PALETTE_VIRTUAL;
|
||||
case GrayScale:
|
||||
case PseudoColor:
|
||||
{
|
||||
HKEY hkey;
|
||||
BOOL private_color_map = FALSE;
|
||||
/* @@ Wine registry key: HKLM\Software\Wine\Wine\Config\x11drv */
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\x11drv", &hkey))
|
||||
{
|
||||
char buffer[20];
|
||||
DWORD type, count = sizeof(buffer);
|
||||
if(!RegQueryValueExA(hkey, "PrivateColorMap", 0, &type, buffer, &count))
|
||||
{
|
||||
char ch = buffer[0];
|
||||
private_color_map = (ch == 'y' || ch == 'Y' || ch == 't' || ch == 'T' || ch == '1');
|
||||
}
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
wine_tsx11_lock();
|
||||
if (private_color_map)
|
||||
{
|
||||
@ -177,7 +160,6 @@ int X11DRV_PALETTE_Init(void)
|
||||
}
|
||||
wine_tsx11_unlock();
|
||||
break;
|
||||
}
|
||||
|
||||
case StaticGray:
|
||||
wine_tsx11_lock();
|
||||
@ -388,47 +370,26 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template
|
||||
int i, j, warn = 0;
|
||||
int diff, r, g, b, bp = 0, wp = 1;
|
||||
int step = 1;
|
||||
int defaultCM_max_copy;
|
||||
unsigned int max = 256;
|
||||
Colormap defaultCM;
|
||||
XColor defaultColors[256];
|
||||
HKEY hkey;
|
||||
|
||||
defaultCM_max_copy = 128;
|
||||
COLOR_max = 256;
|
||||
|
||||
/* @@ Wine registry key: HKLM\Software\Wine\Wine\Config\x11drv */
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\x11drv", &hkey))
|
||||
{
|
||||
char buffer[20];
|
||||
DWORD type, count;
|
||||
|
||||
count = sizeof(buffer);
|
||||
if(!RegQueryValueExA(hkey, "CopyDefaultColors", 0, &type, buffer, &count))
|
||||
defaultCM_max_copy = atoi(buffer);
|
||||
|
||||
count = sizeof(buffer);
|
||||
if(!RegQueryValueExA(hkey, "AllocSystemColors", 0, &type, buffer, &count))
|
||||
COLOR_max = atoi(buffer);
|
||||
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
/* 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 = DefaultColormap( gdi_display, DefaultScreen(gdi_display) );
|
||||
|
||||
for (i = 0; i < defaultCM_max_copy; i++)
|
||||
if (copy_default_colors > 256) copy_default_colors = 256;
|
||||
for (i = 0; i < copy_default_colors; i++)
|
||||
defaultColors[i].pixel = (long) i;
|
||||
wine_tsx11_lock();
|
||||
XQueryColors(gdi_display, defaultCM, &defaultColors[0], defaultCM_max_copy);
|
||||
for (i = 0; i < defaultCM_max_copy; i++)
|
||||
XQueryColors(gdi_display, defaultCM, &defaultColors[0], copy_default_colors);
|
||||
for (i = 0; i < copy_default_colors; i++)
|
||||
XAllocColor( gdi_display, X11DRV_PALETTE_PaletteXColormap, &defaultColors[i] );
|
||||
|
||||
if (COLOR_max > 256) COLOR_max = 256;
|
||||
else if (COLOR_max < 20) COLOR_max = 20;
|
||||
TRACE("%d colors configured.\n", COLOR_max);
|
||||
if (alloc_system_colors > 256) alloc_system_colors = 256;
|
||||
else if (alloc_system_colors < 20) alloc_system_colors = 20;
|
||||
TRACE("%d colors configured.\n", alloc_system_colors);
|
||||
|
||||
TRACE("Building shared map - %i palette entries\n", palette_size);
|
||||
|
||||
@ -532,8 +493,8 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template
|
||||
}
|
||||
}
|
||||
|
||||
if( c_min > COLOR_max - NB_RESERVED_COLORS)
|
||||
c_min = COLOR_max - NB_RESERVED_COLORS;
|
||||
if( c_min > alloc_system_colors - NB_RESERVED_COLORS)
|
||||
c_min = alloc_system_colors - NB_RESERVED_COLORS;
|
||||
|
||||
c_min = (c_min/2) + (c_min/2); /* need even set for split palette */
|
||||
|
||||
@ -720,7 +681,7 @@ static void X11DRV_PALETTE_FillDefaultColors( const PALETTEENTRY *sys_pal_templa
|
||||
XColor xc;
|
||||
int r, g, b, max;
|
||||
|
||||
max = COLOR_max - (256 - (COLOR_gapEnd - COLOR_gapStart));
|
||||
max = alloc_system_colors - (256 - (COLOR_gapEnd - COLOR_gapStart));
|
||||
for ( i = 0, idx = COLOR_gapStart; i < 256 && idx <= COLOR_gapEnd; i++ )
|
||||
if( X11DRV_PALETTE_XPixelToPalette[i] == NB_PALETTE_EMPTY_VALUE )
|
||||
{
|
||||
|
@ -539,6 +539,9 @@ extern int use_xkb;
|
||||
extern int use_take_focus;
|
||||
extern int use_primary_selection;
|
||||
extern int managed_mode;
|
||||
extern int private_color_map;
|
||||
extern int copy_default_colors;
|
||||
extern int alloc_system_colors;
|
||||
|
||||
extern BYTE key_state_table[256];
|
||||
extern POINT cursor_pos;
|
||||
|
@ -76,11 +76,14 @@ int use_xkb = 1;
|
||||
int use_take_focus = 1;
|
||||
int use_primary_selection = 0;
|
||||
int managed_mode = 1;
|
||||
int private_color_map = 0;
|
||||
int client_side_with_core = 1;
|
||||
int client_side_with_render = 1;
|
||||
int client_side_antialias_with_core = 1;
|
||||
int client_side_antialias_with_render = 1;
|
||||
int using_wine_desktop = 0;
|
||||
int copy_default_colors = 128;
|
||||
int alloc_system_colors = 256;
|
||||
DWORD thread_data_tls_index = TLS_OUT_OF_INDEXES;
|
||||
|
||||
static BOOL synchronous; /* run in synchronous mode? */
|
||||
@ -302,6 +305,15 @@ static void setup_options(void)
|
||||
if (!get_config_key( hkey, appkey, "UseXIM", buffer, sizeof(buffer) ))
|
||||
use_xim = IS_OPTION_TRUE( buffer[0] );
|
||||
|
||||
if (!get_config_key( hkey, appkey, "PrivateColorMap", buffer, sizeof(buffer) ))
|
||||
private_color_map = IS_OPTION_TRUE( buffer[0] );
|
||||
|
||||
if (!get_config_key( hkey, appkey, "CopyDefaultColors", buffer, sizeof(buffer) ))
|
||||
copy_default_colors = atoi(buffer);
|
||||
|
||||
if (!get_config_key( hkey, appkey, "AllocSystemColors", buffer, sizeof(buffer) ))
|
||||
alloc_system_colors = atoi(buffer);
|
||||
|
||||
get_config_key( hkey, appkey, "InputStyle", input_style, sizeof(input_style) );
|
||||
|
||||
if (appkey) RegCloseKey( appkey );
|
||||
|
Loading…
x
Reference in New Issue
Block a user