Make tooltip_show_delay=0 work
authorZefram <zefram@fysh.org>
Wed, 2 Jul 2014 13:32:54 +0000 (14:32 +0100)
committersapier <Sapier at GMX dot net>
Wed, 16 Jul 2014 16:06:31 +0000 (18:06 +0200)
src/guiFormSpecMenu.cpp

index d6a4b4f47e24d8024b7a53bc2b9a3f42fefa29d2..d6ca12b707ef23e256de7e5b030bf805fa6cd086 100644 (file)
@@ -2350,16 +2350,19 @@ void GUIFormSpecMenu::drawMenu()
 
        if (hovered != NULL) {
                s32 id = hovered->getID();
+               u32 delta;
                if (id == -1) {
                        m_old_tooltip_id = id;
                        m_old_tooltip = "";
+                       delta = 0;
                } else if (id != m_old_tooltip_id) {
                        m_hoovered_time = getTimeMs();
                        m_old_tooltip_id = id;
+                       delta = 0;
                } else if (id == m_old_tooltip_id) {
-                       u32 delta = porting::getDeltaMs(m_hoovered_time, getTimeMs());
-                       if (delta <= m_tooltip_show_delay)
-                               goto skip_tooltip;
+                       delta = porting::getDeltaMs(m_hoovered_time, getTimeMs());
+               }
+               if (id != -1 && delta >= m_tooltip_show_delay) {
                        for(std::vector<FieldSpec>::iterator iter =  m_fields.begin();
                                        iter != m_fields.end(); iter++) {
                                if ( (iter->fid == id) && (m_tooltips[iter->fname].tooltip != "") ){
@@ -2392,7 +2395,6 @@ void GUIFormSpecMenu::drawMenu()
                }
        }
 
-       skip_tooltip:
        /*
                Draw dragged item stack
        */