Publish 0.8.1 with fixes necessary for glutin (#296)

This commit is contained in:
tomaka 2017-09-23 09:36:30 +02:00 committed by GitHub
parent 6a2a7036d4
commit 15fbc0dff4
4 changed files with 50 additions and 1 deletions

View file

@ -1,5 +1,10 @@
# Unreleased
# Version 0.8.1 (2017-09-22)
- Added various methods to `os::linux::EventsLoopExt`, plus some hidden items necessary to make
glutin work.
# Version 0.8.0 (2017-09-21)
- Added `Window::set_maximized`, `WindowAttributes::maximized` and `WindowBuilder::with_maximized`.

View file

@ -1,6 +1,6 @@
[package]
name = "winit"
version = "0.8.0"
version = "0.8.1"
authors = ["The winit contributors, Pierre Krieger <pierre.krieger1708@gmail.com>"]
description = "Cross-platform window creation library."
keywords = ["windowing"]

View file

@ -12,6 +12,10 @@ use WindowBuilder;
use platform::x11::XConnection;
use platform::x11::ffi::XVisualInfo;
// TODO: stupid hack so that glutin can do its work
#[doc(hidden)]
pub use platform::x11;
pub use platform::XNotSupported;
/// Additional methods on `EventsLoop` that are specific to Linux.
@ -23,6 +27,15 @@ pub trait EventsLoopExt {
/// Builds a new `EventsLoop` that is forced to use Wayland.
fn new_wayland() -> Self
where Self: Sized;
/// True if the `EventsLoop` uses Wayland.
fn is_wayland(&self) -> bool;
/// True if the `EventsLoop` uses X11.
fn is_x11(&self) -> bool;
#[doc(hidden)]
fn get_xlib_xconnection(&self) -> Option<Arc<XConnection>>;
}
impl EventsLoopExt for EventsLoop {
@ -40,6 +53,21 @@ impl EventsLoopExt for EventsLoop {
}
}
}
#[inline]
fn is_wayland(&self) -> bool {
self.events_loop.is_wayland()
}
#[inline]
fn is_x11(&self) -> bool {
!self.events_loop.is_wayland()
}
#[inline]
fn get_xlib_xconnection(&self) -> Option<Arc<XConnection>> {
self.events_loop.x_connection().cloned()
}
}
/// Additional methods on `Window` that are specific to Unix.

View file

@ -382,6 +382,22 @@ impl EventsLoop {
EventsLoop::X(ref mut evlp) => evlp.run_forever(callback)
}
}
#[inline]
pub fn is_wayland(&self) -> bool {
match *self {
EventsLoop::Wayland(_) => true,
EventsLoop::X(_) => false,
}
}
#[inline]
pub fn x_connection(&self) -> Option<&Arc<XConnection>> {
match *self {
EventsLoop::Wayland(_) => None,
EventsLoop::X(ref ev) => Some(ev.x_connection()),
}
}
}
impl EventsLoopProxy {