[WINECFG] use hourglass cursor when opening audio drivers
Robert Reif
reif at earthlink.net
Thu Dec 22 17:39:15 CST 2005
Misbehaving drivers can take a while to open so change to the hour glass
cursor when opening them.
-------------- next part --------------
Index: programs/winecfg/audio.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/audio.c,v
retrieving revision 1.21
diff -p -u -r1.21 audio.c
--- programs/winecfg/audio.c 21 Dec 2005 20:28:55 -0000 1.21
+++ programs/winecfg/audio.c 22 Dec 2005 23:36:34 -0000
@@ -181,6 +181,7 @@ static void initAudioDeviceTree(HWND hDl
HWND tree = NULL;
HIMAGELIST hImageList;
HBITMAP hBitMap;
+ HCURSOR old_cursor;
tree = GetDlgItem(hDlg, IDC_AUDIO_TREE);
@@ -205,6 +206,11 @@ static void initAudioDeviceTree(HWND hDl
insert.u.item.cChildren = 1;
root = (HTREEITEM)SendDlgItemMessage(hDlg, IDC_AUDIO_TREE, TVM_INSERTITEM, 0, (LPARAM)&insert);
+ /* change to the wait cursor because this can take a while if there is a
+ * misbehaving driver that takes a long time to open
+ */
+ old_cursor = SetCursor(LoadCursor(0, IDC_WAIT));
+
/* iterate over list of loaded drivers */
for (pAudioDrv = loadedAudioDrv, i = 0; *pAudioDrv->szName; i++, pAudioDrv++) {
HDRVR hdrv;
@@ -433,6 +439,9 @@ static void initAudioDeviceTree(HWND hDl
}
}
+ /* restore the original cursor */
+ SetCursor(old_cursor);
+
SendDlgItemMessage(hDlg, IDC_AUDIO_TREE, TVM_SELECTITEM, 0, 0);
SendDlgItemMessage(hDlg, IDC_AUDIO_TREE, TVM_EXPAND, TVE_EXPAND, (LPARAM)root);
for (j = 0; j < i; j++)
@@ -444,6 +453,7 @@ static void findAudioDrivers(void)
{
int numFound = 0;
const AUDIO_DRIVER *pAudioDrv = NULL;
+ HCURSOR old_cursor;
/* delete an existing list */
if (loadedAudioDrv)
@@ -452,6 +462,11 @@ static void findAudioDrivers(void)
loadedAudioDrv = 0;
}
+ /* change to the wait cursor because this can take a while if there is a
+ * misbehaving driver that takes a long time to open
+ */
+ old_cursor = SetCursor(LoadCursor(0, IDC_WAIT));
+
for (pAudioDrv = getAudioDrivers(); *pAudioDrv->szName; pAudioDrv++)
{
if (strlen(pAudioDrv->szDriver))
@@ -476,6 +491,9 @@ static void findAudioDrivers(void)
}
}
+ /* restore the original cursor */
+ SetCursor(old_cursor);
+
/* terminate list with empty driver */
loadedAudioDrv = HeapReAlloc(GetProcessHeap(), 0, loadedAudioDrv, (numFound + 1) * sizeof(AUDIO_DRIVER));
CopyMemory(&loadedAudioDrv[numFound], pAudioDrv, sizeof(AUDIO_DRIVER));
More information about the wine-patches
mailing list