[LyX/master] Rewrite (again!) the code for caret drawing
Scott Kostyshak
skostysh at lyx.org
Thu Nov 26 18:01:13 UTC 2020
On Tue, Nov 24, 2020 at 07:43:57PM +0100, Jean-Marc Lasgouttes wrote:
> commit 1b3ffa6627992edeb5b2f3be0cd47003e17a690d
> Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
> Date: Tue Nov 24 18:35:25 2020 +0100
>
> Rewrite (again!) the code for caret drawing
>
> The caret geometry is now computed in BufferView as a list of shapes
> (caret, horizontal l-shape if needed, completion triangle if needed)
> kept in a variable of type CaretGeometry.
>
> The code in WorkArea.cpp only has to draw these shapes. The
> CaretWidget (which never was a widget) in GuiWorkArea.cpp is gone
> now.
>
> As a consequence, the bounding box for the cursor is known precisely
> and therefore rows should be repainted correctly now. This avoids
> caret droppings.
>
> Fixes bug #12024.
> ---
> @@ -1411,12 +1345,14 @@ QVariant GuiWorkArea::inputMethodQuery(Qt::InputMethodQuery query) const
> switch (query) {
> // this is the CJK-specific composition window position and
> // the context menu position when the menu key is pressed.
> - case Qt::ImMicroFocus:
> - return QRect(d->caret_->x - 10 * (d->preedit_lines_ != 1),
> - d->caret_->y + d->caret_->dim.height() * d->preedit_lines_,
> - d->caret_->dim.width(), d->caret_->dim.height());
> - default:
> - return QWidget::inputMethodQuery(query);
> + case Qt::ImMicroFocus: {
> + CaretGeometry const & cg = bufferView().caretGeometry();
> + return QRect(cg.left - 10 * (d->preedit_lines_ != 1),
> + cg.top + cg.height() * d->preedit_lines_,
> + cg.width(), cg.height());
> + }
> + default:
> + return QWidget::inputMethodQuery(query);
I'm guessing this change did not cause the following warning (since
Qt::ImMicroFocus was there before), but since you touched the code I
bring it up here. When I compile, I get the following warning:
/home/scott/lyxbuilds/master/repo/src/frontends/qt/GuiWorkArea.cpp:1348:11: warning: ‘Qt::ImMicroFocus’ is deprecated [-Wdeprecated-declarations]
The following page suggests to use ImCursorRectangle instead:
https://doc.qt.io/qt-5/qt.html
Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20201126/d13eb145/attachment-0001.asc>
More information about the lyx-devel
mailing list