mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-07-21 14:52:04 +00:00
[idd] implement config reload
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "CPipeServer.h"
|
#include "CPipeServer.h"
|
||||||
#include "CDebug.h"
|
#include "CDebug.h"
|
||||||
|
#include "CIndirectDeviceContext.h"
|
||||||
|
|
||||||
CPipeServer g_pipe;
|
CPipeServer g_pipe;
|
||||||
|
|
||||||
@@ -257,7 +258,19 @@ void CPipeServer::WriteMsg(const LGPipeMsg & msg)
|
|||||||
|
|
||||||
void CPipeServer::HandleReloadSettings()
|
void CPipeServer::HandleReloadSettings()
|
||||||
{
|
{
|
||||||
DEBUG_INFO("TODO: reload settings");
|
DEBUG_INFO("Reloading settings");
|
||||||
|
|
||||||
|
AcquireSRWLockShared(&m_deviceContextLock);
|
||||||
|
if (m_deviceContext)
|
||||||
|
m_deviceContext->ReplugMonitor();
|
||||||
|
ReleaseSRWLockShared(&m_deviceContextLock);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPipeServer::SetDeviceContext(CIndirectDeviceContext* context)
|
||||||
|
{
|
||||||
|
AcquireSRWLockExclusive(&m_deviceContextLock);
|
||||||
|
m_deviceContext = context;
|
||||||
|
ReleaseSRWLockExclusive(&m_deviceContextLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPipeServer::SetCursorPos(uint32_t x, uint32_t y)
|
void CPipeServer::SetCursorPos(uint32_t x, uint32_t y)
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ using namespace Microsoft::WRL;
|
|||||||
using namespace Microsoft::WRL::Wrappers;
|
using namespace Microsoft::WRL::Wrappers;
|
||||||
using namespace Microsoft::WRL::Wrappers::HandleTraits;
|
using namespace Microsoft::WRL::Wrappers::HandleTraits;
|
||||||
|
|
||||||
|
class CIndirectDeviceContext;
|
||||||
|
|
||||||
class CPipeServer
|
class CPipeServer
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@@ -43,6 +45,9 @@ class CPipeServer
|
|||||||
bool m_running = false;
|
bool m_running = false;
|
||||||
bool m_connected = false;
|
bool m_connected = false;
|
||||||
|
|
||||||
|
SRWLOCK m_deviceContextLock = SRWLOCK_INIT;
|
||||||
|
CIndirectDeviceContext* m_deviceContext = nullptr;
|
||||||
|
|
||||||
void _DeInit();
|
void _DeInit();
|
||||||
|
|
||||||
static DWORD WINAPI _pipeThread(LPVOID lpParam) { ((CPipeServer*)lpParam)->Thread(); return 0; }
|
static DWORD WINAPI _pipeThread(LPVOID lpParam) { ((CPipeServer*)lpParam)->Thread(); return 0; }
|
||||||
@@ -58,6 +63,8 @@ class CPipeServer
|
|||||||
bool Init();
|
bool Init();
|
||||||
void DeInit();
|
void DeInit();
|
||||||
|
|
||||||
|
void SetDeviceContext(CIndirectDeviceContext* context);
|
||||||
|
|
||||||
void SetCursorPos(uint32_t x, uint32_t y);
|
void SetCursorPos(uint32_t x, uint32_t y);
|
||||||
void SetDisplayMode(uint32_t width, uint32_t height, uint32_t refresh);
|
void SetDisplayMode(uint32_t width, uint32_t height, uint32_t refresh);
|
||||||
void SetGPUStatus(bool software);
|
void SetGPUStatus(bool software);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include "CDebug.h"
|
#include "CDebug.h"
|
||||||
#include "CIndirectDeviceContext.h"
|
#include "CIndirectDeviceContext.h"
|
||||||
#include "CIndirectMonitorContext.h"
|
#include "CIndirectMonitorContext.h"
|
||||||
|
#include "CPipeServer.h"
|
||||||
#include "CSettings.h"
|
#include "CSettings.h"
|
||||||
|
|
||||||
WDFDEVICE l_wdfDevice = nullptr;
|
WDFDEVICE l_wdfDevice = nullptr;
|
||||||
@@ -74,6 +75,7 @@ NTSTATUS LGIddAdapterInitFinished(IDDCX_ADAPTER adapter, const IDARG_IN_ADAPTER_
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
||||||
wrapper->context->FinishInit(0);
|
wrapper->context->FinishInit(0);
|
||||||
|
g_pipe.SetDeviceContext(wrapper->context);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +258,10 @@ NTSTATUS LGIddCreateDevice(_Inout_ PWDFDEVICE_INIT deviceInit)
|
|||||||
{
|
{
|
||||||
auto * wrapper = WdfObjectGet_CIndirectDeviceContextWrapper(object);
|
auto * wrapper = WdfObjectGet_CIndirectDeviceContextWrapper(object);
|
||||||
if (wrapper)
|
if (wrapper)
|
||||||
|
{
|
||||||
|
g_pipe.SetDeviceContext(nullptr);
|
||||||
wrapper->Cleanup();
|
wrapper->Cleanup();
|
||||||
|
}
|
||||||
l_wdfDevice = nullptr;
|
l_wdfDevice = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user