-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++: if a SLINT_SCALE_FACTOR is set at compile time, default to that #5016
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,6 +185,14 @@ pub unsafe extern "C" fn slint_window_adapter_new( | |
set_position, | ||
}); | ||
|
||
if let Some(scale_factor) = | ||
option_env!("SLINT_SCALE_FACTOR").and_then(|x| x.parse::<f32>().ok()).filter(|f| *f > 0.) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't that a little dangerous for regular C++ users? Or is it safe because it'll be overridden anyway later when a windowing system is used? I guess ideally this would be a cmake cache variable that - if set - maps to an environment variable set for corrosion to pass to cargo. Maybe the cache variable could still be called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the C++ programmer set a C++ scale factor at runtime, it will be overridden. |
||
{ | ||
window.window().dispatch_event(i_slint_core::platform::WindowEvent::ScaleFactorChanged { | ||
scale_factor, | ||
}); | ||
} | ||
|
||
core::ptr::write(target as *mut Rc<dyn WindowAdapter>, window); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch