forge
Explore
Log in

Don't you dare go Hollow

niri

Clone
★ 0

0 watching0 forksRustGPL-3.012.1 MiBad3847fIvan Molodetskikh1 year ago2457 commits

client.rs769 lines, 22.6 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_parent(&self, parent: Option<&XdgToplevel>) {
361 self.xdg_toplevel.set_parent(parent);
362 }
363
364 pub fn set_title(&self, title: &str) {
365 self.xdg_toplevel.set_title(title.to_owned());
366 }
367
368 pub fn recent_configures(&mut self) -> impl Iterator<Item = &Configure> {
369 let start = self.configures_looked_at;
370 self.configures_looked_at = self.configures_received.len();
371 self.configures_received[start..].iter().map(|(_, c)| c)
372 }
373
374 pub fn format_recent_configures(&mut self) -> String {
375 let mut buf = String::new();
376 for configure in self.recent_configures() {
377 if !buf.is_empty() {
378 buf.push('\n');
379 }
380 write!(buf, "{configure}").unwrap();
381 }
382 buf
383 }
384}
385
386impl LayerSurface {
387 pub fn commit(&self) {
388 self.surface.commit();
389 }
390
391 pub fn ack_last(&self) {
392 let serial = self.configures_received.last().unwrap().0;
393 self.layer_surface.ack_configure(serial);
394 }
395
396 pub fn ack_last_and_commit(&self) {
397 self.ack_last();
398 self.commit();
399 }
400
401 pub fn set_configure_props(&self, props: LayerConfigureProps) {
402 let LayerConfigureProps {
403 size,
404 anchor,
405 exclusive_zone,
406 margin,
407 kb_interactivity,
408 layer,
409 exclusive_edge,
410 } = props;
411
412 if let Some(x) = size {
413 self.layer_surface.set_size(x.0, x.1);
414 }
415 if let Some(x) = anchor {
416 self.layer_surface.set_anchor(x);
417 }
418 if let Some(x) = exclusive_zone {
419 self.layer_surface.set_exclusive_zone(x);
420 }
421 if let Some(x) = margin {
422 self.layer_surface
423 .set_margin(x.top, x.right, x.bottom, x.left);
424 }
425 if let Some(x) = kb_interactivity {
426 self.layer_surface.set_keyboard_interactivity(x);
427 }
428 if let Some(x) = layer {
429 self.layer_surface.set_layer(x);
430 }
431 if let Some(x) = exclusive_edge {
432 self.layer_surface.set_exclusive_edge(x);
433 }
434 }
435
436 pub fn attach_new_buffer(&self) {
437 let buffer = self.spbm.create_u32_rgba_buffer(0, 0, 0, 0, &self.qh, ());
438 self.surface.attach(Some(&buffer), 0, 0);
439 }
440
441 pub fn attach_null(&self) {
442 self.surface.attach(None, 0, 0);
443 }
444
445 pub fn set_size(&self, w: u16, h: u16) {
446 self.viewport.set_destination(i32::from(w), i32::from(h));
447 }
448
449 pub fn recent_configures(&mut self) -> impl Iterator<Item = &LayerConfigure> {
450 let start = self.configures_looked_at;
451 self.configures_looked_at = self.configures_received.len();
452 self.configures_received[start..].iter().map(|(_, c)| c)
453 }
454
455 pub fn format_recent_configures(&mut self) -> String {
456 let mut buf = String::new();
457 for configure in self.recent_configures() {
458 if !buf.is_empty() {
459 buf.push('\n');
460 }
461 write!(buf, "{configure}").unwrap();
462 }
463 buf
464 }
465}
466
467impl Dispatch<WlCallback, Arc<SyncData>> for State {
468 fn event(
469 _state: &mut Self,
470 _proxy: &WlCallback,
471 event: <WlCallback as wayland_client::Proxy>::Event,
472 data: &Arc<SyncData>,
473 _conn: &Connection,
474 _qhandle: &QueueHandle<Self>,
475 ) {
476 match event {
477 wl_callback::Event::Done { .. } => data.done.store(true, Ordering::Relaxed),
478 _ => unreachable!(),
479 }
480 }
481}
482
483impl Dispatch<WlRegistry, ()> for State {
484 fn event(
485 state: &mut Self,
486 registry: &WlRegistry,
487 event: <WlRegistry as wayland_client::Proxy>::Event,
488 _data: &(),
489 _conn: &Connection,
490 qh: &QueueHandle<Self>,
491 ) {
492 match event {
493 wl_registry::Event::Global {
494 name,
495 interface,
496 version,
497 } => {
498 if interface == WlCompositor::interface().name {
499 let version = min(version, WlCompositor::interface().version);
500 state.compositor = Some(registry.bind(name, version, qh, ()));
501 } else if interface == XdgWmBase::interface().name {
502 let version = min(version, XdgWmBase::interface().version);
503 state.xdg_wm_base = Some(registry.bind(name, version, qh, ()));
504 } else if interface == ZwlrLayerShellV1::interface().name {
505 let version = min(version, ZwlrLayerShellV1::interface().version);
506 state.layer_shell = Some(registry.bind(name, version, qh, ()));
507 } else if interface == WpSinglePixelBufferManagerV1::interface().name {
508 let version = min(version, WpSinglePixelBufferManagerV1::interface().version);
509 state.spbm = Some(registry.bind(name, version, qh, ()));
510 } else if interface == WpViewporter::interface().name {
511 let version = min(version, WpViewporter::interface().version);
512 state.viewporter = Some(registry.bind(name, version, qh, ()));
513 } else if interface == WlOutput::interface().name {
514 let version = min(version, WlOutput::interface().version);
515 let output = registry.bind(name, version, qh, ());
516 state.outputs.insert(output, String::new());
517 }
518
519 let global = Global {
520 name,
521 interface,
522 version,
523 };
524 state.globals.push(global);
525 }
526 wl_registry::Event::GlobalRemove { .. } => (),
527 _ => unreachable!(),
528 }
529 }
530}
531
532impl Dispatch<WlOutput, ()> for State {
533 fn event(
534 state: &mut Self,
535 output: &WlOutput,
536 event: <WlOutput as wayland_client::Proxy>::Event,
537 _data: &(),
538 _conn: &Connection,
539 _qhandle: &QueueHandle<Self>,
540 ) {
541 match event {
542 wl_output::Event::Geometry { .. } => (),
543 wl_output::Event::Mode { .. } => (),
544 wl_output::Event::Done => (),
545 wl_output::Event::Scale { .. } => (),
546 wl_output::Event::Name { name } => {
547 *state.outputs.get_mut(output).unwrap() = name;
548 }
549 wl_output::Event::Description { .. } => (),
550 _ => unreachable!(),
551 }
552 }
553}
554
555impl Dispatch<WlCompositor, ()> for State {
556 fn event(
557 _state: &mut Self,
558 _proxy: &WlCompositor,
559 _event: <WlCompositor as wayland_client::Proxy>::Event,
560 _data: &(),
561 _conn: &Connection,
562 _qhandle: &QueueHandle<Self>,
563 ) {
564 unreachable!()
565 }
566}
567
568impl Dispatch<XdgWmBase, ()> for State {
569 fn event(
570 _state: &mut Self,
571 xdg_wm_base: &XdgWmBase,
572 event: <XdgWmBase as wayland_client::Proxy>::Event,
573 _data: &(),
574 _conn: &Connection,
575 _qhandle: &QueueHandle<Self>,
576 ) {
577 match event {
578 xdg_wm_base::Event::Ping { serial } => {
579 xdg_wm_base.pong(serial);
580 }
581 _ => unreachable!(),
582 }
583 }
584}
585
586impl Dispatch<ZwlrLayerShellV1, ()> for State {
587 fn event(
588 _state: &mut Self,
589 _proxy: &ZwlrLayerShellV1,
590 _event: <ZwlrLayerShellV1 as wayland_client::Proxy>::Event,
591 _data: &(),
592 _conn: &Connection,
593 _qhandle: &QueueHandle<Self>,
594 ) {
595 unreachable!()
596 }
597}
598
599impl Dispatch<WlSurface, ()> for State {
600 fn event(
601 _state: &mut Self,
602 _proxy: &WlSurface,
603 event: <WlSurface as wayland_client::Proxy>::Event,
604 _data: &(),
605 _conn: &Connection,
606 _qhandle: &QueueHandle<Self>,
607 ) {
608 match event {
609 wl_surface::Event::Enter { .. } => (),
610 wl_surface::Event::Leave { .. } => (),
611 wl_surface::Event::PreferredBufferScale { .. } => (),
612 wl_surface::Event::PreferredBufferTransform { .. } => (),
613 _ => unreachable!(),
614 }
615 }
616}
617
618impl Dispatch<XdgSurface, ()> for State {
619 fn event(
620 state: &mut Self,
621 xdg_surface: &XdgSurface,
622 event: <XdgSurface as wayland_client::Proxy>::Event,
623 _data: &(),
624 _conn: &Connection,
625 _qhandle: &QueueHandle<Self>,
626 ) {
627 match event {
628 xdg_surface::Event::Configure { serial } => {
629 let window = state
630 .windows
631 .iter_mut()
632 .find(|w| w.xdg_surface == *xdg_surface)
633 .unwrap();
634 let configure = window.pending_configure.clone();
635 window.configures_received.push((serial, configure));
636 }
637 _ => unreachable!(),
638 }
639 }
640}
641
642impl Dispatch<XdgToplevel, ()> for State {
643 fn event(
644 state: &mut Self,
645 xdg_toplevel: &XdgToplevel,
646 event: <XdgToplevel as wayland_client::Proxy>::Event,
647 _data: &(),
648 _conn: &Connection,
649 _qhandle: &QueueHandle<Self>,
650 ) {
651 let window = state
652 .windows
653 .iter_mut()
654 .find(|w| w.xdg_toplevel == *xdg_toplevel)
655 .unwrap();
656
657 match event {
658 xdg_toplevel::Event::Configure {
659 width,
660 height,
661 states,
662 } => {
663 let configure = &mut window.pending_configure;
664 configure.size = (width, height);
665 configure.states = states
666 .chunks_exact(4)
667 .flat_map(TryInto::<[u8; 4]>::try_into)
668 .map(u32::from_ne_bytes)
669 .flat_map(xdg_toplevel::State::try_from)
670 .collect();
671 }
672 xdg_toplevel::Event::Close => {
673 window.close_requested = true;
674 }
675 xdg_toplevel::Event::ConfigureBounds { width, height } => {
676 window.pending_configure.bounds = Some((width, height));
677 }
678 xdg_toplevel::Event::WmCapabilities { .. } => (),
679 _ => unreachable!(),
680 }
681 }
682}
683
684impl Dispatch<ZwlrLayerSurfaceV1, ()> for State {
685 fn event(
686 state: &mut Self,
687 layer_surface: &ZwlrLayerSurfaceV1,
688 event: <ZwlrLayerSurfaceV1 as wayland_client::Proxy>::Event,
689 _data: &(),
690 _conn: &Connection,
691 _qhandle: &QueueHandle<Self>,
692 ) {
693 let layer_surface = state
694 .layers
695 .iter_mut()
696 .find(|w| w.layer_surface == *layer_surface)
697 .unwrap();
698
699 match event {
700 zwlr_layer_surface_v1::Event::Configure {
701 serial,
702 width,
703 height,
704 } => {
705 let configure = LayerConfigure {
706 size: (width, height),
707 };
708 layer_surface.configures_received.push((serial, configure));
709 }
710 zwlr_layer_surface_v1::Event::Closed => layer_surface.close_requested = true,
711 _ => unreachable!(),
712 }
713 }
714}
715
716impl Dispatch<WlBuffer, ()> for State {
717 fn event(
718 _state: &mut Self,
719 _proxy: &WlBuffer,
720 event: <WlBuffer as wayland_client::Proxy>::Event,
721 _data: &(),
722 _conn: &Connection,
723 _qhandle: &QueueHandle<Self>,
724 ) {
725 match event {
726 wl_buffer::Event::Release => (),
727 _ => unreachable!(),
728 }
729 }
730}
731
732impl Dispatch<WpSinglePixelBufferManagerV1, ()> for State {
733 fn event(
734 _state: &mut Self,
735 _proxy: &WpSinglePixelBufferManagerV1,
736 _event: <WpSinglePixelBufferManagerV1 as wayland_client::Proxy>::Event,
737 _data: &(),
738 _conn: &Connection,
739 _qhandle: &QueueHandle<Self>,
740 ) {
741 unreachable!()
742 }
743}
744
745impl Dispatch<WpViewporter, ()> for State {
746 fn event(
747 _state: &mut Self,
748 _proxy: &WpViewporter,
749 _event: <WpViewporter as wayland_client::Proxy>::Event,
750 _data: &(),
751 _conn: &Connection,
752 _qhandle: &QueueHandle<Self>,
753 ) {
754 unreachable!()
755 }
756}
757
758impl Dispatch<WpViewport, ()> for State {
759 fn event(
760 _state: &mut Self,
761 _proxy: &WpViewport,
762 _event: <WpViewport as wayland_client::Proxy>::Event,
763 _data: &(),
764 _conn: &Connection,
765 _qhandle: &QueueHandle<Self>,
766 ) {
767 unreachable!()
768 }
769}