mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-30 21:30:03 -04:00
Update send test and errors that broke some examples/APIs
This commit is contained in:
@@ -17,6 +17,7 @@ fn main() {
|
|||||||
event_loop.run(move |event, _, control_flow| {
|
event_loop.run(move |event, _, control_flow| {
|
||||||
use winit::event::ElementState::Released;
|
use winit::event::ElementState::Released;
|
||||||
use winit::event::VirtualKeyCode::{N, Y};
|
use winit::event::VirtualKeyCode::{N, Y};
|
||||||
|
*control_flow = ControlFlow::Wait;
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
Event::WindowEvent { event, .. } => match event {
|
Event::WindowEvent { event, .. } => match event {
|
||||||
@@ -71,7 +72,5 @@ fn main() {
|
|||||||
},
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
*control_flow = ControlFlow::Wait;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -448,6 +448,7 @@ impl Window {
|
|||||||
let window_state_lock = self.window_state.lock();
|
let window_state_lock = self.window_state.lock();
|
||||||
// We don't want to increment/decrement the display count more than once!
|
// We don't want to increment/decrement the display count more than once!
|
||||||
if hide == window_state_lock.cursor_hidden { return; }
|
if hide == window_state_lock.cursor_hidden { return; }
|
||||||
|
drop(window_state_lock);
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
let window_state = Arc::clone(&self.window_state);
|
let window_state = Arc::clone(&self.window_state);
|
||||||
self.thread_executor.execute_in_thread(move || {
|
self.thread_executor.execute_in_thread(move || {
|
||||||
@@ -455,7 +456,6 @@ impl Window {
|
|||||||
window_state.lock().cursor_hidden = hide;
|
window_state.lock().cursor_hidden = hide;
|
||||||
let _ = tx.send(());
|
let _ = tx.send(());
|
||||||
});
|
});
|
||||||
drop(window_state_lock);
|
|
||||||
rx.recv().unwrap()
|
rx.recv().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ fn needs_send<T:Send>() {}
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn event_loop_proxy_send() {
|
fn event_loop_proxy_send() {
|
||||||
// ensures that `winit::EventLoopProxy` implements `Send`
|
fn is_send<T: Send>() {
|
||||||
needs_send::<winit::event_loop::EventLoopProxy<()>>();
|
// ensures that `winit::EventLoopProxy` implements `Send`
|
||||||
|
needs_send::<winit::event_loop::EventLoopProxy<T>>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user