mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 12:09:36 +00:00
Fix alt-enter
This commit is contained in:
@@ -94,9 +94,9 @@ void GpAppEnvironment::Render()
|
|||||||
GpAppInterface_Get()->PL_Render(m_displayDriver);
|
GpAppInterface_Get()->PL_Render(m_displayDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GpAppEnvironment::AdjustRequestedResolution(unsigned int &width, unsigned int &height)
|
bool GpAppEnvironment::AdjustRequestedResolution(unsigned int &width, unsigned int &height)
|
||||||
{
|
{
|
||||||
GpAppInterface_Get()->PL_AdjustRequestedResolution(width, height);
|
return GpAppInterface_Get()->PL_AdjustRequestedResolution(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GpAppEnvironment::SetDisplayDriver(IGpDisplayDriver *displayDriver)
|
void GpAppEnvironment::SetDisplayDriver(IGpDisplayDriver *displayDriver)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public:
|
|||||||
|
|
||||||
GpDisplayDriverTickStatus_t Tick(IGpFiber *vosFiber);
|
GpDisplayDriverTickStatus_t Tick(IGpFiber *vosFiber);
|
||||||
void Render();
|
void Render();
|
||||||
void AdjustRequestedResolution(unsigned int &width, unsigned int &height);
|
bool AdjustRequestedResolution(unsigned int &width, unsigned int &height);
|
||||||
|
|
||||||
void SetDisplayDriver(IGpDisplayDriver *displayDriver);
|
void SetDisplayDriver(IGpDisplayDriver *displayDriver);
|
||||||
void SetAudioDriver(IGpAudioDriver *audioDriver);
|
void SetAudioDriver(IGpAudioDriver *audioDriver);
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ namespace
|
|||||||
static_cast<GpAppEnvironment*>(context)->Render();
|
static_cast<GpAppEnvironment*>(context)->Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdjustRequestedResolution(void *context, unsigned int &width, unsigned int &height)
|
bool AdjustRequestedResolution(void *context, unsigned int &width, unsigned int &height)
|
||||||
{
|
{
|
||||||
static_cast<GpAppEnvironment*>(context)->AdjustRequestedResolution(width, height);
|
return static_cast<GpAppEnvironment*>(context)->AdjustRequestedResolution(width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
void PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance) override;
|
void PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance) override;
|
||||||
void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) override;
|
void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) override;
|
||||||
void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) override;
|
void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) override;
|
||||||
void PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height) override;
|
bool PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -80,13 +80,20 @@ void GpAppInterfaceImpl::PL_InstallHostSuspendHook(PortabilityLayer::HostSuspend
|
|||||||
PortabilityLayer::InstallHostSuspendHook(hook, context);
|
PortabilityLayer::InstallHostSuspendHook(hook, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GpAppInterfaceImpl::PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height)
|
bool GpAppInterfaceImpl::PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height)
|
||||||
{
|
{
|
||||||
|
PortabilityLayer::DisplayDeviceManager::IResolutionChangeHandler *handler = PortabilityLayer::DisplayDeviceManager::GetInstance()->GetResolutionChangeHandler();
|
||||||
|
|
||||||
|
if (!handler)
|
||||||
|
return false;
|
||||||
|
|
||||||
uint32_t w32 = width;
|
uint32_t w32 = width;
|
||||||
uint32_t h32 = height;
|
uint32_t h32 = height;
|
||||||
PortabilityLayer::DisplayDeviceManager::GetInstance()->GetResolutionChangeHandler()->AdjustRequestedResolution(w32, h32);
|
handler->AdjustRequestedResolution(w32, h32);
|
||||||
width = w32;
|
width = w32;
|
||||||
height = h32;
|
height = h32;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ struct GpDisplayDriverProperties
|
|||||||
{
|
{
|
||||||
typedef GpDisplayDriverTickStatus_t (*TickFunc_t)(void *context, IGpFiber *vosFiber);
|
typedef GpDisplayDriverTickStatus_t (*TickFunc_t)(void *context, IGpFiber *vosFiber);
|
||||||
typedef void(*RenderFunc_t)(void *context);
|
typedef void(*RenderFunc_t)(void *context);
|
||||||
typedef void(*AdjustRequestedResolutionFunc_t)(void *context, unsigned int &width, unsigned int &height);
|
typedef bool(*AdjustRequestedResolutionFunc_t)(void *context, unsigned int &width, unsigned int &height);
|
||||||
|
|
||||||
EGpDisplayDriverType m_type;
|
EGpDisplayDriverType m_type;
|
||||||
|
|
||||||
|
|||||||
@@ -102,9 +102,11 @@ bool InitSwapChainForWindow(HWND hWnd, ID3D11Device *device, GpComPtr<IDXGISwapC
|
|||||||
if (result != S_OK)
|
if (result != S_OK)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#if 0
|
||||||
result = dxgiFactory->MakeWindowAssociation(hWnd, DXGI_MWA_NO_ALT_ENTER);
|
result = dxgiFactory->MakeWindowAssociation(hWnd, DXGI_MWA_NO_ALT_ENTER);
|
||||||
if (result != S_OK)
|
if (result != S_OK)
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
outSwapChain = swapChain;
|
outSwapChain = swapChain;
|
||||||
|
|
||||||
@@ -173,7 +175,10 @@ bool ResizeD3DWindow(HWND hWnd, DWORD &windowWidth, DWORD &windowHeight, LONG de
|
|||||||
GetClientRect(hWnd, &windowRect);
|
GetClientRect(hWnd, &windowRect);
|
||||||
windowRect.right = windowRect.left + desiredWidth;
|
windowRect.right = windowRect.left + desiredWidth;
|
||||||
windowRect.bottom = windowRect.top + desiredHeight;
|
windowRect.bottom = windowRect.top + desiredHeight;
|
||||||
if (!AdjustWindowRect(&windowRect, windowStyle, menus != nullptr))
|
|
||||||
|
LONG_PTR style = GetWindowLongPtrA(hWnd, GWL_STYLE);
|
||||||
|
|
||||||
|
if (!AdjustWindowRect(&windowRect, static_cast<DWORD>(style), menus != nullptr))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SetWindowPos(hWnd, HWND_TOP, windowRect.left, windowRect.top, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, SWP_NOZORDER | SWP_NOMOVE);
|
SetWindowPos(hWnd, HWND_TOP, windowRect.left, windowRect.top, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, SWP_NOZORDER | SWP_NOMOVE);
|
||||||
@@ -692,23 +697,24 @@ void GpDisplayDriverD3D11::Run()
|
|||||||
uint32_t prevWidth = m_windowWidth;
|
uint32_t prevWidth = m_windowWidth;
|
||||||
uint32_t prevHeight = m_windowHeight;
|
uint32_t prevHeight = m_windowHeight;
|
||||||
|
|
||||||
m_properties.m_adjustRequestedResolutionFunc(m_properties.m_adjustRequestedResolutionFuncContext, desiredWidth, desiredHeight);
|
if (m_properties.m_adjustRequestedResolutionFunc(m_properties.m_adjustRequestedResolutionFuncContext, desiredWidth, desiredHeight))
|
||||||
|
|
||||||
bool resizedOK = ResizeD3DWindow(m_hwnd, m_windowWidth, m_windowHeight, desiredWidth, desiredHeight, windowStyle, menus);
|
|
||||||
resizedOK = resizedOK && DetachSwapChain();
|
|
||||||
resizedOK = resizedOK && ResizeSwapChain(m_swapChain, m_windowWidth, m_windowHeight);
|
|
||||||
resizedOK = resizedOK && InitBackBuffer();
|
|
||||||
|
|
||||||
if (!resizedOK)
|
|
||||||
break; // Critical video driver error, exit
|
|
||||||
|
|
||||||
if (GpVOSEvent *resizeEvent = m_properties.m_eventQueue->QueueEvent())
|
|
||||||
{
|
{
|
||||||
resizeEvent->m_eventType = GpVOSEventTypes::kVideoResolutionChanged;
|
bool resizedOK = ResizeD3DWindow(m_hwnd, m_windowWidth, m_windowHeight, desiredWidth, desiredHeight, windowStyle, menus);
|
||||||
resizeEvent->m_event.m_resolutionChangedEvent.m_prevWidth = prevWidth;
|
resizedOK = resizedOK && DetachSwapChain();
|
||||||
resizeEvent->m_event.m_resolutionChangedEvent.m_prevHeight = prevHeight;
|
resizedOK = resizedOK && ResizeSwapChain(m_swapChain, m_windowWidth, m_windowHeight);
|
||||||
resizeEvent->m_event.m_resolutionChangedEvent.m_newWidth = m_windowWidth;
|
resizedOK = resizedOK && InitBackBuffer();
|
||||||
resizeEvent->m_event.m_resolutionChangedEvent.m_newHeight = m_windowHeight;
|
|
||||||
|
if (!resizedOK)
|
||||||
|
break; // Critical video driver error, exit
|
||||||
|
|
||||||
|
if (GpVOSEvent *resizeEvent = m_properties.m_eventQueue->QueueEvent())
|
||||||
|
{
|
||||||
|
resizeEvent->m_eventType = GpVOSEventTypes::kVideoResolutionChanged;
|
||||||
|
resizeEvent->m_event.m_resolutionChangedEvent.m_prevWidth = prevWidth;
|
||||||
|
resizeEvent->m_event.m_resolutionChangedEvent.m_prevHeight = prevHeight;
|
||||||
|
resizeEvent->m_event.m_resolutionChangedEvent.m_newWidth = m_windowWidth;
|
||||||
|
resizeEvent->m_event.m_resolutionChangedEvent.m_newHeight = m_windowHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
virtual void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) = 0;
|
virtual void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) = 0;
|
||||||
|
|
||||||
virtual void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) = 0;
|
virtual void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) = 0;
|
||||||
virtual void PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height) = 0;
|
virtual bool PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
GP_APP_DLL_EXPORT_API GpAppInterface *GpAppInterface_Get();
|
GP_APP_DLL_EXPORT_API GpAppInterface *GpAppInterface_Get();
|
||||||
|
|||||||
Reference in New Issue
Block a user