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>
QStringView introduced in Qt 5.10.0
qExchange() introduced in Qt 5.14.0
qSwap() is deprecated, use std::swap() instead
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
1. On Win11 we don't need to paint the frame border, the OS will always draw one for us.
2. Fix the wrong coordinate of the right and bottom frame border of the widget example.
3. Improve the Qt Quick example.
4. Correctly detect the OS version when building against Qt below 5.9.
5. Other minor tweaks.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
1. The QWinRegistryKey class was introduced in 5.14.0. The implementation is quite clean, so just copy the sources files from Qt repo in case the user is linking against a version older than 5.14.
2. Fixes the rounding error of the self-painted frame border of the examples.
3. Other minor tweaks.
Fixes: #95
Task-number: #94
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
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
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>
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>
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>
* WIP: qmainwindow example
* NEW: option to disable acrylic on QMainWindow
* IMP: accept standard QMainWindow parameters
* NEW: enable acrylic in QMainWindow example
* IMP: qmainwindow sets acrylic outside constructor
* IMP: center windowTitle
* cleanup
* IMP: move setContentMargin in QtAcrylicMainWIndow class
* more cleanup
* small cleanup
* improvement copied from qtacrylicwidget
* minor improvement
* always connect needRepaint
* close button thickness is now similar to native windows buttons
* add context menu on left icon
* simpler context menu implementation
* IMP: use displaySystemMenu from Utilities
Co-authored-by: Julien Maille <julien.maille@data-pixel.com>
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>
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>
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>
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>