Remove unsound SendSyncWrapper (#3303)
This commit is contained in:
parent
ba654bb61e
commit
34e42ff94d
12 changed files with 86 additions and 79 deletions
|
|
@ -475,7 +475,7 @@ impl WinitUIWindow {
|
|||
|
||||
this.setRootViewController(Some(view_controller));
|
||||
|
||||
match window_attributes.fullscreen.0.clone().map(Into::into) {
|
||||
match window_attributes.fullscreen.clone().map(Into::into) {
|
||||
Some(Fullscreen::Exclusive(ref video_mode)) => {
|
||||
let monitor = video_mode.monitor();
|
||||
let screen = monitor.ui_screen(mtm);
|
||||
|
|
|
|||
|
|
@ -367,15 +367,6 @@ impl Inner {
|
|||
rwh_06::RawWindowHandle::UiKit(window_handle)
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
pub fn raw_display_handle_rwh_06(
|
||||
&self,
|
||||
) -> Result<rwh_06::RawDisplayHandle, rwh_06::HandleError> {
|
||||
Ok(rwh_06::RawDisplayHandle::UiKit(
|
||||
rwh_06::UiKitDisplayHandle::new(),
|
||||
))
|
||||
}
|
||||
|
||||
pub fn theme(&self) -> Option<Theme> {
|
||||
warn!("`Window::theme` is ignored on iOS");
|
||||
None
|
||||
|
|
@ -424,7 +415,7 @@ impl Window {
|
|||
// TODO: transparency, visible
|
||||
|
||||
let main_screen = UIScreen::main(mtm);
|
||||
let fullscreen = window_attributes.fullscreen.0.clone().map(Into::into);
|
||||
let fullscreen = window_attributes.fullscreen.clone().map(Into::into);
|
||||
let screen = match fullscreen {
|
||||
Some(Fullscreen::Exclusive(ref video_mode)) => video_mode.monitor.ui_screen(mtm),
|
||||
Some(Fullscreen::Borderless(Some(ref monitor))) => monitor.ui_screen(mtm),
|
||||
|
|
@ -532,6 +523,16 @@ impl Window {
|
|||
Err(rwh_06::HandleError::Unavailable)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
#[inline]
|
||||
pub(crate) fn raw_display_handle_rwh_06(
|
||||
&self,
|
||||
) -> Result<rwh_06::RawDisplayHandle, rwh_06::HandleError> {
|
||||
Ok(rwh_06::RawDisplayHandle::UiKit(
|
||||
rwh_06::UiKitDisplayHandle::new(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
// WindowExtIOS
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ impl Window {
|
|||
window_state.set_resizable(attributes.resizable);
|
||||
|
||||
// Set startup mode.
|
||||
match attributes.fullscreen.0.map(Into::into) {
|
||||
match attributes.fullscreen.map(Into::into) {
|
||||
Some(Fullscreen::Exclusive(_)) => {
|
||||
warn!("`Fullscreen::Exclusive` is ignored on Wayland");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ impl UnownedWindow {
|
|||
let xconn = &event_loop.xconn;
|
||||
let atoms = xconn.atoms();
|
||||
#[cfg(feature = "rwh_06")]
|
||||
let root = match window_attrs.parent_window.0 {
|
||||
let root = match window_attrs.parent_window.as_ref().map(|handle| handle.0) {
|
||||
Some(rwh_06::RawWindowHandle::Xlib(handle)) => handle.window as xproto::Window,
|
||||
Some(rwh_06::RawWindowHandle::Xcb(handle)) => handle.window.get(),
|
||||
Some(raw) => unreachable!("Invalid raw window handle {raw:?} on X11"),
|
||||
|
|
@ -557,10 +557,10 @@ impl UnownedWindow {
|
|||
if window_attrs.maximized {
|
||||
leap!(window.set_maximized_inner(window_attrs.maximized)).ignore_error();
|
||||
}
|
||||
if window_attrs.fullscreen.0.is_some() {
|
||||
if window_attrs.fullscreen.is_some() {
|
||||
if let Some(flusher) =
|
||||
leap!(window
|
||||
.set_fullscreen_inner(window_attrs.fullscreen.0.clone().map(Into::into)))
|
||||
.set_fullscreen_inner(window_attrs.fullscreen.clone().map(Into::into)))
|
||||
{
|
||||
flusher.ignore_error()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ impl std::fmt::Debug for VideoMode {
|
|||
pub struct NativeDisplayMode(pub ffi::CGDisplayModeRef);
|
||||
|
||||
unsafe impl Send for NativeDisplayMode {}
|
||||
unsafe impl Sync for NativeDisplayMode {}
|
||||
|
||||
impl Drop for NativeDisplayMode {
|
||||
fn drop(&mut self) {
|
||||
|
|
|
|||
|
|
@ -107,6 +107,16 @@ impl Window {
|
|||
Err(rwh_06::HandleError::Unavailable)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
#[inline]
|
||||
pub(crate) fn raw_display_handle_rwh_06(
|
||||
&self,
|
||||
) -> Result<rwh_06::RawDisplayHandle, rwh_06::HandleError> {
|
||||
Ok(rwh_06::RawDisplayHandle::AppKit(
|
||||
rwh_06::AppKitDisplayHandle::new(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
|
|
@ -282,7 +292,7 @@ impl WinitWindow {
|
|||
trace_scope!("WinitWindow::new");
|
||||
|
||||
let this = autoreleasepool(|_| {
|
||||
let screen = match attrs.fullscreen.0.clone().map(Into::into) {
|
||||
let screen = match attrs.fullscreen.clone().map(Into::into) {
|
||||
Some(Fullscreen::Borderless(Some(monitor)))
|
||||
| Some(Fullscreen::Exclusive(VideoMode { monitor, .. })) => {
|
||||
monitor.ns_screen(mtm).or_else(|| NSScreen::mainScreen(mtm))
|
||||
|
|
@ -442,7 +452,7 @@ impl WinitWindow {
|
|||
.ok_or_else(|| os_error!(OsError::CreationError("Couldn't create `NSWindow`")))?;
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
match attrs.parent_window.0 {
|
||||
match attrs.parent_window.map(|handle| handle.0) {
|
||||
Some(rwh_06::RawWindowHandle::AppKit(handle)) => {
|
||||
// SAFETY: Caller ensures the pointer is valid or NULL
|
||||
// Unwrap is fine, since the pointer comes from `NonNull`.
|
||||
|
|
@ -520,14 +530,14 @@ impl WinitWindow {
|
|||
|
||||
this.set_cursor(attrs.cursor);
|
||||
|
||||
let delegate = WinitWindowDelegate::new(&this, attrs.fullscreen.0.is_some());
|
||||
let delegate = WinitWindowDelegate::new(&this, attrs.fullscreen.is_some());
|
||||
|
||||
// XXX Send `Focused(false)` right after creating the window delegate, so we won't
|
||||
// obscure the real focused events on the startup.
|
||||
delegate.queue_event(WindowEvent::Focused(false));
|
||||
|
||||
// Set fullscreen mode after we setup everything
|
||||
this.set_fullscreen(attrs.fullscreen.0.map(Into::into));
|
||||
this.set_fullscreen(attrs.fullscreen.map(Into::into));
|
||||
|
||||
// Setting the window as key has to happen *after* we set the fullscreen
|
||||
// state, since otherwise we'll briefly see the window at normal size
|
||||
|
|
@ -1368,16 +1378,6 @@ impl WinitWindow {
|
|||
rwh_06::RawWindowHandle::AppKit(window_handle)
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
#[inline]
|
||||
pub fn raw_display_handle_rwh_06(
|
||||
&self,
|
||||
) -> Result<rwh_06::RawDisplayHandle, rwh_06::HandleError> {
|
||||
Ok(rwh_06::RawDisplayHandle::AppKit(
|
||||
rwh_06::AppKitDisplayHandle::new(),
|
||||
))
|
||||
}
|
||||
|
||||
fn toggle_style_mask(&self, mask: NSWindowStyleMask, on: bool) {
|
||||
let current_style_mask = self.styleMask();
|
||||
if on {
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ impl Canvas {
|
|||
super::set_canvas_position(&common.document, &common.raw, &common.style, position);
|
||||
}
|
||||
|
||||
if attr.fullscreen.0.is_some() {
|
||||
if attr.fullscreen.is_some() {
|
||||
fullscreen::request_fullscreen(&document, &canvas);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,6 +112,16 @@ impl Window {
|
|||
})
|
||||
.ok_or(rwh_06::HandleError::Unavailable)
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
#[inline]
|
||||
pub(crate) fn raw_display_handle_rwh_06(
|
||||
&self,
|
||||
) -> Result<rwh_06::RawDisplayHandle, rwh_06::HandleError> {
|
||||
Ok(rwh_06::RawDisplayHandle::Web(
|
||||
rwh_06::WebDisplayHandle::new(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
impl Inner {
|
||||
|
|
@ -400,16 +410,6 @@ impl Inner {
|
|||
rwh_05::RawDisplayHandle::Web(rwh_05::WebDisplayHandle::empty())
|
||||
}
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
#[inline]
|
||||
pub fn raw_display_handle_rwh_06(
|
||||
&self,
|
||||
) -> Result<rwh_06::RawDisplayHandle, rwh_06::HandleError> {
|
||||
Ok(rwh_06::RawDisplayHandle::Web(
|
||||
rwh_06::WebDisplayHandle::new(),
|
||||
))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_theme(&self, _theme: Option<Theme>) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1233,8 +1233,8 @@ impl<'a, T: 'static> InitData<'a, T> {
|
|||
|
||||
win.set_enabled_buttons(attributes.enabled_buttons);
|
||||
|
||||
if attributes.fullscreen.0.is_some() {
|
||||
win.set_fullscreen(attributes.fullscreen.0.map(Into::into));
|
||||
if attributes.fullscreen.is_some() {
|
||||
win.set_fullscreen(attributes.fullscreen.map(Into::into));
|
||||
unsafe { force_window_active(win.window) };
|
||||
} else {
|
||||
let size = attributes
|
||||
|
|
@ -1320,7 +1320,7 @@ where
|
|||
};
|
||||
|
||||
#[cfg(feature = "rwh_06")]
|
||||
let parent = match attributes.parent_window.0 {
|
||||
let parent = match attributes.parent_window.as_ref().map(|handle| handle.0) {
|
||||
Some(rwh_06::RawWindowHandle::Win32(handle)) => {
|
||||
window_flags.set(WindowFlags::CHILD, true);
|
||||
if pl_attribs.menu.is_some() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue