mirror of
https://github.com/thinkonmay/sunshine-sdk.git
synced 2026-01-05 00:39:42 +00:00
Moved pairInputDesktop() from desktop.h to input.cpp
This commit is contained in:
parent
bb88d6f828
commit
1be5b4787f
@ -1,18 +0,0 @@
|
||||
namespace platf {
|
||||
using namespace std::literals;
|
||||
inline auto pairInputDesktop(){
|
||||
auto hDesk = OpenInputDesktop(DF_ALLOWOTHERACCOUNTHOOK, FALSE, GENERIC_ALL);
|
||||
if (NULL == hDesk) {
|
||||
auto err = GetLastError();
|
||||
BOOST_LOG(error) << "Failed to OpenInputDesktop [0x"sv << util::hex(err).to_string_view() << ']';
|
||||
} else {
|
||||
BOOST_LOG(info) << std::endl << "Opened desktop [0x"sv << util::hex(hDesk).to_string_view() << ']';
|
||||
if (!SetThreadDesktop(hDesk) ) {
|
||||
auto err = GetLastError();
|
||||
BOOST_LOG(error) << "Failed to SetThreadDesktop [0x"sv << util::hex(err).to_string_view() << ']';
|
||||
}
|
||||
CloseDesktop(hDesk);
|
||||
}
|
||||
return hDesk;
|
||||
};
|
||||
};
|
||||
@ -10,8 +10,6 @@
|
||||
|
||||
#include "display.h"
|
||||
|
||||
#include "desktop.h"
|
||||
|
||||
namespace platf {
|
||||
using namespace std::literals;
|
||||
}
|
||||
@ -92,7 +90,6 @@ int display_base_t::init() {
|
||||
FreeLibrary(user32);
|
||||
});
|
||||
*/
|
||||
pairInputDesktop();
|
||||
|
||||
dxgi::factory1_t::pointer factory_p {};
|
||||
dxgi::adapter_t::pointer adapter_p {};
|
||||
|
||||
@ -12,14 +12,13 @@
|
||||
#include "sunshine/main.h"
|
||||
#include "sunshine/platform/common.h"
|
||||
|
||||
#include "desktop.h"
|
||||
|
||||
namespace platf {
|
||||
using namespace std::literals;
|
||||
|
||||
using adapteraddrs_t = util::c_ptr<IP_ADAPTER_ADDRESSES>;
|
||||
|
||||
volatile HDESK _lastKnownInputDesktop = NULL;
|
||||
HDESK pairInputDesktop();
|
||||
|
||||
class vigem_t {
|
||||
public:
|
||||
@ -355,6 +354,24 @@ int thread_priority() {
|
||||
return SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST) ? 0 : 1;
|
||||
}
|
||||
|
||||
HDESK pairInputDesktop() {
|
||||
auto hDesk = OpenInputDesktop(DF_ALLOWOTHERACCOUNTHOOK, FALSE, GENERIC_ALL);
|
||||
if (NULL == hDesk) {
|
||||
auto err = GetLastError();
|
||||
BOOST_LOG(error) << "Failed to OpenInputDesktop [0x"sv << util::hex(err).to_string_view() << ']';
|
||||
}
|
||||
else {
|
||||
BOOST_LOG(info) << std::endl << "Opened desktop [0x"sv << util::hex(hDesk).to_string_view() << ']';
|
||||
if (!SetThreadDesktop(hDesk) ) {
|
||||
auto err = GetLastError();
|
||||
BOOST_LOG(error) << "Failed to SetThreadDesktop [0x"sv << util::hex(err).to_string_view() << ']';
|
||||
}
|
||||
CloseDesktop(hDesk);
|
||||
}
|
||||
|
||||
return hDesk;
|
||||
};
|
||||
|
||||
void freeInput(void *p) {
|
||||
auto vigem = (vigem_t*)p;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user