-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
155 additions
and
175 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,6 @@ pub mod libei; | |
|
||
#[cfg(target_os = "macos")] | ||
pub mod macos; | ||
|
||
/// fallback consumer | ||
pub mod dummy; |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use async_trait::async_trait; | ||
use crate::{consumer::EventConsumer, event::Event, client::{ClientHandle, ClientEvent}}; | ||
|
||
pub struct DummyConsumer; | ||
|
||
impl DummyConsumer { | ||
pub fn new() -> Self { | ||
Self {} | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl EventConsumer for DummyConsumer { | ||
async fn consume(&mut self, event: Event, client_handle: ClientHandle) { | ||
log::info!("received event: ({client_handle}) {event}"); | ||
} | ||
async fn notify(&mut self, client_event: ClientEvent) { | ||
log::info!("{client_event:?}"); | ||
} | ||
async fn destroy(&mut self) {} | ||
} |
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,10 +1,17 @@ | ||
#[cfg(all(unix, feature = "libei", not(target_os = "macos")))] | ||
pub mod libei; | ||
|
||
#[cfg(target_os = "macos")] | ||
pub mod macos; | ||
|
||
#[cfg(all(unix, feature = "wayland", not(target_os = "macos")))] | ||
pub mod wayland; | ||
|
||
#[cfg(windows)] | ||
pub mod windows; | ||
|
||
#[cfg(all(unix, feature = "x11", not(target_os = "macos")))] | ||
pub mod x11; | ||
|
||
/// fallback event producer | ||
pub mod dummy; |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use std::io; | ||
use std::pin::Pin; | ||
use std::task::{Poll, Context}; | ||
|
||
use futures_core::Stream; | ||
|
||
use crate::event::Event; | ||
use crate::producer::EventProducer; | ||
|
||
use crate::client::{ClientEvent, ClientHandle}; | ||
|
||
pub struct DummyProducer {} | ||
|
||
impl DummyProducer { | ||
pub fn new() -> Self { | ||
Self {} | ||
} | ||
} | ||
|
||
impl Default for DummyProducer { | ||
fn default() -> Self { | ||
Self::new() | ||
} | ||
} | ||
|
||
impl EventProducer for DummyProducer { | ||
fn notify(&mut self, _: ClientEvent) {} | ||
|
||
fn release(&mut self) {} | ||
} | ||
|
||
impl Stream for DummyProducer { | ||
type Item = io::Result<(ClientHandle, Event)>; | ||
|
||
fn poll_next( | ||
self: Pin<&mut Self>, | ||
_cx: &mut Context<'_>, | ||
) -> Poll<Option<Self::Item>> { | ||
Poll::Pending | ||
} | ||
} |
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
Oops, something went wrong.