Fix examples

This commit is contained in:
Drakulix 2017-09-21 19:53:56 +02:00
parent 62be110265
commit 74b56e6de2
3 changed files with 25 additions and 13 deletions

View File

@ -2,7 +2,7 @@ language: rust
cache: cargo cache: cargo
sudo: false sudo: required
rust: rust:
- stable - stable
@ -21,8 +21,16 @@ dist: trusty
addons: addons:
apt: apt:
packages: packages:
- libwayland-dev - libssl-dev
- libudev-dev - libudev-dev
- libgbm-dev
- libxkbcommon-dev
- libegl1-mesa-dev
before_install:
- sudo add-apt-repository -y ppa:wayland.admin/daily-builds
- sudo apt-get update -qq
- sudo apt-get install -y libwayland-dev libinput-dev
branches: branches:
only: only:
@ -38,13 +46,13 @@ before_script:
- export XDG_RUNTIME_DIR="$(pwd)/socket" - export XDG_RUNTIME_DIR="$(pwd)/socket"
script: script:
- travis-cargo --only nightly fmt -- -- --write-mode=diff - travis-cargo -q --only nightly fmt -- -- --write-mode=diff
- travis-cargo --skip nightly build - travis-cargo -q --skip nightly test
- travis-cargo --only nightly build -- --features "clippy" - travis-cargo -q --only nightly test -- --features "clippy"
- travis-cargo --only stable doc -- --no-deps - travis-cargo -q --only stable doc -- --no-deps
after_success: after_success:
- travis-cargo --only stable doc-upload - travis-cargo -q --only stable doc-upload
env: env:
global: global:

View File

@ -25,7 +25,6 @@ use smithay::compositor::{compositor_init, CompositorToken, SubsurfaceRole, Trav
use smithay::compositor::roles::Role; use smithay::compositor::roles::Role;
use smithay::shell::{shell_init, ShellState}; use smithay::shell::{shell_init, ShellState};
use smithay::shm::init_shm_global; use smithay::shm::init_shm_global;
use std::borrow::Borrow;
use std::fs::OpenOptions; use std::fs::OpenOptions;
use std::io::Error as IoError; use std::io::Error as IoError;
use std::time::Duration; use std::time::Duration;
@ -148,7 +147,7 @@ impl DrmHandler<GliumDrawer<DrmBackend>> for DrmHandlerImpl {
frame.clear_color(0.8, 0.8, 0.9, 1.0); frame.clear_color(0.8, 0.8, 0.9, 1.0);
// redraw the frame, in a simple but inneficient way // redraw the frame, in a simple but inneficient way
{ {
let screen_dimensions = (drawer.borrow() as &DrmBackend).get_framebuffer_dimensions(); let screen_dimensions = drawer.get_framebuffer_dimensions();
for toplevel_surface in state.get(&self.shell_state_token).toplevel_surfaces() { for toplevel_surface in state.get(&self.shell_state_token).toplevel_surfaces() {
if let Some(wl_surface) = toplevel_surface.get_surface() { if let Some(wl_surface) = toplevel_surface.get_surface() {
// this surface is a root of a subsurface tree that needs to be drawn // this surface is a root of a subsurface tree that needs to be drawn

View File

@ -1,5 +1,5 @@
use glium; use glium;
use glium::Surface; use glium::{Frame, Surface};
use glium::index::PrimitiveType; use glium::index::PrimitiveType;
use smithay::backend::graphics::egl::EGLGraphicsBackend; use smithay::backend::graphics::egl::EGLGraphicsBackend;
use smithay::backend::graphics::glium::GliumGraphicsBackend; use smithay::backend::graphics::glium::GliumGraphicsBackend;
@ -22,10 +22,10 @@ pub struct GliumDrawer<F: EGLGraphicsBackend + 'static> {
} }
impl<F: EGLGraphicsBackend + 'static> Deref for GliumDrawer<F> { impl<F: EGLGraphicsBackend + 'static> Deref for GliumDrawer<F> {
type Target = GliumGraphicsBackend<F>; type Target = F;
fn deref(&self) -> &GliumGraphicsBackend<F> { fn deref(&self) -> &F {
&self.display self.borrow()
} }
} }
@ -142,4 +142,9 @@ impl<F: EGLGraphicsBackend + 'static> GliumDrawer<F> {
) )
.unwrap(); .unwrap();
} }
#[inline]
pub fn draw(&self) -> Frame {
self.display.draw()
}
} }