[LyX/2.4.1-devel] Defer construction of temporary cursor.

Richard Kimberly Heck rikiheck at lyx.org
Tue Apr 16 16:40:07 UTC 2024


commit 365ff71e2319673c2685be79963443fee13c333b
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Tue Apr 16 12:15:50 2024 -0400

    Defer construction of temporary cursor.
    
    We were doing this on every mouse movement. I.e., for every single
    pixel the mouse traverses. It can be expensive if there are a lot
    of math insets.
    
    (cherry picked from commit 4e8aa89eb96cd73e6630deea6fd6b9d3039aab6c)
---
 src/BufferView.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index d5fa198678..e20b0a7978 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -2678,11 +2678,6 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
 	// LFUN_FILE_OPEN generated by drag-and-drop.
 	FuncRequest cmd = cmd0;
 
-	Cursor old = cursor();
-	Cursor cur(*this);
-	cur.push(buffer_.inset());
-	cur.selection(d->cursor_.selection());
-
 	// Either the inset under the cursor or the
 	// surrounding Text will handle this event.
 
@@ -2700,6 +2695,11 @@ void BufferView::mouseEventDispatch(FuncRequest const & cmd0)
 		return;
 	}
 
+	Cursor old = cursor();
+	Cursor cur(*this);
+	cur.push(buffer_.inset());
+	cur.selection(d->cursor_.selection());
+
 	// Build temporary cursor.
 	Inset * inset = d->text_metrics_[&buffer_.text()].editXY(cur, cmd.x(), cmd.y());
 	if (inset) {


More information about the lyx-cvs mailing list