diff options
author | pavelxdd <pavel.otchertsov@gmail.com> | 2017-12-05 01:12:49 +0200 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2017-12-07 23:32:56 +0200 |
commit | 483437ba91e85c14236d9ccc5986c4d6faaaf7ff (patch) | |
tree | 35c0aa9a0ff08466156c81b3218964e911c2a51e /video/out/w32_common.c | |
parent | 985e83e217bbb845b94fc8ccf9219c779059a8af (diff) | |
download | mpv-483437ba91e85c14236d9ccc5986c4d6faaaf7ff.tar.bz2 mpv-483437ba91e85c14236d9ccc5986c4d6faaaf7ff.tar.xz |
w32_common: skip window snapping if Windows handled it
Check the expected width and height against up-to-date
window placement. If they do not match, we will consider snapping
to have happened on Windows' side.
Diffstat (limited to 'video/out/w32_common.c')
-rw-r--r-- | video/out/w32_common.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 6e15101093..385a13b580 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -617,16 +617,26 @@ static bool snap_to_screen_edges(struct vo_w32_state *w32, RECT *rc) POINT cursor; if (!GetWindowRect(w32->window, &rect) || !GetCursorPos(&cursor)) return false; - // Check for aero snapping + // Check if window is going to be aero-snapped if ((rc->right - rc->left != rect.right - rect.left) || (rc->bottom - rc->top != rect.bottom - rect.top)) return false; + // Check if window has already been aero-snapped + WINDOWPLACEMENT wp = {0}; + wp.length = sizeof(wp); + if (!GetWindowPlacement(w32->window, &wp)) + return false; + RECT wr = wp.rcNormalPosition; + if ((rc->right - rc->left != wr.right - wr.left) || + (rc->bottom - rc->top != wr.bottom - wr.top)) + return false; + MONITORINFO mi = { .cbSize = sizeof(mi) }; if (!GetMonitorInfoW(w32->monitor, &mi)) return false; // Get the work area to let the window snap to taskbar - RECT wr = mi.rcWork; + wr = mi.rcWork; // Check for invisible borders and adjust the work area size RECT frame = {0}; |