Maarten Lankhorst : winecfg: Hide basic and normal acceleration options by default.

Alexandre Julliard julliard at winehq.org
Thu Aug 6 10:49:19 CDT 2009


Module: wine
Branch: master
Commit: 58f67036baa57d40250126309b16bbb2c8e800be
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=58f67036baa57d40250126309b16bbb2c8e800be

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Wed Aug  5 15:16:55 2009 +0200

winecfg: Hide basic and normal acceleration options by default.

There's not really a good reason for them to be visible. The only 
options that are effective are emulation, which pipes through waveout 
and >= basic, which pipes through the accelerated path.

---

 programs/winecfg/audio.c |   63 ++++++++++++++++++++++++++++++++--------------
 1 files changed, 44 insertions(+), 19 deletions(-)

diff --git a/programs/winecfg/audio.c b/programs/winecfg/audio.c
index 3abacb2..9f8a0a2 100644
--- a/programs/winecfg/audio.c
+++ b/programs/winecfg/audio.c
@@ -56,13 +56,14 @@ typedef DWORD (WINAPI * MessagePtr)(UINT, UINT, DWORD, DWORD, DWORD);
 static struct DSOUNDACCEL
 {
   UINT displayID;
+  UINT visible;
   const char* settingStr;
-} const DSound_HW_Accels[] = {
-  {IDS_ACCEL_FULL,      "Full"},
-  {IDS_ACCEL_STANDARD,  "Standard"},
-  {IDS_ACCEL_BASIC,     "Basic"},
-  {IDS_ACCEL_EMULATION, "Emulation"},
-  {0, 0}
+} DSound_HW_Accels[] = {
+  {IDS_ACCEL_FULL,      1, "Full"},
+  {IDS_ACCEL_STANDARD,  0, "Standard"},
+  {IDS_ACCEL_BASIC,     0, "Basic"},
+  {IDS_ACCEL_EMULATION, 1, "Emulation"},
+  {0, 0, 0}
 };
 
 static const char* DSound_Rates[] = {
@@ -606,7 +607,7 @@ static void selectDriver(HWND hDlg, const char * driver)
 
 static void initAudioDlg (HWND hDlg)
 {
-    int i;
+    int i, j, found;
     char* buf = NULL;
 
     WINE_TRACE("\n");
@@ -637,20 +638,31 @@ static void initAudioDlg (HWND hDlg)
     initAudioDeviceTree(hDlg);
 
     SendDlgItemMessage(hDlg, IDC_DSOUND_HW_ACCEL, CB_RESETCONTENT, 0, 0);
+    buf = get_reg_key(config_key, keypath("DirectSound"), "HardwareAcceleration", "Full");
+
+    j = found = 0;
     for (i = 0; 0 != DSound_HW_Accels[i].displayID; ++i) {
       WCHAR accelStr[64];
-      LoadStringW (GetModuleHandle (NULL), DSound_HW_Accels[i].displayID, accelStr,
-          sizeof(accelStr)/sizeof(accelStr[0]));
-      SendDlgItemMessageW (hDlg, IDC_DSOUND_HW_ACCEL, CB_ADDSTRING, 0, (LPARAM)accelStr);
-    }
-    buf = get_reg_key(config_key, keypath("DirectSound"), "HardwareAcceleration", "Full");
-    for (i = 0; NULL != DSound_HW_Accels[i].settingStr; ++i) {
-      if (strcmp(buf, DSound_HW_Accels[i].settingStr) == 0) {
-	SendDlgItemMessage(hDlg, IDC_DSOUND_HW_ACCEL, CB_SETCURSEL, i, 0);
-	break ;
+      int match;
+
+      match = (strcmp(buf, DSound_HW_Accels[i].settingStr) == 0);
+      if (match)
+      {
+        DSound_HW_Accels[i].visible = 1;
+        found = 1;
+      }
+
+      if (DSound_HW_Accels[i].visible)
+      {
+        LoadStringW (GetModuleHandle (NULL), DSound_HW_Accels[i].displayID,
+                     accelStr, sizeof(accelStr)/sizeof(accelStr[0]));
+        SendDlgItemMessageW (hDlg, IDC_DSOUND_HW_ACCEL, CB_ADDSTRING, 0, (LPARAM)accelStr);
+        if (match)
+          SendDlgItemMessage(hDlg, IDC_DSOUND_HW_ACCEL, CB_SETCURSEL, j, 0);
+        j++;
       }
     }
-    if (NULL == DSound_HW_Accels[i].settingStr) {
+    if (!found) {
       WINE_ERR("Invalid Direct Sound HW Accel read from registry (%s)\n", buf);
     }
     HeapFree(GetProcessHeap(), 0, buf);
@@ -700,10 +712,23 @@ AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
           case IDC_DSOUND_HW_ACCEL:
 	    if (HIWORD(wParam) == CBN_SELCHANGE) {
 	      int selected_dsound_accel;
+              int i, j = 0;
+
 	      SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
 	      selected_dsound_accel = SendDlgItemMessage(hDlg, IDC_DSOUND_HW_ACCEL, CB_GETCURSEL, 0, 0);
-	      set_reg_key(config_key, keypath("DirectSound"), "HardwareAcceleration", 
-	         DSound_HW_Accels[selected_dsound_accel].settingStr);
+              for (i = 0; DSound_HW_Accels[i].settingStr; ++i)
+              {
+                if (DSound_HW_Accels[i].visible)
+                {
+                  if (j == selected_dsound_accel)
+                  {
+                    set_reg_key(config_key, keypath("DirectSound"), "HardwareAcceleration",
+                      DSound_HW_Accels[i].settingStr);
+                    break;
+                  }
+                  j++;
+                }
+              }
 	    }
 	    break;
           case IDC_DSOUND_RATES:




More information about the wine-cvs mailing list