Update Smithay

This commit is contained in:
Ottatop 2024-02-29 16:28:25 -06:00
parent 49908df38b
commit 16fff3f7e3
14 changed files with 268 additions and 131 deletions

8
Cargo.lock generated
View file

@ -831,9 +831,9 @@ dependencies = [
[[package]]
name = "gbm"
version = "0.14.1"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f177420f6650dcd50042121adf7ff7ab265abdaf4862fe2624066e36e3a9ef34"
checksum = "313702b30cdeb83ddc72bc14dcee67803cd0ae2d12282ea06e368c25a900c844"
dependencies = [
"bitflags 1.3.2",
"drm",
@ -2053,7 +2053,7 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
[[package]]
name = "smithay"
version = "0.3.0"
source = "git+https://github.com/Smithay/smithay?rev=1074914#1074914492783b25a4c2c49ce49a126d39994596"
source = "git+https://github.com/Smithay/smithay?rev=418190e#418190e4992ce642e6bac873307d4fc4fa9a1e89"
dependencies = [
"appendlist",
"ash",
@ -2128,7 +2128,7 @@ dependencies = [
[[package]]
name = "smithay-drm-extras"
version = "0.1.0"
source = "git+https://github.com/Smithay/smithay?rev=1074914#1074914492783b25a4c2c49ce49a126d39994596"
source = "git+https://github.com/Smithay/smithay?rev=418190e#418190e4992ce642e6bac873307d4fc4fa9a1e89"
dependencies = [
"drm",
"edid-rs",

View file

@ -34,8 +34,8 @@ repository.workspace = true
keywords = ["wayland", "compositor", "smithay", "lua"]
[dependencies]
smithay = { git = "https://github.com/Smithay/smithay", rev = "1074914", default-features = false, features = ["desktop", "wayland_frontend"] }
smithay-drm-extras = { git = "https://github.com/Smithay/smithay", rev = "1074914" }
smithay = { git = "https://github.com/Smithay/smithay", rev = "418190e", default-features = false, features = ["desktop", "wayland_frontend"] }
smithay-drm-extras = { git = "https://github.com/Smithay/smithay", rev = "418190e" }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "registry"] }

View file

@ -1123,7 +1123,9 @@ impl window_service_server::WindowService for WindowService {
let Some(window) = window_id.window(state) else { return };
match window {
WindowElement::Wayland(window) => window.toplevel().send_close(),
WindowElement::Wayland(window) => {
window.toplevel().expect("in wayland enum").send_close()
}
WindowElement::X11(surface) => surface.close().expect("failed to close x11 win"),
WindowElement::X11OverrideRedirect(_) => {
tracing::warn!("tried to close override redirect window");
@ -1431,7 +1433,7 @@ impl window_service_server::WindowService for WindowService {
for window in state.space.elements() {
if let WindowElement::Wayland(window) = window {
window.toplevel().send_configure();
window.toplevel().expect("in wayland enum").send_configure();
}
}

View file

@ -91,8 +91,12 @@ const SUPPORTED_FORMATS: &[Fourcc] = &[
const SUPPORTED_FORMATS_8BIT_ONLY: &[Fourcc] = &[Fourcc::Abgr8888, Fourcc::Argb8888];
/// A [`MultiRenderer`] that uses the [`GbmGlesBackend`].
type UdevRenderer<'a, 'b> =
MultiRenderer<'a, 'a, 'b, GbmGlesBackend<GlesRenderer>, GbmGlesBackend<GlesRenderer>>;
type UdevRenderer<'a> = MultiRenderer<
'a,
'a,
GbmGlesBackend<GlesRenderer, DrmDeviceFd>,
GbmGlesBackend<GlesRenderer, DrmDeviceFd>,
>;
/// Udev state attached to each [`Output`].
#[derive(Debug, PartialEq)]
@ -110,7 +114,7 @@ pub struct Udev {
pub(super) dmabuf_state: Option<(DmabufState, DmabufGlobal)>,
pub(super) primary_gpu: DrmNode,
allocator: Option<Box<dyn Allocator<Buffer = Dmabuf, Error = AnyError>>>,
pub(super) gpu_manager: GpuManager<GbmGlesBackend<GlesRenderer>>,
pub(super) gpu_manager: GpuManager<GbmGlesBackend<GlesRenderer, DrmDeviceFd>>,
backends: HashMap<DrmNode, UdevBackendData>,
pointer_images: Vec<(xcursor::parser::Image, TextureBuffer<MultiTexture>)>,
pointer_element: PointerElement<MultiTexture>,
@ -226,10 +230,7 @@ impl BackendData for Udev {
}
fn early_import(&mut self, surface: &WlSurface) {
if let Err(err) =
self.gpu_manager
.early_import(Some(self.primary_gpu), self.primary_gpu, surface)
{
if let Err(err) = self.gpu_manager.early_import(self.primary_gpu, surface) {
tracing::warn!("early buffer import failed: {}", err);
}
}
@ -556,7 +557,7 @@ enum DeviceAddError {
fn get_surface_dmabuf_feedback(
primary_gpu: DrmNode,
render_node: DrmNode,
gpu_manager: &mut GpuManager<GbmGlesBackend<GlesRenderer>>,
gpu_manager: &mut GpuManager<GbmGlesBackend<GlesRenderer, DrmDeviceFd>>,
composition: &GbmDrmCompositor,
) -> Option<DrmSurfaceDmabufFeedback> {
let primary_formats = gpu_manager
@ -1210,18 +1211,8 @@ impl State {
udev.gpu_manager.single_renderer(&render_node)
} else {
let format = surface.compositor.format();
udev.gpu_manager.renderer(
&primary_gpu,
&render_node,
udev
.allocator
.as_mut()
// TODO: We could build some kind of `GLAllocator` using Renderbuffers in theory for this case.
// That would work for memcpy's of offscreen contents.
.expect("We need an allocator for multigpu systems")
.as_mut(),
format,
)
udev.gpu_manager
.renderer(&primary_gpu, &render_node, format)
}
.expect("failed to create MultiRenderer");
@ -1294,7 +1285,7 @@ fn render_surface_for_output<'a>(
#[allow(clippy::too_many_arguments)]
fn render_surface(
surface: &mut RenderSurface,
renderer: &mut UdevRenderer<'_, '_>,
renderer: &mut UdevRenderer<'_>,
output: &Output,
space: &Space<WindowElement>,

View file

@ -5,11 +5,12 @@ use smithay::{
input::{
keyboard::KeyboardTarget,
pointer::{MotionEvent, PointerTarget},
touch::{self, TouchTarget},
Seat,
},
output::Output,
reexports::wayland_server::{protocol::wl_surface::WlSurface, Resource},
utils::{IsAlive, SERIAL_COUNTER},
utils::{IsAlive, Serial, SERIAL_COUNTER},
wayland::seat::WaylandFocus,
};
@ -56,7 +57,7 @@ impl State {
assert!(!win.is_x11_override_redirect());
if let WindowElement::Wayland(w) = win {
w.toplevel().send_configure();
w.toplevel().expect("in wayland enum").send_configure();
}
}
@ -140,9 +141,9 @@ impl TryFrom<FocusTarget> for WlSurface {
impl PointerTarget<State> for FocusTarget {
fn frame(&self, seat: &Seat<State>, data: &mut State) {
match self {
FocusTarget::Window(window) => window.frame(seat, data),
FocusTarget::Popup(popup) => popup.wl_surface().frame(seat, data),
FocusTarget::LayerSurface(surf) => surf.frame(seat, data),
FocusTarget::Window(window) => PointerTarget::frame(window, seat, data),
FocusTarget::Popup(popup) => PointerTarget::frame(popup.wl_surface(), seat, data),
FocusTarget::LayerSurface(surf) => PointerTarget::frame(surf.wl_surface(), seat, data),
}
}
@ -152,7 +153,9 @@ impl PointerTarget<State> for FocusTarget {
FocusTarget::Popup(popup) => {
PointerTarget::enter(popup.wl_surface(), seat, data, event);
}
FocusTarget::LayerSurface(surf) => PointerTarget::enter(surf, seat, data, event),
FocusTarget::LayerSurface(surf) => {
PointerTarget::enter(surf.wl_surface(), seat, data, event)
}
}
}
@ -162,7 +165,9 @@ impl PointerTarget<State> for FocusTarget {
FocusTarget::Popup(popup) => {
PointerTarget::motion(popup.wl_surface(), seat, data, event);
}
FocusTarget::LayerSurface(surf) => PointerTarget::motion(surf, seat, data, event),
FocusTarget::LayerSurface(surf) => {
PointerTarget::motion(surf.wl_surface(), seat, data, event)
}
}
}
@ -180,7 +185,7 @@ impl PointerTarget<State> for FocusTarget {
PointerTarget::relative_motion(popup.wl_surface(), seat, data, event);
}
FocusTarget::LayerSurface(surf) => {
PointerTarget::relative_motion(surf, seat, data, event);
PointerTarget::relative_motion(surf.wl_surface(), seat, data, event);
}
}
}
@ -196,7 +201,9 @@ impl PointerTarget<State> for FocusTarget {
FocusTarget::Popup(popup) => {
PointerTarget::button(popup.wl_surface(), seat, data, event);
}
FocusTarget::LayerSurface(surf) => PointerTarget::button(surf, seat, data, event),
FocusTarget::LayerSurface(surf) => {
PointerTarget::button(surf.wl_surface(), seat, data, event)
}
}
}
@ -209,23 +216,21 @@ impl PointerTarget<State> for FocusTarget {
match self {
FocusTarget::Window(window) => PointerTarget::axis(window, seat, data, frame),
FocusTarget::Popup(popup) => PointerTarget::axis(popup.wl_surface(), seat, data, frame),
FocusTarget::LayerSurface(surf) => PointerTarget::axis(surf, seat, data, frame),
FocusTarget::LayerSurface(surf) => {
PointerTarget::axis(surf.wl_surface(), seat, data, frame)
}
}
}
fn leave(
&self,
seat: &Seat<State>,
data: &mut State,
serial: smithay::utils::Serial,
time: u32,
) {
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial, time: u32) {
match self {
FocusTarget::Window(window) => PointerTarget::leave(window, seat, data, serial, time),
FocusTarget::Popup(popup) => {
PointerTarget::leave(popup.wl_surface(), seat, data, serial, time);
}
FocusTarget::LayerSurface(surf) => PointerTarget::leave(surf, seat, data, serial, time),
FocusTarget::LayerSurface(surf) => {
PointerTarget::leave(surf.wl_surface(), seat, data, serial, time)
}
}
}
@ -308,7 +313,7 @@ impl KeyboardTarget<State> for FocusTarget {
seat: &Seat<State>,
data: &mut State,
keys: Vec<smithay::input::keyboard::KeysymHandle<'_>>,
serial: smithay::utils::Serial,
serial: Serial,
) {
match self {
FocusTarget::Window(window) => KeyboardTarget::enter(window, seat, data, keys, serial),
@ -316,18 +321,20 @@ impl KeyboardTarget<State> for FocusTarget {
KeyboardTarget::enter(popup.wl_surface(), seat, data, keys, serial);
}
FocusTarget::LayerSurface(surf) => {
KeyboardTarget::enter(surf, seat, data, keys, serial);
KeyboardTarget::enter(surf.wl_surface(), seat, data, keys, serial);
}
}
}
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: smithay::utils::Serial) {
fn leave(&self, seat: &Seat<State>, data: &mut State, serial: Serial) {
match self {
FocusTarget::Window(window) => KeyboardTarget::leave(window, seat, data, serial),
FocusTarget::Popup(popup) => {
KeyboardTarget::leave(popup.wl_surface(), seat, data, serial);
}
FocusTarget::LayerSurface(surf) => KeyboardTarget::leave(surf, seat, data, serial),
FocusTarget::LayerSurface(surf) => {
KeyboardTarget::leave(surf.wl_surface(), seat, data, serial)
}
}
}
@ -337,7 +344,7 @@ impl KeyboardTarget<State> for FocusTarget {
data: &mut State,
key: smithay::input::keyboard::KeysymHandle<'_>,
state: smithay::backend::input::KeyState,
serial: smithay::utils::Serial,
serial: Serial,
time: u32,
) {
match self {
@ -348,7 +355,7 @@ impl KeyboardTarget<State> for FocusTarget {
KeyboardTarget::key(popup.wl_surface(), seat, data, key, state, serial, time);
}
FocusTarget::LayerSurface(surf) => {
KeyboardTarget::key(surf, seat, data, key, state, serial, time);
KeyboardTarget::key(surf.wl_surface(), seat, data, key, state, serial, time);
}
}
}
@ -358,7 +365,7 @@ impl KeyboardTarget<State> for FocusTarget {
seat: &Seat<State>,
data: &mut State,
modifiers: smithay::input::keyboard::ModifiersState,
serial: smithay::utils::Serial,
serial: Serial,
) {
match self {
FocusTarget::Window(window) => {
@ -368,12 +375,54 @@ impl KeyboardTarget<State> for FocusTarget {
KeyboardTarget::modifiers(popup.wl_surface(), seat, data, modifiers, serial);
}
FocusTarget::LayerSurface(surf) => {
KeyboardTarget::modifiers(surf, seat, data, modifiers, serial);
KeyboardTarget::modifiers(surf.wl_surface(), seat, data, modifiers, serial);
}
}
}
}
impl TouchTarget<State> for FocusTarget {
fn down(&self, seat: &Seat<State>, data: &mut State, event: &touch::DownEvent, seq: Serial) {
todo!()
}
fn up(&self, seat: &Seat<State>, data: &mut State, event: &touch::UpEvent, seq: Serial) {
todo!()
}
fn motion(
&self,
seat: &Seat<State>,
data: &mut State,
event: &touch::MotionEvent,
seq: Serial,
) {
todo!()
}
fn frame(&self, seat: &Seat<State>, data: &mut State, seq: Serial) {
todo!()
}
fn cancel(&self, seat: &Seat<State>, data: &mut State, seq: Serial) {
todo!()
}
fn shape(&self, seat: &Seat<State>, data: &mut State, event: &touch::ShapeEvent, seq: Serial) {
todo!()
}
fn orientation(
&self,
seat: &Seat<State>,
data: &mut State,
event: &touch::OrientationEvent,
seq: Serial,
) {
todo!()
}
}
impl WaylandFocus for FocusTarget {
fn wl_surface(&self) -> Option<WlSurface> {
match self {

View file

@ -160,7 +160,7 @@ impl PointerGrab<State> for ResizeSurfaceGrab {
match &self.window {
WindowElement::Wayland(window) => {
let toplevel_surface = window.toplevel();
let toplevel_surface = window.toplevel().expect("in wayland enum");
toplevel_surface.with_pending_state(|state| {
state.states.set(xdg_toplevel::State::Resizing);
@ -210,7 +210,7 @@ impl PointerGrab<State> for ResizeSurfaceGrab {
match &self.window {
WindowElement::Wayland(window) => {
let toplevel_surface = window.toplevel();
let toplevel_surface = window.toplevel().expect("in wayland enum");
toplevel_surface.with_pending_state(|state| {
state.states.unset(xdg_toplevel::State::Resizing);
state.size = Some(self.last_window_size);
@ -459,11 +459,17 @@ pub fn resize_request_client(
let initial_window_size = window.geometry().size;
if let Some(WindowElement::Wayland(window)) = state.window_for_surface(surface) {
window.toplevel().with_pending_state(|state| {
state.states.set(xdg_toplevel::State::Resizing);
});
window
.toplevel()
.expect("in wayland enum")
.with_pending_state(|state| {
state.states.set(xdg_toplevel::State::Resizing);
});
window.toplevel().send_pending_configure();
window
.toplevel()
.expect("in wayland enum")
.send_pending_configure();
}
let grab = ResizeSurfaceGrab::start(
@ -507,11 +513,17 @@ pub fn resize_request_server(
let initial_window_size = window.geometry().size;
if let Some(WindowElement::Wayland(window)) = state.window_for_surface(surface) {
window.toplevel().with_pending_state(|state| {
state.states.set(xdg_toplevel::State::Resizing);
});
window
.toplevel()
.expect("in wayland enum")
.with_pending_state(|state| {
state.states.set(xdg_toplevel::State::Resizing);
});
window.toplevel().send_pending_configure();
window
.toplevel()
.expect("in wayland enum")
.send_pending_configure();
}
let start_data = smithay::input::pointer::GrabStartData {

View file

@ -194,7 +194,7 @@ impl CompositorHandler for State {
if !initial_configure_sent {
tracing::debug!("Initial configure");
window.toplevel().send_configure();
window.toplevel().expect("in wayland enum").send_configure();
}
}
@ -280,7 +280,7 @@ fn ensure_initial_configure(surface: &WlSurface, state: &mut State) {
if !initial_configure_sent {
tracing::debug!("Initial configure");
window.toplevel().send_configure();
window.toplevel().expect("in wayland enum").send_configure();
}
}
return;
@ -406,6 +406,7 @@ delegate_data_control!(State);
impl SeatHandler for State {
type KeyboardFocus = FocusTarget;
type PointerFocus = FocusTarget;
type TouchFocus = FocusTarget;
fn seat_state(&mut self) -> &mut SeatState<Self> {
&mut self.seat_state

View file

@ -41,7 +41,7 @@ impl XdgShellHandler for State {
state.states.set(xdg_toplevel::State::TiledRight);
});
let window = WindowElement::Wayland(Window::new(surface.clone()));
let window = WindowElement::Wayland(Window::new_wayland_window(surface.clone()));
self.new_windows.push(window);
// if let (Some(output), _) | (None, Some(output)) = (
@ -139,7 +139,7 @@ impl XdgShellHandler for State {
self.space.raise_element(win, true);
self.z_index_stack.set_focus(win.clone());
if let WindowElement::Wayland(win) = &win {
win.toplevel().send_configure();
win.toplevel().expect("in wayland enum").send_configure();
}
}
self.seat

View file

@ -179,7 +179,7 @@ impl XwmHandler for State {
self.space.raise_element(win, true);
self.z_index_stack.set_focus(win.clone());
if let WindowElement::Wayland(win) = &win {
win.toplevel().send_configure();
win.toplevel().expect("in wayland enum").send_configure();
}
}
@ -242,7 +242,7 @@ impl XwmHandler for State {
self.space.raise_element(win, true);
self.z_index_stack.set_focus(win.clone());
if let WindowElement::Wayland(win) = &win {
win.toplevel().send_configure();
win.toplevel().expect("in wayland enum").send_configure();
}
}

View file

@ -358,7 +358,7 @@ impl State {
for window in self.space.elements() {
if let WindowElement::Wayland(window) = window {
window.toplevel().send_configure();
window.toplevel().expect("in wayland enum").send_configure();
}
}
} else {
@ -368,7 +368,7 @@ impl State {
for window in state.focus_stack.stack.iter() {
window.set_activate(false);
if let WindowElement::Wayland(window) = window {
window.toplevel().send_configure();
window.toplevel().expect("in wayland enum").send_configure();
}
}
});

View file

@ -117,8 +117,9 @@ impl State {
if win.with_state(|state| state.target_loc.is_some()) {
match win {
WindowElement::Wayland(wl_win) => {
let pending =
compositor::with_states(wl_win.toplevel().wl_surface(), |states| {
let pending = compositor::with_states(
wl_win.toplevel().expect("in wayland enum").wl_surface(),
|states| {
states
.data_map
.get::<XdgToplevelSurfaceData>()
@ -126,10 +127,14 @@ impl State {
.lock()
.expect("Failed to lock Mutex<XdgToplevelSurfaceData>")
.has_pending_changes()
});
},
);
if pending {
pending_wins.push((win.clone(), wl_win.toplevel().send_configure()))
pending_wins.push((
win.clone(),
wl_win.toplevel().expect("in wayland enum").send_configure(),
))
} else {
let loc = win.with_state(|state| state.target_loc.take());
if let Some(loc) = loc {

View file

@ -310,6 +310,7 @@ where
if let WindowElement::Wayland(window) = win {
window
.toplevel()
.expect("in wayland enum")
.current_state()
.states
.contains(xdg_toplevel::State::Fullscreen)

View file

@ -193,9 +193,12 @@ impl WindowElement {
pub fn change_geometry(&self, new_geo: Rectangle<i32, Logical>) {
match self {
WindowElement::Wayland(window) => {
window.toplevel().with_pending_state(|state| {
state.size = Some(new_geo.size);
});
window
.toplevel()
.expect("in wayland enum")
.with_pending_state(|state| {
state.size = Some(new_geo.size);
});
}
WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => {
// TODO: maybe move this check elsewhere idk
@ -217,8 +220,9 @@ impl WindowElement {
pub fn class(&self) -> Option<String> {
match self {
WindowElement::Wayland(window) => {
compositor::with_states(window.toplevel().wl_surface(), |states| {
WindowElement::Wayland(window) => compositor::with_states(
window.toplevel().expect("in wayland enum").wl_surface(),
|states| {
states
.data_map
.get::<XdgToplevelSurfaceData>()
@ -227,8 +231,8 @@ impl WindowElement {
.expect("Failed to lock Mutex<XdgToplevelSurfaceData>")
.app_id
.clone()
})
}
},
),
WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => {
Some(surface.class())
}
@ -238,8 +242,9 @@ impl WindowElement {
pub fn title(&self) -> Option<String> {
match self {
WindowElement::Wayland(window) => {
compositor::with_states(window.toplevel().wl_surface(), |states| {
WindowElement::Wayland(window) => compositor::with_states(
window.toplevel().expect("in wayland enum").wl_surface(),
|states| {
states
.data_map
.get::<XdgToplevelSurfaceData>()
@ -248,8 +253,8 @@ impl WindowElement {
.expect("Failed to lock Mutex<XdgToplevelSurfaceData>")
.title
.clone()
})
}
},
),
WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => {
Some(surface.title())
}
@ -335,7 +340,10 @@ impl WindowElement {
impl PointerTarget<State> for WindowElement {
fn frame(&self, seat: &Seat<State>, state: &mut State) {
match self {
WindowElement::Wayland(window) => window.frame(seat, state),
WindowElement::Wayland(window) => window
.wl_surface()
.expect("in wayland enum")
.frame(seat, state),
WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => {
surface.frame(seat, state)
}
@ -346,7 +354,12 @@ impl PointerTarget<State> for WindowElement {
fn enter(&self, seat: &Seat<State>, state: &mut State, event: &MotionEvent) {
// TODO: ssd
match self {
WindowElement::Wayland(window) => PointerTarget::enter(window, seat, state, event),
WindowElement::Wayland(window) => PointerTarget::enter(
&window.wl_surface().expect("in wayland enum"),
seat,
state,
event,
),
WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => {
PointerTarget::enter(surface, seat, state, event)
}
@ -364,7 +377,12 @@ impl PointerTarget<State> for WindowElement {
fn motion(&self, seat: &Seat<State>, state: &mut State, event: &MotionEvent) {
// TODO: ssd
match self {
WindowElement::Wayland(window) => PointerTarget::motion(window, seat, state, event),
WindowElement::Wayland(window) => PointerTarget::motion(
&window.wl_surface().expect("in wayland enum"),
seat,
state,
event,
),
WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => {
PointerTarget::motion(surface, seat, state, event)
}
@ -381,7 +399,12 @@ impl PointerTarget<State> for WindowElement {
// TODO: ssd
match self {
WindowElement::Wayland(window) => {
PointerTarget::relative_motion(window, seat, state, event);
PointerTarget::relative_motion(
&window.wl_surface().expect("in wayland enum"),
seat,
state,
event,
);
}
WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => {
PointerTarget::relative_motion(surface, seat, state, event);
@ -398,7 +421,12 @@ impl PointerTarget<State> for WindowElement {
) {
// TODO: ssd
match self {
WindowElement::Wayland(window) => PointerTarget::button(window, seat, state, event),
WindowElement::Wayland(window) => PointerTarget::button(
&window.wl_surface().expect("in wayland enum"),
seat,
state,
event,
),
WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => {
PointerTarget::button(surface, seat, state, event)
}
@ -409,7 +437,12 @@ impl PointerTarget<State> for WindowElement {
fn axis(&self, seat: &Seat<State>, state: &mut State, frame: AxisFrame) {
// TODO: ssd
match self {
WindowElement::Wayland(window) => PointerTarget::axis(window, seat, state, frame),
WindowElement::Wayland(window) => PointerTarget::axis(
&window.wl_surface().expect("in wayland enum"),
seat,
state,
frame,
),
WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => {
PointerTarget::axis(surface, seat, state, frame)
}
@ -421,7 +454,13 @@ impl PointerTarget<State> for WindowElement {
// TODO: ssd
match self {
WindowElement::Wayland(window) => {
PointerTarget::leave(window, seat, state, serial, time);
PointerTarget::leave(
&window.wl_surface().expect("in wayland enum"),
seat,
state,
serial,
time,
);
}
WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => {
PointerTarget::leave(surface, seat, state, serial, time)
@ -520,7 +559,13 @@ impl KeyboardTarget<State> for WindowElement {
) {
match self {
WindowElement::Wayland(window) => {
KeyboardTarget::enter(window, seat, state, keys, serial);
KeyboardTarget::enter(
&window.wl_surface().expect("in wayland enum"),
seat,
state,
keys,
serial,
);
}
WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => {
KeyboardTarget::enter(surface, seat, state, keys, serial)
@ -531,7 +576,12 @@ impl KeyboardTarget<State> for WindowElement {
fn leave(&self, seat: &Seat<State>, state: &mut State, serial: Serial) {
match self {
WindowElement::Wayland(window) => KeyboardTarget::leave(window, seat, state, serial),
WindowElement::Wayland(window) => KeyboardTarget::leave(
&window.wl_surface().expect("in wayland enum"),
seat,
state,
serial,
),
WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => {
KeyboardTarget::leave(surface, seat, state, serial)
}
@ -550,7 +600,15 @@ impl KeyboardTarget<State> for WindowElement {
) {
match self {
WindowElement::Wayland(window) => {
KeyboardTarget::key(window, seat, state, key, key_state, serial, time);
KeyboardTarget::key(
&window.wl_surface().expect("in wayland enum"),
seat,
state,
key,
key_state,
serial,
time,
);
}
WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => {
KeyboardTarget::key(surface, seat, state, key, key_state, serial, time);
@ -568,7 +626,13 @@ impl KeyboardTarget<State> for WindowElement {
) {
match self {
WindowElement::Wayland(window) => {
KeyboardTarget::modifiers(window, seat, state, modifiers, serial);
KeyboardTarget::modifiers(
&window.wl_surface().expect("in wayland enum"),
seat,
state,
modifiers,
serial,
);
}
WindowElement::X11(surface) | WindowElement::X11OverrideRedirect(surface) => {
KeyboardTarget::modifiers(surface, seat, state, modifiers, serial);

View file

@ -83,14 +83,17 @@ impl WindowElement {
match self {
WindowElement::Wayland(window) => {
window.toplevel().with_pending_state(|state| {
state.states.unset(xdg_toplevel::State::Maximized);
state.states.set(xdg_toplevel::State::Fullscreen);
state.states.set(xdg_toplevel::State::TiledTop);
state.states.set(xdg_toplevel::State::TiledLeft);
state.states.set(xdg_toplevel::State::TiledBottom);
state.states.set(xdg_toplevel::State::TiledRight);
});
window
.toplevel()
.expect("in wayland enum")
.with_pending_state(|state| {
state.states.unset(xdg_toplevel::State::Maximized);
state.states.set(xdg_toplevel::State::Fullscreen);
state.states.set(xdg_toplevel::State::TiledTop);
state.states.set(xdg_toplevel::State::TiledLeft);
state.states.set(xdg_toplevel::State::TiledBottom);
state.states.set(xdg_toplevel::State::TiledRight);
});
}
WindowElement::X11(surface) => {
surface
@ -130,14 +133,17 @@ impl WindowElement {
match self {
WindowElement::Wayland(window) => {
window.toplevel().with_pending_state(|state| {
state.states.set(xdg_toplevel::State::Maximized);
state.states.unset(xdg_toplevel::State::Fullscreen);
state.states.set(xdg_toplevel::State::TiledTop);
state.states.set(xdg_toplevel::State::TiledLeft);
state.states.set(xdg_toplevel::State::TiledBottom);
state.states.set(xdg_toplevel::State::TiledRight);
});
window
.toplevel()
.expect("in wayland enum")
.with_pending_state(|state| {
state.states.set(xdg_toplevel::State::Maximized);
state.states.unset(xdg_toplevel::State::Fullscreen);
state.states.set(xdg_toplevel::State::TiledTop);
state.states.set(xdg_toplevel::State::TiledLeft);
state.states.set(xdg_toplevel::State::TiledBottom);
state.states.set(xdg_toplevel::State::TiledRight);
});
}
WindowElement::X11(surface) => {
surface
@ -172,14 +178,17 @@ impl WindowElement {
fn set_floating_states(&self) {
match self {
WindowElement::Wayland(window) => {
window.toplevel().with_pending_state(|state| {
state.states.unset(xdg_toplevel::State::Maximized);
state.states.unset(xdg_toplevel::State::Fullscreen);
state.states.unset(xdg_toplevel::State::TiledTop);
state.states.unset(xdg_toplevel::State::TiledLeft);
state.states.unset(xdg_toplevel::State::TiledBottom);
state.states.unset(xdg_toplevel::State::TiledRight);
});
window
.toplevel()
.expect("in wayland enum")
.with_pending_state(|state| {
state.states.unset(xdg_toplevel::State::Maximized);
state.states.unset(xdg_toplevel::State::Fullscreen);
state.states.unset(xdg_toplevel::State::TiledTop);
state.states.unset(xdg_toplevel::State::TiledLeft);
state.states.unset(xdg_toplevel::State::TiledBottom);
state.states.unset(xdg_toplevel::State::TiledRight);
});
}
WindowElement::X11(surface) => {
surface
@ -199,14 +208,17 @@ impl WindowElement {
fn set_tiled_states(&self) {
match self {
WindowElement::Wayland(window) => {
window.toplevel().with_pending_state(|state| {
state.states.unset(xdg_toplevel::State::Maximized);
state.states.unset(xdg_toplevel::State::Fullscreen);
state.states.set(xdg_toplevel::State::TiledTop);
state.states.set(xdg_toplevel::State::TiledLeft);
state.states.set(xdg_toplevel::State::TiledBottom);
state.states.set(xdg_toplevel::State::TiledRight);
});
window
.toplevel()
.expect("in wayland enum")
.with_pending_state(|state| {
state.states.unset(xdg_toplevel::State::Maximized);
state.states.unset(xdg_toplevel::State::Fullscreen);
state.states.set(xdg_toplevel::State::TiledTop);
state.states.set(xdg_toplevel::State::TiledLeft);
state.states.set(xdg_toplevel::State::TiledBottom);
state.states.set(xdg_toplevel::State::TiledRight);
});
}
WindowElement::X11(surface) => {
surface