X11: Continuous Presentation (#7762)
Alternative to #7758, which doesn't involve adding a new trait method `request_draw`. Somehow, my whole screen goes blinking black with this when moving the window, so not ready for landing. Release Notes: - N/A --------- Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
parent
181f556269
commit
8f7a26f397
9 changed files with 78 additions and 23 deletions
|
@ -202,6 +202,16 @@ impl X11WindowState {
|
|||
})
|
||||
.unwrap();
|
||||
|
||||
let fake_id = xcb_connection.generate_id();
|
||||
xcb_connection
|
||||
.send_and_check_request(&xcb::present::SelectInput {
|
||||
eid: fake_id,
|
||||
window: x_window,
|
||||
//Note: also consider `IDLE_NOTIFY`
|
||||
event_mask: xcb::present::EventMask::COMPLETE_NOTIFY,
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
xcb_connection.send_request(&x::MapWindow { window: x_window });
|
||||
xcb_connection.flush().unwrap();
|
||||
|
||||
|
@ -258,7 +268,7 @@ impl X11WindowState {
|
|||
self.xcb_connection.flush().unwrap();
|
||||
}
|
||||
|
||||
pub fn expose(&self) {
|
||||
pub fn refresh(&self) {
|
||||
let mut cb = self.callbacks.lock();
|
||||
if let Some(ref mut fun) = cb.request_frame {
|
||||
fun();
|
||||
|
@ -291,6 +301,18 @@ impl X11WindowState {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn request_refresh(&self) {
|
||||
self.xcb_connection
|
||||
.send_and_check_request(&xcb::present::NotifyMsc {
|
||||
window: self.x_window,
|
||||
serial: 0,
|
||||
target_msc: 0,
|
||||
divisor: 1,
|
||||
remainder: 0,
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
impl PlatformWindow for X11Window {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue