1
0
Fork 0
baseview/src/lib.rs
William Light 5207d961d9 x11: run window in a separate thread
there's a thread.join() to mimic the previous semantics (which are the
same as on the other platforms).
2020-09-11 18:53:33 +02:00

51 lines
897 B
Rust

use std::ffi::c_void;
#[cfg(target_os = "windows")]
mod win;
#[cfg(target_os = "windows")]
pub use win::*;
#[cfg(target_os = "linux")]
mod x11;
#[cfg(target_os = "linux")]
pub use crate::x11::*;
#[cfg(target_os = "macos")]
mod macos;
#[cfg(target_os = "macos")]
pub use macos::*;
mod event;
mod keyboard;
mod mouse_cursor;
pub use event::*;
pub use keyboard::*;
pub use mouse_cursor::MouseCursor;
pub enum Parent {
None,
AsIfParented,
WithParent(*mut c_void),
}
unsafe impl Send for Parent {}
pub struct WindowOpenOptions {
pub title: String,
pub width: usize,
pub height: usize,
pub parent: Parent,
}
pub trait WindowHandler {
type Message;
fn build(window: &mut Window) -> Self;
fn on_frame(&mut self);
fn on_event(&mut self, window: &mut Window, event: Event);
fn on_message(&mut self, window: &mut Window, message: Self::Message);
}