[WINECFG] Fix interaction with screen depth and double buffering

Christian Costa titan.costa at wanadoo.fr
Sun Sep 25 06:57:50 CDT 2005


Hi,

After desesperatly trying to change the screen depth, I've finally 
figured out that enabling
double buffering for OpenGL overrides this value.

Changelog:
Screen depth cannot be selected when double buffering is enabled. 
Disable depth selection when it's the case.

Christian Costa   titan.costa at wanadoo.fr

-------------- next part --------------
Index: programs/winecfg/x11drvdlg.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/x11drvdlg.c,v
retrieving revision 1.24
diff -u -r1.24 x11drvdlg.c
--- programs/winecfg/x11drvdlg.c	12 Jul 2005 18:11:11 -0000	1.24
+++ programs/winecfg/x11drvdlg.c	25 Sep 2005 10:13:44 -0000
@@ -95,21 +95,9 @@
     updating_ui = FALSE;
 }
 
-static void init_dialog (HWND dialog)
+static void init_screen_depth(HWND dialog)
 {
-    unsigned int it;
     char* buf;
-
-    update_gui_for_desktop_mode(dialog);
-
-    updating_ui = TRUE;
-    
-    SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_RESETCONTENT, 0, 0);
-    SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "8 bit");
-    SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "16 bit");
-    SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "24 bit");
-    SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "32 bit"); /* is this valid? */
-
     buf = get_reg_key(config_key, keypath("X11 Driver"), "ScreenDepth", "24");
     if (strcmp(buf, "8") == 0)
 	SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_SETCURSEL, 0, 0);
@@ -122,6 +110,22 @@
     else
 	WINE_ERR("Invalid screen depth read from registry (%s)\n", buf);
     HeapFree(GetProcessHeap(), 0, buf);
+}
+
+static void init_dialog(HWND dialog)
+{
+    unsigned int it;
+    char* buf;
+
+    update_gui_for_desktop_mode(dialog);
+
+    updating_ui = TRUE;
+    
+    SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_RESETCONTENT, 0, 0);
+    SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "8 bit");
+    SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "16 bit");
+    SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "24 bit");
+    SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_ADDSTRING, 0, (LPARAM) "32 bit"); /* is this valid? */
 
     SendDlgItemMessage(dialog, IDC_DESKTOP_WIDTH, EM_LIMITTEXT, RES_MAXLEN, 0);
     SendDlgItemMessage(dialog, IDC_DESKTOP_HEIGHT, EM_LIMITTEXT, RES_MAXLEN, 0);
@@ -134,10 +138,15 @@
     HeapFree(GetProcessHeap(), 0, buf);
 
     buf = get_reg_key(config_key, keypath("X11 Driver"), "DesktopDoubleBuffered", "Y");
-    if (IS_OPTION_TRUE(*buf))
+    if (IS_OPTION_TRUE(*buf)) {
 	CheckDlgButton(dialog, IDC_DOUBLE_BUFFER, BST_CHECKED);
-    else
+	SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_SETCURSEL, -1, 0);
+	disable(IDC_SCREEN_DEPTH);
+    } else {
 	CheckDlgButton(dialog, IDC_DOUBLE_BUFFER, BST_UNCHECKED);
+    	init_screen_depth(dialog);
+	enable(IDC_SCREEN_DEPTH);
+    }
     HeapFree(GetProcessHeap(), 0, buf);
 
     SendDlgItemMessage(dialog, IDC_D3D_VSHADER_MODE, CB_RESETCONTENT, 0, 0);
@@ -228,10 +237,15 @@
 
 
 static void on_double_buffer_clicked(HWND dialog) {
-    if (IsDlgButtonChecked(dialog, IDC_DOUBLE_BUFFER) == BST_CHECKED)
+    if (IsDlgButtonChecked(dialog, IDC_DOUBLE_BUFFER) == BST_CHECKED) {
         set_reg_key(config_key, keypath("X11 Driver"), "DesktopDoubleBuffered", "Y");
-    else
+	SendDlgItemMessage(dialog, IDC_SCREEN_DEPTH, CB_SETCURSEL, -1, 0);
+	disable(IDC_SCREEN_DEPTH);
+    } else {
         set_reg_key(config_key, keypath("X11 Driver"), "DesktopDoubleBuffered", "N");
+    	init_screen_depth(dialog);
+	enable(IDC_SCREEN_DEPTH);
+    }
 }
 
 static void on_d3d_vshader_mode_changed(HWND dialog) {
@@ -247,7 +261,7 @@
 }
 
 INT_PTR CALLBACK
-GraphDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+GraphDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
     switch (uMsg) {
 	case WM_INITDIALOG:


More information about the wine-patches mailing list