@walldock/agent 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/screens/windows.js +16 -14
- package/package.json +1 -1
package/dist/screens/windows.js
CHANGED
|
@@ -23,21 +23,23 @@ public class MonitorHelper {
|
|
|
23
23
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)] public string Device;
|
|
24
24
|
}
|
|
25
25
|
public delegate bool MonitorEnumProc(IntPtr hMon, IntPtr hdc, ref RECT rc, IntPtr data);
|
|
26
|
+
private static List<string> _results = new List<string>();
|
|
27
|
+
private static bool Callback(IntPtr hMon, IntPtr hdc, ref RECT rc, IntPtr data) {
|
|
28
|
+
var info = new MonitorInfo(); info.Size = (uint)Marshal.SizeOf(info);
|
|
29
|
+
GetMonitorInfo(hMon, ref info);
|
|
30
|
+
uint dx, dy;
|
|
31
|
+
GetDpiForMonitor(hMon, 0, out dx, out dy);
|
|
32
|
+
double scale = dx / 96.0;
|
|
33
|
+
int w = info.Monitor.R - info.Monitor.L;
|
|
34
|
+
int h = info.Monitor.B - info.Monitor.T;
|
|
35
|
+
int primary = (info.Flags & 1) != 0 ? 1 : 0;
|
|
36
|
+
_results.Add(info.Device + "|" + info.Monitor.L + "|" + info.Monitor.T + "|" + w + "|" + h + "|" + scale.ToString("F6") + "|" + primary);
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
26
39
|
public static List<string> Enumerate() {
|
|
27
|
-
|
|
28
|
-
EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, (
|
|
29
|
-
|
|
30
|
-
GetMonitorInfo(hMon, ref info);
|
|
31
|
-
uint dx, dy;
|
|
32
|
-
GetDpiForMonitor(hMon, 0, out dx, out dy);
|
|
33
|
-
double scale = dx / 96.0;
|
|
34
|
-
int w = info.Monitor.R - info.Monitor.L;
|
|
35
|
-
int h = info.Monitor.B - info.Monitor.T;
|
|
36
|
-
int primary = (info.Flags & 1) != 0 ? 1 : 0;
|
|
37
|
-
results.Add(info.Device + "|" + info.Monitor.L + "|" + info.Monitor.T + "|" + w + "|" + h + "|" + scale.ToString("F6") + "|" + primary);
|
|
38
|
-
return true;
|
|
39
|
-
}, IntPtr.Zero);
|
|
40
|
-
return results;
|
|
40
|
+
_results = new List<string>();
|
|
41
|
+
EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, new MonitorEnumProc(Callback), IntPtr.Zero);
|
|
42
|
+
return _results;
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
"@
|