From c0d3088817f02bf7dc7fb07cb6051088ffad22a9 Mon Sep 17 00:00:00 2001 From: cakepie Date: Fri, 2 Dec 2022 23:26:16 +0800 Subject: [PATCH] Departure boards: Fix "show via" widget needs redrawn when changed as a side effect of "show deps" toggled --- src/departures_gui.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/departures_gui.cpp b/src/departures_gui.cpp index fb64250ff3..3ba3984995 100644 --- a/src/departures_gui.cpp +++ b/src/departures_gui.cpp @@ -365,16 +365,19 @@ public: this->RaiseWidget(widget); } - if (!this->departure_types[0]) { - this->RaiseWidget(WID_DB_SHOW_VIA); - this->DisableWidget(WID_DB_SHOW_VIA); - } else { - this->EnableWidget(WID_DB_SHOW_VIA); - - if (this->departure_types[2]) { - this->LowerWidget(WID_DB_SHOW_VIA); + /* Side effects */ + if (widget == WID_DB_SHOW_DEPS) { + if (!this->departure_types[0]) { + this->RaiseWidget(WID_DB_SHOW_VIA); + this->DisableWidget(WID_DB_SHOW_VIA); + } else { + this->EnableWidget(WID_DB_SHOW_VIA); + this->SetWidgetLoweredState(WID_DB_SHOW_VIA,this->departure_types[2]); } + /* Redraw required. */ + this->SetWidgetDirty(WID_DB_SHOW_VIA); } + /* We need to recompute the departures list. */ this->calc_tick_countdown = 0; /* We need to redraw the button that was pressed. */