Skip to content

Commit 9b67db8

Browse files
authored
Version 3.1.2
* Solved issue #7.
1 parent 1461a00 commit 9b67db8

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

pypdfeditor_core/__init__.py

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

1616
__system__ = platform.system()
1717
__author__ = "Nianze A. TAO (Omozawa SUENO)"
18-
__version__ = "3.1.1"
18+
__version__ = "3.1.2"
1919
__all__ = ["main", "reset", "remove"]
2020

2121

pypdfeditor_core/windows.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -438,19 +438,27 @@ def __init__(self, system: str, version: str):
438438
self.btn_ext_2.clicked.connect(self.close)
439439
self.btn_ext_3.clicked.connect(self.close)
440440
self.btn_ext_4.clicked.connect(self.close)
441+
import winreg as wrg
441442
from .window_effect import WindowEffect, MSG
442443

443444
self.windowEffect = WindowEffect()
444445
self.msg = MSG
445446
self._title_bar_pos = [
446447
QtCore.QPoint(x, y) for x in range(1200) for y in range(52)
447448
]
448-
self.setWindowFlags(QtCore.Qt.WindowType.FramelessWindowHint)
449+
# self.setWindowFlags(QtCore.Qt.WindowType.FramelessWindowHint)
450+
self.setWindowFlags(QtCore.Qt.WindowType.BypassWindowManagerHint)
449451
self.windowEffect.add_shadow_effect(int(self.winId()))
450452
self.windowEffect.add_window_style(int(self.winId()))
451453
self.windowHandle().screenChanged.connect(
452454
lambda: self.windowEffect.screen_change(int(self.winId())),
453455
)
456+
try:
457+
_loc = wrg.HKEY_CURRENT_USER
458+
_wm = wrg.OpenKeyEx(_loc, r"Control Panel\Desktop\WindowMetrics")
459+
self._border = -int(wrg.QueryValueEx(_wm, "BorderWidth")[0])
460+
except OSError:
461+
self._border = 20
454462
else:
455463
self.tab1.grid.addWidget(self.tab1.button3, 0, 20)
456464
self.tab2.grid.addWidget(self.tab2.button3, 0, 20)
@@ -525,10 +533,10 @@ def nativeEvent(
525533
x_pos = QCursor.pos().x() - self.frameGeometry().x()
526534
y_pos = QCursor.pos().y() - self.frameGeometry().y()
527535
btn = self.findChildren(QPushButton, f"max{i}")[0]
528-
lx = x_pos < 5
529-
rx = x_pos > self.width() - 5
530-
ty = y_pos < 5
531-
by = y_pos > self.height() - 5
536+
lx = x_pos < self._border // 4
537+
rx = x_pos > self.width() - self._border // 4 - 10
538+
ty = y_pos < self._border // 4
539+
by = y_pos > self.height() - self._border // 4
532540
if QtCore.QPoint(x_pos - btn.width(), y_pos) in btn.geometry():
533541
return True, 9 # HTMAXBUTTON
534542
if lx and ty:

0 commit comments

Comments
 (0)