+ // Doesn't go through lyxfunc, so we need to update
+ // the layout choice etc. ourselves
+
+ // e.g. Qt mouse press when no buffer
+ if (!available())
+ return false;
+
+ screen().hideCursor();
+
+ // either the inset under the cursor or the surrounding LyXText will
+ // handle this event.
+
+ // built temporary path to inset
+ InsetOld * inset = insetFromCoords(bv_, cmd.x, cmd.y);
+ DispatchResult res;
+
+ // try to dispatch to that inset
+ if (inset) {
+ FuncRequest cmd2 = cmd;
+ lyxerr << "dispatching action " << cmd2.action
+ << " to inset " << inset << endl;
+ cmd2.x -= inset->x();
+ cmd2.y -= inset->y();
+ res = inset->dispatch(cur, cmd2);
+ if (res.update()) {
+ bv_->update();
+ cur.updatePos();
+ }
+ res.update(false);
+ switch (res.val()) {
+ case FINISHED:
+ case FINISHED_RIGHT:
+ case FINISHED_UP:
+ case FINISHED_DOWN:
+ theTempCursor.pop_back();
+ cur.cursor_ = theTempCursor;
+ cur.innerText()
+ ->setCursorFromCoordinates(cmd.x, top_y() + cmd.y);
+ if (bv_->fitCursor())
+ bv_->update();
+ return true;
+ default:
+ lyxerr << "not dispatched by inner inset val: " << res.val() << endl;
+ break;
+ }
+ }
+
+ // otherwise set cursor to surrounding LyXText
+ if (!res.dispatched()) {
+ //lyxerr << "temp cursor is: " << theTempCursor << endl;
+ //lyxerr << "dispatching " << cmd
+ // << " to surrounding LyXText "
+ // << theTempCursor.innerText() << endl;
+ cur.cursor_ = theTempCursor;
+ FuncRequest cmd1 = cmd;
+ cmd1.y += bv_->top_y();
+ res = cur.innerText()->dispatch(cur, cmd1);
+ if (bv_->fitCursor() || res.update())
+ bv_->update();
+
+ //return DispatchResult(true, true);
+ }
+ // see workAreaKeyPress
+ cursor_timeout.restart();
+ screen().showCursor(*bv_);