BTabView: minor optimization.

Short circuit if asked to select the same index that's currently visible, to
avoid unnecessary invalidation/flicker.

Should fix last part of #9841.
This commit is contained in:
Rene Gollent
2013-06-29 11:55:32 -04:00
parent fcf72bc4b4
commit 16e486eb4d
+6 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
* Copyright 2001-2013, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -7,6 +7,7 @@
* Jérôme Duval ([email protected])
* Stephan Aßmus <[email protected]>
* Artur Wyszynski
* Rene Gollent ([email protected])
*/
@@ -746,6 +747,9 @@ BTabView::Pulse()
void
BTabView::Select(int32 index)
{
if (index == Selection())
return;
if (index < 0 || index >= CountTabs())
index = Selection();
@@ -1351,7 +1355,7 @@ BTabView::_InitObject(bool layouted, button_width width)
fTabList = new BList;
fTabWidthSetting = width;
fSelection = 0;
fSelection = -1;
fFocus = -1;
fTabOffset = 0.0f;
fBorderStyle = B_FANCY_BORDER;