mirror of https://gitee.com/openkylin/kwin.git
[closeWindow]: calling AppManager with pid to unfreeze application;
This commit is contained in:
parent
192984f9a5
commit
28897a90ef
|
@ -1778,17 +1778,17 @@ void X11Client::closeWindow()
|
|||
QDBusMessage message = QDBusMessage::createMethodCall("com.kylin.AppManager",
|
||||
"/com/kylin/AppManager",
|
||||
"com.kylin.AppManager",
|
||||
"ActiveProcessByWid");
|
||||
QList<QVariant> args;
|
||||
args.append(this->window());
|
||||
message.setArguments(args);
|
||||
"ActiveProcessByPid");
|
||||
|
||||
qDebug() << "[DBEUG]: closing x11client pid " << pid();
|
||||
message.setArguments({ pid() });
|
||||
QDBusMessage response = QDBusConnection::sessionBus().call(message);
|
||||
|
||||
if (response.type() == QDBusMessage::ReplyMessage) {
|
||||
doClose = response.arguments().takeFirst().toBool();
|
||||
qDebug() << "[DEBUG]: AppManager return " << doClose;
|
||||
} else {
|
||||
qDebug() << "[DEBUG]: ActiveProcessByWid qdus invalid.";
|
||||
qDebug() << "[DEBUG]: ActiveProcessByPid qdus invalid.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -825,36 +825,37 @@ void XdgToplevelClient::showOnScreenEdge()
|
|||
|
||||
void XdgToplevelClient::closeWindow()
|
||||
{
|
||||
if (isCloseable()) {
|
||||
bool doClose = true;
|
||||
// doClose default to true,
|
||||
// because there is no need to call AppManager on PC mode.
|
||||
if (workspace()->isInTabletMode()) {
|
||||
doClose = false;
|
||||
QDBusMessage message = QDBusMessage::createMethodCall("com.kylin.AppManager",
|
||||
"/com/kylin/AppManager",
|
||||
"com.kylin.AppManager",
|
||||
"ActiveProcessByWid");
|
||||
QList<QVariant> args;
|
||||
args.append(this->window());
|
||||
message.setArguments(args);
|
||||
QDBusMessage response = QDBusConnection::sessionBus().call(message);
|
||||
if (!isCloseable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.type() == QDBusMessage::ReplyMessage) {
|
||||
doClose = response.arguments().takeFirst().toBool();
|
||||
qDebug() << "[DEBUG]: AppManager return " << doClose;
|
||||
} else {
|
||||
qDebug() << "[DEBUG]: ActiveProcessByWid qdus invalid.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
// TODO: 暂时上面ActiveProcessByWid在wayland下无法使用,先全部允许关闭
|
||||
doClose = true;
|
||||
if (doClose) {
|
||||
sendPing(PingReason::CloseWindow);
|
||||
m_shellSurface->sendClose();
|
||||
bool doClose = true;
|
||||
// doClose default to true,
|
||||
// because there is no need to call AppManager on PC mode.
|
||||
if (workspace()->isInTabletMode()) {
|
||||
doClose = false;
|
||||
QDBusMessage message = QDBusMessage::createMethodCall("com.kylin.AppManager",
|
||||
"/com/kylin/AppManager",
|
||||
"com.kylin.AppManager",
|
||||
"ActiveProcessByPid");
|
||||
|
||||
qDebug() << "[DEBUG]: closing xdgtoplevelclient pid " << pid();
|
||||
message.setArguments({ pid() });
|
||||
QDBusMessage response = QDBusConnection::sessionBus().call(message);
|
||||
|
||||
if (response.type() == QDBusMessage::ReplyMessage) {
|
||||
doClose = response.arguments().takeFirst().toBool();
|
||||
qDebug() << "[DEBUG]: AppManager return " << doClose;
|
||||
} else {
|
||||
qDebug() << "[DEBUG]: ActiveProcessByPid qdus invalid.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (doClose) {
|
||||
sendPing(PingReason::CloseWindow);
|
||||
m_shellSurface->sendClose();
|
||||
}
|
||||
}
|
||||
|
||||
XdgSurfaceConfigure *XdgToplevelClient::sendRoleConfigure() const
|
||||
|
|
Loading…
Reference in New Issue