fix bar crashing on monitor add/remove
This commit is contained in:
@@ -12,11 +12,11 @@
|
||||
#include "gdkmm/monitor.h"
|
||||
|
||||
class NotificationController {
|
||||
static std::shared_ptr<NotificationController> instance;
|
||||
inline static std::shared_ptr<NotificationController> instance = nullptr;
|
||||
|
||||
public:
|
||||
static std::shared_ptr<NotificationController> getInstance() {
|
||||
if (!NotificationController::instance) {
|
||||
if (NotificationController::instance == nullptr) {
|
||||
NotificationController::instance = std::shared_ptr<NotificationController>(new NotificationController());
|
||||
}
|
||||
return NotificationController::instance;
|
||||
@@ -26,12 +26,15 @@ class NotificationController {
|
||||
void showNotificationOnAllMonitors(NotifyMessage notify);
|
||||
void showCopyNotification(NotifyMessage notify);
|
||||
|
||||
void addMonitor(std::shared_ptr<Gdk::Monitor> monitor);
|
||||
void removeMonitor(std::shared_ptr<Gdk::Monitor> monitor);
|
||||
|
||||
private:
|
||||
uint64_t globalNotificationId = 1;
|
||||
std::map<uint64_t, std::vector<std::shared_ptr<BaseNotification>>> activeNotifications;
|
||||
std::map<uint64_t, int> hoverCounts;
|
||||
NotificationController();
|
||||
std::vector<std::shared_ptr<Gdk::Monitor>> activeMonitors;
|
||||
std::map<std::string, std::shared_ptr<Gdk::Monitor>> activeMonitors;
|
||||
void updateHoverState(uint64_t notificationId, bool isHovered);
|
||||
void closeNotification(uint64_t notificationId);
|
||||
};
|
||||
Reference in New Issue
Block a user