Use ScreenToClient for point convertion in WM_NCHITTEST
This commit is contained in:
parent
30810032dc
commit
6f856ce495
1 changed files with 4 additions and 6 deletions
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
#include <uxtheme.h>
|
#include <uxtheme.h>
|
||||||
|
#include <windowsx.h>
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QMargins);
|
Q_DECLARE_METATYPE(QMargins);
|
||||||
|
|
||||||
|
|
@ -513,12 +514,9 @@ bool WindowHelper::handleNativeEvent(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto p = MAKEPOINTS(lParam);
|
POINT p{ GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||||
auto r = RECT();
|
ScreenToClient(_handle, &p);
|
||||||
GetWindowRect(_handle, &r);
|
const auto mapped = QPoint(p.x, p.y) / window()->devicePixelRatioF();
|
||||||
const auto mapped = QPoint(
|
|
||||||
p.x - r.left + _marginsDelta.left(),
|
|
||||||
p.y - r.top + _marginsDelta.top());
|
|
||||||
*result = [&] {
|
*result = [&] {
|
||||||
if (!window()->rect().contains(mapped)) {
|
if (!window()->rect().contains(mapped)) {
|
||||||
return HTTRANSPARENT;
|
return HTTRANSPARENT;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue