close one notification to close all

This commit is contained in:
2026-02-02 21:46:50 +01:00
parent 49ac6cec90
commit ed1a9a8605
21 changed files with 352 additions and 146 deletions

View File

@@ -6,7 +6,7 @@
#include <cmath>
#include <graphene.h>
#include <utility>
#include <iostream>
#include <spdlog/spdlog.h>
#include "components/base/button.hpp"
namespace {
@@ -168,11 +168,13 @@ void log_menu_tree(const std::vector<TrayService::MenuNode> &nodes,
if (!node.visible) {
continue;
}
std::cerr << "[TrayIconWidget] menu node id=" << node.id
<< " label='" << node.label << "' enabled="
<< (node.enabled ? "1" : "0") << " sep="
<< (node.separator ? "1" : "0") << " depth=" << depth
<< std::endl;
spdlog::debug(
"[TrayIconWidget] menu node id={} label='{}' enabled={} sep={} depth={}",
node.id,
node.label,
node.enabled ? 1 : 0,
node.separator ? 1 : 0,
depth);
if (!node.children.empty()) {
log_menu_tree(node.children, depth + 1);
}
@@ -299,8 +301,8 @@ void TrayIconWidget::on_primary_released(int /*n_press*/, double x, double y) {
}
}
std::cerr << "[TrayIconWidget] Activate primary id=" << id << " x="
<< sendX << " y=" << sendY << std::endl;
spdlog::debug("[TrayIconWidget] Activate primary id={} x={} y={}", id, sendX,
sendY);
service.activate(id, sendX, sendY);
}
@@ -317,8 +319,9 @@ void TrayIconWidget::on_middle_released(int /*n_press*/, double x, double y) {
}
}
std::cerr << "[TrayIconWidget] SecondaryActivate (middle) id=" << id
<< " x=" << sendX << " y=" << sendY << std::endl;
spdlog::debug(
"[TrayIconWidget] SecondaryActivate (middle) id={} x={} y={}", id,
sendX, sendY);
service.secondaryActivate(id, sendX, sendY);
}
@@ -329,8 +332,9 @@ void TrayIconWidget::on_secondary_released(int /*n_press*/, double x,
// would crash without a mapped surface.
GtkWidget *selfWidget = GTK_WIDGET(gobj());
if (!gtk_widget_get_mapped(selfWidget) || !has_popup_surface(selfWidget)) {
std::cerr << "[TrayIconWidget] Secondary fallback ContextMenu (no surface) id="
<< id << std::endl;
spdlog::debug(
"[TrayIconWidget] Secondary fallback ContextMenu (no surface) id={}",
id);
service.contextMenu(id, -1, -1);
return;
}
@@ -341,8 +345,7 @@ void TrayIconWidget::on_secondary_released(int /*n_press*/, double x,
// Use dbusmenu popover when available and we have a mapped surface; else
// fall back to the item's ContextMenu.
if (hasRemoteMenu && has_popup_surface(selfWidget)) {
std::cerr << "[TrayIconWidget] Requesting dbusmenu for id=" << id
<< std::endl;
spdlog::debug("[TrayIconWidget] Requesting dbusmenu for id={}", id);
menuPopupPending = true;
if (menuRequestInFlight) {
return;
@@ -367,12 +370,12 @@ void TrayIconWidget::on_secondary_released(int /*n_press*/, double x,
(void)try_get_global_pointer_coords(GTK_WIDGET(gobj()), sendX, sendY);
}
if (is_wayland_display(GTK_WIDGET(gobj()))) {
std::cerr << "[TrayIconWidget] ContextMenu wayland id=" << id
<< " x=-1 y=-1" << std::endl;
spdlog::debug(
"[TrayIconWidget] ContextMenu wayland id={} x=-1 y=-1", id);
service.contextMenu(id, -1, -1);
} else {
std::cerr << "[TrayIconWidget] ContextMenu id=" << id << " x=" << sendX
<< " y=" << sendY << std::endl;
spdlog::debug("[TrayIconWidget] ContextMenu id={} x={} y={}", id,
sendX, sendY);
service.contextMenu(id, sendX, sendY);
}
}
@@ -518,9 +521,8 @@ void TrayIconWidget::on_menu_action(const Glib::VariantBase & /*parameter*/,
int32_t sendY = -1;
(void)try_get_pending_coords(sendX, sendY);
std::cerr << "[TrayIconWidget] Menu action id=" << this->id
<< " item=" << itemId << " x=" << sendX << " y=" << sendY
<< std::endl;
spdlog::debug("[TrayIconWidget] Menu action id={} item={} x={} y={}",
this->id, itemId, sendX, sendY);
const uint32_t nowMs = static_cast<uint32_t>(g_get_monotonic_time() / 1000);
// Use button 1 for menu activation events; some dbusmenu handlers ignore