⛏️ index : haiku.git

author Máximo Castañeda <antiswen@yahoo.es> 2022-11-15 18:01:45.0 +01:00:00
committer waddlesplash <waddlesplash@gmail.com> 2022-11-17 21:39:34.0 +00:00:00
commit
16c04c68e23ceb6bfd77bf49c0b440e1cacf3150 [patch]
tree
ae7ca31b0d12142180d75fbd356faf4ae3c44591
parent
4df79935e52a93597d3b992684f6cf018ff54295
download
16c04c68e23ceb6bfd77bf49c0b440e1cacf3150.tar.gz

BAlert: invalidate icon view on icon change

Invalidating the layout may not be enough for an update.

Fixes: #18069
Change-Id: I93f6b0feb043c7f317a9ff1e7af11b2047fc7cd5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5821
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
(cherry picked from commit 5728bdf606fa4f339f79a411ae4f99b77570a27c)
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5794

Diff

 src/kits/interface/Alert.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/kits/interface/Alert.cpp b/src/kits/interface/Alert.cpp
index d1d45cf..d126c0a 100644
--- a/src/kits/interface/Alert.cpp
+++ b/src/kits/interface/Alert.cpp
@@ -21,6 +21,7 @@
#include <Bitmap.h>
#include <Button.h>
#include <ControlLook.h>
#include <Debug.h>
#include <FindDirectory.h>
#include <IconUtils.h>
#include <LayoutBuilder.h>
@@ -747,14 +748,17 @@
void
TAlertView::SetBitmap(BBitmap* icon)
{
	if (icon == NULL && fIconBitmap == NULL)
		return;

	ASSERT(icon != fIconBitmap);

	BBitmap* oldBitmap = fIconBitmap;
	fIconBitmap = icon;
	Invalidate();

	if (oldBitmap == NULL || (oldBitmap != NULL && icon == NULL)
			|| (icon != NULL && oldBitmap->Bounds() != icon->Bounds())) {
	if (oldBitmap == NULL || icon == NULL || oldBitmap->Bounds() != icon->Bounds())
		InvalidateLayout();
	} else
		Invalidate();

	delete oldBitmap;
}