chore: window state
This commit is contained in:
parent
0370cadd67
commit
a610ac9c7a
2 changed files with 142 additions and 1 deletions
135
src/platform_impl/linux/wayland/dnd.rs
Normal file
135
src/platform_impl/linux/wayland/dnd.rs
Normal file
|
|
@ -0,0 +1,135 @@
|
||||||
|
use sctk::data_device_manager::{
|
||||||
|
data_device::DataDeviceHandler, data_offer::DataOfferHandler, data_source::DataSourceHandler,
|
||||||
|
};
|
||||||
|
|
||||||
|
use crate::platform_impl::wayland::state::WinitState;
|
||||||
|
|
||||||
|
impl DataDeviceHandler for WinitState {
|
||||||
|
fn enter(
|
||||||
|
&mut self,
|
||||||
|
conn: &wayland_client::Connection,
|
||||||
|
qh: &wayland_client::QueueHandle<Self>,
|
||||||
|
data_device: &wayland_client::protocol::wl_data_device::WlDataDevice,
|
||||||
|
x: f64,
|
||||||
|
y: f64,
|
||||||
|
wl_surface: &wayland_client::protocol::wl_surface::WlSurface,
|
||||||
|
) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn leave(
|
||||||
|
&mut self,
|
||||||
|
conn: &wayland_client::Connection,
|
||||||
|
qh: &wayland_client::QueueHandle<Self>,
|
||||||
|
data_device: &wayland_client::protocol::wl_data_device::WlDataDevice,
|
||||||
|
) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn motion(
|
||||||
|
&mut self,
|
||||||
|
conn: &wayland_client::Connection,
|
||||||
|
qh: &wayland_client::QueueHandle<Self>,
|
||||||
|
data_device: &wayland_client::protocol::wl_data_device::WlDataDevice,
|
||||||
|
x: f64,
|
||||||
|
y: f64,
|
||||||
|
) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn selection(
|
||||||
|
&mut self,
|
||||||
|
conn: &wayland_client::Connection,
|
||||||
|
qh: &wayland_client::QueueHandle<Self>,
|
||||||
|
data_device: &wayland_client::protocol::wl_data_device::WlDataDevice,
|
||||||
|
) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn drop_performed(
|
||||||
|
&mut self,
|
||||||
|
conn: &wayland_client::Connection,
|
||||||
|
qh: &wayland_client::QueueHandle<Self>,
|
||||||
|
data_device: &wayland_client::protocol::wl_data_device::WlDataDevice,
|
||||||
|
) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DataOfferHandler for WinitState {
|
||||||
|
fn source_actions(
|
||||||
|
&mut self,
|
||||||
|
conn: &wayland_client::Connection,
|
||||||
|
qh: &wayland_client::QueueHandle<Self>,
|
||||||
|
offer: &mut sctk::data_device_manager::data_offer::DragOffer,
|
||||||
|
actions: wayland_client::protocol::wl_data_device_manager::DndAction,
|
||||||
|
) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn selected_action(
|
||||||
|
&mut self,
|
||||||
|
conn: &wayland_client::Connection,
|
||||||
|
qh: &wayland_client::QueueHandle<Self>,
|
||||||
|
offer: &mut sctk::data_device_manager::data_offer::DragOffer,
|
||||||
|
actions: wayland_client::protocol::wl_data_device_manager::DndAction,
|
||||||
|
) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DataSourceHandler for WinitState {
|
||||||
|
fn accept_mime(
|
||||||
|
&mut self,
|
||||||
|
conn: &wayland_client::Connection,
|
||||||
|
qh: &wayland_client::QueueHandle<Self>,
|
||||||
|
source: &wayland_client::protocol::wl_data_source::WlDataSource,
|
||||||
|
mime: Option<String>,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn send_request(
|
||||||
|
&mut self,
|
||||||
|
conn: &wayland_client::Connection,
|
||||||
|
qh: &wayland_client::QueueHandle<Self>,
|
||||||
|
source: &wayland_client::protocol::wl_data_source::WlDataSource,
|
||||||
|
mime: String,
|
||||||
|
fd: sctk::data_device_manager::WritePipe,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn cancelled(
|
||||||
|
&mut self,
|
||||||
|
conn: &wayland_client::Connection,
|
||||||
|
qh: &wayland_client::QueueHandle<Self>,
|
||||||
|
source: &wayland_client::protocol::wl_data_source::WlDataSource,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn dnd_dropped(
|
||||||
|
&mut self,
|
||||||
|
conn: &wayland_client::Connection,
|
||||||
|
qh: &wayland_client::QueueHandle<Self>,
|
||||||
|
source: &wayland_client::protocol::wl_data_source::WlDataSource,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn dnd_finished(
|
||||||
|
&mut self,
|
||||||
|
conn: &wayland_client::Connection,
|
||||||
|
qh: &wayland_client::QueueHandle<Self>,
|
||||||
|
source: &wayland_client::protocol::wl_data_source::WlDataSource,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn action(
|
||||||
|
&mut self,
|
||||||
|
conn: &wayland_client::Connection,
|
||||||
|
qh: &wayland_client::QueueHandle<Self>,
|
||||||
|
source: &wayland_client::protocol::wl_data_source::WlDataSource,
|
||||||
|
action: wayland_client::protocol::wl_data_device_manager::DndAction,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sctk::delegate_data_device!(WinitState);
|
||||||
|
|
@ -23,6 +23,7 @@ use dpi::{LogicalSize, PhysicalSize};
|
||||||
use rwh_06::HandleError;
|
use rwh_06::HandleError;
|
||||||
use sctk::reexports::client::Proxy;
|
use sctk::reexports::client::Proxy;
|
||||||
use sctk::reexports::client::protocol::wl_surface::WlSurface;
|
use sctk::reexports::client::protocol::wl_surface::WlSurface;
|
||||||
|
use sctk::reexports::csd_frame::WindowState;
|
||||||
use sctk::shm::slot::{Buffer, CreateBufferError, SlotPool};
|
use sctk::shm::slot::{Buffer, CreateBufferError, SlotPool};
|
||||||
use wayland_client::protocol::wl_shm::Format;
|
use wayland_client::protocol::wl_shm::Format;
|
||||||
use winit_core::event_loop::ActiveEventLoop as CoreActiveEventLoop;
|
use winit_core::event_loop::ActiveEventLoop as CoreActiveEventLoop;
|
||||||
|
|
@ -104,6 +105,8 @@ pub trait WindowExtWayland {
|
||||||
fn xdg_toplevel(&self) -> Option<NonNull<c_void>>;
|
fn xdg_toplevel(&self) -> Option<NonNull<c_void>>;
|
||||||
|
|
||||||
fn xdg_surface_handle<'a>(&'a self) -> Option<&dyn HasXdgSurfaceHandle>;
|
fn xdg_surface_handle<'a>(&'a self) -> Option<&dyn HasXdgSurfaceHandle>;
|
||||||
|
|
||||||
|
fn window_state(&self) -> Option<WindowState>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WindowExtWayland for dyn CoreWindow + '_ {
|
impl WindowExtWayland for dyn CoreWindow + '_ {
|
||||||
|
|
@ -113,10 +116,13 @@ impl WindowExtWayland for dyn CoreWindow + '_ {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
||||||
fn xdg_surface_handle(&self) -> Option<&dyn HasXdgSurfaceHandle> {
|
fn xdg_surface_handle(&self) -> Option<&dyn HasXdgSurfaceHandle> {
|
||||||
Some(self.cast_ref::<Window>()? as &dyn HasXdgSurfaceHandle)
|
Some(self.cast_ref::<Window>()? as &dyn HasXdgSurfaceHandle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn window_state(&self) -> Option<WindowState> {
|
||||||
|
self.cast_ref::<Window>()?.xdg_window_state()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue