WIP: Refactor Linux platform implementation (#10227)
This puts the Linux platform implementation at a similar code style and quality to the macOS platform. The largest change is that I collapsed the `LinuxPlatform` -> `[Backend]` -> `[Backend]State` -> `[Backend]StateInner` to just `[Backend]` and `[Backend]State`, and in the process removed most of the `Rc`s and `RefCell`s. TODO: - [x] Make sure that this is on-par with the existing implementation - [x] Review in detail, now that the large changes are done. - [ ] Update the roadmap Release Notes: - N/A
This commit is contained in:
parent
ee1642a50f
commit
def87a8d76
18 changed files with 1256 additions and 1095 deletions
|
@ -66,7 +66,14 @@ pub(crate) fn current_platform() -> Rc<dyn Platform> {
|
|||
}
|
||||
#[cfg(target_os = "linux")]
|
||||
pub(crate) fn current_platform() -> Rc<dyn Platform> {
|
||||
Rc::new(LinuxPlatform::new())
|
||||
let wayland_display = std::env::var_os("WAYLAND_DISPLAY");
|
||||
let use_wayland = wayland_display.is_some_and(|display| !display.is_empty());
|
||||
|
||||
if use_wayland {
|
||||
Rc::new(WaylandClient::new())
|
||||
} else {
|
||||
Rc::new(X11Client::new())
|
||||
}
|
||||
}
|
||||
// todo("windows")
|
||||
#[cfg(target_os = "windows")]
|
||||
|
@ -207,6 +214,7 @@ pub(crate) trait PlatformWindow: HasWindowHandle + HasDisplayHandle {
|
|||
fn on_appearance_changed(&self, callback: Box<dyn FnMut()>);
|
||||
fn is_topmost_for_position(&self, position: Point<Pixels>) -> bool;
|
||||
fn draw(&self, scene: &Scene);
|
||||
fn completed_frame(&self) {}
|
||||
fn sprite_atlas(&self) -> Arc<dyn PlatformAtlas>;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue