Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Upgrade to wayland-rs 0.20 #88

Merged
merged 25 commits into from
Apr 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
570cee0
Prepare migration to wayland-rs-0.20
elinorbgr Apr 12, 2018
b9cac1a
wayland.shm: migrate to wayland_rs-0.20
elinorbgr Apr 13, 2018
1140b48
wayland.output: migrate to wayland_rs-0.20
elinorbgr Apr 14, 2018
93050e2
Doc proofreading
elinorbgr Apr 15, 2018
e44b0e5
wayland.seat: migrate to wayland_rs-0.20
elinorbgr Apr 15, 2018
710d23f
wayland.compositor: migrate to wayland_rs-0.20
elinorbgr Apr 17, 2018
6dfcef1
Remove unstable rustfmt options
elinorbgr Apr 17, 2018
b80093f
backend.session: migrate to wayland_rs-0.20
elinorbgr Apr 17, 2018
3a74a40
travis: only build master & PRs
elinorbgr Apr 17, 2018
cb4b783
backend.session.logind fixes
elinorbgr Apr 17, 2018
f9dbabc
backend.graphics: port no-feature code to wayland-rs 0.20
elinorbgr Apr 17, 2018
7f6af94
backend: migrate drm & udev
elinorbgr Apr 18, 2018
31a3d40
backend.drm: update doc examples
elinorbgr Apr 18, 2018
53242bd
backend.libinput: migrate to wayland-rs 0.20
elinorbgr Apr 18, 2018
422e8b3
backend.winit: migrate to wayland-rs 0.20
elinorbgr Apr 18, 2018
b8d4b17
wayland.shell: split wl and xdg & port xdg
elinorbgr Apr 18, 2018
d97fde3
wayland.shell: integrate the stable xdg_shell
elinorbgr Apr 18, 2018
9c88443
wayland.shell: clean start for wl_shell
elinorbgr Apr 19, 2018
d267a89
remove crates.io patch, wayland-rs 0.20 is published
elinorbgr Apr 21, 2018
4bd1501
wayland.shell: don't access the data of dead surfaces during cleanup
elinorbgr Apr 22, 2018
4579f20
port examples to wayland_rs 0.20
elinorbgr Apr 22, 2018
12e13f8
wayland.shell.xdg: make names more explicit
elinorbgr Apr 22, 2018
048dda5
wayland.shell: legacy module for wl_shell
elinorbgr Apr 23, 2018
ebee5fe
wayland-rs 0.20.1 works around the rustc bug
elinorbgr Apr 23, 2018
4fda0be
review comments
elinorbgr Apr 24, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
error_on_line_overflow = false
fn_args_density = "Compressed"
fn_args_layout = "Visual"
fn_arg_intent = "Tabbed"
reorder_imports = true
reorder_imported_names = true
report_todo = "Never"
report_fixme = "Never"
use_try_shorthand = true
max_width = 110
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ rust:

sudo: required

branches:
only:
- master

dist: trusty

# We cannot cache .vagga, because we actually do not have read permissions
Expand Down
13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ description = "Smithay is a library for writing wayland compositors."
repository = "https://github.com/Smithay/smithay"

[dependencies]
wayland-server = "0.14.0"
wayland-sys = "0.14.0"
nix = "0.9.0"
wayland-server = "0.20.1"
wayland-sys = "0.20.1"
nix = "0.10.0"
xkbcommon = "0.2.1"
tempfile = "2.1.5"
slog = { version = "2.1.1" }
slog-stdlog = "3.0.2"
libloading = "0.4.0"
wayland-client = { version = "0.12.5", optional = true }
wayland-client = { version = "0.20.1", optional = true }
winit = { version = "0.10.0", optional = true }
drm = { version = "^0.3.1", optional = true }
gbm = { version = "^0.4.0", optional = true, default-features = false, features = ["drm-support"] }
Expand All @@ -24,7 +24,7 @@ input = { version = "0.4.0", optional = true }
udev = { version = "0.2.0", optional = true }
dbus = { version = "0.6.1", optional = true }
systemd = { version = "^0.2.0", optional = true }
wayland-protocols = { version = "0.14.0", features = ["unstable_protocols", "server"] }
wayland-protocols = { version = "0.20.1", features = ["unstable_protocols", "server"] }
image = "0.17.0"
error-chain = "0.11.0"
lazy_static = "1.0.0"
Expand All @@ -38,7 +38,7 @@ slog-async = "2.2"
rand = "0.3"

[features]
default = ["backend_winit", "backend_drm", "backend_libinput", "backend_udev", "renderer_glium", "backend_session_logind"]
default = ["backend_winit", "backend_drm", "backend_libinput", "backend_udev", "renderer_glium"]
backend_winit = ["winit", "wayland-server/dlopen", "wayland-client/dlopen"]
backend_drm = ["drm", "gbm"]
backend_libinput = ["input"]
Expand All @@ -47,3 +47,4 @@ backend_session_udev = ["udev", "backend_session"]
backend_session_logind = ["dbus", "systemd", "backend_session"]
backend_udev = ["udev", "backend_drm", "backend_session_udev"]
renderer_glium = ["glium"]

26 changes: 14 additions & 12 deletions examples/drm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use std::os::unix::io::AsRawFd;
use std::os::unix::io::RawFd;
use std::rc::Rc;
use std::time::Duration;
use wayland_server::EventLoopHandle;

#[derive(Debug)]
pub struct Card(File);
Expand All @@ -56,7 +55,7 @@ fn main() {
);

// Initialize the wayland server
let (mut display, mut event_loop) = wayland_server::create_display();
let (mut display, mut event_loop) = wayland_server::Display::new();

/*
* Initialize the drm backend
Expand Down Expand Up @@ -124,10 +123,10 @@ fn main() {
* Initialize the globals
*/

init_shm_global(&mut event_loop, vec![], log.clone());
init_shm_global(&mut display, event_loop.token(), vec![], log.clone());

let (compositor_token, _shell_state_token, window_map) =
init_shell(&mut event_loop, log.clone(), egl_display.clone());
let (compositor_token, _, _, window_map) =
init_shell(&mut display, event_loop.token(), log.clone(), egl_display);

/*
* Add a listening socket:
Expand All @@ -139,7 +138,7 @@ fn main() {
* Register the DrmDevice on the EventLoop
*/
let _source = drm_device_bind(
&mut event_loop,
&event_loop.token(),
device,
DrmHandlerImpl {
compositor_token,
Expand All @@ -159,16 +158,19 @@ fn main() {
}

pub struct DrmHandlerImpl {
compositor_token: CompositorToken<SurfaceData, Roles, Rc<RefCell<Option<EGLDisplay>>>>,
compositor_token: CompositorToken<SurfaceData, Roles>,
window_map: Rc<RefCell<MyWindowMap>>,
drawer: GliumDrawer<DrmBackend<Card>>,
logger: ::slog::Logger,
}

impl DrmHandler<Card> for DrmHandlerImpl {
fn ready(
&mut self, _evlh: &mut EventLoopHandle, _device: &mut DrmDevice<Card>, _crtc: crtc::Handle,
_frame: u32, _duration: Duration,
&mut self,
_device: &mut DrmDevice<Card>,
_crtc: crtc::Handle,
_frame: u32,
_duration: Duration,
) {
let mut frame = self.drawer.draw();
frame.clear_color(0.8, 0.8, 0.9, 1.0);
Expand Down Expand Up @@ -215,8 +217,8 @@ impl DrmHandler<Card> for DrmHandlerImpl {

if let Some(ref texture) = attributes.user_data.texture {
if let Ok(subdata) = Role::<SubsurfaceRole>::data(role) {
x += subdata.x;
y += subdata.y;
x += subdata.location.0;
y += subdata.location.1;
}
info!(self.logger, "Render window");
self.drawer.render_texture(
Expand Down Expand Up @@ -248,7 +250,7 @@ impl DrmHandler<Card> for DrmHandlerImpl {
frame.finish().unwrap();
}

fn error(&mut self, _evlh: &mut EventLoopHandle, _device: &mut DrmDevice<Card>, error: DrmError) {
fn error(&mut self, _device: &mut DrmDevice<Card>, error: DrmError) {
panic!("{:?}", error);
}
}
9 changes: 7 additions & 2 deletions examples/helpers/glium.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,13 @@ impl<F: EGLGraphicsBackend + 'static> GliumDrawer<F> {
}

pub fn render_texture(
&self, target: &mut glium::Frame, texture: &Texture2d, y_inverted: bool,
surface_dimensions: (u32, u32), surface_location: (i32, i32), screen_size: (u32, u32),
&self,
target: &mut glium::Frame,
texture: &Texture2d,
y_inverted: bool,
surface_dimensions: (u32, u32),
surface_location: (i32, i32),
screen_size: (u32, u32),
blending: glium::Blend,
) {
let xscale = 2.0 * (surface_dimensions.0 as f32) / (screen_size.0 as f32);
Expand Down
Loading