winit-core: move application
This commit is contained in:
parent
79fa4061cb
commit
c0b737de4a
7 changed files with 68 additions and 68 deletions
|
|
@ -69,13 +69,14 @@ use std::os::raw::c_void;
|
|||
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[doc(inline)]
|
||||
pub use winit_core::application::macos::ApplicationHandlerExtMacOS;
|
||||
use winit_core::window::PlatformWindowAttributes;
|
||||
|
||||
use crate::application::ApplicationHandler;
|
||||
use crate::event_loop::{ActiveEventLoop, EventLoopBuilder};
|
||||
use crate::monitor::MonitorHandle;
|
||||
use crate::platform_impl::MonitorHandle as MacOsMonitorHandle;
|
||||
use crate::window::{Window, WindowId};
|
||||
use crate::window::Window;
|
||||
|
||||
/// Additional methods on [`Window`] that are specific to MacOS.
|
||||
pub trait WindowExtMacOS {
|
||||
|
|
@ -610,52 +611,3 @@ pub enum OptionAsAlt {
|
|||
#[default]
|
||||
None,
|
||||
}
|
||||
|
||||
/// Additional events on [`ApplicationHandler`] that are specific to macOS.
|
||||
///
|
||||
/// This can be registered with [`ApplicationHandler::macos_handler`].
|
||||
pub trait ApplicationHandlerExtMacOS: ApplicationHandler {
|
||||
/// The system interpreted a keypress as a standard key binding command.
|
||||
///
|
||||
/// Examples include inserting tabs and newlines, or moving the insertion point, see
|
||||
/// [`NSStandardKeyBindingResponding`] for the full list of key bindings. They are often text
|
||||
/// editing related.
|
||||
///
|
||||
/// This corresponds to the [`doCommandBySelector:`] method on `NSTextInputClient`.
|
||||
///
|
||||
/// The `action` parameter contains the string representation of the selector. Examples include
|
||||
/// `"insertBacktab:"`, `"indent:"` and `"noop:"`.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```ignore
|
||||
/// impl ApplicationHandlerExtMacOS for App {
|
||||
/// fn standard_key_binding(
|
||||
/// &mut self,
|
||||
/// event_loop: &dyn ActiveEventLoop,
|
||||
/// window_id: WindowId,
|
||||
/// action: &str,
|
||||
/// ) {
|
||||
/// match action {
|
||||
/// "moveBackward:" => self.cursor.position -= 1,
|
||||
/// "moveForward:" => self.cursor.position += 1,
|
||||
/// _ => {} // Ignore other actions
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// [`NSStandardKeyBindingResponding`]: https://developer.apple.com/documentation/appkit/nsstandardkeybindingresponding?language=objc
|
||||
/// [`doCommandBySelector:`]: https://developer.apple.com/documentation/appkit/nstextinputclient/1438256-docommandbyselector?language=objc
|
||||
#[doc(alias = "doCommandBySelector:")]
|
||||
fn standard_key_binding(
|
||||
&mut self,
|
||||
event_loop: &dyn ActiveEventLoop,
|
||||
window_id: WindowId,
|
||||
action: &str,
|
||||
) {
|
||||
let _ = event_loop;
|
||||
let _ = window_id;
|
||||
let _ = action;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue