Skip to content

Commit ff2556a

Browse files
authored
Merge pull request #12 from ZibanPirate/static-crt
link against static crt
2 parents 354b2f4 + ec76f22 commit ff2556a

File tree

3 files changed

+17
-34
lines changed

3 files changed

+17
-34
lines changed

.cargo/config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[target.x86_64-pc-windows-msvc]
2+
rustflags = ["-Ctarget-feature=+crt-static"]
3+
[target.aarch64-pc-windows-msvc]
4+
rustflags = ["-Ctarget-feature=+crt-static"]

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@ Cross-platform Widget showing download/upload speed at the corner of your screen
1010

1111
## Download
1212

13-
| OS | Processor | Download |
14-
| ------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
15-
| MacOS | Apple Silicon | - [Installer](https://github.com/ZibanPirate/sysmon/releases/latest/download/System.Monitor_0.1.14_aarch64.dmg)<br>- [Standalone](https://github.com/ZibanPirate/sysmon/releases/latest/download/System.Monitor_aarch64.app.tar.gz) |
16-
| MacOS | Intel | - [Installer](https://github.com/ZibanPirate/sysmon/releases/latest/download/System.Monitor_0.1.14_x64.dmg)<br>- [Standalone](https://github.com/ZibanPirate/sysmon/releases/latest/download/System.Monitor_x64.app.tar.gz) |
13+
| OS | Processor | Download |
14+
| ------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
15+
| MacOS | Apple Silicon | - [Installer](https://github.com/ZibanPirate/sysmon/releases/latest/download/System.Monitor_0.1.14_aarch64.dmg)<br>- [Standalone](https://github.com/ZibanPirate/sysmon/releases/latest/download/System.Monitor_aarch64.app.tar.gz) |
16+
| MacOS | Intel | - [Installer](https://github.com/ZibanPirate/sysmon/releases/latest/download/System.Monitor_0.1.14_x64.dmg)<br>- [Standalone](https://github.com/ZibanPirate/sysmon/releases/latest/download/System.Monitor_x64.app.tar.gz) |
1717
| Windows | Arm | - [Installer](https://github.com/ZibanPirate/sysmon/releases/latest/download/System.Monitor_0.1.14_arm64-setup.exe)<br>- [MSI Installer](https://github.com/ZibanPirate/sysmon/releases/latest/download/System.Monitor_0.1.14_x64_en-US.msi) |
1818
| Windows | x86 | - [Installer](https://github.com/ZibanPirate/sysmon/releases/latest/download/System.Monitor_0.1.14_x64-setup.exe)<br>- [MSI Installer](https://github.com/ZibanPirate/sysmon/releases/latest/download/System.Monitor_0.1.14_x64_en-US.msi) |
19-
| Linux | Arm | N/A |
20-
| Linux | x86 | N/A |
19+
| Linux | Arm | N/A |
20+
| Linux | x86 | N/A |
21+
22+
### Minimum supported OS version
23+
24+
- **Windows**: Windows 10 and later
25+
- **macOS**: macOS Catalina (10.15) and later
2126

2227
## Contributing
2328

lib-cpp/cpp/src/screen_info.cc

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,6 @@
99
typedef double float64_t;
1010
#endif
1111

12-
// --- todo-zm: move this to a seperate file
13-
typedef DPI_AWARENESS_CONTEXT(WINAPI *PFN_SetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT);
14-
15-
static PFN_SetThreadDpiAwarenessContext pSetThreadDpiAwarenessContext = NULL;
16-
17-
static void InitDpiAwarenessFunc(void)
18-
{
19-
if (!pSetThreadDpiAwarenessContext)
20-
{
21-
HMODULE hUser32 = GetModuleHandleW(L"user32.dll");
22-
if (hUser32)
23-
{
24-
pSetThreadDpiAwarenessContext =
25-
(PFN_SetThreadDpiAwarenessContext)
26-
GetProcAddress(hUser32, "SetThreadDpiAwarenessContext");
27-
}
28-
}
29-
}
30-
31-
static DPI_AWARENESS_CONTEXT SafeSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT ctx)
32-
{
33-
InitDpiAwarenessFunc();
34-
return pSetThreadDpiAwarenessContext ? pSetThreadDpiAwarenessContext(ctx) : NULL;
35-
}
36-
// ---
37-
3812
BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
3913
{
4014
// only when running cargo test, to mimic Tauri's DPI awareness
@@ -46,7 +20,7 @@ BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMoni
4620
monitorInfo.cbSize = sizeof(MONITORINFOEX);
4721

4822
// temporarily be DPI-unaware
49-
DPI_AWARENESS_CONTEXT originalContext = SafeSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
23+
DPI_AWARENESS_CONTEXT originalContext = SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
5024

5125
if (GetMonitorInfo(hMonitor, &monitorInfo))
5226
{
@@ -74,7 +48,7 @@ BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMoni
7448
}
7549

7650
// Restore original DPI awareness context
77-
SafeSetThreadDpiAwarenessContext(originalContext);
51+
SetThreadDpiAwarenessContext(originalContext);
7852

7953
return TRUE; // Continue enumeration
8054
}

0 commit comments

Comments
 (0)