forge
Explore
Log in

Don't you dare go Hollow

niri

Clone
★ 0

0 watching0 forksRustGPL-3.012.1 MiBb0eb8adIvan Molodetskikh3 months ago2857 commits

client.rs777 lines, 22.7 KiBHistoryRawDownload
1use std::cmp::min;
2use std::collections::HashMap;
3use std::fmt;
4use std::fmt::Write as _;
5use std::os::unix::net::UnixStream;
6use std::sync::atomic::{AtomicBool, Ordering};
7use std::sync::Arc;
8use std::time::Duration;
9
10use calloop::EventLoop;
11use calloop_wayland_source::WaylandSource;
12use single_pixel_buffer::v1::client::wp_single_pixel_buffer_manager_v1::WpSinglePixelBufferManagerV1;
13use smithay::reexports::wayland_protocols::wp::single_pixel_buffer;
14use smithay::reexports::wayland_protocols::wp::viewporter::client::wp_viewport::WpViewport;
15use smithay::reexports::wayland_protocols::wp::viewporter::client::wp_viewporter::WpViewporter;
16use smithay::reexports::wayland_protocols::xdg::shell::client::xdg_surface::{self, XdgSurface};
17use smithay::reexports::wayland_protocols::xdg::shell::client::xdg_toplevel::{self, XdgToplevel};
18use smithay::reexports::wayland_protocols::xdg::shell::client::xdg_wm_base::{self, XdgWmBase};
19use smithay::reexports::wayland_protocols_wlr::layer_shell::v1::client::zwlr_layer_shell_v1::{
20 self, ZwlrLayerShellV1,
21};
22use smithay::reexports::wayland_protocols_wlr::layer_shell::v1::client::zwlr_layer_surface_v1::{
23 self, ZwlrLayerSurfaceV1,
24};
25use wayland_backend::client::Backend;
26use wayland_client::globals::Global;
27use wayland_client::protocol::wl_buffer::{self, WlBuffer};
28use wayland_client::protocol::wl_callback::{self, WlCallback};
29use wayland_client::protocol::wl_compositor::WlCompositor;
30use wayland_client::protocol::wl_display::WlDisplay;
31use wayland_client::protocol::wl_output::{self, WlOutput};
32use wayland_client::protocol::wl_registry::{self, WlRegistry};
33use wayland_client::protocol::wl_surface::{self, WlSurface};
34use wayland_client::{Connection, Dispatch, Proxy as _, QueueHandle};
35
36use crate::utils::id::IdCounter;
37
38pub struct Client {
39 pub id: ClientId,
40 pub event_loop: EventLoop<'static, State>,
41 pub connection: Connection,
42 pub qh: QueueHandle<State>,
43 pub display: WlDisplay,
44 pub state: State,
45}
46
47pub struct State {
48 pub qh: QueueHandle<State>,
49
50 pub globals: Vec<Global>,
51 pub outputs: HashMap<WlOutput, String>,
52
53 pub compositor: Option<WlCompositor>,
54 pub xdg_wm_base: Option<XdgWmBase>,
55 pub layer_shell: Option<ZwlrLayerShellV1>,
56 pub spbm: Option<WpSinglePixelBufferManagerV1>,
57 pub viewporter: Option<WpViewporter>,
58
59 pub windows: Vec<Window>,
60 pub layers: Vec<LayerSurface>,
61}
62
63pub struct Window {
64 pub qh: QueueHandle<State>,
65 pub spbm: WpSinglePixelBufferManagerV1,
66
67 pub surface: WlSurface,
68 pub xdg_surface: XdgSurface,
69 pub xdg_toplevel: XdgToplevel,
70 pub viewport: WpViewport,
71 pub pending_configure: Configure,
72 pub configures_received: Vec<(u32, Configure)>,
73 pub close_requested: bool,
74
75 pub configures_looked_at: usize,
76}
77
78pub struct LayerSurface {
79 pub qh: QueueHandle<State>,
80 pub spbm: WpSinglePixelBufferManagerV1,
81
82 pub surface: WlSurface,
83 pub layer_surface: ZwlrLayerSurfaceV1,
84 pub viewport: WpViewport,
85 pub configures_received: Vec<(u32, LayerConfigure)>,
86 pub close_requested: bool,
87
88 pub configures_looked_at: usize,
89}
90
91#[derive(Debug, Clone, Default)]
92pub struct Configure {
93 pub size: (i32, i32),
94 pub bounds: Option<(i32, i32)>,
95 pub states: Vec<xdg_toplevel::State>,
96}
97
98#[derive(Debug, Clone, Copy)]
99pub struct LayerConfigure {
100 pub size: (u32, u32),
101}
102
103#[derive(Clone, Copy, Default)]
104pub struct LayerMargin {
105 pub top: i32,
106 pub right: i32,
107 pub bottom: i32,
108 pub left: i32,
109}
110
111#[derive(Clone, Copy, Default)]
112pub struct LayerConfigureProps {
113 pub size: Option<(u32, u32)>,
114 pub anchor: Option<zwlr_layer_surface_v1::Anchor>,
115 pub exclusive_zone: Option<i32>,
116 pub margin: Option<LayerMargin>,
117 pub kb_interactivity: Option<zwlr_layer_surface_v1::KeyboardInteractivity>,
118 pub layer: Option<zwlr_layer_shell_v1::Layer>,
119 pub exclusive_edge: Option<zwlr_layer_surface_v1::Anchor>,
120}
121
122#[derive(Default)]
123pub struct SyncData {
124 pub done: AtomicBool,
125}
126
127static CLIENT_ID_COUNTER: IdCounter = IdCounter::new();
128
129#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
130pub struct ClientId(u64);
131
132impl ClientId {
133 fn next() -> ClientId {
134 ClientId(CLIENT_ID_COUNTER.next())
135 }
136}
137
138impl fmt::Display for Configure {
139 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
140 write!(f, "size: {} × {}, ", self.size.0, self.size.1)?;
141 if let Some(bounds) = self.bounds {
142 write!(f, "bounds: {} × {}, ", bounds.0, bounds.1)?;
143 } else {
144 write!(f, "bounds: none, ")?;
145 }
146 write!(f, "states: {:?}", self.states)?;
147 Ok(())
148 }
149}
150
151impl fmt::Display for LayerConfigure {
152 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
153 write!(f, "size: {} × {}", self.size.0, self.size.1)?;
154 Ok(())
155 }
156}
157
158impl Client {
159 pub fn new(stream: UnixStream) -> Self {
160 let id = ClientId::next();
161
162 let event_loop = EventLoop::try_new().unwrap();
163 let backend = Backend::connect(stream).unwrap();
164 let connection = Connection::from_backend(backend);
165 let queue = connection.new_event_queue();
166 let qh = queue.handle();
167 WaylandSource::new(connection.clone(), queue)
168 .insert(event_loop.handle())
169 .unwrap();
170
171 let display = connection.display();
172 let _registry = display.get_registry(&qh, ());
173 connection.flush().unwrap();
174
175 let state = State {
176 qh: qh.clone(),
177 globals: Vec::new(),
178 outputs: HashMap::new(),
179 compositor: None,
180 xdg_wm_base: None,
181 layer_shell: None,
182 spbm: None,
183 viewporter: None,
184 windows: Vec::new(),
185 layers: Vec::new(),
186 };
187
188 Self {
189 id,
190 event_loop,
191 connection,
192 qh,
193 display,
194 state,
195 }
196 }
197
198 pub fn dispatch(&mut self) {
199 self.event_loop
200 .dispatch(Duration::ZERO, &mut self.state)
201 .unwrap();
202
203 if let Some(error) = self.connection.protocol_error() {
204 panic!("{error}");
205 }
206 }
207
208 pub fn send_sync(&self) -> Arc<SyncData> {
209 let data = Arc::new(SyncData::default());
210 self.display.sync(&self.qh, data.clone());
211 self.connection.flush().unwrap();
212 data
213 }
214
215 pub fn create_window(&mut self) -> &mut Window {
216 self.state.create_window()
217 }
218
219 pub fn window(&mut self, surface: &WlSurface) -> &mut Window {
220 self.state.window(surface)
221 }
222
223 pub fn create_layer(
224 &mut self,
225 output: Option<&WlOutput>,
226 layer: zwlr_layer_shell_v1::Layer,
227 namespace: &str,
228 ) -> &mut LayerSurface {
229 self.state.create_layer(output, layer, namespace.to_owned())
230 }
231
232 pub fn layer(&mut self, surface: &WlSurface) -> &mut LayerSurface {
233 self.state.layer(surface)
234 }
235
236 pub fn output(&mut self, name: &str) -> WlOutput {
237 self.state
238 .outputs
239 .iter()
240 .find(|(_, v)| *v == name)
241 .unwrap()
242 .0
243 .clone()
244 }
245}
246
247impl State {
248 pub fn create_window(&mut self) -> &mut Window {
249 let compositor = self.compositor.as_ref().unwrap();
250 let xdg_wm_base = self.xdg_wm_base.as_ref().unwrap();
251 let viewporter = self.viewporter.as_ref().unwrap();
252
253 let surface = compositor.create_surface(&self.qh, ());
254 let xdg_surface = xdg_wm_base.get_xdg_surface(&surface, &self.qh, ());
255 let xdg_toplevel = xdg_surface.get_toplevel(&self.qh, ());
256 let viewport = viewporter.get_viewport(&surface, &self.qh, ());
257
258 let window = Window {
259 qh: self.qh.clone(),
260 spbm: self.spbm.clone().unwrap(),
261
262 surface,
263 xdg_surface,
264 xdg_toplevel,
265 viewport,
266 pending_configure: Configure::default(),
267 configures_received: Vec::new(),
268 close_requested: false,
269
270 configures_looked_at: 0,
271 };
272
273 self.windows.push(window);
274 self.windows.last_mut().unwrap()
275 }
276
277 pub fn window(&mut self, surface: &WlSurface) -> &mut Window {
278 self.windows
279 .iter_mut()
280 .find(|w| w.surface == *surface)
281 .unwrap()
282 }
283
284 pub fn create_layer(
285 &mut self,
286 output: Option<&WlOutput>,
287 layer: zwlr_layer_shell_v1::Layer,
288 namespace: String,
289 ) -> &mut LayerSurface {
290 let compositor = self.compositor.as_ref().unwrap();
291 let layer_shell = self.layer_shell.as_ref().unwrap();
292 let viewporter = self.viewporter.as_ref().unwrap();
293
294 let surface = compositor.create_surface(&self.qh, ());
295 let layer_surface =
296 layer_shell.get_layer_surface(&surface, output, layer, namespace, &self.qh, ());
297 let viewport = viewporter.get_viewport(&surface, &self.qh, ());
298
299 let layer_surface = LayerSurface {
300 qh: self.qh.clone(),
301 spbm: self.spbm.clone().unwrap(),
302
303 surface,
304 layer_surface,
305 viewport,
306 configures_received: Vec::new(),
307 close_requested: false,
308
309 configures_looked_at: 0,
310 };
311
312 self.layers.push(layer_surface);
313 self.layers.last_mut().unwrap()
314 }
315
316 pub fn layer(&mut self, surface: &WlSurface) -> &mut LayerSurface {
317 self.layers
318 .iter_mut()
319 .find(|w| w.surface == *surface)
320 .unwrap()
321 }
322}
323
324impl Window {
325 pub fn commit(&self) {
326 self.surface.commit();
327 }
328
329 pub fn ack_last(&self) {
330 let serial = self.configures_received.last().unwrap().0;
331 self.xdg_surface.ack_configure(serial);
332 }
333
334 pub fn ack_last_and_commit(&self) {
335 self.ack_last();
336 self.commit();
337 }
338
339 pub fn attach_new_buffer(&self) {
340 let buffer = self.spbm.create_u32_rgba_buffer(0, 0, 0, 0, &self.qh, ());
341 self.surface.attach(Some(&buffer), 0, 0);
342 }
343
344 pub fn attach_null(&self) {
345 self.surface.attach(None, 0, 0);
346 }
347
348 pub fn set_size(&self, w: u16, h: u16) {
349 self.viewport.set_destination(i32::from(w), i32::from(h));
350 }
351
352 pub fn set_fullscreen(&self, output: Option<&WlOutput>) {
353 self.xdg_toplevel.set_fullscreen(output);
354 }
355
356 pub fn unset_fullscreen(&self) {
357 self.xdg_toplevel.unset_fullscreen();
358 }
359
360 pub fn set_maximized(&self) {
361 self.xdg_toplevel.set_maximized();
362 }
363
364 pub fn unset_maximized(&self) {
365 self.xdg_toplevel.unset_maximized();
366 }
367
368 pub fn set_parent(&self, parent: Option<&XdgToplevel>) {
369 self.xdg_toplevel.set_parent(parent);
370 }
371
372 pub fn set_title(&self, title: &str) {
373 self.xdg_toplevel.set_title(title.to_owned());
374 }
375
376 pub fn recent_configures(&mut self) -> impl Iterator<Item = &Configure> {
377 let start = self.configures_looked_at;
378 self.configures_looked_at = self.configures_received.len();
379 self.configures_received[start..].iter().map(|(_, c)| c)
380 }
381
382 pub fn format_recent_configures(&mut self) -> String {
383 let mut buf = String::new();
384 for configure in self.recent_configures() {
385 if !buf.is_empty() {
386 buf.push('\n');
387 }
388 write!(buf, "{configure}").unwrap();
389 }
390 buf
391 }
392}
393
394impl LayerSurface {
395 pub fn commit(&self) {
396 self.surface.commit();
397 }
398
399 pub fn ack_last(&self) {
400 let serial = self.configures_received.last().unwrap().0;
401 self.layer_surface.ack_configure(serial);
402 }
403
404 pub fn ack_last_and_commit(&self) {
405 self.ack_last();
406 self.commit();
407 }
408
409 pub fn set_configure_props(&self, props: LayerConfigureProps) {
410 let LayerConfigureProps {
411 size,
412 anchor,
413 exclusive_zone,
414 margin,
415 kb_interactivity,
416 layer,
417 exclusive_edge,
418 } = props;
419
420 if let Some(x) = size {
421 self.layer_surface.set_size(x.0, x.1);
422 }
423 if let Some(x) = anchor {
424 self.layer_surface.set_anchor(x);
425 }
426 if let Some(x) = exclusive_zone {
427 self.layer_surface.set_exclusive_zone(x);
428 }
429 if let Some(x) = margin {
430 self.layer_surface
431 .set_margin(x.top, x.right, x.bottom, x.left);
432 }
433 if let Some(x) = kb_interactivity {
434 self.layer_surface.set_keyboard_interactivity(x);
435 }
436 if let Some(x) = layer {
437 self.layer_surface.set_layer(x);
438 }
439 if let Some(x) = exclusive_edge {
440 self.layer_surface.set_exclusive_edge(x);
441 }
442 }
443
444 pub fn attach_new_buffer(&self) {
445 let buffer = self.spbm.create_u32_rgba_buffer(0, 0, 0, 0, &self.qh, ());
446 self.surface.attach(Some(&buffer), 0, 0);
447 }
448
449 pub fn attach_null(&self) {
450 self.surface.attach(None, 0, 0);
451 }
452
453 pub fn set_size(&self, w: u16, h: u16) {
454 self.viewport.set_destination(i32::from(w), i32::from(h));
455 }
456
457 pub fn recent_configures(&mut self) -> impl Iterator<Item = &LayerConfigure> {
458 let start = self.configures_looked_at;
459 self.configures_looked_at = self.configures_received.len();
460 self.configures_received[start..].iter().map(|(_, c)| c)
461 }
462
463 pub fn format_recent_configures(&mut self) -> String {
464 let mut buf = String::new();
465 for configure in self.recent_configures() {
466 if !buf.is_empty() {
467 buf.push('\n');
468 }
469 write!(buf, "{configure}").unwrap();
470 }
471 buf
472 }
473}
474
475impl Dispatch<WlCallback, Arc<SyncData>> for State {
476 fn event(
477 _state: &mut Self,
478 _proxy: &WlCallback,
479 event: <WlCallback as wayland_client::Proxy>::Event,
480 data: &Arc<SyncData>,
481 _conn: &Connection,
482 _qhandle: &QueueHandle<Self>,
483 ) {
484 match event {
485 wl_callback::Event::Done { .. } => data.done.store(true, Ordering::Relaxed),
486 _ => unreachable!(),
487 }
488 }
489}
490
491impl Dispatch<WlRegistry, ()> for State {
492 fn event(
493 state: &mut Self,
494 registry: &WlRegistry,
495 event: <WlRegistry as wayland_client::Proxy>::Event,
496 _data: &(),
497 _conn: &Connection,
498 qh: &QueueHandle<Self>,
499 ) {
500 match event {
501 wl_registry::Event::Global {
502 name,
503 interface,
504 version,
505 } => {
506 if interface == WlCompositor::interface().name {
507 let version = min(version, WlCompositor::interface().version);
508 state.compositor = Some(registry.bind(name, version, qh, ()));
509 } else if interface == XdgWmBase::interface().name {
510 let version = min(version, XdgWmBase::interface().version);
511 state.xdg_wm_base = Some(registry.bind(name, version, qh, ()));
512 } else if interface == ZwlrLayerShellV1::interface().name {
513 let version = min(version, ZwlrLayerShellV1::interface().version);
514 state.layer_shell = Some(registry.bind(name, version, qh, ()));
515 } else if interface == WpSinglePixelBufferManagerV1::interface().name {
516 let version = min(version, WpSinglePixelBufferManagerV1::interface().version);
517 state.spbm = Some(registry.bind(name, version, qh, ()));
518 } else if interface == WpViewporter::interface().name {
519 let version = min(version, WpViewporter::interface().version);
520 state.viewporter = Some(registry.bind(name, version, qh, ()));
521 } else if interface == WlOutput::interface().name {
522 let version = min(version, WlOutput::interface().version);
523 let output = registry.bind(name, version, qh, ());
524 state.outputs.insert(output, String::new());
525 }
526
527 let global = Global {
528 name,
529 interface,
530 version,
531 };
532 state.globals.push(global);
533 }
534 wl_registry::Event::GlobalRemove { .. } => (),
535 _ => unreachable!(),
536 }
537 }
538}
539
540impl Dispatch<WlOutput, ()> for State {
541 fn event(
542 state: &mut Self,
543 output: &WlOutput,
544 event: <WlOutput as wayland_client::Proxy>::Event,
545 _data: &(),
546 _conn: &Connection,
547 _qhandle: &QueueHandle<Self>,
548 ) {
549 match event {
550 wl_output::Event::Geometry { .. } => (),
551 wl_output::Event::Mode { .. } => (),
552 wl_output::Event::Done => (),
553 wl_output::Event::Scale { .. } => (),
554 wl_output::Event::Name { name } => {
555 *state.outputs.get_mut(output).unwrap() = name;
556 }
557 wl_output::Event::Description { .. } => (),
558 _ => unreachable!(),
559 }
560 }
561}
562
563impl Dispatch<WlCompositor, ()> for State {
564 fn event(
565 _state: &mut Self,
566 _proxy: &WlCompositor,
567 _event: <WlCompositor as wayland_client::Proxy>::Event,
568 _data: &(),
569 _conn: &Connection,
570 _qhandle: &QueueHandle<Self>,
571 ) {
572 unreachable!()
573 }
574}
575
576impl Dispatch<XdgWmBase, ()> for State {
577 fn event(
578 _state: &mut Self,
579 xdg_wm_base: &XdgWmBase,
580 event: <XdgWmBase as wayland_client::Proxy>::Event,
581 _data: &(),
582 _conn: &Connection,
583 _qhandle: &QueueHandle<Self>,
584 ) {
585 match event {
586 xdg_wm_base::Event::Ping { serial } => {
587 xdg_wm_base.pong(serial);
588 }
589 _ => unreachable!(),
590 }
591 }
592}
593
594impl Dispatch<ZwlrLayerShellV1, ()> for State {
595 fn event(
596 _state: &mut Self,
597 _proxy: &ZwlrLayerShellV1,
598 _event: <ZwlrLayerShellV1 as wayland_client::Proxy>::Event,
599 _data: &(),
600 _conn: &Connection,
601 _qhandle: &QueueHandle<Self>,
602 ) {
603 unreachable!()
604 }
605}
606
607impl Dispatch<WlSurface, ()> for State {
608 fn event(
609 _state: &mut Self,
610 _proxy: &WlSurface,
611 event: <WlSurface as wayland_client::Proxy>::Event,
612 _data: &(),
613 _conn: &Connection,
614 _qhandle: &QueueHandle<Self>,
615 ) {
616 match event {
617 wl_surface::Event::Enter { .. } => (),
618 wl_surface::Event::Leave { .. } => (),
619 wl_surface::Event::PreferredBufferScale { .. } => (),
620 wl_surface::Event::PreferredBufferTransform { .. } => (),
621 _ => unreachable!(),
622 }
623 }
624}
625
626impl Dispatch<XdgSurface, ()> for State {
627 fn event(
628 state: &mut Self,
629 xdg_surface: &XdgSurface,
630 event: <XdgSurface as wayland_client::Proxy>::Event,
631 _data: &(),
632 _conn: &Connection,
633 _qhandle: &QueueHandle<Self>,
634 ) {
635 match event {
636 xdg_surface::Event::Configure { serial } => {
637 let window = state
638 .windows
639 .iter_mut()
640 .find(|w| w.xdg_surface == *xdg_surface)
641 .unwrap();
642 let configure = window.pending_configure.clone();
643 window.configures_received.push((serial, configure));
644 }
645 _ => unreachable!(),
646 }
647 }
648}
649
650impl Dispatch<XdgToplevel, ()> for State {
651 fn event(
652 state: &mut Self,
653 xdg_toplevel: &XdgToplevel,
654 event: <XdgToplevel as wayland_client::Proxy>::Event,
655 _data: &(),
656 _conn: &Connection,
657 _qhandle: &QueueHandle<Self>,
658 ) {
659 let window = state
660 .windows
661 .iter_mut()
662 .find(|w| w.xdg_toplevel == *xdg_toplevel)
663 .unwrap();
664
665 match event {
666 xdg_toplevel::Event::Configure {
667 width,
668 height,
669 states,
670 } => {
671 let configure = &mut window.pending_configure;
672 configure.size = (width, height);
673 configure.states = states
674 .chunks_exact(4)
675 .flat_map(TryInto::<[u8; 4]>::try_into)
676 .map(u32::from_ne_bytes)
677 .flat_map(xdg_toplevel::State::try_from)
678 .collect();
679 }
680 xdg_toplevel::Event::Close => {
681 window.close_requested = true;
682 }
683 xdg_toplevel::Event::ConfigureBounds { width, height } => {
684 window.pending_configure.bounds = Some((width, height));
685 }
686 xdg_toplevel::Event::WmCapabilities { .. } => (),
687 _ => unreachable!(),
688 }
689 }
690}
691
692impl Dispatch<ZwlrLayerSurfaceV1, ()> for State {
693 fn event(
694 state: &mut Self,
695 layer_surface: &ZwlrLayerSurfaceV1,
696 event: <ZwlrLayerSurfaceV1 as wayland_client::Proxy>::Event,
697 _data: &(),
698 _conn: &Connection,
699 _qhandle: &QueueHandle<Self>,
700 ) {
701 let layer_surface = state
702 .layers
703 .iter_mut()
704 .find(|w| w.layer_surface == *layer_surface)
705 .unwrap();
706
707 match event {
708 zwlr_layer_surface_v1::Event::Configure {
709 serial,
710 width,
711 height,
712 } => {
713 let configure = LayerConfigure {
714 size: (width, height),
715 };
716 layer_surface.configures_received.push((serial, configure));
717 }
718 zwlr_layer_surface_v1::Event::Closed => layer_surface.close_requested = true,
719 _ => unreachable!(),
720 }
721 }
722}
723
724impl Dispatch<WlBuffer, ()> for State {
725 fn event(
726 _state: &mut Self,
727 _proxy: &WlBuffer,
728 event: <WlBuffer as wayland_client::Proxy>::Event,
729 _data: &(),
730 _conn: &Connection,
731 _qhandle: &QueueHandle<Self>,
732 ) {
733 match event {
734 wl_buffer::Event::Release => (),
735 _ => unreachable!(),
736 }
737 }
738}
739
740impl Dispatch<WpSinglePixelBufferManagerV1, ()> for State {
741 fn event(
742 _state: &mut Self,
743 _proxy: &WpSinglePixelBufferManagerV1,
744 _event: <WpSinglePixelBufferManagerV1 as wayland_client::Proxy>::Event,
745 _data: &(),
746 _conn: &Connection,
747 _qhandle: &QueueHandle<Self>,
748 ) {
749 unreachable!()
750 }
751}
752
753impl Dispatch<WpViewporter, ()> for State {
754 fn event(
755 _state: &mut Self,
756 _proxy: &WpViewporter,
757 _event: <WpViewporter as wayland_client::Proxy>::Event,
758 _data: &(),
759 _conn: &Connection,
760 _qhandle: &QueueHandle<Self>,
761 ) {
762 unreachable!()
763 }
764}
765
766impl Dispatch<WpViewport, ()> for State {
767 fn event(
768 _state: &mut Self,
769 _proxy: &WpViewport,
770 _event: <WpViewport as wayland_client::Proxy>::Event,
771 _data: &(),
772 _conn: &Connection,
773 _qhandle: &QueueHandle<Self>,
774 ) {
775 unreachable!()
776 }
777}