hover pauses notification
This commit is contained in:
@@ -28,8 +28,9 @@ class NotificationController {
|
||||
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;
|
||||
|
||||
void updateHoverState(uint64_t notificationId, bool isHovered);
|
||||
void closeNotification(uint64_t notificationId);
|
||||
};
|
||||
};
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
#include <csignal>
|
||||
#include <cstdint>
|
||||
#include <chrono>
|
||||
|
||||
#include <sigc++/connection.h>
|
||||
|
||||
#include "gdkmm/monitor.h"
|
||||
#include "gtkmm/window.h"
|
||||
@@ -13,18 +16,31 @@ class BaseNotification : public Gtk::Window {
|
||||
public:
|
||||
BaseNotification( uint64_t notificationId, std::shared_ptr<Gdk::Monitor> monitor);
|
||||
|
||||
void pauseAutoClose();
|
||||
void resumeAutoClose();
|
||||
void startAutoClose(int timeoutMs);
|
||||
|
||||
sigc::signal<void(int)> signal_close;
|
||||
sigc::signal<void(bool)> signal_hover_changed;
|
||||
|
||||
virtual ~BaseNotification() = default;
|
||||
|
||||
uint64_t getNotificationId() const {
|
||||
return this->notificationId;
|
||||
}
|
||||
|
||||
private:
|
||||
void ensure_notification_css_loaded();
|
||||
|
||||
void start_auto_close_timeout(int timeoutMs);
|
||||
void pause_auto_close();
|
||||
void resume_auto_close();
|
||||
|
||||
// onClose signal can be added here if needed
|
||||
protected:
|
||||
uint64_t notificationId;
|
||||
|
||||
bool autoClosePaused = false;
|
||||
int autoCloseRemainingMs = 0;
|
||||
std::chrono::steady_clock::time_point autoCloseDeadline;
|
||||
sigc::connection autoCloseConnection;
|
||||
};
|
||||
Reference in New Issue
Block a user