2016-10-08 04:52:19 +11:00
|
|
|
use std::sync::Arc;
|
2015-12-13 21:43:39 +11:00
|
|
|
|
2016-10-08 04:52:19 +11:00
|
|
|
use wayland_client::protocol::{wl_display,wl_surface};
|
2015-12-13 21:43:39 +11:00
|
|
|
|
2016-10-08 04:52:19 +11:00
|
|
|
use {CreationError, MouseCursor, CursorState, Event, WindowAttributes};
|
2015-12-09 08:54:06 +11:00
|
|
|
|
2016-10-08 04:52:19 +11:00
|
|
|
use super::WaylandContext;
|
2015-12-09 08:54:06 +11:00
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct WindowProxy;
|
|
|
|
|
|
|
|
impl WindowProxy {
|
|
|
|
#[inline]
|
|
|
|
pub fn wakeup_event_loop(&self) {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct Window {
|
2016-10-08 04:52:19 +11:00
|
|
|
resize_callback: Option<fn(u32,u32)>
|
2015-12-13 21:43:39 +11:00
|
|
|
}
|
|
|
|
|
2015-12-09 08:54:06 +11:00
|
|
|
pub struct PollEventsIterator<'a> {
|
|
|
|
window: &'a Window,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> Iterator for PollEventsIterator<'a> {
|
|
|
|
type Item = Event;
|
|
|
|
|
|
|
|
fn next(&mut self) -> Option<Event> {
|
2016-10-08 04:52:19 +11:00
|
|
|
unimplemented!()
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct WaitEventsIterator<'a> {
|
|
|
|
window: &'a Window,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> Iterator for WaitEventsIterator<'a> {
|
|
|
|
type Item = Event;
|
|
|
|
|
|
|
|
fn next(&mut self) -> Option<Event> {
|
2016-10-08 04:52:19 +11:00
|
|
|
unimplemented!()
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Window {
|
2016-10-08 04:52:19 +11:00
|
|
|
pub fn new(ctxt: Arc<WaylandContext>, attributes: &WindowAttributes) -> Result<Window, CreationError>
|
2015-12-09 08:54:06 +11:00
|
|
|
{
|
2016-10-08 04:52:19 +11:00
|
|
|
unimplemented!()
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn set_title(&self, title: &str) {
|
2016-10-08 04:52:19 +11:00
|
|
|
// TODO
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn show(&self) {
|
2015-12-13 21:43:39 +11:00
|
|
|
// TODO
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn hide(&self) {
|
2015-12-13 21:43:39 +11:00
|
|
|
// TODO
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn get_position(&self) -> Option<(i32, i32)> {
|
2015-12-13 21:43:39 +11:00
|
|
|
// Not possible with wayland
|
|
|
|
None
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn set_position(&self, _x: i32, _y: i32) {
|
2015-12-13 21:43:39 +11:00
|
|
|
// Not possible with wayland
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_inner_size(&self) -> Option<(u32, u32)> {
|
2016-10-08 04:52:19 +11:00
|
|
|
// TODO
|
|
|
|
None
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn get_outer_size(&self) -> Option<(u32, u32)> {
|
2016-10-08 04:52:19 +11:00
|
|
|
// TODO
|
|
|
|
None
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn set_inner_size(&self, x: u32, y: u32) {
|
2016-10-08 04:52:19 +11:00
|
|
|
// TODO
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn create_window_proxy(&self) -> WindowProxy {
|
|
|
|
WindowProxy
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn poll_events(&self) -> PollEventsIterator {
|
|
|
|
PollEventsIterator {
|
|
|
|
window: self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn wait_events(&self) -> WaitEventsIterator {
|
|
|
|
WaitEventsIterator {
|
|
|
|
window: self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn set_window_resize_callback(&mut self, callback: Option<fn(u32, u32)>) {
|
2015-12-13 21:43:39 +11:00
|
|
|
self.resize_callback = callback;
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2015-12-13 23:13:20 +11:00
|
|
|
pub fn set_cursor(&self, _cursor: MouseCursor) {
|
2015-12-13 21:43:39 +11:00
|
|
|
// TODO
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2015-12-23 00:35:55 +11:00
|
|
|
pub fn set_cursor_state(&self, state: CursorState) -> Result<(), String> {
|
|
|
|
use CursorState::{Grab, Normal, Hide};
|
|
|
|
// TODO : not yet possible on wayland to grab cursor
|
|
|
|
match state {
|
|
|
|
Grab => Err("Cursor cannot be grabbed on wayland yet.".to_string()),
|
|
|
|
Hide => Err("Cursor cannot be hidden on wayland yet.".to_string()),
|
|
|
|
Normal => Ok(())
|
|
|
|
}
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn hidpi_factor(&self) -> f32 {
|
2016-10-08 04:52:19 +11:00
|
|
|
// TODO
|
2015-12-09 08:54:06 +11:00
|
|
|
1.0
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2015-12-13 21:43:39 +11:00
|
|
|
pub fn set_cursor_position(&self, _x: i32, _y: i32) -> Result<(), ()> {
|
|
|
|
// TODO: not yet possible on wayland
|
2015-12-23 00:35:55 +11:00
|
|
|
Err(())
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
2016-10-08 04:52:19 +11:00
|
|
|
|
|
|
|
pub fn get_display(&self) -> &wl_display::WlDisplay {
|
|
|
|
unimplemented!()
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
2016-10-08 04:52:19 +11:00
|
|
|
|
|
|
|
pub fn get_surface(&self) -> &wl_surface::WlSurface {
|
|
|
|
unimplemented!()
|
2015-12-09 08:54:06 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-13 21:43:39 +11:00
|
|
|
impl Drop for Window {
|
|
|
|
fn drop(&mut self) {
|
2016-10-08 04:52:19 +11:00
|
|
|
// TODO
|
2015-12-13 21:43:39 +11:00
|
|
|
}
|
2016-10-08 04:52:19 +11:00
|
|
|
}
|