mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
fix: 增加wayland下任务栏鼠标悬浮应用窗口关闭的逻辑
适配wayland下关闭任务栏鼠标悬浮应用窗口的功能,wayland下调用后端CloseWindow接口 Log: 修复wayland下任务栏鼠标悬浮窗口关闭应用失败的问题 Bug: https://pms.uniontech.com/zentao/bug-view-105849.html Influence: wayland下任务栏鼠标悬浮窗口关闭应用 Change-Id: I4c65e2382e479c4a8a691535c042b9f8eb5a1d42
This commit is contained in:
parent
db77d69f24
commit
80adc3c2ca
@ -143,26 +143,30 @@ void AppSnapshot::setTitleVisible(bool bVisible)
|
||||
|
||||
void AppSnapshot::closeWindow() const
|
||||
{
|
||||
const auto display = Utils::IS_WAYLAND_DISPLAY ? XOpenDisplay(nullptr) : QX11Info::display();
|
||||
if (!display) {
|
||||
qWarning() << "Error: get display failed!";
|
||||
return;
|
||||
if (Utils::IS_WAYLAND_DISPLAY) {
|
||||
m_dockDaemonInter->CloseWindow(static_cast<uint>(m_wid));
|
||||
} else {
|
||||
const auto display = QX11Info::display();
|
||||
if (!display) {
|
||||
qWarning() << "Error: get display failed!";
|
||||
return;
|
||||
}
|
||||
|
||||
XEvent e;
|
||||
|
||||
memset(&e, 0, sizeof(e));
|
||||
e.xclient.type = ClientMessage;
|
||||
e.xclient.window = m_wid;
|
||||
e.xclient.message_type = XInternAtom(display, "WM_PROTOCOLS", true);
|
||||
e.xclient.format = 32;
|
||||
e.xclient.data.l[0] = XInternAtom(display, "WM_DELETE_WINDOW", false);
|
||||
e.xclient.data.l[1] = CurrentTime;
|
||||
|
||||
Q_EMIT requestCloseAppSnapshot();
|
||||
|
||||
XSendEvent(display, m_wid, false, NoEventMask, &e);
|
||||
XFlush(display);
|
||||
}
|
||||
|
||||
XEvent e;
|
||||
|
||||
memset(&e, 0, sizeof(e));
|
||||
e.xclient.type = ClientMessage;
|
||||
e.xclient.window = m_wid;
|
||||
e.xclient.message_type = XInternAtom(display, "WM_PROTOCOLS", true);
|
||||
e.xclient.format = 32;
|
||||
e.xclient.data.l[0] = XInternAtom(display, "WM_DELETE_WINDOW", false);
|
||||
e.xclient.data.l[1] = CurrentTime;
|
||||
|
||||
Q_EMIT requestCloseAppSnapshot();
|
||||
|
||||
XSendEvent(display, m_wid, false, NoEventMask, &e);
|
||||
XFlush(display);
|
||||
}
|
||||
|
||||
void AppSnapshot::compositeChanged() const
|
||||
|
Loading…
x
Reference in New Issue
Block a user