Use calloop
This commit is contained in:
parent
315bc8cd90
commit
6d15d0f3c9
3 changed files with 13 additions and 4 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -170,6 +170,8 @@ dependencies = [
|
||||||
name = "cosmic-idle"
|
name = "cosmic-idle"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"calloop",
|
||||||
|
"calloop-wayland-source",
|
||||||
"cosmic-config",
|
"cosmic-config",
|
||||||
"cosmic-idle-config",
|
"cosmic-idle-config",
|
||||||
"keyframe",
|
"keyframe",
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ wayland-protocols = { version = "0.32.3", features = ["client", "staging"] }
|
||||||
wayland-protocols-wlr = { version = "0.3.3", features = ["client"] }
|
wayland-protocols-wlr = { version = "0.3.3", features = ["client"] }
|
||||||
cosmic-config = { git = "https://github.com/pop-os/libcosmic" }
|
cosmic-config = { git = "https://github.com/pop-os/libcosmic" }
|
||||||
cosmic-idle-config = { path = "./cosmic-idle-config" }
|
cosmic-idle-config = { path = "./cosmic-idle-config" }
|
||||||
|
calloop = "0.13.0"
|
||||||
|
calloop-wayland-source = "0.3.0"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
|
|
|
||||||
13
src/main.rs
13
src/main.rs
|
|
@ -1,5 +1,7 @@
|
||||||
#![allow(clippy::single_match)]
|
#![allow(clippy::single_match)]
|
||||||
|
|
||||||
|
use calloop::EventLoop;
|
||||||
|
use calloop_wayland_source::WaylandSource;
|
||||||
use keyframe::{ease, functions::EaseInOut};
|
use keyframe::{ease, functions::EaseInOut};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use wayland_client::{
|
use wayland_client::{
|
||||||
|
|
@ -132,7 +134,7 @@ impl State {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let connection = Connection::connect_to_env().unwrap();
|
let connection = Connection::connect_to_env().unwrap();
|
||||||
let (globals, mut event_queue) = registry_queue_init::<State>(&connection).unwrap();
|
let (globals, event_queue) = registry_queue_init::<State>(&connection).unwrap();
|
||||||
let qh = event_queue.handle();
|
let qh = event_queue.handle();
|
||||||
|
|
||||||
let output_power_manager = globals
|
let output_power_manager = globals
|
||||||
|
|
@ -200,9 +202,12 @@ fn main() {
|
||||||
_idle_notification,
|
_idle_notification,
|
||||||
outputs,
|
outputs,
|
||||||
};
|
};
|
||||||
loop {
|
|
||||||
event_queue.blocking_dispatch(&mut state).unwrap();
|
let mut event_loop: EventLoop<State> = EventLoop::try_new().unwrap();
|
||||||
}
|
WaylandSource::new(connection, event_queue)
|
||||||
|
.insert(event_loop.handle())
|
||||||
|
.unwrap();
|
||||||
|
while let Ok(_) = event_loop.dispatch(None, &mut state) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Dispatch<wl_registry::WlRegistry, GlobalListContents> for State {
|
impl Dispatch<wl_registry::WlRegistry, GlobalListContents> for State {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue