parent
0e24f9c0d5
commit
f4b148df1e
7 changed files with 184 additions and 58 deletions
|
|
@ -5,20 +5,22 @@
|
|||
#include <chrono>
|
||||
#include <hyprutils/os/Process.hpp>
|
||||
#include <hyprutils/os/FileDescriptor.hpp>
|
||||
#include <map>
|
||||
#include "./eventLoop/EventLoopTimer.hpp"
|
||||
#include "../helpers/signal/Signal.hpp"
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
class CXDGWMBase;
|
||||
class CXWaylandSurface;
|
||||
|
||||
class CANRManager {
|
||||
public:
|
||||
CANRManager();
|
||||
|
||||
void onResponse(SP<CXDGWMBase> wmBase);
|
||||
bool isNotResponding(SP<CXDGWMBase> wmBase);
|
||||
void onResponse(SP<CXWaylandSurface> xwaylandSurface);
|
||||
bool isNotResponding(PHLWINDOW pWindow);
|
||||
|
||||
private:
|
||||
bool m_active = false;
|
||||
|
|
@ -27,8 +29,12 @@ class CANRManager {
|
|||
void onTick();
|
||||
|
||||
struct SANRData {
|
||||
SANRData(PHLWINDOW pWindow);
|
||||
~SANRData();
|
||||
|
||||
WP<CXWaylandSurface> xwaylandSurface;
|
||||
WP<CXDGWMBase> xdgBase;
|
||||
|
||||
int missedResponses = 0;
|
||||
std::thread dialogThread;
|
||||
SP<Hyprutils::OS::CProcess> dialogProc;
|
||||
|
|
@ -38,9 +44,19 @@ class CANRManager {
|
|||
void runDialog(const std::string& title, const std::string& appName, const std::string appClass, pid_t dialogWmPID);
|
||||
bool isThreadRunning();
|
||||
void killDialog() const;
|
||||
bool isDefunct() const;
|
||||
bool fitsWindow(PHLWINDOW pWindow) const;
|
||||
pid_t getPid() const;
|
||||
void ping();
|
||||
};
|
||||
|
||||
std::map<WP<CXDGWMBase>, SP<SANRData>> m_data;
|
||||
void onResponse(SP<SANRData> data);
|
||||
bool isNotResponding(SP<SANRData> data);
|
||||
SP<SANRData> dataFor(PHLWINDOW pWindow);
|
||||
SP<SANRData> dataFor(SP<CXDGWMBase> wmBase);
|
||||
SP<SANRData> dataFor(SP<CXWaylandSurface> pXwaylandSurface);
|
||||
|
||||
std::vector<SP<SANRData>> m_data;
|
||||
};
|
||||
|
||||
inline UP<CANRManager> g_pANRManager;
|
||||
Loading…
Add table
Add a link
Reference in a new issue