Update sctk to 0.11.0
This commit is contained in:
parent
8a81be7c0a
commit
b88f48fbc0
2 changed files with 23 additions and 18 deletions
|
|
@ -10,8 +10,8 @@ license = "MIT"
|
||||||
keywords = ["clipboard", "wayland"]
|
keywords = ["clipboard", "wayland"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
sctk = { package = "smithay-client-toolkit", version = "0.10", default-features = false }
|
sctk = { package = "smithay-client-toolkit", version = "0.11", default-features = false }
|
||||||
wayland-client = { version = "0.27", features = ["dlopen"] }
|
wayland-client = { version = "0.27", features = ["dlopen"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
sctk = { package = "smithay-client-toolkit", version = "0.10"}
|
sctk = { package = "smithay-client-toolkit", version = "0.11"}
|
||||||
|
|
|
||||||
|
|
@ -41,27 +41,32 @@ fn main() {
|
||||||
let mut dimentions = (320u32, 240u32);
|
let mut dimentions = (320u32, 240u32);
|
||||||
|
|
||||||
// Create surface
|
// Create surface
|
||||||
let surface = env.create_surface();
|
let surface = env.create_surface().detach();
|
||||||
|
|
||||||
// Create window
|
// Create window
|
||||||
let mut window = env
|
let mut window = env
|
||||||
.create_window::<ConceptFrame, _>(surface, dimentions, move |event, mut dispatch_data| {
|
.create_window::<ConceptFrame, _>(
|
||||||
// Get our dispath data
|
surface,
|
||||||
let dispatch_data = dispatch_data.get::<DispatchData>().unwrap();
|
None,
|
||||||
|
dimentions,
|
||||||
|
move |event, mut dispatch_data| {
|
||||||
|
// Get our dispath data
|
||||||
|
let dispatch_data = dispatch_data.get::<DispatchData>().unwrap();
|
||||||
|
|
||||||
// Keep last event in priority order : Close > Configure > Refresh
|
// Keep last event in priority order : Close > Configure > Refresh
|
||||||
let should_replace_event = match (&event, &dispatch_data.pending_frame_event) {
|
let should_replace_event = match (&event, &dispatch_data.pending_frame_event) {
|
||||||
(_, &None)
|
(_, &None)
|
||||||
| (_, &Some(WindowEvent::Refresh))
|
| (_, &Some(WindowEvent::Refresh))
|
||||||
| (&WindowEvent::Configure { .. }, &Some(WindowEvent::Configure { .. }))
|
| (&WindowEvent::Configure { .. }, &Some(WindowEvent::Configure { .. }))
|
||||||
| (&WindowEvent::Close, _) => true,
|
| (&WindowEvent::Close, _) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
if should_replace_event {
|
if should_replace_event {
|
||||||
dispatch_data.pending_frame_event = Some(event);
|
dispatch_data.pending_frame_event = Some(event);
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
|
)
|
||||||
.expect("failed to create a window.");
|
.expect("failed to create a window.");
|
||||||
|
|
||||||
// Set title and app id
|
// Set title and app id
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue