Skip to content

Commit

Permalink
refactor(widows): update comments about aerosnap & remove shadow (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ngo Iok Ui (Wu Yu Wei) authored Jul 8, 2021
1 parent 9b906f5 commit 921c901
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
10 changes: 1 addition & 9 deletions src/platform_impl/windows/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -828,15 +828,7 @@ unsafe extern "system" fn public_window_callback<T: 'static>(
.recurse_depth
.set(subclass_input.recurse_depth.get() + 1);

// we remove the temp_win_flags as soon as the first msg to the subclass_procedure,
// so it will disable the normal_procedure
// if TEMP_WIN_FLAGS
// .lock()
// .get(&subclass_input.temp_flags_id)
// .is_some()
// {
// TEMP_WIN_FLAGS.lock().remove(&subclass_input.temp_flags_id);
// }
// Clear userdata
winuser::SetWindowLongPtrW(window, winuser::GWL_USERDATA, 0);

let result =
Expand Down
16 changes: 2 additions & 14 deletions src/platform_impl/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -878,18 +878,6 @@ unsafe fn init<T: 'static>(
DeleteObject(region as _);
}

// make shadow for borderless windows as it is not there by default
// FIXME: add shadow attribute?
if !attributes.decorations {
let margins = winapi::um::uxtheme::MARGINS {
cxLeftWidth: 1,
cxRightWidth: 1,
cyBottomHeight: 1,
cyTopHeight: 1,
};
dwmapi::DwmExtendFrameIntoClientArea(real_window.0, &margins);
}

// If the system theme is dark, we need to set the window theme now
// before we update the window flags (and possibly show the
// window for the first time).
Expand Down Expand Up @@ -1007,8 +995,7 @@ unsafe extern "system" fn window_proc(

match msg {
winuser::WM_NCCALCSIZE => {
// here we handle necessary messages with temp_window_flags until the subclass_procedure it attached.
// this check is necessary to stop this procedure when subclass_procedure is attached
// Check if userdata is set and if the value of it is true
if userdata != 0 && *(userdata as *mut bool) == true {
// adjust the maximized borderless window to fill the work area rectangle of the display monitor
if util::is_maximized(window) {
Expand All @@ -1024,6 +1011,7 @@ unsafe extern "system" fn window_proc(
}
}
winuser::WM_NCCREATE => {
// Set userdata to the value of lparam. This will be cleared on event loop subclassing.
if userdata == 0 {
let createstruct = &*(lparam as *const winuser::CREATESTRUCTW);
userdata = createstruct.lpCreateParams as LONG_PTR;
Expand Down

0 comments on commit 921c901

Please sign in to comment.