fix: 修复任务栏应用图标右键失效问题

修复任务栏应用图标右键失效问题

Log:
Task: https://pms.uniontech.com/task-view-140805.html
Influence: 保证任务栏应用右键菜单功能正常
Change-Id: Iedb3e0394567c855f7760dc52a06d8ad1073001e
This commit is contained in:
weizhixiang
2022-05-31 17:20:39 +08:00
parent 602f7c55e1
commit 7cb147fb39
26 changed files with 288 additions and 224 deletions

View File

@ -204,6 +204,7 @@ std::vector<DesktopAction> DesktopInfo::getActions()
DesktopAction action;
action.name = m_keyFile.getLocaleStr(mainKey, KeyName, "");
action.exec = m_keyFile.getStr(mainKey, KeyExec);
action.section = mainKey;
actions.push_back(action);
}
}

View File

@ -1,3 +1,24 @@
/*
* Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang <weizhixiang@uniontech.com>
*
* Maintainer: weizhixiang <weizhixiang@uniontech.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "gsetting.h"
#include <iostream>

View File

@ -1,3 +1,24 @@
/*
* Copyright (C) 2021 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: weizhixiang <weizhixiang@uniontech.com>
*
* Maintainer: weizhixiang <weizhixiang@uniontech.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GSETTING_H
#define GSETTING_H

View File

@ -301,23 +301,29 @@ std::string XCBUtils::getWMIconName(XWindow xid)
std::vector<WMIcon> XCBUtils::getWMIcon(XWindow xid)
{
std::vector<WMIcon> ret;
/*
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_icon(&ewmh, xid);
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_icon(&m_ewmh, xid);
xcb_ewmh_get_wm_icon_reply_t reply;
if (xcb_ewmh_get_wm_icon_reply(&ewmh, cookie, &reply, nullptr)) {
if (xcb_ewmh_get_wm_icon_reply(&m_ewmh, cookie, &reply, nullptr)) {
xcb_ewmh_wm_icon_iterator_t iter = xcb_ewmh_get_wm_icon_iterator(&reply);
auto fcn = [](xcb_ewmh_wm_icon_iterator_t it) {
std::vector<BYTE> data;
uint32_t *dat = it.data;
int area = it.width * it.height;
for (int i = 0; i < (2 + area) * 4; i++, dat++) { // TODO check data accuracy
data.push_back(*dat);
std::vector<BYTE> ret;
// data数据是按行从左至右从上至下排列
uint32_t *data = it.data;
if (!data) {
return ret;
}
return data;
// 根据宽高获取每个位置的数据每行前有两个位置offset
int area = it.width * it.height;
for (int i = 0; i < (2 + area) * 4; i++, data++) {
ret.push_back(*data);
}
return ret;
};
ret.push_back({iter.width, iter.height, fcn(iter)});
// 获取不同size图标数据
while (iter.rem >= 1) {
xcb_ewmh_get_wm_icon_next(&iter);
ret.push_back({iter.width, iter.height, fcn(iter)});
@ -325,7 +331,7 @@ std::vector<WMIcon> XCBUtils::getWMIcon(XWindow xid)
xcb_ewmh_get_wm_icon_reply_wipe(&reply); // clear
}
*/
return ret;
}

View File

@ -206,7 +206,7 @@ public:
// 获取窗口图标 _NET_WM_ICON_NAME
std::string getWMIconName(XWindow xid);
// _NET_WM_ICON
// 获取窗口图标信息 _NET_WM_ICON
std::vector<WMIcon> getWMIcon(XWindow xid);
// WM_CLIENT_LEADER