chore(rustfmt): use nightly (#2325)
Stable rustfmt lacks a lot of features resulting in worse formatted code, thus use nightly formatter.
This commit is contained in:
parent
7006c7ceca
commit
7b0c7b6cb2
154 changed files with 3439 additions and 5891 deletions
|
|
@ -1,16 +1,11 @@
|
|||
use std::{
|
||||
collections::VecDeque,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
use std::collections::VecDeque;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use crate::{
|
||||
cursor::Cursor,
|
||||
dpi::{PhysicalPosition, PhysicalSize, Position, Size},
|
||||
error,
|
||||
platform_impl::Fullscreen,
|
||||
window,
|
||||
window::ImePurpose,
|
||||
};
|
||||
use crate::cursor::Cursor;
|
||||
use crate::dpi::{PhysicalPosition, PhysicalSize, Position, Size};
|
||||
use crate::platform_impl::Fullscreen;
|
||||
use crate::window::ImePurpose;
|
||||
use crate::{error, window};
|
||||
|
||||
use super::{
|
||||
ActiveEventLoop, MonitorHandle, OsError, RedoxSocket, TimeSocket, WindowId, WindowProperties,
|
||||
|
|
@ -54,7 +49,7 @@ impl Window {
|
|||
(1024, 768)
|
||||
};
|
||||
|
||||
//TODO: min/max inner_size
|
||||
// TODO: min/max inner_size
|
||||
|
||||
// Async by default.
|
||||
let mut flag_str = ORBITAL_FLAG_ASYNC.to_string();
|
||||
|
|
@ -67,7 +62,7 @@ impl Window {
|
|||
flag_str.push(ORBITAL_FLAG_RESIZABLE);
|
||||
}
|
||||
|
||||
//TODO: fullscreen
|
||||
// TODO: fullscreen
|
||||
|
||||
if attrs.transparent {
|
||||
flag_str.push(ORBITAL_FLAG_TRANSPARENT);
|
||||
|
|
@ -84,14 +79,14 @@ impl Window {
|
|||
match attrs.window_level {
|
||||
window::WindowLevel::AlwaysOnBottom => {
|
||||
flag_str.push(ORBITAL_FLAG_BACK);
|
||||
}
|
||||
window::WindowLevel::Normal => {}
|
||||
},
|
||||
window::WindowLevel::Normal => {},
|
||||
window::WindowLevel::AlwaysOnTop => {
|
||||
flag_str.push(ORBITAL_FLAG_FRONT);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
//TODO: window_icon
|
||||
// TODO: window_icon
|
||||
|
||||
// Open window.
|
||||
let window = RedoxSocket::orbital(&WindowProperties {
|
||||
|
|
@ -158,9 +153,7 @@ impl Window {
|
|||
|
||||
#[inline]
|
||||
pub fn id(&self) -> WindowId {
|
||||
WindowId {
|
||||
fd: self.window_socket.fd as u64,
|
||||
}
|
||||
WindowId { fd: self.window_socket.fd as u64 }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
@ -207,36 +200,28 @@ impl Window {
|
|||
#[inline]
|
||||
pub fn inner_position(&self) -> Result<PhysicalPosition<i32>, error::NotSupportedError> {
|
||||
let mut buf: [u8; 4096] = [0; 4096];
|
||||
let path = self
|
||||
.window_socket
|
||||
.fpath(&mut buf)
|
||||
.expect("failed to read properties");
|
||||
let path = self.window_socket.fpath(&mut buf).expect("failed to read properties");
|
||||
let properties = WindowProperties::new(path);
|
||||
Ok((properties.x, properties.y).into())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn outer_position(&self) -> Result<PhysicalPosition<i32>, error::NotSupportedError> {
|
||||
//TODO: adjust for window decorations
|
||||
// TODO: adjust for window decorations
|
||||
self.inner_position()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_outer_position(&self, position: Position) {
|
||||
//TODO: adjust for window decorations
|
||||
// TODO: adjust for window decorations
|
||||
let (x, y): (i32, i32) = position.to_physical::<i32>(self.scale_factor()).into();
|
||||
self.window_socket
|
||||
.write(format!("P,{x},{y}").as_bytes())
|
||||
.expect("failed to set position");
|
||||
self.window_socket.write(format!("P,{x},{y}").as_bytes()).expect("failed to set position");
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn inner_size(&self) -> PhysicalSize<u32> {
|
||||
let mut buf: [u8; 4096] = [0; 4096];
|
||||
let path = self
|
||||
.window_socket
|
||||
.fpath(&mut buf)
|
||||
.expect("failed to read properties");
|
||||
let path = self.window_socket.fpath(&mut buf).expect("failed to read properties");
|
||||
let properties = WindowProperties::new(path);
|
||||
(properties.w, properties.h).into()
|
||||
}
|
||||
|
|
@ -244,15 +229,13 @@ impl Window {
|
|||
#[inline]
|
||||
pub fn request_inner_size(&self, size: Size) -> Option<PhysicalSize<u32>> {
|
||||
let (w, h): (u32, u32) = size.to_physical::<u32>(self.scale_factor()).into();
|
||||
self.window_socket
|
||||
.write(format!("S,{w},{h}").as_bytes())
|
||||
.expect("failed to set size");
|
||||
self.window_socket.write(format!("S,{w},{h}").as_bytes()).expect("failed to set size");
|
||||
None
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn outer_size(&self) -> PhysicalSize<u32> {
|
||||
//TODO: adjust for window decorations
|
||||
// TODO: adjust for window decorations
|
||||
self.inner_size()
|
||||
}
|
||||
|
||||
|
|
@ -265,19 +248,14 @@ impl Window {
|
|||
#[inline]
|
||||
pub fn title(&self) -> String {
|
||||
let mut buf: [u8; 4096] = [0; 4096];
|
||||
let path = self
|
||||
.window_socket
|
||||
.fpath(&mut buf)
|
||||
.expect("failed to read properties");
|
||||
let path = self.window_socket.fpath(&mut buf).expect("failed to read properties");
|
||||
let properties = WindowProperties::new(path);
|
||||
properties.title.to_string()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_title(&self, title: &str) {
|
||||
self.window_socket
|
||||
.write(format!("T,{title}").as_bytes())
|
||||
.expect("failed to set title");
|
||||
self.window_socket.write(format!("T,{title}").as_bytes()).expect("failed to set title");
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
@ -357,14 +335,14 @@ impl Window {
|
|||
match level {
|
||||
window::WindowLevel::AlwaysOnBottom => {
|
||||
let _ = self.set_flag(ORBITAL_FLAG_BACK, true);
|
||||
}
|
||||
},
|
||||
window::WindowLevel::Normal => {
|
||||
let _ = self.set_flag(ORBITAL_FLAG_BACK, false);
|
||||
let _ = self.set_flag(ORBITAL_FLAG_FRONT, false);
|
||||
}
|
||||
},
|
||||
window::WindowLevel::AlwaysOnTop => {
|
||||
let _ = self.set_flag(ORBITAL_FLAG_FRONT, true);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -391,9 +369,7 @@ impl Window {
|
|||
|
||||
#[inline]
|
||||
pub fn set_cursor_position(&self, _: Position) -> Result<(), error::ExternalError> {
|
||||
Err(error::ExternalError::NotSupported(
|
||||
error::NotSupportedError::new(),
|
||||
))
|
||||
Err(error::ExternalError::NotSupported(error::NotSupportedError::new()))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
@ -417,9 +393,7 @@ impl Window {
|
|||
|
||||
#[inline]
|
||||
pub fn set_cursor_visible(&self, visible: bool) {
|
||||
let _ = self
|
||||
.window_socket
|
||||
.write(format!("M,C,{}", if visible { 1 } else { 0 }).as_bytes());
|
||||
let _ = self.window_socket.write(format!("M,C,{}", if visible { 1 } else { 0 }).as_bytes());
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
@ -456,9 +430,7 @@ impl Window {
|
|||
|
||||
#[inline]
|
||||
pub fn set_cursor_hittest(&self, _hittest: bool) -> Result<(), error::ExternalError> {
|
||||
Err(error::ExternalError::NotSupported(
|
||||
error::NotSupportedError::new(),
|
||||
))
|
||||
Err(error::ExternalError::NotSupported(error::NotSupportedError::new()))
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_04")]
|
||||
|
|
@ -498,9 +470,7 @@ impl Window {
|
|||
pub fn raw_display_handle_rwh_06(
|
||||
&self,
|
||||
) -> Result<rwh_06::RawDisplayHandle, rwh_06::HandleError> {
|
||||
Ok(rwh_06::RawDisplayHandle::Orbital(
|
||||
rwh_06::OrbitalDisplayHandle::new(),
|
||||
))
|
||||
Ok(rwh_06::RawDisplayHandle::Orbital(rwh_06::OrbitalDisplayHandle::new()))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue