examples: reduce warnings

This commit is contained in:
Victor Berger 2017-09-22 15:00:29 +02:00
parent 4b4097d56d
commit cfb388561f
3 changed files with 7 additions and 9 deletions

View File

@ -21,9 +21,9 @@ use helpers::{init_shell, GliumDrawer, MyWindowMap, Roles, SurfaceData};
use slog::{Drain, Logger}; use slog::{Drain, Logger};
use smithay::backend::drm::{drm_device_bind, DrmBackend, DrmDevice, DrmHandler}; use smithay::backend::drm::{drm_device_bind, DrmBackend, DrmDevice, DrmHandler};
use smithay::backend::graphics::egl::EGLGraphicsBackend; use smithay::backend::graphics::egl::EGLGraphicsBackend;
use smithay::compositor::{compositor_init, CompositorToken, SubsurfaceRole, TraversalAction}; use smithay::compositor::{CompositorToken, SubsurfaceRole, TraversalAction};
use smithay::compositor::roles::Role; use smithay::compositor::roles::Role;
use smithay::shell::{shell_init, ShellState}; use smithay::shell::ShellState;
use smithay::shm::init_shm_global; use smithay::shm::init_shm_global;
use std::cell::RefCell; use std::cell::RefCell;
use std::fs::OpenOptions; use std::fs::OpenOptions;

View File

@ -30,7 +30,7 @@ where
// need to check more carefully // need to check more carefully
let mut found = None; let mut found = None;
if let Some(wl_surface) = self.toplevel.get_surface() { if let Some(wl_surface) = self.toplevel.get_surface() {
ctoken.with_surface_tree_downward( let _ = ctoken.with_surface_tree_downward(
wl_surface, wl_surface,
self.location, self.location,
|wl_surface, attributes, role, &(mut x, mut y)| if let Some((w, h)) = get_size(attributes) { |wl_surface, attributes, role, &(mut x, mut y)| if let Some((w, h)) = get_size(attributes) {
@ -60,14 +60,14 @@ where
found found
} }
fn self_update<F>(&mut self, ctoken: CompositorToken<U, R, CID>, mut get_size: F) fn self_update<F>(&mut self, ctoken: CompositorToken<U, R, CID>, get_size: F)
where where
F: Fn(&SurfaceAttributes<U>) -> Option<(i32, i32)>, F: Fn(&SurfaceAttributes<U>) -> Option<(i32, i32)>,
{ {
let (base_x, base_y) = self.location; let (base_x, base_y) = self.location;
let (mut min_x, mut min_y, mut max_x, mut max_y) = (base_x, base_y, base_x, base_y); let (mut min_x, mut min_y, mut max_x, mut max_y) = (base_x, base_y, base_x, base_y);
if let Some(wl_surface) = self.toplevel.get_surface() { if let Some(wl_surface) = self.toplevel.get_surface() {
ctoken.with_surface_tree_downward( let _ = ctoken.with_surface_tree_downward(
wl_surface, wl_surface,
(base_x, base_y), (base_x, base_y),
|_, attributes, role, &(mut x, mut y)| { |_, attributes, role, &(mut x, mut y)| {

View File

@ -18,10 +18,9 @@ use smithay::backend::graphics::egl::EGLGraphicsBackend;
use smithay::backend::input::{self, Event, InputBackend, InputHandler, KeyboardKeyEvent, PointerButtonEvent, use smithay::backend::input::{self, Event, InputBackend, InputHandler, KeyboardKeyEvent, PointerButtonEvent,
PointerMotionAbsoluteEvent}; PointerMotionAbsoluteEvent};
use smithay::backend::winit; use smithay::backend::winit;
use smithay::compositor::{compositor_init, SubsurfaceRole, SurfaceAttributes, TraversalAction}; use smithay::compositor::{SubsurfaceRole, TraversalAction};
use smithay::compositor::roles::Role; use smithay::compositor::roles::Role;
use smithay::seat::{KbdHandle, PointerHandle, Seat}; use smithay::seat::{KbdHandle, PointerHandle, Seat};
use smithay::shell::{shell_init, ShellSurfaceRole};
use smithay::shm::init_shm_global; use smithay::shm::init_shm_global;
use std::cell::RefCell; use std::cell::RefCell;
use std::rc::Rc; use std::rc::Rc;
@ -138,7 +137,7 @@ fn main() {
init_shm_global(&mut event_loop, vec![], log.clone()); init_shm_global(&mut event_loop, vec![], log.clone());
let (compositor_token, shell_state_token, window_map) = init_shell(&mut event_loop, log.clone()); let (compositor_token, _shell_state_token, window_map) = init_shell(&mut event_loop, log.clone());
let (seat_token, _) = Seat::new(&mut event_loop, "winit".into(), log.clone()); let (seat_token, _) = Seat::new(&mut event_loop, "winit".into(), log.clone());
@ -177,7 +176,6 @@ fn main() {
// redraw the frame, in a simple but inneficient way // redraw the frame, in a simple but inneficient way
{ {
let screen_dimensions = drawer.get_framebuffer_dimensions(); let screen_dimensions = drawer.get_framebuffer_dimensions();
let state = event_loop.state();
window_map window_map
.borrow() .borrow()
.with_windows_from_bottom_to_top(|toplevel_surface, initial_place| { .with_windows_from_bottom_to_top(|toplevel_surface, initial_place| {