mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 13:51:30 +11:00
Re-format on stable rustfmt (#974)
This commit is contained in:
parent
9dd15d00d8
commit
a195ce8146
|
@ -45,11 +45,10 @@ matrix:
|
||||||
install:
|
install:
|
||||||
- rustup self update
|
- rustup self update
|
||||||
- rustup target add $TARGET; true
|
- rustup target add $TARGET; true
|
||||||
- rustup install nightly
|
- rustup component add rustfmt
|
||||||
- rustup component add rustfmt --toolchain nightly
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cargo +nightly fmt --all -- --check
|
- cargo fmt --all -- --check
|
||||||
- cargo build --target $TARGET --verbose
|
- cargo build --target $TARGET --verbose
|
||||||
- cargo build --target $TARGET --features serde --verbose
|
- cargo build --target $TARGET --features serde --verbose
|
||||||
# Running iOS apps on OSX requires the simulator so we skip that for now
|
# Running iOS apps on OSX requires the simulator so we skip that for now
|
||||||
|
|
|
@ -12,37 +12,35 @@ fn main() {
|
||||||
|
|
||||||
let mut cursor_idx = 0;
|
let mut cursor_idx = 0;
|
||||||
|
|
||||||
event_loop.run(move |event, _, control_flow| {
|
event_loop.run(move |event, _, control_flow| match event {
|
||||||
match event {
|
Event::WindowEvent {
|
||||||
Event::WindowEvent {
|
event:
|
||||||
event:
|
WindowEvent::KeyboardInput {
|
||||||
WindowEvent::KeyboardInput {
|
input:
|
||||||
input:
|
KeyboardInput {
|
||||||
KeyboardInput {
|
state: ElementState::Pressed,
|
||||||
state: ElementState::Pressed,
|
..
|
||||||
..
|
},
|
||||||
},
|
..
|
||||||
..
|
},
|
||||||
},
|
..
|
||||||
..
|
} => {
|
||||||
} => {
|
println!("Setting cursor to \"{:?}\"", CURSORS[cursor_idx]);
|
||||||
println!("Setting cursor to \"{:?}\"", CURSORS[cursor_idx]);
|
window.set_cursor_icon(CURSORS[cursor_idx]);
|
||||||
window.set_cursor_icon(CURSORS[cursor_idx]);
|
if cursor_idx < CURSORS.len() - 1 {
|
||||||
if cursor_idx < CURSORS.len() - 1 {
|
cursor_idx += 1;
|
||||||
cursor_idx += 1;
|
} else {
|
||||||
} else {
|
cursor_idx = 0;
|
||||||
cursor_idx = 0;
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
Event::WindowEvent {
|
|
||||||
event: WindowEvent::CloseRequested,
|
|
||||||
..
|
|
||||||
} => {
|
|
||||||
*control_flow = ControlFlow::Exit;
|
|
||||||
return;
|
|
||||||
},
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
|
Event::WindowEvent {
|
||||||
|
event: WindowEvent::CloseRequested,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
*control_flow = ControlFlow::Exit;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ fn main() {
|
||||||
H => window.set_cursor_visible(modifiers.shift),
|
H => window.set_cursor_visible(modifiers.shift),
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ fn main() {
|
||||||
let num = num.trim().parse().ok().expect("Please enter a number");
|
let num = num.trim().parse().ok().expect("Please enter a number");
|
||||||
match num {
|
match num {
|
||||||
2 => macos_use_simple_fullscreen = true,
|
2 => macos_use_simple_fullscreen = true,
|
||||||
_ => {},
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prompt for monitor when using native fullscreen
|
// Prompt for monitor when using native fullscreen
|
||||||
|
@ -54,69 +54,62 @@ fn main() {
|
||||||
*control_flow = ControlFlow::Wait;
|
*control_flow = ControlFlow::Wait;
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
Event::WindowEvent { event, .. } => {
|
Event::WindowEvent { event, .. } => match event {
|
||||||
match event {
|
WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
|
||||||
WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
|
WindowEvent::KeyboardInput {
|
||||||
WindowEvent::KeyboardInput {
|
input:
|
||||||
input:
|
KeyboardInput {
|
||||||
KeyboardInput {
|
virtual_keycode: Some(virtual_code),
|
||||||
virtual_keycode: Some(virtual_code),
|
state,
|
||||||
state,
|
..
|
||||||
..
|
},
|
||||||
},
|
..
|
||||||
..
|
} => match (virtual_code, state) {
|
||||||
} => {
|
(VirtualKeyCode::Escape, _) => *control_flow = ControlFlow::Exit,
|
||||||
match (virtual_code, state) {
|
(VirtualKeyCode::F, ElementState::Pressed) => {
|
||||||
(VirtualKeyCode::Escape, _) => *control_flow = ControlFlow::Exit,
|
#[cfg(target_os = "macos")]
|
||||||
(VirtualKeyCode::F, ElementState::Pressed) => {
|
{
|
||||||
#[cfg(target_os = "macos")]
|
if macos_use_simple_fullscreen {
|
||||||
{
|
use winit::platform::macos::WindowExtMacOS;
|
||||||
if macos_use_simple_fullscreen {
|
if WindowExtMacOS::set_simple_fullscreen(&window, !is_fullscreen) {
|
||||||
use winit::platform::macos::WindowExtMacOS;
|
is_fullscreen = !is_fullscreen;
|
||||||
if WindowExtMacOS::set_simple_fullscreen(
|
|
||||||
&window,
|
|
||||||
!is_fullscreen,
|
|
||||||
) {
|
|
||||||
is_fullscreen = !is_fullscreen;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
is_fullscreen = !is_fullscreen;
|
}
|
||||||
if !is_fullscreen {
|
|
||||||
window.set_fullscreen(None);
|
|
||||||
} else {
|
|
||||||
window.set_fullscreen(Some(window.current_monitor()));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
(VirtualKeyCode::S, ElementState::Pressed) => {
|
|
||||||
println!("window.fullscreen {:?}", window.fullscreen());
|
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
{
|
|
||||||
use winit::platform::macos::WindowExtMacOS;
|
|
||||||
println!(
|
|
||||||
"window.simple_fullscreen {:?}",
|
|
||||||
WindowExtMacOS::simple_fullscreen(&window)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
(VirtualKeyCode::M, ElementState::Pressed) => {
|
|
||||||
is_maximized = !is_maximized;
|
|
||||||
window.set_maximized(is_maximized);
|
|
||||||
},
|
|
||||||
(VirtualKeyCode::D, ElementState::Pressed) => {
|
|
||||||
decorations = !decorations;
|
|
||||||
window.set_decorations(decorations);
|
|
||||||
},
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
is_fullscreen = !is_fullscreen;
|
||||||
|
if !is_fullscreen {
|
||||||
|
window.set_fullscreen(None);
|
||||||
|
} else {
|
||||||
|
window.set_fullscreen(Some(window.current_monitor()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(VirtualKeyCode::S, ElementState::Pressed) => {
|
||||||
|
println!("window.fullscreen {:?}", window.fullscreen());
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
{
|
||||||
|
use winit::platform::macos::WindowExtMacOS;
|
||||||
|
println!(
|
||||||
|
"window.simple_fullscreen {:?}",
|
||||||
|
WindowExtMacOS::simple_fullscreen(&window)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(VirtualKeyCode::M, ElementState::Pressed) => {
|
||||||
|
is_maximized = !is_maximized;
|
||||||
|
window.set_maximized(is_maximized);
|
||||||
|
}
|
||||||
|
(VirtualKeyCode::D, ElementState::Pressed) => {
|
||||||
|
decorations = !decorations;
|
||||||
|
window.set_decorations(decorations);
|
||||||
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
},
|
||||||
|
_ => (),
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ fn main() {
|
||||||
// action from the user, this is generally where you'd handle cleanup before
|
// action from the user, this is generally where you'd handle cleanup before
|
||||||
// closing the window. How to close the window is detailed in the handler for
|
// closing the window. How to close the window is detailed in the handler for
|
||||||
// the Y key.
|
// the Y key.
|
||||||
},
|
}
|
||||||
WindowEvent::KeyboardInput {
|
WindowEvent::KeyboardInput {
|
||||||
input:
|
input:
|
||||||
KeyboardInput {
|
KeyboardInput {
|
||||||
|
@ -63,19 +63,19 @@ fn main() {
|
||||||
// sent.
|
// sent.
|
||||||
*control_flow = ControlFlow::Exit;
|
*control_flow = ControlFlow::Exit;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
N => {
|
N => {
|
||||||
if close_requested {
|
if close_requested {
|
||||||
println!("Your window will continue to stay by your side.");
|
println!("Your window will continue to stay by your side.");
|
||||||
close_requested = false;
|
close_requested = false;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,19 +39,15 @@ fn main() {
|
||||||
use self::VirtualKeyCode::*;
|
use self::VirtualKeyCode::*;
|
||||||
match key {
|
match key {
|
||||||
A => window.set_always_on_top(state),
|
A => window.set_always_on_top(state),
|
||||||
C => {
|
C => window.set_cursor_icon(match state {
|
||||||
window.set_cursor_icon(match state {
|
true => CursorIcon::Progress,
|
||||||
true => CursorIcon::Progress,
|
false => CursorIcon::Default,
|
||||||
false => CursorIcon::Default,
|
}),
|
||||||
})
|
|
||||||
},
|
|
||||||
D => window.set_decorations(!state),
|
D => window.set_decorations(!state),
|
||||||
F => {
|
F => window.set_fullscreen(match state {
|
||||||
window.set_fullscreen(match state {
|
true => Some(window.current_monitor()),
|
||||||
true => Some(window.current_monitor()),
|
false => None,
|
||||||
false => None,
|
}),
|
||||||
})
|
|
||||||
},
|
|
||||||
G => window.set_cursor_grab(state).unwrap(),
|
G => window.set_cursor_grab(state).unwrap(),
|
||||||
H => window.set_cursor_visible(!state),
|
H => window.set_cursor_visible(!state),
|
||||||
I => {
|
I => {
|
||||||
|
@ -60,49 +56,41 @@ fn main() {
|
||||||
println!("-> inner_position : {:?}", window.inner_position());
|
println!("-> inner_position : {:?}", window.inner_position());
|
||||||
println!("-> outer_size : {:?}", window.outer_size());
|
println!("-> outer_size : {:?}", window.outer_size());
|
||||||
println!("-> inner_size : {:?}", window.inner_size());
|
println!("-> inner_size : {:?}", window.inner_size());
|
||||||
},
|
}
|
||||||
L => {
|
L => window.set_min_inner_size(match state {
|
||||||
window.set_min_inner_size(match state {
|
true => Some(WINDOW_SIZE.into()),
|
||||||
true => Some(WINDOW_SIZE.into()),
|
false => None,
|
||||||
false => None,
|
}),
|
||||||
})
|
|
||||||
},
|
|
||||||
M => window.set_maximized(state),
|
M => window.set_maximized(state),
|
||||||
P => {
|
P => window.set_outer_position({
|
||||||
window.set_outer_position({
|
let mut position = window.outer_position().unwrap();
|
||||||
let mut position = window.outer_position().unwrap();
|
let sign = if state { 1.0 } else { -1.0 };
|
||||||
let sign = if state { 1.0 } else { -1.0 };
|
position.x += 10.0 * sign;
|
||||||
position.x += 10.0 * sign;
|
position.y += 10.0 * sign;
|
||||||
position.y += 10.0 * sign;
|
position
|
||||||
position
|
}),
|
||||||
})
|
|
||||||
},
|
|
||||||
Q => window.request_redraw(),
|
Q => window.request_redraw(),
|
||||||
R => window.set_resizable(state),
|
R => window.set_resizable(state),
|
||||||
S => {
|
S => window.set_inner_size(
|
||||||
window.set_inner_size(
|
match state {
|
||||||
match state {
|
true => (WINDOW_SIZE.0 + 100, WINDOW_SIZE.1 + 100),
|
||||||
true => (WINDOW_SIZE.0 + 100, WINDOW_SIZE.1 + 100),
|
false => WINDOW_SIZE,
|
||||||
false => WINDOW_SIZE,
|
}
|
||||||
}
|
.into(),
|
||||||
.into(),
|
),
|
||||||
|
W => window
|
||||||
|
.set_cursor_position(
|
||||||
|
(WINDOW_SIZE.0 as i32 / 2, WINDOW_SIZE.1 as i32 / 2).into(),
|
||||||
)
|
)
|
||||||
},
|
.unwrap(),
|
||||||
W => {
|
|
||||||
window
|
|
||||||
.set_cursor_position(
|
|
||||||
(WINDOW_SIZE.0 as i32 / 2, WINDOW_SIZE.1 as i32 / 2).into(),
|
|
||||||
)
|
|
||||||
.unwrap()
|
|
||||||
},
|
|
||||||
Z => {
|
Z => {
|
||||||
window.set_visible(false);
|
window.set_visible(false);
|
||||||
thread::sleep(Duration::from_secs(1));
|
thread::sleep(Duration::from_secs(1));
|
||||||
window.set_visible(true);
|
window.set_visible(true);
|
||||||
},
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,25 +102,23 @@ fn main() {
|
||||||
false => ControlFlow::Exit,
|
false => ControlFlow::Exit,
|
||||||
};
|
};
|
||||||
match event {
|
match event {
|
||||||
Event::WindowEvent { event, window_id } => {
|
Event::WindowEvent { event, window_id } => match event {
|
||||||
match event {
|
WindowEvent::CloseRequested
|
||||||
WindowEvent::CloseRequested
|
| WindowEvent::Destroyed
|
||||||
| WindowEvent::Destroyed
|
| WindowEvent::KeyboardInput {
|
||||||
| WindowEvent::KeyboardInput {
|
input:
|
||||||
input:
|
KeyboardInput {
|
||||||
KeyboardInput {
|
virtual_keycode: Some(VirtualKeyCode::Escape),
|
||||||
virtual_keycode: Some(VirtualKeyCode::Escape),
|
..
|
||||||
..
|
},
|
||||||
},
|
..
|
||||||
..
|
} => {
|
||||||
} => {
|
window_senders.remove(&window_id);
|
||||||
window_senders.remove(&window_id);
|
}
|
||||||
},
|
_ => {
|
||||||
_ => {
|
if let Some(tx) = window_senders.get(&window_id) {
|
||||||
if let Some(tx) = window_senders.get(&window_id) {
|
tx.send(event).unwrap();
|
||||||
tx.send(event).unwrap();
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|
|
@ -28,7 +28,7 @@ fn main() {
|
||||||
if windows.is_empty() {
|
if windows.is_empty() {
|
||||||
*control_flow = ControlFlow::Exit;
|
*control_flow = ControlFlow::Exit;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
WindowEvent::KeyboardInput {
|
WindowEvent::KeyboardInput {
|
||||||
input:
|
input:
|
||||||
KeyboardInput {
|
KeyboardInput {
|
||||||
|
@ -39,10 +39,10 @@ fn main() {
|
||||||
} => {
|
} => {
|
||||||
let window = Window::new(&event_loop).unwrap();
|
let window = Window::new(&event_loop).unwrap();
|
||||||
windows.insert(window.id(), window);
|
windows.insert(window.id(), window);
|
||||||
},
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -25,7 +25,7 @@ fn main() {
|
||||||
Event::EventsCleared => {
|
Event::EventsCleared => {
|
||||||
window.request_redraw();
|
window.request_redraw();
|
||||||
*control_flow = ControlFlow::WaitUntil(Instant::now() + Duration::new(1, 0))
|
*control_flow = ControlFlow::WaitUntil(Instant::now() + Duration::new(1, 0))
|
||||||
},
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,24 +19,22 @@ fn main() {
|
||||||
event_loop.run(move |event, _, control_flow| {
|
event_loop.run(move |event, _, control_flow| {
|
||||||
*control_flow = ControlFlow::Wait;
|
*control_flow = ControlFlow::Wait;
|
||||||
match event {
|
match event {
|
||||||
Event::WindowEvent { event, .. } => {
|
Event::WindowEvent { event, .. } => match event {
|
||||||
match event {
|
WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
|
||||||
WindowEvent::CloseRequested => *control_flow = ControlFlow::Exit,
|
WindowEvent::KeyboardInput {
|
||||||
WindowEvent::KeyboardInput {
|
input:
|
||||||
input:
|
KeyboardInput {
|
||||||
KeyboardInput {
|
virtual_keycode: Some(VirtualKeyCode::Space),
|
||||||
virtual_keycode: Some(VirtualKeyCode::Space),
|
state: ElementState::Released,
|
||||||
state: ElementState::Released,
|
..
|
||||||
..
|
},
|
||||||
},
|
..
|
||||||
..
|
} => {
|
||||||
} => {
|
resizable = !resizable;
|
||||||
resizable = !resizable;
|
println!("Resizable: {}", resizable);
|
||||||
println!("Resizable: {}", resizable);
|
window.set_resizable(resizable);
|
||||||
window.set_resizable(resizable);
|
|
||||||
},
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
|
_ => (),
|
||||||
},
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,11 +21,11 @@ fn main() {
|
||||||
match event {
|
match event {
|
||||||
Event::NewEvents(StartCause::Init) => {
|
Event::NewEvents(StartCause::Init) => {
|
||||||
*control_flow = ControlFlow::WaitUntil(Instant::now() + timer_length)
|
*control_flow = ControlFlow::WaitUntil(Instant::now() + timer_length)
|
||||||
},
|
}
|
||||||
Event::NewEvents(StartCause::ResumeTimeReached { .. }) => {
|
Event::NewEvents(StartCause::ResumeTimeReached { .. }) => {
|
||||||
*control_flow = ControlFlow::WaitUntil(Instant::now() + timer_length);
|
*control_flow = ControlFlow::WaitUntil(Instant::now() + timer_length);
|
||||||
println!("\nTimer\n");
|
println!("\nTimer\n");
|
||||||
},
|
}
|
||||||
Event::WindowEvent {
|
Event::WindowEvent {
|
||||||
event: WindowEvent::CloseRequested,
|
event: WindowEvent::CloseRequested,
|
||||||
..
|
..
|
||||||
|
|
|
@ -43,7 +43,7 @@ fn main() {
|
||||||
CloseRequested => *control_flow = ControlFlow::Exit,
|
CloseRequested => *control_flow = ControlFlow::Exit,
|
||||||
DroppedFile(path) => {
|
DroppedFile(path) => {
|
||||||
window.set_window_icon(Some(load_icon(&path)));
|
window.set_window_icon(Some(load_icon(&path)));
|
||||||
},
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,14 +14,12 @@ fn main() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
println!("Close the window to continue.");
|
println!("Close the window to continue.");
|
||||||
event_loop.run_return(|event, _, control_flow| {
|
event_loop.run_return(|event, _, control_flow| match event {
|
||||||
match event {
|
Event::WindowEvent {
|
||||||
Event::WindowEvent {
|
event: WindowEvent::CloseRequested,
|
||||||
event: WindowEvent::CloseRequested,
|
..
|
||||||
..
|
} => *control_flow = ControlFlow::Exit,
|
||||||
} => *control_flow = ControlFlow::Exit,
|
_ => *control_flow = ControlFlow::Wait,
|
||||||
_ => *control_flow = ControlFlow::Wait,
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
drop(window);
|
drop(window);
|
||||||
|
|
||||||
|
@ -31,14 +29,12 @@ fn main() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
println!("Wa ha ha! You thought that closing the window would finish this?!");
|
println!("Wa ha ha! You thought that closing the window would finish this?!");
|
||||||
event_loop.run_return(|event, _, control_flow| {
|
event_loop.run_return(|event, _, control_flow| match event {
|
||||||
match event {
|
Event::WindowEvent {
|
||||||
Event::WindowEvent {
|
event: WindowEvent::CloseRequested,
|
||||||
event: WindowEvent::CloseRequested,
|
..
|
||||||
..
|
} => *control_flow = ControlFlow::Exit,
|
||||||
} => *control_flow = ControlFlow::Exit,
|
_ => *control_flow = ControlFlow::Wait,
|
||||||
_ => *control_flow = ControlFlow::Wait,
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
println!("Okay we're done now for real.");
|
println!("Okay we're done now for real.");
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
merge_imports=true
|
|
||||||
match_block_trailing_comma=true
|
|
||||||
force_explicit_abi=true
|
force_explicit_abi=true
|
||||||
format_macro_matchers=true
|
|
||||||
use_field_init_shorthand=true
|
use_field_init_shorthand=true
|
||||||
format_code_in_doc_comments=true
|
# merge_imports=true
|
||||||
force_multiline_blocks=true
|
|
||||||
|
|
|
@ -122,11 +122,9 @@ pub trait EventLoopExtUnix {
|
||||||
impl<T> EventLoopExtUnix for EventLoop<T> {
|
impl<T> EventLoopExtUnix for EventLoop<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn new_x11() -> Result<Self, XNotSupported> {
|
fn new_x11() -> Result<Self, XNotSupported> {
|
||||||
LinuxEventLoop::new_x11().map(|ev| {
|
LinuxEventLoop::new_x11().map(|ev| EventLoop {
|
||||||
EventLoop {
|
event_loop: ev,
|
||||||
event_loop: ev,
|
_marker: ::std::marker::PhantomData,
|
||||||
_marker: ::std::marker::PhantomData,
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,7 +292,7 @@ impl WindowExtUnix for Window {
|
||||||
fn set_wayland_theme(&self, theme: WaylandTheme) {
|
fn set_wayland_theme(&self, theme: WaylandTheme) {
|
||||||
match self.window {
|
match self.window {
|
||||||
LinuxWindow::Wayland(ref w) => w.set_theme(WaylandThemeObject(theme)),
|
LinuxWindow::Wayland(ref w) => w.set_theme(WaylandThemeObject(theme)),
|
||||||
_ => {},
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,21 +79,21 @@ impl EventLoop {
|
||||||
device_id: DEVICE_ID,
|
device_id: DEVICE_ID,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
android_glue::Event::InitWindow => {
|
android_glue::Event::InitWindow => {
|
||||||
// The activity went to foreground.
|
// The activity went to foreground.
|
||||||
if let Some(cb) = self.suspend_callback.borrow().as_ref() {
|
if let Some(cb) = self.suspend_callback.borrow().as_ref() {
|
||||||
(*cb)(false);
|
(*cb)(false);
|
||||||
}
|
}
|
||||||
Some(Event::Resumed)
|
Some(Event::Resumed)
|
||||||
},
|
}
|
||||||
android_glue::Event::TermWindow => {
|
android_glue::Event::TermWindow => {
|
||||||
// The activity went to background.
|
// The activity went to background.
|
||||||
if let Some(cb) = self.suspend_callback.borrow().as_ref() {
|
if let Some(cb) = self.suspend_callback.borrow().as_ref() {
|
||||||
(*cb)(true);
|
(*cb)(true);
|
||||||
}
|
}
|
||||||
Some(Event::Suspended)
|
Some(Event::Suspended)
|
||||||
},
|
}
|
||||||
android_glue::Event::WindowResized | android_glue::Event::ConfigChanged => {
|
android_glue::Event::WindowResized | android_glue::Event::ConfigChanged => {
|
||||||
// Activity Orientation changed or resized.
|
// Activity Orientation changed or resized.
|
||||||
let native_window = unsafe { android_glue::native_window() };
|
let native_window = unsafe { android_glue::native_window() };
|
||||||
|
@ -108,14 +108,14 @@ impl EventLoop {
|
||||||
event: WindowEvent::Resized(size),
|
event: WindowEvent::Resized(size),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
android_glue::Event::WindowRedrawNeeded => {
|
android_glue::Event::WindowRedrawNeeded => {
|
||||||
// The activity needs to be redrawn.
|
// The activity needs to be redrawn.
|
||||||
Some(Event::WindowEvent {
|
Some(Event::WindowEvent {
|
||||||
window_id: RootWindowId(WindowId),
|
window_id: RootWindowId(WindowId),
|
||||||
event: WindowEvent::Redraw,
|
event: WindowEvent::Redraw,
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
android_glue::Event::Wake => Some(Event::Awakened),
|
android_glue::Event::Wake => Some(Event::Awakened),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
|
@ -251,7 +251,7 @@ extern "C" fn mouse_callback(
|
||||||
delta: ((*event).movementX as f64, (*event).movementY as f64),
|
delta: ((*event).movementX as f64, (*event).movementY as f64),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
mouse_input @ ffi::EMSCRIPTEN_EVENT_MOUSEDOWN
|
mouse_input @ ffi::EMSCRIPTEN_EVENT_MOUSEDOWN
|
||||||
| mouse_input @ ffi::EMSCRIPTEN_EVENT_MOUSEUP => {
|
| mouse_input @ ffi::EMSCRIPTEN_EVENT_MOUSEUP => {
|
||||||
let button = match (*event).button {
|
let button = match (*event).button {
|
||||||
|
@ -274,8 +274,8 @@ extern "C" fn mouse_callback(
|
||||||
modifiers,
|
modifiers,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
_ => {},
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ffi::EM_FALSE
|
ffi::EM_FALSE
|
||||||
|
@ -310,7 +310,7 @@ extern "C" fn keyboard_callback(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
ffi::EMSCRIPTEN_EVENT_KEYUP => {
|
ffi::EMSCRIPTEN_EVENT_KEYUP => {
|
||||||
queue.lock().unwrap().push_back(::Event::WindowEvent {
|
queue.lock().unwrap().push_back(::Event::WindowEvent {
|
||||||
window_id: ::WindowId(WindowId(0)),
|
window_id: ::WindowId(WindowId(0)),
|
||||||
|
@ -324,8 +324,8 @@ extern "C" fn keyboard_callback(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
_ => {},
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ffi::EM_FALSE
|
ffi::EM_FALSE
|
||||||
|
@ -757,7 +757,7 @@ fn error_to_str(code: ffi::EMSCRIPTEN_RESULT) -> &'static str {
|
||||||
match code {
|
match code {
|
||||||
ffi::EMSCRIPTEN_RESULT_SUCCESS | ffi::EMSCRIPTEN_RESULT_DEFERRED => {
|
ffi::EMSCRIPTEN_RESULT_SUCCESS | ffi::EMSCRIPTEN_RESULT_DEFERRED => {
|
||||||
"Internal error in the library (success detected as failure)"
|
"Internal error in the library (success detected as failure)"
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::EMSCRIPTEN_RESULT_NOT_SUPPORTED => "Not supported",
|
ffi::EMSCRIPTEN_RESULT_NOT_SUPPORTED => "Not supported",
|
||||||
ffi::EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED => "Failed not deferred",
|
ffi::EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED => "Failed not deferred",
|
||||||
|
@ -778,7 +778,7 @@ fn key_translate(input: [ffi::EM_UTF8; ffi::EM_HTML5_SHORT_STRING_LEN_BYTES]) ->
|
||||||
Ok(key) => key,
|
Ok(key) => key,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
return 0;
|
return 0;
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
if key.chars().count() == 1 {
|
if key.chars().count() == 1 {
|
||||||
key.as_bytes()[0]
|
key.as_bytes()[0]
|
||||||
|
@ -797,25 +797,21 @@ fn key_translate_virt(
|
||||||
Ok(key) => key,
|
Ok(key) => key,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
return None;
|
return None;
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
use VirtualKeyCode::*;
|
use VirtualKeyCode::*;
|
||||||
match key {
|
match key {
|
||||||
"Alt" => {
|
"Alt" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_LEFT => Some(LAlt),
|
||||||
ffi::DOM_KEY_LOCATION_LEFT => Some(LAlt),
|
ffi::DOM_KEY_LOCATION_RIGHT => Some(RAlt),
|
||||||
ffi::DOM_KEY_LOCATION_RIGHT => Some(RAlt),
|
_ => None,
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"AltGraph" => None,
|
"AltGraph" => None,
|
||||||
"CapsLock" => None,
|
"CapsLock" => None,
|
||||||
"Control" => {
|
"Control" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_LEFT => Some(LControl),
|
||||||
ffi::DOM_KEY_LOCATION_LEFT => Some(LControl),
|
ffi::DOM_KEY_LOCATION_RIGHT => Some(RControl),
|
||||||
ffi::DOM_KEY_LOCATION_RIGHT => Some(RControl),
|
_ => None,
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"Fn" => None,
|
"Fn" => None,
|
||||||
"FnLock" => None,
|
"FnLock" => None,
|
||||||
|
@ -823,22 +819,18 @@ fn key_translate_virt(
|
||||||
"Meta" => None,
|
"Meta" => None,
|
||||||
"NumLock" => Some(Numlock),
|
"NumLock" => Some(Numlock),
|
||||||
"ScrollLock" => Some(Scroll),
|
"ScrollLock" => Some(Scroll),
|
||||||
"Shift" => {
|
"Shift" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_LEFT => Some(LShift),
|
||||||
ffi::DOM_KEY_LOCATION_LEFT => Some(LShift),
|
ffi::DOM_KEY_LOCATION_RIGHT => Some(RShift),
|
||||||
ffi::DOM_KEY_LOCATION_RIGHT => Some(RShift),
|
_ => None,
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"Super" => None,
|
"Super" => None,
|
||||||
"Symbol" => None,
|
"Symbol" => None,
|
||||||
"SymbolLock" => None,
|
"SymbolLock" => None,
|
||||||
|
|
||||||
"Enter" => {
|
"Enter" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_NUMPAD => Some(NumpadEnter),
|
||||||
ffi::DOM_KEY_LOCATION_NUMPAD => Some(NumpadEnter),
|
_ => Some(Return),
|
||||||
_ => Some(Return),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"Tab" => Some(Tab),
|
"Tab" => Some(Tab),
|
||||||
" " => Some(Space),
|
" " => Some(Space),
|
||||||
|
@ -1163,65 +1155,45 @@ fn key_translate_virt(
|
||||||
"Divide" => Some(Divide),
|
"Divide" => Some(Divide),
|
||||||
"Subtract" | "-" => Some(Subtract),
|
"Subtract" | "-" => Some(Subtract),
|
||||||
"Separator" => None,
|
"Separator" => None,
|
||||||
"0" => {
|
"0" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad0),
|
||||||
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad0),
|
_ => Some(Key0),
|
||||||
_ => Some(Key0),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"1" => {
|
"1" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad1),
|
||||||
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad1),
|
_ => Some(Key1),
|
||||||
_ => Some(Key1),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"2" => {
|
"2" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad2),
|
||||||
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad2),
|
_ => Some(Key2),
|
||||||
_ => Some(Key2),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"3" => {
|
"3" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad3),
|
||||||
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad3),
|
_ => Some(Key3),
|
||||||
_ => Some(Key3),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"4" => {
|
"4" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad4),
|
||||||
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad4),
|
_ => Some(Key4),
|
||||||
_ => Some(Key4),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"5" => {
|
"5" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad5),
|
||||||
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad5),
|
_ => Some(Key5),
|
||||||
_ => Some(Key5),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"6" => {
|
"6" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad6),
|
||||||
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad6),
|
_ => Some(Key6),
|
||||||
_ => Some(Key6),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"7" => {
|
"7" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad7),
|
||||||
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad7),
|
_ => Some(Key7),
|
||||||
_ => Some(Key7),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"8" => {
|
"8" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad8),
|
||||||
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad8),
|
_ => Some(Key8),
|
||||||
_ => Some(Key8),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"9" => {
|
"9" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad9),
|
||||||
ffi::DOM_KEY_LOCATION_NUMPAD => Some(Numpad9),
|
_ => Some(Key9),
|
||||||
_ => Some(Key9),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"A" | "a" => Some(A),
|
"A" | "a" => Some(A),
|
||||||
|
@ -1254,17 +1226,13 @@ fn key_translate_virt(
|
||||||
"'" => Some(Apostrophe),
|
"'" => Some(Apostrophe),
|
||||||
"\\" => Some(Backslash),
|
"\\" => Some(Backslash),
|
||||||
":" => Some(Colon),
|
":" => Some(Colon),
|
||||||
"," => {
|
"," => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_NUMPAD => Some(NumpadComma),
|
||||||
ffi::DOM_KEY_LOCATION_NUMPAD => Some(NumpadComma),
|
_ => Some(Comma),
|
||||||
_ => Some(Comma),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"=" => {
|
"=" => match location {
|
||||||
match location {
|
ffi::DOM_KEY_LOCATION_NUMPAD => Some(NumpadEquals),
|
||||||
ffi::DOM_KEY_LOCATION_NUMPAD => Some(NumpadEquals),
|
_ => Some(Equals),
|
||||||
_ => Some(Equals),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"{" => Some(LBracket),
|
"{" => Some(LBracket),
|
||||||
"." => Some(Period),
|
"." => Some(Period),
|
||||||
|
|
|
@ -71,7 +71,7 @@ impl Drop for AppStateImpl {
|
||||||
let () = msg_send![window, release];
|
let () = msg_send![window, release];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,15 +128,13 @@ impl AppState {
|
||||||
queued_windows.push(window);
|
queued_windows.push(window);
|
||||||
msg_send![window, retain];
|
msg_send![window, retain];
|
||||||
return;
|
return;
|
||||||
},
|
}
|
||||||
&mut AppStateImpl::ProcessingEvents { .. } => {},
|
&mut AppStateImpl::ProcessingEvents { .. } => {}
|
||||||
&mut AppStateImpl::InUserCallback { .. } => {},
|
&mut AppStateImpl::InUserCallback { .. } => {}
|
||||||
&mut AppStateImpl::Terminated => {
|
&mut AppStateImpl::Terminated => panic!(
|
||||||
panic!(
|
"Attempt to create a `Window` \
|
||||||
"Attempt to create a `Window` \
|
after the app has terminated"
|
||||||
after the app has terminated"
|
),
|
||||||
)
|
|
||||||
},
|
|
||||||
app_state => unreachable!("unexpected state: {:#?}", app_state), /* all other cases should be impossible */
|
app_state => unreachable!("unexpected state: {:#?}", app_state), /* all other cases should be impossible */
|
||||||
}
|
}
|
||||||
drop(this);
|
drop(this);
|
||||||
|
@ -154,13 +152,11 @@ impl AppState {
|
||||||
let windows = ptr::read(queued_windows);
|
let windows = ptr::read(queued_windows);
|
||||||
let events = ptr::read(queued_events);
|
let events = ptr::read(queued_events);
|
||||||
(windows, events)
|
(windows, events)
|
||||||
},
|
}
|
||||||
_ => {
|
_ => panic!(
|
||||||
panic!(
|
"winit iOS expected the app to be in a `NotLaunched` \
|
||||||
"winit iOS expected the app to be in a `NotLaunched` \
|
state, but was not - please file an issue"
|
||||||
state, but was not - please file an issue"
|
),
|
||||||
)
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
ptr::write(
|
ptr::write(
|
||||||
&mut this.app_state,
|
&mut this.app_state,
|
||||||
|
@ -180,12 +176,10 @@ impl AppState {
|
||||||
ref mut queued_windows,
|
ref mut queued_windows,
|
||||||
..
|
..
|
||||||
} => mem::replace(queued_windows, Vec::new()),
|
} => mem::replace(queued_windows, Vec::new()),
|
||||||
_ => {
|
_ => panic!(
|
||||||
panic!(
|
"winit iOS expected the app to be in a `Launching` \
|
||||||
"winit iOS expected the app to be in a `Launching` \
|
state, but was not - please file an issue"
|
||||||
state, but was not - please file an issue"
|
),
|
||||||
)
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
// have to drop RefMut because the window setup code below can trigger new events
|
// have to drop RefMut because the window setup code below can trigger new events
|
||||||
drop(this);
|
drop(this);
|
||||||
|
@ -228,13 +222,11 @@ impl AppState {
|
||||||
let events = ptr::read(queued_events);
|
let events = ptr::read(queued_events);
|
||||||
let event_handler = ptr::read(queued_event_handler);
|
let event_handler = ptr::read(queued_event_handler);
|
||||||
(windows, events, event_handler)
|
(windows, events, event_handler)
|
||||||
},
|
}
|
||||||
_ => {
|
_ => panic!(
|
||||||
panic!(
|
"winit iOS expected the app to be in a `Launching` \
|
||||||
"winit iOS expected the app to be in a `Launching` \
|
state, but was not - please file an issue"
|
||||||
state, but was not - please file an issue"
|
),
|
||||||
)
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
ptr::write(
|
ptr::write(
|
||||||
&mut this.app_state,
|
&mut this.app_state,
|
||||||
|
@ -283,7 +275,7 @@ impl AppState {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
Event::NewEvents(StartCause::Poll)
|
Event::NewEvents(StartCause::Poll)
|
||||||
},
|
}
|
||||||
ControlFlow::Wait => {
|
ControlFlow::Wait => {
|
||||||
let (event_handler, start) = match &mut this.app_state {
|
let (event_handler, start) = match &mut this.app_state {
|
||||||
&mut AppStateImpl::NotLaunched { .. }
|
&mut AppStateImpl::NotLaunched { .. }
|
||||||
|
@ -305,7 +297,7 @@ impl AppState {
|
||||||
start,
|
start,
|
||||||
requested_resume: None,
|
requested_resume: None,
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
ControlFlow::WaitUntil(requested_resume) => {
|
ControlFlow::WaitUntil(requested_resume) => {
|
||||||
let (event_handler, start) = match &mut this.app_state {
|
let (event_handler, start) = match &mut this.app_state {
|
||||||
&mut AppStateImpl::NotLaunched { .. }
|
&mut AppStateImpl::NotLaunched { .. }
|
||||||
|
@ -334,7 +326,7 @@ impl AppState {
|
||||||
requested_resume: Some(requested_resume),
|
requested_resume: Some(requested_resume),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
ControlFlow::Exit => bug!("unexpected controlflow `Exit`"),
|
ControlFlow::Exit => bug!("unexpected controlflow `Exit`"),
|
||||||
};
|
};
|
||||||
drop(this);
|
drop(this);
|
||||||
|
@ -365,7 +357,7 @@ impl AppState {
|
||||||
} => {
|
} => {
|
||||||
queued_events.extend(events);
|
queued_events.extend(events);
|
||||||
return;
|
return;
|
||||||
},
|
}
|
||||||
&mut AppStateImpl::ProcessingEvents {
|
&mut AppStateImpl::ProcessingEvents {
|
||||||
ref mut event_handler,
|
ref mut event_handler,
|
||||||
ref mut active_control_flow,
|
ref mut active_control_flow,
|
||||||
|
@ -461,7 +453,7 @@ impl AppState {
|
||||||
let mut this = AppState::get_mut();
|
let mut this = AppState::get_mut();
|
||||||
match &mut this.app_state {
|
match &mut this.app_state {
|
||||||
&mut AppStateImpl::NotLaunched { .. } | &mut AppStateImpl::Launching { .. } => return,
|
&mut AppStateImpl::NotLaunched { .. } | &mut AppStateImpl::Launching { .. } => return,
|
||||||
&mut AppStateImpl::ProcessingEvents { .. } => {},
|
&mut AppStateImpl::ProcessingEvents { .. } => {}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
drop(this);
|
drop(this);
|
||||||
|
@ -474,25 +466,21 @@ impl AppState {
|
||||||
&mut AppStateImpl::ProcessingEvents {
|
&mut AppStateImpl::ProcessingEvents {
|
||||||
ref mut event_handler,
|
ref mut event_handler,
|
||||||
ref mut active_control_flow,
|
ref mut active_control_flow,
|
||||||
} => {
|
} => (
|
||||||
(
|
ManuallyDrop::new(ptr::read(event_handler)),
|
||||||
ManuallyDrop::new(ptr::read(event_handler)),
|
*active_control_flow,
|
||||||
*active_control_flow,
|
),
|
||||||
)
|
|
||||||
},
|
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let new = this.control_flow;
|
let new = this.control_flow;
|
||||||
match (old, new) {
|
match (old, new) {
|
||||||
(ControlFlow::Poll, ControlFlow::Poll) => {
|
(ControlFlow::Poll, ControlFlow::Poll) => ptr::write(
|
||||||
ptr::write(
|
&mut this.app_state,
|
||||||
&mut this.app_state,
|
AppStateImpl::PollFinished {
|
||||||
AppStateImpl::PollFinished {
|
waiting_event_handler: ManuallyDrop::into_inner(event_handler),
|
||||||
waiting_event_handler: ManuallyDrop::into_inner(event_handler),
|
},
|
||||||
},
|
),
|
||||||
)
|
|
||||||
},
|
|
||||||
(ControlFlow::Wait, ControlFlow::Wait) => {
|
(ControlFlow::Wait, ControlFlow::Wait) => {
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
ptr::write(
|
ptr::write(
|
||||||
|
@ -502,7 +490,7 @@ impl AppState {
|
||||||
start,
|
start,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
},
|
}
|
||||||
(ControlFlow::WaitUntil(old_instant), ControlFlow::WaitUntil(new_instant))
|
(ControlFlow::WaitUntil(old_instant), ControlFlow::WaitUntil(new_instant))
|
||||||
if old_instant == new_instant =>
|
if old_instant == new_instant =>
|
||||||
{
|
{
|
||||||
|
@ -525,7 +513,7 @@ impl AppState {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
this.waker.stop()
|
this.waker.stop()
|
||||||
},
|
}
|
||||||
(_, ControlFlow::WaitUntil(new_instant)) => {
|
(_, ControlFlow::WaitUntil(new_instant)) => {
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
ptr::write(
|
ptr::write(
|
||||||
|
@ -536,7 +524,7 @@ impl AppState {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
this.waker.start_at(new_instant)
|
this.waker.start_at(new_instant)
|
||||||
},
|
}
|
||||||
(_, ControlFlow::Poll) => {
|
(_, ControlFlow::Poll) => {
|
||||||
ptr::write(
|
ptr::write(
|
||||||
&mut this.app_state,
|
&mut this.app_state,
|
||||||
|
@ -545,13 +533,13 @@ impl AppState {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
this.waker.start()
|
this.waker.start()
|
||||||
},
|
}
|
||||||
(_, ControlFlow::Exit) => {
|
(_, ControlFlow::Exit) => {
|
||||||
// https://developer.apple.com/library/archive/qa/qa1561/_index.html
|
// https://developer.apple.com/library/archive/qa/qa1561/_index.html
|
||||||
// it is not possible to quit an iOS app gracefully and programatically
|
// it is not possible to quit an iOS app gracefully and programatically
|
||||||
warn!("`ControlFlow::Exit` ignored on iOS");
|
warn!("`ControlFlow::Exit` ignored on iOS");
|
||||||
this.control_flow = old
|
this.control_flow = old
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,14 +161,14 @@ impl UIInterfaceOrientationMask {
|
||||||
match (valid_orientations, idiom) {
|
match (valid_orientations, idiom) {
|
||||||
(ValidOrientations::LandscapeAndPortrait, Idiom::Phone) => {
|
(ValidOrientations::LandscapeAndPortrait, Idiom::Phone) => {
|
||||||
UIInterfaceOrientationMask::AllButUpsideDown
|
UIInterfaceOrientationMask::AllButUpsideDown
|
||||||
},
|
}
|
||||||
(ValidOrientations::LandscapeAndPortrait, _) => UIInterfaceOrientationMask::All,
|
(ValidOrientations::LandscapeAndPortrait, _) => UIInterfaceOrientationMask::All,
|
||||||
(ValidOrientations::Landscape, _) => UIInterfaceOrientationMask::Landscape,
|
(ValidOrientations::Landscape, _) => UIInterfaceOrientationMask::Landscape,
|
||||||
(ValidOrientations::Portrait, Idiom::Phone) => UIInterfaceOrientationMask::Portrait,
|
(ValidOrientations::Portrait, Idiom::Phone) => UIInterfaceOrientationMask::Portrait,
|
||||||
(ValidOrientations::Portrait, _) => {
|
(ValidOrientations::Portrait, _) => {
|
||||||
UIInterfaceOrientationMask::Portrait
|
UIInterfaceOrientationMask::Portrait
|
||||||
| UIInterfaceOrientationMask::PortraitUpsideDown
|
| UIInterfaceOrientationMask::PortraitUpsideDown
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ impl Inner {
|
||||||
let () = msg_send![self.window, setScreen: uiscreen];
|
let () = msg_send![self.window, setScreen: uiscreen];
|
||||||
}
|
}
|
||||||
let () = msg_send![self.window, setFrame: bounds];
|
let () = msg_send![self.window, setFrame: bounds];
|
||||||
},
|
}
|
||||||
None => warn!("`Window::set_fullscreen(None)` ignored on iOS"),
|
None => warn!("`Window::set_fullscreen(None)` ignored on iOS"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,14 +301,12 @@ impl Window {
|
||||||
let screen_bounds: CGRect = msg_send![screen, bounds];
|
let screen_bounds: CGRect = msg_send![screen, bounds];
|
||||||
|
|
||||||
let frame = match window_attributes.inner_size {
|
let frame = match window_attributes.inner_size {
|
||||||
Some(dim) => {
|
Some(dim) => CGRect {
|
||||||
CGRect {
|
origin: screen_bounds.origin,
|
||||||
origin: screen_bounds.origin,
|
size: CGSize {
|
||||||
size: CGSize {
|
width: dim.width,
|
||||||
width: dim.width,
|
height: dim.height,
|
||||||
height: dim.height,
|
},
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
None => screen_bounds,
|
None => screen_bounds,
|
||||||
};
|
};
|
||||||
|
|
|
@ -158,10 +158,10 @@ impl Window {
|
||||||
match *window_target {
|
match *window_target {
|
||||||
EventLoopWindowTarget::Wayland(ref window_target) => {
|
EventLoopWindowTarget::Wayland(ref window_target) => {
|
||||||
wayland::Window::new(window_target, attribs, pl_attribs).map(Window::Wayland)
|
wayland::Window::new(window_target, attribs, pl_attribs).map(Window::Wayland)
|
||||||
},
|
}
|
||||||
EventLoopWindowTarget::X(ref window_target) => {
|
EventLoopWindowTarget::X(ref window_target) => {
|
||||||
x11::Window::new(window_target, attribs, pl_attribs).map(Window::X)
|
x11::Window::new(window_target, attribs, pl_attribs).map(Window::X)
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,13 +313,9 @@ impl Window {
|
||||||
pub fn fullscreen(&self) -> Option<RootMonitorHandle> {
|
pub fn fullscreen(&self) -> Option<RootMonitorHandle> {
|
||||||
match self {
|
match self {
|
||||||
&Window::X(ref w) => w.fullscreen(),
|
&Window::X(ref w) => w.fullscreen(),
|
||||||
&Window::Wayland(ref w) => {
|
&Window::Wayland(ref w) => w.fullscreen().map(|monitor_id| RootMonitorHandle {
|
||||||
w.fullscreen().map(|monitor_id| {
|
inner: MonitorHandle::Wayland(monitor_id),
|
||||||
RootMonitorHandle {
|
}),
|
||||||
inner: MonitorHandle::Wayland(monitor_id),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,15 +370,11 @@ impl Window {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn current_monitor(&self) -> RootMonitorHandle {
|
pub fn current_monitor(&self) -> RootMonitorHandle {
|
||||||
match self {
|
match self {
|
||||||
&Window::X(ref window) => {
|
&Window::X(ref window) => RootMonitorHandle {
|
||||||
RootMonitorHandle {
|
inner: MonitorHandle::X(window.current_monitor()),
|
||||||
inner: MonitorHandle::X(window.current_monitor()),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
&Window::Wayland(ref window) => {
|
&Window::Wayland(ref window) => RootMonitorHandle {
|
||||||
RootMonitorHandle {
|
inner: MonitorHandle::Wayland(window.current_monitor()),
|
||||||
inner: MonitorHandle::Wayland(window.current_monitor()),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -390,20 +382,16 @@ impl Window {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn available_monitors(&self) -> VecDeque<MonitorHandle> {
|
pub fn available_monitors(&self) -> VecDeque<MonitorHandle> {
|
||||||
match self {
|
match self {
|
||||||
&Window::X(ref window) => {
|
&Window::X(ref window) => window
|
||||||
window
|
.available_monitors()
|
||||||
.available_monitors()
|
.into_iter()
|
||||||
.into_iter()
|
.map(MonitorHandle::X)
|
||||||
.map(MonitorHandle::X)
|
.collect(),
|
||||||
.collect()
|
&Window::Wayland(ref window) => window
|
||||||
},
|
.available_monitors()
|
||||||
&Window::Wayland(ref window) => {
|
.into_iter()
|
||||||
window
|
.map(MonitorHandle::Wayland)
|
||||||
.available_monitors()
|
.collect(),
|
||||||
.into_iter()
|
|
||||||
.map(MonitorHandle::Wayland)
|
|
||||||
.collect()
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,16 +452,14 @@ impl<T: 'static> EventLoop<T> {
|
||||||
"x11" => {
|
"x11" => {
|
||||||
// TODO: propagate
|
// TODO: propagate
|
||||||
return EventLoop::new_x11().expect("Failed to initialize X11 backend");
|
return EventLoop::new_x11().expect("Failed to initialize X11 backend");
|
||||||
},
|
}
|
||||||
"wayland" => {
|
"wayland" => {
|
||||||
return EventLoop::new_wayland().expect("Failed to initialize Wayland backend");
|
return EventLoop::new_wayland().expect("Failed to initialize Wayland backend");
|
||||||
},
|
}
|
||||||
_ => {
|
_ => panic!(
|
||||||
panic!(
|
"Unknown environment variable value for {}, try one of `x11`,`wayland`",
|
||||||
"Unknown environment variable value for {}, try one of `x11`,`wayland`",
|
BACKEND_PREFERENCE_ENV_VAR,
|
||||||
BACKEND_PREFERENCE_ENV_VAR,
|
),
|
||||||
)
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,19 +497,17 @@ impl<T: 'static> EventLoop<T> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn available_monitors(&self) -> VecDeque<MonitorHandle> {
|
pub fn available_monitors(&self) -> VecDeque<MonitorHandle> {
|
||||||
match *self {
|
match *self {
|
||||||
EventLoop::Wayland(ref evlp) => {
|
EventLoop::Wayland(ref evlp) => evlp
|
||||||
evlp.available_monitors()
|
.available_monitors()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(MonitorHandle::Wayland)
|
.map(MonitorHandle::Wayland)
|
||||||
.collect()
|
.collect(),
|
||||||
},
|
EventLoop::X(ref evlp) => evlp
|
||||||
EventLoop::X(ref evlp) => {
|
.x_connection()
|
||||||
evlp.x_connection()
|
.available_monitors()
|
||||||
.available_monitors()
|
.into_iter()
|
||||||
.into_iter()
|
.map(MonitorHandle::X)
|
||||||
.map(MonitorHandle::X)
|
.collect(),
|
||||||
.collect()
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,22 +137,20 @@ impl<T: 'static> EventLoop<T> {
|
||||||
let env = Environment::from_display_with_cb(
|
let env = Environment::from_display_with_cb(
|
||||||
&display,
|
&display,
|
||||||
&mut event_queue,
|
&mut event_queue,
|
||||||
move |event, registry| {
|
move |event, registry| match event {
|
||||||
match event {
|
GlobalEvent::New {
|
||||||
GlobalEvent::New {
|
id,
|
||||||
id,
|
ref interface,
|
||||||
ref interface,
|
version,
|
||||||
version,
|
} => {
|
||||||
} => {
|
if interface == "wl_seat" {
|
||||||
if interface == "wl_seat" {
|
seat_manager.add_seat(id, version, registry)
|
||||||
seat_manager.add_seat(id, version, registry)
|
}
|
||||||
}
|
}
|
||||||
},
|
GlobalEvent::Removed { id, ref interface } => {
|
||||||
GlobalEvent::Removed { id, ref interface } => {
|
if interface == "wl_seat" {
|
||||||
if interface == "wl_seat" {
|
seat_manager.remove_seat(id)
|
||||||
seat_manager.remove_seat(id)
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -299,7 +297,7 @@ impl<T: 'static> EventLoop<T> {
|
||||||
&self.window_target,
|
&self.window_target,
|
||||||
&mut control_flow,
|
&mut control_flow,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
ControlFlow::Wait => {
|
ControlFlow::Wait => {
|
||||||
self.inner_loop.dispatch(None, &mut ()).unwrap();
|
self.inner_loop.dispatch(None, &mut ()).unwrap();
|
||||||
callback(
|
callback(
|
||||||
|
@ -310,7 +308,7 @@ impl<T: 'static> EventLoop<T> {
|
||||||
&self.window_target,
|
&self.window_target,
|
||||||
&mut control_flow,
|
&mut control_flow,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
ControlFlow::WaitUntil(deadline) => {
|
ControlFlow::WaitUntil(deadline) => {
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
// compute the blocking duration
|
// compute the blocking duration
|
||||||
|
@ -344,7 +342,7 @@ impl<T: 'static> EventLoop<T> {
|
||||||
&mut control_flow,
|
&mut control_flow,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,7 +534,7 @@ impl SeatData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -648,12 +646,10 @@ impl MonitorHandle {
|
||||||
.with_info(&self.proxy, |_, info| info.modes.clone())
|
.with_info(&self.proxy, |_, info| info.modes.clone())
|
||||||
.unwrap_or(vec![])
|
.unwrap_or(vec![])
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|x| {
|
.map(|x| VideoMode {
|
||||||
VideoMode {
|
size: (x.dimensions.0 as u32, x.dimensions.1 as u32),
|
||||||
size: (x.dimensions.0 as u32, x.dimensions.1 as u32),
|
refresh_rate: (x.refresh_rate as f32 / 1000.0).round() as u16,
|
||||||
refresh_rate: (x.refresh_rate as f32 / 1000.0).round() as u16,
|
bit_depth: 32,
|
||||||
bit_depth: 32,
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -674,11 +670,9 @@ pub fn primary_monitor(outputs: &OutputMgr) -> MonitorHandle {
|
||||||
pub fn available_monitors(outputs: &OutputMgr) -> VecDeque<MonitorHandle> {
|
pub fn available_monitors(outputs: &OutputMgr) -> VecDeque<MonitorHandle> {
|
||||||
outputs.with_all(|list| {
|
outputs.with_all(|list| {
|
||||||
list.iter()
|
list.iter()
|
||||||
.map(|&(_, ref proxy, _)| {
|
.map(|&(_, ref proxy, _)| MonitorHandle {
|
||||||
MonitorHandle {
|
proxy: proxy.clone(),
|
||||||
proxy: proxy.clone(),
|
mgr: outputs.clone(),
|
||||||
mgr: outputs.clone(),
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
})
|
})
|
||||||
|
|
|
@ -31,12 +31,12 @@ pub fn init_keyboard(
|
||||||
let wid = make_wid(&surface);
|
let wid = make_wid(&surface);
|
||||||
my_sink.send((WindowEvent::Focused(true), wid)).unwrap();
|
my_sink.send((WindowEvent::Focused(true), wid)).unwrap();
|
||||||
*target.lock().unwrap() = Some(wid);
|
*target.lock().unwrap() = Some(wid);
|
||||||
},
|
}
|
||||||
KbEvent::Leave { surface, .. } => {
|
KbEvent::Leave { surface, .. } => {
|
||||||
let wid = make_wid(&surface);
|
let wid = make_wid(&surface);
|
||||||
my_sink.send((WindowEvent::Focused(false), wid)).unwrap();
|
my_sink.send((WindowEvent::Focused(false), wid)).unwrap();
|
||||||
*target.lock().unwrap() = None;
|
*target.lock().unwrap() = None;
|
||||||
},
|
}
|
||||||
KbEvent::Key {
|
KbEvent::Key {
|
||||||
rawkey,
|
rawkey,
|
||||||
keysym,
|
keysym,
|
||||||
|
@ -79,8 +79,8 @@ pub fn init_keyboard(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
KbEvent::RepeatInfo { .. } => { /* Handled by smithay client toolkit */ },
|
KbEvent::RepeatInfo { .. } => { /* Handled by smithay client toolkit */ }
|
||||||
KbEvent::Modifiers {
|
KbEvent::Modifiers {
|
||||||
modifiers: event_modifiers,
|
modifiers: event_modifiers,
|
||||||
} => *modifiers_tracker.lock().unwrap() = event_modifiers.into(),
|
} => *modifiers_tracker.lock().unwrap() = event_modifiers.into(),
|
||||||
|
@ -133,53 +133,49 @@ pub fn init_keyboard(
|
||||||
// }
|
// }
|
||||||
seat.get_keyboard(|keyboard| {
|
seat.get_keyboard(|keyboard| {
|
||||||
keyboard.implement_closure(
|
keyboard.implement_closure(
|
||||||
move |evt, _| {
|
move |evt, _| match evt {
|
||||||
match evt {
|
wl_keyboard::Event::Enter { surface, .. } => {
|
||||||
wl_keyboard::Event::Enter { surface, .. } => {
|
let wid = make_wid(&surface);
|
||||||
let wid = make_wid(&surface);
|
my_sink.send((WindowEvent::Focused(true), wid)).unwrap();
|
||||||
my_sink.send((WindowEvent::Focused(true), wid)).unwrap();
|
target = Some(wid);
|
||||||
target = Some(wid);
|
|
||||||
},
|
|
||||||
wl_keyboard::Event::Leave { surface, .. } => {
|
|
||||||
let wid = make_wid(&surface);
|
|
||||||
my_sink.send((WindowEvent::Focused(false), wid)).unwrap();
|
|
||||||
target = None;
|
|
||||||
},
|
|
||||||
wl_keyboard::Event::Key { key, state, .. } => {
|
|
||||||
if let Some(wid) = target {
|
|
||||||
let state = match state {
|
|
||||||
wl_keyboard::KeyState::Pressed => ElementState::Pressed,
|
|
||||||
wl_keyboard::KeyState::Released => ElementState::Released,
|
|
||||||
_ => unreachable!(),
|
|
||||||
};
|
|
||||||
my_sink
|
|
||||||
.send((
|
|
||||||
WindowEvent::KeyboardInput {
|
|
||||||
device_id: crate::event::DeviceId(
|
|
||||||
crate::platform_impl::DeviceId::Wayland(
|
|
||||||
DeviceId,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
input: KeyboardInput {
|
|
||||||
state,
|
|
||||||
scancode: key,
|
|
||||||
virtual_keycode: None,
|
|
||||||
modifiers: ModifiersState::default(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
wid,
|
|
||||||
))
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
|
wl_keyboard::Event::Leave { surface, .. } => {
|
||||||
|
let wid = make_wid(&surface);
|
||||||
|
my_sink.send((WindowEvent::Focused(false), wid)).unwrap();
|
||||||
|
target = None;
|
||||||
|
}
|
||||||
|
wl_keyboard::Event::Key { key, state, .. } => {
|
||||||
|
if let Some(wid) = target {
|
||||||
|
let state = match state {
|
||||||
|
wl_keyboard::KeyState::Pressed => ElementState::Pressed,
|
||||||
|
wl_keyboard::KeyState::Released => ElementState::Released,
|
||||||
|
_ => unreachable!(),
|
||||||
|
};
|
||||||
|
my_sink
|
||||||
|
.send((
|
||||||
|
WindowEvent::KeyboardInput {
|
||||||
|
device_id: crate::event::DeviceId(
|
||||||
|
crate::platform_impl::DeviceId::Wayland(DeviceId),
|
||||||
|
),
|
||||||
|
input: KeyboardInput {
|
||||||
|
state,
|
||||||
|
scancode: key,
|
||||||
|
virtual_keycode: None,
|
||||||
|
modifiers: ModifiersState::default(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
wid,
|
||||||
|
))
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
},
|
},
|
||||||
(),
|
(),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.unwrap()
|
.unwrap()
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ pub fn implement_pointer(
|
||||||
wid,
|
wid,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
PtrEvent::Leave { surface, .. } => {
|
PtrEvent::Leave { surface, .. } => {
|
||||||
mouse_focus = None;
|
mouse_focus = None;
|
||||||
let wid = store.find_wid(&surface);
|
let wid = store.find_wid(&surface);
|
||||||
|
@ -70,7 +70,7 @@ pub fn implement_pointer(
|
||||||
wid,
|
wid,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
PtrEvent::Motion {
|
PtrEvent::Motion {
|
||||||
surface_x,
|
surface_x,
|
||||||
surface_y,
|
surface_y,
|
||||||
|
@ -88,7 +88,7 @@ pub fn implement_pointer(
|
||||||
wid,
|
wid,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
PtrEvent::Button { button, state, .. } => {
|
PtrEvent::Button { button, state, .. } => {
|
||||||
if let Some(wid) = mouse_focus {
|
if let Some(wid) = mouse_focus {
|
||||||
let state = match state {
|
let state = match state {
|
||||||
|
@ -115,7 +115,7 @@ pub fn implement_pointer(
|
||||||
wid,
|
wid,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
PtrEvent::Axis { axis, value, .. } => {
|
PtrEvent::Axis { axis, value, .. } => {
|
||||||
if let Some(wid) = mouse_focus {
|
if let Some(wid) = mouse_focus {
|
||||||
if pointer.as_ref().version() < 5 {
|
if pointer.as_ref().version() < 5 {
|
||||||
|
@ -155,7 +155,7 @@ pub fn implement_pointer(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
PtrEvent::Frame => {
|
PtrEvent::Frame => {
|
||||||
let axis_buffer = axis_buffer.take();
|
let axis_buffer = axis_buffer.take();
|
||||||
let axis_discrete_buffer = axis_discrete_buffer.take();
|
let axis_discrete_buffer = axis_discrete_buffer.take();
|
||||||
|
@ -188,11 +188,11 @@ pub fn implement_pointer(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
PtrEvent::AxisSource { .. } => (),
|
PtrEvent::AxisSource { .. } => (),
|
||||||
PtrEvent::AxisStop { .. } => {
|
PtrEvent::AxisStop { .. } => {
|
||||||
axis_state = TouchPhase::Ended;
|
axis_state = TouchPhase::Ended;
|
||||||
},
|
}
|
||||||
PtrEvent::AxisDiscrete { axis, discrete } => {
|
PtrEvent::AxisDiscrete { axis, discrete } => {
|
||||||
let (mut x, mut y) = axis_discrete_buffer.unwrap_or((0, 0));
|
let (mut x, mut y) = axis_discrete_buffer.unwrap_or((0, 0));
|
||||||
match axis {
|
match axis {
|
||||||
|
@ -206,7 +206,7 @@ pub fn implement_pointer(
|
||||||
TouchPhase::Started | TouchPhase::Moved => TouchPhase::Moved,
|
TouchPhase::Started | TouchPhase::Moved => TouchPhase::Moved,
|
||||||
_ => TouchPhase::Started,
|
_ => TouchPhase::Started,
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -49,7 +49,7 @@ pub(crate) fn implement_touch(
|
||||||
id,
|
id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
TouchEvent::Up { id, .. } => {
|
TouchEvent::Up { id, .. } => {
|
||||||
let idx = pending_ids.iter().position(|p| p.id == id);
|
let idx = pending_ids.iter().position(|p| p.id == id);
|
||||||
if let Some(idx) = idx {
|
if let Some(idx) = idx {
|
||||||
|
@ -66,7 +66,7 @@ pub(crate) fn implement_touch(
|
||||||
pt.wid,
|
pt.wid,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
TouchEvent::Motion { id, x, y, .. } => {
|
TouchEvent::Motion { id, x, y, .. } => {
|
||||||
let pt = pending_ids.iter_mut().find(|p| p.id == id);
|
let pt = pending_ids.iter_mut().find(|p| p.id == id);
|
||||||
if let Some(pt) = pt {
|
if let Some(pt) = pt {
|
||||||
|
@ -83,7 +83,7 @@ pub(crate) fn implement_touch(
|
||||||
pt.wid,
|
pt.wid,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
TouchEvent::Frame => (),
|
TouchEvent::Frame => (),
|
||||||
TouchEvent::Cancel => {
|
TouchEvent::Cancel => {
|
||||||
for pt in pending_ids.drain(..) {
|
for pt in pending_ids.drain(..) {
|
||||||
|
@ -99,7 +99,7 @@ pub(crate) fn implement_touch(
|
||||||
pt.wid,
|
pt.wid,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -107,7 +107,7 @@ impl Window {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
WEvent::Refresh => {
|
WEvent::Refresh => {
|
||||||
let store = window_store.lock().unwrap();
|
let store = window_store.lock().unwrap();
|
||||||
for window in &store.windows {
|
for window in &store.windows {
|
||||||
|
@ -116,7 +116,7 @@ impl Window {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
WEvent::Close => {
|
WEvent::Close => {
|
||||||
let mut store = window_store.lock().unwrap();
|
let mut store = window_store.lock().unwrap();
|
||||||
for window in &mut store.windows {
|
for window in &mut store.windows {
|
||||||
|
@ -125,7 +125,7 @@ impl Window {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -118,7 +118,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
wt.xconn
|
wt.xconn
|
||||||
.check_errors()
|
.check_errors()
|
||||||
.expect("Failed to call XRefreshKeyboardMapping");
|
.expect("Failed to call XRefreshKeyboardMapping");
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::ClientMessage => {
|
ffi::ClientMessage => {
|
||||||
let client_msg: &ffi::XClientMessageEvent = xev.as_ref();
|
let client_msg: &ffi::XClientMessageEvent = xev.as_ref();
|
||||||
|
@ -236,7 +236,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
event: WindowEvent::HoveredFileCancelled,
|
event: WindowEvent::HoveredFileCancelled,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::SelectionNotify => {
|
ffi::SelectionNotify => {
|
||||||
let xsel: &ffi::XSelectionEvent = xev.as_ref();
|
let xsel: &ffi::XSelectionEvent = xev.as_ref();
|
||||||
|
@ -263,7 +263,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
|
|
||||||
self.dnd.result = result;
|
self.dnd.result = result;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::ConfigureNotify => {
|
ffi::ConfigureNotify => {
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
|
@ -429,7 +429,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
callback(Event::WindowEvent { window_id, event });
|
callback(Event::WindowEvent { window_id, event });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::ReparentNotify => {
|
ffi::ReparentNotify => {
|
||||||
let xev: &ffi::XReparentEvent = xev.as_ref();
|
let xev: &ffi::XReparentEvent = xev.as_ref();
|
||||||
|
@ -444,7 +444,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
self.with_window(xev.window, |window| {
|
self.with_window(xev.window, |window| {
|
||||||
window.invalidate_cached_frame_extents();
|
window.invalidate_cached_frame_extents();
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::DestroyNotify => {
|
ffi::DestroyNotify => {
|
||||||
let xev: &ffi::XDestroyWindowEvent = xev.as_ref();
|
let xev: &ffi::XDestroyWindowEvent = xev.as_ref();
|
||||||
|
@ -467,7 +467,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
window_id,
|
window_id,
|
||||||
event: WindowEvent::Destroyed,
|
event: WindowEvent::Destroyed,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::Expose => {
|
ffi::Expose => {
|
||||||
let xev: &ffi::XExposeEvent = xev.as_ref();
|
let xev: &ffi::XExposeEvent = xev.as_ref();
|
||||||
|
@ -479,7 +479,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
window_id,
|
window_id,
|
||||||
event: WindowEvent::RedrawRequested,
|
event: WindowEvent::RedrawRequested,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::KeyPress | ffi::KeyRelease => {
|
ffi::KeyPress | ffi::KeyRelease => {
|
||||||
use crate::event::ElementState::{Pressed, Released};
|
use crate::event::ElementState::{Pressed, Released};
|
||||||
|
@ -554,7 +554,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
callback(event);
|
callback(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::GenericEvent => {
|
ffi::GenericEvent => {
|
||||||
let guard = if let Some(e) = GenericEventCookie::from_event(&wt.xconn, *xev) {
|
let guard = if let Some(e) = GenericEventCookie::from_event(&wt.xconn, *xev) {
|
||||||
|
@ -596,39 +596,33 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
Released
|
Released
|
||||||
};
|
};
|
||||||
match xev.detail as u32 {
|
match xev.detail as u32 {
|
||||||
ffi::Button1 => {
|
ffi::Button1 => callback(Event::WindowEvent {
|
||||||
callback(Event::WindowEvent {
|
window_id,
|
||||||
window_id,
|
event: MouseInput {
|
||||||
event: MouseInput {
|
device_id,
|
||||||
device_id,
|
state,
|
||||||
state,
|
button: Left,
|
||||||
button: Left,
|
modifiers,
|
||||||
modifiers,
|
},
|
||||||
},
|
}),
|
||||||
})
|
ffi::Button2 => callback(Event::WindowEvent {
|
||||||
},
|
window_id,
|
||||||
ffi::Button2 => {
|
event: MouseInput {
|
||||||
callback(Event::WindowEvent {
|
device_id,
|
||||||
window_id,
|
state,
|
||||||
event: MouseInput {
|
button: Middle,
|
||||||
device_id,
|
modifiers,
|
||||||
state,
|
},
|
||||||
button: Middle,
|
}),
|
||||||
modifiers,
|
ffi::Button3 => callback(Event::WindowEvent {
|
||||||
},
|
window_id,
|
||||||
})
|
event: MouseInput {
|
||||||
},
|
device_id,
|
||||||
ffi::Button3 => {
|
state,
|
||||||
callback(Event::WindowEvent {
|
button: Right,
|
||||||
window_id,
|
modifiers,
|
||||||
event: MouseInput {
|
},
|
||||||
device_id,
|
}),
|
||||||
state,
|
|
||||||
button: Right,
|
|
||||||
modifiers,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// Suppress emulated scroll wheel clicks, since we handle the real motion events for those.
|
// Suppress emulated scroll wheel clicks, since we handle the real motion events for those.
|
||||||
// In practice, even clicky scroll wheels appear to be reported by evdev (and XInput2 in
|
// In practice, even clicky scroll wheels appear to be reported by evdev (and XInput2 in
|
||||||
|
@ -651,21 +645,19 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
x => {
|
x => callback(Event::WindowEvent {
|
||||||
callback(Event::WindowEvent {
|
window_id,
|
||||||
window_id,
|
event: MouseInput {
|
||||||
event: MouseInput {
|
device_id,
|
||||||
device_id,
|
state,
|
||||||
state,
|
button: Other(x as u8),
|
||||||
button: Other(x as u8),
|
modifiers,
|
||||||
modifiers,
|
},
|
||||||
},
|
}),
|
||||||
})
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
ffi::XI_Motion => {
|
ffi::XI_Motion => {
|
||||||
let xev: &ffi::XIDeviceEvent = unsafe { &*(xev.data as *const _) };
|
let xev: &ffi::XIDeviceEvent = unsafe { &*(xev.data as *const _) };
|
||||||
let device_id = mkdid(xev.deviceid);
|
let device_id = mkdid(xev.deviceid);
|
||||||
|
@ -734,11 +726,11 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
delta: match info.orientation {
|
delta: match info.orientation {
|
||||||
ScrollOrientation::Horizontal => {
|
ScrollOrientation::Horizontal => {
|
||||||
LineDelta(delta as f32, 0.0)
|
LineDelta(delta as f32, 0.0)
|
||||||
},
|
}
|
||||||
// X11 vertical scroll coordinates are opposite to winit's
|
// X11 vertical scroll coordinates are opposite to winit's
|
||||||
ScrollOrientation::Vertical => {
|
ScrollOrientation::Vertical => {
|
||||||
LineDelta(0.0, -delta as f32)
|
LineDelta(0.0, -delta as f32)
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
phase: TouchPhase::Moved,
|
phase: TouchPhase::Moved,
|
||||||
modifiers,
|
modifiers,
|
||||||
|
@ -761,7 +753,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
for event in events {
|
for event in events {
|
||||||
callback(event);
|
callback(event);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::XI_Enter => {
|
ffi::XI_Enter => {
|
||||||
let xev: &ffi::XIEnterEvent = unsafe { &*(xev.data as *const _) };
|
let xev: &ffi::XIEnterEvent = unsafe { &*(xev.data as *const _) };
|
||||||
|
@ -821,7 +813,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
ffi::XI_Leave => {
|
ffi::XI_Leave => {
|
||||||
let xev: &ffi::XILeaveEvent = unsafe { &*(xev.data as *const _) };
|
let xev: &ffi::XILeaveEvent = unsafe { &*(xev.data as *const _) };
|
||||||
|
|
||||||
|
@ -836,7 +828,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
ffi::XI_FocusIn => {
|
ffi::XI_FocusIn => {
|
||||||
let xev: &ffi::XIFocusInEvent = unsafe { &*(xev.data as *const _) };
|
let xev: &ffi::XIFocusInEvent = unsafe { &*(xev.data as *const _) };
|
||||||
|
|
||||||
|
@ -878,7 +870,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
modifiers: ModifiersState::from(xev.mods),
|
modifiers: ModifiersState::from(xev.mods),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
ffi::XI_FocusOut => {
|
ffi::XI_FocusOut => {
|
||||||
let xev: &ffi::XIFocusOutEvent = unsafe { &*(xev.data as *const _) };
|
let xev: &ffi::XIFocusOutEvent = unsafe { &*(xev.data as *const _) };
|
||||||
if !self.window_exists(xev.event) {
|
if !self.window_exists(xev.event) {
|
||||||
|
@ -892,7 +884,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
window_id: mkwid(xev.event),
|
window_id: mkwid(xev.event),
|
||||||
event: Focused(false),
|
event: Focused(false),
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::XI_TouchBegin | ffi::XI_TouchUpdate | ffi::XI_TouchEnd => {
|
ffi::XI_TouchBegin | ffi::XI_TouchUpdate | ffi::XI_TouchEnd => {
|
||||||
let xev: &ffi::XIDeviceEvent = unsafe { &*(xev.data as *const _) };
|
let xev: &ffi::XIDeviceEvent = unsafe { &*(xev.data as *const _) };
|
||||||
|
@ -920,7 +912,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::XI_RawButtonPress | ffi::XI_RawButtonRelease => {
|
ffi::XI_RawButtonPress | ffi::XI_RawButtonRelease => {
|
||||||
let xev: &ffi::XIRawEvent = unsafe { &*(xev.data as *const _) };
|
let xev: &ffi::XIRawEvent = unsafe { &*(xev.data as *const _) };
|
||||||
|
@ -937,7 +929,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::XI_RawMotion => {
|
ffi::XI_RawMotion => {
|
||||||
let xev: &ffi::XIRawEvent = unsafe { &*(xev.data as *const _) };
|
let xev: &ffi::XIRawEvent = unsafe { &*(xev.data as *const _) };
|
||||||
|
@ -962,7 +954,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
1 => mouse_delta.1 = x,
|
1 => mouse_delta.1 = x,
|
||||||
2 => scroll_delta.0 = x as f32,
|
2 => scroll_delta.0 = x as f32,
|
||||||
3 => scroll_delta.1 = x as f32,
|
3 => scroll_delta.1 = x as f32,
|
||||||
_ => {},
|
_ => {}
|
||||||
}
|
}
|
||||||
callback(Event::DeviceEvent {
|
callback(Event::DeviceEvent {
|
||||||
device_id: did,
|
device_id: did,
|
||||||
|
@ -988,7 +980,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::XI_RawKeyPress | ffi::XI_RawKeyRelease => {
|
ffi::XI_RawKeyPress | ffi::XI_RawKeyRelease => {
|
||||||
let xev: &ffi::XIRawEvent = unsafe { &*(xev.data as *const _) };
|
let xev: &ffi::XIRawEvent = unsafe { &*(xev.data as *const _) };
|
||||||
|
@ -1033,7 +1025,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
modifiers: ModifiersState::default(),
|
modifiers: ModifiersState::default(),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
ffi::XI_HierarchyChanged => {
|
ffi::XI_HierarchyChanged => {
|
||||||
let xev: &ffi::XIHierarchyEvent = unsafe { &*(xev.data as *const _) };
|
let xev: &ffi::XIHierarchyEvent = unsafe { &*(xev.data as *const _) };
|
||||||
|
@ -1056,11 +1048,11 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
devices.remove(&DeviceId(info.deviceid));
|
devices.remove(&DeviceId(info.deviceid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
_ => {},
|
_ => {}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if event_type == self.randr_event_offset {
|
if event_type == self.randr_event_offset {
|
||||||
// In the future, it would be quite easy to emit monitor hotplug events.
|
// In the future, it would be quite easy to emit monitor hotplug events.
|
||||||
|
@ -1101,13 +1093,13 @@ impl<T: 'static> EventProcessor<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.ime_receiver.try_recv() {
|
match self.ime_receiver.try_recv() {
|
||||||
Ok((window_id, x, y)) => {
|
Ok((window_id, x, y)) => {
|
||||||
wt.ime.borrow_mut().send_xim_spot(window_id, x, y);
|
wt.ime.borrow_mut().send_xim_spot(window_id, x, y);
|
||||||
},
|
}
|
||||||
Err(_) => (),
|
Err(_) => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,7 +308,7 @@ impl<T: 'static> EventLoop<T> {
|
||||||
&self.target,
|
&self.target,
|
||||||
&mut control_flow,
|
&mut control_flow,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
ControlFlow::Wait => {
|
ControlFlow::Wait => {
|
||||||
self.inner_loop.dispatch(None, &mut ()).unwrap();
|
self.inner_loop.dispatch(None, &mut ()).unwrap();
|
||||||
callback(
|
callback(
|
||||||
|
@ -319,7 +319,7 @@ impl<T: 'static> EventLoop<T> {
|
||||||
&self.target,
|
&self.target,
|
||||||
&mut control_flow,
|
&mut control_flow,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
ControlFlow::WaitUntil(deadline) => {
|
ControlFlow::WaitUntil(deadline) => {
|
||||||
let start = ::std::time::Instant::now();
|
let start = ::std::time::Instant::now();
|
||||||
// compute the blocking duration
|
// compute the blocking duration
|
||||||
|
@ -353,7 +353,7 @@ impl<T: 'static> EventLoop<T> {
|
||||||
&mut control_flow,
|
&mut control_flow,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,8 +588,8 @@ impl Device {
|
||||||
position: 0.0,
|
position: 0.0,
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
},
|
}
|
||||||
_ => {},
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -619,8 +619,8 @@ impl Device {
|
||||||
{
|
{
|
||||||
axis.position = info.value;
|
axis.position = info.value;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => {},
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,7 +384,7 @@ impl UnownedWindow {
|
||||||
ImeContextCreationError::XError(err) => OsError::XError(err),
|
ImeContextCreationError::XError(err) => OsError::XError(err),
|
||||||
ImeContextCreationError::Null => {
|
ImeContextCreationError::Null => {
|
||||||
OsError::XMisc("IME Context creation failed")
|
OsError::XMisc("IME Context creation failed")
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
return Err(os_error!(e));
|
return Err(os_error!(e));
|
||||||
}
|
}
|
||||||
|
@ -558,7 +558,7 @@ impl UnownedWindow {
|
||||||
self.set_position_inner(position.0, position.1).queue();
|
self.set_position_inner(position.0, position.1).queue();
|
||||||
}
|
}
|
||||||
flusher
|
flusher
|
||||||
},
|
}
|
||||||
Some(RootMonitorHandle {
|
Some(RootMonitorHandle {
|
||||||
inner: PlatformMonitorHandle::X(monitor),
|
inner: PlatformMonitorHandle::X(monitor),
|
||||||
}) => {
|
}) => {
|
||||||
|
@ -568,7 +568,7 @@ impl UnownedWindow {
|
||||||
self.set_position_inner(monitor_origin.0, monitor_origin.1)
|
self.set_position_inner(monitor_origin.0, monitor_origin.1)
|
||||||
.queue();
|
.queue();
|
||||||
self.set_fullscreen_hint(true)
|
self.set_fullscreen_hint(true)
|
||||||
},
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1190,11 +1190,11 @@ impl UnownedWindow {
|
||||||
ffi::GrabSuccess => Ok(()),
|
ffi::GrabSuccess => Ok(()),
|
||||||
ffi::AlreadyGrabbed => {
|
ffi::AlreadyGrabbed => {
|
||||||
Err("Cursor could not be grabbed: already grabbed by another client")
|
Err("Cursor could not be grabbed: already grabbed by another client")
|
||||||
},
|
}
|
||||||
ffi::GrabInvalidTime => Err("Cursor could not be grabbed: invalid time"),
|
ffi::GrabInvalidTime => Err("Cursor could not be grabbed: invalid time"),
|
||||||
ffi::GrabNotViewable => {
|
ffi::GrabNotViewable => {
|
||||||
Err("Cursor could not be grabbed: grab location not viewable")
|
Err("Cursor could not be grabbed: grab location not viewable")
|
||||||
},
|
}
|
||||||
ffi::GrabFrozen => Err("Cursor could not be grabbed: frozen by another client"),
|
ffi::GrabFrozen => Err("Cursor could not be grabbed: frozen by another client"),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ unsafe fn maybe_dispatch_device_event(event: id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
AppState::queue_events(events);
|
AppState::queue_events(events);
|
||||||
},
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,11 +213,9 @@ impl AppState {
|
||||||
let start = HANDLER.get_start_time().unwrap();
|
let start = HANDLER.get_start_time().unwrap();
|
||||||
let cause = match HANDLER.get_control_flow_and_update_prev() {
|
let cause = match HANDLER.get_control_flow_and_update_prev() {
|
||||||
ControlFlow::Poll => StartCause::Poll,
|
ControlFlow::Poll => StartCause::Poll,
|
||||||
ControlFlow::Wait => {
|
ControlFlow::Wait => StartCause::WaitCancelled {
|
||||||
StartCause::WaitCancelled {
|
start,
|
||||||
start,
|
requested_resume: None,
|
||||||
requested_resume: None,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
ControlFlow::WaitUntil(requested_resume) => {
|
ControlFlow::WaitUntil(requested_resume) => {
|
||||||
if Instant::now() >= requested_resume {
|
if Instant::now() >= requested_resume {
|
||||||
|
@ -231,7 +229,7 @@ impl AppState {
|
||||||
requested_resume: Some(requested_resume),
|
requested_resume: Some(requested_resume),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
ControlFlow::Exit => StartCause::Poll, //panic!("unexpected `ControlFlow::Exit`"),
|
ControlFlow::Exit => StartCause::Poll, //panic!("unexpected `ControlFlow::Exit`"),
|
||||||
};
|
};
|
||||||
HANDLER.set_in_callback(true);
|
HANDLER.set_in_callback(true);
|
||||||
|
|
|
@ -121,7 +121,7 @@ extern "C" fn control_flow_begin_handler(
|
||||||
//trace!("Triggered `CFRunLoopAfterWaiting`");
|
//trace!("Triggered `CFRunLoopAfterWaiting`");
|
||||||
AppState::wakeup();
|
AppState::wakeup();
|
||||||
//trace!("Completed `CFRunLoopAfterWaiting`");
|
//trace!("Completed `CFRunLoopAfterWaiting`");
|
||||||
},
|
}
|
||||||
kCFRunLoopEntry => unimplemented!(), // not expected to ever happen
|
kCFRunLoopEntry => unimplemented!(), // not expected to ever happen
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ extern "C" fn control_flow_end_handler(
|
||||||
//trace!("Triggered `CFRunLoopBeforeWaiting`");
|
//trace!("Triggered `CFRunLoopBeforeWaiting`");
|
||||||
AppState::cleared();
|
AppState::cleared();
|
||||||
//trace!("Completed `CFRunLoopBeforeWaiting`");
|
//trace!("Completed `CFRunLoopBeforeWaiting`");
|
||||||
},
|
}
|
||||||
kCFRunLoopExit => (), //unimplemented!(), // not expected to ever happen
|
kCFRunLoopExit => (), //unimplemented!(), // not expected to ever happen
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl From<CursorIcon> for Cursor {
|
||||||
CursorIcon::Alias => Cursor::Native("dragLinkCursor"),
|
CursorIcon::Alias => Cursor::Native("dragLinkCursor"),
|
||||||
CursorIcon::NotAllowed | CursorIcon::NoDrop => {
|
CursorIcon::NotAllowed | CursorIcon::NoDrop => {
|
||||||
Cursor::Native("operationNotAllowedCursor")
|
Cursor::Native("operationNotAllowedCursor")
|
||||||
},
|
}
|
||||||
CursorIcon::ContextMenu => Cursor::Native("contextualMenuCursor"),
|
CursorIcon::ContextMenu => Cursor::Native("contextualMenuCursor"),
|
||||||
CursorIcon::Crosshair => Cursor::Native("crosshairCursor"),
|
CursorIcon::Crosshair => Cursor::Native("crosshairCursor"),
|
||||||
CursorIcon::EResize => Cursor::Native("resizeRightCursor"),
|
CursorIcon::EResize => Cursor::Native("resizeRightCursor"),
|
||||||
|
@ -57,7 +57,7 @@ impl From<CursorIcon> for Cursor {
|
||||||
// what's used in Safari and Chrome.
|
// what's used in Safari and Chrome.
|
||||||
CursorIcon::Wait | CursorIcon::Progress => {
|
CursorIcon::Wait | CursorIcon::Progress => {
|
||||||
Cursor::Undocumented("busyButClickableCursor")
|
Cursor::Undocumented("busyButClickableCursor")
|
||||||
},
|
}
|
||||||
|
|
||||||
// For the rest, we can just snatch the cursors from WebKit...
|
// For the rest, we can just snatch the cursors from WebKit...
|
||||||
// They fit the style of the native cursors, and will seem
|
// They fit the style of the native cursors, and will seem
|
||||||
|
@ -81,7 +81,7 @@ impl Cursor {
|
||||||
Cursor::Native(cursor_name) => {
|
Cursor::Native(cursor_name) => {
|
||||||
let sel = Sel::register(cursor_name);
|
let sel = Sel::register(cursor_name);
|
||||||
msg_send![class!(NSCursor), performSelector: sel]
|
msg_send![class!(NSCursor), performSelector: sel]
|
||||||
},
|
}
|
||||||
Cursor::Undocumented(cursor_name) => {
|
Cursor::Undocumented(cursor_name) => {
|
||||||
let class = class!(NSCursor);
|
let class = class!(NSCursor);
|
||||||
let sel = Sel::register(cursor_name);
|
let sel = Sel::register(cursor_name);
|
||||||
|
@ -92,7 +92,7 @@ impl Cursor {
|
||||||
sel!(arrowCursor)
|
sel!(arrowCursor)
|
||||||
};
|
};
|
||||||
msg_send![class, performSelector: sel]
|
msg_send![class, performSelector: sel]
|
||||||
},
|
}
|
||||||
Cursor::WebKit(cursor_name) => load_webkit_cursor(cursor_name),
|
Cursor::WebKit(cursor_name) => load_webkit_cursor(cursor_name),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -900,7 +900,7 @@ extern "C" fn scroll_wheel(this: &Object, _sel: Sel, event: id) {
|
||||||
let phase = match event.phase() {
|
let phase = match event.phase() {
|
||||||
NSEventPhase::NSEventPhaseMayBegin | NSEventPhase::NSEventPhaseBegan => {
|
NSEventPhase::NSEventPhaseMayBegin | NSEventPhase::NSEventPhaseBegan => {
|
||||||
TouchPhase::Started
|
TouchPhase::Started
|
||||||
},
|
}
|
||||||
NSEventPhase::NSEventPhaseEnded => TouchPhase::Ended,
|
NSEventPhase::NSEventPhaseEnded => TouchPhase::Ended,
|
||||||
_ => TouchPhase::Moved,
|
_ => TouchPhase::Moved,
|
||||||
};
|
};
|
||||||
|
|
|
@ -116,7 +116,7 @@ fn create_window(
|
||||||
Some(ref monitor_id) => {
|
Some(ref monitor_id) => {
|
||||||
let monitor_screen = monitor_id.inner.ns_screen();
|
let monitor_screen = monitor_id.inner.ns_screen();
|
||||||
Some(monitor_screen.unwrap_or(appkit::NSScreen::mainScreen(nil)))
|
Some(monitor_screen.unwrap_or(appkit::NSScreen::mainScreen(nil)))
|
||||||
},
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
let frame = match screen {
|
let frame = match screen {
|
||||||
|
@ -127,7 +127,7 @@ fn create_window(
|
||||||
.map(|logical| (logical.width, logical.height))
|
.map(|logical| (logical.width, logical.height))
|
||||||
.unwrap_or_else(|| (800.0, 600.0));
|
.unwrap_or_else(|| (800.0, 600.0));
|
||||||
NSRect::new(NSPoint::new(0.0, 0.0), NSSize::new(width, height))
|
NSRect::new(NSPoint::new(0.0, 0.0), NSSize::new(width, height))
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut masks = if !attrs.decorations && !screen.is_some() {
|
let mut masks = if !attrs.decorations && !screen.is_some() {
|
||||||
|
@ -649,7 +649,7 @@ impl UnownedWindow {
|
||||||
// Our best bet is probably to move to the origin of the
|
// Our best bet is probably to move to the origin of the
|
||||||
// target monitor.
|
// target monitor.
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
},
|
}
|
||||||
(&None, None) | (&Some(_), Some(_)) => return,
|
(&None, None) | (&Some(_), Some(_)) => return,
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,14 +285,14 @@ pub fn handle_extended_keys(
|
||||||
} else {
|
} else {
|
||||||
winuser::VK_LCONTROL
|
winuser::VK_LCONTROL
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
winuser::VK_MENU => {
|
winuser::VK_MENU => {
|
||||||
if extended {
|
if extended {
|
||||||
winuser::VK_RMENU
|
winuser::VK_RMENU
|
||||||
} else {
|
} else {
|
||||||
winuser::VK_LMENU
|
winuser::VK_LMENU
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => {
|
_ => {
|
||||||
match scancode {
|
match scancode {
|
||||||
// This is only triggered when using raw input. Without this check, we get two events whenever VK_PAUSE is
|
// This is only triggered when using raw input. Without this check, we get two events whenever VK_PAUSE is
|
||||||
|
@ -308,10 +308,10 @@ pub fn handle_extended_keys(
|
||||||
} else {
|
} else {
|
||||||
winuser::VK_SCROLL
|
winuser::VK_SCROLL
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => vkey,
|
_ => vkey,
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
Some((vkey, scancode))
|
Some((vkey, scancode))
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ impl<T: 'static> EventLoop<T> {
|
||||||
match event {
|
match event {
|
||||||
Some(e) => {
|
Some(e) => {
|
||||||
runner.process_event(e);
|
runner.process_event(e);
|
||||||
},
|
}
|
||||||
None => break,
|
None => break,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,10 +210,10 @@ impl<T: 'static> EventLoop<T> {
|
||||||
break 'main;
|
break 'main;
|
||||||
}
|
}
|
||||||
msg_unprocessed = true;
|
msg_unprocessed = true;
|
||||||
},
|
}
|
||||||
ControlFlow::WaitUntil(resume_time) => {
|
ControlFlow::WaitUntil(resume_time) => {
|
||||||
wait_until_time_or_msg(resume_time);
|
wait_until_time_or_msg(resume_time);
|
||||||
},
|
}
|
||||||
ControlFlow::Poll => (),
|
ControlFlow::Poll => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ impl<T> EventLoopRunner<T> {
|
||||||
RunnerState::New => {
|
RunnerState::New => {
|
||||||
self.call_event_handler(Event::NewEvents(StartCause::Init));
|
self.call_event_handler(Event::NewEvents(StartCause::Init));
|
||||||
RunnerState::HandlingEvents
|
RunnerState::HandlingEvents
|
||||||
},
|
}
|
||||||
|
|
||||||
// When `NewEvents` gets sent after an idle depends on the control flow...
|
// When `NewEvents` gets sent after an idle depends on the control flow...
|
||||||
RunnerState::Idle(wait_start) => {
|
RunnerState::Idle(wait_start) => {
|
||||||
|
@ -371,7 +371,7 @@ impl<T> EventLoopRunner<T> {
|
||||||
// `Exit` shouldn't really ever get sent here, but if it does do something somewhat sane.
|
// `Exit` shouldn't really ever get sent here, but if it does do something somewhat sane.
|
||||||
ControlFlow::Exit => RunnerState::DeferredNewEvents(wait_start),
|
ControlFlow::Exit => RunnerState::DeferredNewEvents(wait_start),
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,27 +405,23 @@ impl<T> EventLoopRunner<T> {
|
||||||
start: wait_start,
|
start: wait_start,
|
||||||
requested_resume: None,
|
requested_resume: None,
|
||||||
}))
|
}))
|
||||||
},
|
}
|
||||||
ControlFlow::WaitUntil(resume_time) => {
|
ControlFlow::WaitUntil(resume_time) => {
|
||||||
let start_cause = match Instant::now() >= resume_time {
|
let start_cause = match Instant::now() >= resume_time {
|
||||||
// If the current time is later than the requested resume time, the resume time
|
// If the current time is later than the requested resume time, the resume time
|
||||||
// has been reached.
|
// has been reached.
|
||||||
true => {
|
true => StartCause::ResumeTimeReached {
|
||||||
StartCause::ResumeTimeReached {
|
start: wait_start,
|
||||||
start: wait_start,
|
requested_resume: resume_time,
|
||||||
requested_resume: resume_time,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
// Otherwise, the requested resume time HASN'T been reached and we send a WaitCancelled.
|
// Otherwise, the requested resume time HASN'T been reached and we send a WaitCancelled.
|
||||||
false => {
|
false => StartCause::WaitCancelled {
|
||||||
StartCause::WaitCancelled {
|
start: wait_start,
|
||||||
start: wait_start,
|
requested_resume: Some(resume_time),
|
||||||
requested_resume: Some(resume_time),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
self.call_event_handler(Event::NewEvents(start_cause));
|
self.call_event_handler(Event::NewEvents(start_cause));
|
||||||
},
|
}
|
||||||
// This can be reached if the control flow is changed to poll during a `RedrawRequested`
|
// This can be reached if the control flow is changed to poll during a `RedrawRequested`
|
||||||
// that was sent after `EventsCleared`.
|
// that was sent after `EventsCleared`.
|
||||||
ControlFlow::Poll => self.call_event_handler(Event::NewEvents(StartCause::Poll)),
|
ControlFlow::Poll => self.call_event_handler(Event::NewEvents(StartCause::Poll)),
|
||||||
|
@ -442,7 +438,7 @@ impl<T> EventLoopRunner<T> {
|
||||||
RunnerState::HandlingEvents => {
|
RunnerState::HandlingEvents => {
|
||||||
self.call_event_handler(Event::EventsCleared);
|
self.call_event_handler(Event::EventsCleared);
|
||||||
self.runner_state = RunnerState::Idle(Instant::now());
|
self.runner_state = RunnerState::Idle(Instant::now());
|
||||||
},
|
}
|
||||||
|
|
||||||
// If we *weren't* handling events, we don't have to do anything.
|
// If we *weren't* handling events, we don't have to do anything.
|
||||||
RunnerState::New | RunnerState::Idle(..) => (),
|
RunnerState::New | RunnerState::Idle(..) => (),
|
||||||
|
@ -455,7 +451,7 @@ impl<T> EventLoopRunner<T> {
|
||||||
ControlFlow::Poll => {
|
ControlFlow::Poll => {
|
||||||
self.call_event_handler(Event::NewEvents(StartCause::Poll));
|
self.call_event_handler(Event::NewEvents(StartCause::Poll));
|
||||||
self.call_event_handler(Event::EventsCleared);
|
self.call_event_handler(Event::EventsCleared);
|
||||||
},
|
}
|
||||||
// If we had deferred a WaitUntil and the resume time has since been reached,
|
// If we had deferred a WaitUntil and the resume time has since been reached,
|
||||||
// send the resume notification and EventsCleared event.
|
// send the resume notification and EventsCleared event.
|
||||||
ControlFlow::WaitUntil(resume_time) => {
|
ControlFlow::WaitUntil(resume_time) => {
|
||||||
|
@ -468,27 +464,25 @@ impl<T> EventLoopRunner<T> {
|
||||||
));
|
));
|
||||||
self.call_event_handler(Event::EventsCleared);
|
self.call_event_handler(Event::EventsCleared);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
// If we deferred a wait and no events were received, the user doesn't have to
|
// If we deferred a wait and no events were received, the user doesn't have to
|
||||||
// get an event.
|
// get an event.
|
||||||
ControlFlow::Wait | ControlFlow::Exit => (),
|
ControlFlow::Wait | ControlFlow::Exit => (),
|
||||||
}
|
}
|
||||||
// Mark that we've entered an idle state.
|
// Mark that we've entered an idle state.
|
||||||
self.runner_state = RunnerState::Idle(wait_start)
|
self.runner_state = RunnerState::Idle(wait_start)
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call_event_handler(&mut self, event: Event<T>) {
|
fn call_event_handler(&mut self, event: Event<T>) {
|
||||||
match event {
|
match event {
|
||||||
Event::NewEvents(_) => {
|
Event::NewEvents(_) => self
|
||||||
self.trigger_newevents_on_redraw
|
.trigger_newevents_on_redraw
|
||||||
.store(true, Ordering::Relaxed)
|
.store(true, Ordering::Relaxed),
|
||||||
},
|
Event::EventsCleared => self
|
||||||
Event::EventsCleared => {
|
.trigger_newevents_on_redraw
|
||||||
self.trigger_newevents_on_redraw
|
.store(false, Ordering::Relaxed),
|
||||||
.store(false, Ordering::Relaxed)
|
|
||||||
},
|
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,18 +819,18 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
runner.in_modal_loop = true;
|
runner.in_modal_loop = true;
|
||||||
}
|
}
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
winuser::WM_EXITSIZEMOVE => {
|
winuser::WM_EXITSIZEMOVE => {
|
||||||
let mut runner = subclass_input.event_loop_runner.runner.borrow_mut();
|
let mut runner = subclass_input.event_loop_runner.runner.borrow_mut();
|
||||||
if let Some(ref mut runner) = *runner {
|
if let Some(ref mut runner) = *runner {
|
||||||
runner.in_modal_loop = false;
|
runner.in_modal_loop = false;
|
||||||
}
|
}
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
winuser::WM_NCCREATE => {
|
winuser::WM_NCCREATE => {
|
||||||
enable_non_client_dpi_scaling(window);
|
enable_non_client_dpi_scaling(window);
|
||||||
commctrl::DefSubclassProc(window, msg, wparam, lparam)
|
commctrl::DefSubclassProc(window, msg, wparam, lparam)
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_NCLBUTTONDOWN => {
|
winuser::WM_NCLBUTTONDOWN => {
|
||||||
// jumpstart the modal loop
|
// jumpstart the modal loop
|
||||||
|
@ -850,7 +844,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
winuser::PostMessageW(window, winuser::WM_MOUSEMOVE, 0, 0);
|
winuser::PostMessageW(window, winuser::WM_MOUSEMOVE, 0, 0);
|
||||||
}
|
}
|
||||||
commctrl::DefSubclassProc(window, msg, wparam, lparam)
|
commctrl::DefSubclassProc(window, msg, wparam, lparam)
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_CLOSE => {
|
winuser::WM_CLOSE => {
|
||||||
use crate::event::WindowEvent::CloseRequested;
|
use crate::event::WindowEvent::CloseRequested;
|
||||||
|
@ -859,7 +853,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
event: CloseRequested,
|
event: CloseRequested,
|
||||||
});
|
});
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_DESTROY => {
|
winuser::WM_DESTROY => {
|
||||||
use crate::event::WindowEvent::Destroyed;
|
use crate::event::WindowEvent::Destroyed;
|
||||||
|
@ -872,7 +866,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
Box::from_raw(subclass_input);
|
Box::from_raw(subclass_input);
|
||||||
drop(subclass_input);
|
drop(subclass_input);
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
_ if msg == *REQUEST_REDRAW_NO_NEWEVENTS_MSG_ID => {
|
_ if msg == *REQUEST_REDRAW_NO_NEWEVENTS_MSG_ID => {
|
||||||
use crate::event::WindowEvent::RedrawRequested;
|
use crate::event::WindowEvent::RedrawRequested;
|
||||||
|
@ -892,22 +886,20 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
};
|
};
|
||||||
match runner_state {
|
match runner_state {
|
||||||
RunnerState::Idle(..) | RunnerState::DeferredNewEvents(..) => request_redraw(),
|
RunnerState::Idle(..) | RunnerState::DeferredNewEvents(..) => request_redraw(),
|
||||||
RunnerState::HandlingEvents => {
|
RunnerState::HandlingEvents => match control_flow {
|
||||||
match control_flow {
|
ControlFlow::Poll => request_redraw(),
|
||||||
ControlFlow::Poll => request_redraw(),
|
ControlFlow::WaitUntil(resume_time) => {
|
||||||
ControlFlow::WaitUntil(resume_time) => {
|
if resume_time <= Instant::now() {
|
||||||
if resume_time <= Instant::now() {
|
request_redraw()
|
||||||
request_redraw()
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
|
_ => (),
|
||||||
},
|
},
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
winuser::WM_PAINT => {
|
winuser::WM_PAINT => {
|
||||||
use crate::event::WindowEvent::RedrawRequested;
|
use crate::event::WindowEvent::RedrawRequested;
|
||||||
subclass_input.send_event(Event::WindowEvent {
|
subclass_input.send_event(Event::WindowEvent {
|
||||||
|
@ -915,7 +907,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
event: RedrawRequested,
|
event: RedrawRequested,
|
||||||
});
|
});
|
||||||
commctrl::DefSubclassProc(window, msg, wparam, lparam)
|
commctrl::DefSubclassProc(window, msg, wparam, lparam)
|
||||||
},
|
}
|
||||||
|
|
||||||
// WM_MOVE supplies client area positions, so we send Moved here instead.
|
// WM_MOVE supplies client area positions, so we send Moved here instead.
|
||||||
winuser::WM_WINDOWPOSCHANGED => {
|
winuser::WM_WINDOWPOSCHANGED => {
|
||||||
|
@ -934,7 +926,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
|
|
||||||
// This is necessary for us to still get sent WM_SIZE.
|
// This is necessary for us to still get sent WM_SIZE.
|
||||||
commctrl::DefSubclassProc(window, msg, wparam, lparam)
|
commctrl::DefSubclassProc(window, msg, wparam, lparam)
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_SIZE => {
|
winuser::WM_SIZE => {
|
||||||
use crate::event::WindowEvent::Resized;
|
use crate::event::WindowEvent::Resized;
|
||||||
|
@ -962,7 +954,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
|
|
||||||
subclass_input.send_event(event);
|
subclass_input.send_event(event);
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_CHAR => {
|
winuser::WM_CHAR => {
|
||||||
use crate::event::WindowEvent::ReceivedCharacter;
|
use crate::event::WindowEvent::ReceivedCharacter;
|
||||||
|
@ -972,7 +964,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
event: ReceivedCharacter(chr),
|
event: ReceivedCharacter(chr),
|
||||||
});
|
});
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
// Prevents default windows menu hotkeys playing unwanted
|
// Prevents default windows menu hotkeys playing unwanted
|
||||||
// "ding" sounds. Alternatively could check for WM_SYSCOMMAND
|
// "ding" sounds. Alternatively could check for WM_SYSCOMMAND
|
||||||
|
@ -1024,7 +1016,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
});
|
});
|
||||||
|
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_MOUSELEAVE => {
|
winuser::WM_MOUSELEAVE => {
|
||||||
use crate::event::WindowEvent::CursorLeft;
|
use crate::event::WindowEvent::CursorLeft;
|
||||||
|
@ -1043,7 +1035,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
});
|
});
|
||||||
|
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_MOUSEWHEEL => {
|
winuser::WM_MOUSEWHEEL => {
|
||||||
use crate::event::MouseScrollDelta::LineDelta;
|
use crate::event::MouseScrollDelta::LineDelta;
|
||||||
|
@ -1063,7 +1055,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
});
|
});
|
||||||
|
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_MOUSEHWHEEL => {
|
winuser::WM_MOUSEHWHEEL => {
|
||||||
use crate::event::MouseScrollDelta::LineDelta;
|
use crate::event::MouseScrollDelta::LineDelta;
|
||||||
|
@ -1083,7 +1075,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
});
|
});
|
||||||
|
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_KEYDOWN | winuser::WM_SYSKEYDOWN => {
|
winuser::WM_KEYDOWN | winuser::WM_SYSKEYDOWN => {
|
||||||
use crate::event::{ElementState::Pressed, VirtualKeyCode};
|
use crate::event::{ElementState::Pressed, VirtualKeyCode};
|
||||||
|
@ -1114,7 +1106,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
}
|
}
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_KEYUP | winuser::WM_SYSKEYUP => {
|
winuser::WM_KEYUP | winuser::WM_SYSKEYUP => {
|
||||||
use crate::event::ElementState::Released;
|
use crate::event::ElementState::Released;
|
||||||
|
@ -1133,7 +1125,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_LBUTTONDOWN => {
|
winuser::WM_LBUTTONDOWN => {
|
||||||
use crate::event::{ElementState::Pressed, MouseButton::Left, WindowEvent::MouseInput};
|
use crate::event::{ElementState::Pressed, MouseButton::Left, WindowEvent::MouseInput};
|
||||||
|
@ -1150,7 +1142,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_LBUTTONUP => {
|
winuser::WM_LBUTTONUP => {
|
||||||
use crate::event::{
|
use crate::event::{
|
||||||
|
@ -1169,7 +1161,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_RBUTTONDOWN => {
|
winuser::WM_RBUTTONDOWN => {
|
||||||
use crate::event::{
|
use crate::event::{
|
||||||
|
@ -1188,7 +1180,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_RBUTTONUP => {
|
winuser::WM_RBUTTONUP => {
|
||||||
use crate::event::{
|
use crate::event::{
|
||||||
|
@ -1207,7 +1199,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_MBUTTONDOWN => {
|
winuser::WM_MBUTTONDOWN => {
|
||||||
use crate::event::{
|
use crate::event::{
|
||||||
|
@ -1226,7 +1218,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_MBUTTONUP => {
|
winuser::WM_MBUTTONUP => {
|
||||||
use crate::event::{
|
use crate::event::{
|
||||||
|
@ -1245,7 +1237,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_XBUTTONDOWN => {
|
winuser::WM_XBUTTONDOWN => {
|
||||||
use crate::event::{
|
use crate::event::{
|
||||||
|
@ -1265,7 +1257,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_XBUTTONUP => {
|
winuser::WM_XBUTTONUP => {
|
||||||
use crate::event::{
|
use crate::event::{
|
||||||
|
@ -1285,7 +1277,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_INPUT_DEVICE_CHANGE => {
|
winuser::WM_INPUT_DEVICE_CHANGE => {
|
||||||
let event = match wparam as _ {
|
let event = match wparam as _ {
|
||||||
|
@ -1300,7 +1292,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
});
|
});
|
||||||
|
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_INPUT => {
|
winuser::WM_INPUT => {
|
||||||
use crate::event::{
|
use crate::event::{
|
||||||
|
@ -1399,7 +1391,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
}
|
}
|
||||||
|
|
||||||
commctrl::DefSubclassProc(window, msg, wparam, lparam)
|
commctrl::DefSubclassProc(window, msg, wparam, lparam)
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_TOUCH => {
|
winuser::WM_TOUCH => {
|
||||||
let pcount = LOWORD(wparam as DWORD) as usize;
|
let pcount = LOWORD(wparam as DWORD) as usize;
|
||||||
|
@ -1439,7 +1431,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
}
|
}
|
||||||
winuser::CloseTouchInputHandle(htouch);
|
winuser::CloseTouchInputHandle(htouch);
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_SETFOCUS => {
|
winuser::WM_SETFOCUS => {
|
||||||
use crate::event::WindowEvent::Focused;
|
use crate::event::WindowEvent::Focused;
|
||||||
|
@ -1449,7 +1441,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
});
|
});
|
||||||
|
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_KILLFOCUS => {
|
winuser::WM_KILLFOCUS => {
|
||||||
use crate::event::WindowEvent::Focused;
|
use crate::event::WindowEvent::Focused;
|
||||||
|
@ -1458,7 +1450,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
event: Focused(false),
|
event: Focused(false),
|
||||||
});
|
});
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_SETCURSOR => {
|
winuser::WM_SETCURSOR => {
|
||||||
let set_cursor_to = {
|
let set_cursor_to = {
|
||||||
|
@ -1479,15 +1471,15 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
let cursor = winuser::LoadCursorW(ptr::null_mut(), cursor.to_windows_cursor());
|
let cursor = winuser::LoadCursorW(ptr::null_mut(), cursor.to_windows_cursor());
|
||||||
winuser::SetCursor(cursor);
|
winuser::SetCursor(cursor);
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
None => winuser::DefWindowProcW(window, msg, wparam, lparam),
|
None => winuser::DefWindowProcW(window, msg, wparam, lparam),
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_DROPFILES => {
|
winuser::WM_DROPFILES => {
|
||||||
// See `FileDropHandler` for implementation.
|
// See `FileDropHandler` for implementation.
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
winuser::WM_GETMINMAXINFO => {
|
winuser::WM_GETMINMAXINFO => {
|
||||||
let mmi = lparam as *mut winuser::MINMAXINFO;
|
let mmi = lparam as *mut winuser::MINMAXINFO;
|
||||||
|
@ -1516,7 +1508,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
}
|
}
|
||||||
|
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
// Only sent on Windows 8.1 or newer. On Windows 7 and older user has to log out to change
|
// Only sent on Windows 8.1 or newer. On Windows 7 and older user has to log out to change
|
||||||
// DPI, therefore all applications are closed while DPI is changing.
|
// DPI, therefore all applications are closed while DPI is changing.
|
||||||
|
@ -1560,7 +1552,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
});
|
});
|
||||||
|
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
if msg == *DESTROY_MSG_ID {
|
if msg == *DESTROY_MSG_ID {
|
||||||
|
@ -1613,7 +1605,7 @@ unsafe extern "system" fn public_window_callback<T>(
|
||||||
} else {
|
} else {
|
||||||
commctrl::DefSubclassProc(window, msg, wparam, lparam)
|
commctrl::DefSubclassProc(window, msg, wparam, lparam)
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1631,7 +1623,7 @@ unsafe extern "system" fn thread_event_target_callback<T>(
|
||||||
Box::from_raw(subclass_input);
|
Box::from_raw(subclass_input);
|
||||||
drop(subclass_input);
|
drop(subclass_input);
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
// Because WM_PAINT comes after all other messages, we use it during modal loops to detect
|
// Because WM_PAINT comes after all other messages, we use it during modal loops to detect
|
||||||
// when the event queue has been emptied. See `process_event` for more details.
|
// when the event queue has been emptied. See `process_event` for more details.
|
||||||
winuser::WM_PAINT => {
|
winuser::WM_PAINT => {
|
||||||
|
@ -1669,13 +1661,13 @@ unsafe extern "system" fn thread_event_target_callback<T>(
|
||||||
winuser::TranslateMessage(&mut msg);
|
winuser::TranslateMessage(&mut msg);
|
||||||
winuser::DispatchMessageW(&mut msg);
|
winuser::DispatchMessageW(&mut msg);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
// If the message isn't one of those three, it may be handled by the modal
|
// If the message isn't one of those three, it may be handled by the modal
|
||||||
// loop so we should return control flow to it.
|
// loop so we should return control flow to it.
|
||||||
_ => {
|
_ => {
|
||||||
queue_call_again();
|
queue_call_again();
|
||||||
return 0;
|
return 0;
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1689,27 +1681,27 @@ unsafe extern "system" fn thread_event_target_callback<T>(
|
||||||
wait_until_time_or_msg(resume_time);
|
wait_until_time_or_msg(resume_time);
|
||||||
runner.new_events();
|
runner.new_events();
|
||||||
queue_call_again();
|
queue_call_again();
|
||||||
},
|
}
|
||||||
ControlFlow::Poll => {
|
ControlFlow::Poll => {
|
||||||
runner.new_events();
|
runner.new_events();
|
||||||
queue_call_again();
|
queue_call_again();
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
_ if msg == *USER_EVENT_MSG_ID => {
|
_ if msg == *USER_EVENT_MSG_ID => {
|
||||||
if let Ok(event) = subclass_input.user_event_receiver.recv() {
|
if let Ok(event) = subclass_input.user_event_receiver.recv() {
|
||||||
subclass_input.send_event(Event::UserEvent(event));
|
subclass_input.send_event(Event::UserEvent(event));
|
||||||
}
|
}
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
_ if msg == *EXEC_MSG_ID => {
|
_ if msg == *EXEC_MSG_ID => {
|
||||||
let mut function: ThreadExecFn = Box::from_raw(wparam as usize as *mut _);
|
let mut function: ThreadExecFn = Box::from_raw(wparam as usize as *mut _);
|
||||||
function();
|
function();
|
||||||
0
|
0
|
||||||
},
|
}
|
||||||
_ => commctrl::DefSubclassProc(window, msg, wparam, lparam),
|
_ => commctrl::DefSubclassProc(window, msg, wparam, lparam),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ impl CursorIcon {
|
||||||
CursorIcon::NotAllowed | CursorIcon::NoDrop => winuser::IDC_NO,
|
CursorIcon::NotAllowed | CursorIcon::NoDrop => winuser::IDC_NO,
|
||||||
CursorIcon::Grab | CursorIcon::Grabbing | CursorIcon::Move | CursorIcon::AllScroll => {
|
CursorIcon::Grab | CursorIcon::Grabbing | CursorIcon::Move | CursorIcon::AllScroll => {
|
||||||
winuser::IDC_SIZEALL
|
winuser::IDC_SIZEALL
|
||||||
},
|
}
|
||||||
CursorIcon::EResize
|
CursorIcon::EResize
|
||||||
| CursorIcon::WResize
|
| CursorIcon::WResize
|
||||||
| CursorIcon::EwResize
|
| CursorIcon::EwResize
|
||||||
|
@ -140,10 +140,10 @@ impl CursorIcon {
|
||||||
| CursorIcon::RowResize => winuser::IDC_SIZENS,
|
| CursorIcon::RowResize => winuser::IDC_SIZENS,
|
||||||
CursorIcon::NeResize | CursorIcon::SwResize | CursorIcon::NeswResize => {
|
CursorIcon::NeResize | CursorIcon::SwResize | CursorIcon::NeswResize => {
|
||||||
winuser::IDC_SIZENESW
|
winuser::IDC_SIZENESW
|
||||||
},
|
}
|
||||||
CursorIcon::NwResize | CursorIcon::SeResize | CursorIcon::NwseResize => {
|
CursorIcon::NwResize | CursorIcon::SeResize | CursorIcon::NwseResize => {
|
||||||
winuser::IDC_SIZENWSE
|
winuser::IDC_SIZENWSE
|
||||||
},
|
}
|
||||||
CursorIcon::Wait => winuser::IDC_WAIT,
|
CursorIcon::Wait => winuser::IDC_WAIT,
|
||||||
CursorIcon::Progress => winuser::IDC_APPSTARTING,
|
CursorIcon::Progress => winuser::IDC_APPSTARTING,
|
||||||
CursorIcon::Help => winuser::IDC_HELP,
|
CursorIcon::Help => winuser::IDC_HELP,
|
||||||
|
|
|
@ -464,7 +464,7 @@ impl Window {
|
||||||
|
|
||||||
mark_fullscreen(window.0, true);
|
mark_fullscreen(window.0, true);
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
&None => {
|
&None => {
|
||||||
self.thread_executor.execute_in_thread(move || {
|
self.thread_executor.execute_in_thread(move || {
|
||||||
let mut window_state_lock = window_state.lock();
|
let mut window_state_lock = window_state.lock();
|
||||||
|
@ -487,7 +487,7 @@ impl Window {
|
||||||
|
|
||||||
mark_fullscreen(window.0, false);
|
mark_fullscreen(window.0, false);
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ impl MouseProperties {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
self.cursor_flags = old_flags;
|
self.cursor_flags = old_flags;
|
||||||
return Err(e);
|
return Err(e);
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -309,7 +309,7 @@ impl WindowFlags {
|
||||||
h,
|
h,
|
||||||
winuser::SWP_NOZORDER | winuser::SWP_FRAMECHANGED,
|
winuser::SWP_NOZORDER | winuser::SWP_FRAMECHANGED,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
None => {
|
None => {
|
||||||
// Refresh the window frame.
|
// Refresh the window frame.
|
||||||
winuser::SetWindowPos(
|
winuser::SetWindowPos(
|
||||||
|
@ -324,7 +324,7 @@ impl WindowFlags {
|
||||||
| winuser::SWP_NOSIZE
|
| winuser::SWP_NOSIZE
|
||||||
| winuser::SWP_FRAMECHANGED,
|
| winuser::SWP_FRAMECHANGED,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
winuser::SendMessageW(window, *event_loop::SET_RETAIN_STATE_ON_SIZE_MSG_ID, 0, 0);
|
winuser::SendMessageW(window, *event_loop::SET_RETAIN_STATE_ON_SIZE_MSG_ID, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue