mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 01:45:40 +00:00
Some fixes
svn path=/trunk/; revision=29257
This commit is contained in:
parent
1daf74908e
commit
b785a1ed6d
1 changed files with 153 additions and 134 deletions
|
@ -5,135 +5,83 @@
|
||||||
|
|
||||||
static HINSTANCE hInstance;
|
static HINSTANCE hInstance;
|
||||||
|
|
||||||
#if 0
|
|
||||||
#ifdef UNICODE
|
#ifdef UNICODE
|
||||||
typedef INT_PTR (WINAPI *PDEVICEPROPERTIES)(HWND,LPCWSTR,LPCWSTR,BOOL);
|
typedef INT_PTR (WINAPI *PDEVICEPROPERTIES)(HWND,LPCWSTR,LPCWSTR,BOOL);
|
||||||
#define FUNC_DEVICEPROPERTIES "DevicePropertiesW"
|
#define FUNC_DEVICEPROPERTIES "DevicePropertiesW"
|
||||||
#else
|
#else
|
||||||
typedef INT_PTR (WINAPI *PDEVICEPROPERTIES)(HWND,LPCWSTR,LPCSTR,BOOL);
|
typedef INT_PTR (WINAPI *PDEVICEPROPERTIES)(HWND,LPCSTR,LPCSTR,BOOL);
|
||||||
#define FUNC_DEVICEPROPERTIES "DevicePropertiesA"
|
#define FUNC_DEVICEPROPERTIES "DevicePropertiesA"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static LPTSTR
|
||||||
|
GetMonitorDevInstID(LPCTSTR lpDeviceID)
|
||||||
|
{
|
||||||
|
/* FIXME: Implement, allocate returned string with LocalAlloc! */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
ShowMonitorProperties(PDESKMONITOR This,
|
ShowMonitorProperties(PDESKMONITOR This)
|
||||||
LPCTSTR lpDevice)
|
|
||||||
{
|
{
|
||||||
HMODULE hDevMgr;
|
HMODULE hDevMgr;
|
||||||
PDEVICEPROPERTIES pDeviceProperties;
|
PDEVICEPROPERTIES pDeviceProperties;
|
||||||
|
LPTSTR lpDevInstID;
|
||||||
|
|
||||||
|
if (This->SelMonitor != NULL)
|
||||||
|
{
|
||||||
|
lpDevInstID = GetMonitorDevInstID(This->SelMonitor->dd.DeviceID);
|
||||||
|
if (lpDevInstID != NULL)
|
||||||
|
{
|
||||||
hDevMgr = LoadLibrary(TEXT("devmgr.dll"));
|
hDevMgr = LoadLibrary(TEXT("devmgr.dll"));
|
||||||
if (hDevMgr != NULL)
|
if (hDevMgr != NULL)
|
||||||
{
|
{
|
||||||
pDeviceProperties = (PDEVICEPROPERTIESW)GetProcAddress(hDevMgr,
|
pDeviceProperties = (PDEVICEPROPERTIES)GetProcAddress(hDevMgr,
|
||||||
FUNC_DEVICEPROPERTIES);
|
FUNC_DEVICEPROPERTIES);
|
||||||
if (pDeviceProperties != NULL)
|
if (pDeviceProperties != NULL)
|
||||||
{
|
{
|
||||||
pDeviceProperties(This->hwndDlg,
|
pDeviceProperties(This->hwndDlg,
|
||||||
NULL,
|
NULL,
|
||||||
lpDevice,
|
This->SelMonitor->dd.DeviceID,
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeLibrary(hDevMgr);
|
FreeLibrary(hDevMgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LocalFree((HLOCAL)lpDevInstID);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
UpdateMonitorDialogControls(PDESKMONITOR This)
|
UpdateMonitorSelection(PDESKMONITOR This)
|
||||||
{
|
{
|
||||||
PDEVMODEW lpCurrentMode, lpMode;
|
|
||||||
DWORD dwIndex = 0;
|
|
||||||
TCHAR szBuffer[64];
|
|
||||||
BOOL bHasDef = FALSE;
|
|
||||||
INT i;
|
INT i;
|
||||||
|
|
||||||
/* Fill the refresh rate combo box */
|
if (This->dwMonitorCount > 1)
|
||||||
SendDlgItemMessage(This->hwndDlg,
|
|
||||||
IDC_REFRESHRATE,
|
|
||||||
CB_RESETCONTENT,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
|
|
||||||
lpCurrentMode = This->DeskExtInterface->GetCurrentMode(This->DeskExtInterface->Context);
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
lpMode = This->DeskExtInterface->EnumAllModes(This->DeskExtInterface->Context,
|
This->SelMonitor = NULL;
|
||||||
dwIndex++);
|
|
||||||
if (lpMode != NULL &&
|
|
||||||
lpMode->dmBitsPerPel == lpCurrentMode->dmBitsPerPel &&
|
|
||||||
lpMode->dmPelsWidth == lpCurrentMode->dmPelsWidth &&
|
|
||||||
lpMode->dmPelsHeight == lpCurrentMode->dmPelsHeight)
|
|
||||||
{
|
|
||||||
/* We're only interested in refresh rates for the current resolution and color depth */
|
|
||||||
|
|
||||||
if (lpMode->dmDisplayFrequency <= 1)
|
|
||||||
{
|
|
||||||
/* Default hardware frequency */
|
|
||||||
if (bHasDef)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
bHasDef = TRUE;
|
|
||||||
|
|
||||||
if (!LoadString(hInstance,
|
|
||||||
IDS_USEDEFFRQUENCY,
|
|
||||||
szBuffer,
|
|
||||||
sizeof(szBuffer) / sizeof(szBuffer[0])))
|
|
||||||
{
|
|
||||||
szBuffer[0] = TEXT('\0');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TCHAR szFmt[64];
|
|
||||||
|
|
||||||
if (!LoadString(hInstance,
|
|
||||||
IDS_FREQFMT,
|
|
||||||
szFmt,
|
|
||||||
sizeof(szFmt) / sizeof(szFmt[0])))
|
|
||||||
{
|
|
||||||
szFmt[0] = TEXT('\0');
|
|
||||||
}
|
|
||||||
|
|
||||||
_sntprintf(szBuffer,
|
|
||||||
sizeof(szBuffer) / sizeof(szBuffer[0]),
|
|
||||||
szFmt,
|
|
||||||
lpMode->dmDisplayFrequency);
|
|
||||||
}
|
|
||||||
|
|
||||||
i = (INT)SendDlgItemMessage(This->hwndDlg,
|
i = (INT)SendDlgItemMessage(This->hwndDlg,
|
||||||
IDC_REFRESHRATE,
|
IDC_MONITORLIST,
|
||||||
CB_ADDSTRING,
|
LB_GETCURSEL,
|
||||||
0,
|
0,
|
||||||
(LPARAM)szBuffer);
|
0);
|
||||||
if (i >= 0)
|
if (i >= 0)
|
||||||
{
|
{
|
||||||
SendDlgItemMessage(This->hwndDlg,
|
This->SelMonitor = (PDESKMONINFO)SendDlgItemMessage(This->hwndDlg,
|
||||||
IDC_REFRESHRATE,
|
IDC_MONITORLIST,
|
||||||
CB_SETITEMDATA,
|
LB_GETITEMDATA,
|
||||||
(WPARAM)lpMode,
|
|
||||||
0);
|
|
||||||
|
|
||||||
if (lpMode->dmDisplayFrequency == lpCurrentMode->dmDisplayFrequency)
|
|
||||||
{
|
|
||||||
SendDlgItemMessage(This->hwndDlg,
|
|
||||||
IDC_REFRESHRATE,
|
|
||||||
CB_SETCURSEL,
|
|
||||||
(WPARAM)i,
|
(WPARAM)i,
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
This->SelMonitor = This->Monitors;
|
||||||
|
|
||||||
} while (lpMode != NULL);
|
|
||||||
|
|
||||||
/* FIXME: Update pruning mode controls */
|
|
||||||
|
|
||||||
/* FIXME: Enable/Disable properties button */
|
|
||||||
EnableWindow(GetDlgItem(This->hwndDlg,
|
EnableWindow(GetDlgItem(This->hwndDlg,
|
||||||
IDC_MONITORPROPERTIES),
|
IDC_MONITORPROPERTIES),
|
||||||
FALSE);
|
This->SelMonitor != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
|
@ -143,7 +91,11 @@ InitMonitorDialog(PDESKMONITOR This)
|
||||||
DISPLAY_DEVICE dd;
|
DISPLAY_DEVICE dd;
|
||||||
BOOL bRet;
|
BOOL bRet;
|
||||||
INT i;
|
INT i;
|
||||||
DWORD dwIndex = 0;
|
DWORD dwIndex;
|
||||||
|
PDEVMODEW lpCurrentMode, lpMode;
|
||||||
|
TCHAR szBuffer[64];
|
||||||
|
BOOL bHasDef = FALSE;
|
||||||
|
BOOL bAdded = FALSE;
|
||||||
|
|
||||||
/* Free all allocated monitors */
|
/* Free all allocated monitors */
|
||||||
pmi = This->Monitors;
|
pmi = This->Monitors;
|
||||||
|
@ -169,6 +121,7 @@ InitMonitorDialog(PDESKMONITOR This)
|
||||||
if (This->lpDisplayDevice != NULL)
|
if (This->lpDisplayDevice != NULL)
|
||||||
{
|
{
|
||||||
/* Enumerate all monitors */
|
/* Enumerate all monitors */
|
||||||
|
dwIndex = 0;
|
||||||
pmilink = &This->Monitors;
|
pmilink = &This->Monitors;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -273,7 +226,102 @@ InitMonitorDialog(PDESKMONITOR This)
|
||||||
IDC_MONITORLIST),
|
IDC_MONITORLIST),
|
||||||
(This->dwMonitorCount > 1 ? SW_SHOW : SW_HIDE));
|
(This->dwMonitorCount > 1 ? SW_SHOW : SW_HIDE));
|
||||||
|
|
||||||
UpdateMonitorDialogControls(This);
|
/* Fill the refresh rate combo box */
|
||||||
|
SendDlgItemMessage(This->hwndDlg,
|
||||||
|
IDC_REFRESHRATE,
|
||||||
|
CB_RESETCONTENT,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
|
||||||
|
lpCurrentMode = This->DeskExtInterface->GetCurrentMode(This->DeskExtInterface->Context);
|
||||||
|
dwIndex = 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
lpMode = This->DeskExtInterface->EnumAllModes(This->DeskExtInterface->Context,
|
||||||
|
dwIndex++);
|
||||||
|
if (lpMode != NULL &&
|
||||||
|
lpMode->dmBitsPerPel == lpCurrentMode->dmBitsPerPel &&
|
||||||
|
lpMode->dmPelsWidth == lpCurrentMode->dmPelsWidth &&
|
||||||
|
lpMode->dmPelsHeight == lpCurrentMode->dmPelsHeight)
|
||||||
|
{
|
||||||
|
/* We're only interested in refresh rates for the current resolution and color depth */
|
||||||
|
|
||||||
|
if (lpMode->dmDisplayFrequency <= 1)
|
||||||
|
{
|
||||||
|
/* Default hardware frequency */
|
||||||
|
if (bHasDef)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bHasDef = TRUE;
|
||||||
|
|
||||||
|
if (!LoadString(hInstance,
|
||||||
|
IDS_USEDEFFRQUENCY,
|
||||||
|
szBuffer,
|
||||||
|
sizeof(szBuffer) / sizeof(szBuffer[0])))
|
||||||
|
{
|
||||||
|
szBuffer[0] = TEXT('\0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TCHAR szFmt[64];
|
||||||
|
|
||||||
|
if (!LoadString(hInstance,
|
||||||
|
IDS_FREQFMT,
|
||||||
|
szFmt,
|
||||||
|
sizeof(szFmt) / sizeof(szFmt[0])))
|
||||||
|
{
|
||||||
|
szFmt[0] = TEXT('\0');
|
||||||
|
}
|
||||||
|
|
||||||
|
_sntprintf(szBuffer,
|
||||||
|
sizeof(szBuffer) / sizeof(szBuffer[0]),
|
||||||
|
szFmt,
|
||||||
|
lpMode->dmDisplayFrequency);
|
||||||
|
}
|
||||||
|
|
||||||
|
i = (INT)SendDlgItemMessage(This->hwndDlg,
|
||||||
|
IDC_REFRESHRATE,
|
||||||
|
CB_ADDSTRING,
|
||||||
|
0,
|
||||||
|
(LPARAM)szBuffer);
|
||||||
|
if (i >= 0)
|
||||||
|
{
|
||||||
|
bAdded = TRUE;
|
||||||
|
|
||||||
|
SendDlgItemMessage(This->hwndDlg,
|
||||||
|
IDC_REFRESHRATE,
|
||||||
|
CB_SETITEMDATA,
|
||||||
|
(WPARAM)lpMode,
|
||||||
|
0);
|
||||||
|
|
||||||
|
if (lpMode->dmDisplayFrequency == lpCurrentMode->dmDisplayFrequency)
|
||||||
|
{
|
||||||
|
SendDlgItemMessage(This->hwndDlg,
|
||||||
|
IDC_REFRESHRATE,
|
||||||
|
CB_SETCURSEL,
|
||||||
|
(WPARAM)i,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} while (lpMode != NULL);
|
||||||
|
|
||||||
|
EnableWindow(GetDlgItem(This->hwndDlg,
|
||||||
|
IDS_MONITORSETTINGSGROUP),
|
||||||
|
bAdded);
|
||||||
|
EnableWindow(GetDlgItem(This->hwndDlg,
|
||||||
|
IDS_REFRESHRATELABEL),
|
||||||
|
bAdded);
|
||||||
|
EnableWindow(GetDlgItem(This->hwndDlg,
|
||||||
|
IDC_REFRESHRATE),
|
||||||
|
bAdded);
|
||||||
|
|
||||||
|
/* FIXME: Update pruning mode controls */
|
||||||
|
|
||||||
|
UpdateMonitorSelection(This);
|
||||||
}
|
}
|
||||||
|
|
||||||
static LONG
|
static LONG
|
||||||
|
@ -315,33 +363,6 @@ ResetMonitorChanges(PDESKMONITOR This)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL
|
|
||||||
UpdateMonitorSelection(PDESKMONITOR This)
|
|
||||||
{
|
|
||||||
INT i;
|
|
||||||
|
|
||||||
if (This->dwMonitorCount <= 1)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
i = (INT)SendDlgItemMessage(This->hwndDlg,
|
|
||||||
IDC_MONITORLIST,
|
|
||||||
LB_GETCURSEL,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
if (i >= 0)
|
|
||||||
{
|
|
||||||
This->SelMonitor = (PDESKMONINFO)SendDlgItemMessage(This->hwndDlg,
|
|
||||||
IDC_MONITORLIST,
|
|
||||||
LB_GETITEMDATA,
|
|
||||||
(WPARAM)i,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
This->SelMonitor = NULL;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static INT_PTR CALLBACK
|
static INT_PTR CALLBACK
|
||||||
MonitorDlgProc(HWND hwndDlg,
|
MonitorDlgProc(HWND hwndDlg,
|
||||||
UINT uMsg,
|
UINT uMsg,
|
||||||
|
@ -374,14 +395,12 @@ MonitorDlgProc(HWND hwndDlg,
|
||||||
switch (LOWORD(wParam))
|
switch (LOWORD(wParam))
|
||||||
{
|
{
|
||||||
case IDC_MONITORPROPERTIES:
|
case IDC_MONITORPROPERTIES:
|
||||||
|
ShowMonitorProperties(This);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_MONITORLIST:
|
case IDC_MONITORLIST:
|
||||||
if (HIWORD(wParam) == LBN_SELCHANGE)
|
if (HIWORD(wParam) == LBN_SELCHANGE)
|
||||||
{
|
UpdateMonitorSelection(This);
|
||||||
if (UpdateMonitorSelection(This))
|
|
||||||
UpdateMonitorDialogControls(This);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue