Cleanup GUID string and add more conditional compilation
This commit is contained in:
parent
2294fdb28d
commit
e5c37cc0de
11
src/lib.rs
11
src/lib.rs
|
@ -1,12 +1,20 @@
|
|||
// todo: will deal with conditional compilation/visibility later,
|
||||
// todo: we still have to choose how to organize the code
|
||||
// todo: for now I need this to be able to check and compile
|
||||
// todo: We should consider doing it as winit does it
|
||||
#[cfg(target_os = "windows")]
|
||||
mod win;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub use win::*;
|
||||
|
||||
use std::ffi::c_void;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
mod x11;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
mod macos;
|
||||
#[cfg(target_os = "macos")]
|
||||
pub use macos::Window;
|
||||
|
||||
pub enum Parent {
|
||||
|
@ -25,5 +33,6 @@ pub struct WindowOpenOptions<'a> {
|
|||
}
|
||||
|
||||
pub fn run(options: WindowOpenOptions) {
|
||||
#[cfg(target_os = "linux")]
|
||||
x11::run(options);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ pub fn create_window(w: WindowOpenOptions) {
|
|||
let mut guid: GUID = MaybeUninit::uninit().assume_init();
|
||||
CoCreateGuid(&mut guid);
|
||||
let class_name = format!(
|
||||
"Baseview-{}-{}-{}-{}{}{}{}{}{}{}{}\0",
|
||||
"Baseview-{:0X}-{:0X}-{:0X}-{:0X}{:0X}-{:0X}{:0X}{:0X}{:0X}{:0X}{:0X}\0",
|
||||
guid.Data1,
|
||||
guid.Data2,
|
||||
guid.Data3,
|
||||
|
@ -86,8 +86,7 @@ pub fn create_window(w: WindowOpenOptions) {
|
|||
let _hwnd = CreateWindowExA(
|
||||
0,
|
||||
class_name.as_ptr() as *const i8,
|
||||
// todo: change title based on options struct
|
||||
"Baseview\0".as_ptr() as *const i8,
|
||||
(w.title.to_owned() + "\0").as_ptr() as *const i8,
|
||||
// todo: fine for now, will have to change with a parent
|
||||
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
CW_USEDEFAULT,
|
||||
|
|
Loading…
Reference in a new issue