mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 14:51:30 +11:00
Merge pull request #498 from vberger/master
Update wayland dependency to 0.2.
This commit is contained in:
commit
8f66d58287
12
Cargo.toml
12
Cargo.toml
|
@ -60,18 +60,18 @@ dwmapi-sys = "0.1"
|
||||||
|
|
||||||
[target.i686-unknown-linux-gnu.dependencies]
|
[target.i686-unknown-linux-gnu.dependencies]
|
||||||
osmesa-sys = "0.0.5"
|
osmesa-sys = "0.0.5"
|
||||||
wayland-client = "0.1.6"
|
wayland-client = { version = "0.2.0", features = ["egl", "dlopen"] }
|
||||||
wayland-kbd = "0.1.1"
|
wayland-kbd = "0.2.0"
|
||||||
x11-dl = "=1.0.1"
|
x11-dl = "=1.0.1"
|
||||||
|
|
||||||
[target.x86_64-unknown-linux-gnu.dependencies]
|
[target.x86_64-unknown-linux-gnu.dependencies]
|
||||||
osmesa-sys = "0.0.5"
|
osmesa-sys = "0.0.5"
|
||||||
wayland-client = "0.1.6"
|
wayland-client = { version = "0.2.0", features = ["egl", "dlopen"] }
|
||||||
wayland-kbd = "0.1.1"
|
wayland-kbd = "0.2.0"
|
||||||
x11-dl = "=1.0.1"
|
x11-dl = "=1.0.1"
|
||||||
|
|
||||||
[target.arm-unknown-linux-gnueabihf.dependencies]
|
[target.arm-unknown-linux-gnueabihf.dependencies]
|
||||||
osmesa-sys = "0.0.5"
|
osmesa-sys = "0.0.5"
|
||||||
wayland-client = "0.1.6"
|
wayland-client = { version = "0.2.0", features = ["egl", "dlopen"] }
|
||||||
wayland-kbd = "0.1.1"
|
wayland-kbd = "0.2.0"
|
||||||
x11-dl = "=1.0.1"
|
x11-dl = "=1.0.1"
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use super::wayland::core::{Display, Registry, Compositor, Shell, Output, ButtonState,
|
use super::wayland::core::{default_display, Display, Registry};
|
||||||
Seat, Pointer, default_display, WSurface, SurfaceId, Keyboard,
|
use super::wayland::core::compositor::{Compositor, SurfaceId, WSurface};
|
||||||
KeyState};
|
use super::wayland::core::output::Output;
|
||||||
|
use super::wayland::core::seat::{ButtonState, Seat, Pointer, Keyboard, KeyState};
|
||||||
|
use super::wayland::core::shell::Shell;
|
||||||
use super::wayland_kbd::MappedKeyboard;
|
use super::wayland_kbd::MappedKeyboard;
|
||||||
use super::keyboard::keycode_to_vkey;
|
use super::keyboard::keycode_to_vkey;
|
||||||
|
|
||||||
|
@ -68,11 +70,11 @@ impl WaylandContext {
|
||||||
if let Some(ref mut p) = pointer {
|
if let Some(ref mut p) = pointer {
|
||||||
// set the enter/leave callbacks
|
// set the enter/leave callbacks
|
||||||
let current_surface = current_pointer_surface.clone();
|
let current_surface = current_pointer_surface.clone();
|
||||||
p.set_enter_action(move |_, sid, x, y| {
|
p.set_enter_action(move |_, _, sid, x, y| {
|
||||||
*current_surface.lock().unwrap() = Some(sid);
|
*current_surface.lock().unwrap() = Some(sid);
|
||||||
});
|
});
|
||||||
let current_surface = current_pointer_surface.clone();
|
let current_surface = current_pointer_surface.clone();
|
||||||
p.set_leave_action(move |_, sid| {
|
p.set_leave_action(move |_, _, sid| {
|
||||||
*current_surface.lock().unwrap() = None;
|
*current_surface.lock().unwrap() = None;
|
||||||
});
|
});
|
||||||
// set the events callbacks
|
// set the events callbacks
|
||||||
|
@ -90,7 +92,7 @@ impl WaylandContext {
|
||||||
});
|
});
|
||||||
let current_surface = current_pointer_surface.clone();
|
let current_surface = current_pointer_surface.clone();
|
||||||
let event_queues = windows_event_queues.clone();
|
let event_queues = windows_event_queues.clone();
|
||||||
p.set_button_action(move |_, sid, b, s| {
|
p.set_button_action(move |_, _, sid, b, s| {
|
||||||
let button = match b {
|
let button = match b {
|
||||||
0x110 => MouseButton::Left,
|
0x110 => MouseButton::Left,
|
||||||
0x111 => MouseButton::Right,
|
0x111 => MouseButton::Right,
|
||||||
|
@ -98,8 +100,8 @@ impl WaylandContext {
|
||||||
_ => return
|
_ => return
|
||||||
};
|
};
|
||||||
let state = match s {
|
let state = match s {
|
||||||
ButtonState::WL_POINTER_BUTTON_STATE_RELEASED => ElementState::Released,
|
ButtonState::Released => ElementState::Released,
|
||||||
ButtonState::WL_POINTER_BUTTON_STATE_PRESSED => ElementState::Pressed
|
ButtonState::Pressed => ElementState::Pressed
|
||||||
};
|
};
|
||||||
// dispatch to the appropriate queue
|
// dispatch to the appropriate queue
|
||||||
let sid = *current_surface.lock().unwrap();
|
let sid = *current_surface.lock().unwrap();
|
||||||
|
@ -119,11 +121,11 @@ impl WaylandContext {
|
||||||
display.sync_roundtrip();
|
display.sync_roundtrip();
|
||||||
|
|
||||||
let current_surface = current_keyboard_surface.clone();
|
let current_surface = current_keyboard_surface.clone();
|
||||||
wkbd.set_enter_action(move |_, sid, _| {
|
wkbd.set_enter_action(move |_, _, sid, _| {
|
||||||
*current_surface.lock().unwrap() = Some(sid);
|
*current_surface.lock().unwrap() = Some(sid);
|
||||||
});
|
});
|
||||||
let current_surface = current_keyboard_surface.clone();
|
let current_surface = current_keyboard_surface.clone();
|
||||||
wkbd.set_leave_action(move |_, sid| {
|
wkbd.set_leave_action(move |_, _, sid| {
|
||||||
*current_surface.lock().unwrap() = None;
|
*current_surface.lock().unwrap() = None;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -132,10 +134,10 @@ impl WaylandContext {
|
||||||
// We managed to load a keymap
|
// We managed to load a keymap
|
||||||
let current_surface = current_keyboard_surface.clone();
|
let current_surface = current_keyboard_surface.clone();
|
||||||
let event_queues = windows_event_queues.clone();
|
let event_queues = windows_event_queues.clone();
|
||||||
mkbd.set_key_action(move |state, _, _, keycode, keystate| {
|
mkbd.set_key_action(move |state, _, _, _, keycode, keystate| {
|
||||||
let kstate = match keystate {
|
let kstate = match keystate {
|
||||||
KeyState::WL_KEYBOARD_KEY_STATE_RELEASED => ElementState::Released,
|
KeyState::Released => ElementState::Released,
|
||||||
KeyState::WL_KEYBOARD_KEY_STATE_PRESSED => ElementState::Pressed
|
KeyState::Pressed => ElementState::Pressed
|
||||||
};
|
};
|
||||||
let mut events = Vec::new();
|
let mut events = Vec::new();
|
||||||
// key event
|
// key event
|
||||||
|
@ -167,10 +169,10 @@ impl WaylandContext {
|
||||||
// fallback to raw inputs, no virtual keycodes
|
// fallback to raw inputs, no virtual keycodes
|
||||||
let current_surface = current_keyboard_surface.clone();
|
let current_surface = current_keyboard_surface.clone();
|
||||||
let event_queues = windows_event_queues.clone();
|
let event_queues = windows_event_queues.clone();
|
||||||
rkbd.set_key_action(move |_, _, keycode, keystate| {
|
rkbd.set_key_action(move |_, _, _, keycode, keystate| {
|
||||||
let kstate = match keystate {
|
let kstate = match keystate {
|
||||||
KeyState::WL_KEYBOARD_KEY_STATE_RELEASED => ElementState::Released,
|
KeyState::Released => ElementState::Released,
|
||||||
KeyState::WL_KEYBOARD_KEY_STATE_PRESSED => ElementState::Pressed
|
KeyState::Pressed => ElementState::Pressed
|
||||||
};
|
};
|
||||||
let event = Event::KeyboardInput(kstate, (keycode & 0xff) as u8, None);
|
let event = Event::KeyboardInput(kstate, (keycode & 0xff) as u8, None);
|
||||||
// dispatch to the appropriate queue
|
// dispatch to the appropriate queue
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
#![allow(unused_variables, dead_code)]
|
#![allow(unused_variables, dead_code)]
|
||||||
|
|
||||||
use self::wayland::egl::{EGLSurface, is_egl_available};
|
use self::wayland::egl::{EGLSurface, is_egl_available};
|
||||||
use self::wayland::core::{ShellSurface, Surface, Output, ShellFullscreenMethod};
|
use self::wayland::core::Surface;
|
||||||
|
use self::wayland::core::output::Output;
|
||||||
|
use self::wayland::core::shell::{ShellSurface, ShellFullscreenMethod};
|
||||||
|
|
||||||
use libc;
|
use libc;
|
||||||
use api::dlopen;
|
use api::dlopen;
|
||||||
|
|
Loading…
Reference in a new issue