-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from ids1024/raw-window-handle-0.6
Raw window handle 0.6
- Loading branch information
Showing
13 changed files
with
57 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
use window_clipboard::Clipboard; | ||
use winit::{ | ||
error::EventLoopError, | ||
event::{Event, WindowEvent}, | ||
event_loop::{ControlFlow, EventLoop}, | ||
event_loop::EventLoop, | ||
window::WindowBuilder, | ||
}; | ||
|
||
fn main() { | ||
let event_loop = EventLoop::new(); | ||
fn main() -> Result<(), EventLoopError> { | ||
let event_loop = EventLoop::new().unwrap(); | ||
|
||
let window = WindowBuilder::new() | ||
.with_title("A fantastic window!") | ||
.build(&event_loop) | ||
.unwrap(); | ||
|
||
let clipboard = Clipboard::connect(&window).expect("Connect to clipboard"); | ||
let clipboard = | ||
unsafe { Clipboard::connect(&window) }.expect("Connect to clipboard"); | ||
|
||
event_loop.run(move |event, _, control_flow| match event { | ||
Event::MainEventsCleared => { | ||
event_loop.run(move |event, elwt| match event { | ||
Event::AboutToWait => { | ||
println!("{:?}", clipboard.read()); | ||
} | ||
Event::WindowEvent { | ||
event: WindowEvent::CloseRequested, | ||
window_id, | ||
} if window_id == window.id() => *control_flow = ControlFlow::Exit, | ||
_ => *control_flow = ControlFlow::Wait, | ||
}); | ||
} if window_id == window.id() => elwt.exit(), | ||
_ => {} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
use window_clipboard::Clipboard; | ||
use winit::{ | ||
error::EventLoopError, | ||
event::{Event, WindowEvent}, | ||
event_loop::{ControlFlow, EventLoop}, | ||
event_loop::EventLoop, | ||
window::WindowBuilder, | ||
}; | ||
|
||
fn main() { | ||
let event_loop = EventLoop::new(); | ||
fn main() -> Result<(), EventLoopError> { | ||
let event_loop = EventLoop::new().unwrap(); | ||
|
||
let window = WindowBuilder::new() | ||
.with_title("A fantastic window!") | ||
.build(&event_loop) | ||
.unwrap(); | ||
|
||
let mut clipboard = | ||
Clipboard::connect(&window).expect("Connect to clipboard"); | ||
unsafe { Clipboard::connect(&window) }.expect("Connect to clipboard"); | ||
|
||
clipboard | ||
.write(String::from("Hello, world!")) | ||
.expect("Write to clipboard"); | ||
|
||
event_loop.run(move |event, _, control_flow| match event { | ||
Event::MainEventsCleared => {} | ||
event_loop.run(move |event, elwt| match event { | ||
Event::WindowEvent { | ||
event: WindowEvent::CloseRequested, | ||
window_id, | ||
} if window_id == window.id() => *control_flow = ControlFlow::Exit, | ||
_ => *control_flow = ControlFlow::Wait, | ||
}); | ||
} if window_id == window.id() => elwt.exit(), | ||
_ => {} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters