From 1a008c1380305648ab50f1d99e73439747e9d61d Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 20 Jul 2021 14:24:10 +0200 Subject: [PATCH] Simply screen refresh handler We only need to check the event type once, and preferably early, and avoid doing more work than necessary. --- vncviewer/MonitorArrangement.cxx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/vncviewer/MonitorArrangement.cxx b/vncviewer/MonitorArrangement.cxx index 4c8e8db6..93227c59 100644 --- a/vncviewer/MonitorArrangement.cxx +++ b/vncviewer/MonitorArrangement.cxx @@ -448,18 +448,13 @@ int MonitorArrangement::get_monitor_name(int m, char name[], size_t name_len) int MonitorArrangement::fltk_event_handler(int event) { - MonitorArrangement *self; std::set::iterator it; - for (it = instances.begin(); it != instances.end(); it++) { - self = *it; + if (event != FL_SCREEN_CONFIGURATION_CHANGED) + return 0; - switch (event) { - case FL_SCREEN_CONFIGURATION_CHANGED: - self->refresh(); - break; - } - } + for (it = instances.begin(); it != instances.end(); it++) + (*it)->refresh(); return 0; } -- 2.39.5