Rename show_window_menu to show_system_menu
This commit is contained in:
parent
f93a6d740a
commit
f1c5186e79
4 changed files with 12 additions and 10 deletions
|
|
@ -160,9 +160,11 @@ pub fn change_level<Message>(id: Id, level: Level) -> Command<Message> {
|
||||||
Command::single(command::Action::Window(Action::ChangeLevel(id, level)))
|
Command::single(command::Action::Window(Action::ChangeLevel(id, level)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Show window menu at cursor position.
|
/// Show the [system menu] at cursor position.
|
||||||
pub fn show_window_menu<Message>(id: Id) -> Command<Message> {
|
///
|
||||||
Command::single(command::Action::Window(Action::ShowWindowMenu(id)))
|
/// [system menu]: https://en.wikipedia.org/wiki/Common_menus_in_Microsoft_Windows#System_menu
|
||||||
|
pub fn show_system_menu<Message>(id: Id) -> Command<Message> {
|
||||||
|
Command::single(command::Action::Window(Action::ShowSystemMenu(id)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fetches an identifier unique to the window, provided by the underlying windowing system. This is
|
/// Fetches an identifier unique to the window, provided by the underlying windowing system. This is
|
||||||
|
|
|
||||||
|
|
@ -81,11 +81,11 @@ pub enum Action<T> {
|
||||||
GainFocus(Id),
|
GainFocus(Id),
|
||||||
/// Change the window [`Level`].
|
/// Change the window [`Level`].
|
||||||
ChangeLevel(Id, Level),
|
ChangeLevel(Id, Level),
|
||||||
/// Show window menu at cursor position.
|
/// Show the system menu at cursor position.
|
||||||
///
|
///
|
||||||
/// ## Platform-specific
|
/// ## Platform-specific
|
||||||
/// Android / iOS / macOS / Orbital / Web / X11: Unsupported.
|
/// Android / iOS / macOS / Orbital / Web / X11: Unsupported.
|
||||||
ShowWindowMenu(Id),
|
ShowSystemMenu(Id),
|
||||||
/// Fetch the raw identifier unique to the window.
|
/// Fetch the raw identifier unique to the window.
|
||||||
FetchId(Id, Box<dyn FnOnce(u64) -> T + 'static>),
|
FetchId(Id, Box<dyn FnOnce(u64) -> T + 'static>),
|
||||||
/// Change the window [`Icon`].
|
/// Change the window [`Icon`].
|
||||||
|
|
@ -146,7 +146,7 @@ impl<T> Action<T> {
|
||||||
}
|
}
|
||||||
Self::GainFocus(id) => Action::GainFocus(id),
|
Self::GainFocus(id) => Action::GainFocus(id),
|
||||||
Self::ChangeLevel(id, level) => Action::ChangeLevel(id, level),
|
Self::ChangeLevel(id, level) => Action::ChangeLevel(id, level),
|
||||||
Self::ShowWindowMenu(id) => Action::ShowWindowMenu(id),
|
Self::ShowSystemMenu(id) => Action::ShowSystemMenu(id),
|
||||||
Self::FetchId(id, o) => {
|
Self::FetchId(id, o) => {
|
||||||
Action::FetchId(id, Box::new(move |s| f(o(s))))
|
Action::FetchId(id, Box::new(move |s| f(o(s))))
|
||||||
}
|
}
|
||||||
|
|
@ -206,8 +206,8 @@ impl<T> fmt::Debug for Action<T> {
|
||||||
Self::ChangeLevel(id, level) => {
|
Self::ChangeLevel(id, level) => {
|
||||||
write!(f, "Action::ChangeLevel({id:?}, {level:?})")
|
write!(f, "Action::ChangeLevel({id:?}, {level:?})")
|
||||||
}
|
}
|
||||||
Self::ShowWindowMenu(id) => {
|
Self::ShowSystemMenu(id) => {
|
||||||
write!(f, "Action::ShowWindowMenu({id:?})")
|
write!(f, "Action::ShowSystemMenu({id:?})")
|
||||||
}
|
}
|
||||||
Self::FetchId(id, _) => write!(f, "Action::FetchId({id:?})"),
|
Self::FetchId(id, _) => write!(f, "Action::FetchId({id:?})"),
|
||||||
Self::ChangeIcon(id, _icon) => {
|
Self::ChangeIcon(id, _icon) => {
|
||||||
|
|
|
||||||
|
|
@ -807,7 +807,7 @@ pub fn run_command<A, C, E>(
|
||||||
window::Action::ChangeLevel(_id, level) => {
|
window::Action::ChangeLevel(_id, level) => {
|
||||||
window.set_window_level(conversion::window_level(level));
|
window.set_window_level(conversion::window_level(level));
|
||||||
}
|
}
|
||||||
window::Action::ShowWindowMenu(_id) => {
|
window::Action::ShowSystemMenu(_id) => {
|
||||||
if let mouse::Cursor::Available(point) = state.cursor() {
|
if let mouse::Cursor::Available(point) = state.cursor() {
|
||||||
window.show_window_menu(winit::dpi::LogicalPosition {
|
window.show_window_menu(winit::dpi::LogicalPosition {
|
||||||
x: point.x,
|
x: point.x,
|
||||||
|
|
|
||||||
|
|
@ -1059,7 +1059,7 @@ fn run_command<A, C, E>(
|
||||||
.set_window_level(conversion::window_level(level));
|
.set_window_level(conversion::window_level(level));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window::Action::ShowWindowMenu(id) => {
|
window::Action::ShowSystemMenu(id) => {
|
||||||
if let Some(window) = window_manager.get_mut(id) {
|
if let Some(window) = window_manager.get_mut(id) {
|
||||||
if let mouse::Cursor::Available(point) =
|
if let mouse::Cursor::Available(point) =
|
||||||
window.state.cursor()
|
window.state.cursor()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue