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:
@@ -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.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
* Jérôme Duval ([email protected])
|
* Jérôme Duval ([email protected])
|
||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
* Artur Wyszynski
|
* Artur Wyszynski
|
||||||
|
* Rene Gollent ([email protected])
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -746,6 +747,9 @@ BTabView::Pulse()
|
|||||||
void
|
void
|
||||||
BTabView::Select(int32 index)
|
BTabView::Select(int32 index)
|
||||||
{
|
{
|
||||||
|
if (index == Selection())
|
||||||
|
return;
|
||||||
|
|
||||||
if (index < 0 || index >= CountTabs())
|
if (index < 0 || index >= CountTabs())
|
||||||
index = Selection();
|
index = Selection();
|
||||||
|
|
||||||
@@ -1351,7 +1355,7 @@ BTabView::_InitObject(bool layouted, button_width width)
|
|||||||
fTabList = new BList;
|
fTabList = new BList;
|
||||||
|
|
||||||
fTabWidthSetting = width;
|
fTabWidthSetting = width;
|
||||||
fSelection = 0;
|
fSelection = -1;
|
||||||
fFocus = -1;
|
fFocus = -1;
|
||||||
fTabOffset = 0.0f;
|
fTabOffset = 0.0f;
|
||||||
fBorderStyle = B_FANCY_BORDER;
|
fBorderStyle = B_FANCY_BORDER;
|
||||||
|
|||||||
Reference in New Issue
Block a user