1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
use smithay_client_toolkit::{
delegate_keyboard,
seat::keyboard::{KeyEvent, KeyboardHandler, Keysym, Modifiers},
shell::WaylandSurface,
};
use wayland_client::{
protocol::{wl_keyboard::WlKeyboard, wl_surface::WlSurface},
Connection, QueueHandle,
};
use crate::{app::App, handler::SurfaceCtx};
impl KeyboardHandler for App {
fn enter(
&mut self,
_: &Connection,
_: &QueueHandle<Self>,
_: &WlKeyboard,
_: &WlSurface,
_: u32,
_: &[u32],
_: &[Keysym],
) {
}
fn leave(
&mut self,
_: &Connection,
_: &QueueHandle<Self>,
_: &WlKeyboard,
_: &WlSurface,
_: u32,
) {
}
fn press_key(
&mut self,
_: &Connection,
_: &QueueHandle<Self>,
_: &WlKeyboard,
_: u32,
event: KeyEvent,
) {
// let App {
// compositor_state,
// qh,
// lock_windows,
// windows,
// ..
// } = self;
// let text = event.utf8.as_deref();
// let sym = event.keysym.raw();
// let raw = event.raw_code;
// for lw in lock_windows.iter_mut() {
// let ctx = SurfaceCtx {
// size: (lw.width, lw.height),
// compositor_state,
// wl_surface: &lw.wl_surface,
// layer: None,
// bg_effect_surface: None,
// qh,
// };
// if lw.handler.on_key(raw, sym, text, ctx) {
// lw.request_frame(compositor_state, qh);
// }
// }
// for w in windows.iter_mut() {
// let ctx = SurfaceCtx {
// size: (w.width, w.height),
// compositor_state,
// wl_surface: w.layer.wl_surface(),
// layer: Some(&w.layer),
// bg_effect_surface: w.bg_effect_surface.as_ref(),
// qh,
// };
// if w.handler.on_key(raw, sym, text, ctx) {
// w.request_frame(compositor_state, qh);
// }
// }
}
fn release_key(
&mut self,
_: &Connection,
_: &QueueHandle<Self>,
_: &WlKeyboard,
_: u32,
_: KeyEvent,
) {
}
fn update_modifiers(
&mut self,
_: &Connection,
_: &QueueHandle<Self>,
_: &WlKeyboard,
_: u32,
_: Modifiers,
_: u32,
) {
}
}
delegate_keyboard!(App);