From 7269faf651cbb789156113df0a540943a24ded27 Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Sat, 21 Aug 2021 18:00:14 +0200 Subject: Only request selection index in ColorsPanel when needed --- ColorsPanel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ColorsPanel.c b/ColorsPanel.c index e9c44b02..86c2023f 100644 --- a/ColorsPanel.c +++ b/ColorsPanel.c @@ -49,7 +49,7 @@ static HandlerResult ColorsPanel_eventHandler(Panel* super, int ch) { ColorsPanel* this = (ColorsPanel*) super; HandlerResult result = IGNORED; - int mark = Panel_getSelectedIndex(super); + int mark; switch(ch) { case 0x0a: @@ -58,6 +58,7 @@ static HandlerResult ColorsPanel_eventHandler(Panel* super, int ch) { case KEY_MOUSE: case KEY_RECLICK: case ' ': + mark = Panel_getSelectedIndex(super); assert(mark >= 0); assert(mark < LAST_COLORSCHEME); for (int i = 0; ColorSchemeNames[i] != NULL; i++) -- cgit v1.2.3