chore: remove platform WindowId's

WindowId is a window _identifier_, and as such doesn't store anything
(unlike a _handle_). So we can safely make only be defined once, in the
core crate.

There are a few backends where we still use `into_raw` internally; I
consider these patterns discouraged, we should not be passing around
important state in the window id.
This commit is contained in:
Mads Marquart 2024-10-08 15:29:40 +02:00 committed by GitHub
parent eccd9e415d
commit da2268ae22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 226 additions and 379 deletions

View file

@ -15,8 +15,7 @@ use crate::event::Event;
use crate::platform_impl::platform::definitions::{
IDataObjectVtbl, IDropTarget, IDropTargetVtbl, IUnknownVtbl,
};
use crate::platform_impl::platform::WindowId;
use crate::window::WindowId as RootWindowId;
use crate::window::WindowId;
#[repr(C)]
pub struct FileDropHandlerData {
@ -86,7 +85,7 @@ impl FileDropHandler {
let hdrop = unsafe {
Self::iterate_filenames(pDataObj, |filename| {
drop_handler.send_event(Event::WindowEvent {
window_id: RootWindowId(WindowId(drop_handler.window)),
window_id: WindowId::from_raw(drop_handler.window as usize),
event: HoveredFile(filename),
});
})
@ -120,7 +119,7 @@ impl FileDropHandler {
let drop_handler = unsafe { Self::from_interface(this) };
if drop_handler.hovered_is_valid {
drop_handler.send_event(Event::WindowEvent {
window_id: RootWindowId(WindowId(drop_handler.window)),
window_id: WindowId::from_raw(drop_handler.window as usize),
event: HoveredFileCancelled,
});
}
@ -140,7 +139,7 @@ impl FileDropHandler {
let hdrop = unsafe {
Self::iterate_filenames(pDataObj, |filename| {
drop_handler.send_event(Event::WindowEvent {
window_id: RootWindowId(WindowId(drop_handler.window)),
window_id: WindowId::from_raw(drop_handler.window as usize),
event: DroppedFile(filename),
});
})