mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-02 06:40:06 -04:00
Add ability to get wayland display from events loop. (#829)
Signed-off-by: Hal Gentz <zegentzy@protonmail.com>
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
- `LoopDestroyed` is emitted when the `run` or `run_return` method is about to exit.
|
- `LoopDestroyed` is emitted when the `run` or `run_return` method is about to exit.
|
||||||
- Rename `MonitorId` to `MonitorHandle`.
|
- Rename `MonitorId` to `MonitorHandle`.
|
||||||
- Removed `serde` implementations from `ControlFlow`.
|
- Removed `serde` implementations from `ControlFlow`.
|
||||||
|
- On Wayland, added a `get_wayland_display` function to `EventsLoopExt`.
|
||||||
- On Windows, fix `CursorMoved(0, 0)` getting dispatched on window focus.
|
- On Windows, fix `CursorMoved(0, 0)` getting dispatched on window focus.
|
||||||
- On macOS, fix command key event left and right reverse.
|
- On macOS, fix command key event left and right reverse.
|
||||||
- On FreeBSD, NetBSD, and OpenBSD, fix build of X11 backend.
|
- On FreeBSD, NetBSD, and OpenBSD, fix build of X11 backend.
|
||||||
|
|||||||
@@ -111,6 +111,13 @@ pub trait EventLoopExtUnix {
|
|||||||
|
|
||||||
//#[doc(hidden)]
|
//#[doc(hidden)]
|
||||||
//fn get_xlib_xconnection(&self) -> Option<Arc<XConnection>>;
|
//fn get_xlib_xconnection(&self) -> Option<Arc<XConnection>>;
|
||||||
|
|
||||||
|
/// Returns a pointer to the `wl_display` object of wayland that is used by this `EventsLoop`.
|
||||||
|
///
|
||||||
|
/// Returns `None` if the `EventsLoop` doesn't use wayland (if it uses xlib for example).
|
||||||
|
///
|
||||||
|
/// The pointer will become invalid when the glutin `EventsLoop` is destroyed.
|
||||||
|
fn get_wayland_display(&self) -> Option<*mut raw::c_void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> EventLoopExtUnix for EventLoop<T> {
|
impl<T> EventLoopExtUnix for EventLoop<T> {
|
||||||
@@ -150,6 +157,14 @@ impl<T> EventLoopExtUnix for EventLoop<T> {
|
|||||||
//fn get_xlib_xconnection(&self) -> Option<Arc<XConnection>> {
|
//fn get_xlib_xconnection(&self) -> Option<Arc<XConnection>> {
|
||||||
// self.event_loop.x_connection().cloned()
|
// self.event_loop.x_connection().cloned()
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn get_wayland_display(&self) -> Option<*mut raw::c_void> {
|
||||||
|
match self.events_loop {
|
||||||
|
LinuxEventsLoop::Wayland(ref e) => Some(e.get_display().c_ptr() as *mut _),
|
||||||
|
_ => None
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Additional methods on `Window` that are specific to Unix.
|
/// Additional methods on `Window` that are specific to Unix.
|
||||||
|
|||||||
@@ -287,6 +287,10 @@ impl<T: 'static> EventLoop<T> {
|
|||||||
get_available_monitors(&self.outputs)
|
get_available_monitors(&self.outputs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_display(&self) -> &Display {
|
||||||
|
&*self.display
|
||||||
|
}
|
||||||
|
|
||||||
pub fn window_target(&self) -> &RootELW<T> {
|
pub fn window_target(&self) -> &RootELW<T> {
|
||||||
&self.window_target
|
&self.window_target
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user