Commit Graph

101 Commits

Author SHA1 Message Date
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 8ec1cfcf35 Minor improvements.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-23 21:52:40 +08:00
Yuhang Zhao 9b01d7a294 Minor improvements.
Maybe this should be the right logic.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-22 15:49:17 +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 04d0e568b0 Minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-20 20:12:03 +08:00
Yuhang Zhao 1951fe38ce Minor improvements.
Don't lose original ex-styles.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-18 11:05:58 +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 a461c529da Add a mode to link to system libs directly.
In case someone need this.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-16 16:37:01 +08:00
Yuhang Zhao 921b87ab2e Minor improvements.
Use global screen coordinates instead of local window coordinates to get more reliable hit test result.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-13 12:56:03 +08:00
Yuhang Zhao 2ca6a90ae2 Add a Qt Quick helper class.
It's much easier to use it in Qt Quick now.

Fixes: #11

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-12 20:53:53 +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 36609f1715 Fix app crash.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-09 14:19:48 +08:00
Yuhang Zhao 57d2667c5e Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-09 13:13:42 +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 ed6267461c Minor improvements.
The ignore and draggable areas/objects are limited in the title bar area only.
There's no need to judge them outside the title bar area.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-09 09:25:08 +08:00
Yuhang Zhao c4fe56345f Fix compilation error introduced by previous commit.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-08 21:37:36 +08:00
Yuhang Zhao 43d83bf156 Remove useless header file.
It has been included already, by Qt's own header files, or whatever.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-08 17:26:01 +08:00
Yuhang Zhao 45790ee099 Fix old Qt build again.
qAsConst was introduced in Qt 5.7

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-08 17:16:17 +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 0b84006b14 Minor tweaks.
Maybe fix one issue of #9

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-07 17:45:22 +08:00
Yuhang Zhao f3d5f6a0ce Simplify the code a bit.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-06 22:26:57 +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 a3d4df1ebf Minor improvement.
Fixes: #7

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-03 21:20:24 +08:00
Yuhang Zhao 49c7b52a4e Minor improvements.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-03 21:05:01 +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 201a170948 Minor tweaks.
1. Use Qt functions instead of STL functions.
2. Add a comment explain the XXPtr functions.
3. Remove D2D usage. Using GetDeviceCaps is fine.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-02 11:00:01 +08:00
Yuhang Zhao 5335114258 Add more comments.
These are important memo, it's better to write them in our code.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-05-02 10:45:52 +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 74d7dfad43 Fix flashing issue when maximizing.
The window will flash when maximizing and restoring (the whole will become totally transparent at that moment, and after it has been maximized or restored, it will become not transparent again).

Caused by passing negative values to DwmExtendFrameIntoClientArea.

Fixes: #4

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-29 22:02:25 +08:00
Yuhang Zhao ff555585c2 Update comments.
Make it more clearly.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-29 15:03:47 +08:00
Yuhang Zhao b94e534906 Minor improvement.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-27 10:49:54 +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 0239c298b3 Fix wrong condition introduced in last commit.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-22 11:48:23 +08:00
Yuhang Zhao 94cb8729aa Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-22 11:19:23 +08:00
Yuhang Zhao 21bceb088a Update comments.
Make it more clearly.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-20 21:30:01 +08:00
Yuhang Zhao 11f04ca255 Fix function signature.
Should be const XXX *, not const *XXX

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-19 15:47:22 +08:00
Yuhang Zhao 0a4f1eb03b Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-19 08:17:52 +08:00
Yuhang Zhao 835e14aa04 Add some comments in Chinese.
有些东西用英文不会写,感觉还是用中文写得明白些,不过可能要辛苦国际友人了。

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-18 13:43:24 +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 eefb3feb44 Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-12 20:54:58 +08:00
Yuhang Zhao 7f1f2dffc3 Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-12 11:52:54 +08:00
Yuhang Zhao 8cc3cbb05f Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-11 22:08:01 +08:00
Yuhang Zhao 19279aa848 Update.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2020-04-11 19:22:08 +08:00