mirror of
https://github.com/libretro/Play-.git
synced 2025-02-01 14:15:27 +00:00
Use focus window system.
This commit is contained in:
parent
6304c9c0f0
commit
82fd06476e
@ -3,10 +3,9 @@
|
||||
#include "../AppConfig.h"
|
||||
|
||||
CPH_DirectInput::CPH_DirectInput(HWND hWnd)
|
||||
: m_hWnd(hWnd)
|
||||
, m_inputManager(hWnd, CAppConfig::GetInstance())
|
||||
: m_inputManager(CAppConfig::GetInstance())
|
||||
{
|
||||
|
||||
m_inputManager.PushFocusWindow(hWnd);
|
||||
}
|
||||
|
||||
CPH_DirectInput::~CPH_DirectInput()
|
||||
|
@ -1,5 +1,4 @@
|
||||
#ifndef _PH_DIRECTINPUT_H_
|
||||
#define _PH_DIRECTINPUT_H_
|
||||
#pragma once
|
||||
|
||||
#include "Types.h"
|
||||
#include "SettingsDialogProvider.h"
|
||||
@ -24,7 +23,4 @@ private:
|
||||
static CPadHandler* PadHandlerFactory(HWND);
|
||||
|
||||
PH_DirectInput::CInputManager m_inputManager;
|
||||
HWND m_hWnd;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -59,6 +59,8 @@ CControllerSettingsWnd::CControllerSettingsWnd(HWND parent, CInputManager& input
|
||||
)
|
||||
);
|
||||
|
||||
m_inputManager.PushFocusWindow(m_hWnd);
|
||||
|
||||
RefreshLayout();
|
||||
PopulateList();
|
||||
UpdateBindings();
|
||||
@ -69,7 +71,7 @@ CControllerSettingsWnd::CControllerSettingsWnd(HWND parent, CInputManager& input
|
||||
|
||||
CControllerSettingsWnd::~CControllerSettingsWnd()
|
||||
{
|
||||
|
||||
m_inputManager.PopFocusWindow();
|
||||
}
|
||||
|
||||
void CControllerSettingsWnd::RefreshLayout()
|
||||
@ -171,6 +173,7 @@ void CControllerSettingsWnd::OnListItemDblClick()
|
||||
CInputBindingSelectionWindow dialog(m_hWnd, m_inputManager, button);
|
||||
dialog.DoModal();
|
||||
UpdateBindings();
|
||||
m_inputManager.ResetBindingValues();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,12 +45,14 @@ CInputBindingSelectionWindow::CInputBindingSelectionWindow(
|
||||
|
||||
m_directInputManagerHandlerId = inputManager.GetDirectInputManager()->RegisterInputEventHandler(std::bind(
|
||||
&CInputBindingSelectionWindow::ProcessEvent, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
m_inputManager.PushFocusWindow(m_hWnd);
|
||||
|
||||
SetTimer(m_hWnd, 0, 50, NULL);
|
||||
}
|
||||
|
||||
CInputBindingSelectionWindow::~CInputBindingSelectionWindow()
|
||||
{
|
||||
m_inputManager.PopFocusWindow();
|
||||
m_inputManager.GetDirectInputManager()->UnregisterInputEventHandler(m_directInputManagerHandlerId);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ uint32 CInputManager::m_buttonDefaultValue[PS2::CControllerInfo::MAX_BUTTONS] =
|
||||
false
|
||||
};
|
||||
|
||||
CInputManager::CInputManager(HWND hWnd, Framework::CConfig& config)
|
||||
CInputManager::CInputManager(Framework::CConfig& config)
|
||||
: m_config(config)
|
||||
, m_directInputManager(new Framework::DirectInput::CManager())
|
||||
{
|
||||
@ -65,8 +65,8 @@ CInputManager::CInputManager(HWND hWnd, Framework::CConfig& config)
|
||||
m_directInputManager->RegisterInputEventHandler(std::bind(&CInputManager::OnInputEventReceived,
|
||||
this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
|
||||
m_directInputManager->CreateKeyboard(hWnd);
|
||||
m_directInputManager->CreateJoysticks(hWnd);
|
||||
m_directInputManager->CreateKeyboard();
|
||||
m_directInputManager->CreateJoysticks();
|
||||
}
|
||||
|
||||
CInputManager::~CInputManager()
|
||||
@ -74,6 +74,18 @@ CInputManager::~CInputManager()
|
||||
delete m_directInputManager;
|
||||
}
|
||||
|
||||
void CInputManager::PushFocusWindow(HWND focusWindow)
|
||||
{
|
||||
m_focusWindows.push(focusWindow);
|
||||
m_directInputManager->SetFocusWindow(m_focusWindows.top());
|
||||
}
|
||||
|
||||
void CInputManager::PopFocusWindow()
|
||||
{
|
||||
m_focusWindows.pop();
|
||||
m_directInputManager->SetFocusWindow(m_focusWindows.top());
|
||||
}
|
||||
|
||||
void CInputManager::Load()
|
||||
{
|
||||
bool hasBindings = false;
|
||||
|
@ -129,9 +129,12 @@ namespace PH_DirectInput
|
||||
uint32 m_key2State = 0;
|
||||
};
|
||||
|
||||
CInputManager(HWND, Framework::CConfig&);
|
||||
CInputManager(Framework::CConfig&);
|
||||
virtual ~CInputManager();
|
||||
|
||||
void PushFocusWindow(HWND);
|
||||
void PopFocusWindow();
|
||||
|
||||
uint32 GetBindingValue(PS2::CControllerInfo::BUTTON) const;
|
||||
void ResetBindingValues();
|
||||
|
||||
@ -159,5 +162,6 @@ namespace PH_DirectInput
|
||||
|
||||
Framework::DirectInput::CManager* m_directInputManager;
|
||||
Framework::CConfig& m_config;
|
||||
std::stack<HWND> m_focusWindows;
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user