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
13 changes: 4 additions & 9 deletions examples/data_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ use smithay_client_toolkit::{
data_source::{CopyPasteSource, DataSourceHandler, DragSource},
DataDeviceManagerState, WritePipe,
},
delegate_compositor, delegate_data_device, delegate_keyboard, delegate_output,
delegate_pointer, delegate_primary_selection, delegate_registry, delegate_seat, delegate_shm,
delegate_xdg_shell, delegate_xdg_window,
delegate_compositor, delegate_data_device, delegate_keyboard, delegate_pointer,
delegate_primary_selection, delegate_registry,
output::{OutputHandler, OutputState},
primary_selection::{
device::{PrimarySelectionDevice, PrimarySelectionDeviceHandler},
Expand Down Expand Up @@ -1082,16 +1081,10 @@ struct SeatObject {
}

delegate_compositor!(DataDeviceWindow);
delegate_output!(DataDeviceWindow);
delegate_shm!(DataDeviceWindow);

delegate_seat!(DataDeviceWindow);
delegate_keyboard!(DataDeviceWindow);
delegate_pointer!(DataDeviceWindow);

delegate_xdg_shell!(DataDeviceWindow);
delegate_xdg_window!(DataDeviceWindow);

delegate_data_device!(DataDeviceWindow);

delegate_primary_selection!(DataDeviceWindow);
Expand All @@ -1115,3 +1108,5 @@ fn pick_mime(mime_types: &[String]) -> Option<String> {

None
}

smithay_client_toolkit::delegate_dispatch2!(DataDeviceWindow);
6 changes: 3 additions & 3 deletions examples/generic_list_seats.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use smithay_client_toolkit::{
delegate_registry, delegate_seat,
delegate_registry,
registry::{ProvidesRegistryState, RegistryState},
registry_handlers,
seat::{Capability, SeatHandler, SeatState},
Expand Down Expand Up @@ -81,8 +81,6 @@ impl<T: Test + 'static> SeatHandler for ListSeats<T> {
}
}

