Skip to content

Commit

Permalink
fix: 适配窗管获取窗口信息的最新接口;
Browse files Browse the repository at this point in the history
Description:

Log:
  • Loading branch information
mikigo committed Jan 17, 2024
1 parent 6fddeb6 commit a5c5033
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- 切换 `YouQu` 的正式域名为:youqu.uniontech.com ;
- 重新构建了文档 UI 布局,对多个文档模块及文档内容进行了修改、调整、优化,增加了留言模块;
- 1070 窗管获取窗口信息的接口 `GetAllWindowStatesList` 换了调用逻辑,YouQu 适配最新的接口;**[@泽铭](https://github.com/Jimijun)**

## 2.4.2(2023/12/27)

Expand Down
8 changes: 4 additions & 4 deletions src/wayland_wininfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down

0 comments on commit a5c5033

Please sign in to comment.