media widget fix
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
BaseNotification::BaseNotification(uint64_t notificationId, std::shared_ptr<Gdk::Monitor> monitor) {
|
||||
ensure_notification_css_loaded();
|
||||
set_default_size(350, -1);
|
||||
set_default_size(350, 100);
|
||||
gtk_layer_init_for_window(gobj());
|
||||
gtk_layer_set_monitor(gobj(), monitor->gobj());
|
||||
gtk_layer_set_layer(gobj(), GTK_LAYER_SHELL_LAYER_OVERLAY);
|
||||
@@ -72,7 +72,7 @@ void BaseNotification::startAutoClose(int timeoutMs) {
|
||||
}
|
||||
|
||||
autoCloseRemainingMs = timeoutMs;
|
||||
autoClosePaused = false;
|
||||
autoClosePaused = false;
|
||||
start_auto_close_timeout(timeoutMs);
|
||||
}
|
||||
|
||||
@@ -81,12 +81,12 @@ void BaseNotification::start_auto_close_timeout(int timeoutMs) {
|
||||
autoCloseConnection.disconnect();
|
||||
}
|
||||
|
||||
autoCloseDeadline = std::chrono::steady_clock::now() + std::chrono::milliseconds(timeoutMs);
|
||||
autoCloseDeadline = std::chrono::steady_clock::now() + std::chrono::milliseconds(timeoutMs);
|
||||
autoCloseConnection = Glib::signal_timeout().connect([this]() {
|
||||
this->signal_close.emit(this->notificationId);
|
||||
return false; // Don't repeat
|
||||
},
|
||||
timeoutMs);
|
||||
timeoutMs);
|
||||
}
|
||||
|
||||
void BaseNotification::pause_auto_close() {
|
||||
@@ -98,10 +98,10 @@ void BaseNotification::pause_auto_close() {
|
||||
autoCloseConnection.disconnect();
|
||||
}
|
||||
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
auto remaining = std::chrono::duration_cast<std::chrono::milliseconds>(autoCloseDeadline - now).count();
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
auto remaining = std::chrono::duration_cast<std::chrono::milliseconds>(autoCloseDeadline - now).count();
|
||||
autoCloseRemainingMs = static_cast<int>(std::max<int64_t>(0, remaining));
|
||||
autoClosePaused = true;
|
||||
autoClosePaused = true;
|
||||
}
|
||||
|
||||
void BaseNotification::resume_auto_close() {
|
||||
@@ -118,7 +118,6 @@ void BaseNotification::resume_auto_close() {
|
||||
start_auto_close_timeout(autoCloseRemainingMs);
|
||||
}
|
||||
|
||||
|
||||
void BaseNotification::ensure_notification_css_loaded() {
|
||||
static bool loaded = false;
|
||||
if (loaded) {
|
||||
|
||||
Reference in New Issue
Block a user