From: terencehill Date: Wed, 2 Sep 2015 10:01:45 +0000 (+0200) Subject: Narrow focusedItem value range to avoid useless focusedItemChangeNotify calls (when... X-Git-Tag: xonotic-v0.8.2~1808^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9c41791f4e5993c2fd0dc9298f70ee8e5d8e04d2;p=xonotic%2Fxonotic-data.pk3dir.git Narrow focusedItem value range to avoid useless focusedItemChangeNotify calls (when list is smaller than list box) --- diff --git a/qcsrc/menu/item/listbox.qc b/qcsrc/menu/item/listbox.qc index 067234d3c..9303eb279 100644 --- a/qcsrc/menu/item/listbox.qc +++ b/qcsrc/menu/item/listbox.qc @@ -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);