wayland.shell.xdg: make names more explicit
This commit is contained in:
parent
4579f20fae
commit
12e13f863b
|
@ -4,8 +4,8 @@ use rand;
|
|||
use smithay::backend::graphics::egl::wayland::{BufferAccessError, Format};
|
||||
use smithay::backend::graphics::egl::wayland::{EGLDisplay, EGLImages};
|
||||
use smithay::wayland::compositor::{compositor_init, CompositorToken, SurfaceAttributes, SurfaceEvent};
|
||||
use smithay::wayland::shell::xdg::{xdg_shell_init, PopupConfigure, ShellEvent, ShellState, ShellSurfaceRole,
|
||||
ToplevelConfigure};
|
||||
use smithay::wayland::shell::xdg::{xdg_shell_init, PopupConfigure, ShellState, ToplevelConfigure,
|
||||
XdgRequest, XdgSurfaceRole};
|
||||
use smithay::wayland::shm::with_buffer_contents as shm_buffer_contents;
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
@ -13,7 +13,7 @@ use std::sync::{Arc, Mutex};
|
|||
use wayland_server::{Display, LoopToken, Resource};
|
||||
use wayland_server::protocol::{wl_buffer, wl_callback, wl_surface};
|
||||
|
||||
define_roles!(Roles => [ ShellSurface, ShellSurfaceRole ] );
|
||||
define_roles!(Roles => [ ShellSurface, XdgSurfaceRole ] );
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct SurfaceData {
|
||||
|
@ -137,7 +137,7 @@ pub fn init_shell(
|
|||
looptoken,
|
||||
compositor_token.clone(),
|
||||
move |shell_event, ()| match shell_event {
|
||||
ShellEvent::NewToplevel { surface } => {
|
||||
XdgRequest::NewToplevel { surface } => {
|
||||
// place the window at a random location in the [0;300]x[0;300] square
|
||||
use rand::distributions::{IndependentSample, Range};
|
||||
let range = Range::new(0, 300);
|
||||
|
@ -151,7 +151,7 @@ pub fn init_shell(
|
|||
});
|
||||
shell_window_map.borrow_mut().insert(surface, (x, y));
|
||||
}
|
||||
ShellEvent::NewPopup { surface } => surface.send_configure(PopupConfigure {
|
||||
XdgRequest::NewPopup { surface } => surface.send_configure(PopupConfigure {
|
||||
size: (10, 10),
|
||||
position: (10, 10),
|
||||
serial: 42,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use smithay::utils::Rectangle;
|
||||
use smithay::wayland::compositor::{CompositorToken, SubsurfaceRole, SurfaceAttributes, TraversalAction};
|
||||
use smithay::wayland::compositor::roles::Role;
|
||||
use smithay::wayland::shell::xdg::{ShellSurfaceRole, ToplevelSurface};
|
||||
use smithay::wayland::shell::xdg::{ToplevelSurface, XdgSurfaceRole};
|
||||
use wayland_server::Resource;
|
||||
use wayland_server::protocol::wl_surface;
|
||||
|
||||
|
@ -14,7 +14,7 @@ struct Window<U, R, SD> {
|
|||
impl<U, R, SD> Window<U, R, SD>
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<SubsurfaceRole> + Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<SubsurfaceRole> + Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
// Find the topmost surface under this point if any and the location of this point in the surface
|
||||
|
@ -121,7 +121,7 @@ impl<U, R, SD, F> WindowMap<U, R, SD, F>
|
|||
where
|
||||
F: Fn(&SurfaceAttributes<U>) -> Option<(i32, i32)>,
|
||||
U: 'static,
|
||||
R: Role<SubsurfaceRole> + Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<SubsurfaceRole> + Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
pub fn new(ctoken: CompositorToken<U, R>, get_size: F) -> WindowMap<U, R, SD, F> {
|
||||
|
|
|
@ -32,15 +32,15 @@
|
|||
//! #
|
||||
//! use smithay::wayland::compositor::roles::*;
|
||||
//! use smithay::wayland::compositor::CompositorToken;
|
||||
//! use smithay::wayland::shell::xdg::{xdg_shell_init, ShellSurfaceRole, ShellEvent};
|
||||
//! use smithay::wayland::shell::xdg::{xdg_shell_init, XdgSurfaceRole, XdgRequest};
|
||||
//! use wayland_protocols::unstable::xdg_shell::v6::server::zxdg_shell_v6::ZxdgShellV6;
|
||||
//! use wayland_server::{EventLoop, LoopToken};
|
||||
//! # use wayland_server::protocol::{wl_seat, wl_output};
|
||||
//! # #[derive(Default)] struct MySurfaceData;
|
||||
//!
|
||||
//! // define the roles type. You need to integrate the ShellSurface role:
|
||||
//! // define the roles type. You need to integrate the XdgSurface role:
|
||||
//! define_roles!(MyRoles =>
|
||||
//! [ShellSurface, ShellSurfaceRole]
|
||||
//! [XdgSurface, XdgSurfaceRole]
|
||||
//! );
|
||||
//!
|
||||
//! // define the metadata you want associated with the shell clients
|
||||
|
@ -63,8 +63,8 @@
|
|||
//! // token from the compositor implementation
|
||||
//! compositor_token,
|
||||
//! // your implementation, can also be a strucy implementing the
|
||||
//! // appropriate Implementation<(), ShellEvent<_, _, _>> trait
|
||||
//! |event: ShellEvent<_, _, MyShellData>, ()| { /* ... */ },
|
||||
//! // appropriate Implementation<(), XdgRequest<_, _, _>> trait
|
||||
//! |event: XdgRequest<_, _, MyShellData>, ()| { /* ... */ },
|
||||
//! None // put a logger if you want
|
||||
//! );
|
||||
//!
|
||||
|
@ -106,13 +106,13 @@ mod xdg_handlers;
|
|||
// compatibility handlers for the zxdg_shell_v6 protocol, its earlier version
|
||||
mod zxdgv6_handlers;
|
||||
|
||||
/// Metadata associated with the `shell_surface` role
|
||||
pub struct ShellSurfaceRole {
|
||||
/// Metadata associated with the `xdg_surface` role
|
||||
pub struct XdgSurfaceRole {
|
||||
/// Pending state as requested by the client
|
||||
///
|
||||
/// The data in this field are double-buffered, you should
|
||||
/// apply them on a surface commit.
|
||||
pub pending_state: ShellSurfacePendingState,
|
||||
pub pending_state: XdgSurfacePendingState,
|
||||
/// Geometry of the surface
|
||||
///
|
||||
/// Defines, in surface relative coordinates, what should
|
||||
|
@ -175,7 +175,7 @@ impl PositionerState {
|
|||
}
|
||||
|
||||
/// Contents of the pending state of a shell surface, depending on its role
|
||||
pub enum ShellSurfacePendingState {
|
||||
pub enum XdgSurfacePendingState {
|
||||
/// This a regular, toplevel surface
|
||||
///
|
||||
/// This corresponds to the `xdg_toplevel` role
|
||||
|
@ -248,9 +248,9 @@ impl Clone for PopupState {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for ShellSurfacePendingState {
|
||||
fn default() -> ShellSurfacePendingState {
|
||||
ShellSurfacePendingState::None
|
||||
impl Default for XdgSurfacePendingState {
|
||||
fn default() -> XdgSurfacePendingState {
|
||||
XdgSurfacePendingState::None
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ pub(crate) struct ShellImplementation<U, R, SD> {
|
|||
log: ::slog::Logger,
|
||||
compositor_token: CompositorToken<U, R>,
|
||||
loop_token: LoopToken,
|
||||
user_impl: Rc<RefCell<Implementation<(), ShellEvent<U, R, SD>>>>,
|
||||
user_impl: Rc<RefCell<Implementation<(), XdgRequest<U, R, SD>>>>,
|
||||
shell_state: Arc<Mutex<ShellState<U, R, SD>>>,
|
||||
}
|
||||
|
||||
|
@ -288,10 +288,10 @@ pub fn xdg_shell_init<U, R, SD, L, Impl>(
|
|||
)
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: Default + 'static,
|
||||
L: Into<Option<::slog::Logger>>,
|
||||
Impl: Implementation<(), ShellEvent<U, R, SD>>,
|
||||
Impl: Implementation<(), XdgRequest<U, R, SD>>,
|
||||
{
|
||||
let log = ::slog_or_stdlog(logger);
|
||||
let shell_state = Arc::new(Mutex::new(ShellState {
|
||||
|
@ -300,7 +300,7 @@ where
|
|||
}));
|
||||
|
||||
let shell_impl = ShellImplementation {
|
||||
log: log.new(o!("smithay_module" => "shell_handler")),
|
||||
log: log.new(o!("smithay_module" => "xdg_shell_handler")),
|
||||
loop_token: ltoken.clone(),
|
||||
compositor_token: ctoken,
|
||||
user_impl: Rc::new(RefCell::new(implementation)),
|
||||
|
@ -332,15 +332,9 @@ pub struct ShellState<U, R, SD> {
|
|||
impl<U, R, SD> ShellState<U, R, SD>
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
/// Cleans the internal surface storage by removing all dead surfaces
|
||||
pub fn cleanup_surfaces(&mut self) {
|
||||
self.known_toplevels.retain(|s| s.alive());
|
||||
self.known_popups.retain(|s| s.alive());
|
||||
}
|
||||
|
||||
/// Access all the shell surfaces known by this handler
|
||||
pub fn toplevel_surfaces(&self) -> &[ToplevelSurface<U, R, SD>] {
|
||||
&self.known_toplevels[..]
|
||||
|
@ -409,7 +403,7 @@ impl<SD> ShellClient<SD> {
|
|||
|
||||
/// Send a ping request to this shell client
|
||||
///
|
||||
/// You'll receive the reply in the `Handler::cient_pong()` method.
|
||||
/// You'll receive the reply as a `XdgRequest::ClientPong` request.
|
||||
///
|
||||
/// A typical use is to start a timer at the same time you send this ping
|
||||
/// request, and cancel it when you receive the pong. If the timer runs
|
||||
|
@ -486,7 +480,7 @@ pub struct ToplevelSurface<U, R, SD> {
|
|||
impl<U, R, SD> ToplevelSurface<U, R, SD>
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
/// Is the toplevel surface refered by this handle still alive?
|
||||
|
@ -556,7 +550,7 @@ where
|
|||
return false;
|
||||
}
|
||||
let configured = self.token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(&self.wl_surface, |data| data.configured)
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(&self.wl_surface, |data| data.configured)
|
||||
.expect("A shell surface object exists but the surface does not have the shell_surface role ?!");
|
||||
if !configured {
|
||||
match self.shell_surface {
|
||||
|
@ -610,8 +604,8 @@ where
|
|||
return None;
|
||||
}
|
||||
self.token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(&self.wl_surface, |data| match data.pending_state {
|
||||
ShellSurfacePendingState::Toplevel(ref state) => Some(state.clone()),
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(&self.wl_surface, |data| match data.pending_state {
|
||||
XdgSurfacePendingState::Toplevel(ref state) => Some(state.clone()),
|
||||
_ => None,
|
||||
})
|
||||
.ok()
|
||||
|
@ -638,7 +632,7 @@ pub struct PopupSurface<U, R, SD> {
|
|||
impl<U, R, SD> PopupSurface<U, R, SD>
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
/// Is the popup surface refered by this handle still alive?
|
||||
|
@ -712,7 +706,7 @@ where
|
|||
return false;
|
||||
}
|
||||
let configured = self.token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(&self.wl_surface, |data| data.configured)
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(&self.wl_surface, |data| data.configured)
|
||||
.expect("A shell surface object exists but the surface does not have the shell_surface role ?!");
|
||||
if !configured {
|
||||
match self.shell_surface {
|
||||
|
@ -769,8 +763,8 @@ where
|
|||
return None;
|
||||
}
|
||||
self.token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(&self.wl_surface, |data| match data.pending_state {
|
||||
ShellSurfacePendingState::Popup(ref state) => Some(state.clone()),
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(&self.wl_surface, |data| match data.pending_state {
|
||||
XdgSurfacePendingState::Popup(ref state) => Some(state.clone()),
|
||||
_ => None,
|
||||
})
|
||||
.ok()
|
||||
|
@ -816,7 +810,7 @@ pub struct PopupConfigure {
|
|||
/// for you directly.
|
||||
///
|
||||
/// Depending on what you want to do, you might ignore some of them
|
||||
pub enum ShellEvent<U, R, SD> {
|
||||
pub enum XdgRequest<U, R, SD> {
|
||||
/// A new shell client was instanciated
|
||||
NewClient {
|
||||
/// the client
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::{make_shell_client_data, PopupConfigure, PopupKind, PopupState, PositionerState, ShellClient,
|
||||
ShellClientData, ShellEvent, ShellImplementation, ShellSurfacePendingState, ShellSurfaceRole,
|
||||
ToplevelConfigure, ToplevelKind, ToplevelState};
|
||||
ShellClientData, ShellImplementation, ToplevelConfigure, ToplevelKind, ToplevelState,
|
||||
XdgRequest, XdgSurfacePendingState, XdgSurfaceRole};
|
||||
use std::sync::Mutex;
|
||||
use utils::Rectangle;
|
||||
use wayland::compositor::CompositorToken;
|
||||
|
@ -16,7 +16,7 @@ pub(crate) fn implement_wm_base<U, R, SD>(
|
|||
) -> Resource<xdg_wm_base::XdgWmBase>
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: Default + 'static,
|
||||
{
|
||||
let shell = shell.implement_nonsend(
|
||||
|
@ -27,7 +27,7 @@ where
|
|||
shell.set_user_data(Box::into_raw(Box::new(Mutex::new(make_shell_client_data::<SD>()))) as *mut _);
|
||||
let mut user_impl = implem.user_impl.borrow_mut();
|
||||
user_impl.receive(
|
||||
ShellEvent::NewClient {
|
||||
XdgRequest::NewClient {
|
||||
client: make_shell_client(&shell),
|
||||
},
|
||||
(),
|
||||
|
@ -60,7 +60,7 @@ impl<U, R, SD> Implementation<Resource<xdg_wm_base::XdgWmBase>, xdg_wm_base::Req
|
|||
for ShellImplementation<U, R, SD>
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
fn receive(&mut self, request: xdg_wm_base::Request, shell: Resource<xdg_wm_base::XdgWmBase>) {
|
||||
|
@ -72,8 +72,8 @@ where
|
|||
implement_positioner(id, &self.loop_token);
|
||||
}
|
||||
xdg_wm_base::Request::GetXdgSurface { id, surface } => {
|
||||
let role_data = ShellSurfaceRole {
|
||||
pending_state: ShellSurfacePendingState::None,
|
||||
let role_data = XdgSurfaceRole {
|
||||
pending_state: XdgSurfacePendingState::None,
|
||||
window_geometry: None,
|
||||
pending_configures: Vec::new(),
|
||||
configured: false,
|
||||
|
@ -110,7 +110,7 @@ where
|
|||
if valid {
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(
|
||||
ShellEvent::ClientPong {
|
||||
XdgRequest::ClientPong {
|
||||
client: make_shell_client(&shell),
|
||||
},
|
||||
(),
|
||||
|
@ -216,7 +216,7 @@ fn destroy_surface<U, R, SD>(
|
|||
implem: Box<Implementation<Resource<xdg_surface::XdgSurface>, xdg_surface::Request>>,
|
||||
) where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
let implem: ShellImplementation<U, R, SD> = *downcast_impl(implem).unwrap_or_else(|_| unreachable!());
|
||||
|
@ -232,8 +232,8 @@ fn destroy_surface<U, R, SD>(
|
|||
}
|
||||
implem
|
||||
.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(&data.0, |rdata| {
|
||||
if let ShellSurfacePendingState::None = rdata.pending_state {
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(&data.0, |rdata| {
|
||||
if let XdgSurfacePendingState::None = rdata.pending_state {
|
||||
// all is good
|
||||
} else {
|
||||
data.1.post_error(
|
||||
|
@ -249,7 +249,7 @@ impl<U, R, SD> Implementation<Resource<xdg_surface::XdgSurface>, xdg_surface::Re
|
|||
for ShellImplementation<U, R, SD>
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
fn receive(&mut self, request: xdg_surface::Request, xdg_surface: Resource<xdg_surface::XdgSurface>) {
|
||||
|
@ -261,8 +261,8 @@ where
|
|||
}
|
||||
xdg_surface::Request::GetToplevel { id } => {
|
||||
self.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(surface, |data| {
|
||||
data.pending_state = ShellSurfacePendingState::Toplevel(ToplevelState {
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(surface, |data| {
|
||||
data.pending_state = XdgSurfacePendingState::Toplevel(ToplevelState {
|
||||
parent: None,
|
||||
title: String::new(),
|
||||
app_id: String::new(),
|
||||
|
@ -290,7 +290,7 @@ where
|
|||
|
||||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(ShellEvent::NewToplevel { surface: handle }, ());
|
||||
user_impl.receive(XdgRequest::NewToplevel { surface: handle }, ());
|
||||
}
|
||||
xdg_surface::Request::GetPopup {
|
||||
id,
|
||||
|
@ -305,8 +305,8 @@ where
|
|||
parent_surface.clone()
|
||||
});
|
||||
self.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(surface, |data| {
|
||||
data.pending_state = ShellSurfacePendingState::Popup(PopupState {
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(surface, |data| {
|
||||
data.pending_state = XdgSurfacePendingState::Popup(PopupState {
|
||||
parent: parent_surface,
|
||||
positioner: positioner_data.clone(),
|
||||
});
|
||||
|
@ -331,7 +331,7 @@ where
|
|||
|
||||
let handle = make_popup_handle(self.compositor_token, &popup);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(ShellEvent::NewPopup { surface: handle }, ());
|
||||
user_impl.receive(XdgRequest::NewPopup { surface: handle }, ());
|
||||
}
|
||||
xdg_surface::Request::SetWindowGeometry {
|
||||
x,
|
||||
|
@ -340,7 +340,7 @@ where
|
|||
height,
|
||||
} => {
|
||||
self.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(surface, |data| {
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(surface, |data| {
|
||||
data.window_geometry = Some(Rectangle {
|
||||
x,
|
||||
y,
|
||||
|
@ -352,7 +352,7 @@ where
|
|||
}
|
||||
xdg_surface::Request::AckConfigure { serial } => {
|
||||
self.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(surface, |data| {
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(surface, |data| {
|
||||
let mut found = false;
|
||||
data.pending_configures.retain(|&s| {
|
||||
if s == serial {
|
||||
|
@ -392,7 +392,7 @@ fn with_surface_toplevel_data<U, R, SD, F>(
|
|||
f: F,
|
||||
) where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
F: FnOnce(&mut ToplevelState),
|
||||
{
|
||||
|
@ -400,8 +400,8 @@ fn with_surface_toplevel_data<U, R, SD, F>(
|
|||
let &(ref surface, _, _) = unsafe { &*(ptr as *mut ShellSurfaceUserData) };
|
||||
implem
|
||||
.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(surface, |data| match data.pending_state {
|
||||
ShellSurfacePendingState::Toplevel(ref mut toplevel_data) => f(toplevel_data),
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(surface, |data| match data.pending_state {
|
||||
XdgSurfacePendingState::Toplevel(ref mut toplevel_data) => f(toplevel_data),
|
||||
_ => unreachable!(),
|
||||
})
|
||||
.expect("xdg_toplevel exists but surface has not shell_surface role?!");
|
||||
|
@ -413,7 +413,7 @@ pub fn send_toplevel_configure<U, R>(
|
|||
configure: ToplevelConfigure,
|
||||
) where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
{
|
||||
let &(ref surface, _, ref shell_surface) =
|
||||
unsafe { &*(resource.get_user_data() as *mut ShellSurfaceUserData) };
|
||||
|
@ -436,7 +436,7 @@ pub fn send_toplevel_configure<U, R>(
|
|||
shell_surface.send(xdg_surface::Event::Configure { serial });
|
||||
// Add the configure as pending
|
||||
token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(surface, |data| data.pending_configures.push(serial))
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(surface, |data| data.pending_configures.push(serial))
|
||||
.expect("xdg_toplevel exists but surface has not shell_surface role?!");
|
||||
}
|
||||
|
||||
|
@ -458,7 +458,7 @@ impl<U, R, SD> Implementation<Resource<xdg_toplevel::XdgToplevel>, xdg_toplevel:
|
|||
for ShellImplementation<U, R, SD>
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
fn receive(&mut self, request: xdg_toplevel::Request, toplevel: Resource<xdg_toplevel::XdgToplevel>) {
|
||||
|
@ -490,7 +490,7 @@ where
|
|||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(
|
||||
ShellEvent::ShowWindowMenu {
|
||||
XdgRequest::ShowWindowMenu {
|
||||
surface: handle,
|
||||
seat,
|
||||
serial,
|
||||
|
@ -503,7 +503,7 @@ where
|
|||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(
|
||||
ShellEvent::Move {
|
||||
XdgRequest::Move {
|
||||
surface: handle,
|
||||
seat,
|
||||
serial,
|
||||
|
@ -521,7 +521,7 @@ where
|
|||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(
|
||||
ShellEvent::Resize {
|
||||
XdgRequest::Resize {
|
||||
surface: handle,
|
||||
seat,
|
||||
serial,
|
||||
|
@ -543,18 +543,18 @@ where
|
|||
xdg_toplevel::Request::SetMaximized => {
|
||||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(ShellEvent::Maximize { surface: handle }, ());
|
||||
user_impl.receive(XdgRequest::Maximize { surface: handle }, ());
|
||||
}
|
||||
xdg_toplevel::Request::UnsetMaximized => {
|
||||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(ShellEvent::UnMaximize { surface: handle }, ());
|
||||
user_impl.receive(XdgRequest::UnMaximize { surface: handle }, ());
|
||||
}
|
||||
xdg_toplevel::Request::SetFullscreen { output } => {
|
||||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(
|
||||
ShellEvent::Fullscreen {
|
||||
XdgRequest::Fullscreen {
|
||||
surface: handle,
|
||||
output,
|
||||
},
|
||||
|
@ -564,12 +564,12 @@ where
|
|||
xdg_toplevel::Request::UnsetFullscreen => {
|
||||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(ShellEvent::UnFullscreen { surface: handle }, ());
|
||||
user_impl.receive(XdgRequest::UnFullscreen { surface: handle }, ());
|
||||
}
|
||||
xdg_toplevel::Request::SetMinimized => {
|
||||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(ShellEvent::Minimize { surface: handle }, ());
|
||||
user_impl.receive(XdgRequest::Minimize { surface: handle }, ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ fn destroy_toplevel<U, R, SD>(
|
|||
implem: Box<Implementation<Resource<xdg_toplevel::XdgToplevel>, xdg_toplevel::Request>>,
|
||||
) where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
let implem: ShellImplementation<U, R, SD> = *downcast_impl(implem).unwrap_or_else(|_| unreachable!());
|
||||
|
@ -596,8 +596,8 @@ fn destroy_toplevel<U, R, SD>(
|
|||
} else {
|
||||
implem
|
||||
.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(&data.0, |data| {
|
||||
data.pending_state = ShellSurfacePendingState::None;
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(&data.0, |data| {
|
||||
data.pending_state = XdgSurfacePendingState::None;
|
||||
data.configured = false;
|
||||
})
|
||||
.expect("xdg_toplevel exists but surface has not shell_surface role?!");
|
||||
|
@ -621,7 +621,7 @@ pub(crate) fn send_popup_configure<U, R>(
|
|||
configure: PopupConfigure,
|
||||
) where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
{
|
||||
let &(ref surface, _, ref shell_surface) =
|
||||
unsafe { &*(resource.get_user_data() as *mut ShellSurfaceUserData) };
|
||||
|
@ -637,7 +637,7 @@ pub(crate) fn send_popup_configure<U, R>(
|
|||
shell_surface.send(xdg_surface::Event::Configure { serial });
|
||||
// Add the configure as pending
|
||||
token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(surface, |data| data.pending_configures.push(serial))
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(surface, |data| data.pending_configures.push(serial))
|
||||
.expect("xdg_toplevel exists but surface has not shell_surface role?!");
|
||||
}
|
||||
|
||||
|
@ -659,7 +659,7 @@ impl<U, R, SD> Implementation<Resource<xdg_popup::XdgPopup>, xdg_popup::Request>
|
|||
for ShellImplementation<U, R, SD>
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
fn receive(&mut self, request: xdg_popup::Request, popup: Resource<xdg_popup::XdgPopup>) {
|
||||
|
@ -671,7 +671,7 @@ where
|
|||
let handle = make_popup_handle(self.compositor_token, &popup);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(
|
||||
ShellEvent::Grab {
|
||||
XdgRequest::Grab {
|
||||
surface: handle,
|
||||
seat,
|
||||
serial,
|
||||
|
@ -688,7 +688,7 @@ fn destroy_popup<U, R, SD>(
|
|||
implem: Box<Implementation<Resource<xdg_popup::XdgPopup>, xdg_popup::Request>>,
|
||||
) where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
let implem: ShellImplementation<U, R, SD> = *downcast_impl(implem).unwrap_or_else(|_| unreachable!());
|
||||
|
@ -704,8 +704,8 @@ fn destroy_popup<U, R, SD>(
|
|||
} else {
|
||||
implem
|
||||
.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(&data.0, |data| {
|
||||
data.pending_state = ShellSurfacePendingState::None;
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(&data.0, |data| {
|
||||
data.pending_state = XdgSurfacePendingState::None;
|
||||
data.configured = false;
|
||||
})
|
||||
.expect("xdg_popup exists but surface has not shell_surface role?!");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::{make_shell_client_data, PopupConfigure, PopupKind, PopupState, PositionerState, ShellClient,
|
||||
ShellClientData, ShellEvent, ShellImplementation, ShellSurfacePendingState, ShellSurfaceRole,
|
||||
ToplevelConfigure, ToplevelKind, ToplevelState};
|
||||
ShellClientData, ShellImplementation, ToplevelConfigure, ToplevelKind, ToplevelState,
|
||||
XdgRequest, XdgSurfacePendingState, XdgSurfaceRole};
|
||||
use std::sync::Mutex;
|
||||
use utils::Rectangle;
|
||||
use wayland::compositor::CompositorToken;
|
||||
|
@ -18,7 +18,7 @@ pub(crate) fn implement_shell<U, R, SD>(
|
|||
) -> Resource<zxdg_shell_v6::ZxdgShellV6>
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: Default + 'static,
|
||||
{
|
||||
let shell = shell.implement_nonsend(
|
||||
|
@ -29,7 +29,7 @@ where
|
|||
shell.set_user_data(Box::into_raw(Box::new(Mutex::new(make_shell_client_data::<SD>()))) as *mut _);
|
||||
let mut user_impl = implem.user_impl.borrow_mut();
|
||||
user_impl.receive(
|
||||
ShellEvent::NewClient {
|
||||
XdgRequest::NewClient {
|
||||
client: make_shell_client(&shell),
|
||||
},
|
||||
(),
|
||||
|
@ -62,7 +62,7 @@ impl<U, R, SD> Implementation<Resource<zxdg_shell_v6::ZxdgShellV6>, zxdg_shell_v
|
|||
for ShellImplementation<U, R, SD>
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
fn receive(&mut self, request: zxdg_shell_v6::Request, shell: Resource<zxdg_shell_v6::ZxdgShellV6>) {
|
||||
|
@ -74,8 +74,8 @@ where
|
|||
implement_positioner(id, &self.loop_token);
|
||||
}
|
||||
zxdg_shell_v6::Request::GetXdgSurface { id, surface } => {
|
||||
let role_data = ShellSurfaceRole {
|
||||
pending_state: ShellSurfacePendingState::None,
|
||||
let role_data = XdgSurfaceRole {
|
||||
pending_state: XdgSurfacePendingState::None,
|
||||
window_geometry: None,
|
||||
pending_configures: Vec::new(),
|
||||
configured: false,
|
||||
|
@ -112,7 +112,7 @@ where
|
|||
if valid {
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(
|
||||
ShellEvent::ClientPong {
|
||||
XdgRequest::ClientPong {
|
||||
client: make_shell_client(&shell),
|
||||
},
|
||||
(),
|
||||
|
@ -232,7 +232,7 @@ fn destroy_surface<U, R, SD>(
|
|||
implem: Box<Implementation<Resource<zxdg_surface_v6::ZxdgSurfaceV6>, zxdg_surface_v6::Request>>,
|
||||
) where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
let implem: ShellImplementation<U, R, SD> = *downcast_impl(implem).unwrap_or_else(|_| unreachable!());
|
||||
|
@ -248,8 +248,8 @@ fn destroy_surface<U, R, SD>(
|
|||
}
|
||||
implem
|
||||
.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(&data.0, |rdata| {
|
||||
if let ShellSurfacePendingState::None = rdata.pending_state {
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(&data.0, |rdata| {
|
||||
if let XdgSurfacePendingState::None = rdata.pending_state {
|
||||
// all is good
|
||||
} else {
|
||||
data.1.post_error(
|
||||
|
@ -265,7 +265,7 @@ impl<U, R, SD> Implementation<Resource<zxdg_surface_v6::ZxdgSurfaceV6>, zxdg_sur
|
|||
for ShellImplementation<U, R, SD>
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
fn receive(
|
||||
|
@ -281,8 +281,8 @@ where
|
|||
}
|
||||
zxdg_surface_v6::Request::GetToplevel { id } => {
|
||||
self.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(surface, |data| {
|
||||
data.pending_state = ShellSurfacePendingState::Toplevel(ToplevelState {
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(surface, |data| {
|
||||
data.pending_state = XdgSurfacePendingState::Toplevel(ToplevelState {
|
||||
parent: None,
|
||||
title: String::new(),
|
||||
app_id: String::new(),
|
||||
|
@ -310,7 +310,7 @@ where
|
|||
|
||||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(ShellEvent::NewToplevel { surface: handle }, ());
|
||||
user_impl.receive(XdgRequest::NewToplevel { surface: handle }, ());
|
||||
}
|
||||
zxdg_surface_v6::Request::GetPopup {
|
||||
id,
|
||||
|
@ -322,8 +322,8 @@ where
|
|||
let parent_ptr = parent.get_user_data();
|
||||
let &(ref parent_surface, _) = unsafe { &*(parent_ptr as *mut XdgSurfaceUserData) };
|
||||
self.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(surface, |data| {
|
||||
data.pending_state = ShellSurfacePendingState::Popup(PopupState {
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(surface, |data| {
|
||||
data.pending_state = XdgSurfacePendingState::Popup(PopupState {
|
||||
parent: Some(parent_surface.clone()),
|
||||
positioner: positioner_data.clone(),
|
||||
});
|
||||
|
@ -348,7 +348,7 @@ where
|
|||
|
||||
let handle = make_popup_handle(self.compositor_token, &popup);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(ShellEvent::NewPopup { surface: handle }, ());
|
||||
user_impl.receive(XdgRequest::NewPopup { surface: handle }, ());
|
||||
}
|
||||
zxdg_surface_v6::Request::SetWindowGeometry {
|
||||
x,
|
||||
|
@ -357,7 +357,7 @@ where
|
|||
height,
|
||||
} => {
|
||||
self.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(surface, |data| {
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(surface, |data| {
|
||||
data.window_geometry = Some(Rectangle {
|
||||
x,
|
||||
y,
|
||||
|
@ -369,7 +369,7 @@ where
|
|||
}
|
||||
zxdg_surface_v6::Request::AckConfigure { serial } => {
|
||||
self.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(surface, |data| {
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(surface, |data| {
|
||||
let mut found = false;
|
||||
data.pending_configures.retain(|&s| {
|
||||
if s == serial {
|
||||
|
@ -409,7 +409,7 @@ fn with_surface_toplevel_data<U, R, SD, F>(
|
|||
f: F,
|
||||
) where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
F: FnOnce(&mut ToplevelState),
|
||||
{
|
||||
|
@ -417,8 +417,8 @@ fn with_surface_toplevel_data<U, R, SD, F>(
|
|||
let &(ref surface, _, _) = unsafe { &*(ptr as *mut ShellSurfaceUserData) };
|
||||
implem
|
||||
.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(surface, |data| match data.pending_state {
|
||||
ShellSurfacePendingState::Toplevel(ref mut toplevel_data) => f(toplevel_data),
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(surface, |data| match data.pending_state {
|
||||
XdgSurfacePendingState::Toplevel(ref mut toplevel_data) => f(toplevel_data),
|
||||
_ => unreachable!(),
|
||||
})
|
||||
.expect("xdg_toplevel exists but surface has not shell_surface role?!");
|
||||
|
@ -430,7 +430,7 @@ pub fn send_toplevel_configure<U, R>(
|
|||
configure: ToplevelConfigure,
|
||||
) where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
{
|
||||
let &(ref surface, _, ref shell_surface) =
|
||||
unsafe { &*(resource.get_user_data() as *mut ShellSurfaceUserData) };
|
||||
|
@ -453,7 +453,7 @@ pub fn send_toplevel_configure<U, R>(
|
|||
shell_surface.send(zxdg_surface_v6::Event::Configure { serial });
|
||||
// Add the configure as pending
|
||||
token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(surface, |data| data.pending_configures.push(serial))
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(surface, |data| data.pending_configures.push(serial))
|
||||
.expect("xdg_toplevel exists but surface has not shell_surface role?!");
|
||||
}
|
||||
|
||||
|
@ -475,7 +475,7 @@ impl<U, R, SD> Implementation<Resource<zxdg_toplevel_v6::ZxdgToplevelV6>, zxdg_t
|
|||
for ShellImplementation<U, R, SD>
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
fn receive(
|
||||
|
@ -511,7 +511,7 @@ where
|
|||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(
|
||||
ShellEvent::ShowWindowMenu {
|
||||
XdgRequest::ShowWindowMenu {
|
||||
surface: handle,
|
||||
seat,
|
||||
serial,
|
||||
|
@ -524,7 +524,7 @@ where
|
|||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(
|
||||
ShellEvent::Move {
|
||||
XdgRequest::Move {
|
||||
surface: handle,
|
||||
seat,
|
||||
serial,
|
||||
|
@ -542,7 +542,7 @@ where
|
|||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(
|
||||
ShellEvent::Resize {
|
||||
XdgRequest::Resize {
|
||||
surface: handle,
|
||||
seat,
|
||||
serial,
|
||||
|
@ -564,18 +564,18 @@ where
|
|||
zxdg_toplevel_v6::Request::SetMaximized => {
|
||||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(ShellEvent::Maximize { surface: handle }, ());
|
||||
user_impl.receive(XdgRequest::Maximize { surface: handle }, ());
|
||||
}
|
||||
zxdg_toplevel_v6::Request::UnsetMaximized => {
|
||||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(ShellEvent::UnMaximize { surface: handle }, ());
|
||||
user_impl.receive(XdgRequest::UnMaximize { surface: handle }, ());
|
||||
}
|
||||
zxdg_toplevel_v6::Request::SetFullscreen { output } => {
|
||||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(
|
||||
ShellEvent::Fullscreen {
|
||||
XdgRequest::Fullscreen {
|
||||
surface: handle,
|
||||
output,
|
||||
},
|
||||
|
@ -585,12 +585,12 @@ where
|
|||
zxdg_toplevel_v6::Request::UnsetFullscreen => {
|
||||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(ShellEvent::UnFullscreen { surface: handle }, ());
|
||||
user_impl.receive(XdgRequest::UnFullscreen { surface: handle }, ());
|
||||
}
|
||||
zxdg_toplevel_v6::Request::SetMinimized => {
|
||||
let handle = make_toplevel_handle(self.compositor_token, &toplevel);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(ShellEvent::Minimize { surface: handle }, ());
|
||||
user_impl.receive(XdgRequest::Minimize { surface: handle }, ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ fn destroy_toplevel<U, R, SD>(
|
|||
implem: Box<Implementation<Resource<zxdg_toplevel_v6::ZxdgToplevelV6>, zxdg_toplevel_v6::Request>>,
|
||||
) where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
let implem: ShellImplementation<U, R, SD> = *downcast_impl(implem).unwrap_or_else(|_| unreachable!());
|
||||
|
@ -617,8 +617,8 @@ fn destroy_toplevel<U, R, SD>(
|
|||
} else {
|
||||
implem
|
||||
.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(&data.0, |data| {
|
||||
data.pending_state = ShellSurfacePendingState::None;
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(&data.0, |data| {
|
||||
data.pending_state = XdgSurfacePendingState::None;
|
||||
data.configured = false;
|
||||
})
|
||||
.expect("xdg_toplevel exists but surface has not shell_surface role?!");
|
||||
|
@ -642,7 +642,7 @@ pub(crate) fn send_popup_configure<U, R>(
|
|||
configure: PopupConfigure,
|
||||
) where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
{
|
||||
let &(ref surface, _, ref shell_surface) =
|
||||
unsafe { &*(resource.get_user_data() as *mut ShellSurfaceUserData) };
|
||||
|
@ -658,7 +658,7 @@ pub(crate) fn send_popup_configure<U, R>(
|
|||
shell_surface.send(zxdg_surface_v6::Event::Configure { serial });
|
||||
// Add the configure as pending
|
||||
token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(surface, |data| data.pending_configures.push(serial))
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(surface, |data| data.pending_configures.push(serial))
|
||||
.expect("xdg_toplevel exists but surface has not shell_surface role?!");
|
||||
}
|
||||
|
||||
|
@ -680,7 +680,7 @@ impl<U, R, SD> Implementation<Resource<zxdg_popup_v6::ZxdgPopupV6>, zxdg_popup_v
|
|||
for ShellImplementation<U, R, SD>
|
||||
where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
fn receive(&mut self, request: zxdg_popup_v6::Request, popup: Resource<zxdg_popup_v6::ZxdgPopupV6>) {
|
||||
|
@ -692,7 +692,7 @@ where
|
|||
let handle = make_popup_handle(self.compositor_token, &popup);
|
||||
let mut user_impl = self.user_impl.borrow_mut();
|
||||
user_impl.receive(
|
||||
ShellEvent::Grab {
|
||||
XdgRequest::Grab {
|
||||
surface: handle,
|
||||
seat,
|
||||
serial,
|
||||
|
@ -709,7 +709,7 @@ fn destroy_popup<U, R, SD>(
|
|||
implem: Box<Implementation<Resource<zxdg_popup_v6::ZxdgPopupV6>, zxdg_popup_v6::Request>>,
|
||||
) where
|
||||
U: 'static,
|
||||
R: Role<ShellSurfaceRole> + 'static,
|
||||
R: Role<XdgSurfaceRole> + 'static,
|
||||
SD: 'static,
|
||||
{
|
||||
let implem: ShellImplementation<U, R, SD> = *downcast_impl(implem).unwrap_or_else(|_| unreachable!());
|
||||
|
@ -725,8 +725,8 @@ fn destroy_popup<U, R, SD>(
|
|||
} else {
|
||||
implem
|
||||
.compositor_token
|
||||
.with_role_data::<ShellSurfaceRole, _, _>(&data.0, |data| {
|
||||
data.pending_state = ShellSurfacePendingState::None;
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(&data.0, |data| {
|
||||
data.pending_state = XdgSurfacePendingState::None;
|
||||
data.configured = false;
|
||||
})
|
||||
.expect("xdg_popup exists but surface has not shell_surface role?!");
|
||||
|
|
Loading…
Reference in New Issue