From 74aee020b48832f48b75b49bf265bca067a881fc Mon Sep 17 00:00:00 2001 From: yuanye Date: Tue, 28 Jun 2022 11:14:12 +0800 Subject: [PATCH] Resolve focus change theme color transition error --- include/ssd.h | 2 +- src/ssd/ssd.c | 12 ++---------- src/view.c | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/include/ssd.h b/include/ssd.h index 302d78d8..8b5e7359 100644 --- a/include/ssd.h +++ b/include/ssd.h @@ -135,7 +135,7 @@ struct ssd_hover_state { /* Public SSD API */ void ssd_create(struct view *view); void ssd_hide(struct view *view); -void ssd_set_active(struct view *view); +void ssd_set_active(struct view *view, bool activated); void ssd_update_title(struct view *view); void ssd_update_geometry(struct view *view); void ssd_reload(struct view *view); diff --git a/src/ssd/ssd.c b/src/ssd/ssd.c index 94dcf501..64925177 100644 --- a/src/ssd/ssd.c +++ b/src/ssd/ssd.c @@ -285,19 +285,11 @@ ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate) } void -ssd_set_active(struct view *view) +ssd_set_active(struct view *view, bool activated) { if (!view->ssd.tree) { return; } - - struct view *last = view->server->ssd_focused_view; - if (last == view) { - return; - } - if (last && last->ssd.tree) { - _ssd_set_active(&last->ssd, false); - } - _ssd_set_active(&view->ssd, true); + _ssd_set_active(&view->ssd, activated); view->server->ssd_focused_view = view; } diff --git a/src/view.c b/src/view.c index e82dd6d3..1bd0cbdd 100644 --- a/src/view.c +++ b/src/view.c @@ -14,7 +14,7 @@ void view_set_activated(struct view *view, bool activated) { if (view->ssd.enabled) { - ssd_set_active(view); + ssd_set_active(view, activated); } if (view->impl->set_activated) { view->impl->set_activated(view, activated);