Commit Graph

61 Commits

Author SHA1 Message Date
Yuhang Zhao b9cb70b3ac wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-14 15:36:12 +08:00
Yuhang Zhao bb8d174c56 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-14 15:26:49 +08:00
Yuhang Zhao efb56c712c wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-13 15:48:07 +08:00
Yuhang Zhao 2073cb9fd2 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-13 15:17:27 +08:00
Yuhang Zhao 556741cfb1 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-13 12:14:08 +08:00
Yuhang Zhao 2881874d7a wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-12 15:53:50 +08:00
Yuhang Zhao 0ce352ff22 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-11 17:59:53 +08:00
Yuhang Zhao ae65733b2d wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-11 17:23:31 +08:00
Yuhang Zhao 0e4f95fe2c wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-11 16:23:12 +08:00
Yuhang Zhao 8e69a57039 wip
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-11 09:33:27 +08:00
Yuhang Zhao bbd20b6476 win32: minor improvements
1. Adds some more comments
2. Fixed a typo in QMainWindow example
3. Commented out a block of code that may cause issues
4. Return WVR_REDRAW by default in WM_NCCALCSIZE
5. Other minor tweaks

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-09 10:21:52 +08:00
Yuhang Zhao 39ec7efcf3 win32: minor refactor
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-07 11:45:54 +08:00
Yuhang Zhao 04f31f7b42 Win32: update the internal margin when DPI changes
Make the internal margin sync with the latest DPI.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-03-07 10:26:16 +08:00
Yuhang Zhao a9256ba4b3 QtQuick demo: work-around a QtQuick bug
See https://bugreports.qt.io/browse/QTBUG-69711
Also some minor tweaks of the constexpr variables.

Fixes: #35

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-02-10 10:14:54 +08:00
Yuhang Zhao ebe7da1a9f Win32: use Win32 APIs instead of Qt APIs
Our native event filter happens before QPA's internal
handling, so the window state won't change if we query
for them in the native event filter. To fix this, use
Win32 API instead.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-01-20 13:16:45 +08:00
Yuhang Zhao 7ddde978e8 Fix compilation on sdks lack "timeapi.h"
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-01-06 17:40:58 +08:00
Yuhang Zhao fc307c83bf Simplify code a bit
Amends commit 17601f386f

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-01-05 11:10:58 +08:00
Yuhang Zhao 17601f386f Code refactor
1. Load dwmapi.dll and winmm.dll dynamically at runtime, to remove the dependency on those dlls
2. Use QSystemLibrary to load dlls, it can make the loading of system dlls safer, and avoid duplicating the code
3. Use QWinRegistryKey to access registry, no need to use QSettings in such scenarios
4. Adapt to new code when building against Qt 6.3 and newer.
5. Other minor tweaks.

Fixes: #94
2022-01-05 11:00:31 +08:00
Yuhang Zhao c3c5ef0d5d The DWM workaround is not needed when DWM composition is disabled
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2022-01-03 11:03:24 +08:00
Yuhang Zhao 9904a5077a Fix top part be cut-off for some pixels when maximized
Root cause: forgot to change the passed parameter after the function signature changed

