feat(wayland): data device dummy
This commit is contained in:
100
src/wayland/data_device.rs
Normal file
100
src/wayland/data_device.rs
Normal file
@@ -0,0 +1,100 @@
|
||||
use smithay::reexports::wayland_server::{
|
||||
protocol::{
|
||||
wl_data_device::{
|
||||
Request::{Release, SetSelection, StartDrag},
|
||||
WlDataDevice,
|
||||
},
|
||||
wl_data_device_manager::{
|
||||
Request::{CreateDataSource, GetDataDevice},
|
||||
WlDataDeviceManager,
|
||||
},
|
||||
wl_data_source::{
|
||||
Request::{Destroy, Offer, SetActions},
|
||||
WlDataSource,
|
||||
},
|
||||
},
|
||||
Client, DataInit, Dispatch, DisplayHandle, GlobalDispatch, New, Resource,
|
||||
};
|
||||
|
||||
use super::state::WaylandState;
|
||||
|
||||
impl GlobalDispatch<WlDataDeviceManager, (), WaylandState> for WaylandState {
|
||||
fn bind(
|
||||
_state: &mut WaylandState,
|
||||
_handle: &DisplayHandle,
|
||||
_client: &Client,
|
||||
resource: New<WlDataDeviceManager>,
|
||||
_global_data: &(),
|
||||
data_init: &mut DataInit<'_, WaylandState>,
|
||||
) {
|
||||
let _resource = data_init.init(resource, ());
|
||||
}
|
||||
}
|
||||
|
||||
impl Dispatch<WlDataDeviceManager, (), WaylandState> for WaylandState {
|
||||
fn request(
|
||||
_state: &mut WaylandState,
|
||||
_client: &Client,
|
||||
_resource: &WlDataDeviceManager,
|
||||
request: <WlDataDeviceManager as Resource>::Request,
|
||||
_data: &(),
|
||||
_dhandle: &DisplayHandle,
|
||||
data_init: &mut DataInit<'_, WaylandState>,
|
||||
) {
|
||||
match request {
|
||||
CreateDataSource { id } => {
|
||||
data_init.init(id, ());
|
||||
}
|
||||
GetDataDevice { id, seat: _ } => {
|
||||
data_init.init(id, ());
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Dispatch<WlDataSource, (), WaylandState> for WaylandState {
|
||||
fn request(
|
||||
_state: &mut WaylandState,
|
||||
_client: &Client,
|
||||
_resource: &WlDataSource,
|
||||
request: <WlDataSource as Resource>::Request,
|
||||
_data: &(),
|
||||
_dhandle: &DisplayHandle,
|
||||
_data_init: &mut DataInit<'_, WaylandState>,
|
||||
) {
|
||||
match request {
|
||||
Offer { mime_type: _ } => todo!(),
|
||||
Destroy => todo!(),
|
||||
SetActions { dnd_actions: _ } => todo!(),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Dispatch<WlDataDevice, (), WaylandState> for WaylandState {
|
||||
fn request(
|
||||
_state: &mut WaylandState,
|
||||
_client: &Client,
|
||||
_resource: &WlDataDevice,
|
||||
request: <WlDataDevice as Resource>::Request,
|
||||
_data: &(),
|
||||
_dhandle: &DisplayHandle,
|
||||
_data_init: &mut DataInit<'_, WaylandState>,
|
||||
) {
|
||||
match request {
|
||||
StartDrag {
|
||||
source: _,
|
||||
origin: _,
|
||||
icon: _,
|
||||
serial: _,
|
||||
} => todo!(),
|
||||
SetSelection {
|
||||
source: _,
|
||||
serial: _,
|
||||
} => todo!(),
|
||||
Release => todo!(),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
pub mod compositor;
|
||||
mod data_device;
|
||||
pub mod panel_item;
|
||||
pub mod seat;
|
||||
pub mod shaders;
|
||||
|
||||
@@ -7,6 +7,7 @@ use smithay::{
|
||||
output::{Output, Scale, Subpixel},
|
||||
reexports::wayland_server::{
|
||||
backend::{ClientData, ClientId, DisconnectReason},
|
||||
protocol::wl_data_device_manager::WlDataDeviceManager,
|
||||
Display, DisplayHandle,
|
||||
},
|
||||
utils::Size,
|
||||
@@ -46,7 +47,6 @@ pub struct WaylandState {
|
||||
pub output_manager_state: OutputManagerState,
|
||||
pub output: Output,
|
||||
pub seat_state: SeatDelegate,
|
||||
// pub data_device_state: DataDeviceState,
|
||||
}
|
||||
|
||||
impl WaylandState {
|
||||
@@ -72,7 +72,7 @@ impl WaylandState {
|
||||
);
|
||||
let _global = output.create_global::<Self>(&display_handle);
|
||||
output.change_current_state(None, None, Some(Scale::Integer(2)), None);
|
||||
// let data_device_state = DataDeviceState::new(&dh, log.clone());
|
||||
display_handle.create_global::<Self, WlDataDeviceManager, _>(3, ());
|
||||
|
||||
println!("Init Wayland compositor");
|
||||
|
||||
@@ -87,7 +87,6 @@ impl WaylandState {
|
||||
output_manager_state,
|
||||
output,
|
||||
seat_state: SeatDelegate,
|
||||
// data_device_state,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user