Hack to get settings window working in wine

This commit is contained in:
shygoo 2018-12-28 00:32:56 -06:00
parent c7da4cb93e
commit 943f2d109b
2 changed files with 46 additions and 1 deletions

View File

@ -9,7 +9,8 @@ CSettingConfig::CSettingConfig(bool bJustGameSetting /* = false */) :
m_GeneralOptionsPage(NULL),
m_AdvancedPage(NULL),
m_DefaultsPage(NULL),
m_GameConfig(bJustGameSetting)
m_GameConfig(bJustGameSetting),
m_bTVNSelChangedSupported(false)
{
}
@ -291,6 +292,8 @@ void CSettingConfig::ApplySettings(bool UpdateScreen)
LRESULT CSettingConfig::OnPageListItemChanged(NMHDR* /*phdr*/)
{
m_bTVNSelChangedSupported = true;
HTREEITEM hItem = m_PagesTreeList.GetSelectedItem();
CSettingsPage * Page = (CSettingsPage *)m_PagesTreeList.GetItemData(hItem);
@ -304,9 +307,48 @@ LRESULT CSettingConfig::OnPageListItemChanged(NMHDR* /*phdr*/)
m_CurrentPage->ShowPage();
::EnableWindow(GetDlgItem(IDC_RESET_PAGE), m_CurrentPage->EnableReset());
}
return 0; // retval ignored
}
// fallback to using HitTest if TVN_SELCHANGED isn't working
LRESULT CSettingConfig::OnPageListClicked(NMHDR*)
{
if (m_bTVNSelChangedSupported)
{
return 0;
}
DWORD dwClickPos = GetMessagePos();
CPoint clickPt = CPoint(dwClickPos);
ScreenToClient(&clickPt);
CRect treeRect;
m_PagesTreeList.GetWindowRect(treeRect);
ScreenToClient(&treeRect);
clickPt.x -= treeRect.left;
clickPt.y -= treeRect.top;
clickPt.y -= 2;
UINT uFlags;
HTREEITEM hItem = m_PagesTreeList.HitTest(clickPt, &uFlags);
CSettingsPage * Page = (CSettingsPage *)m_PagesTreeList.GetItemData(hItem);
if (Page)
{
if (m_CurrentPage)
{
m_CurrentPage->HidePage();
}
m_CurrentPage = Page;
m_CurrentPage->ShowPage();
::EnableWindow(GetDlgItem(IDC_RESET_PAGE), m_CurrentPage->EnableReset());
}
return 0; // retval ignored
}
LRESULT CSettingConfig::OnSettingPageChanged(UINT /*uMsg*/, WPARAM /*wPage*/, LPARAM /*lParam*/)
{
::EnableWindow(GetDlgItem(IDAPPLY), true);

View File

@ -13,6 +13,7 @@ public:
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED, OnClicked)
NOTIFY_HANDLER_EX(IDC_PAGELIST, TVN_SELCHANGED, OnPageListItemChanged)
NOTIFY_HANDLER_EX(IDC_PAGELIST, NM_CLICK, OnPageListClicked)
MESSAGE_HANDLER_EX(PSM_CHANGED, OnSettingPageChanged)
REFLECT_NOTIFICATIONS()
END_MSG_MAP()
@ -22,6 +23,7 @@ public:
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
LRESULT OnPageListItemChanged(NMHDR* phdr);
LRESULT OnPageListClicked(NMHDR* phdr);
LRESULT OnSettingPageChanged(UINT /*uMsg*/, WPARAM wPage, LPARAM /*lParam*/);
public:
@ -42,4 +44,5 @@ private:
SETTING_SECTIONS m_Sections;
CSettingsPage * m_CurrentPage, *m_GeneralOptionsPage, *m_AdvancedPage, *m_DefaultsPage;
bool m_GameConfig;
bool m_bTVNSelChangedSupported;
};