mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-01 14:20:05 -04:00
macOS move impl details of platform into platform_impl
This commit is contained in:
@@ -241,14 +241,10 @@ pub trait EventLoopWindowTargetExtMacOS {
|
|||||||
|
|
||||||
impl<T> EventLoopWindowTargetExtMacOS for EventLoopWindowTarget<T> {
|
impl<T> EventLoopWindowTargetExtMacOS for EventLoopWindowTarget<T> {
|
||||||
fn hide_application(&self) {
|
fn hide_application(&self) {
|
||||||
let cls = objc::runtime::Class::get("NSApplication").unwrap();
|
self.p.hide_application()
|
||||||
let app: cocoa::base::id = unsafe { msg_send![cls, sharedApplication] };
|
|
||||||
unsafe { msg_send![app, hide: 0] }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hide_other_applications(&self) {
|
fn hide_other_applications(&self) {
|
||||||
let cls = objc::runtime::Class::get("NSApplication").unwrap();
|
self.p.hide_other_applications()
|
||||||
let app: cocoa::base::id = unsafe { msg_send![cls, sharedApplication] };
|
|
||||||
unsafe { msg_send![app, hideOtherApplications: 0] }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,9 +112,7 @@ impl WindowExtWindows for Window {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn set_enable(&self, enabled: bool) {
|
fn set_enable(&self, enabled: bool) {
|
||||||
unsafe {
|
self.window.set_enable(enabled)
|
||||||
winapi::um::winuser::EnableWindow(self.hwnd() as _, enabled as _);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|||||||
@@ -85,6 +85,20 @@ impl<T: 'static> EventLoopWindowTarget<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T> EventLoopWindowTarget<T> {
|
||||||
|
pub(crate) fn hide_application(&self) {
|
||||||
|
let cls = objc::runtime::Class::get("NSApplication").unwrap();
|
||||||
|
let app: cocoa::base::id = unsafe { msg_send![cls, sharedApplication] };
|
||||||
|
unsafe { msg_send![app, hide: 0] }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn hide_other_applications(&self) {
|
||||||
|
let cls = objc::runtime::Class::get("NSApplication").unwrap();
|
||||||
|
let app: cocoa::base::id = unsafe { msg_send![cls, sharedApplication] };
|
||||||
|
unsafe { msg_send![app, hideOtherApplications: 0] }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct EventLoop<T: 'static> {
|
pub struct EventLoop<T: 'static> {
|
||||||
pub(crate) delegate: IdRef,
|
pub(crate) delegate: IdRef,
|
||||||
|
|
||||||
|
|||||||
@@ -564,6 +564,11 @@ impl Window {
|
|||||||
self.window_state.lock().window_icon = window_icon;
|
self.window_state.lock().window_icon = window_icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn set_enable(&self, enabled: bool) {
|
||||||
|
unsafe { winuser::EnableWindow(self.hwnd() as _, enabled as _) };
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_taskbar_icon(&self, taskbar_icon: Option<Icon>) {
|
pub fn set_taskbar_icon(&self, taskbar_icon: Option<Icon>) {
|
||||||
if let Some(ref taskbar_icon) = taskbar_icon {
|
if let Some(ref taskbar_icon) = taskbar_icon {
|
||||||
|
|||||||
Reference in New Issue
Block a user