mirror of
https://github.com/hyprwm/Hyprland
synced 2025-12-20 08:30:02 +01:00
anr: don't create for anr dialogs (#12601)
This commit is contained in:
parent
05ccbb2f2d
commit
6535ff07c9
4 changed files with 15 additions and 5 deletions
|
|
@ -147,6 +147,10 @@ bool CAsyncDialogBox::isRunning() const {
|
||||||
return m_readEventSource;
|
return m_readEventSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pid_t CAsyncDialogBox::getPID() const {
|
||||||
|
return m_dialogPid;
|
||||||
|
}
|
||||||
|
|
||||||
SP<CAsyncDialogBox> CAsyncDialogBox::lockSelf() {
|
SP<CAsyncDialogBox> CAsyncDialogBox::lockSelf() {
|
||||||
return m_selfWeakReference.lock();
|
return m_selfWeakReference.lock();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ class CAsyncDialogBox {
|
||||||
SP<CPromise<std::string>> open();
|
SP<CPromise<std::string>> open();
|
||||||
void kill();
|
void kill();
|
||||||
bool isRunning() const;
|
bool isRunning() const;
|
||||||
|
pid_t getPID() const;
|
||||||
|
|
||||||
SP<CAsyncDialogBox> lockSelf();
|
SP<CAsyncDialogBox> lockSelf();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "ANRManager.hpp"
|
#include "ANRManager.hpp"
|
||||||
|
|
||||||
#include "../helpers/fs/FsUtils.hpp"
|
#include "../helpers/fs/FsUtils.hpp"
|
||||||
#include "../debug/Log.hpp"
|
#include "../debug/Log.hpp"
|
||||||
#include "../macros.hpp"
|
#include "../macros.hpp"
|
||||||
|
|
@ -29,6 +30,10 @@ CANRManager::CANRManager() {
|
||||||
auto window = std::any_cast<PHLWINDOW>(data);
|
auto window = std::any_cast<PHLWINDOW>(data);
|
||||||
|
|
||||||
for (const auto& d : m_data) {
|
for (const auto& d : m_data) {
|
||||||
|
// Window is ANR dialog
|
||||||
|
if (d->isRunning() && d->dialogBox->getPID() == window->getPID())
|
||||||
|
return;
|
||||||
|
|
||||||
if (d->fitsWindow(window))
|
if (d->fitsWindow(window))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -84,7 +89,7 @@ void CANRManager::onTick() {
|
||||||
|
|
||||||
if (data->missedResponses >= *PANRTHRESHOLD) {
|
if (data->missedResponses >= *PANRTHRESHOLD) {
|
||||||
if (!data->isRunning() && !data->dialogSaidWait) {
|
if (!data->isRunning() && !data->dialogSaidWait) {
|
||||||
data->runDialog(firstWindow->m_title, firstWindow->m_class, data->getPid());
|
data->runDialog(firstWindow->m_title, firstWindow->m_class, data->getPID());
|
||||||
|
|
||||||
for (const auto& w : g_pCompositor->m_windows) {
|
for (const auto& w : g_pCompositor->m_windows) {
|
||||||
if (!w->m_isMapped)
|
if (!w->m_isMapped)
|
||||||
|
|
@ -240,7 +245,7 @@ bool CANRManager::SANRData::isDefunct() const {
|
||||||
return xdgBase.expired() && xwaylandSurface.expired();
|
return xdgBase.expired() && xwaylandSurface.expired();
|
||||||
}
|
}
|
||||||
|
|
||||||
pid_t CANRManager::SANRData::getPid() const {
|
pid_t CANRManager::SANRData::getPID() const {
|
||||||
if (xdgBase) {
|
if (xdgBase) {
|
||||||
pid_t pid = 0;
|
pid_t pid = 0;
|
||||||
wl_client_get_credentials(xdgBase->client(), &pid, nullptr, nullptr);
|
wl_client_get_credentials(xdgBase->client(), &pid, nullptr, nullptr);
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class CANRManager {
|
||||||
void killDialog();
|
void killDialog();
|
||||||
bool isDefunct() const;
|
bool isDefunct() const;
|
||||||
bool fitsWindow(PHLWINDOW pWindow) const;
|
bool fitsWindow(PHLWINDOW pWindow) const;
|
||||||
pid_t getPid() const;
|
pid_t getPID() const;
|
||||||
void ping();
|
void ping();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue