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

Use custom frame for main window only #4914

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kornes
Copy link
Contributor

@kornes kornes commented Oct 23, 2023

We use custom frame to draw extra controls in title bar on Windows. Currently few windows beside main window also use BaseWindow::EnableCustomFrame flag. This PR removes use of custom frame outside of Window.cpp, so only main chatterino window and popup chats are left.

Since Qt6.4 system theme and user preferred colors are used for title bars by default.

other changes:

  • BasePopup is always enabling Qt::Dialog flag, which removes minimize/maximize buttons. This is undesired for EmotePopup, so i added bool to disable that behavior for that single window. This is possibly breaking change for Linux WMs, so needs test, didn't want to ifdef right away.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/widgets/BasePopup.hpp Show resolved Hide resolved
src/widgets/settingspages/AboutPage.cpp Outdated Show resolved Hide resolved
src/widgets/splits/Split.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@Nerixyz Nerixyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least for the draggable popups, this does make it look a bit weird:

The background for the Subscribe to thread looks a bit off now, as the window frame doesn't have the same color anymore.

Otherwise, this looks good.

@fourtf
Copy link
Member

fourtf commented Oct 24, 2023

This seems to make the frames of secondary windows look inconsistent with the main window. What's the reasoning behind this change?

@kornes
Copy link
Contributor Author

kornes commented Oct 24, 2023

windows on master already using native frame: settings, search, filters select
this PR changes frame for:

  • emote popup
  • thread/user popup (if not set to close at lost focus)
  • select channel dialog
  • color picker (general settings page)
  • update dialog
  • license window (about page)
  • tutorial video window (split -> how to)

not changed:

  • main window, secondary windows with chats
  • any window using BaseWindow::Frameless which overrides customframe flag

Motivation:

  • main purpose of custom frame is to draw things which are not possible on native titlebar, windows affected by this PR doesn't draw custom stuff on their titlebars.
  • visually, native window will also use dark color by default:
Before After
b1 a1
a1 a2

unless user specifically setup their system to use accent colors for title bars, then it's best to respect the color settings specified by the user.

  • letting OS draw title bars makes resizing more fluent
Before After
https://i.nuuls.com/yxNYT.mp4 https://i.nuuls.com/RiyYk.mp4
notice tearing/shadowing and occasional appearing of win7 frame
  • title bar height will be consistent with rest of OS
  • double click to maximize doesn't work in emote popup, while it works in main window. From what i recall issue was connected with calling QWidget::winId() and results it have on custom frame handling
  • moving native window between monitors doesn't cause resize/redraw we have in custom frame
  • this PR was spawned by my research for adding support for win11 snap layouts, custom frame will need quite a few changes to make it work, because it doesn't hint proper system buttons on hover/hit test.

tl;dr why sacrifice superior native feel, if window doesn't draw custom buttons. Future OS updates will introduce more maintenance on custom frame, so i wanted to minimize its use to just bare minimum we need.

@Nerixyz
Copy link
Contributor

Nerixyz commented Oct 24, 2023

this PR was spawned by my research for adding support for win11 snap layouts, custom frame will need quite a few changes to make it work, because it doesn't hint proper system buttons on hover/hit test.

I wonder if we could fix this by returning HTMAXBUTTON (and others) in NCHITTEST.

@kornes
Copy link
Contributor Author

kornes commented Oct 24, 2023

yeah obviously its fixable and we gonna have it working on main window either by your or mine effort.
I gave it as example of issues connected with own custom frame - its sacrifice you need to take for custom buttons in title, basically reinvent the wheel and 50 edge cases. But there is little reason to use it outside of main window.

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.

None yet

3 participants