Commit Graph

72 Commits

Author SHA1 Message Date
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 84ce2eb418 Simplify the code a bit
There is a type called QObjectList already.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-11-20 20:52:12 +08:00
Yuhang Zhao 095731d741 Minor improvement.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-11-20 13:43:02 +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 c783bc1fe2 Minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-11-12 11:34:41 +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 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 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 5296fb6f90 Add a comment about the helper function introduced in the previous commit.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-16 20:27:06 +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
Yuhang Zhao e1656a9636 Move all function pointers to the core data struct.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-15 22:00:13 +08:00
Yuhang Zhao 904bbb8576 Remove QPointer usages.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-15 21:06:58 +08:00
Yuhang Zhao 7aae486ba9 Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-14 14:06:12 +08:00
Yuhang Zhao 09100a1845 Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-14 12:39:23 +08:00
Yuhang Zhao 8bc4c0155a Revert "Enable layered window by default."
This reverts commit 367675700f.

Reason for revert: This breaks some Qt Quick applications.
2020-10-12 20:27:20 +08:00
Yuhang Zhao 367675700f Enable layered window by default.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-12 20:18:56 +08:00
Yuhang Zhao 4f06aa1206 Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-11 10:24:54 +08:00
Yuhang Zhao fc1566897f Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-10 20:51:07 +08:00
Yuhang Zhao 3ffc8fd681 Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-10 17:18:17 +08:00
Yuhang Zhao 7cc51b8c2e Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-10-10 11:29:33 +08:00
Yuhang Zhao c61b6ff1fb Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-08-01 10:32:22 +08:00
Yuhang Zhao d0e03bf19c Remove some leftover.
Amends last commit.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-06-27 14:21:48 +08:00
Yuhang Zhao 807dda608e Adapt to new style.
1. Use QList instead of QVector because QVector will become an alias of QList since Qt6.
2. Don't use *const because the account of const is too large.
3. New style applied, by Clang Format.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-06-27 14:19:09 +08:00
Yuhang Zhao aa93f72c10 Add a null pointer check.
Also apply new code format.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-06-06 09:26:30 +08:00
Yuhang Zhao 066650f824 Minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-22 12:19:12 +08:00
Yuhang Zhao fb0daa1107 Minor tweaks.
1. Remove window handle from WINDOW, it's useless now.
2. Rename variables in WINDOWDATA to match their real usage.
3. Do not enable layered window by default, it's causing problems.
4. Add a progress bar to the QQPlayer example.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-22 09:47:52 +08:00
Yuhang Zhao d28e3d167c Add a way to ignore title bar.
If a window is in fullscreen mode, it should not have a title bar.

Maybe a rare use case, but better than nothing.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-17 17:35:09 +08:00
Yuhang Zhao 2df22bdb64 Fix QWindow disappear bug of Qt Quick.
Restoring window styles to default will break Qt Quick applications.
The QWindow will disappear once we do it.

Qt Widgets applications are not affected.

Don't know why currently.

Disable it by default because it's not something we must do.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-11 22:05:43 +08:00
Yuhang Zhao 136b865853 Minor improvements.
1. Use const more.
2. Add some missing ResolveWin32APIs() call
3. Move updateQtFrame to WinNativeEventFilter

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-09 12:58:01 +08:00
Yuhang Zhao b6865f7642 Fix old Qt builds.
Now should support Qt 5.6

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-08 16:37:15 +08:00
Yuhang Zhao 7753161f9f Add Qt Quick example.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-08 14:19:41 +08:00
Yuhang Zhao a49a134f24 Minor improvements.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-04 09:01:39 +08:00
Yuhang Zhao 123c36c374 Add a new way to set ignore areas.
Fixes: #6

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-03 19:24:40 +08:00
Yuhang Zhao 63315acf75 Minor improvements.
1. Add more comments.
2. Add a function to change window geometry through Win32 API/
3. Add a function to move the window to the center of the desktop.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-01 19:37:57 +08:00
Yuhang Zhao 21a563a460 Minor tweaks.
Amends commit f0ef569b08

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-27 08:52:07 +08:00
Yuhang Zhao f0ef569b08 Revert back to the original solution.
We will use the original solution in this branch.
The new Windows Terminal solution will be in another branch.

Partially reverts commit 01707907cd

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-26 21:40:37 +08:00
Yuhang Zhao 01707907cd WIP. Adapt to Windows Terminal style.
Don't remove the window frame totally, only remove the title bar instead
(including the top border).
We can resize outside our window just like any other normal window in
this way. And many strange problems caused by the removal of window
frame are gone such as background flicker.
However, we will need to paint the top frame border ourself. Otherwise
the window doesn't look very good.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-24 13:02:13 +08:00
Yuhang Zhao f77e1adf61 Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-22 15:27:52 +08:00
Yuhang Zhao 4e1d324100 Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-17 21:39:36 +08:00
Yuhang Zhao b789c050cc Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-13 21:46:57 +08:00
Yuhang Zhao 6bba0cbe18 Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-13 20:33:54 +08:00
Yuhang Zhao 19279aa848 Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-11 19:22:08 +08:00
Yuhang Zhao bb3aeb7f4c Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-11 18:43:21 +08:00
Yuhang Zhao bc4d034a26 Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-10 20:40:28 +08:00
Yuhang Zhao 9e2e0bffed Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-10 16:09:35 +08:00
Yuhang Zhao 91e7351ea3 Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-10 09:49:20 +08:00