Replace PROFILE_ functions by RegQueryValueExA in x11drv.
This commit is contained in:
parent
e81bf3f3ce
commit
de70d2b2c7
|
@ -8,11 +8,14 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ts_xlib.h"
|
||||
#include "ts_xutil.h"
|
||||
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winreg.h"
|
||||
#include "winuser.h"
|
||||
|
||||
#include "debugtools.h"
|
||||
|
@ -740,7 +743,17 @@ BOOL X11DRV_SetWindowText( HWND hwnd, LPCWSTR text )
|
|||
{
|
||||
if (text_cp == (UINT)-1)
|
||||
{
|
||||
text_cp = PROFILE_GetWineIniInt("x11drv", "TextCP", CP_ACP);
|
||||
HKEY hkey;
|
||||
/* default value */
|
||||
text_cp = CP_ACP;
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\x11drv", &hkey))
|
||||
{
|
||||
char buffer[20];
|
||||
DWORD type, count = sizeof(buffer);
|
||||
if(!RegQueryValueExA(hkey, "TextCP", 0, &type, buffer, &count))
|
||||
text_cp = atoi(buffer);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
TRACE("text_cp = %u\n", text_cp);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <stdlib.h>
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winreg.h"
|
||||
#include "winuser.h"
|
||||
#include "bitmap.h"
|
||||
#include "color.h"
|
||||
|
@ -522,6 +523,12 @@ main()
|
|||
|
||||
#endif /* BITBLT_TEST */
|
||||
|
||||
static inline BOOL get_bool(const char *buffer, BOOL def_value)
|
||||
{
|
||||
if(IS_OPTION_TRUE(buffer[0])) return TRUE;
|
||||
if(IS_OPTION_FALSE(buffer[0])) return FALSE;
|
||||
return def_value;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* perfect_graphics
|
||||
|
@ -531,7 +538,20 @@ main()
|
|||
static inline int perfect_graphics(void)
|
||||
{
|
||||
static int perfect = -1;
|
||||
if (perfect == -1) perfect = PROFILE_GetWineIniBool( "x11drv", "PerfectGraphics", 0 );
|
||||
if (perfect == -1)
|
||||
{
|
||||
HKEY hkey;
|
||||
char buffer[20];
|
||||
/* default value */
|
||||
perfect = 0;
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\x11drv", &hkey))
|
||||
{
|
||||
DWORD type, count = sizeof(buffer);
|
||||
if(!RegQueryValueExA(hkey, "PerfectGraphics", 0, &type, buffer, &count))
|
||||
perfect = get_bool(buffer, 0);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
}
|
||||
return perfect;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "options.h"
|
||||
#include "palette.h"
|
||||
#include "windef.h"
|
||||
#include "winreg.h"
|
||||
#include "x11drv.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(palette);
|
||||
|
@ -88,6 +89,13 @@ static void X11DRV_PALETTE_FormatSystemPalette(void);
|
|||
static BOOL X11DRV_PALETTE_CheckSysColor(COLORREF c);
|
||||
static int X11DRV_PALETTE_LookupSystemXPixel(COLORREF col);
|
||||
|
||||
static inline BOOL get_bool(const char *buffer, BOOL def_value)
|
||||
{
|
||||
if(IS_OPTION_TRUE(buffer[0])) return TRUE;
|
||||
if(IS_OPTION_FALSE(buffer[0])) return FALSE;
|
||||
return def_value;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* COLOR_Init
|
||||
*
|
||||
|
@ -114,7 +122,19 @@ BOOL X11DRV_PALETTE_Init(void)
|
|||
X11DRV_PALETTE_PaletteFlags |= X11DRV_PALETTE_VIRTUAL;
|
||||
case GrayScale:
|
||||
case PseudoColor:
|
||||
if (PROFILE_GetWineIniBool( "x11drv", "PrivateColorMap", 0 ))
|
||||
{
|
||||
HKEY hkey;
|
||||
BOOL private_color_map = FALSE;
|
||||
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))
|
||||
private_color_map = get_bool(buffer, 0);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
if (private_color_map)
|
||||
{
|
||||
XSetWindowAttributes win_attr;
|
||||
|
||||
|
@ -139,6 +159,7 @@ BOOL X11DRV_PALETTE_Init(void)
|
|||
X11DRV_PALETTE_PaletteXColormap = TSXCreateColormap(gdi_display, root_window,
|
||||
visual, AllocNone);
|
||||
break;
|
||||
}
|
||||
|
||||
case StaticGray:
|
||||
X11DRV_PALETTE_PaletteXColormap = TSXCreateColormap(gdi_display, root_window,
|
||||
|
@ -316,21 +337,38 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void)
|
|||
int defaultCM_max_copy;
|
||||
Colormap defaultCM;
|
||||
XColor defaultColors[256];
|
||||
HKEY hkey;
|
||||
|
||||
defaultCM_max_copy = 128;
|
||||
COLOR_max = 256;
|
||||
|
||||
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) );
|
||||
defaultCM_max_copy = PROFILE_GetWineIniInt( "x11drv", "CopyDefaultColors", 128);
|
||||
|
||||
for (i = 0; i < defaultCM_max_copy; i++)
|
||||
defaultColors[i].pixel = (long) i;
|
||||
TSXQueryColors(gdi_display, defaultCM, &defaultColors[0], defaultCM_max_copy);
|
||||
for (i = 0; i < defaultCM_max_copy; i++)
|
||||
TSXAllocColor( gdi_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);
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#include "windef.h"
|
||||
#include "wingdi.h"
|
||||
#include "winnls.h"
|
||||
#include "winreg.h"
|
||||
#include "heap.h"
|
||||
#include "options.h"
|
||||
#include "font.h"
|
||||
#include "debugtools.h"
|
||||
#include "user.h" /* for TWEAK_WineLook (FIXME) */
|
||||
|
@ -71,7 +71,7 @@ TC_CP_STROKE | TC_CR_ANY |
|
|||
/* X11R6 adds TC_SF_X_YINDEP, maybe more... */
|
||||
|
||||
static const char* INIFontMetrics = "/cachedmetrics.";
|
||||
static const char* INIFontSection = "fonts";
|
||||
static const char* INIFontSection = "Software\\Wine\\Wine\\Config\\fonts";
|
||||
static const char* INIAliasSection = "Alias";
|
||||
static const char* INIIgnoreSection = "Ignore";
|
||||
static const char* INIDefault = "Default";
|
||||
|
@ -1393,9 +1393,15 @@ static void XFONT_LoadDefaultLFD(LFD* lfd, LPCSTR fonttype)
|
|||
static void XFONT_LoadDefault(LPCSTR ini, LPCSTR fonttype)
|
||||
{
|
||||
char buffer[MAX_LFD_LENGTH];
|
||||
HKEY hkey;
|
||||
|
||||
if( PROFILE_GetWineIniString( INIFontSection, ini, "", buffer, sizeof buffer ) )
|
||||
buffer[0] = 0;
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, INIFontSection, &hkey))
|
||||
{
|
||||
DWORD type, count = sizeof(buffer);
|
||||
RegQueryValueExA(hkey, ini, 0, &type, buffer, &count);
|
||||
RegCloseKey(hkey);
|
||||
|
||||
if (*buffer)
|
||||
{
|
||||
LFD* lfd;
|
||||
|
@ -1532,6 +1538,33 @@ static void XFONT_LoadAlias(const LFD* lfd, LPCSTR lpAlias, BOOL bSubst)
|
|||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Just a copy of PROFILE_GetStringItem
|
||||
*
|
||||
* Convenience function that turns a string 'xxx, yyy, zzz' into
|
||||
* the 'xxx\0 yyy, zzz' and returns a pointer to the 'yyy, zzz'.
|
||||
*/
|
||||
static char *XFONT_GetStringItem( char *start )
|
||||
{
|
||||
#define XFONT_isspace(c) (isspace(c) || (c == '\r') || (c == 0x1a))
|
||||
char *lpchX, *lpch;
|
||||
|
||||
for (lpchX = start, lpch = NULL; *lpchX != '\0'; lpchX++ )
|
||||
{
|
||||
if( *lpchX == ',' )
|
||||
{
|
||||
if( lpch ) *lpch = '\0'; else *lpchX = '\0';
|
||||
while( *(++lpchX) )
|
||||
if( !XFONT_isspace(*lpchX) ) return lpchX;
|
||||
}
|
||||
else if( XFONT_isspace( *lpchX ) && !lpch ) lpch = lpchX;
|
||||
else lpch = NULL;
|
||||
}
|
||||
if( lpch ) *lpch = '\0';
|
||||
return NULL;
|
||||
#undef XFONT_isspace
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* XFONT_LoadAliases
|
||||
*
|
||||
|
@ -1564,10 +1597,16 @@ static void XFONT_LoadAliases(void)
|
|||
char buffer[MAX_LFD_LENGTH];
|
||||
int i = 0;
|
||||
LFD* lfd;
|
||||
HKEY hkey;
|
||||
|
||||
/* built-ins first */
|
||||
PROFILE_GetWineIniString( INIFontSection, INIDefaultSerif,
|
||||
"-bitstream-charter-", buffer, sizeof buffer );
|
||||
strcpy(buffer, "-bitstream-charter-");
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, INIFontSection, &hkey))
|
||||
{
|
||||
DWORD type, count = sizeof(buffer);
|
||||
RegQueryValueExA(hkey, INIDefaultSerif, 0, &type, buffer, &count);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
TRACE("Using '%s' as default serif font\n", buffer);
|
||||
lfd = LFD_Parse(buffer);
|
||||
/* NB XFONT_InitialCapitals should not change these standard aliases */
|
||||
|
@ -1581,8 +1620,13 @@ static void XFONT_LoadAliases(void)
|
|||
HeapFree(GetProcessHeap(), 0, lfd);
|
||||
}
|
||||
|
||||
PROFILE_GetWineIniString( INIFontSection, INIDefaultSansSerif,
|
||||
"-adobe-helvetica-", buffer, sizeof buffer);
|
||||
strcpy(buffer, "-adobe-helvetica-");
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, INIFontSection, &hkey))
|
||||
{
|
||||
DWORD type, count = sizeof(buffer);
|
||||
RegQueryValueExA(hkey, INIDefaultSansSerif, 0, &type, buffer, &count);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
TRACE("Using '%s' as default sans serif font\n", buffer);
|
||||
lfd = LFD_Parse(buffer);
|
||||
if (lfd)
|
||||
|
@ -1599,18 +1643,24 @@ static void XFONT_LoadAliases(void)
|
|||
/* then user specified aliases */
|
||||
do
|
||||
{
|
||||
BOOL bHaveAlias, bSubst;
|
||||
BOOL bSubst;
|
||||
char subsection[32];
|
||||
snprintf( subsection, sizeof subsection, "%s%i", INIAliasSection, i++ );
|
||||
|
||||
bHaveAlias = PROFILE_GetWineIniString( INIFontSection,
|
||||
subsection, "", buffer, sizeof buffer);
|
||||
if (!bHaveAlias)
|
||||
buffer[0] = 0;
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, INIFontSection, &hkey))
|
||||
{
|
||||
DWORD type, count = sizeof(buffer);
|
||||
RegQueryValueExA(hkey, subsection, 0, &type, buffer, &count);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
if (!buffer[0])
|
||||
break;
|
||||
|
||||
XFONT_InitialCapitals(buffer);
|
||||
lpResource = PROFILE_GetStringItem( buffer );
|
||||
bSubst = (PROFILE_GetStringItem( lpResource )) ? TRUE : FALSE;
|
||||
lpResource = XFONT_GetStringItem( buffer );
|
||||
bSubst = (XFONT_GetStringItem( lpResource )) ? TRUE : FALSE;
|
||||
if( lpResource && *lpResource )
|
||||
{
|
||||
lfd = LFD_Parse(lpResource);
|
||||
|
@ -1731,10 +1781,18 @@ static void XFONT_LoadIgnores(void)
|
|||
/* Others from INI file */
|
||||
do
|
||||
{
|
||||
HKEY hkey;
|
||||
sprintf( subsection, "%s%i", INIIgnoreSection, i++ );
|
||||
|
||||
if( PROFILE_GetWineIniString( INIFontSection,
|
||||
subsection, "", buffer, sizeof buffer) )
|
||||
buffer[0] = 0;
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, INIFontSection, &hkey))
|
||||
{
|
||||
DWORD type, count = sizeof(buffer);
|
||||
RegQueryValueExA(hkey, subsection, 0, &type, buffer, &count);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
if( buffer[0] )
|
||||
{
|
||||
char* pch = buffer;
|
||||
while( *pch && isspace(*pch) ) pch++;
|
||||
|
@ -2240,8 +2298,19 @@ static int XFONT_GetPointResolution( DeviceCaps* pDevCaps )
|
|||
int i, j, point_resolution, num = 3;
|
||||
int allowed_xfont_resolutions[3] = { 72, 75, 100 };
|
||||
int best = 0, best_diff = 65536;
|
||||
HKEY hkey;
|
||||
|
||||
point_resolution = 0;
|
||||
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, INIFontSection, &hkey))
|
||||
{
|
||||
char buffer[20];
|
||||
DWORD type, count = sizeof(buffer);
|
||||
if(!RegQueryValueExA(hkey, INIResolution, 0, &type, buffer, &count))
|
||||
point_resolution = atoi(buffer);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
point_resolution = PROFILE_GetWineIniInt( INIFontSection, INIResolution, 0 );
|
||||
if( !point_resolution )
|
||||
point_resolution = pDevCaps->logPixelsY;
|
||||
else
|
||||
|
@ -2714,6 +2783,7 @@ BOOL X11DRV_FONT_Init( DeviceCaps* pDevCaps )
|
|||
unsigned x_checksum;
|
||||
int i,res, x_count, fd, buf_size;
|
||||
char *buffer;
|
||||
HKEY hkey;
|
||||
|
||||
res = XFONT_GetPointResolution( pDevCaps );
|
||||
|
||||
|
@ -2740,7 +2810,15 @@ BOOL X11DRV_FONT_Init( DeviceCaps* pDevCaps )
|
|||
|
||||
/* deal with systemwide font metrics cache */
|
||||
|
||||
if( PROFILE_GetWineIniString( INIFontSection, INIGlobalMetrics, "", buffer, buf_size ) )
|
||||
buffer[0] = 0;
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, INIFontSection, &hkey))
|
||||
{
|
||||
DWORD type, count = buf_size;
|
||||
RegQueryValueExA(hkey, INIGlobalMetrics, 0, &type, buffer, &count);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
if( buffer[0] )
|
||||
{
|
||||
fd = open( buffer, O_RDONLY );
|
||||
XFONT_ReadCachedMetrics(fd, DefResolution, x_checksum, x_count);
|
||||
|
|
|
@ -53,10 +53,10 @@
|
|||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "winreg.h"
|
||||
#include "clipboard.h"
|
||||
#include "win.h"
|
||||
#include "x11drv.h"
|
||||
#include "options.h"
|
||||
#include "debugtools.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(clipboard);
|
||||
|
@ -217,16 +217,27 @@ BOOL X11DRV_CLIPBOARD_IsNativeProperty(Atom prop)
|
|||
BOOL X11DRV_CLIPBOARD_LaunchServer()
|
||||
{
|
||||
int iWndsLocks;
|
||||
char clearSelection[8];
|
||||
char clearSelection[8] = "0";
|
||||
int persistent_selection = 1;
|
||||
HKEY hkey;
|
||||
|
||||
/* If persistant selection has been disabled in the .winerc Clipboard section,
|
||||
* don't launch the server
|
||||
*/
|
||||
if ( !PROFILE_GetWineIniInt("Clipboard", "PersistentSelection", 1) )
|
||||
return FALSE;
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Clipboard", &hkey))
|
||||
{
|
||||
char buffer[20];
|
||||
DWORD type, count = sizeof(buffer);
|
||||
if(!RegQueryValueExA(hkey, "PersistentSelection", 0, &type, buffer, &count))
|
||||
persistent_selection = atoi(buffer);
|
||||
|
||||
/* Get the clear selection preference */
|
||||
sprintf(clearSelection, "%d", PROFILE_GetWineIniInt("Clipboard", "ClearAllSelections", 0));
|
||||
count = sizeof(clearSelection);
|
||||
RegQueryValueExA(hkey, "ClearAllSelections", 0, &type, clearSelection, &count);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
if ( !persistent_selection )
|
||||
return FALSE;
|
||||
|
||||
/* Start up persistant WINE X clipboard server process which will
|
||||
* take ownership of the X selection and continue to service selection
|
||||
|
@ -547,7 +558,19 @@ static BOOL X11DRV_CLIPBOARD_ReadSelection(UINT wFormat, Window w, Atom prop, At
|
|||
}
|
||||
|
||||
if(text_cp == (UINT)-1)
|
||||
text_cp = PROFILE_GetWineIniInt("x11drv", "TextCP", CP_ACP);
|
||||
{
|
||||
HKEY hkey;
|
||||
/* default value */
|
||||
text_cp = CP_ACP;
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\x11drv", &hkey))
|
||||
{
|
||||
char buf[20];
|
||||
DWORD type, count = sizeof(buf);
|
||||
if(!RegQueryValueExA(hkey, "TextCP", 0, &type, buf, &count))
|
||||
text_cp = atoi(buf);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
}
|
||||
|
||||
count = MultiByteToWideChar(text_cp, 0, lpstr, -1, NULL, 0);
|
||||
hUnicodeText = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, count * sizeof(WCHAR));
|
||||
|
@ -677,7 +700,17 @@ void X11DRV_CLIPBOARD_ReleaseSelection(Atom selType, Window w, HWND hwnd)
|
|||
{
|
||||
Display *display = thread_display();
|
||||
Atom xaClipboard = TSXInternAtom(display, "CLIPBOARD", False);
|
||||
int clearAllSelections = PROFILE_GetWineIniInt("Clipboard", "ClearAllSelections", 0);
|
||||
int clearAllSelections = 0;
|
||||
HKEY hkey;
|
||||
|
||||
if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Clipboard", &hkey))
|
||||
{
|
||||
char buffer[20];
|
||||
DWORD type, count = sizeof(buffer);
|
||||
if(!RegQueryValueExA(hkey, "ClearAllSelections", 0, &type, buffer, &count))
|
||||
clearAllSelections = atoi(buffer);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
/* w is the window that lost the selection
|
||||
* selectionPrevWindow is nonzero if CheckSelection() was called.
|
||||
|
|
Loading…
Reference in New Issue