diff --git a/examples/present_special_event.rs b/examples/present_special_event.rs index 6fe66a5b551..0294202e341 100644 --- a/examples/present_special_event.rs +++ b/examples/present_special_event.rs @@ -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); } diff --git a/src/base.rs b/src/base.rs index 1b60f9c148b..aeb19927ccd 100644 --- a/src/base.rs +++ b/src/base.rs @@ -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(&self) -> SpecialEventId { @@ -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 { + 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> { + 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 @@ -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 { + pub fn wait_for_special_event2(&self, se: &SpecialEvent) -> Result { unsafe { let ev = xcb_wait_for_special_event(self.c, se.raw); self.handle_wait_for_event(ev) @@ -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> { + pub fn poll_for_special_event2(&self, se: &SpecialEvent) -> Result> { unsafe { let ev = xcb_poll_for_special_event(self.c, se.raw); self.handle_poll_for_event(ev)