mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 06:11:30 +11:00
Upgrade mio
to 0.7 (#1875)
* Upgrade `mio` to 0.7 Replaced `mio-extras` with `mio-misc`. * Possible improvement * Remove leftover * Wrong rebase * Fix typo
This commit is contained in:
parent
ffe2143d14
commit
889258f538
|
@ -15,6 +15,7 @@
|
|||
- On Windows, fixed `WindowEvent::ThemeChanged` not properly firing and fixed `Window::theme` returning the wrong theme.
|
||||
- On Web, added support for `DeviceEvent::MouseMotion` to listen for relative mouse movements.
|
||||
- Added `Window::drag_window`. Implemented on Windows, macOS, X11 and Wayland.
|
||||
- On X11, bump `mio` to 0.7.
|
||||
|
||||
# 0.24.0 (2020-12-09)
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ targets = ["i686-pc-windows-msvc", "x86_64-pc-windows-msvc", "i686-unknown-linux
|
|||
default = ["x11", "wayland"]
|
||||
web-sys = ["web_sys", "wasm-bindgen", "instant/wasm-bindgen"]
|
||||
stdweb = ["std_web", "instant/stdweb"]
|
||||
x11 = ["x11-dl", "mio", "mio-extras", "percent-encoding", "parking_lot"]
|
||||
x11 = ["x11-dl", "mio", "mio-misc", "percent-encoding", "parking_lot"]
|
||||
wayland = ["wayland-client", "sctk"]
|
||||
|
||||
[dependencies]
|
||||
|
@ -87,8 +87,8 @@ features = [
|
|||
[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd"))'.dependencies]
|
||||
wayland-client = { version = "0.28", features = [ "dlopen"] , optional = true }
|
||||
sctk = { package = "smithay-client-toolkit", version = "0.12.3", optional = true }
|
||||
mio = { version = "0.6", optional = true }
|
||||
mio-extras = { version = "2.0", optional = true }
|
||||
mio = { version = "0.7", features = ["os-ext"], optional = true }
|
||||
mio-misc = { version = "1.0", optional = true }
|
||||
x11-dl = { version = "2.18.5", optional = true }
|
||||
percent-encoding = { version = "2.0", optional = true }
|
||||
parking_lot = { version = "0.11.0", optional = true }
|
||||
|
|
|
@ -32,15 +32,20 @@ use std::{
|
|||
ptr,
|
||||
rc::Rc,
|
||||
slice,
|
||||
sync::mpsc::Receiver,
|
||||
sync::{mpsc, Arc, Weak},
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use libc::{self, setlocale, LC_CTYPE};
|
||||
|
||||
use mio::{unix::EventedFd, Events, Poll, PollOpt, Ready, Token};
|
||||
use mio::{unix::SourceFd, Events, Interest, Poll, Token, Waker};
|
||||
|
||||
use mio_extras::channel::{channel, Receiver, SendError, Sender};
|
||||
use mio_misc::{
|
||||
channel::{channel, SendError, Sender},
|
||||
queue::NotificationQueue,
|
||||
NotificationId,
|
||||
};
|
||||
|
||||
use self::{
|
||||
dnd::{Dnd, DndState},
|
||||
|
@ -57,8 +62,7 @@ use crate::{
|
|||
};
|
||||
|
||||
const X_TOKEN: Token = Token(0);
|
||||
const USER_TOKEN: Token = Token(1);
|
||||
const REDRAW_TOKEN: Token = Token(2);
|
||||
const USER_REDRAW_TOKEN: Token = Token(1);
|
||||
|
||||
pub struct EventLoopWindowTarget<T> {
|
||||
xconn: Arc<XConnection>,
|
||||
|
@ -180,33 +184,16 @@ impl<T: 'static> EventLoop<T> {
|
|||
mod_keymap.reset_from_x_connection(&xconn);
|
||||
|
||||
let poll = Poll::new().unwrap();
|
||||
let waker = Arc::new(Waker::new(poll.registry(), USER_REDRAW_TOKEN).unwrap());
|
||||
let queue = Arc::new(NotificationQueue::new(waker));
|
||||
|
||||
let (user_sender, user_channel) = channel();
|
||||
let (redraw_sender, redraw_channel) = channel();
|
||||
poll.registry()
|
||||
.register(&mut SourceFd(&xconn.x11_fd), X_TOKEN, Interest::READABLE)
|
||||
.unwrap();
|
||||
|
||||
poll.register(
|
||||
&EventedFd(&xconn.x11_fd),
|
||||
X_TOKEN,
|
||||
Ready::readable(),
|
||||
PollOpt::level(),
|
||||
)
|
||||
.unwrap();
|
||||
let (user_sender, user_channel) = channel(queue.clone(), NotificationId::gen_next());
|
||||
|
||||
poll.register(
|
||||
&user_channel,
|
||||
USER_TOKEN,
|
||||
Ready::readable(),
|
||||
PollOpt::level(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
poll.register(
|
||||
&redraw_channel,
|
||||
REDRAW_TOKEN,
|
||||
Ready::readable(),
|
||||
PollOpt::level(),
|
||||
)
|
||||
.unwrap();
|
||||
let (redraw_sender, redraw_channel) = channel(queue, NotificationId::gen_next());
|
||||
|
||||
let target = Rc::new(RootELW {
|
||||
p: super::EventLoopWindowTarget::X(EventLoopWindowTarget {
|
||||
|
|
|
@ -10,7 +10,7 @@ use std::{
|
|||
};
|
||||
|
||||
use libc;
|
||||
use mio_extras::channel::Sender;
|
||||
use mio_misc::channel::Sender;
|
||||
use parking_lot::Mutex;
|
||||
|
||||
use crate::{
|
||||
|
|
Loading…
Reference in a new issue