]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_data.C
Fix event loop to no longer eat CPU
[lyx.git] / src / mathed / math_data.C
index b26a119a08a38cb869977fd9a51452b9a11edd48..770f5048f5550e483db2e105402951cc9bb3adec 100644 (file)
@@ -310,6 +310,7 @@ void MathArray::draw(PainterInfo & pi, int x, int y) const
                        }
                }
 #endif
+               theCoords.insets().add(at.nucleus(), x, y);
                at->drawSelection(pi, x, y);
                at->draw(pi, x, y);
                x += at->width();
@@ -383,13 +384,19 @@ MathArray::size_type MathArray::x2pos(int targetx, int glue) const
 
        if (abs(lastx - targetx) < abs(currx - targetx) && it != begin())
                --it;
-       // The below code guarantees that in this slice, the cursor will 
+       // The below code guarantees that in this slice, the cursor will
        // never be on the right edge of an inset after a mouse click.
-       if (it != begin())
+#ifdef WITH_WARNINGS
+#warning A better solution has to be found here!
+       // FIXME: this is too brute! The position left to an inset should
+       // be reachable with the mouse in general.
+#endif
+       if (it != begin()) {
                --it;
-       if (it < end() && (*it)->getChar())
-               ++it;
-               
+               if (it < end() && (*it)->getChar())
+                       ++it;
+       }
+
        return it - begin();
 }