From c9ec9e0a4ca01bbfa1655348d60f5fafb40b53ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 13 Apr 2017 18:16:54 +0200 Subject: [PATCH] [apps] Avoid useless blinking in row button view Change-Id: Ib4cba9a4c08b66fcbd26c6afd183c670ee670944 --- escher/src/button_row_controller.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/escher/src/button_row_controller.cpp b/escher/src/button_row_controller.cpp index c7212b850..e58df4c90 100644 --- a/escher/src/button_row_controller.cpp +++ b/escher/src/button_row_controller.cpp @@ -49,10 +49,15 @@ int ButtonRowController::ContentView::numberOfSubviews() const { } View * ButtonRowController::ContentView::subviewAtIndex(int index) { - if (index == 0) { + /* Warning: the order of the subviews is important for drity tracking. + * Indeed, when a child is redrawn, the redrawn area is the smallest + * rectangle unioniong the dirty rectangle and the previous redrawn area. + * As the main view is more likely to be bigger, we prefer to set it as the + * last child. */ + if (index == numberOfSubviews() - 1) { return m_mainViewController->view(); } else { - return buttonAtIndex(index - 1); + return buttonAtIndex(index); } }