Merge pull request #67 from Smithay/drm/get_current_mode

Add getter for current `DrmBackend` mode
This commit is contained in:
Victor Brekenfeld 2018-02-18 23:40:30 +01:00 committed by GitHub
commit 63aa7f8474
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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); self.connectors.retain(|x| *x != connector);
} }
/// Gets the currently used mode
pub fn current_mode(&self) -> Mode {
self.mode
}
/// Changes the currently set mode /// Changes the currently set mode
/// ///
/// # Errors /// # Errors

View File

@ -77,7 +77,8 @@ impl<T: EGLGraphicsBackend + 'static> From<T> for GliumGraphicsBackend<T> {
} }
impl<T: EGLGraphicsBackend + EGLWaylandExtensions + 'static> EGLWaylandExtensions impl<T: EGLGraphicsBackend + EGLWaylandExtensions + 'static> EGLWaylandExtensions
for GliumGraphicsBackend<T> { for GliumGraphicsBackend<T>
{
fn bind_wl_display(&self, display: &Display) -> EGLResult<EGLDisplay> { fn bind_wl_display(&self, display: &Display) -> EGLResult<EGLDisplay> {
(*self.backend).0.bind_wl_display(display) (*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> 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. /// Creates a new `UdevBackend` and adds it to the given `EventLoop`'s state.
/// ///
/// ## Arguments /// ## Arguments
@ -177,7 +178,8 @@ impl<
H: DrmHandler<SessionFdDrmDevice> + 'static, H: DrmHandler<SessionFdDrmDevice> + 'static,
S: Session + 'static, S: Session + 'static,
T: UdevHandler<H> + '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>) { fn pause<'a>(&mut self, state: &mut StateProxy<'a>) {
state.with_value(self, |state, udev| { state.with_value(self, |state, udev| {
for &mut (ref mut device, _) in udev.devices.values_mut() { for &mut (ref mut device, _) in udev.devices.values_mut() {

View File

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

View File

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