Commit 00377a78 authored by Alexandre Julliard's avatar Alexandre Julliard

Store config file contents in the registry so we only have to load it

once per session. Replaced PROFILE_EnumerateWineIniSection by PROFILE_EnumWineIniString. Removed a few unnecessary/unused command-line options.
parent 67a24c8c
......@@ -21,20 +21,10 @@ static int pop_driver(char **, char **, int *);
static int console_initialized = FALSE;
int CONSOLE_Init(char *drivers)
static int CONSOLE_Init(void)
{
/* When this function is called drivers should be a string
that consists of driver names followed by plus (+) signs
to denote additions.
For example:
drivers = tty Load just the tty driver
drivers = ncurses+xterm Load ncurses then xterm
The "default" value is just tty.
*/
char *single;
char buffer[256];
char *single, *drivers = buffer;
int length;
char initial_rows[5];
char initial_columns[5];
......@@ -43,6 +33,18 @@ int CONSOLE_Init(char *drivers)
driver.console_out = stdout;
driver.console_in = stdin;
/* drivers should be a string that consists of driver names
followed by plus (+) signs to denote additions.
For example:
drivers = tty Load just the tty driver
drivers = ncurses+xterm Load ncurses then xterm
The "default" value is just tty.
*/
PROFILE_GetWineIniString( "console", "Drivers", CONSOLE_DEFAULT_DRIVER,
buffer, sizeof(buffer) );
while (pop_driver(&drivers, &single, &length))
{
if (!strncmp(single, "tty", length))
......@@ -92,7 +94,7 @@ int CONSOLE_Init(char *drivers)
void CONSOLE_Write(char out, int fg_color, int bg_color, int attribute)
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.write)
{
......@@ -111,7 +113,7 @@ void CONSOLE_Close()
void CONSOLE_MoveCursor(char row, char col)
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.moveCursor)
{
......@@ -125,7 +127,7 @@ void CONSOLE_ClearWindow(char row1, char col1, char row2, char col2,
int bg_color, int attribute)
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.clearWindow)
{
......@@ -139,7 +141,7 @@ void CONSOLE_ScrollUpWindow(char row1, char col1, char row2, char col2,
char lines, int bg_color, int attribute)
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.scrollUpWindow)
{
......@@ -154,7 +156,7 @@ void CONSOLE_ScrollDownWindow(char row1, char col1, char row2, char col2,
char lines, int bg_color, int attribute)
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.scrollDownWindow)
{
......@@ -171,7 +173,7 @@ int CONSOLE_CheckForKeystroke(char *scan, char *ascii)
a conv_* function in int16.c. Yuck. */
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.checkForKeystroke)
return driver.checkForKeystroke(scan, ascii);
......@@ -182,7 +184,7 @@ int CONSOLE_CheckForKeystroke(char *scan, char *ascii)
void CONSOLE_GetKeystroke(char *scan, char *ascii)
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.getKeystroke)
driver.getKeystroke(scan, ascii);
......@@ -191,7 +193,7 @@ void CONSOLE_GetKeystroke(char *scan, char *ascii)
void CONSOLE_GetCursorPosition(char *row, char *col)
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.getCursorPosition)
driver.getCursorPosition(row, col);
......@@ -200,7 +202,7 @@ void CONSOLE_GetCursorPosition(char *row, char *col)
void CONSOLE_GetCharacterAtCursor(char *ch, int *fg, int *bg, int *a)
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.getCharacterAtCursor)
driver.getCharacterAtCursor(ch, fg, bg, a);
......@@ -209,7 +211,7 @@ void CONSOLE_GetCharacterAtCursor(char *ch, int *fg, int *bg, int *a)
void CONSOLE_Refresh()
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.refresh)
driver.refresh();
......@@ -218,7 +220,7 @@ void CONSOLE_Refresh()
int CONSOLE_AllocColor(int color)
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.allocColor)
return driver.allocColor(color);
......@@ -229,7 +231,7 @@ int CONSOLE_AllocColor(int color)
void CONSOLE_ClearScreen()
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.clearScreen)
{
......@@ -242,7 +244,7 @@ void CONSOLE_ClearScreen()
char CONSOLE_GetCharacter()
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
/* I'm not sure if we need this really. This is a function that can be
accelerated that returns the next *non extended* keystroke */
......@@ -255,7 +257,7 @@ char CONSOLE_GetCharacter()
void CONSOLE_ResizeScreen(int x, int y)
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.resizeScreen)
driver.resizeScreen(x, y);
......@@ -270,7 +272,7 @@ void CONSOLE_NotifyResizeScreen(int x, int y)
void CONSOLE_SetBackgroundColor(int fg, int bg)
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.setBackgroundColor)
driver.setBackgroundColor(fg, bg);
......@@ -279,7 +281,7 @@ void CONSOLE_SetBackgroundColor(int fg, int bg)
void CONSOLE_GetBackgroundColor(int *fg, int *bg)
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
if (driver.getBackgroundColor)
driver.getBackgroundColor(fg, bg);
......@@ -288,7 +290,7 @@ void CONSOLE_GetBackgroundColor(int *fg, int *bg)
void CONSOLE_WriteRawString(char *str)
{
if (!console_initialized)
console_initialized = CONSOLE_Init(driver.driver_list);
console_initialized = CONSOLE_Init();
/* This is a special function that is only for internal use and
does not actually call any of the console drivers. It's
......
......@@ -91,12 +91,6 @@ For more information, see the
file contained in the source distribution.
.SH OPTIONS
.TP
.I -backingstore
Turn on backing store
Backingstore stores pixels of obscured window parts off-screen.
This buffer is used to restore these parts faster once they are to reappear,
but it consumes additional memory of course.
.TP
.I -config filename
Use the named configuration file rather than the default
(@sysconfdir@/wine.conf or ~/.winerc).
......@@ -212,12 +206,6 @@ Read only files may not be opened in write mode (the default is to
allow opening read-only files for writing, because most Windows
programs always request read-write access, even on CD-ROM drives...).
.TP
.I -fixedmap
Use a "standard" color map.
.TP
.I -iconic
Start as an icon
.TP
.I -language xx
Set the language to
.I xx
......@@ -227,15 +215,6 @@ Set the language to
Create each top-level window as a properly managed X window instead of
creating our own "sticky" window.
.TP
.I -mode modename
Determines the mode in which
.B wine
is started. Possible mode names are
.I standard
and
.I enhanced.
Enhanced mode is the default (when no -mode option is specified).
.TP
.I -name name
Set the application name
.TP
......
......@@ -382,31 +382,6 @@ static void PSDRV_ReencodeCharWidths(AFM *afm)
return;
}
/***********************************************************
*
* PSDRV_afmfilesCallback
*
* Callback for PROFILE_EnumerateWineIniSection
* Try to parse AFM file `value', alter the CharWidths field of afm struct if
* the font is using AdobeStandardEncoding to correspond to WinANSI, then add
* afm to system font list.
*/
static void PSDRV_afmfilesCallback(char const *key, char const *value,
void *user)
{
AFM *afm;
afm = PSDRV_AFMParse(value);
if(afm) {
if(afm->EncodingScheme &&
!strcmp(afm->EncodingScheme, "AdobeStandardEncoding")) {
PSDRV_ReencodeCharWidths(afm);
}
PSDRV_AddAFMtoList(&PSDRV_AFMFontList, afm);
}
return;
}
/***********************************************************
*
......@@ -437,7 +412,22 @@ static void PSDRV_DumpFontList(void)
*/
BOOL PSDRV_GetFontMetrics(void)
{
PROFILE_EnumerateWineIniSection( "afmfiles", PSDRV_afmfilesCallback, NULL);
int idx = 0;
char key[256];
char value[256];
while (PROFILE_EnumWineIniString( "afmfiles", idx++, key, sizeof(key), value, sizeof(value)))
{
AFM *afm = PSDRV_AFMParse(value);
if (afm)
{
if(afm->EncodingScheme &&
!strcmp(afm->EncodingScheme, "AdobeStandardEncoding")) {
PSDRV_ReencodeCharWidths(afm);
}
PSDRV_AddAFMtoList(&PSDRV_AFMFontList, afm);
}
}
PSDRV_DumpFontList();
return TRUE;
}
......
......@@ -2121,83 +2121,6 @@ static BOOL XFONT_WriteCachedMetrics( int fd, unsigned x_checksum, int x_count,
}
/***********************************************************************
* XFONT_CheckIniSection
*
* INIT ONLY
*
* Examines wine.conf for old/invalid font entries and recommend changes to
* the user.
*
* Revision history
* 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation.
*/
static void XFONT_CheckIniCallback(char const *, char const *, void *);
static char const *fontmsgprologue =
"Wine warning:\n"
" The following entries in the [fonts] section of the wine.conf file are\n"
" obsolete or invalid:\n";
static char const *fontmsgepilogue =
" These entries should be eliminated or updated.\n"
" See the documentation/fonts file for more information.\n";
static int XFONT_CheckIniSection(void)
{
int found = 0;
PROFILE_EnumerateWineIniSection("Fonts", &XFONT_CheckIniCallback,
(void *)&found);
if(found)
MESSAGE(fontmsgepilogue);
return 1;
}
static void XFONT_CheckIniCallback(
char const *key,
char const *value,
void *found)
{
/* Ignore any keys that start with potential comment characters "'", '#',
or ';'. */
if(key[0] == '\'' || key[0] == '#' || key[0] == ';' || key[0] == '\0')
return;
/* Make sure this is a valid key */
if((strncasecmp(key, INIAliasSection, 5) == 0) ||
(strncasecmp(key, INIIgnoreSection, 6) == 0) ||
(strcasecmp( key, INIDefault) == 0) ||
(strcasecmp( key, INIDefaultFixed) == 0) ||
(strcasecmp( key, INIGlobalMetrics) == 0) ||
(strcasecmp( key, INIResolution) == 0) ||
(strcasecmp( key, INIDefaultSerif) == 0) ||
(strcasecmp( key, INIDefaultSansSerif) ==0) )
{
/* Valid key; make sure the value doesn't contain a wildcard */
if(strchr(value, '*')) {
if(*(int *)found == 0) {
MESSAGE(fontmsgprologue);
++*(int *)found;
}
MESSAGE(" %s=%s [no wildcards allowed]\n", key, value);
}
}
else {
/* Not a valid key */
if(*(int *)found == 0) {
MESSAGE(fontmsgprologue);
++*(int *)found;
}
MESSAGE(" %s=%s [obsolete]\n", key, value);
}
return;
}
/***********************************************************************
* XFONT_GetPointResolution()
*
* INIT ONLY
......@@ -2631,8 +2554,6 @@ BOOL X11DRV_FONT_Init( DeviceCaps* pDevCaps )
int i,res, x_count, fd, buf_size;
char *buffer;
XFONT_CheckIniSection();
res = XFONT_GetPointResolution( pDevCaps );
x_pattern = TSXListFonts(display, "*", MAX_FONTS, &x_count );
......
......@@ -58,7 +58,6 @@ typedef struct CONSOLE_DRIVER
/* Other data */
int norefresh;
char *driver_list;
FILE *console_out;
FILE *console_in;
int x_res;
......@@ -69,7 +68,6 @@ typedef struct CONSOLE_DRIVER
extern CONSOLE_device driver; /* Global driver struct */
/* Generic defines */
int CONSOLE_Init(char *drivers);
void CONSOLE_Close(void);
void CONSOLE_Write(char out, int fg_color, int bg_color, int attribute);
void CONSOLE_MoveCursor(char row, char col);
......
......@@ -15,7 +15,6 @@ extern int MAIN_GetLanguageID(char*lang, char*country, char*charset, char*dialec
extern BOOL MAIN_ParseDebugOptions(char *options);
extern void MAIN_ParseLanguageOption( char *arg );
extern void MAIN_ParseModeOption( char *arg );
extern BOOL RELAY_Init(void);
extern void THUNK_InitCallout(void);
......
......@@ -51,13 +51,6 @@ typedef struct
extern const WINE_LANGUAGE_DEF Languages[];
/* Supported modes */
typedef enum
{
MODE_STANDARD,
MODE_ENHANCED
} WINE_MODE;
struct options
{
int *argc;
......@@ -66,15 +59,10 @@ struct options
char * programName; /* To use when loading resources */
char *dllFlags; /* -dll flags (hack for Winelib support) */
int usePrivateMap;
int useFixedMap;
int synchronous; /* X synchronous mode */
int backingstore; /* Use backing store */
short cmdShow;
int debug;
int failReadOnly; /* Opening a read only file will fail
if write access is requested */
WINE_MODE mode; /* Start Wine in selected mode
(standard/enhanced) */
WINE_LANGUAGE language; /* Current language */
int managed; /* Managed windows */
int perfectGraphics; /* Favor correctness over speed for graphics */
......@@ -95,14 +83,10 @@ extern int PROFILE_LoadWineIni(void);
extern void PROFILE_UsageWineIni(void);
extern int PROFILE_GetWineIniString( const char *section, const char *key_name,
const char *def, char *buffer, int len );
extern int PROFILE_GetWineIniInt( const char *section, const char *key_name,
int def );
extern int PROFILE_EnumerateWineIniSection(
char const *section,
void (*callback)(char const *key, char const *name, void *user),
void *userptr );
extern int PROFILE_GetWineIniBool( char const *section, char const *key_name,
int def );
extern BOOL PROFILE_EnumWineIniString( const char *section, int index,
char *name, int name_len, char *buffer, int len );
extern int PROFILE_GetWineIniInt( const char *section, const char *key_name, int def );
extern int PROFILE_GetWineIniBool( char const *section, char const *key_name, int def );
extern char* PROFILE_GetStringItem( char* );
/* Version functions */
......
......@@ -94,13 +94,9 @@ struct options Options =
NULL, /* programName */
NULL, /* dllFlags */
FALSE, /* usePrivateMap */
FALSE, /* useFixedMap */
FALSE, /* synchronous */
FALSE, /* backing store */
SW_SHOWNORMAL, /* cmdShow */
FALSE,
FALSE, /* failReadOnly */
MODE_ENHANCED, /* Enhanced mode */
#ifdef DEFAULT_LANG
DEFAULT_LANG, /* Default language */
#else
......@@ -122,9 +118,7 @@ static const char szUsage[] =
"Usage: %s [options] \"program_name [arguments]\"\n"
"\n"
"Options:\n"
" -backingstore Turn on backing store\n"
" -config name Specify config file to use\n"
" -console driver Select which driver(s) to use for the console\n"
" -debug Enter debugger before starting application\n"
" -debugmsg name Turn debugging-messages on or off\n"
" -depth n Change the depth to use for multiple-depth screens\n"
......@@ -132,13 +126,10 @@ static const char szUsage[] =
" -display name Use the specified display\n"
" -dll name Enable or disable built-in DLLs\n"
" -failreadonly Read only files may not be opened in write mode\n"
" -fixedmap Use a \"standard\" color map\n"
" -help Show this help message\n"
" -iconic Start as an icon\n"
" -language xx Set the language (one of Br,Ca,Cs,Cy,Da,De,En,Eo,Es,Fi,Fr,Ga,Gd,Gv\n"
" Hu,It,Ko,Kw,Nl,No,Pl,Pt,Sv,Ru,Wa)\n"
" -managed Allow the window manager to manage created windows\n"
" -mode mode Start Wine in a particular mode (standard or enhanced)\n"
" -name name Set the application name\n"
" -nodga Disable XFree86 DGA extensions\n"
" -noxshm Disable XSHM extension\n"
......@@ -719,23 +710,6 @@ void MAIN_ParseLanguageOption( char *arg )
/***********************************************************************
* MAIN_ParseModeOption
*
* Parse -mode option.
*/
void MAIN_ParseModeOption( char *arg )
{
if (!lstrcmpiA("enhanced", arg)) Options.mode = MODE_ENHANCED;
else if (!lstrcmpiA("standard", arg)) Options.mode = MODE_STANDARD;
else
{
MESSAGE( "Invalid mode '%s' specified.\n", arg);
MESSAGE( "Valid modes are: 'standard', 'enhanced' (default).\n");
ExitProcess(1);
}
}
/***********************************************************************
* MAIN_ParseOptions
*
* Parse command line options and open display.
......
......@@ -471,22 +471,7 @@ DWORD WINAPI GetWinFlags16(void)
GetSystemInfo(&si);
/* There doesn't seem to be any Pentium flag. */
result = cpuflags[MIN (si.wProcessorLevel, 4)];
switch(Options.mode)
{
case MODE_STANDARD:
result |= WF_STANDARD | WF_PMODE | WF_80x87;
break;
case MODE_ENHANCED:
result |= WF_ENHANCED | WF_PMODE | WF_80x87 | WF_PAGING;
break;
default:
ERR("Unknown mode set? This shouldn't happen. Check GetWinFlags()!\n");
break;
}
result = cpuflags[MIN (si.wProcessorLevel, 4)] | WF_ENHANCED | WF_PMODE | WF_80x87 | WF_PAGING;
if (si.wProcessorLevel >= 4) result |= WF_HASCPUID;
ovi.dwOSVersionInfoSize = sizeof(ovi);
GetVersionExA(&ovi);
......
......@@ -20,7 +20,6 @@
#include <unistd.h>
#include "clipboard.h"
#include "console.h"
#include "debugtools.h"
#include "desktop.h"
#include "keyboard.h"
......@@ -49,7 +48,6 @@ void X11DRV_USER_RestoreSetup(void);
static XrmOptionDescRec optionsTable[] =
{
{ "-backingstore", ".backingstore", XrmoptionNoArg, (caddr_t)"on" },
{ "-desktop", ".desktop", XrmoptionSepArg, (caddr_t)NULL },
{ "-depth", ".depth", XrmoptionSepArg, (caddr_t)NULL },
{ "-display", ".display", XrmoptionSepArg, (caddr_t)NULL },
......@@ -58,20 +56,17 @@ static XrmOptionDescRec optionsTable[] =
{ "-name", ".name", XrmoptionSepArg, (caddr_t)NULL },
{ "-perfect", ".perfect", XrmoptionNoArg, (caddr_t)"on" },
{ "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" },
{ "-fixedmap", ".fixedmap", XrmoptionNoArg, (caddr_t)"on" },
{ "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" },
{ "-debug", ".debug", XrmoptionNoArg, (caddr_t)"on" },
{ "-debugmsg", ".debugmsg", XrmoptionSepArg, (caddr_t)NULL },
{ "-dll", ".dll", XrmoptionSepArg, (caddr_t)NULL },
{ "-failreadonly", ".failreadonly", XrmoptionNoArg, (caddr_t)"on" },
{ "-mode", ".mode", XrmoptionSepArg, (caddr_t)NULL },
{ "-managed", ".managed", XrmoptionNoArg, (caddr_t)"off"},
{ "-winver", ".winver", XrmoptionSepArg, (caddr_t)NULL },
{ "-config", ".config", XrmoptionSepArg, (caddr_t)NULL },
{ "-nodga", ".nodga", XrmoptionNoArg, (caddr_t)"off"},
{ "-noxshm", ".noxshm", XrmoptionNoArg, (caddr_t)"off"},
{ "-dxgrab", ".dxgrab", XrmoptionNoArg, (caddr_t)"on" },
{ "-console", ".console", XrmoptionSepArg, (caddr_t)NULL },
{ "-dosver", ".dosver", XrmoptionSepArg, (caddr_t)NULL }
};
......@@ -229,16 +224,10 @@ void X11DRV_USER_ParseOptions(int *argc, char *argv[])
Options.programName, argc, argv );
/* Get all options */
if (X11DRV_USER_GetResource( db, ".iconic", &value ))
Options.cmdShow = SW_SHOWMINIMIZED;
if (X11DRV_USER_GetResource( db, ".privatemap", &value ))
Options.usePrivateMap = TRUE;
if (X11DRV_USER_GetResource( db, ".fixedmap", &value ))
Options.useFixedMap = TRUE;
if (X11DRV_USER_GetResource( db, ".synchronous", &value ))
Options.synchronous = TRUE;
if (X11DRV_USER_GetResource( db, ".backingstore", &value ))
Options.backingstore = TRUE;
if (X11DRV_USER_GetResource( db, ".debug", &value ))
Options.debug = TRUE;
if (X11DRV_USER_GetResource( db, ".failreadonly", &value ))
......@@ -253,8 +242,6 @@ void X11DRV_USER_ParseOptions(int *argc, char *argv[])
MAIN_ParseLanguageOption( (char *)value.addr );
if (X11DRV_USER_GetResource( db, ".managed", &value))
Options.managed = TRUE;
if (X11DRV_USER_GetResource( db, ".mode", &value))
MAIN_ParseModeOption( (char *)value.addr );
if (X11DRV_USER_GetResource( db, ".debugoptions", &value))
MAIN_ParseDebugOptions((char*)value.addr);
if (X11DRV_USER_GetResource( db, ".debugmsg", &value))
......@@ -284,10 +271,6 @@ void X11DRV_USER_ParseOptions(int *argc, char *argv[])
Options.noXSHM = TRUE;
if (X11DRV_USER_GetResource( db, ".dxgrab", &value))
Options.DXGrab = TRUE;
if (X11DRV_USER_GetResource( db, ".console", &value))
driver.driver_list = xstrdup((char *)value.addr);
else
driver.driver_list = CONSOLE_DEFAULT_DRIVER;
}
/***********************************************************************
......
......@@ -216,7 +216,7 @@ BOOL X11DRV_WND_CreateWindow(WND *wndPtr, CLASS *classPtr, CREATESTRUCTA *cs, BO
win_attr.bit_gravity = (classPtr->style & (CS_VREDRAW | CS_HREDRAW)) ? BGForget : BGNorthWest;
win_attr.colormap = X11DRV_PALETTE_PaletteXColormap;
win_attr.backing_store = Options.backingstore ? WhenMapped : NotUseful;
win_attr.backing_store = NotUseful;
win_attr.save_under = ((classPtr->style & CS_SAVEBITS) != 0);
win_attr.cursor = X11DRV_MOUSE_XCursor;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment