Skip to content

Commit

Permalink
temp fix black screen
Browse files Browse the repository at this point in the history
  • Loading branch information
harryfei committed Aug 14, 2020
1 parent d39a498 commit 8bcc6c9
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions rust_src/src/webrender_backend/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use super::font::FontRef;
use super::texture::TextureResourceManager;

pub enum EmacsGUIEvent {
Flush,
Flush(SyncSender<()>),
ReadBytes(DeviceIntRect, SyncSender<ImageKey>),
}

Expand Down Expand Up @@ -208,13 +208,15 @@ impl Output {
)
};
}
Event::UserEvent(EmacsGUIEvent::Flush) => {
Event::UserEvent(EmacsGUIEvent::Flush(s)) => {
renderer.update();
renderer.render(device_size).unwrap();
let _ = renderer.flush_pipeline_info();
current_context.swap_buffers().ok();

texture_resources.borrow_mut().clear();

s.send(()).unwrap();
}
Event::UserEvent(EmacsGUIEvent::ReadBytes(device_rect, sender)) => {
let mut fb_rect =
Expand Down Expand Up @@ -357,6 +359,16 @@ impl Output {
txn.generate_frame();

self.render_api.send_transaction(self.document_id, txn);

self.render_api.flush_scene_builder();

let (sender, receiver) = sync_channel(1);

let _ = self
.event_loop_proxy
.send_event(EmacsGUIEvent::Flush(sender));

receiver.recv().unwrap()
}
}

Expand Down Expand Up @@ -481,9 +493,7 @@ impl RenderNotifier for Notifier {
})
}

fn wake_up(&self) {
let _ = self.event_loop_proxy.send_event(EmacsGUIEvent::Flush);
}
fn wake_up(&self) {}

fn new_frame_ready(
&self,
Expand All @@ -492,6 +502,5 @@ impl RenderNotifier for Notifier {
_composite_needed: bool,
_render_time: Option<u64>,
) {
self.wake_up();
}
}

0 comments on commit 8bcc6c9

Please sign in to comment.