Fixes: #77

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-12-20 10:51:36 +08:00
Julien 76c13cf9bf
FIX for #92 return HTCAPTION only when mouse is pressed (#93) 2021-12-18 08:20:50 +08:00
Yuhang Zhao fb8f061091 Win32: Add workaround for DWM flicker
And some other minor tweaks.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-12-01 14:59:29 +08:00
Yuhang Zhao 6068944657 Win32: always return 0 in WM_NCCALCSIZE
Otherwise will cause bugs.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-11-28 20:22:08 +08:00
Yuhang Zhao 3aba956d66 Minor improvements
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-11-19 14:11:55 +08:00
Yuhang Zhao 5be463436c Minor tweaks
The "wParam == FALSE" case is very rare, but it may be needed.
Adding special handling for it doesn't bring any harm anyway.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-11-18 14:16:20 +08:00
Yuhang Zhao 330669e34a Quality improvements
1. Use native frame color in the MainWindow example, just like the Widget example. Fixes #87
2. Rename setHitTestVisibleInChrome() to setHitTestVisible(): This name was taken from Microsoft's WindowChrome class in WPF. Now they removed the legacy "Chrome" suffix in their new products, so we removed it as well.
3. Fix build with Qt older than 5.15: Q_NAMESPACE_EXPORT was introduced in Qt 5.14
4. Removed code that supports native frame: they are just leftovers of the previous refactoring.
4. Correctly detect SetWindowLongPtrW() and GetWindowLongPtrW() 's operation result: they won't modify the Last Error state on success, so we have to set Last Error state to ERROR_SUCCESS before calling them to make sure we get the correct error code.
5. Remove implicitly conversions, use explicit casts where possible
6. Fixed FormatMessage() usage, correctly retrieve the error message: According to MSDN, we should pass the address of a LPWSTR, not the LPWSTR itself.
7. Removed the special handing of WM_SIZE: It turns out that this handling is not needed at all and it's causing new issues, so just remove it.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-10-08 15:43:33 +08:00
Yuhang Zhao 138a2b90cb Minor refactor
1. Remove compiler specific flags
2. Build shared library by default
3. Remove unused functions
4. Minor tweaks of some internal logic, the final behavior is not affected

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-09-06 14:24:43 +08:00
Yuhang Zhao 8367331278 Win32: move all win32 staff to one header
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-09-05 13:24:12 +08:00
Yuhang Zhao a5a5942d80 Win32: Add some useful functions back
1. Also rename some leftovers to more appropriate names
2. Be more verbose to help debugging

TODO: improve widget example, make use of the these functions

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-09-05 09:20:19 +08:00
Yuhang Zhao bc8a70dbb2 Win32: Fix window content will be cut-off for some pixels when window is fullscreened
1. Fix that bug
2. Some adjustments of the variable names to make them more clear
3. Some tweaks to the title bar height value

TODO: Add a button to switch between fullscreen and windowed mode for the widget example
TODO: Add a title text to the widget example

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-09-04 22:40:13 +08:00
Yuhang Zhao 2c106ffef9 Minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-09-01 15:26:36 +08:00
Yuhang Zhao 523e35fdb1 Minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-08-22 15:14:42 +08:00
Yuhang Zhao 89027ec0c8 Minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-08-11 19:48:02 +08:00
Yuhang Zhao 5a2d498445 Minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-08-11 17:58:47 +08:00
Yuhang Zhao c6e5545b4d Fixed a bug caused by typo
My bad

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-07-26 20:02:39 +08:00
Yuhang Zhao da4269bbd6 Minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-07-23 21:05:35 +08:00
Yuhang Zhao 2b6d0fccb6 Minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-07-23 11:04:48 +08:00
Yuhang Zhao b44cfb4474 Refactor UNIX version
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-07-21 17:14:55 +08:00
Yuhang Zhao 233ebba3ec Minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-07-20 09:58:00 +08:00
Yuhang Zhao f30339ff54 Minor cleanup
1. Remove unneeded functions
2. Rename some functions and variables to match their real functionality

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-07-19 10:43:10 +08:00
Yuhang Zhao bdbfc96eb0 Minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-07-17 15:35:55 +08:00
Yuhang Zhao 5938fcb475 Internal refactor
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-06-25 14:17:32 +08:00
Yuhang Zhao 28144b1e74 Minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-06-09 13:27:11 +08:00
Yuhang Zhao e0b5244420 Rename function
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-06-01 13:10:05 +08:00
Yuhang Zhao 4139cf0ab2 redesign API 2021-05-31 11:52:32 +08:00
Yuhang Zhao fca63dbf54 Minor improvement
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-04-28 11:39:51 +08:00
Yuhang Zhao cdb7b87eb4 Remove acrylic related things
They'll be moved to a separate repo instead

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-04-02 12:02:46 +08:00
Yuhang Zhao 16f7d78035 Win32: Fix the flickering issue when resizing
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-03-31 20:35:21 +08:00
Yuhang Zhao 42ee3f8a91 Minor improvements
1. QScopedPointer's get() function was introduced in Qt 5.11, too new, don't use it, use data() instead. They are the same.
2. Fixed a typo.
3. Use QGuiApplication::isRightToLeft() to simplify the code.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-03-20 11:19:10 +08:00
Yuhang Zhao 0f699161cd Simplify code
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
2021-03-18 15:58:42 +08:00