Commit Graph

32 Commits

Author SHA1 Message Date
Yuhang Zhao 8a20747ba8 Minor tweaks
Mainly cleanup the WinNativeEventFilter

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-03-05 10:40:52 +08:00
Yuhang Zhao 7522273331 Get rid of latin-1 strings
Use UTF-8 strings everywhere.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-12-22 20:46:39 +08:00
Yuhang Zhao 68bc4c31ed Cleanup
WinNativeEventFilter:
1. Removed all unused functions and macros.
Win32 API prototypes are not touched because
we may still need them in the future.
2. Don't store data through SetWindowLongPtrW,
using dynamic properties of QWindow instead.
People may rely on GetWindowLongPtrW(hwnd, GWLP_USERDATA)
to do their own work.
3. Some helper functions are removed, such as
moveWindowToDesktopCenter(). You can implement them
yourself. Keep them in the source code will keep
pulling in new dependencies so I have to get rid
of them.
4. Some blocks are removed, such as WM_GETMINMAXIINFO.
It's not needed. You can call Qt's standard API now,
such as setMaximumSize() and setMinimumSize().

FramelessQuickHelper:
1. Removed all functions that can be replaced by Qt's
own API, such as setMaximumSize() and setMinimumSize().
2. Removed helper functions, such as moveWindowToDesktopCenter().
You can implement them yourself. Just few lines of code.

FramelessWindowsManager:
Adapt to the above changes.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-11-28 11:54:56 +08:00
Yuhang Zhao 8e78e275e4 Add a cross-platform frameless window example
Written in pure Qt. Cross-platform.
Lacking the system features on Windows of course.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-11-19 12:20:11 +08:00
Yuhang Zhao e5cd434500 Simplify style sheet
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-11-18 16:46:40 +08:00
Yuhang Zhao 137019f7e6 Refactor
Use QWindow pointer on all platforms.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-11-17 15:08:39 +08:00
Yuhang Zhao b672851f51 Win32: Remove the dependency of the widgets and quick module
This commit totally removed the dependency of the widgets
and quick modules for the Windows platform. Now the library
itself only depends on the core and gui modules. Currently
no bug can be found. But there are some side effects: one is
we can't set a palette for a widget due to we can't access
QWidget specific functions so if you want to enable blur
effect, you will have to do this by yourself. Another one is
you now have to pass the window handle to WinNativeEventFilter
instead of the pointer of a QObject. Before this patch, I'm
using QWidget::winId() to get the window handle, now we have
get rid of the widgets dependency so I can't get the window
handle now, you have to pass it explicitly. And it leads to
huge refactoring of the whole repository. But I think it's
worth doing. If anyone knows how to get the window handle
without introducing new dependencies, please tell me. It will
help me a lot.

To remove the quick dependency, the FramelessQuickHelper class
is moved out of the library now. If your project needs it,
please copy the files to your project and include them directly.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-11-16 23:01:00 +08:00
Yuhang Zhao 9cd7e368de Minor improvement.
It turns out that the final title bar height contains
the border height as well.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-11-14 16:27:20 +08:00
Yuhang Zhao c783bc1fe2 Minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-11-12 11:34:41 +08:00
Yuhang Zhao 1bf0d59efa Fix Qt5 and Qt6 build.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-11-07 00:29:36 +08:00
Yuhang Zhao b1ddc5010d Fix build on old Qt versions.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-11-03 14:11:47 +08:00
Yuhang Zhao 955961cf9b Minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-24 23:45:23 +08:00
Yuhang Zhao c3d54c616d Minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-23 19:04:52 +08:00
Yuhang Zhao 9d4a3a453c Minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-23 14:03:04 +08:00
Yuhang Zhao 2e1075235c Minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-22 19:55:13 +08:00
Yuhang Zhao d671fd703d Minor improvements.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-22 11:49:30 +08:00
Yuhang Zhao 6a12cb1a30 Minor improvements.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-21 21:21:56 +08:00
Yuhang Zhao 8c21be9e64 Fixed two issues.
1. The border color on Win10 when in light theme is also #707070, not pure white.
2. The brush color of the Acrylic effect is reversed before, it is now correct.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-21 11:10:51 +08:00
Yuhang Zhao f3e863e14b Minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-20 23:26:03 +08:00
Yuhang Zhao cde5ebcf8d Fix build on 5.12
Q_DISABLE_COPY_MOVE: since 5.13
QLatin1String arg: since 5.14

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-20 13:01:43 +08:00
Yuhang Zhao 17b35173ef Minor improvements to the Win32Demo project.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-20 09:55:20 +08:00
Yuhang Zhao 886f31d0c0 Fix two issues.
1. The border line may disappear when resizing: fixed by change the line width to 2px.
2. Some part of the window become totally transparent after DPI changes: fixed by calling update() after DPI changes.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-19 22:07:12 +08:00
Yuhang Zhao 72db8e7043 Improve the Win32Demo project.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-19 14:54:13 +08:00
Yuhang Zhao 8ea85ed3ba Minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-18 21:21:03 +08:00
Yuhang Zhao ae92a00628 Guard against the event.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-18 13:23:59 +08:00
Yuhang Zhao f38b86e992 Fix the context menu issue.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-18 11:53:04 +08:00
Yuhang Zhao d3f58ae98f Use blur instead of Acrylic on Win10.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-17 20:19:52 +08:00
Yuhang Zhao 226bc52ece Fix the acrylic effect.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-17 18:09:59 +08:00
Yuhang Zhao 073ad117ba Minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-17 13:08:47 +08:00
Yuhang Zhao ff10ae21f4 Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-16 20:02:38 +08:00
Yuhang Zhao 0debbb890f Minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-16 15:53:20 +08:00
Yuhang Zhao 208e831fc5 Add a full-featured win32 example.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-16 15:48:01 +08:00