Commit cd0b7897 authored by Mike Hearn's avatar Mike Hearn Committed by Alexandre Julliard

- Remove "PerfectGraphics", "Use XSHM extension", and "Use a private

colour map". - Implement a simple transaction system for instant apply. - Complete the desktop size code, this now reads and writes to the registry correctly. - Remove const modifier from version accessor functions. - Change registry root to Wine/WineCfg for testing purposes.
parent 2a3d5fc1
......@@ -62,28 +62,24 @@ IDD_X11DRVCFG DIALOG DISCARDABLE 0, 0, 260, 250
STYLE WS_CHILD | WS_DISABLED
FONT 8, "MS Sans Serif"
BEGIN
EDITTEXT IDC_SYSCOLORS,100,41,40,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Use a private color map",IDC_PRIVATEMAP,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,15,62,91,10
CONTROL "Favor correctness over speed",IDC_PERFECTGRAPH,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,15,76,117,10
CONTROL "Use XFree DGA extension",IDC_XDGA,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,141,62,97,10
CONTROL "Use XFree Shm extension",IDC_XSHM,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,141,76,96,10
CONTROL "Enable Wine desktop",IDC_MANAGED,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,17,143,84,10
EDITTEXT IDC_DESKTOP_WIDTH,64,159,40,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
EDITTEXT IDC_DESKTOP_HEIGHT,117,159,40,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
GROUPBOX "Render Settings",IDC_STATIC,8,4,244,90
BS_AUTOCHECKBOX | WS_TABSTOP,145,44,97,10
CONTROL "Enable Wine desktop",IDC_ENABLE_DESKTOP,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,17,110,84,10
EDITTEXT IDC_DESKTOP_WIDTH,64,125,40,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
EDITTEXT IDC_DESKTOP_HEIGHT,117,125,40,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
GROUPBOX "Render Settings",IDC_STATIC,8,4,244,60
LTEXT "The driver color and render settings are used to optimise the way in which colors and applications are displayed.",
IDC_STATIC,15,17,228,22
LTEXT "Allocated system colors:",IDC_STATIC,15,43,76,8
GROUPBOX "Wine Desktop",IDC_STATIC,8,99,244,83
EDITTEXT IDC_SYSCOLORS,90,41,40,14,ES_AUTOHSCROLL | ES_NUMBER
GROUPBOX "Wine Desktop",IDC_STATIC,8,65,244,83
LTEXT "Wine can be setup to emulate a windows desktop, or can be run in ""Managed"" mode (default) where the default X11 windows manager/environment is resposible for placing the windows.",
IDC_STATIC,15,112,228,28
LTEXT "Desktop size:",IDC_DESKTOP_SIZE,17,161,44,8,WS_DISABLED
LTEXT "X",IDC_DESKTOP_BY,108,161,8,8,WS_DISABLED
IDC_STATIC,15,77,228,28
LTEXT "Desktop size:",IDC_DESKTOP_SIZE,17,125,44,8,WS_DISABLED
LTEXT "X",IDC_DESKTOP_BY,108,125,8,8,WS_DISABLED
END
IDD_DLLCFG DIALOG DISCARDABLE 0, 0, 260, 250
......
......@@ -62,6 +62,9 @@ initGeneralDlg (HWND hDlg)
{
int i;
const VERSION_DESC *pVer = NULL;
char *curWinVer = getConfigValue("Version", "Windows", "win98");
char *curDOSVer = getConfigValue("Version", "DOS", "6.22");
char *curWineLook = getConfigValue("Tweak.Layout", "WineLook", "win95");
if ((pVer = getWinVersions ()))
{
......@@ -69,7 +72,7 @@ initGeneralDlg (HWND hDlg)
{
SendDlgItemMessage (hDlg, IDC_WINVER, CB_ADDSTRING,
0, (LPARAM) pVer->szDescription);
if (!strcmp (pVer->szVersion, config.szWinVer))
if (!strcmp (pVer->szVersion, curWinVer))
SendDlgItemMessage (hDlg, IDC_WINVER, CB_SETCURSEL,
(WPARAM) i, 0);
}
......@@ -80,7 +83,7 @@ initGeneralDlg (HWND hDlg)
{
SendDlgItemMessage (hDlg, IDC_DOSVER, CB_ADDSTRING,
0, (LPARAM) pVer->szDescription);
if (!strcmp (pVer->szVersion, config.szDOSVer))
if (!strcmp (pVer->szVersion, curDOSVer))
SendDlgItemMessage (hDlg, IDC_DOSVER, CB_SETCURSEL,
(WPARAM) i, 0);
}
......@@ -91,11 +94,15 @@ initGeneralDlg (HWND hDlg)
{
SendDlgItemMessage (hDlg, IDC_WINELOOK, CB_ADDSTRING,
0, (LPARAM) pVer->szDescription);
if (!strcmp (pVer->szVersion, config.szWinLook))
if (!strcmp (pVer->szVersion, curWineLook))
SendDlgItemMessage (hDlg, IDC_WINELOOK, CB_SETCURSEL,
(WPARAM) i, 0);
}
}
free(curWinVer);
free(curDOSVer);
free(curWineLook);
}
INT_PTR CALLBACK
......@@ -112,12 +119,12 @@ GeneralDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
case IDC_WINVER: if (HIWORD(wParam) == CBN_SELCHANGE) {
/* user changed the wine version combobox */
int selection = SendDlgItemMessage( hDlg, IDC_WINVER, CB_GETCURSEL, 0, 0);
const VERSION_DESC *desc = getWinVersions();
VERSION_DESC *desc = getWinVersions();
while (selection > 0) {
desc++; selection--;
}
strcpy(config.szWinVer, desc->szVersion);
addTransaction("Version", "Windows", ACTION_SET, desc->szVersion);
}
break;
}
......@@ -264,12 +271,12 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow)
/* Until winecfg is fully functional, warn users that it is incomplete and doesn't do anything */
WINE_FIXME("The winecfg tool is not yet complete, and does not actually alter your configuration.\n");
WINE_FIXME("If you want to alter the way Wine works, look in the ~/.wine/config file for more information.\n");
/*
* Load the configuration from registry
*/
loadConfig (&config);
if (initialize() != 0) {
WINE_ERR("initialization failed, aborting\n");
ExitProcess(1);
}
/*
* The next 3 lines should be all that is needed
* for the Wine Configuration property sheet
......@@ -277,7 +284,6 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow)
InitCommonControls ();
if (doPropertySheet (hInstance, NULL) > 0) {
WINE_TRACE("OK\n");
saveConfig(&config);
} else
WINE_TRACE("Cancel\n");
......
......@@ -80,7 +80,7 @@ static DLL_DESC sDLLType[] = {
/*****************************************************************************
*/
const VERSION_DESC* getWinVersions(void)
VERSION_DESC* getWinVersions(void)
{
return sWinVersions;
}
......@@ -88,7 +88,7 @@ const VERSION_DESC* getWinVersions(void)
/*****************************************************************************
*/
const VERSION_DESC* getDOSVersions(void)
VERSION_DESC* getDOSVersions(void)
{
return sDOSVersions;
}
......@@ -96,7 +96,7 @@ const VERSION_DESC* getDOSVersions(void)
/*****************************************************************************
*/
const VERSION_DESC* getWinelook(void)
VERSION_DESC* getWinelook(void)
{
return sWineLook;
}
......@@ -104,7 +104,7 @@ const VERSION_DESC* getWinelook(void)
/*****************************************************************************
*/
const DLL_DESC* getDLLDefaults(void)
DLL_DESC* getDLLDefaults(void)
{
return sDLLType;
}
......@@ -93,9 +93,9 @@ typedef struct
int nSynchronous;
} X11DRV_DESC;
const VERSION_DESC *getWinVersions(void);
const VERSION_DESC *getDOSVersions(void);
const VERSION_DESC *getWinelook(void);
const DLL_DESC *getDLLDefaults(void);
VERSION_DESC *getWinVersions(void);
VERSION_DESC *getDOSVersions(void);
VERSION_DESC *getWinelook(void);
DLL_DESC *getDLLDefaults(void);
#endif
......@@ -101,3 +101,4 @@
#define IDC_BOX_LABELSERIAL 1071
#define IDC_STATIC_SERIAL 1072
#define IDC_STATIC_LABEL 1073
#define IDC_ENABLE_DESKTOP 1074
......@@ -37,6 +37,60 @@
#define IS_OPTION_FALSE(ch) \
((ch) == 'n' || (ch) == 'N' || (ch) == 'f' || (ch) == 'F' || (ch) == '0')
#define return_if_fail(try, ret) \
if (!(try)) { \
WINE_ERR("assertion (##try) failed, returning\n"); \
return ret; \
}
/* Transaction management */
enum transaction_action {
ACTION_SET,
ACTION_REMOVE
};
struct transaction {
char *section;
char *key;
char *newValue;
enum transaction_action action;
struct transaction *next, *prev;
};
extern struct transaction *tqhead, *tqtail;
extern int instantApply; /* non-zero means apply all changes instantly */
/* Commits a transaction to the registry */
void processTransaction(struct transaction *trans);
/* Processes every pending transaction in the queue, removing them as it works from head to tail */
void processTransQueue();
/* Adds a transaction to the head of the queue. If we're using instant apply, this calls processTransaction
* action can be either:
* ACTION_SET -> this transaction will change a registry key, newValue is the replacement value
* ACTION_REMOVE -> this transaction will remove a registry key. In this case, newValue is ignored.
*/
void addTransaction(char *section, char *key, enum transaction_action action, char *newValue);
/* frees the transaction structure, all fields, and removes it from the queue if in it */
void destroyTransaction(struct transaction *trans);
/* Initializes the transaction system */
int initialize(void);
typedef struct structWineCfg
{
char szWinVer[MAX_VERSION_LENGTH];
......@@ -68,11 +122,13 @@ int freeConfig(WINECFG_DESC *pCfg);
int loadConfig(WINECFG_DESC *pCfg);
int saveConfig(const WINECFG_DESC *pCfg);
int setConfigValue (HKEY hCurrent, char *subkey, char *valueName, const char *value);
int getConfigValue (HKEY hCurrent, char *subkey, char *valueName, char *retVal, int length, char *defaultResult);
int setConfigValue (char *subkey, char *valueName, const char *value);
char *getConfigValue (char *subkey, char *valueName, char *defaultResult);
HRESULT doesConfigValueExist (char *subkey, char *valueName);
HRESULT removeConfigValue (char *subkey, char *valueName);
/* X11DRV */
void initX11DrvDlg (HWND hDlg);
void saveX11DrvDlgSettings (HWND hDlg);
INT_PTR CALLBACK X11DrvDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
......@@ -84,6 +140,6 @@ void saveDriveSettings (HWND hDlg);
INT_PTR CALLBACK DriveDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DriveEditDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
#define WINE_KEY_ROOT "Software\\Wine\\Wine\\Config"
#define WINE_KEY_ROOT "Software\\Wine\\WineCfg\\Config"
#endif
......@@ -34,67 +34,139 @@
WINE_DEFAULT_DEBUG_CHANNEL(winecfg);
#define RES_MAXLEN 5 /* the maximum number of characters in a screen dimension. 5 digits should be plenty, what kind of crazy person runs their screen >10,000 pixels across? */
int updatingUI;
void updateGUIForDesktopMode(HWND hDlg) {
WINE_TRACE("\n");
updatingUI = TRUE;
/* do we have desktop mode enabled? */
if (doesConfigValueExist("x11drv", "Desktop") == S_OK) {
CheckDlgButton(hDlg, IDC_ENABLE_DESKTOP, BST_CHECKED);
/* enable the controls */
EnableWindow(GetDlgItem(hDlg, IDC_DESKTOP_WIDTH), 1);
EnableWindow(GetDlgItem(hDlg, IDC_DESKTOP_HEIGHT), 1);
EnableWindow(GetDlgItem(hDlg, IDC_DESKTOP_SIZE), 1);
EnableWindow(GetDlgItem(hDlg, IDC_DESKTOP_BY), 1);
SetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_WIDTH), "640");
SetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_HEIGHT), "480");
}
else {
CheckDlgButton(hDlg, IDC_ENABLE_DESKTOP, BST_UNCHECKED);
/* disable the controls */
EnableWindow(GetDlgItem(hDlg, IDC_DESKTOP_WIDTH), 0);
EnableWindow(GetDlgItem(hDlg, IDC_DESKTOP_HEIGHT), 0);
EnableWindow(GetDlgItem(hDlg, IDC_DESKTOP_SIZE), 0);
EnableWindow(GetDlgItem(hDlg, IDC_DESKTOP_BY), 0);
SetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_WIDTH), "");
SetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_HEIGHT), "");
}
updatingUI = FALSE;
}
/* pokes the win32 api to setup the dialog from the config struct */
void initX11DrvDlg (HWND hDlg)
{
char szBuf[20];
char *buf;
int x, y;
char *i;
updatingUI = TRUE;
updateGUIForDesktopMode(hDlg);
/* desktop size */
buf = getConfigValue("x11drv", "Desktop", "640x480");
i = strchr(buf, 'x');
*i = '\0';
i++;
SetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_WIDTH), buf);
SetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_HEIGHT), i);
free(buf);
SendDlgItemMessage(hDlg, IDC_DESKTOP_WIDTH, EM_LIMITTEXT, RES_MAXLEN, 0);
SendDlgItemMessage(hDlg, IDC_DESKTOP_HEIGHT, EM_LIMITTEXT, RES_MAXLEN, 0);
updatingUI = FALSE;
}
/* system colors */
sprintf (szBuf, "%d", config.sX11Drv.nSysColors);
SendDlgItemMessage (hDlg, IDC_SYSCOLORS, WM_SETTEXT, 0, (LPARAM) szBuf);
/* private color map */
if (config.sX11Drv.nPrivateMap)
SendDlgItemMessage( hDlg, IDC_PRIVATEMAP, BM_SETCHECK, BST_CHECKED, 0);
/* perfect graphics */
if (config.sX11Drv.nPerfect)
SendDlgItemMessage( hDlg, IDC_PERFECTGRAPH, BM_SETCHECK, BST_CHECKED, 0);
void setFromDesktopSizeEdits(HWND hDlg) {
char *width = malloc(RES_MAXLEN+1);
char *height = malloc(RES_MAXLEN+1);
char *newStr = malloc((RES_MAXLEN*2) + 2);
/* desktop size */
sprintf (szBuf, "%d", config.sX11Drv.nDesktopSizeX);
SendDlgItemMessage (hDlg, IDC_DESKTOP_WIDTH, WM_SETTEXT, 0, (LPARAM) szBuf);
sprintf (szBuf, "%d", config.sX11Drv.nDesktopSizeY);
SendDlgItemMessage (hDlg, IDC_DESKTOP_HEIGHT, WM_SETTEXT, 0, (LPARAM) szBuf);
if (updatingUI) return;
WINE_TRACE("\n");
GetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_WIDTH), width, RES_MAXLEN+1);
GetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_HEIGHT), height, RES_MAXLEN+1);
if (config.sX11Drv.nDGA) SendDlgItemMessage( hDlg, IDC_XDGA, BM_SETCHECK, BST_CHECKED, 0);
if (config.sX11Drv.nXShm) SendDlgItemMessage( hDlg, IDC_XSHM, BM_SETCHECK, BST_CHECKED, 0);
}
if (strcmp(width, "") == 0) strcpy(width, "640");
if (strcmp(height, "") == 0) strcpy(height, "480");
sprintf(newStr, "%sx%s", width, height);
addTransaction("x11drv", "Desktop", ACTION_SET, newStr);
void
saveX11DrvDlgSettings (HWND hDlg)
{
free(width);
free(height);
free(newStr);
}
void onEnableDesktopClicked(HWND hDlg) {
WINE_TRACE("\n");
if (IsDlgButtonChecked(hDlg, IDC_ENABLE_DESKTOP) == BST_CHECKED) {
/* it was just unchecked, so read the values of the edit boxes, set the config value */
setFromDesktopSizeEdits(hDlg);
} else {
/* it was just checked, so remove the config values */
addTransaction("x11drv", "Desktop", ACTION_REMOVE, NULL);
}
updateGUIForDesktopMode(hDlg);
}
INT_PTR CALLBACK
X11DrvDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_INITDIALOG:
break;
case WM_COMMAND:
switch(HIWORD(wParam)) {
case EN_CHANGE: {
SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
if ( (LOWORD(wParam) == IDC_DESKTOP_WIDTH) || (LOWORD(wParam) == IDC_DESKTOP_HEIGHT) ) setFromDesktopSizeEdits(hDlg);
break;
}
case BN_CLICKED: {
WINE_TRACE("%ld\n", LOWORD(wParam));
switch(LOWORD(wParam)) {
case IDC_ENABLE_DESKTOP: onEnableDesktopClicked(hDlg); break;
};
break;
}
default:
break;
}
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_KILLACTIVE: {
/* validate user info. Lets just assume everything is okay for now */
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE);
break;
}
case PSN_APPLY: {
/* should probably check everything is really all rosy :) */
saveX11DrvDlgSettings (hDlg);
SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
break;
}
......
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