Skip to content

Commit 1d4358a

Browse files
committed
anvil: Fix compiling without xwayland
1 parent a170f84 commit 1d4358a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

anvil/src/focus.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use std::{borrow::Cow, sync::Arc};
22

3+
#[cfg(feature = "xwayland")]
4+
use smithay::xwayland::xwm::XwmOfferData;
35
#[cfg(feature = "xwayland")]
46
use smithay::xwayland::X11Surface;
57
pub use smithay::{
@@ -27,7 +29,6 @@ use smithay::{
2729
reexports::wayland_server::DisplayHandle,
2830
utils::{Logical, Point},
2931
wayland::selection::data_device::WlOfferData,
30-
xwayland::xwm::XwmOfferData,
3132
};
3233

3334
use crate::{
@@ -376,32 +377,37 @@ impl WaylandFocus for KeyboardFocusTarget {
376377

377378
pub enum AnvilOfferData<S: Source> {
378379
Wayland(WlOfferData<S>),
380+
#[cfg(feature = "xwayland")]
379381
X11(XwmOfferData<S>),
380382
}
381383

382384
impl<S: Source> OfferData for AnvilOfferData<S> {
383385
fn disable(&self) {
384386
match self {
385387
AnvilOfferData::Wayland(data) => data.disable(),
388+
#[cfg(feature = "xwayland")]
386389
AnvilOfferData::X11(data) => data.disable(),
387390
}
388391
}
389392

390393
fn drop(&self) {
391394
match self {
392395
AnvilOfferData::Wayland(data) => data.drop(),
396+
#[cfg(feature = "xwayland")]
393397
AnvilOfferData::X11(data) => data.drop(),
394398
}
395399
}
396400

397401
fn validated(&self) -> bool {
398402
match self {
399403
AnvilOfferData::Wayland(data) => data.validated(),
404+
#[cfg(feature = "xwayland")]
400405
AnvilOfferData::X11(data) => data.validated(),
401406
}
402407
}
403408
}
404409

410+
#[allow(unreachable_patterns)]
405411
impl<BackendData: Backend> DndFocus<AnvilState<BackendData>> for PointerFocusTarget {
406412
type OfferData<S>
407413
= AnvilOfferData<S>
@@ -422,6 +428,7 @@ impl<BackendData: Backend> DndFocus<AnvilState<BackendData>> for PointerFocusTar
422428
DndFocus::enter(surface, data, dh, source, seat, location, serial)
423429
.map(AnvilOfferData::Wayland)
424430
}
431+
#[cfg(feature = "xwayland")]
425432
PointerFocusTarget::X11Surface(surface) => {
426433
DndFocus::enter(surface, data, dh, source, seat, location, serial).map(AnvilOfferData::X11)
427434
}
@@ -446,6 +453,7 @@ impl<BackendData: Backend> DndFocus<AnvilState<BackendData>> for PointerFocusTar
446453
};
447454
DndFocus::motion(surface, data, offer, seat, location, time)
448455
}
456+
#[cfg(feature = "xwayland")]
449457
PointerFocusTarget::X11Surface(surface) => {
450458
let offer = match offer {
451459
Some(AnvilOfferData::X11(ref mut offer)) => Some(offer),
@@ -473,6 +481,7 @@ impl<BackendData: Backend> DndFocus<AnvilState<BackendData>> for PointerFocusTar
473481
};
474482
DndFocus::leave(surface, data, offer, seat)
475483
}
484+
#[cfg(feature = "xwayland")]
476485
PointerFocusTarget::X11Surface(surface) => {
477486
let offer = match offer {
478487
Some(AnvilOfferData::X11(ref mut offer)) => Some(offer),
@@ -500,6 +509,7 @@ impl<BackendData: Backend> DndFocus<AnvilState<BackendData>> for PointerFocusTar
500509
};
501510
DndFocus::drop(surface, data, offer, seat)
502511
}
512+
#[cfg(feature = "xwayland")]
503513
PointerFocusTarget::X11Surface(surface) => {
504514
let offer = match offer {
505515
Some(AnvilOfferData::X11(ref mut offer)) => Some(offer),

anvil/src/state.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
#[cfg(feature = "xwayland")]
2+
use std::os::unix::io::OwnedFd;
13
use std::{
24
collections::HashMap,
3-
os::unix::io::OwnedFd,
45
sync::{atomic::AtomicBool, Arc},
56
time::Duration,
67
};

0 commit comments

Comments
 (0)