X11: Fix request_redraw not waking the event loop (#1756)
This commit is contained in:
parent
3a077ff211
commit
45e4fd6ec1
3 changed files with 41 additions and 38 deletions
|
|
@ -1,8 +1,6 @@
|
|||
use raw_window_handle::unix::XlibHandle;
|
||||
use std::{
|
||||
cmp,
|
||||
collections::HashSet,
|
||||
env,
|
||||
cmp, env,
|
||||
ffi::CString,
|
||||
mem::{self, replace, MaybeUninit},
|
||||
os::raw::*,
|
||||
|
|
@ -12,6 +10,7 @@ use std::{
|
|||
};
|
||||
|
||||
use libc;
|
||||
use mio_extras::channel::Sender;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use crate::{
|
||||
|
|
@ -104,7 +103,7 @@ pub struct UnownedWindow {
|
|||
cursor_visible: Mutex<bool>,
|
||||
ime_sender: Mutex<ImeSender>,
|
||||
pub shared_state: Mutex<SharedState>,
|
||||
pending_redraws: Arc<::std::sync::Mutex<HashSet<WindowId>>>,
|
||||
redraw_sender: Sender<WindowId>,
|
||||
}
|
||||
|
||||
impl UnownedWindow {
|
||||
|
|
@ -249,7 +248,7 @@ impl UnownedWindow {
|
|||
cursor_visible: Mutex::new(true),
|
||||
ime_sender: Mutex::new(event_loop.ime_sender.clone()),
|
||||
shared_state: SharedState::new(guessed_monitor, window_attrs.visible),
|
||||
pending_redraws: event_loop.pending_redraws.clone(),
|
||||
redraw_sender: event_loop.redraw_sender.clone(),
|
||||
};
|
||||
|
||||
// Title must be set before mapping. Some tiling window managers (i.e. i3) use the window
|
||||
|
|
@ -1314,10 +1313,7 @@ impl UnownedWindow {
|
|||
|
||||
#[inline]
|
||||
pub fn request_redraw(&self) {
|
||||
self.pending_redraws
|
||||
.lock()
|
||||
.unwrap()
|
||||
.insert(WindowId(self.xwindow));
|
||||
self.redraw_sender.send(WindowId(self.xwindow)).unwrap();
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue