Commit 0af614e7 authored by Mike Hearn's avatar Mike Hearn Committed by Alexandre Julliard

- rewrite the transaction system to be based on a settings overlay,

to have a nicer API, and to actually work (always a bonus) - change the libraries page to be based on a listbox rather than a treeview, clean up and shrink the code - add accelerator keys to the libraries page, focus management - make the window title reflect what the user is currently editing - remove bogus root warning - remove some unused control IDs in resource.h - start converting the x11drv dialog to kernel_style from javaStyle - bugfixing
parent a5ce4ee7
......@@ -84,20 +84,18 @@ STYLE WS_CHILD | WS_DISABLED
FONT 8, "MS Shell Dlg"
BEGIN
GROUPBOX "DLL Overrides",IDC_STATIC,8,4,244,240
LTEXT "Libraries can be specified individually to be either builtin or native. A DLL entry specified as ""*"" pertains to all DLLs not specified explicitly."
LTEXT "Dynamic Link Libraries can be specified individually to be either builtin (provided by Wine) or native (taken from Windows or provided by the application)."
, IDC_STATIC,15,17,228,32
CONTROL "DLL Overrides", IDC_TREE_DLLS, "SysTreeView32", WS_BORDER | WS_TABSTOP | TVS_LINESATROOT | TVS_HASLINES | TVS_SHOWSELALWAYS | TVS_HASBUTTONS, 15,50,142,187
LISTBOX IDC_DLLS_LIST,15,50,142,187,WS_BORDER | WS_TABSTOP | WS_VSCROLL
LTEXT "Load order:",IDC_STATIC,163,50,37,8
CONTROL "Builtin (Wine)",IDC_RAD_BUILTIN,"Button", BS_AUTORADIOBUTTON | WS_GROUP,163,65,75,10
CONTROL "Native (Windows)",IDC_RAD_NATIVE,"Button", BS_AUTORADIOBUTTON,163,80,75,10
CONTROL "Builtin, Native",IDC_RAD_BUILTIN_NATIVE,"Button", BS_AUTORADIOBUTTON,163,95,75,10
CONTROL "Native, Builtin",IDC_RAD_NATIVE_BUILTIN,"Button", BS_AUTORADIOBUTTON,163,110,75,10
CONTROL "Disable",IDC_RAD_DISABLE,"Button", BS_AUTORADIOBUTTON,163,125,75,10
PUSHBUTTON "Add application...",IDC_DLLS_ADDAPP,163,144,82,14
PUSHBUTTON "Remove application",IDC_DLLS_REMOVEAPP, 163,164,82,14
PUSHBUTTON "Add DLL override for:",IDC_DLLS_ADDDLL, 163,184,82,14
COMBOBOX IDC_DLLLIST,163,204,82,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP | CBS_SORT | CBS_LOWERCASE
PUSHBUTTON "Remove DLL override",IDC_DLLS_REMOVEDLL,163,224,82,14
CONTROL "&Builtin (Wine)",IDC_RAD_BUILTIN,"Button", BS_AUTORADIOBUTTON | WS_GROUP,163,65,75,10
CONTROL "&Native (Windows)",IDC_RAD_NATIVE,"Button", BS_AUTORADIOBUTTON,163,80,75,10
CONTROL "Bui&ltin then Native",IDC_RAD_BUILTIN_NATIVE,"Button", BS_AUTORADIOBUTTON,163,95,75,10
CONTROL "Nati&ve then Builtin",IDC_RAD_NATIVE_BUILTIN,"Button", BS_AUTORADIOBUTTON,163,110,75,10
CONTROL "&Disable",IDC_RAD_DISABLE,"Button", BS_AUTORADIOBUTTON,163,125,75,10
PUSHBUTTON "&Add DLL override for:",IDC_DLLS_ADDDLL, 163,184,82,14
COMBOBOX IDC_DLLCOMBO,163,204,82,14,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP | CBS_SORT | CBS_LOWERCASE
PUSHBUTTON "&Remove DLL override",IDC_DLLS_REMOVEDLL,163,224,82,14
END
IDD_SYSTEMCFG DIALOG DISCARDABLE 0, 0, 260, 250
......
......@@ -40,23 +40,21 @@ static void update_comboboxes(HWND dialog)
char *winver, *dosver;
/* retrieve the registry values */
winver = getConfigValue(keypath("Version"), "Windows", NULL);
dosver = getConfigValue(keypath("Version"), "DOS", NULL);
winver = get(keypath("Version"), "Windows", "");
dosver = get(keypath("Version"), "DOS", "");
/* NULL winver/dosver means use automatic mode (ie the builtin dll linkage heuristics) */
/* empty winver/dosver means use automatic mode (ie the builtin dll linkage heuristics) */
WINE_TRACE("winver is %s\n", winver ? winver : "null (automatic mode)");
WINE_TRACE("dosver is %s\n", dosver ? dosver : "null (automatic mode)");
WINE_TRACE("winver is %s\n", *winver != '\0' ? winver : "null (automatic mode)");
WINE_TRACE("dosver is %s\n", *dosver != '\0' ? dosver : "null (automatic mode)");
/* normalize the version strings */
if (winver && strlen(winver))
if (*winver != '\0')
{
if ((pVer = getWinVersions ()))
{
WINE_TRACE("Windows version\n");
for (i = 0; *pVer->szVersion || *pVer->szDescription; i++, pVer++)
{
WINE_TRACE("pVer->szVersion == %s\n", pVer->szVersion);
if (!strcasecmp (pVer->szVersion, winver))
{
SendDlgItemMessage (dialog, IDC_WINVER, CB_SETCURSEL, (WPARAM) (i + 1), 0);
......@@ -71,14 +69,12 @@ static void update_comboboxes(HWND dialog)
SendDlgItemMessage (dialog, IDC_WINVER, CB_SETCURSEL, 0, 0);
}
if (dosver && strlen(dosver))
if (*dosver != '\0')
{
if ((pVer = getDOSVersions ()))
{
WINE_TRACE("DOS version\n");
for (i = 0; *pVer->szVersion || *pVer->szDescription; i++, pVer++)
{
WINE_TRACE("pVer->szVersion == %s\n", pVer->szVersion);
if (!strcasecmp (pVer->szVersion, dosver))
{
SendDlgItemMessage (dialog, IDC_DOSVER, CB_SETCURSEL,
......@@ -93,9 +89,9 @@ static void update_comboboxes(HWND dialog)
WINE_TRACE("setting dosver combobox to automatic/default\n");
SendDlgItemMessage (dialog, IDC_DOSVER, CB_SETCURSEL, 0, 0);
}
if (winver) free(winver);
if (dosver) free(dosver);
HeapFree(GetProcessHeap(), 0, winver);
HeapFree(GetProcessHeap(), 0, dosver);
}
void
......@@ -153,6 +149,7 @@ static void add_listview_item(HWND listview, char *text, void *association)
ListView_InsertItem(listview, &item);
}
/* Called when the application is initialized (cannot reinit!) */
static void init_appsheet(HWND dialog)
{
HWND listview;
......@@ -160,22 +157,21 @@ static void init_appsheet(HWND dialog)
int i;
DWORD size;
char appname[1024];
FILETIME ft;
WINE_TRACE("()\n");
listview = GetDlgItem(dialog, IDC_APP_LISTVIEW);
/* we use the lparam field of the item so we can alter the presentation later and not change code
* for instance, to use the tile view or to display the EXEs embedded 'display name' */
add_listview_item(listview, "Default Settings", NULL);
/* do the application specific stuff, then add the default item last */
if (RegOpenKey(configKey, "AppDefaults", &key) == ERROR_SUCCESS)
/* because this list is only populated once, it's safe to bypass the settings list here */
if (RegOpenKey(config_key, "AppDefaults", &key) == ERROR_SUCCESS)
{
i = 0;
size = sizeof(appname);
while (RegEnumKeyEx(key, i, appname, &size, NULL, NULL, NULL, &ft) == ERROR_SUCCESS)
while (RegEnumKeyEx(key, i, appname, &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
{
add_listview_item(listview, appname, strdup(appname));
......@@ -218,12 +214,13 @@ static int get_listview_selection(HWND listview)
return -1;
}
/* called when the user selects a different application */
static void on_selection_change(HWND dialog, HWND listview)
{
LVITEM item;
char *oldapp = currentApp;
WINE_TRACE("()\n");
item.iItem = get_listview_selection(listview);
......@@ -253,6 +250,8 @@ static void on_selection_change(HWND dialog, HWND listview)
init_comboboxes(dialog);
update_comboboxes(dialog);
set_window_title(dialog);
}
static void on_add_app_click(HWND dialog)
......@@ -295,14 +294,14 @@ static void on_remove_app_click(HWND dialog)
{
HWND listview = GetDlgItem(dialog, IDC_APP_LISTVIEW);
int selection = get_listview_selection(listview);
char *section = keypath("");
char *section = keypath(""); /* AppDefaults\\whatever.exe\\ */
WINE_TRACE("selection=%d, section=%s\n", selection, section);
assert( selection != 0 ); /* user cannot click this button when "default settings" is selected */
section[strlen(section)] = '\0'; /* remove last backslash */
addTransaction(section, NULL, ACTION_REMOVE, NULL);
set(section, NULL, NULL); /* delete the section */
ListView_DeleteItem(listview, selection);
SetFocus(listview);
......@@ -316,13 +315,16 @@ static void on_winver_change(HWND dialog)
if (selection == 0)
{
WINE_TRACE("automatic/default selected so removing current setting\n");
addTransaction(keypath("Version"), "Windows", ACTION_REMOVE, NULL);
set(keypath("Version"), "Windows", NULL);
}
else
{
WINE_TRACE("setting Version\\Windows key to value '%s'\n", ver[selection - 1].szVersion);
addTransaction(keypath("Version"), "Windows", ACTION_SET, ver[selection - 1].szVersion);
set(keypath("Version"), "Windows", ver[selection - 1].szVersion);
}
/* enable the apply button */
SendMessage(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0);
}
static void on_dosver_change(HWND dialog)
......@@ -333,13 +335,16 @@ static void on_dosver_change(HWND dialog)
if (selection == 0)
{
WINE_TRACE("automatic/default selected so removing current setting\n");
addTransaction(keypath("Version"), "DOS", ACTION_REMOVE, NULL);
set(keypath("Version"), "DOS", NULL);
}
else
{
WINE_TRACE("setting Version\\DOS key to value '%s'\n", ver[selection - 1].szVersion);
addTransaction(keypath("Version"), "DOS", ACTION_SET, ver[selection - 1].szVersion);
set(keypath("Version"), "DOS", ver[selection - 1].szVersion);
}
/* enable the apply button */
SendMessage(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0);
}
INT_PTR CALLBACK
......@@ -348,17 +353,25 @@ AppDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
switch (uMsg)
{
case WM_INITDIALOG:
init_appsheet(hDlg);
break;
init_appsheet(hDlg);
break;
case WM_SHOWWINDOW:
set_window_title(hDlg);
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code)
{
case LVN_ITEMCHANGED:
on_selection_change(hDlg, GetDlgItem(hDlg, IDC_APP_LISTVIEW));
break;
on_selection_change(hDlg, GetDlgItem(hDlg, IDC_APP_LISTVIEW));
break;
case PSN_APPLY:
apply();
SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
break;
}
break;
case WM_COMMAND:
......@@ -383,6 +396,7 @@ AppDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
break;
}
break;
}
......
......@@ -55,7 +55,8 @@ void selectAudioDriver(HWND hDlg, char *drivername)
{
if (!strcmp (pAudioDrv->szDriver, drivername))
{
addTransaction("Winmm", "Drivers", ACTION_SET, pAudioDrv->szDriver);
set("Winmm", "Drivers", (char *) pAudioDrv->szDriver);
SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM) hDlg, 0); /* enable apply button */
SendDlgItemMessage(hDlg, IDC_AUDIO_DRIVER, CB_SETCURSEL,
(WPARAM) i, 0);
}
......@@ -66,7 +67,7 @@ void selectAudioDriver(HWND hDlg, char *drivername)
void
initAudioDlg (HWND hDlg)
{
char *curAudioDriver = getConfigValue("Winmm", "Drivers", "winealsa.drv");
char *curAudioDriver = get("Winmm", "Drivers", "winealsa.drv");
const AUDIO_DRIVER *pAudioDrv = NULL;
int i;
......@@ -175,13 +176,18 @@ AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
}
break;
case WM_SHOWWINDOW:
set_window_title(hDlg);
break;
case WM_NOTIFY:
switch(((LPNMHDR)lParam)->code) {
case PSN_KILLACTIVE:
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE);
break;
case PSN_APPLY:
apply();
SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR);
break;
case PSN_SETACTIVE:
......
......@@ -212,14 +212,13 @@ int refreshDriveDlg (HWND dialog)
ShowWindow(GetDlgItem(dialog, IDS_DRIVE_NO_C), SW_HIDE);
/* disable or enable controls depending on whether we are editing global vs app specific config */
if (appSettings == EDITING_GLOBAL) {
if (currentApp) {
WINE_TRACE("enabling controls\n");
enable(IDC_LIST_DRIVES);
enable(IDC_BUTTON_ADD);
enable(IDC_BUTTON_REMOVE);
enable(IDC_BUTTON_EDIT);
enable(IDC_BUTTON_AUTODETECT);
} else {
WINE_TRACE("disabling controls\n");
disable(IDC_LIST_DRIVES);
......@@ -1016,6 +1015,11 @@ DriveDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_INITDIALOG:
onDriveInitDialog();
break;
case WM_SHOWWINDOW:
set_window_title(hDlg);
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_LIST_DRIVES:
......
......@@ -217,10 +217,6 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow)
WINE_ERR("initialization failed, aborting\n");
ExitProcess(1);
}
/* is the user running as root? */
if(getuid() == 0)
MessageBox(NULL, "It is not advisable to run wine as root. Doing so may compromise the security of your computer. Please run wine as a normal user.", "", MB_OK);
/*
* The next 3 lines should be all that is needed
......
......@@ -53,26 +53,17 @@
#define IDC_DESKTOP_BY 1026
#define IDC_XDGA 1027
#define IDC_XSHM 1028
/* dll editing */
#define IDC_RAD_BUILTIN 1029
#define IDC_RAD_NATIVE 1030
#define IDC_RAD_BUILTIN_NATIVE 1031
#define IDC_RAD_NATIVE_BUILTIN 1032
#define IDC_RAD_DISABLE 1033
#define IDC_TREE_DLLS 1034
#define IDC_DLLS_ADDAPP 8000
#define IDC_DLLS_LIST 1034
#define IDC_DLLS_ADDDLL 8001
#define IDC_DLLS_REMOVEAPP 8002
#define IDC_DLLS_REMOVEDLL 8003
#define IDC_DLLLIST 8004
#define IDC_RADIO_DEFAULT_BUILTIN 1033
#define IDC_RADIO_DEFAULT_NATIVE 1034
#define IDC_RADIO_VIRTUAL 1035
#define IDC_EDIT_VIRTUAL 1036
#define IDC_BUTTON_VIRTUAL 1037
#define IDC_RADIO_REAL 1038
#define IDC_EDIT_REAL 1039
#define IDC_BUTTON_REAL 1040
#define IDC_BUTTON_FOLDERS 1041
#define IDC_DLLCOMBO 8004
/* drive editing */
#define IDC_LIST_DRIVES 1042
......
......@@ -45,30 +45,21 @@
}
#define WRITEME(owner) MessageBox(owner, "Write me!", "", MB_OK | MB_ICONEXCLAMATION);
/* 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 */
extern char *currentApp; /* NULL means editing global settings */
#define EDITING_GLOBAL 0
#define EDITING_APP 1
extern int appSettings; /* non-zero means we are editing appdefault settings */
/* Use get and set to alter registry settings. The changes made through set
won't be committed to the registry until process_all_settings is called,
however get will still return accurate information.
extern char *currentApp; /* NULL means editing global settings */
You are expected to release the result of get. The parameters to set will
be copied, so release them too when necessary.
*/
void set(char *path, char *name, char *value);
char *get(char *path, char *name, char *def);
BOOL exists(char *path, char *name);
void apply(void);
char **enumerate_values(char *path);
/* returns a string of the form "AppDefaults\\appname.exe\\section", or just "section" if
* the user is editing the global settings.
......@@ -77,31 +68,11 @@ extern char *currentApp; /* NULL means editing global settings */
*/
char *keypath(char *section);
/* 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(const char *section, const char *key, enum transaction_action action, const 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);
extern HKEY configKey;
extern HKEY config_key;
/* don't use these directly! */
int setConfigValue (const char *subkey, const char *valueName, const char *value);
char *getConfigValue (const char *subkey, const char *valueName, const char *defaultResult);
HRESULT doesConfigValueExist (const char *subkey, const char *valueName);
HRESULT removeConfigValue (const char *subkey, const char *valueName);
void set_window_title(HWND dialog);
/* Graphics */
......@@ -125,14 +96,12 @@ INT_PTR CALLBACK AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
char *getDialogItemText(HWND hDlg, WORD controlID);
#define disable(id) EnableWindow(GetDlgItem(dialog, id), 0);
#define enable(id) EnableWindow(GetDlgItem(dialog, id), 1);
#define alloc(size) HeapAlloc(GetProcessHeap(), 0, size);
#define release(ptr) HeapFree(GetProcessHeap(), 0, ptr);
void PRINTERROR(void); /* WINE_TRACE() the plaintext error message from GetLastError() */
/* returns a string in the win32 heap */
static inline char *strdupA(char *s)
{
char *r = alloc(strlen(s));
char *r = HeapAlloc(GetProcessHeap(), 0, strlen(s));
return strcpy(r, s);
}
......
......@@ -36,19 +36,18 @@ 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;
int updating_ui;
int appSettings = EDITING_GLOBAL; /* start by editing global */
void updateGUIForDesktopMode(HWND dialog) {
void update_gui_for_desktop_mode(HWND dialog) {
WINE_TRACE("\n");
updatingUI = TRUE;
updating_ui = TRUE;
/* do we have desktop mode enabled? */
if (doesConfigValueExist(keypath("x11drv"), "Desktop") == S_OK) {
if (exists(keypath("x11drv"), "Desktop"))
{
CheckDlgButton(dialog, IDC_ENABLE_DESKTOP, BST_CHECKED);
/* enable the controls */
enable(IDC_DESKTOP_WIDTH);
enable(IDC_DESKTOP_HEIGHT);
enable(IDC_DESKTOP_SIZE);
......@@ -57,9 +56,10 @@ void updateGUIForDesktopMode(HWND dialog) {
SetWindowText(GetDlgItem(dialog, IDC_DESKTOP_WIDTH), "640");
SetWindowText(GetDlgItem(dialog, IDC_DESKTOP_HEIGHT), "480");
}
else {
else
{
CheckDlgButton(dialog, IDC_ENABLE_DESKTOP, BST_UNCHECKED);
/* disable the controls */
disable(IDC_DESKTOP_WIDTH);
disable(IDC_DESKTOP_HEIGHT);
disable(IDC_DESKTOP_SIZE);
......@@ -69,22 +69,22 @@ void updateGUIForDesktopMode(HWND dialog) {
SetWindowText(GetDlgItem(dialog, IDC_DESKTOP_HEIGHT), "");
}
updatingUI = FALSE;
updating_ui = FALSE;
}
/* pokes the win32 api to setup the dialog from the config struct */
void initGraphDlg (HWND hDlg)
{
static const char default_desktop[] = "640x480";
static char *default_desktop = "640x480";
char *buf;
char *bufindex;
updateGUIForDesktopMode(hDlg);
update_gui_for_desktop_mode(hDlg);
updatingUI = TRUE;
updating_ui = TRUE;
/* desktop size */
buf = getConfigValue(keypath("x11drv"), "Desktop", default_desktop);
buf = get(keypath("x11drv"), "Desktop", default_desktop);
bufindex = strchr(buf, 'x');
if(!bufindex) /* handle invalid "Desktop" values */
{
......@@ -96,7 +96,7 @@ void initGraphDlg (HWND hDlg)
bufindex++;
SetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_WIDTH), buf);
SetWindowText(GetDlgItem(hDlg, IDC_DESKTOP_HEIGHT), bufindex);
free(buf);
HeapFree(GetProcessHeap(), 0, buf);
SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "8 bit");
......@@ -104,7 +104,7 @@ void initGraphDlg (HWND hDlg)
SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "24 bit");
SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "32 bit"); /* is this valid? */
buf = getConfigValue(keypath("x11drv"), "ScreenDepth", "24");
buf = get(keypath("x11drv"), "ScreenDepth", "24");
if (strcmp(buf, "8") == 0)
SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_SETCURSEL, 0, 0);
else if (strcmp(buf, "16") == 0)
......@@ -115,36 +115,34 @@ void initGraphDlg (HWND hDlg)
SendDlgItemMessage(hDlg, IDC_SCREEN_DEPTH, CB_SETCURSEL, 3, 0);
else
WINE_ERR("Invalid screen depth read from registry (%s)\n", buf);
free(buf);
HeapFree(GetProcessHeap(), 0, buf);
SendDlgItemMessage(hDlg, IDC_DESKTOP_WIDTH, EM_LIMITTEXT, RES_MAXLEN, 0);
SendDlgItemMessage(hDlg, IDC_DESKTOP_HEIGHT, EM_LIMITTEXT, RES_MAXLEN, 0);
buf = getConfigValue(keypath("x11drv"), "DXGrab", "Y");
buf = get(keypath("x11drv"), "DXGrab", "Y");
if (IS_OPTION_TRUE(*buf))
CheckDlgButton(hDlg, IDC_DX_MOUSE_GRAB, BST_CHECKED);
else
CheckDlgButton(hDlg, IDC_DX_MOUSE_GRAB, BST_UNCHECKED);
free(buf);
HeapFree(GetProcessHeap(), 0, buf);
buf = getConfigValue(keypath("x11drv"), "DesktopDoubleBuffered", "Y");
buf = get(keypath("x11drv"), "DesktopDoubleBuffered", "Y");
if (IS_OPTION_TRUE(*buf))
CheckDlgButton(hDlg, IDC_DOUBLE_BUFFER, BST_CHECKED);
else
CheckDlgButton(hDlg, IDC_DOUBLE_BUFFER, BST_UNCHECKED);
free(buf);
HeapFree(GetProcessHeap(), 0, buf);
updatingUI = FALSE;
updating_ui = FALSE;
}
void setFromDesktopSizeEdits(HWND hDlg) {
char *width = malloc(RES_MAXLEN+1);
char *height = malloc(RES_MAXLEN+1);
char *newStr = malloc((RES_MAXLEN*2) + 2);
char *width = HeapAlloc(GetProcessHeap(), 0, RES_MAXLEN+1);
char *height = HeapAlloc(GetProcessHeap(), 0, RES_MAXLEN+1);
char *new = HeapAlloc(GetProcessHeap(), 0, (RES_MAXLEN*2) + 2);
if (updatingUI) return;
if (updating_ui) goto end;
WINE_TRACE("\n");
......@@ -154,12 +152,13 @@ void setFromDesktopSizeEdits(HWND hDlg) {
if (strcmp(width, "") == 0) strcpy(width, "640");
if (strcmp(height, "") == 0) strcpy(height, "480");
sprintf(newStr, "%sx%s", width, height);
addTransaction(keypath("x11drv"), "Desktop", ACTION_SET, newStr);
free(width);
free(height);
free(newStr);
sprintf(new, "%sx%s", width, height);
set(keypath("x11drv"), "Desktop", new);
end:
HeapFree(GetProcessHeap(), 0, width);
HeapFree(GetProcessHeap(), 0, height);
HeapFree(GetProcessHeap(), 0, new);
}
void onEnableDesktopClicked(HWND hDlg) {
......@@ -169,9 +168,9 @@ void onEnableDesktopClicked(HWND hDlg) {
setFromDesktopSizeEdits(hDlg);
} else {
/* it was just checked, so remove the config values */
addTransaction(keypath("x11drv"), "Desktop", ACTION_REMOVE, NULL);
set(keypath("x11drv"), "Desktop", NULL);
}
updateGUIForDesktopMode(hDlg);
update_gui_for_desktop_mode(hDlg);
}
void onScreenDepthChanged(HWND hDlg) {
......@@ -179,26 +178,26 @@ void onScreenDepthChanged(HWND hDlg) {
char *spaceIndex = strchr(newvalue, ' ');
WINE_TRACE("newvalue=%s\n", newvalue);
if (updatingUI) return;
if (updating_ui) return;
*spaceIndex = '\0';
addTransaction(keypath("x11drv"), "ScreenDepth", ACTION_SET, newvalue);
set(keypath("x11drv"), "ScreenDepth", newvalue);
free(newvalue);
}
void onDXMouseGrabClicked(HWND hDlg) {
if (IsDlgButtonChecked(hDlg, IDC_DX_MOUSE_GRAB) == BST_CHECKED)
addTransaction(keypath("x11drv"), "DXGrab", ACTION_SET, "Y");
set(keypath("x11drv"), "DXGrab", "Y");
else
addTransaction(keypath("x11drv"), "DXGrab", ACTION_SET, "N");
set(keypath("x11drv"), "DXGrab", "N");
}
void onDoubleBufferClicked(HWND hDlg) {
if (IsDlgButtonChecked(hDlg, IDC_DOUBLE_BUFFER) == BST_CHECKED)
addTransaction(keypath("x11drv"), "DesktopDoubleBuffered", ACTION_SET, "Y");
set(keypath("x11drv"), "DesktopDoubleBuffered", "Y");
else
addTransaction(keypath("x11drv"), "DesktopDoubleBuffered", ACTION_SET, "N");
set(keypath("x11drv"), "DesktopDoubleBuffered", "N");
}
INT_PTR CALLBACK
......@@ -207,17 +206,21 @@ GraphDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
switch (uMsg) {
case WM_INITDIALOG:
break;
case WM_SHOWWINDOW:
set_window_title(hDlg);
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)) && !updatingUI )
if ( ((LOWORD(wParam) == IDC_DESKTOP_WIDTH) || (LOWORD(wParam) == IDC_DESKTOP_HEIGHT)) && !updating_ui )
setFromDesktopSizeEdits(hDlg);
break;
}
case BN_CLICKED: {
if (updatingUI) break;
if (updating_ui) break;
switch(LOWORD(wParam)) {
case IDC_ENABLE_DESKTOP: onEnableDesktopClicked(hDlg); break;
case IDC_DX_MOUSE_GRAB: onDXMouseGrabClicked(hDlg); break;
......@@ -243,6 +246,7 @@ GraphDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
}
case PSN_APPLY: {
apply();
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