windows: Add back hide_title_bar
checks (#32427)
These `if` condition checks were removed in #30828, and this PR adds them back. This is especially important in the handling of `WM_NCHITTEST`, where all the calculations are based on the assumption that `hide_title_bar = true`. Release Notes: - N/A
This commit is contained in:
parent
b3a8816c0e
commit
4c3ada5753
1 changed files with 26 additions and 19 deletions
|
@ -888,6 +888,32 @@ fn handle_hit_test_msg(
|
|||
return None;
|
||||
}
|
||||
|
||||
let mut lock = state_ptr.state.borrow_mut();
|
||||
if let Some(mut callback) = lock.callbacks.hit_test_window_control.take() {
|
||||
drop(lock);
|
||||
let area = callback();
|
||||
state_ptr
|
||||
.state
|
||||
.borrow_mut()
|
||||
.callbacks
|
||||
.hit_test_window_control = Some(callback);
|
||||
if let Some(area) = area {
|
||||
return match area {
|
||||
WindowControlArea::Drag => Some(HTCAPTION as _),
|
||||
WindowControlArea::Close => Some(HTCLOSE as _),
|
||||
WindowControlArea::Max => Some(HTMAXBUTTON as _),
|
||||
WindowControlArea::Min => Some(HTMINBUTTON as _),
|
||||
};
|
||||
}
|
||||
} else {
|
||||
drop(lock);
|
||||
}
|
||||
|
||||
if !state_ptr.hide_title_bar {
|
||||
// If the OS draws the title bar, we don't need to handle hit test messages.
|
||||
return None;
|
||||
}
|
||||
|
||||
// default handler for resize areas
|
||||
let hit = unsafe { DefWindowProcW(handle, msg, wparam, lparam) };
|
||||
if matches!(
|
||||
|
@ -922,25 +948,6 @@ fn handle_hit_test_msg(
|
|||
return Some(HTTOP as _);
|
||||
}
|
||||
|
||||
let mut lock = state_ptr.state.borrow_mut();
|
||||
if let Some(mut callback) = lock.callbacks.hit_test_window_control.take() {
|
||||
drop(lock);
|
||||
let area = callback();
|
||||
state_ptr
|
||||
.state
|
||||
.borrow_mut()
|
||||
.callbacks
|
||||
.hit_test_window_control = Some(callback);
|
||||
if let Some(area) = area {
|
||||
return match area {
|
||||
WindowControlArea::Drag => Some(HTCAPTION as _),
|
||||
WindowControlArea::Close => Some(HTCLOSE as _),
|
||||
WindowControlArea::Max => Some(HTMAXBUTTON as _),
|
||||
WindowControlArea::Min => Some(HTMINBUTTON as _),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Some(HTCLIENT as _)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue