Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add request_redraw method on Linux (#222)
  • Loading branch information
Ngo Iok Ui (Wu Yu Wei) committed Apr 30, 2021
1 parent 0d11c98 commit 03abfa0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/request-redraw.md
@@ -0,0 +1,5 @@
---
"wry": patch
---

Add `request_redraw` method of `Window` on Linux
1 change: 1 addition & 0 deletions src/application/event_loop.rs
Expand Up @@ -539,6 +539,7 @@ impl<T: 'static> EventLoop<T> {
Inhibit(false)
});
}
WindowRequest::Redraw => window.queue_draw(),
}
}

Expand Down
10 changes: 8 additions & 2 deletions src/application/window.rs
Expand Up @@ -339,7 +339,6 @@ impl WindowBuilder {
window_target: &EventLoopWindowTarget<T>,
) -> Result<Window, OsError> {
Window::new(window_target, self.window)
// TODO request redraw
}
}

Expand Down Expand Up @@ -557,6 +556,7 @@ impl Window {
log::warn!("Fail to send wire up events request: {}", e);
}

window.queue_draw();
Ok(Self {
window_id,
window,
Expand All @@ -578,7 +578,12 @@ impl Window {
}

pub fn request_redraw(&self) {
todo!()
if let Err(e) = self
.window_requests_tx
.send((self.window_id, WindowRequest::Redraw))
{
log::warn!("Fail to send redraw request: {}", e);
}
}

pub fn inner_position(&self) -> Result<PhysicalPosition<i32>, NotSupportedError> {
Expand Down Expand Up @@ -857,6 +862,7 @@ pub(crate) enum WindowRequest {
SkipTaskbar,
CursorIcon(Option<CursorIcon>),
WireUpEvents,
Redraw,
}

pub(crate) fn hit_test(window: &gdk::Window, cx: f64, cy: f64) -> WindowEdge {
Expand Down

0 comments on commit 03abfa0

Please sign in to comment.