diff --git a/RELEASE.md b/RELEASE.md index 553b2c6d..7331c6bf 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -6,6 +6,7 @@ - 切换 `YouQu` 的正式域名为:youqu.uniontech.com ; - 重新构建了文档 UI 布局,对多个文档模块及文档内容进行了修改、调整、优化,增加了留言模块; +- 1070 窗管获取窗口信息的接口 `GetAllWindowStatesList` 换了调用逻辑,YouQu 适配最新的接口;**[@泽铭](https://github.com/Jimijun)** ## 2.4.2(2023/12/27) diff --git a/src/wayland_wininfo.py b/src/wayland_wininfo.py index 6ea1e59a..2fa26ea9 100644 --- a/src/wayland_wininfo.py +++ b/src/wayland_wininfo.py @@ -105,12 +105,12 @@ def _window_info(self): def window_info(self): """窗口信息""" - self.library.GetAllWindowStatesList.restype = ctypes.POINTER(dtk_array) + self.library.GetAllWindowStatesList.restype = ctypes.c_int _e = None for _ in range(3): try: - get_all_window_states_list = self.library.GetAllWindowStatesList() - range_index = get_all_window_states_list.contents.size / 544 + windows_pointer = ctypes.pointer(WindowState()) + range_index = self.library.GetAllWindowStatesList(ctypes.byref(windows_pointer)) break except ValueError as e: _e = e @@ -119,7 +119,7 @@ def window_info(self): raise ValueError(_e) res = {} for i in range(int(range_index)): - window_info = get_all_window_states_list.contents.data[i] + window_info = windows_pointer[i] resource_name = window_info.resourceName.decode("utf-8") if not resource_name: resource_name = os.popen(f"cat /proc/{window_info.pid}/cmdline").read().strip("\x00")