Skip to content

Commit 0dd88d7

Browse files
committed
fix: ...
1 parent 0eda7f9 commit 0dd88d7

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
SetWindowDisplayAffinity.argtypes = ctypes.wintypes.HWND, ctypes.wintypes.DWORD
2020
SetWindowDisplayAffinity.restype = ctypes.wintypes.BOOL
2121
ui.hwnd = FindWindow(None, "元扫雷")
22+
ui.SetWindowDisplayAffinity = SetWindowDisplayAffinity
2223

2324

2425
sys.exit(app.exec_())

src/mineSweeperGUI.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,12 @@ def mineAreaLeftRelease(self, i, j):
207207
self.layMine(i // self.pixSize, j // self.pixSize)
208208
self.game_state = 'playing'
209209

210-
self.SetWindowDisplayAffinity = ctypes.windll.user32.SetWindowDisplayAffinity
211-
self.SetWindowDisplayAffinity.argtypes = ctypes.wintypes.HWND, ctypes.wintypes.DWORD
212-
self.SetWindowDisplayAffinity.restype = ctypes.wintypes.BOOL
213-
if not self.SetWindowDisplayAffinity(self.hwnd, 0x00000011):
214-
raise ctypes.WinError()
210+
if self.player_designator[:6] != "[live]":
211+
if not self.SetWindowDisplayAffinity(self.hwnd, 0x00000011):
212+
raise ctypes.WinError()
213+
else:
214+
if not self.SetWindowDisplayAffinity(self.hwnd, 0x00000000):
215+
raise ctypes.WinError()
215216
# print('failed', ctypes.get_last_error())
216217
# raise ctypes.WinError()
217218

@@ -1157,6 +1158,7 @@ def hidden_score_board(self):
11571158
else:
11581159
self.score_board_manager.visible()
11591160

1161+
11601162
def closeEvent_(self):
11611163
# 主窗口关闭的回调
11621164
self.score_board_manager.close()

0 commit comments

Comments
 (0)