mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-24 14:55:37 +00:00
fix(wgc): preserve full-width display identifiers
This commit is contained in:
@@ -24,7 +24,7 @@ static std::mutex g_stopMutex;
|
||||
static std::condition_variable g_stopCv;
|
||||
|
||||
struct CaptureConfig {
|
||||
int displayId = 0;
|
||||
int64_t displayId = 0;
|
||||
int64_t windowHandle = 0;
|
||||
std::string outputPath;
|
||||
std::string audioOutputPath;
|
||||
@@ -96,7 +96,7 @@ static bool parseSimpleJson(const std::string& json, CaptureConfig& config) {
|
||||
config.outputPath = findString("outputPath");
|
||||
if (config.outputPath.empty()) return false;
|
||||
|
||||
int displayId = findInt("displayId");
|
||||
int64_t displayId = findInt64("displayId");
|
||||
if (displayId >= 0) config.displayId = displayId;
|
||||
|
||||
int64_t windowHandle = findInt64("windowHandle");
|
||||
|
||||
@@ -27,20 +27,16 @@ std::vector<MonitorInfo> enumerateMonitors() {
|
||||
}
|
||||
|
||||
// Electron uses the HMONITOR handle value cast to a number as the display ID.
|
||||
HMONITOR findMonitorByDisplayId(int displayId) {
|
||||
HMONITOR findMonitorByDisplayId(int64_t displayId) {
|
||||
auto monitors = enumerateMonitors();
|
||||
|
||||
for (const auto& m : monitors) {
|
||||
if (static_cast<int>(reinterpret_cast<intptr_t>(m.handle)) == displayId) {
|
||||
if (static_cast<int64_t>(reinterpret_cast<intptr_t>(m.handle)) == displayId) {
|
||||
return m.handle;
|
||||
}
|
||||
}
|
||||
|
||||
if (!monitors.empty()) {
|
||||
return monitors[0].handle;
|
||||
}
|
||||
|
||||
return MonitorFromPoint({0, 0}, MONITOR_DEFAULTTOPRIMARY);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MonitorInfo getMonitorInfo(HMONITOR monitor) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <windows.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -14,5 +15,5 @@ struct MonitorInfo {
|
||||
};
|
||||
|
||||
std::vector<MonitorInfo> enumerateMonitors();
|
||||
HMONITOR findMonitorByDisplayId(int displayId);
|
||||
HMONITOR findMonitorByDisplayId(int64_t displayId);
|
||||
MonitorInfo getMonitorInfo(HMONITOR monitor);
|
||||
|
||||
Reference in New Issue
Block a user