delegate_seat!(@<T: Test + 'static> ListSeats<T>);

delegate_registry!(@<T: Test + 'static> ListSeats<T>);

impl<T: Test + 'static> ProvidesRegistryState for ListSeats<T> {
Expand All @@ -92,3 +90,5 @@ impl<T: Test + 'static> ProvidesRegistryState for ListSeats<T> {

registry_handlers!(SeatState);
}

smithay_client_toolkit::delegate_dispatch2!(@<T: Test + 'static> ListSeats<T>);
11 changes: 3 additions & 8 deletions examples/generic_simple_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use std::convert::TryInto;

use smithay_client_toolkit::{
compositor::{CompositorHandler, CompositorState},
delegate_compositor, delegate_keyboard, delegate_output, delegate_pointer, delegate_registry,
delegate_seat, delegate_shm, delegate_xdg_shell, delegate_xdg_window,
delegate_compositor, delegate_keyboard, delegate_pointer, delegate_registry,
output::{OutputHandler, OutputState},
registry::{ProvidesRegistryState, RegistryState},
registry_handlers,
Expand Down Expand Up @@ -477,16 +476,10 @@ impl<T: Test + 'static> SimpleWindow<T> {
}

delegate_compositor!(@<T: Test + 'static> SimpleWindow<T>);
delegate_output!(@<T: Test + 'static> SimpleWindow<T>);
delegate_shm!(@<T: Test + 'static> SimpleWindow<T>);

delegate_seat!(@<T: Test + 'static> SimpleWindow<T>);
delegate_keyboard!(@<T: Test + 'static> SimpleWindow<T>);
delegate_pointer!(@<T: Test + 'static> SimpleWindow<T>);

delegate_xdg_shell!(@<T: Test + 'static> SimpleWindow<T>);
delegate_xdg_window!(@<T: Test + 'static> SimpleWindow<T>);

delegate_registry!(@<T: Test + 'static> SimpleWindow<T>);

impl<T: Test + 'static> ProvidesRegistryState for SimpleWindow<T> {
Expand All @@ -495,3 +488,5 @@ impl<T: Test + 'static> ProvidesRegistryState for SimpleWindow<T> {
}
registry_handlers![OutputState, SeatState,];
}

smithay_client_toolkit::delegate_dispatch2!(@<T: Test + 'static> SimpleWindow<T>);
10 changes: 3 additions & 7 deletions examples/image_viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use std::env;

use smithay_client_toolkit::{
compositor::{CompositorHandler, CompositorState},
delegate_compositor, delegate_output, delegate_registry, delegate_shm, delegate_xdg_shell,
delegate_xdg_window,
delegate_compositor, delegate_registry,
output::{OutputHandler, OutputState},
registry::{ProvidesRegistryState, RegistryState},
registry_handlers,
Expand Down Expand Up @@ -319,11 +318,6 @@ impl State {
}

delegate_compositor!(State);
delegate_output!(State);
delegate_shm!(State);

delegate_xdg_shell!(State);
delegate_xdg_window!(State);

delegate_registry!(State);

Expand All @@ -334,3 +328,5 @@ impl ProvidesRegistryState for State {

registry_handlers!(OutputState);
}

smithay_client_toolkit::delegate_dispatch2!(State);
10 changes: 3 additions & 7 deletions examples/image_viewporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use std::{env, path::Path};

use smithay_client_toolkit::{
compositor::{CompositorHandler, CompositorState},
delegate_compositor, delegate_output, delegate_registry, delegate_shm, delegate_simple,
delegate_xdg_shell, delegate_xdg_window,
delegate_compositor, delegate_registry, delegate_simple,
output::{OutputHandler, OutputState},
registry::{ProvidesRegistryState, RegistryState, SimpleGlobal},
registry_handlers,
Expand Down Expand Up @@ -319,11 +318,6 @@ impl State {
}

delegate_compositor!(State);
delegate_output!(State);
delegate_shm!(State);

delegate_xdg_shell!(State);
delegate_xdg_window!(State);

delegate_simple!(State, WpViewporter, 1);

Expand Down Expand Up @@ -361,3 +355,5 @@ impl Drop for ImageViewer {
self.viewport.destroy()
}
}

smithay_client_toolkit::delegate_dispatch2!(State);
10 changes: 4 additions & 6 deletions examples/list_outputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::error::Error;

use smithay_client_toolkit::{
delegate_output, delegate_registry,
delegate_registry,
output::{OutputHandler, OutputInfo, OutputState},
registry::{ProvidesRegistryState, RegistryState},
registry_handlers,
Expand Down Expand Up @@ -103,10 +103,6 @@ impl OutputHandler for ListOutputs {
}
}

// Now we need to say we are delegating the responsibility of output related events for our application data
// type to the requisite delegate.
delegate_output!(ListOutputs);

// In order for our delegate to know of the existence of globals, we need to implement registry
// handling for the program. This trait will forward events to the RegistryHandler trait
// implementations.
Expand All @@ -125,7 +121,7 @@ impl ProvidesRegistryState for ListOutputs {
registry_handlers! {
// Here we specify that OutputState needs to receive events regarding the creation and destruction of
// globals.
OutputState,
OutputState
}
}

Expand Down Expand Up @@ -157,3 +153,5 @@ fn print_output(info: &OutputInfo) {
println!("\t\t{mode}");
}
}

smithay_client_toolkit::delegate_dispatch2!(ListOutputs);
6 changes: 3 additions & 3 deletions examples/list_seats.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use smithay_client_toolkit::{
delegate_registry, delegate_seat,
delegate_registry,
registry::{ProvidesRegistryState, RegistryState},
registry_handlers,
seat::{Capability, SeatHandler, SeatState},
Expand Down Expand Up @@ -69,8 +69,6 @@ impl SeatHandler for ListSeats {
}
}

delegate_seat!(ListSeats);

delegate_registry!(ListSeats);

impl ProvidesRegistryState for ListSeats {
Expand All @@ -80,3 +78,5 @@ impl ProvidesRegistryState for ListSeats {

registry_handlers!(SeatState);
}

smithay_client_toolkit::delegate_dispatch2!(ListSeats);
10 changes: 3 additions & 7 deletions examples/list_shm_formats.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/// Example app showing how to use delegate types from Smithay's client toolkit and initializing state.
use smithay_client_toolkit::{
delegate_shm,
shm::{Shm, ShmHandler},
};
use smithay_client_toolkit::shm::{Shm, ShmHandler};
use wayland_client::{
globals::{registry_queue_init, GlobalListContents},
protocol::wl_registry,
Expand Down Expand Up @@ -45,9 +42,6 @@ impl ShmHandler for ListShmFormats {
}
}

// Delegate handling of the wl_shm protocol to our state object.
delegate_shm!(ListShmFormats);

impl Dispatch<wl_registry::WlRegistry, GlobalListContents> for ListShmFormats {
fn event(
_state: &mut Self,
Expand All @@ -60,3 +54,5 @@ impl Dispatch<wl_registry::WlRegistry, GlobalListContents> for ListShmFormats {
// We don't need any other globals.
}
}

smithay_client_toolkit::delegate_dispatch2!(ListShmFormats);
13 changes: 4 additions & 9 deletions examples/relative_pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

use smithay_client_toolkit::{
compositor::{CompositorHandler, CompositorState},
delegate_compositor, delegate_output, delegate_pointer, delegate_pointer_constraints,
delegate_registry, delegate_relative_pointer, delegate_seat, delegate_shm, delegate_xdg_shell,
delegate_xdg_window,
delegate_compositor, delegate_pointer, delegate_pointer_constraints, delegate_registry,
delegate_relative_pointer,
globals::ProvidesBoundGlobal,
output::{OutputHandler, OutputState},
registry::{ProvidesRegistryState, RegistryState},
Expand Down Expand Up @@ -547,17 +546,11 @@ impl SimpleWindow {
}

delegate_compositor!(SimpleWindow);
delegate_output!(SimpleWindow);
delegate_shm!(SimpleWindow);

delegate_seat!(SimpleWindow);
delegate_pointer!(SimpleWindow);
delegate_pointer_constraints!(SimpleWindow);
delegate_relative_pointer!(SimpleWindow);

delegate_xdg_shell!(SimpleWindow);
delegate_xdg_window!(SimpleWindow);

delegate_registry!(SimpleWindow);

impl ProvidesRegistryState for SimpleWindow {
Expand All @@ -578,3 +571,5 @@ impl Dispatch<wl_region::WlRegion, ()> for SimpleWindow {
) {
}
}

smithay_client_toolkit::delegate_dispatch2!(SimpleWindow);
3 changes: 1 addition & 2 deletions examples/session_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ impl ShmHandler for AppData {
}

smithay_client_toolkit::delegate_compositor!(AppData);
smithay_client_toolkit::delegate_output!(AppData);
smithay_client_toolkit::delegate_session_lock!(AppData);
smithay_client_toolkit::delegate_shm!(AppData);
smithay_client_toolkit::delegate_registry!(AppData);
wayland_client::delegate_noop!(AppData: ignore wl_buffer::WlBuffer);
smithay_client_toolkit::delegate_dispatch2!(AppData);
8 changes: 3 additions & 5 deletions examples/simple_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use std::{convert::TryInto, num::NonZeroU32};

use smithay_client_toolkit::{
compositor::{CompositorHandler, CompositorState},
delegate_compositor, delegate_keyboard, delegate_layer, delegate_output, delegate_pointer,
delegate_registry, delegate_seat, delegate_shm,
delegate_compositor, delegate_keyboard, delegate_layer, delegate_pointer, delegate_registry,
output::{OutputHandler, OutputState},
registry::{ProvidesRegistryState, RegistryState},
registry_handlers,
Expand Down Expand Up @@ -450,10 +449,7 @@ impl SimpleLayer {
}

delegate_compositor!(SimpleLayer);
delegate_output!(SimpleLayer);
delegate_shm!(SimpleLayer);

delegate_seat!(SimpleLayer);
delegate_keyboard!(SimpleLayer);
delegate_pointer!(SimpleLayer);

Expand All @@ -467,3 +463,5 @@ impl ProvidesRegistryState for SimpleLayer {
}
registry_handlers![OutputState, SeatState];
}

smithay_client_toolkit::delegate_dispatch2!(SimpleLayer);
11 changes: 4 additions & 7 deletions examples/simple_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use smithay_client_toolkit::reexports::calloop_wayland_source::WaylandSource;
use smithay_client_toolkit::{
activation::{ActivationHandler, ActivationState},
compositor::{CompositorHandler, CompositorState},
delegate_activation, delegate_compositor, delegate_keyboard, delegate_output, delegate_pointer,
delegate_registry, delegate_seat, delegate_shm, delegate_xdg_shell, delegate_xdg_window,
delegate_activation, delegate_compositor, delegate_keyboard, delegate_pointer,
delegate_registry,
output::{OutputHandler, OutputState},
registry::{ProvidesRegistryState, RegistryState},
registry_handlers,
Expand Down Expand Up @@ -517,15 +517,10 @@ impl SimpleWindow {
}

delegate_compositor!(SimpleWindow);
delegate_output!(SimpleWindow);
delegate_shm!(SimpleWindow);

delegate_seat!(SimpleWindow);
delegate_keyboard!(SimpleWindow);
delegate_pointer!(SimpleWindow);

delegate_xdg_shell!(SimpleWindow);
delegate_xdg_window!(SimpleWindow);
delegate_activation!(SimpleWindow);

delegate_registry!(SimpleWindow);
Expand All @@ -536,3 +531,5 @@ impl ProvidesRegistryState for SimpleWindow {
}
registry_handlers![OutputState, SeatState,];
}

smithay_client_toolkit::delegate_dispatch2!(SimpleWindow);
16 changes: 6 additions & 10 deletions examples/themed_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ use smithay_client_toolkit::reexports::csd_frame::{
};
use smithay_client_toolkit::reexports::protocols::xdg::shell::client::xdg_toplevel::ResizeEdge as XdgResizeEdge;
use smithay_client_toolkit::{
compositor::{CompositorHandler, CompositorState},
delegate_compositor, delegate_keyboard, delegate_output, delegate_pointer, delegate_registry,
delegate_seat, delegate_shm, delegate_subcompositor, delegate_xdg_shell, delegate_xdg_window,
compositor::{CompositorHandler, CompositorState, SurfaceData},
delegate_compositor, delegate_keyboard, delegate_pointer, delegate_registry,
delegate_subcompositor,
output::{OutputHandler, OutputState},
registry::{ProvidesRegistryState, RegistryState},
registry_handlers,
Expand Down Expand Up @@ -387,7 +387,7 @@ impl SeatHandler for SimpleWindow {
let surface = self.compositor_state.create_surface(qh);
let themed_pointer = self
.seat_state
.get_pointer_with_theme(
.get_pointer_with_theme::<_, SurfaceData>(
qh,
&seat,
self.shm_state.wl_shm(),
Expand Down Expand Up @@ -675,16 +675,10 @@ impl SimpleWindow {

delegate_compositor!(SimpleWindow);
delegate_subcompositor!(SimpleWindow);
delegate_output!(SimpleWindow);
delegate_shm!(SimpleWindow);

delegate_seat!(SimpleWindow);
delegate_keyboard!(SimpleWindow);
delegate_pointer!(SimpleWindow);

delegate_xdg_shell!(SimpleWindow);
delegate_xdg_window!(SimpleWindow);

delegate_registry!(SimpleWindow);

impl ProvidesRegistryState for SimpleWindow {
Expand All @@ -693,3 +687,5 @@ impl ProvidesRegistryState for SimpleWindow {
}
registry_handlers![OutputState, SeatState,];
}

smithay_client_toolkit::delegate_dispatch2!(SimpleWindow);
Loading
Loading