Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ jobs:
- name: Selectively upgrade url
run: cargo update -p url@2.0.0 --precise 2.3.0
# Needed to fix WlTouch trait bounds
- name: Selectively upgrade client-toolkit
run: cargo update -p smithay-client-toolkit@0.21.0 --precise 0.21.1
- name: Rust toolchain
uses: dtolnay/rust-toolchain@1.87
- name: Check
Expand Down
13 changes: 13 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,16 @@ harness = false
[profile.release-with-debug]
inherits = "release"
debug = true

[patch.crates-io]
wayland-sys = { git = "https://github.com/smithay/wayland-rs" }
wayland-egl = { git = "https://github.com/smithay/wayland-rs" }
wayland-backend = { git = "https://github.com/smithay/wayland-rs" }
wayland-server = { git = "https://github.com/smithay/wayland-rs" }
wayland-scanner = { git = "https://github.com/smithay/wayland-rs" }
wayland-client = { git = "https://github.com/smithay/wayland-rs" }
wayland-protocols = { git = "https://github.com/smithay/wayland-rs" }
wayland-protocols-wlr = { git = "https://github.com/smithay/wayland-rs" }
wayland-cursor = { git = "https://github.com/smithay/wayland-rs" }
winit = { git = "https://github.com/ids1024/winit", branch = "wayland-update" }
gbm = { git = "https://github.com/ids1024/gbm.rs", branch = "wayland-rs" }
2 changes: 1 addition & 1 deletion anvil/src/shell/grabs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ bitflags::bitflags! {
impl From<xdg_toplevel::ResizeEdge> for ResizeEdge {
#[inline]
fn from(x: xdg_toplevel::ResizeEdge) -> Self {
Self::from_bits(x as u32).unwrap()
Self::from_bits(u32::from(x)).unwrap()
}
}

Expand Down
3 changes: 0 additions & 3 deletions anvil/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use smithay::{
RenderElementStates, default_primary_scanout_output_compare, utils::select_dmabuf_feedback,
},
},
delegate_dispatch2,
desktop::{
PopupKind, PopupManager, Space,
space::SpaceElement,
Expand Down Expand Up @@ -645,8 +644,6 @@ impl<BackendData: Backend> ImageCopyCaptureHandler for AnvilState<BackendData> {
}
}

delegate_dispatch2!(@<BackendData: Backend + 'static> AnvilState<BackendData>);

impl<BackendData: Backend + 'static> AnvilState<BackendData> {
pub fn init(
display: Display<AnvilState<BackendData>>,
Expand Down
3 changes: 0 additions & 3 deletions examples/compositor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::sync::Arc;

use smithay::delegate_dispatch2;
use smithay::reexports::wayland_server::Display;

use smithay::wayland::compositor::{CompositorClientState, CompositorHandler, CompositorState};
Expand Down Expand Up @@ -74,5 +73,3 @@ impl AsMut<CompositorState> for App {
&mut self.compositor_state
}
}

delegate_dispatch2!(App);
2 changes: 0 additions & 2 deletions examples/minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,5 +291,3 @@ impl ClientData for ClientState {
println!("disconnected");
}
}

smithay::delegate_dispatch2!(App);
2 changes: 0 additions & 2 deletions examples/seat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,3 @@ impl CompositorHandler for App {

fn commit(&mut self, _surface: &WlSurface) {}
}

