Rename internal structs for consistency (#2149)

Proxy -> EventLoopProxy
Id -> WindowId or DeviceId
WindowTarget -> EventLoopWindowTarget
Handle -> MonitorHandle
Mode -> VideoMode
PlatformSpecificBuilderAttributes -> PlatformSpecificWindowBuilderAttributes
SuperWindowId -> RootWindowId
This commit is contained in:
Mads Marquart 2022-03-18 14:09:39 +01:00 committed by GitHub
parent 85baf79d17
commit a438091266
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 134 additions and 135 deletions

View file

@ -9,7 +9,7 @@ use crate::window::{
use raw_window_handle::{RawWindowHandle, WebHandle};
use super::{backend, monitor, EventLoopWindowTarget};
use super::{backend, monitor::MonitorHandle, EventLoopWindowTarget};
use std::cell::{Ref, RefCell};
use std::collections::vec_deque::IntoIter as VecDequeIter;
@ -19,7 +19,7 @@ use std::rc::Rc;
pub struct Window {
canvas: Rc<RefCell<backend::Canvas>>,
previous_pointer: RefCell<&'static str>,
id: Id,
id: WindowId,
register_redraw_request: Box<dyn Fn()>,
resize_notify_fn: Box<dyn Fn(PhysicalSize<u32>)>,
destroy_fn: Option<Box<dyn FnOnce()>>,
@ -29,7 +29,7 @@ impl Window {
pub fn new<T>(
target: &EventLoopWindowTarget<T>,
attr: WindowAttributes,
platform_attr: PlatformSpecificBuilderAttributes,
platform_attr: PlatformSpecificWindowBuilderAttributes,
) -> Result<Self, RootOE> {
let runner = target.runner.clone();
@ -311,7 +311,7 @@ impl Window {
// Allow directly accessing the current monitor internally without unwrapping.
fn current_monitor_inner(&self) -> RootMH {
RootMH {
inner: monitor::Handle,
inner: MonitorHandle,
}
}
@ -321,19 +321,19 @@ impl Window {
}
#[inline]
pub fn available_monitors(&self) -> VecDequeIter<monitor::Handle> {
pub fn available_monitors(&self) -> VecDequeIter<MonitorHandle> {
VecDeque::new().into_iter()
}
#[inline]
pub fn primary_monitor(&self) -> Option<RootMH> {
Some(RootMH {
inner: monitor::Handle,
inner: MonitorHandle,
})
}
#[inline]
pub fn id(&self) -> Id {
pub fn id(&self) -> WindowId {
return self.id;
}
@ -354,15 +354,15 @@ impl Drop for Window {
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Id(pub(crate) u32);
pub struct WindowId(pub(crate) u32);
impl Id {
pub const unsafe fn dummy() -> Id {
Id(0)
impl WindowId {
pub const unsafe fn dummy() -> Self {
Self(0)
}
}
#[derive(Default, Clone)]
pub struct PlatformSpecificBuilderAttributes {
pub struct PlatformSpecificWindowBuilderAttributes {
pub(crate) canvas: Option<backend::RawCanvasType>,
}