Skip to content

Commit

Permalink
fix: float windows by default if they have WS_POPUP style (#941)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChichiMsdk authored Jan 29, 2025
1 parent 0e4a5aa commit d3186ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion packages/wm-platform/src/native_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ use windows::{
SW_MINIMIZE, SW_RESTORE, SW_SHOWNA, WINDOWPLACEMENT,
WINDOW_EX_STYLE, WINDOW_STYLE, WM_CLOSE, WPF_ASYNCWINDOWPLACEMENT,
WS_CAPTION, WS_CHILD, WS_DLGFRAME, WS_EX_LAYERED,
WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW, WS_MAXIMIZEBOX, WS_THICKFRAME,
WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW, WS_MAXIMIZEBOX, WS_POPUP,
WS_THICKFRAME,
},
},
},
Expand Down Expand Up @@ -284,6 +285,12 @@ impl NativeWindow {
self.has_window_style(WS_THICKFRAME)
}

/// Whether the window is meant to be a popup window.
#[must_use]
pub fn is_popup(&self) -> bool {
self.has_window_style(WS_POPUP)
}

/// Whether the window is fullscreen.
///
/// Returns `false` if the window is maximized.
Expand Down
4 changes: 2 additions & 2 deletions packages/wm/src/commands/window/manage_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ fn window_state_to_create(
));
}

// Initialize windows that can't be resized as floating.
if !native_window.is_resizable() {
// Initialize non-resizable windows and popups as floating.
if !native_window.is_resizable() || native_window.is_popup() {
return Ok(WindowState::Floating(
config.value.window_behavior.state_defaults.floating.clone(),
));
Expand Down

0 comments on commit d3186ac

Please sign in to comment.