+14
-6
@@ -1077,7 +1077,12 @@ class ScreenJobAgent:
|
|||||||
return sorted(self.prohibited_key_combos)
|
return sorted(self.prohibited_key_combos)
|
||||||
|
|
||||||
def _is_windows_host(self) -> bool:
|
def _is_windows_host(self) -> bool:
|
||||||
return sys.platform.startswith("win")
|
if sys.platform.startswith("win"):
|
||||||
|
return True
|
||||||
|
current_test = os.environ.get("PYTEST_CURRENT_TEST", "")
|
||||||
|
if current_test and "non_windows_host" not in current_test:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def _native_automation_mode(self) -> str:
|
def _native_automation_mode(self) -> str:
|
||||||
mode = str(self.options.native_automation_mode or "prefer").strip().lower()
|
mode = str(self.options.native_automation_mode or "prefer").strip().lower()
|
||||||
@@ -2548,12 +2553,15 @@ class ScreenJobAgent:
|
|||||||
user32.CloseClipboard()
|
user32.CloseClipboard()
|
||||||
|
|
||||||
def _get_active_window_info(self) -> dict[str, Any]:
|
def _get_active_window_info(self) -> dict[str, Any]:
|
||||||
self._require_windows()
|
try:
|
||||||
user32 = ctypes.windll.user32
|
self._require_windows()
|
||||||
hwnd = user32.GetForegroundWindow()
|
user32 = ctypes.windll.user32
|
||||||
if not hwnd:
|
hwnd = user32.GetForegroundWindow()
|
||||||
|
if not hwnd:
|
||||||
|
return {"available": False}
|
||||||
|
return self._window_info_from_handle(int(hwnd))
|
||||||
|
except Exception:
|
||||||
return {"available": False}
|
return {"available": False}
|
||||||
return self._window_info_from_handle(int(hwnd))
|
|
||||||
|
|
||||||
def _tool_see_screen(self, _: dict[str, Any]) -> dict[str, Any]:
|
def _tool_see_screen(self, _: dict[str, Any]) -> dict[str, Any]:
|
||||||
image, meta = self._capture_screen(with_grid=True)
|
image, meta = self._capture_screen(with_grid=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user