summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-10-01 17:44:15 +0200
committerDudemanguy <random342@airmail.cc>2023-10-01 15:57:31 +0000
commita98641cf45042f7c76c3dd7913dfdd61ce0c073b (patch)
tree544776a4c0735be9e11409f8438b0e65b6e84b2a
parent0b705983584691c6d7b1ee19c4b6950fa5334326 (diff)
downloadmpv-a98641cf45042f7c76c3dd7913dfdd61ce0c073b.tar.bz2
mpv-a98641cf45042f7c76c3dd7913dfdd61ce0c073b.tar.xz
win32: add WS_THICKFRAME style in borderless mode
Fixes window resizing in borderless mode after adding WS_SYSMENU. Fixes: 172d9be3005c6a85f4f139f1dedccefe26ea8d91
-rw-r--r--video/out/w32_common.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index 8db3e35c34..931a902c76 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -174,6 +174,9 @@ struct vo_w32_state {
static void adjust_window_rect(struct vo_w32_state *w32, HWND hwnd, RECT *rc)
{
+ if (!w32->opts->border)
+ return;
+
if (w32->api.pAdjustWindowRectExForDpi) {
w32->api.pAdjustWindowRectExForDpi(rc,
GetWindowLongPtrW(hwnd, GWL_STYLE), 0,
@@ -811,7 +814,7 @@ static bool snap_to_screen_edges(struct vo_w32_state *w32, RECT *rc)
static DWORD update_style(struct vo_w32_state *w32, DWORD style)
{
- const DWORD NO_FRAME = WS_OVERLAPPED | WS_MINIMIZEBOX;
+ const DWORD NO_FRAME = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_THICKFRAME;
const DWORD FRAME = WS_OVERLAPPEDWINDOW;
const DWORD FULLSCREEN = NO_FRAME;
style &= ~(NO_FRAME | FRAME | FULLSCREEN);
@@ -1282,6 +1285,9 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
break;
}
break;
+ case WM_NCACTIVATE:
+ // Cosmetic to remove blinking window border when initializing window
+ return 1;
case WM_NCHITTEST:
// Provide sizing handles for borderless windows
if ((!w32->opts->border || !w32->opts->title_bar) && !w32->current_fs) {
@@ -1406,6 +1412,8 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
update_dark_mode(w32);
break;
case WM_NCCALCSIZE:
+ if (!w32->opts->border)
+ return 0;
// Apparently removing WS_CAPTION disables some window animation, instead
// just reduce non-client size to remove title bar.
if (wParam && lParam && w32->opts->border && !w32->opts->title_bar &&