Refactor: Notificaciones muestran solo la última (sin cola FIFO)
Cambio de comportamiento: - ANTES: Notificaciones en cola FIFO esperaban turno secuencialmente - AHORA: Solo se muestra la última notificación inmediatamente Implementación: - show() destruye notificación actual con current_notification_.reset() - Vacía cola completa descartando notificaciones pendientes - Activa nueva notificación inmediatamente sin esperar en cola Resultado: - ✅ Usuario pulsa 5 teclas rápido → Solo ve la 5ª notificación - ✅ Feedback inmediato → Nueva reemplaza vieja instantáneamente - ✅ Sin esperas → Siempre información actualizada - ✅ UX mejorada → Respuesta inmediata a última acción del usuario 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,15 @@ void Notifier::show(const std::string& text, Uint64 duration) {
|
||||
duration = NOTIFICATION_DURATION;
|
||||
}
|
||||
|
||||
// NUEVO: Limpiar notificación actual y cola (solo mostrar la última)
|
||||
// Si hay una notificación activa, destruirla inmediatamente
|
||||
current_notification_.reset();
|
||||
|
||||
// Vaciar cola completa (descartar notificaciones pendientes)
|
||||
while (!notification_queue_.empty()) {
|
||||
notification_queue_.pop();
|
||||
}
|
||||
|
||||
// Crear nueva notificación
|
||||
Notification notif;
|
||||
notif.text = text;
|
||||
@@ -52,8 +61,8 @@ void Notifier::show(const std::string& text, Uint64 duration) {
|
||||
notif.y_offset = -50.0f; // Comienza 50px arriba (fuera de pantalla)
|
||||
// NOTA: Los colores se obtienen dinámicamente desde ThemeManager en render()
|
||||
|
||||
// Añadir a cola
|
||||
notification_queue_.push(notif);
|
||||
// Activar inmediatamente como notificación actual (sin esperar en cola)
|
||||
current_notification_ = std::make_unique<Notification>(notif);
|
||||
}
|
||||
|
||||
void Notifier::update(Uint64 current_time) {
|
||||
|
||||
Reference in New Issue
Block a user