Skip to content
This repository was archived by the owner on Jul 15, 2024. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ scopeguard = "1.1.0"
wio = "0.2.2"
accesskit_windows = { version = "0.10.0", optional = true }

[target.'cfg(target_os="windows")'.dependencies.windows]
version = "0.36.1"
features = [
"implement",
"Win32_Foundation",
"Win32_UI_TextServices",
"Win32_System_Ole",
"Win32_System_Com"
]

[target.'cfg(target_os="windows")'.dependencies.winapi]
version = "0.3.9"
features = ["d2d1_1", "dwrite", "winbase", "libloaderapi", "errhandlingapi", "winuser",
Expand Down
8 changes: 8 additions & 0 deletions src/backend/windows/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ pub enum Error {
OldWindows,
/// The `hwnd` pointer was null.
NullHwnd,
WindowsResult(windows::core::Error),
}

impl From<windows::core::Error> for Error {
fn from(v: windows::core::Error) -> Self {
Self::WindowsResult(v)
}
}

fn hresult_description(hr: HRESULT) -> Option<String> {
Expand Down Expand Up @@ -78,6 +85,7 @@ impl fmt::Display for Error {
Error::Direct2D => write!(f, "Direct2D error"),
Error::OldWindows => write!(f, "Attempted newer API on older Windows"),
Error::NullHwnd => write!(f, "Window handle is Null"),
Error::WindowsResult(e) => e.fmt(f),
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/backend/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub mod screen;
mod timers;
pub mod util;
pub mod window;
mod text_input;

// https://docs.microsoft.com/en-us/windows/win32/direct2d/render-targets-overview
// ID2D1RenderTarget is the interface. The other resources inherit from it.
Expand Down
Loading