Implement From<u64> for WindowId and vise-versa

This should help downstream applications to expose WindowId to the end
users via e.g. IPC to control particular windows in multi window
systems.
This commit is contained in:
Kirill Chibisov 2022-07-02 14:27:19 +03:00 committed by GitHub
parent c55d97183d
commit cb41c58f21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 115 additions and 60 deletions

View file

@ -369,9 +369,7 @@ impl<T: 'static> EventLoop<T> {
sticky_exit_callback(
Event::WindowEvent {
window_id: crate::window::WindowId(
crate::platform_impl::WindowId::Wayland(*window_id),
),
window_id: crate::window::WindowId(*window_id),
event: WindowEvent::ScaleFactorChanged {
scale_factor,
new_inner_size: &mut physical_size,
@ -421,9 +419,7 @@ impl<T: 'static> EventLoop<T> {
if let Some(physical_size) = physical_size {
sticky_exit_callback(
Event::WindowEvent {
window_id: crate::window::WindowId(
crate::platform_impl::WindowId::Wayland(*window_id),
),
window_id: crate::window::WindowId(*window_id),
event: WindowEvent::Resized(physical_size),
},
&self.window_target,
@ -436,9 +432,7 @@ impl<T: 'static> EventLoop<T> {
if window_update.close_window {
sticky_exit_callback(
Event::WindowEvent {
window_id: crate::window::WindowId(
crate::platform_impl::WindowId::Wayland(*window_id),
),
window_id: crate::window::WindowId(*window_id),
event: WindowEvent::CloseRequested,
},
&self.window_target,
@ -488,9 +482,7 @@ impl<T: 'static> EventLoop<T> {
// Handle redraw request.
if window_update.redraw_requested {
sticky_exit_callback(
Event::RedrawRequested(crate::window::WindowId(
crate::platform_impl::WindowId::Wayland(*window_id),
)),
Event::RedrawRequested(crate::window::WindowId(*window_id)),
&self.window_target,
&mut control_flow,
&mut callback,

View file

@ -1,7 +1,7 @@
//! An event loop's sink to deliver events from the Wayland event callbacks.
use crate::event::{DeviceEvent, DeviceId as RootDeviceId, Event, WindowEvent};
use crate::platform_impl::platform::{DeviceId as PlatformDeviceId, WindowId as PlatformWindowId};
use crate::platform_impl::platform::DeviceId as PlatformDeviceId;
use crate::window::WindowId as RootWindowId;
use super::{DeviceId, WindowId};
@ -30,7 +30,7 @@ impl EventSink {
pub fn push_window_event(&mut self, event: WindowEvent<'static>, window_id: WindowId) {
self.window_events.push(Event::WindowEvent {
event,
window_id: RootWindowId(PlatformWindowId::Wayland(window_id)),
window_id: RootWindowId(window_id),
});
}
}