mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-02 14:50:04 -04:00
@@ -70,6 +70,7 @@ changelog entry.
|
|||||||
- Added `Window::surface_position`, which is the position of the surface inside the window.
|
- Added `Window::surface_position`, which is the position of the surface inside the window.
|
||||||
- Added `Window::safe_area`, which describes the area of the surface that is unobstructed.
|
- Added `Window::safe_area`, which describes the area of the surface that is unobstructed.
|
||||||
- On X11, Wayland, Windows and macOS, improved scancode conversions for more obscure key codes.
|
- On X11, Wayland, Windows and macOS, improved scancode conversions for more obscure key codes.
|
||||||
|
- On Wayland, add `WindowExtWayland::xdg_toplevel`.
|
||||||
- Add ability to make non-activating window on macOS using `NSPanel` with `NSWindowStyleMask::NonactivatingPanel`.
|
- Add ability to make non-activating window on macOS using `NSPanel` with `NSWindowStyleMask::NonactivatingPanel`.
|
||||||
- On Windows, add `IconExtWindows::from_resource_name`.
|
- On Windows, add `IconExtWindows::from_resource_name`.
|
||||||
- Implement `MonitorHandleProvider` for `MonitorHandle` to access common monitor API.
|
- Implement `MonitorHandleProvider` for `MonitorHandle` to access common monitor API.
|
||||||
|
|||||||
@@ -13,7 +13,12 @@
|
|||||||
//! * `wayland-csd-adwaita` (default).
|
//! * `wayland-csd-adwaita` (default).
|
||||||
//! * `wayland-csd-adwaita-crossfont`.
|
//! * `wayland-csd-adwaita-crossfont`.
|
||||||
//! * `wayland-csd-adwaita-notitle`.
|
//! * `wayland-csd-adwaita-notitle`.
|
||||||
|
|
||||||
|
use std::ffi::c_void;
|
||||||
|
use std::ptr::NonNull;
|
||||||
|
|
||||||
use crate::event_loop::{ActiveEventLoop, EventLoop, EventLoopBuilder};
|
use crate::event_loop::{ActiveEventLoop, EventLoop, EventLoopBuilder};
|
||||||
|
use crate::platform_impl::wayland::Window;
|
||||||
pub use crate::window::Theme;
|
pub use crate::window::Theme;
|
||||||
use crate::window::{Window as CoreWindow, WindowAttributes};
|
use crate::window::{Window as CoreWindow, WindowAttributes};
|
||||||
|
|
||||||
@@ -72,9 +77,17 @@ impl EventLoopBuilderExtWayland for EventLoopBuilder {
|
|||||||
/// Additional methods on [`Window`] that are specific to Wayland.
|
/// Additional methods on [`Window`] that are specific to Wayland.
|
||||||
///
|
///
|
||||||
/// [`Window`]: crate::window::Window
|
/// [`Window`]: crate::window::Window
|
||||||
pub trait WindowExtWayland {}
|
pub trait WindowExtWayland {
|
||||||
|
/// Returns `xdg_toplevel` of the window or [`None`] if the window is X11 window.
|
||||||
|
fn xdg_toplevel(&self) -> Option<NonNull<c_void>>;
|
||||||
|
}
|
||||||
|
|
||||||
impl WindowExtWayland for dyn CoreWindow + '_ {}
|
impl WindowExtWayland for dyn CoreWindow + '_ {
|
||||||
|
#[inline]
|
||||||
|
fn xdg_toplevel(&self) -> Option<NonNull<c_void>> {
|
||||||
|
self.cast_ref::<Window>()?.xdg_toplevel()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Additional methods on [`WindowAttributes`] that are specific to Wayland.
|
/// Additional methods on [`WindowAttributes`] that are specific to Wayland.
|
||||||
pub trait WindowAttributesExtWayland {
|
pub trait WindowAttributesExtWayland {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
//! The Wayland window.
|
//! The Wayland window.
|
||||||
|
|
||||||
|
use std::ffi::c_void;
|
||||||
|
use std::ptr::NonNull;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
@@ -214,6 +216,10 @@ impl Window {
|
|||||||
window_events_sink,
|
window_events_sink,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn xdg_toplevel(&self) -> Option<NonNull<c_void>> {
|
||||||
|
NonNull::new(self.window.xdg_toplevel().id().as_ptr().cast())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Window {
|
impl Window {
|
||||||
|
|||||||
Reference in New Issue
Block a user