From 346bda45f26176cd57bdbdf8bf904882489e643d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Tue, 17 Dec 2019 02:28:00 -0300 Subject: [PATCH] Minor optimization. --HG-- branch : dev --- include/eepp/ui/uihelper.hpp | 3 ++- src/eepp/ui/uiwidget.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/eepp/ui/uihelper.hpp b/include/eepp/ui/uihelper.hpp index 53195ab84..6e8d67555 100644 --- a/include/eepp/ui/uihelper.hpp +++ b/include/eepp/ui/uihelper.hpp @@ -33,7 +33,8 @@ enum UIFlag { UI_ANCHOR_LEFT = (1 << 16), UI_ANCHOR_RIGHT = (1 << 17), UI_TOUCH_DRAG_ENABLED = (1 << 18), - UI_TEXT_SELECTION_ENABLED = (1 << 19) + UI_TEXT_SELECTION_ENABLED = (1 << 19), + UI_ATTRIBUTE_CHANGED = (1 << 20) }; enum UINodeType { diff --git a/src/eepp/ui/uiwidget.cpp b/src/eepp/ui/uiwidget.cpp index 67970d0b6..f32b13443 100644 --- a/src/eepp/ui/uiwidget.cpp +++ b/src/eepp/ui/uiwidget.cpp @@ -406,6 +406,8 @@ void UIWidget::notifyLayoutAttrChange() { if ( 0 == mAttributesTransactionCount ) { NodeMessage msg( this, NodeMessage::LayoutAttributeChange ); messagePost( &msg ); + } else { + mFlags |= UI_ATTRIBUTE_CHANGED; } } @@ -756,7 +758,11 @@ void UIWidget::endAttributesTransaction() { mAttributesTransactionCount--; if ( 0 == mAttributesTransactionCount ) { - notifyLayoutAttrChange(); + if ( mFlags & UI_ATTRIBUTE_CHANGED ) { + notifyLayoutAttrChange(); + + mFlags &= ~UI_ATTRIBUTE_CHANGED; + } } }