After some testing, it's found that it's not reliable.
Maybe we should use another windows message to do this?
To be investigated.
Signed-off-by: Yuhang Zhao <2546789017@qq.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>
Before this patch, the maximum size of a frameless window
will be limited to the primary screen's size if the user
doesn't set a maximum window size explicitly.
It works fine on single screen cases, however, if you have
multiple screens and when you are trying to resize the window
to some size bigger than the primary screen, such as expand
it from one screen to another, the window will refuse to
continue resizing after it reaches the primary screen's size.
The solution is simple and straightforward: if the user doesn't
set the maximum window size explicitly, just don't set the maximum
size to let it can be resized without any limitations.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
If the user set a custom title bar height, just return
the original value, don't plus the border height afterwards,
this is not what the user would want.
But if we are querying the standard value, it should be
border height + caption height.
Border width and border height don't have this issue.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>