fix Windows build
This commit is contained in:
parent
3fe752ca80
commit
2ee975231b
0
.github/workflows/rust.yml
vendored
Executable file → Normal file
0
.github/workflows/rust.yml
vendored
Executable file → Normal file
0
.gitignore
vendored
Executable file → Normal file
0
.gitignore
vendored
Executable file → Normal file
0
.rustfmt.toml
Executable file → Normal file
0
.rustfmt.toml
Executable file → Normal file
0
Cargo.toml
Executable file → Normal file
0
Cargo.toml
Executable file → Normal file
0
examples/open_window.rs
Executable file → Normal file
0
examples/open_window.rs
Executable file → Normal file
0
src/event.rs
Executable file → Normal file
0
src/event.rs
Executable file → Normal file
0
src/keyboard.rs
Executable file → Normal file
0
src/keyboard.rs
Executable file → Normal file
0
src/lib.rs
Executable file → Normal file
0
src/lib.rs
Executable file → Normal file
0
src/macos/mod.rs
Executable file → Normal file
0
src/macos/mod.rs
Executable file → Normal file
0
src/macos/window.rs
Executable file → Normal file
0
src/macos/window.rs
Executable file → Normal file
0
src/mouse_cursor.rs
Executable file → Normal file
0
src/mouse_cursor.rs
Executable file → Normal file
0
src/win/mod.rs
Executable file → Normal file
0
src/win/mod.rs
Executable file → Normal file
19
src/win/window.rs
Executable file → Normal file
19
src/win/window.rs
Executable file → Normal file
|
@ -8,7 +8,7 @@ use winapi::um::winuser::{
|
|||
SetWindowLongPtrA, TranslateMessage, UnregisterClassA, CS_OWNDC, GWLP_USERDATA, MB_ICONERROR,
|
||||
MB_OK, MB_TOPMOST, MSG, WM_CLOSE, WM_CREATE, WM_MOUSEMOVE, WM_PAINT, WM_SHOWWINDOW, WM_TIMER,
|
||||
WNDCLASSA, WS_CAPTION, WS_CHILD, WS_CLIPSIBLINGS, WS_MAXIMIZEBOX, WS_MINIMIZEBOX,
|
||||
WS_POPUPWINDOW, WS_SIZEBOX, WS_VISIBLE,
|
||||
WS_POPUPWINDOW, WS_SIZEBOX, WS_VISIBLE, WM_DPICHANGED,
|
||||
};
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
@ -24,8 +24,7 @@ use raw_window_handle::{
|
|||
|
||||
use crate::{
|
||||
Event, KeyboardEvent, MouseButton, MouseEvent, Parent::WithParent, ScrollDelta, WindowEvent,
|
||||
WindowHandler, WindowInfo, WindowOpenOptions, WindowOpenResult, WindowScalePolicy, Size, Point,
|
||||
PhySize, PhyPoint,
|
||||
WindowHandler, WindowInfo, WindowOpenOptions, WindowScalePolicy, Size, Point, PhySize, PhyPoint,
|
||||
};
|
||||
|
||||
unsafe fn message_box(title: &str, msg: &str) {
|
||||
|
@ -108,6 +107,9 @@ unsafe extern "system" fn wnd_proc<H: WindowHandler>(
|
|||
.on_event(&mut window, Event::Window(WindowEvent::WillClose));
|
||||
return DefWindowProcA(hwnd, msg, wparam, lparam);
|
||||
}
|
||||
WM_DPICHANGED => {
|
||||
// TODO: Notify app of DPI change
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
@ -194,8 +196,8 @@ impl Window {
|
|||
|
||||
let scaling = match options.scale {
|
||||
// TODO: Find system scale factor
|
||||
WindowScalePolicy::TrySystemScaleFactor => 1.0,
|
||||
WindowScalePolicy::TrySystemScaleFactorTimes(user_scale) => 1.0 * user_scale,
|
||||
WindowScalePolicy::TrySystemScaleFactor => get_scaling().unwrap_or(1.0),
|
||||
WindowScalePolicy::TrySystemScaleFactorTimes(user_scale) => get_scaling().unwrap_or(1.0) * user_scale,
|
||||
WindowScalePolicy::UseScaleFactor(user_scale) => user_scale,
|
||||
WindowScalePolicy::NoScaling => 1.0,
|
||||
};
|
||||
|
@ -254,7 +256,7 @@ impl Window {
|
|||
SetWindowLongPtrA(hwnd, GWLP_USERDATA, Box::into_raw(window_state) as *const _ as _);
|
||||
SetTimer(hwnd, 4242, 13, None);
|
||||
|
||||
Ok((WindowHandle { hwnd }, window_info))
|
||||
WindowHandle { hwnd }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -267,3 +269,8 @@ unsafe impl HasRawWindowHandle for Window {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn get_scaling() -> Option<f64> {
|
||||
// TODO: find system scaling
|
||||
None
|
||||
}
|
0
src/window_info.rs
Executable file → Normal file
0
src/window_info.rs
Executable file → Normal file
0
src/window_open_options.rs
Executable file → Normal file
0
src/window_open_options.rs
Executable file → Normal file
0
src/x11/cursor.rs
Executable file → Normal file
0
src/x11/cursor.rs
Executable file → Normal file
0
src/x11/mod.rs
Executable file → Normal file
0
src/x11/mod.rs
Executable file → Normal file
0
src/x11/window.rs
Executable file → Normal file
0
src/x11/window.rs
Executable file → Normal file
0
src/x11/xcb_connection.rs
Executable file → Normal file
0
src/x11/xcb_connection.rs
Executable file → Normal file
Loading…
Reference in a new issue