-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#791 Try to fix second Windows 7/8 compatibility issue
- Loading branch information
Showing
6 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "realearn" | ||
version = "2.14.2" | ||
version = "2.14.3" | ||
authors = ["Benjamin Klum <[email protected]>"] | ||
edition = "2021" | ||
build = "build.rs" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,6 @@ pub mod menu_tree; | |
|
||
#[cfg(target_os = "macos")] | ||
mod macos; | ||
|
||
#[cfg(target_os = "windows")] | ||
mod win; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use libloading::{Library, Symbol}; | ||
use winapi::shared::minwindef::UINT; | ||
use winapi::shared::windef::HWND; | ||
|
||
/// Provides access to some Win32 API functions that are not available in older Windows versions. | ||
/// | ||
/// This is better than eagerly linking to these functions because then the resulting binary | ||
/// wouldn't work *at all* in the older Windows versions, whereas with this approach, we can | ||
/// fall back to alternative logic or alternative values on a case-by-case basis. | ||
pub struct DynamicWinApi { | ||
user32_library: Library, | ||
} | ||
|
||
impl DynamicWinApi { | ||
pub fn load() -> Self { | ||
unsafe { | ||
Self { | ||
user32_library: Library::new("user32.dll").unwrap(), | ||
} | ||
} | ||
} | ||
|
||
/// Should be available from Windows 10 onwards. | ||
pub fn get_dpi_for_window(&self) -> Option<Symbol<GetDpiForWindow>> { | ||
unsafe { self.user32_library.get(b"GetDpiForWindow").ok() } | ||
} | ||
} | ||
|
||
type GetDpiForWindow = extern "stdcall" fn(hwnd: HWND) -> UINT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters