Skip to content

Commit

Permalink
Remove prefixes from platform extensions traits (PlatformApplicationE…
Browse files Browse the repository at this point in the history
…xt -> ApplicationExt) (#1873)

* Rename LinuxApplicationExt to linux::ApplicatonExt
* Rename MacApplicationExt to mac::ApplicationExt
* Update CHANGELOG
  • Loading branch information
maan2003 authored Jul 15, 2021
1 parent 399c454 commit a08ea03
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ You can find its changes [documented below](#070---2021-01-01).
- Change the signature of `add_idle_callback` ([#1787] by [@jneem])
- Move macOS only function to Mac extension trait ([#1863] by [@Maan2003])
- x11: Only query atoms once instead of per window ([#1865] by [@psychon])
- remove prefix from platform extension traits ([#1873] by [@Maan2003])

### Deprecated

Expand Down Expand Up @@ -759,6 +760,7 @@ Last release without a changelog :(
[#1866]: https://github.com/linebender/druid/pull/1866
[#1867]: https://github.com/linebender/druid/pull/1867
[#1868]: https://github.com/linebender/druid/pull/1868
[#1873]: https://github.com/linebender/druid/pull/1873

[Unreleased]: https://github.com/linebender/druid/compare/v0.7.0...master
[0.7.0]: https://github.com/linebender/druid/compare/v0.6.0...v0.7.0
Expand Down
2 changes: 1 addition & 1 deletion druid-shell/src/backend/gtk/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl Application {
}
}

impl crate::platform::linux::LinuxApplicationExt for crate::Application {
impl crate::platform::linux::ApplicationExt for crate::Application {
fn primary_clipboard(&self) -> crate::Clipboard {
crate::Clipboard(Clipboard {
selection: gdk::SELECTION_PRIMARY,
Expand Down
2 changes: 1 addition & 1 deletion druid-shell/src/backend/mac/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl Application {
}
}

impl crate::platform::mac::MacApplicationExt for crate::Application {
impl crate::platform::mac::ApplicationExt for crate::Application {
fn hide(&self) {
unsafe {
let () = msg_send![self.backend_app.ns_app, hide: nil];
Expand Down
2 changes: 1 addition & 1 deletion druid-shell/src/backend/x11/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ impl Application {
}
}

impl crate::platform::linux::LinuxApplicationExt for crate::Application {
impl crate::platform::linux::ApplicationExt for crate::Application {
fn primary_clipboard(&self) -> crate::Clipboard {
self.backend_app.primary.clone().into()
}
Expand Down
4 changes: 2 additions & 2 deletions druid-shell/src/platform/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::Clipboard;
/// Linux specific extensions to [`Application`]
///
/// [`Application`]: crate::Application
pub trait LinuxApplicationExt {
pub trait ApplicationExt {
/// Returns a handle to the primary system clipboard.
///
/// This is useful for middle mouse paste.
Expand All @@ -32,5 +32,5 @@ mod test {

use super::*;
use static_assertions as sa;
sa::assert_impl_all!(Application: LinuxApplicationExt);
sa::assert_impl_all!(Application: ApplicationExt);
}
4 changes: 2 additions & 2 deletions druid-shell/src/platform/mac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/// macOS specific extensions to [`Application`]
///
/// [`Application`]: crate::Application
pub trait MacApplicationExt {
pub trait ApplicationExt {
/// Hide the application this window belongs to. (cmd+H)
fn hide(&self);

Expand All @@ -36,5 +36,5 @@ mod test {

use super::*;
use static_assertions as sa;
sa::assert_impl_all!(Application: MacApplicationExt);
sa::assert_impl_all!(Application: ApplicationExt);
}
6 changes: 3 additions & 3 deletions druid/src/win_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ impl<T: Data> Inner<T> {

#[cfg(target_os = "macos")]
{
use druid_shell::platform::mac::MacApplicationExt;
use druid_shell::platform::mac::ApplicationExt as _;

let windows = &mut self.windows;
let window = self.menu_window.and_then(|w| windows.get_mut(w));
Expand Down Expand Up @@ -841,13 +841,13 @@ impl<T: Data> AppState<T> {

#[cfg(target_os = "macos")]
fn hide_app(&self) {
use druid_shell::platform::mac::MacApplicationExt;
use druid_shell::platform::mac::ApplicationExt as _;
self.inner.borrow().app.hide()
}

#[cfg(target_os = "macos")]
fn hide_others(&mut self) {
use druid_shell::platform::mac::MacApplicationExt;
use druid_shell::platform::mac::ApplicationExt as _;
self.inner.borrow().app.hide_others();
}

Expand Down

0 comments on commit a08ea03

Please sign in to comment.