]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Narrow focusedItem value range to avoid useless focusedItemChangeNotify calls (when...
authorterencehill <piuntn@gmail.com>
Wed, 2 Sep 2015 10:01:45 +0000 (12:01 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 2 Sep 2015 10:01:45 +0000 (12:01 +0200)
qcsrc/menu/item/listbox.qc

index 067234d3cc08665526a037da66ab39d2fec18c27..9303eb27903dc6bb7273cd95d1e98661570bed1a 100644 (file)
@@ -332,7 +332,7 @@ float ListBox_mousePress(entity me, vector pos)
 void ListBox_setFocusedItem(entity me, int item)
 {
        float focusedItem_save = me.focusedItem;
-       me.focusedItem = item;
+       me.focusedItem = (item < me.nItems) ? item : -1;
        if(focusedItem_save != me.focusedItem)
        {
                me.focusedItemChangeNotify(me);