fmt: rust 1.31
This commit is contained in:
parent
a1b8d2bf47
commit
a3acd48cc3
|
@ -78,7 +78,8 @@ impl<T: Into<GliumGraphicsBackend<T>> + GLGraphicsBackend + 'static> GliumDrawer
|
|||
tex_coords: [1.0, 0.0],
|
||||
},
|
||||
],
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// building the index buffer
|
||||
let index_buffer =
|
||||
|
@ -121,7 +122,8 @@ impl<T: Into<GliumGraphicsBackend<T>> + GLGraphicsBackend + 'static> GliumDrawer
|
|||
tex_coords: [1.0, 0.0],
|
||||
},
|
||||
],
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// building the index buffer
|
||||
let index_buffer =
|
||||
|
@ -165,7 +167,8 @@ impl<F: GLGraphicsBackend + 'static> GliumDrawer<F> {
|
|||
MipmapsOption::NoMipmap,
|
||||
images.width,
|
||||
images.height,
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
unsafe {
|
||||
images
|
||||
.bind_to_texture(0, opengl_texture.get_id())
|
||||
|
@ -261,7 +264,8 @@ impl<F: GLGraphicsBackend + 'static> GliumDrawer<F> {
|
|||
blend: blending,
|
||||
..Default::default()
|
||||
},
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -338,7 +342,8 @@ impl<F: GLGraphicsBackend + 'static> GliumDrawer<F> {
|
|||
TraversalAction::SkipChildren
|
||||
}
|
||||
},
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -132,12 +132,14 @@ impl<B: InputBackend> InputHandler<B> for AnvilInputHandler {
|
|||
self.running.store(false, Ordering::SeqCst);
|
||||
}
|
||||
#[cfg(feature = "udev")]
|
||||
KeyAction::VtSwitch(vt) => if let Some(ref mut session) = self.session {
|
||||
info!(log, "Trying to switch to vt {}", vt);
|
||||
if let Err(err) = session.change_vt(vt) {
|
||||
error!(log, "Error switching to vt {}: {}", vt, err);
|
||||
KeyAction::VtSwitch(vt) => {
|
||||
if let Some(ref mut session) = self.session {
|
||||
info!(log, "Trying to switch to vt {}", vt);
|
||||
if let Err(err) = session.change_vt(vt) {
|
||||
error!(log, "Error switching to vt {}: {}", vt, err);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
KeyAction::Run(cmd) => {
|
||||
info!(self.log, "Starting program"; "cmd" => cmd.clone());
|
||||
if let Err(e) = Command::new(&cmd).spawn() {
|
||||
|
|
|
@ -130,7 +130,8 @@ pub fn run_udev(mut display: Display, mut event_loop: EventLoop<()>, log: Logger
|
|||
},
|
||||
seat.clone(),
|
||||
log.clone(),
|
||||
).map_err(|_| ())?;
|
||||
)
|
||||
.map_err(|_| ())?;
|
||||
|
||||
/*
|
||||
* Initialize wayland clipboard
|
||||
|
@ -151,7 +152,8 @@ pub fn run_udev(mut display: Display, mut event_loop: EventLoop<()>, log: Logger
|
|||
let keyboard = w_seat
|
||||
.add_keyboard(XkbConfig::default(), 1000, 500, |seat, focus| {
|
||||
set_data_device_focus(seat, focus.and_then(|s| s.client()))
|
||||
}).expect("Failed to initialize the keyboard");
|
||||
})
|
||||
.expect("Failed to initialize the keyboard");
|
||||
|
||||
/*
|
||||
* Initialize a fake output (we render one screen to every device in this example)
|
||||
|
@ -366,7 +368,8 @@ impl<S: SessionNotifier, Data: 'static> UdevHandler for UdevHandlerImpl<S, Data>
|
|||
.open(
|
||||
&path,
|
||||
OFlag::O_RDWR | OFlag::O_CLOEXEC | OFlag::O_NOCTTY | OFlag::O_NONBLOCK,
|
||||
).ok()
|
||||
)
|
||||
.ok()
|
||||
.and_then(|fd| LegacyDrmDevice::new(SessionFd(fd), self.logger.clone()).ok())
|
||||
.and_then(|drm| GbmDevice::new(drm, self.logger.clone()).ok())
|
||||
.and_then(|gbm| EglDevice::new(gbm, self.logger.clone()).ok())
|
||||
|
|
|
@ -59,7 +59,8 @@ pub fn run_winit(display: &mut Display, event_loop: &mut EventLoop<()>, log: Log
|
|||
let keyboard = seat
|
||||
.add_keyboard(XkbConfig::default(), 1000, 500, |seat, focus| {
|
||||
set_data_device_focus(seat, focus.and_then(|s| s.client()))
|
||||
}).expect("Failed to initialize the keyboard");
|
||||
})
|
||||
.expect("Failed to initialize the keyboard");
|
||||
|
||||
let (output, _) = Output::new(
|
||||
display,
|
||||
|
|
6
build.rs
6
build.rs
|
@ -33,7 +33,8 @@ fn main() {
|
|||
"EGL_EXT_platform_device",
|
||||
"EGL_KHR_image_base",
|
||||
],
|
||||
).write_bindings(gl_generator::GlobalGenerator, &mut file)
|
||||
)
|
||||
.write_bindings(gl_generator::GlobalGenerator, &mut file)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
|
@ -45,7 +46,8 @@ fn main() {
|
|||
Profile::Compatibility,
|
||||
Fallbacks::None,
|
||||
["GL_OES_EGL_image"],
|
||||
).write_bindings(gl_generator::StructGenerator, &mut file)
|
||||
)
|
||||
.write_bindings(gl_generator::StructGenerator, &mut file)
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,7 +149,8 @@ impl<D: RawDevice + ControlDevice + 'static> Device for GbmDevice<D> {
|
|||
h as u32,
|
||||
GbmFormat::XRGB8888,
|
||||
BufferObjectFlags::SCANOUT | BufferObjectFlags::RENDERING,
|
||||
).chain_err(|| ErrorKind::SurfaceCreationFailed)?;
|
||||
)
|
||||
.chain_err(|| ErrorKind::SurfaceCreationFailed)?;
|
||||
|
||||
// initialize a buffer for the cursor image
|
||||
let cursor = Cell::new((
|
||||
|
@ -160,7 +161,8 @@ impl<D: RawDevice + ControlDevice + 'static> Device for GbmDevice<D> {
|
|||
1,
|
||||
GbmFormat::ARGB8888,
|
||||
BufferObjectFlags::CURSOR | BufferObjectFlags::WRITE,
|
||||
).chain_err(|| ErrorKind::BufferCreationFailed)?,
|
||||
)
|
||||
.chain_err(|| ErrorKind::BufferCreationFailed)?,
|
||||
(0, 0),
|
||||
));
|
||||
|
||||
|
|
|
@ -61,16 +61,15 @@ impl<S: SessionObserver + 'static, D: RawDevice + ControlDevice + AsSessionObser
|
|||
}
|
||||
// reset cursor
|
||||
{
|
||||
let &(ref cursor, ref hotspot): &(
|
||||
BufferObject<()>,
|
||||
(u32, u32),
|
||||
) = unsafe { &*backend.cursor.as_ptr() };
|
||||
let &(ref cursor, ref hotspot): &(BufferObject<()>, (u32, u32)) =
|
||||
unsafe { &*backend.cursor.as_ptr() };
|
||||
if crtc::set_cursor2(
|
||||
&*backend.dev.borrow(),
|
||||
*crtc,
|
||||
cursor,
|
||||
((*hotspot).0 as i32, (*hotspot).1 as i32),
|
||||
).is_err()
|
||||
)
|
||||
.is_err()
|
||||
{
|
||||
if let Err(err) = crtc::set_cursor(&*backend.dev.borrow(), *crtc, cursor) {
|
||||
error!(self.logger, "Failed to reset cursor. Error: {}", err);
|
||||
|
|
|
@ -103,7 +103,8 @@ impl<D: RawDevice + 'static> GbmSurfaceInternal<D> {
|
|||
h as u32,
|
||||
GbmFormat::XRGB8888,
|
||||
BufferObjectFlags::SCANOUT | BufferObjectFlags::RENDERING,
|
||||
).chain_err(|| ErrorKind::SurfaceCreationFailed)?;
|
||||
)
|
||||
.chain_err(|| ErrorKind::SurfaceCreationFailed)?;
|
||||
|
||||
// Clean up buffers
|
||||
if let Some(Ok(Some(fb))) = self.next_buffer.take().map(|mut bo| bo.take_userdata()) {
|
||||
|
@ -231,7 +232,8 @@ impl<'a, A: AsRawFd + 'static> CursorBackend<'a> for GbmSurfaceInternal<LegacyDr
|
|||
h,
|
||||
GbmFormat::ARGB8888,
|
||||
BufferObjectFlags::CURSOR | BufferObjectFlags::WRITE,
|
||||
).chain_err(|| ErrorKind::BufferCreationFailed)?;
|
||||
)
|
||||
.chain_err(|| ErrorKind::BufferCreationFailed)?;
|
||||
|
||||
cursor
|
||||
.write(&**buffer)
|
||||
|
|
|
@ -227,35 +227,40 @@ impl<A: AsRawFd + 'static> Device for LegacyDrmDevice<A> {
|
|||
|
||||
fn process_events(&mut self) {
|
||||
match crtc::receive_events(self) {
|
||||
Ok(events) => for event in events {
|
||||
if let crtc::Event::PageFlip(event) = event {
|
||||
if self.active.load(Ordering::SeqCst) {
|
||||
if self
|
||||
.backends
|
||||
.borrow()
|
||||
.get(&event.crtc)
|
||||
.iter()
|
||||
.flat_map(|x| x.upgrade())
|
||||
.next()
|
||||
.is_some()
|
||||
{
|
||||
trace!(self.logger, "Handling event for backend {:?}", event.crtc);
|
||||
if let Some(handler) = self.handler.as_ref() {
|
||||
handler.borrow_mut().vblank(event.crtc);
|
||||
Ok(events) => {
|
||||
for event in events {
|
||||
if let crtc::Event::PageFlip(event) = event {
|
||||
if self.active.load(Ordering::SeqCst) {
|
||||
if self
|
||||
.backends
|
||||
.borrow()
|
||||
.get(&event.crtc)
|
||||
.iter()
|
||||
.flat_map(|x| x.upgrade())
|
||||
.next()
|
||||
.is_some()
|
||||
{
|
||||
trace!(self.logger, "Handling event for backend {:?}", event.crtc);
|
||||
if let Some(handler) = self.handler.as_ref() {
|
||||
handler.borrow_mut().vblank(event.crtc);
|
||||
}
|
||||
} else {
|
||||
self.backends.borrow_mut().remove(&event.crtc);
|
||||
}
|
||||
} else {
|
||||
self.backends.borrow_mut().remove(&event.crtc);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Err(err) => if let Some(handler) = self.handler.as_ref() {
|
||||
handler.borrow_mut().error(
|
||||
ResultExt::<()>::chain_err(Err(err), || {
|
||||
ErrorKind::DrmDev(format!("Error processing drm events on {:?}", self.dev_path()))
|
||||
}).unwrap_err(),
|
||||
);
|
||||
},
|
||||
}
|
||||
Err(err) => {
|
||||
if let Some(handler) = self.handler.as_ref() {
|
||||
handler.borrow_mut().error(
|
||||
ResultExt::<()>::chain_err(Err(err), || {
|
||||
ErrorKind::DrmDev(format!("Error processing drm events on {:?}", self.dev_path()))
|
||||
})
|
||||
.unwrap_err(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,8 @@ impl<A: AsRawFd + 'static> Surface for LegacyDrmSurfaceInternal<A> {
|
|||
encoder::Info::load_from_device(self, *encoder).chain_err(|| {
|
||||
ErrorKind::DrmDev(format!("Error loading encoder info on {:?}", self.dev_path()))
|
||||
})
|
||||
}).collect::<Result<Vec<encoder::Info>>>()?;
|
||||
})
|
||||
.collect::<Result<Vec<encoder::Info>>>()?;
|
||||
|
||||
// and if any encoder supports the selected crtc
|
||||
let resource_handles = self.resource_handles().chain_err(|| {
|
||||
|
@ -137,7 +138,8 @@ impl<A: AsRawFd + 'static> Surface for LegacyDrmSurfaceInternal<A> {
|
|||
if !connector::Info::load_from_device(self, *connector)
|
||||
.chain_err(|| {
|
||||
ErrorKind::DrmDev(format!("Error loading connector info on {:?}", self.dev_path()))
|
||||
})?.modes()
|
||||
})?
|
||||
.modes()
|
||||
.contains(&mode)
|
||||
{
|
||||
bail!(ErrorKind::ModeNotSuitable(mode));
|
||||
|
@ -201,7 +203,8 @@ impl<A: AsRawFd + 'static> RawSurface for LegacyDrmSurfaceInternal<A> {
|
|||
.collect::<Vec<connector::Handle>>(),
|
||||
(0, 0),
|
||||
pending.mode,
|
||||
).chain_err(|| {
|
||||
)
|
||||
.chain_err(|| {
|
||||
ErrorKind::DrmDev(format!(
|
||||
"Error setting crtc {:?} on {:?}",
|
||||
self.crtc,
|
||||
|
@ -222,7 +225,8 @@ impl<A: AsRawFd + 'static> RawSurface for LegacyDrmSurfaceInternal<A> {
|
|||
self.crtc,
|
||||
framebuffer,
|
||||
&[crtc::PageFlipFlags::PageFlipEvent],
|
||||
).map_err(|_| SwapBuffersError::ContextLost)
|
||||
)
|
||||
.map_err(|_| SwapBuffersError::ContextLost)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,12 +37,7 @@ pub use self::context::EGLContext;
|
|||
pub mod error;
|
||||
use self::error::*;
|
||||
|
||||
#[allow(
|
||||
non_camel_case_types,
|
||||
dead_code,
|
||||
unused_mut,
|
||||
non_upper_case_globals
|
||||
)]
|
||||
#[allow(non_camel_case_types, dead_code, unused_mut, non_upper_case_globals)]
|
||||
pub mod ffi;
|
||||
use self::ffi::egl::types::EGLImage;
|
||||
|
||||
|
|
|
@ -24,10 +24,7 @@ use wayland_server::calloop::{
|
|||
// No idea if this is the same across unix platforms
|
||||
// Lets make this linux exclusive for now, once someone tries to build it for
|
||||
// any BSD-like system, they can verify if this is right and make a PR to change this.
|
||||
#[cfg(all(
|
||||
any(target_os = "linux", target_os = "android"),
|
||||
feature = "backend_session"
|
||||
))]
|
||||
#[cfg(all(any(target_os = "linux", target_os = "android"), feature = "backend_session"))]
|
||||
const INPUT_MAJOR: u32 = 13;
|
||||
|
||||
/// Libinput based `InputBackend`.
|
||||
|
@ -448,16 +445,18 @@ impl backend::InputBackend for LibinputInputBackend {
|
|||
libinput::Event::Keyboard(keyboard_event) => {
|
||||
use input::event::keyboard::*;
|
||||
match keyboard_event {
|
||||
KeyboardEvent::Key(key_event) => if let Some(ref mut handler) = self.handler {
|
||||
let device_seat = key_event.device().seat();
|
||||
if let Some(ref seat) = self.seats.get(&device_seat) {
|
||||
trace!(self.logger, "Calling on_keyboard_key with {:?}", key_event);
|
||||
handler.on_keyboard_key(seat, key_event);
|
||||
} else {
|
||||
warn!(self.logger, "Received key event of non existing Seat");
|
||||
continue;
|
||||
KeyboardEvent::Key(key_event) => {
|
||||
if let Some(ref mut handler) = self.handler {
|
||||
let device_seat = key_event.device().seat();
|
||||
if let Some(ref seat) = self.seats.get(&device_seat) {
|
||||
trace!(self.logger, "Calling on_keyboard_key with {:?}", key_event);
|
||||
handler.on_keyboard_key(seat, key_event);
|
||||
} else {
|
||||
warn!(self.logger, "Received key event of non existing Seat");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
libinput::Event::Pointer(pointer_event) => {
|
||||
|
|
|
@ -101,7 +101,8 @@ impl LogindSession {
|
|||
"org.freedesktop.login1.Manager",
|
||||
"GetSession",
|
||||
Some(vec![session_id.clone().into()]),
|
||||
)?.get1::<DbusPath<'static>>()
|
||||
)?
|
||||
.get1::<DbusPath<'static>>()
|
||||
.chain_err(|| ErrorKind::UnexpectedMethodReturn)?;
|
||||
|
||||
// Match all signals that we want to receive and handle
|
||||
|
@ -342,7 +343,8 @@ impl Session for LogindSession {
|
|||
(major(stat.st_rdev) as u32).into(),
|
||||
(minor(stat.st_rdev) as u32).into(),
|
||||
]),
|
||||
)?.get2::<OwnedFd, bool>();
|
||||
)?
|
||||
.get2::<OwnedFd, bool>();
|
||||
let fd = fd.chain_err(|| ErrorKind::UnexpectedMethodReturn)?.into_fd();
|
||||
Ok(fd)
|
||||
} else {
|
||||
|
@ -363,7 +365,8 @@ impl Session for LogindSession {
|
|||
(major(stat.st_rdev) as u32).into(),
|
||||
(minor(stat.st_rdev) as u32).into(),
|
||||
]),
|
||||
).map(|_| ())
|
||||
)
|
||||
.map(|_| ())
|
||||
} else {
|
||||
bail!(ErrorKind::SessionLost)
|
||||
}
|
||||
|
@ -390,7 +393,8 @@ impl Session for LogindSession {
|
|||
"org.freedesktop.login1.Seat",
|
||||
"SwitchTo",
|
||||
Some(vec![(vt_num as u32).into()]),
|
||||
).map(|_| ())
|
||||
)
|
||||
.map(|_| ())
|
||||
} else {
|
||||
bail!(ErrorKind::SessionLost)
|
||||
}
|
||||
|
|
|
@ -185,8 +185,10 @@ impl DirectSession {
|
|||
path,
|
||||
fcntl::OFlag::O_RDWR | fcntl::OFlag::O_CLOEXEC,
|
||||
Mode::empty(),
|
||||
).chain_err(|| ErrorKind::FailedToOpenTTY(String::from(path.to_string_lossy())))
|
||||
}).unwrap_or_else(|| {
|
||||
)
|
||||
.chain_err(|| ErrorKind::FailedToOpenTTY(String::from(path.to_string_lossy())))
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
dup(0 /*stdin*/).chain_err(|| ErrorKind::FailedToOpenTTY(String::from("<stdin>")))
|
||||
})?;
|
||||
|
||||
|
@ -429,7 +431,8 @@ pub fn direct_session_bind<Data: 'static>(
|
|||
.insert_source(source, {
|
||||
let notifier = notifier.clone();
|
||||
move |_, _| notifier.borrow_mut().signal_received()
|
||||
}).map_err(move |e| {
|
||||
})
|
||||
.map_err(move |e| {
|
||||
// the backend in the closure should already have been dropped
|
||||
let notifier = Rc::try_unwrap(fail_notifier)
|
||||
.unwrap_or_else(|_| unreachable!())
|
||||
|
|
|
@ -73,7 +73,8 @@ impl<T: UdevHandler + 'static> UdevBackend<T> {
|
|||
warn!(log, "Unable to get id of {:?}, Error: {:?}. Skipping", path, err);
|
||||
None
|
||||
}
|
||||
}).collect();
|
||||
})
|
||||
.collect();
|
||||
|
||||
let mut builder = MonitorBuilder::new(context)?;
|
||||
builder.match_subsystem("drm")?;
|
||||
|
@ -217,6 +218,7 @@ pub fn all_gpus<S: AsRef<str>>(context: &Context, seat: S) -> UdevResult<Vec<Pat
|
|||
.map(|x| x.to_os_string())
|
||||
.unwrap_or(OsString::from("seat0"))
|
||||
== *seat.as_ref()
|
||||
}).flat_map(|device| device.devnode().map(PathBuf::from))
|
||||
})
|
||||
.flat_map(|device| device.devnode().map(PathBuf::from))
|
||||
.collect())
|
||||
}
|
||||
|
|
|
@ -108,7 +108,8 @@ impl PointerGrab for DnDGrab {
|
|||
offer_data.clone(),
|
||||
action_choice,
|
||||
)
|
||||
}).unwrap();
|
||||
})
|
||||
.unwrap();
|
||||
// advertize the offer to the client
|
||||
device.send(wl_data_device::Event::DataOffer { id: offer.clone() });
|
||||
with_source_metadata(source, |meta| {
|
||||
|
@ -118,7 +119,8 @@ impl PointerGrab for DnDGrab {
|
|||
offer.send(wl_data_offer::Event::SourceActions {
|
||||
source_actions: meta.dnd_action.to_raw(),
|
||||
});
|
||||
}).unwrap();
|
||||
})
|
||||
.unwrap();
|
||||
device.send(wl_data_device::Event::Enter {
|
||||
serial,
|
||||
x: x - sx,
|
||||
|
|
|
@ -150,7 +150,8 @@ impl SeatData {
|
|||
// check if the source and associated mime type is still valid
|
||||
let valid = with_source_metadata(&source, |meta| {
|
||||
meta.mime_types.contains(&mime_type)
|
||||
}).unwrap_or(false)
|
||||
})
|
||||
.unwrap_or(false)
|
||||
&& source.is_alive();
|
||||
if !valid {
|
||||
// deny the receive
|
||||
|
@ -171,7 +172,8 @@ impl SeatData {
|
|||
for mime_type in meta.mime_types.iter().cloned() {
|
||||
offer.send(wl_data_offer::Event::Offer { mime_type })
|
||||
}
|
||||
}).unwrap();
|
||||
})
|
||||
.unwrap();
|
||||
dd.send(wl_data_device::Event::Selection { id: Some(offer) });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,8 @@ where
|
|||
self.callback.clone(),
|
||||
action_choice,
|
||||
)
|
||||
}).unwrap();
|
||||
})
|
||||
.unwrap();
|
||||
// advertize the offer to the client
|
||||
device.send(wl_data_device::Event::DataOffer { id: offer.clone() });
|
||||
for mime_type in self.metadata.mime_types.iter().cloned() {
|
||||
|
|
|
@ -141,7 +141,8 @@ impl KbdInternal {
|
|||
&xkb_config.variant,
|
||||
xkb_config.options,
|
||||
xkb::KEYMAP_COMPILE_NO_FLAGS,
|
||||
).ok_or(())?;
|
||||
)
|
||||
.ok_or(())?;
|
||||
let state = xkb::State::new(&keymap);
|
||||
Ok(KbdInternal {
|
||||
known_kbds: Vec::new(),
|
||||
|
|
|
@ -119,7 +119,8 @@ where
|
|||
} else {
|
||||
false
|
||||
}
|
||||
}).expect("wl_shell_surface exists but surface has not the right role?");
|
||||
})
|
||||
.expect("wl_shell_surface exists but surface has not the right role?");
|
||||
if valid {
|
||||
(&mut *user_impl)(ShellRequest::Pong {
|
||||
surface: make_handle(&shell_surface, ctoken),
|
||||
|
|
|
@ -620,7 +620,8 @@ where
|
|||
.with_role_data::<XdgSurfaceRole, _, _>(&self.wl_surface, |data| match data.pending_state {
|
||||
XdgSurfacePendingState::Toplevel(ref state) => Some(state.clone()),
|
||||
_ => None,
|
||||
}).ok()
|
||||
})
|
||||
.ok()
|
||||
.and_then(|x| x)
|
||||
}
|
||||
}
|
||||
|
@ -782,7 +783,8 @@ where
|
|||
.with_role_data::<XdgSurfaceRole, _, _>(&self.wl_surface, |data| match data.pending_state {
|
||||
XdgSurfacePendingState::Popup(ref state) => Some(state.clone()),
|
||||
_ => None,
|
||||
}).ok()
|
||||
})
|
||||
.ok()
|
||||
.and_then(|x| x)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,7 +217,8 @@ where
|
|||
"xdg_surface was destroyed before its role object".into(),
|
||||
);
|
||||
}
|
||||
}).expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
})
|
||||
.expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
}
|
||||
|
||||
fn xdg_surface_implementation<U, R, SD>(
|
||||
|
@ -244,7 +245,8 @@ fn xdg_surface_implementation<U, R, SD>(
|
|||
min_size: (0, 0),
|
||||
max_size: (0, 0),
|
||||
});
|
||||
}).expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
})
|
||||
.expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
let toplevel = id.implement_nonsend(
|
||||
toplevel_implementation::<U, R, SD>,
|
||||
Some(destroy_toplevel::<U, R, SD>),
|
||||
|
@ -286,7 +288,8 @@ fn xdg_surface_implementation<U, R, SD>(
|
|||
parent: parent_surface,
|
||||
positioner: positioner_data.borrow().clone(),
|
||||
});
|
||||
}).expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
})
|
||||
.expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
let popup = id.implement_nonsend(
|
||||
xg_popup_implementation::<U, R, SD>,
|
||||
Some(destroy_popup::<U, R, SD>),
|
||||
|
@ -315,7 +318,8 @@ fn xdg_surface_implementation<U, R, SD>(
|
|||
.compositor_token
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(&data.wl_surface, |data| {
|
||||
data.window_geometry = Some(Rectangle { x, y, width, height });
|
||||
}).expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
})
|
||||
.expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
}
|
||||
xdg_surface::Request::AckConfigure { serial } => {
|
||||
data.shell_data
|
||||
|
@ -336,7 +340,8 @@ fn xdg_surface_implementation<U, R, SD>(
|
|||
);
|
||||
}
|
||||
role_data.configured = true;
|
||||
}).expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
})
|
||||
.expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -369,7 +374,8 @@ fn with_surface_toplevel_data<U, R, SD, F>(
|
|||
.with_role_data::<XdgSurfaceRole, _, _>(&toplevel_data.wl_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?!");
|
||||
})
|
||||
.expect("xdg_toplevel exists but surface has not shell_surface role?!");
|
||||
}
|
||||
|
||||
pub fn send_toplevel_configure<U, R, SD>(
|
||||
|
@ -539,7 +545,8 @@ where
|
|||
.with_role_data::<XdgSurfaceRole, _, _>(&data.wl_surface, |data| {
|
||||
data.pending_state = XdgSurfacePendingState::None;
|
||||
data.configured = false;
|
||||
}).expect("xdg_toplevel exists but surface has not shell_surface role?!");
|
||||
})
|
||||
.expect("xdg_toplevel exists but surface has not shell_surface role?!");
|
||||
}
|
||||
// remove this surface from the known ones (as well as any leftover dead surface)
|
||||
data.shell_data
|
||||
|
@ -627,7 +634,8 @@ where
|
|||
.with_role_data::<XdgSurfaceRole, _, _>(&data.wl_surface, |data| {
|
||||
data.pending_state = XdgSurfacePendingState::None;
|
||||
data.configured = false;
|
||||
}).expect("xdg_popup exists but surface has not shell_surface role?!");
|
||||
})
|
||||
.expect("xdg_popup exists but surface has not shell_surface role?!");
|
||||
}
|
||||
// remove this surface from the known ones (as well as any leftover dead surface)
|
||||
data.shell_data
|
||||
|
|
|
@ -236,7 +236,8 @@ where
|
|||
"xdg_surface was destroyed before its role object".into(),
|
||||
);
|
||||
}
|
||||
}).expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
})
|
||||
.expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
}
|
||||
|
||||
fn xdg_surface_implementation<U, R, SD>(
|
||||
|
@ -263,7 +264,8 @@ fn xdg_surface_implementation<U, R, SD>(
|
|||
min_size: (0, 0),
|
||||
max_size: (0, 0),
|
||||
});
|
||||
}).expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
})
|
||||
.expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
let toplevel = id.implement_nonsend(
|
||||
toplevel_implementation::<U, R, SD>,
|
||||
Some(destroy_toplevel::<U, R, SD>),
|
||||
|
@ -302,7 +304,8 @@ fn xdg_surface_implementation<U, R, SD>(
|
|||
parent: Some(parent_data.wl_surface.clone()),
|
||||
positioner: positioner_data.borrow().clone(),
|
||||
});
|
||||
}).expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
})
|
||||
.expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
let popup = id.implement_nonsend(
|
||||
popup_implementation::<U, R, SD>,
|
||||
Some(destroy_popup::<U, R, SD>),
|
||||
|
@ -331,7 +334,8 @@ fn xdg_surface_implementation<U, R, SD>(
|
|||
.compositor_token
|
||||
.with_role_data::<XdgSurfaceRole, _, _>(&data.wl_surface, |data| {
|
||||
data.window_geometry = Some(Rectangle { x, y, width, height });
|
||||
}).expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
})
|
||||
.expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
}
|
||||
zxdg_surface_v6::Request::AckConfigure { serial } => {
|
||||
data.shell_data
|
||||
|
@ -352,7 +356,8 @@ fn xdg_surface_implementation<U, R, SD>(
|
|||
);
|
||||
}
|
||||
role_data.configured = true;
|
||||
}).expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
})
|
||||
.expect("xdg_surface exists but surface has not shell_surface role?!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -382,7 +387,8 @@ where
|
|||
.with_role_data::<XdgSurfaceRole, _, _>(&data.wl_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?!");
|
||||
})
|
||||
.expect("xdg_toplevel exists but surface has not shell_surface role?!");
|
||||
}
|
||||
|
||||
pub fn send_toplevel_configure<U, R, SD>(
|
||||
|
@ -553,7 +559,8 @@ where
|
|||
.with_role_data::<XdgSurfaceRole, _, _>(&data.wl_surface, |data| {
|
||||
data.pending_state = XdgSurfacePendingState::None;
|
||||
data.configured = false;
|
||||
}).expect("xdg_toplevel exists but surface has not shell_surface role?!");
|
||||
})
|
||||
.expect("xdg_toplevel exists but surface has not shell_surface role?!");
|
||||
}
|
||||
// remove this surface from the known ones (as well as any leftover dead surface)
|
||||
data.shell_data
|
||||
|
@ -644,7 +651,8 @@ where
|
|||
.with_role_data::<XdgSurfaceRole, _, _>(&data.wl_surface, |data| {
|
||||
data.pending_state = XdgSurfacePendingState::None;
|
||||
data.configured = false;
|
||||
}).expect("xdg_popup exists but surface has not shell_surface role?!");
|
||||
})
|
||||
.expect("xdg_popup exists but surface has not shell_surface role?!");
|
||||
}
|
||||
// remove this surface from the known ones (as well as any leftover dead surface)
|
||||
data.shell_data
|
||||
|
|
|
@ -97,7 +97,8 @@ impl<WM: XWindowManager + 'static> XWayland<WM> {
|
|||
debug_assert!(evt.signal() == Signal::SIGUSR1);
|
||||
xwayland_ready(&inner);
|
||||
},
|
||||
).map_err(|_| ())
|
||||
)
|
||||
.map_err(|_| ())
|
||||
}),
|
||||
wayland_display: display,
|
||||
instance: None,
|
||||
|
|
Loading…
Reference in New Issue