Skip to content

Commit 0ca22ab

Browse files
committed
修复 Windows 下双屏缩放不一致时光标为可拖拽状态的问题 (#196)
1 parent 3bc8ba3 commit 0ca22ab

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

qframelesswindow/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
:license: GPLv3, see LICENSE for more details.
1313
"""
1414

15-
__version__ = "0.7.0"
15+
__version__ = "0.7.2"
1616
__author__ = "zhiyiYo"
1717

1818
import sys

qframelesswindow/windows/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,18 @@ def nativeEvent(self, eventType, message):
117117
return super().nativeEvent(eventType, message)
118118

119119
if msg.message == win32con.WM_NCHITTEST and self._isResizeEnabled:
120-
pos = QCursor.pos()
121-
xPos = pos.x() - self.x()
122-
yPos = pos.y() - self.y()
123-
w = self.frameGeometry().width()
124-
h = self.frameGeometry().height()
120+
xPos, yPos = win32gui.ScreenToClient(msg.hWnd, (msg.lParam & 65535, msg.lParam >> 16))
121+
clientRect = win32gui.GetClientRect(msg.hWnd)
122+
123+
w = clientRect[2] - clientRect[0]
124+
h = clientRect[3] - clientRect[1]
125125

126126
# fixes issue https://github.com/zhiyiYo/PyQt-Frameless-Window/issues/98
127127
bw = 0 if win_utils.isMaximized(msg.hWnd) or win_utils.isFullScreen(msg.hWnd) else self.BORDER_WIDTH
128-
lx = xPos < bw
129-
rx = xPos > w - bw
130-
ty = yPos < bw
131-
by = yPos > h - bw
128+
lx = xPos < bw # left
129+
rx = xPos > w - bw # right
130+
ty = yPos < bw # top
131+
by = yPos > h - bw # bottom
132132
if lx and ty:
133133
return True, win32con.HTTOPLEFT
134134
elif rx and by:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setuptools.setup(
88
name="PyQt5-Frameless-Window",
9-
version="0.7.0",
9+
version="0.7.2",
1010
keywords="pyqt frameless",
1111
author="zhiyiYo",
1212
author_email="[email protected]",

0 commit comments

Comments
 (0)