+ // Either the inset under the cursor or the
+ // surrounding LyXText will handle this event.
+
+ // Build temporary cursor.
+ cmd.y = min(max(cmd.y,-1), bv_->workHeight());
+ InsetBase * inset = bv_->text()->editXY(cur, cmd.x, cmd.y);
+ lyxerr << BOOST_CURRENT_FUNCTION
+ << " * hit inset at tip: " << inset << endl;
+ lyxerr << BOOST_CURRENT_FUNCTION
+ << " * created temp cursor:" << cur << endl;
+
+ // Put anchor at the same position.
+ cur.resetAnchor();
+
+ // Try to dispatch to an non-editable inset near this position
+ // via the temp cursor. If the inset wishes to change the real
+ // cursor it has to do so explicitly by using
+ // cur.bv().cursor() = cur; (or similar)
+ if (inset)
+ inset->dispatch(cur, cmd);
+
+ // Now dispatch to the temporary cursor. If the real cursor should
+ // be modified, the inset's dispatch has to do so explicitly.
+ if (!cur.result().dispatched())
+ cur.dispatch(cmd);
+
+ if (cur.result().dispatched()) {
+ // Redraw if requested or necessary.
+ update(cur.result().update(), cur.result().update());
+ }