Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Window::open_as_if_parented #153

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions src/macos/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,44 +166,6 @@ impl Window {
window_handle
}

pub fn open_as_if_parented<H, B>(options: WindowOpenOptions, build: B) -> WindowHandle
where
H: WindowHandler + 'static,
B: FnOnce(&mut crate::Window) -> H,
B: Send + 'static,
{
let pool = unsafe { NSAutoreleasePool::new(nil) };

let scaling = match options.scale {
WindowScalePolicy::ScaleFactor(scale) => scale,
WindowScalePolicy::SystemScaleFactor => 1.0,
};

let window_info = WindowInfo::from_logical_size(options.size, scaling);

let ns_view = unsafe { create_view(&options) };

let window = Window {
ns_app: None,
ns_window: None,
ns_view,
close_requested: false,

#[cfg(feature = "opengl")]
gl_context: options
.gl_config
.map(|gl_config| Self::create_gl_context(None, ns_view, gl_config)),
};

let window_handle = Self::init(true, window, window_info, build);

unsafe {
let () = msg_send![pool, drain];
}

window_handle
}

pub fn open_blocking<H, B>(options: WindowOpenOptions, build: B)
where
H: WindowHandler + 'static,
Expand Down
11 changes: 0 additions & 11 deletions src/win/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,17 +565,6 @@ impl Window<'_> {
window_handle
}

pub fn open_as_if_parented<H, B>(options: WindowOpenOptions, build: B) -> WindowHandle
where
H: WindowHandler + 'static,
B: FnOnce(&mut crate::Window) -> H,
B: Send + 'static,
{
let (window_handle, _) = Self::open(true, null_mut(), options, build);

window_handle
}

pub fn open_blocking<H, B>(options: WindowOpenOptions, build: B)
where
H: WindowHandler + 'static,
Expand Down
10 changes: 0 additions & 10 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,6 @@ impl<'a> Window<'a> {
WindowHandle::new(window_handle)
}

pub fn open_as_if_parented<H, B>(options: WindowOpenOptions, build: B) -> WindowHandle
where
H: WindowHandler + 'static,
B: FnOnce(&mut Window) -> H,
B: Send + 'static,
{
let window_handle = platform::Window::open_as_if_parented::<H, B>(options, build);
WindowHandle::new(window_handle)
}

pub fn open_blocking<H, B>(options: WindowOpenOptions, build: B)
where
H: WindowHandler + 'static,
Expand Down
20 changes: 0 additions & 20 deletions src/x11/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,26 +147,6 @@ impl Window {
window_handle
}

pub fn open_as_if_parented<H, B>(options: WindowOpenOptions, build: B) -> WindowHandle
where
H: WindowHandler + 'static,
B: FnOnce(&mut crate::Window) -> H,
B: Send + 'static,
{
let (tx, rx) = mpsc::sync_channel::<WindowOpenResult>(1);

let (parent_handle, mut window_handle) = ParentHandle::new();

thread::spawn(move || {
Self::window_thread(None, options, build, tx.clone(), Some(parent_handle));
});

let raw_window_handle = rx.recv().unwrap().unwrap();
window_handle.raw_window_handle = Some(raw_window_handle.0);

window_handle
}

pub fn open_blocking<H, B>(options: WindowOpenOptions, build: B)
where
H: WindowHandler + 'static,
Expand Down
Loading