Skip to content

Commit

Permalink
fix(Windows): fix windows always visible initially
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Nov 8, 2022
1 parent 091ca47 commit ae06c3e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changes/windows-always-visible.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": "patch"
---

On Windows, fix window always visible initially.
2 changes: 1 addition & 1 deletion src/platform_impl/windows/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ unsafe extern "system" fn public_window_callback<T: 'static>(
};

if subclass_removed && recurse_depth == 0 {
Box::from_raw(subclass_input_ptr);
drop(Box::from_raw(subclass_input_ptr))
}

result
Expand Down
2 changes: 1 addition & 1 deletion src/platform_impl/windows/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ pub(crate) unsafe extern "system" fn subclass_proc(
let subclass_input = &*(subclass_input_ptr);

if msg == WM_DESTROY {
Box::from_raw(subclass_input_ptr);
drop(Box::from_raw(subclass_input_ptr));
}

match msg {
Expand Down
2 changes: 0 additions & 2 deletions src/platform_impl/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,13 @@ impl DeviceId {
#[non_exhaustive]
#[derive(Debug)]
pub enum OsError {
CreationError(&'static str),
IoError(std::io::Error),
}
impl std::error::Error for OsError {}

impl std::fmt::Display for OsError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
OsError::CreationError(e) => f.pad(e),
OsError::IoError(e) => f.pad(&e.to_string()),
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/platform_impl/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1074,9 +1074,12 @@ unsafe fn init<T: 'static>(
}
}

if attributes.content_protection {
win.set_content_protection(true);
}

win.set_visible(attributes.visible);
win.set_closable(attributes.closable);
win.set_content_protection(attributes.content_protection);

if let Some(position) = attributes.position {
win.set_outer_position(position);
Expand Down

0 comments on commit ae06c3e

Please sign in to comment.