diff --git a/AffinityPanel.c b/AffinityPanel.c index dbce5ca0c..ddc58c966 100644 --- a/AffinityPanel.c +++ b/AffinityPanel.c @@ -172,7 +172,7 @@ static void AffinityPanel_updateTopo(AffinityPanel* this, MaskItem* item) { static void AffinityPanel_update(AffinityPanel* this, bool keepSelected) { Panel* super = (Panel*) this; - FunctionBar_setLabel(super->currentBar, KEY_F(3), this->topoView ? "Collapse/Expand" : ""); + FunctionBar_setLabel(super->defaultBar, KEY_F(3), this->topoView ? "Collapse/Expand" : ""); int oldSelected = Panel_getSelectedIndex(super); Panel_prune(super); diff --git a/IncSet.c b/IncSet.c index 909741375..9dcb01610 100644 --- a/IncSet.c +++ b/IncSet.c @@ -72,8 +72,8 @@ IncSet* IncSet_new(FunctionBar* bar) { } void IncSet_delete(IncSet* this) { - IncMode_done(&(this->modes[0])); - IncMode_done(&(this->modes[1])); + IncMode_done(&(this->modes[INC_SEARCH])); + IncMode_done(&(this->modes[INC_FILTER])); free(this); } diff --git a/MetersPanel.c b/MetersPanel.c index 13c102d18..9196ef3ee 100644 --- a/MetersPanel.c +++ b/MetersPanel.c @@ -54,13 +54,9 @@ void MetersPanel_setMoving(MetersPanel* this, bool moving) { if (selected) { selected->moving = moving; } - if (!moving) { - Panel_setSelectionColor(super, PANEL_SELECTION_FOCUS); - Panel_setDefaultBar(super); - } else { - Panel_setSelectionColor(super, PANEL_SELECTION_FOLLOW); - super->currentBar = Meters_movingBar; - } + + Panel_setSelectionColor(super, moving ? PANEL_SELECTION_FOLLOW : PANEL_SELECTION_FOCUS); + super->currentBar = moving ? Meters_movingBar : NULL; } static inline bool moveToNeighbor(MetersPanel* this, MetersPanel* neighbor, int selected) { diff --git a/Panel.c b/Panel.c index dea64019b..68f59c80d 100644 --- a/Panel.c +++ b/Panel.c @@ -60,7 +60,7 @@ void Panel_init(Panel* this, int x, int y, int w, int h, const ObjectClass* type this->wasFocus = false; RichString_beginAllocated(this->header); this->defaultBar = fuBar; - this->currentBar = fuBar; + this->currentBar = NULL; this->selectionColorId = PANEL_SELECTION_FOCUS; } @@ -324,7 +324,7 @@ void Panel_draw(Panel* this, bool force_redraw, bool focus, bool highlightSelect if (Panel_drawFunctionBarFn(this)) Panel_drawFunctionBar(this, hideFunctionBar); else if (!hideFunctionBar) - FunctionBar_draw(this->currentBar); + FunctionBar_draw(this->currentBar ? this->currentBar : this->defaultBar); } this->oldSelected = this->selected; diff --git a/Panel.h b/Panel.h index 41dba2166..b4065ff03 100644 --- a/Panel.h +++ b/Panel.h @@ -76,7 +76,7 @@ struct Panel_ { ColorElements selectionColorId; }; -#define Panel_setDefaultBar(this_) do { (this_)->currentBar = (this_)->defaultBar; } while (0) +#define Panel_setDefaultBar(this_) do { (this_)->defaultBar = NULL; } while (0) #define KEY_CTRL(l) ((l)-'A'+1) diff --git a/ScreenManager.c b/ScreenManager.c index 914c510b7..cabc6a7bf 100644 --- a/ScreenManager.c +++ b/ScreenManager.c @@ -176,7 +176,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) { if (ok == OK) { if (mevent.bstate & BUTTON1_RELEASED) { if (mevent.y == LINES - 1) { - ch = FunctionBar_synthesizeEvent(panelFocus->currentBar, mevent.x); + ch = FunctionBar_synthesizeEvent(panelFocus->currentBar ? panelFocus->currentBar : panelFocus->defaultBar, mevent.x); } else { for (int i = 0; i < this->panelCount; i++) { Panel* panel = (Panel*) Vector_get(this->panels, i);