mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-30 05:10:03 -04:00
On Windows and macOS, add API to enable/disable window controls (#2537)
* On Windows and macOS, add API to enable/disable window controls * fix build * missing import * use `WindowButtons` flags * rename to `[set_]enabled_buttons` * add example, fix windows impl for minimize * macOS: Fix button enabling close/minimize while disabling maximized * Update src/platform_impl/windows/window.rs Co-authored-by: Kirill Chibisov <contact@kchibisov.com> * compose the flags on a sep line, use `bool::then` Co-authored-by: Mads Marquart <mads@marquart.dk> Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
This commit is contained in:
@@ -23,7 +23,7 @@ use crate::{
|
||||
monitor, view, EventLoopWindowTarget, Fullscreen, MonitorHandle,
|
||||
},
|
||||
window::{
|
||||
CursorGrabMode, CursorIcon, Theme, UserAttentionType, WindowAttributes,
|
||||
CursorGrabMode, CursorIcon, Theme, UserAttentionType, WindowAttributes, WindowButtons,
|
||||
WindowId as RootWindowId, WindowLevel,
|
||||
},
|
||||
};
|
||||
@@ -172,6 +172,17 @@ impl Inner {
|
||||
false
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_enabled_buttons(&self, _buttons: WindowButtons) {
|
||||
warn!("`Window::set_enabled_buttons` is ignored on iOS");
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn enabled_buttons(&self) -> WindowButtons {
|
||||
warn!("`Window::enabled_buttons` is ignored on iOS");
|
||||
WindowButtons::all()
|
||||
}
|
||||
|
||||
pub fn scale_factor(&self) -> f64 {
|
||||
unsafe {
|
||||
let hidpi: CGFloat = msg_send![self.view, contentScaleFactor];
|
||||
|
||||
Reference in New Issue
Block a user