On macOS, move automatic tabbing setting to ELWT

Those are global for the application, so it's better to keep them
on EventLoopWindowTarget.
This commit is contained in:
Kirill Chibisov 2023-07-13 15:55:51 +00:00 committed by GitHub
parent c5941d105f
commit 4d6dbea74c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 44 deletions

View file

@ -21,7 +21,7 @@ use objc2::rc::{autoreleasepool, Id, Shared};
use objc2::{msg_send_id, ClassType};
use raw_window_handle::{AppKitDisplayHandle, RawDisplayHandle};
use super::appkit::{NSApp, NSApplicationActivationPolicy, NSEvent};
use super::appkit::{NSApp, NSApplicationActivationPolicy, NSEvent, NSWindow};
use crate::{
event::Event,
event_loop::{ControlFlow, EventLoopClosed, EventLoopWindowTarget as RootWindowTarget},
@ -101,6 +101,14 @@ impl<T> EventLoopWindowTarget<T> {
pub(crate) fn hide_other_applications(&self) {
NSApp().hideOtherApplications(None)
}
pub(crate) fn set_allows_automatic_window_tabbing(&self, enabled: bool) {
NSWindow::setAllowsAutomaticWindowTabbing(enabled)
}
pub(crate) fn allows_automatic_window_tabbing(&self) -> bool {
NSWindow::allowsAutomaticWindowTabbing()
}
}
pub struct EventLoop<T: 'static> {