Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win32: add an option to control window title bar state #11469

Merged
merged 7 commits into from
Sep 21, 2023

Conversation

kasper93
Copy link
Contributor

No description provided.

@kasper93 kasper93 force-pushed the win32_window branch 3 times, most recently from cd8eff9 to 7846832 Compare March 19, 2023 06:12
@natural-harmonia-gropius
Copy link
Contributor

There still a bar.
image
And I use set title-bar no in console, it doesn't take effect. After cycle border twice, it works.

@kasper93
Copy link
Contributor Author

kasper93 commented Mar 19, 2023

There still a bar.

Yes, there is a border. DMW makes left, right and bottom border invisible, but it is there, just it is visible on top.

This is just how Windows works, but we can reduce top window border size to imitate DWM invisible borders. I've added a commit. One side effect is that border grab area is different on top, because simply the border itself is smaller, compared to others.

I think for app like mpv it make sense to reduce top border size, so I made the change.

And I use set title-bar no in console, it doesn't take effect. After cycle border twice, it works.

Good catch. I missed the dynamic settings update check. Fixed now.

EDIT: There is one issue with resizing, that's why I'm reluctant with adjusting top border width, it needs to be accounted for in all places... and it is annoying.

@kasper93
Copy link
Contributor Author

kasper93 commented Mar 22, 2023

Just for visibility of progress. I have this patch working as intended, but while testing I notices few more issues with window sizing and I need to fix those first... and this needs motivation to fight with winapi ;p

Fixes for #7192 and #11486 above other things that I noticed and don't have specific issues reported.

@kasper93
Copy link
Contributor Author

kasper93 commented Aug 21, 2023

Rebased and as a bonus added --window-corners option. This PR is now ready, other improvements might follow in next ones.

@kasper93 kasper93 force-pushed the win32_window branch 4 times, most recently from 363fe8e to 62ae6fb Compare August 21, 2023 23:16
@kasper93
Copy link
Contributor Author

kasper93 commented Aug 21, 2023

Windows builds are available here, if anyone wants to try https://github.com/mpv-player/mpv/actions/runs/5932869185

@kasper93 kasper93 force-pushed the win32_window branch 2 times, most recently from 9074871 to af3ff18 Compare August 22, 2023 00:23
@natural-harmonia-gropius
Copy link
Contributor

Border looks pretty good now 👍. But no transition animation when --title-bar=no

@kasper93
Copy link
Contributor Author

kasper93 commented Aug 22, 2023

But no transition animation when --title-bar=no

What animation? Anyway I don't think I can do anything here, if there is no animation without WS_CAPTION

@natural-harmonia-gropius
Copy link
Contributor

2023-08-22.220652.mp4

https://github.com/melak47/BorderlessWindow

This demo works as I expect, using WS_POPUP with WS_CAPTION.

@kasper93
Copy link
Contributor Author

Nah, it completely disables non-client area drawing by DWM, with a shadow restore. But there is no window outline and the shadow is not visible in fact.

I guess I can enable WS_CAPTION and just exclude whole title bar, not just border.

@kasper93
Copy link
Contributor Author

@natural-harmonia-gropius Try this version, should be fine now. As a bonus we don't have to ask DWM. Hopefully, our geometry is correct ;p

@natural-harmonia-gropius
Copy link
Contributor

Everything works perfectly to me. Thank you so much!

@kasper93
Copy link
Contributor Author

Thanks for test. I guess it is ready for review and merge now.

@MG240
Copy link

MG240 commented Aug 28, 2023

I'm eagerly waiting for this to be merged.

DOCS/man/options.rst Outdated Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented Sep 21, 2023

Download the artifacts for this pull request:

Windows

video/out/w32_common.c Outdated Show resolved Hide resolved
DWM makes part of left, right and bottom border invisible.
Allows to set preference for window corners rounding for DWM.
I don't think in fullscreen mode it makes sense to enable rounded corners.
We can add another option if someone needs it, but for now `window_corners`
affects only the window as one would expect.
Apparently removing WS_CAPTION disables some window animations. Instead
adjust non-client area to not draw title bar.

Note that we do not account for difference in real border size and
invisible one, but seems to work correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants