Skip to content

Commit

Permalink
fix Semver clashes
Browse files Browse the repository at this point in the history
  • Loading branch information
rtbo committed Apr 13, 2024
1 parent f57ea66 commit e77b421
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/present_special_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl Example {
self.conn.flush()?;

loop {
let ev = self.conn.poll_for_special_event(&special_event)?;
let ev = self.conn.poll_for_special_event2(&special_event)?;
if let Some(ev) = ev {
println!("Received special event {:#?}", ev);
}
Expand Down
35 changes: 32 additions & 3 deletions src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ impl Connection {
/// XGE events are only defined in the `xinput` and `present` extensions
///
/// This function is present only if either of the `xinput` or `present` cargo features are active.
#[deprecated(note = "broken API: use `register_for_special_event` instead")]
#[deprecated(note = "Broken API: use `register_for_special_event` instead")]
#[cfg(any(feature = "xinput", feature = "present"))]
#[allow(deprecated)]
pub fn register_for_special_xge<XGE: GeEvent>(&self) -> SpecialEventId {
Expand All @@ -1295,6 +1295,35 @@ impl Connection {
}
}

/// Stop listening to a special event
#[deprecated(note = "use `unregister_for_special_event` instead")]
#[cfg(any(feature = "xinput", feature = "present"))]
pub fn unregister_for_special_xge(&self, se: SpecialEvent) {
unsafe {
xcb_unregister_for_special_event(self.c, se.raw);
}
}

/// Returns the next event from a special queue, blocking until one arrives
#[deprecated(note = "Broken API: use `wait_for_special_event2` instead")]
#[cfg(any(feature = "xinput", feature = "present"))]
pub fn wait_for_special_event(&self, se: SpecialEvent) -> Result<Event> {
unsafe {
let ev = xcb_wait_for_special_event(self.c, se.raw);
self.handle_wait_for_event(ev)
}
}

/// Returns the next event from a special queue
#[deprecated(note = "Broken API: use `poll_for_special_event2` instead")]
#[cfg(any(feature = "xinput", feature = "present"))]
pub fn poll_for_special_event(&self, se: SpecialEvent) -> Result<Option<Event>> {
unsafe {
let ev = xcb_poll_for_special_event(self.c, se.raw);
self.handle_poll_for_event(ev)
}
}

/// Start listening for a special event.
///
/// Effectively creates an internal special queue for this event
Expand Down Expand Up @@ -1332,7 +1361,7 @@ impl Connection {

/// Returns the next event from a special queue, blocking until one arrives
#[cfg(any(feature = "xinput", feature = "present"))]
pub fn wait_for_special_event(&self, se: &SpecialEvent) -> Result<Event> {
pub fn wait_for_special_event2(&self, se: &SpecialEvent) -> Result<Event> {
unsafe {
let ev = xcb_wait_for_special_event(self.c, se.raw);
self.handle_wait_for_event(ev)
Expand All @@ -1341,7 +1370,7 @@ impl Connection {

/// Returns the next event from a special queue
#[cfg(any(feature = "xinput", feature = "present"))]
pub fn poll_for_special_event(&self, se: &SpecialEvent) -> Result<Option<Event>> {
pub fn poll_for_special_event2(&self, se: &SpecialEvent) -> Result<Option<Event>> {
unsafe {
let ev = xcb_poll_for_special_event(self.c, se.raw);
self.handle_poll_for_event(ev)
Expand Down

0 comments on commit e77b421

Please sign in to comment.