Add getter for current `DrmBackend` mode

This commit is contained in:
Drakulix 2018-02-08 13:58:54 +01:00
parent 3f99cdc76f
commit 8a30689015
5 changed files with 15 additions and 7 deletions

View File

@ -203,6 +203,11 @@ impl<A: Device + 'static> DrmBackend<A> {
self.connectors.retain(|x| *x != connector);
}
/// Gets the currently used mode
pub fn current_mode(&self) -> Mode {
self.mode
}
/// Changes the currently set mode
///
/// # Errors

View File

@ -77,7 +77,8 @@ impl<T: EGLGraphicsBackend + 'static> From<T> for GliumGraphicsBackend<T> {
}
impl<T: EGLGraphicsBackend + EGLWaylandExtensions + 'static> EGLWaylandExtensions
for GliumGraphicsBackend<T> {
for GliumGraphicsBackend<T>
{
fn bind_wl_display(&self, display: &Display) -> EGLResult<EGLDisplay> {
(*self.backend).0.bind_wl_display(display)
}

View File

@ -60,7 +60,8 @@ pub struct UdevBackend<
}
impl<H: DrmHandler<SessionFdDrmDevice> + 'static, S: Session + 'static, T: UdevHandler<H> + 'static>
UdevBackend<H, S, T> {
UdevBackend<H, S, T>
{
/// Creates a new `UdevBackend` and adds it to the given `EventLoop`'s state.
///
/// ## Arguments
@ -177,7 +178,8 @@ impl<
H: DrmHandler<SessionFdDrmDevice> + 'static,
S: Session + 'static,
T: UdevHandler<H> + 'static,
> SessionObserver for StateToken<UdevBackend<H, S, T>> {
> SessionObserver for StateToken<UdevBackend<H, S, T>>
{
fn pause<'a>(&mut self, state: &mut StateProxy<'a>) {
state.with_value(self, |state, udev| {
for &mut (ref mut device, _) in udev.devices.values_mut() {

View File

@ -11,8 +11,7 @@ pub struct RegionData {
impl RegionData {
/// Initialize the user_data of a region, must be called right when the surface is created
pub unsafe fn init(region: &wl_region::WlRegion) {
region.set_user_data(Box::into_raw(Box::new(Mutex::new(RegionData::default())))
as *mut _)
region.set_user_data(Box::into_raw(Box::new(Mutex::new(RegionData::default()))) as *mut _)
}
/// Cleans the user_data of that surface, must be called when it is destroyed

View File

@ -83,8 +83,9 @@ where
);
return;
}
shell_surface
.set_user_data(Box::into_raw(Box::new(unsafe { (surface.clone_unchecked(), shell.clone_unchecked()) })) as *mut _);
shell_surface.set_user_data(Box::into_raw(Box::new(unsafe {
(surface.clone_unchecked(), shell.clone_unchecked())
})) as *mut _);
evlh.register(
&shell_surface,
shell_surface_implementation(),