smithay::delegate_dispatch2!(App);
2 changes: 1 addition & 1 deletion smallvil/src/grabs/resize_grab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bitflags::bitflags! {
impl From<xdg_toplevel::ResizeEdge> for ResizeEdge {
#[inline]
fn from(x: xdg_toplevel::ResizeEdge) -> Self {
Self::from_bits(x as u32).unwrap()
Self::from_bits(u32::from(x)).unwrap()
}
}

Expand Down
2 changes: 0 additions & 2 deletions smallvil/src/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,3 @@ impl WaylandDndGrabHandler for Smallvil {
//

impl OutputHandler for Smallvil {}

smithay::delegate_dispatch2!(Smallvil);
16 changes: 8 additions & 8 deletions src/backend/egl/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ impl EGLDisplay {
ffi::egl::BindWaylandDisplayWL(**self.display, display_ptr as *mut _)
})
.map_err(Error::OtherEGLDisplayAlreadyBound)?;
let reader = EGLBufferReader::new(self.display.clone(), display_ptr);
let reader = EGLBufferReader::new(self.display.clone(), display_ptr as _);
let mut global = BUFFER_READER.lock().unwrap();
if global.as_ref().and_then(|x| x.upgrade()).is_some() {
warn!("Double bind_wl_display, smithay does not support this, please report");
Expand Down Expand Up @@ -1065,7 +1065,7 @@ impl EGLBufferReader {
let query = wrap_egl_call_bool(|| unsafe {
ffi::egl::QueryWaylandBufferWL(
**self.display,
buffer.id().as_ptr() as _,
buffer.id().as_ptr().unwrap().as_ptr(),
ffi::egl::EGL_TEXTURE_FORMAT,
&mut format,
)
Expand Down Expand Up @@ -1095,7 +1095,7 @@ impl EGLBufferReader {
wrap_egl_call_bool(|| unsafe {
ffi::egl::QueryWaylandBufferWL(
**self.display,
buffer.id().as_ptr() as _,
buffer.id().as_ptr().unwrap().as_ptr(),
ffi::egl::WIDTH as i32,
&mut width,
)
Expand All @@ -1106,7 +1106,7 @@ impl EGLBufferReader {
wrap_egl_call_bool(|| unsafe {
ffi::egl::QueryWaylandBufferWL(
**self.display,
buffer.id().as_ptr() as _,
buffer.id().as_ptr().unwrap().as_ptr(),
ffi::egl::HEIGHT as i32,
&mut height,
)
Expand All @@ -1128,7 +1128,7 @@ impl EGLBufferReader {
unsafe {
ffi::egl::QueryWaylandBufferWL(
**self.display,
buffer.id().as_ptr() as _,
buffer.id().as_ptr().unwrap().as_ptr(),
ffi::egl::WAYLAND_Y_INVERTED_WL,
&mut inverted,
)
Expand All @@ -1152,7 +1152,7 @@ impl EGLBufferReader {
**self.display,
ffi::egl::NO_CONTEXT,
ffi::egl::WAYLAND_BUFFER_WL,
buffer.id().as_ptr() as *mut _,
buffer.id().as_ptr().unwrap().as_ptr(),
out.as_ptr(),
)
})
Expand Down Expand Up @@ -1188,7 +1188,7 @@ impl EGLBufferReader {
if unsafe {
ffi::egl::QueryWaylandBufferWL(
**self.display,
buffer.id().as_ptr() as _,
buffer.id().as_ptr().unwrap().as_ptr(),
ffi::egl::WIDTH as _,
&mut width,
) == 0
Expand All @@ -1200,7 +1200,7 @@ impl EGLBufferReader {
if unsafe {
ffi::egl::QueryWaylandBufferWL(
**self.display,
buffer.id().as_ptr() as _,
buffer.id().as_ptr().unwrap().as_ptr(),
ffi::egl::HEIGHT as _,
&mut height,
) == 0
Expand Down
2 changes: 1 addition & 1 deletion src/backend/egl/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ unsafe impl EGLNativeSurface for wegl::WlEglSurface {
ffi::egl::CreatePlatformWindowSurfaceEXT(
display.handle,
config_id,
self.ptr() as *mut _,
self.ptr().as_ptr(),
WINIT_SURFACE_ATTRIBUTES.as_ptr(),
)
})
Expand Down
2 changes: 1 addition & 1 deletion src/backend/renderer/element/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl Id {
#[cfg(feature = "wayland_frontend")]
pub fn from_wayland_resource<R: Resource>(resource: &R) -> Self {
Id {
inner: InnerId::WaylandResource(resource.id()),
inner: InnerId::WaylandResource(resource.id().clone()),
namespace: None,
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/winit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ where
let size = window.surface_size();
let surface = unsafe {
wegl::WlEglSurface::new_from_raw(
handle.surface.as_ptr() as *mut _,
std::ptr::NonNull::new(handle.surface.as_ptr() as *mut _).unwrap(),
size.width as i32,
size.height as i32,
)
Expand Down
13 changes: 6 additions & 7 deletions src/utils/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ pub struct LockedClientObjsIter<'a, T: 'static, G, F> {
pub guard: MutexGuard<'a, G>,
}

pub(crate) fn new_locked_obj_iter_from_vec<T: Resource + 'static>(
guard: MutexGuard<'_, Vec<Weak<T>>>,
client: ClientId,
) -> impl Iterator<Item = T> + '_ {
pub(crate) fn new_locked_obj_iter_from_vec<'a, T: Resource + 'static>(
guard: MutexGuard<'a, Vec<Weak<T>>>,
client: &'a ClientId,
) -> impl Iterator<Item = T> + 'a {
new_locked_obj_iter(guard, client, |guard| guard.iter())
}

Expand All @@ -23,7 +23,7 @@ pub(crate) fn new_locked_obj_iter<
F: for<'b> FnOnce(&'b G) -> std::slice::Iter<'b, Weak<T>>,
>(
guard: MutexGuard<'a, G>,
client: ClientId,
client: &'a ClientId,
iterator_fn: F,
) -> impl Iterator<Item = T> + 'a {
let iterator = unsafe {
Expand All @@ -33,10 +33,9 @@ pub(crate) fn new_locked_obj_iter<
};

let iterator = iterator.filter_map(move |p| {
let client = &client;
p.upgrade()
.ok()
.filter(|p| p.client().is_some_and(|c| c.id() == *client))
.filter(|p| p.client().is_some_and(|c| c.id() == client))
});

LockedClientObjsIter::<'a, T, G, _>::new_internal(iterator, guard)
Expand Down
16 changes: 8 additions & 8 deletions src/wayland/alpha_modifier/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ use wayland_protocols::wp::alpha_modifier::v1::server::{
wp_alpha_modifier_v1::{self, WpAlphaModifierV1},
};

use wayland_server::{Client, DataInit, Dispatch, DisplayHandle, New, Resource, backend::ClientId};
use wayland_server::{
Client, DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource, backend::ClientId,
};

use super::{AlphaModifierSurfaceCachedState, AlphaModifierSurfaceData, AlphaModifierSurfaceUserData};
use crate::wayland::{Dispatch2, GlobalData, GlobalDispatch2, compositor};
use crate::wayland::{GlobalData, compositor};

impl<D> GlobalDispatch2<WpAlphaModifierV1, D> for GlobalData
impl<D> GlobalDispatch<WpAlphaModifierV1, D> for GlobalData
where
D: Dispatch<WpAlphaModifierV1, GlobalData>,
D: 'static,
{
fn bind(
Expand All @@ -25,9 +26,8 @@ where
}
}

impl<D> Dispatch2<WpAlphaModifierV1, D> for GlobalData
impl<D> Dispatch<WpAlphaModifierV1, D> for GlobalData
where
D: Dispatch<WpAlphaModifierSurfaceV1, AlphaModifierSurfaceUserData>,
D: 'static,
{
fn request(
Expand Down Expand Up @@ -72,7 +72,7 @@ where
}
}

impl<D> Dispatch2<WpAlphaModifierSurfaceV1, D> for AlphaModifierSurfaceUserData {
impl<D> Dispatch<WpAlphaModifierSurfaceV1, D> for AlphaModifierSurfaceUserData {
fn request(
&self,
_state: &mut D,
Expand Down Expand Up @@ -128,7 +128,7 @@ impl<D> Dispatch2<WpAlphaModifierSurfaceV1, D> for AlphaModifierSurfaceUserData
}
}

fn destroyed(&self, _state: &mut D, _client: ClientId, _object: &WpAlphaModifierSurfaceV1) {
fn destroyed(&self, _state: &mut D, _client: &ClientId, _object: &WpAlphaModifierSurfaceV1) {
// Nothing to do here, graceful Destroy is already handled with double buffering
// and in case of client close WlSurface destroyed handler will clean up the data anyway,
// so there is no point in queuing new update
Expand Down
18 changes: 4 additions & 14 deletions src/wayland/alpha_modifier/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
//! struct ClientState { compositor_state: CompositorClientState }
//! impl wayland_server::backend::ClientData for ClientState {}
//!
//! smithay::delegate_dispatch2!(State);
//!
//! impl CompositorHandler for State {
//! fn compositor_state(&mut self) -> &mut CompositorState {
//! &mut self.compositor_state
Expand Down Expand Up @@ -54,13 +52,8 @@ use std::sync::{
atomic::{self, AtomicBool},
};

use wayland_protocols::wp::alpha_modifier::v1::server::{
wp_alpha_modifier_surface_v1::WpAlphaModifierSurfaceV1, wp_alpha_modifier_v1::WpAlphaModifierV1,
};
use wayland_server::{
Dispatch, DisplayHandle, GlobalDispatch, Resource, Weak, backend::GlobalId,
protocol::wl_surface::WlSurface,
};
use wayland_protocols::wp::alpha_modifier::v1::server::wp_alpha_modifier_v1::WpAlphaModifierV1;
use wayland_server::{DisplayHandle, Resource, Weak, backend::GlobalId, protocol::wl_surface::WlSurface};

use super::compositor::Cacheable;

Expand Down Expand Up @@ -137,7 +130,7 @@ impl AlphaModifierSurfaceData {
}
}

/// User data of [WpAlphaModifierSurfaceV1] object
/// User data of [`WpAlphaModifierSurfaceV1`][wayland_protocols::wp::alpha_modifier::v1::server::wp_alpha_modifier_surface_v1] object
#[derive(Debug)]
pub struct AlphaModifierSurfaceUserData(Mutex<Weak<WlSurface>>);

Expand All @@ -161,10 +154,7 @@ impl AlphaModifierState {
/// Regiseter new [WpAlphaModifierV1] global
pub fn new<D>(display: &DisplayHandle) -> AlphaModifierState
where
D: GlobalDispatch<WpAlphaModifierV1, GlobalData>
+ Dispatch<WpAlphaModifierV1, GlobalData>
+ Dispatch<WpAlphaModifierSurfaceV1, AlphaModifierSurfaceUserData>
+ 'static,
D: 'static,
{
let global = display.create_global::<D, WpAlphaModifierV1, _>(1, GlobalData);

Expand Down
18 changes: 6 additions & 12 deletions src/wayland/background_effect/dispatch.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::wayland::background_effect::{BackgroundEffectSurfaceData, ExtBackgroundEffectHandler};
use crate::wayland::compositor;
use crate::wayland::{
Dispatch2, GlobalData, GlobalDispatch2,
GlobalData,
background_effect::{BackgroundEffectSurfaceCachedState, BackgroundEffectSurfaceUserData},
compositor::with_states,
};
Expand All @@ -13,12 +13,9 @@ use wayland_protocols::ext::background_effect::v1::server::{
Error as SurfaceError, ExtBackgroundEffectSurfaceV1, Request as SurfaceRequest,
},
};
use wayland_server::{Client, DataInit, Dispatch, DisplayHandle, New, Resource};
use wayland_server::{Client, DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource};

impl<D: ExtBackgroundEffectHandler> GlobalDispatch2<ExtBackgroundEffectManagerV1, D> for GlobalData
where
D: Dispatch<ExtBackgroundEffectManagerV1, GlobalData>,
{
impl<D: ExtBackgroundEffectHandler> GlobalDispatch<ExtBackgroundEffectManagerV1, D> for GlobalData {
fn bind(
&self,
state: &mut D,
Expand All @@ -32,10 +29,7 @@ where
}
}

impl<D: ExtBackgroundEffectHandler> Dispatch2<ExtBackgroundEffectManagerV1, D> for GlobalData
where
D: Dispatch<ExtBackgroundEffectSurfaceV1, BackgroundEffectSurfaceUserData>,
{
impl<D: ExtBackgroundEffectHandler> Dispatch<ExtBackgroundEffectManagerV1, D> for GlobalData {
fn request(
&self,
_state: &mut D,
Expand Down Expand Up @@ -73,7 +67,7 @@ where
}
}

impl<D: ExtBackgroundEffectHandler> Dispatch2<ExtBackgroundEffectSurfaceV1, D>
impl<D: ExtBackgroundEffectHandler> Dispatch<ExtBackgroundEffectSurfaceV1, D>
for BackgroundEffectSurfaceUserData
{
fn request(
Expand Down Expand Up @@ -131,7 +125,7 @@ impl<D: ExtBackgroundEffectHandler> Dispatch2<ExtBackgroundEffectSurfaceV1, D>
fn destroyed(
&self,
_state: &mut D,
_client_id: wayland_server::backend::ClientId,
_client_id: &wayland_server::backend::ClientId,
_object: &ExtBackgroundEffectSurfaceV1,
) {
// No-op: cleanup is handled by double-buffering and surface destruction
Expand Down
Loading
Loading