X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt%2FGuiWorkArea.cpp;h=02e03aaaeb780565d741ffd284345b3c09a852e9;hb=070270fdc719edcd0ae49a182acf58583038a765;hp=1c76928ab9b70a61caab0f7c7dddf6c15e40aa85;hpb=4b15d64f5172f622ec9747f25635a822aef725d3;p=features.git diff --git a/src/frontends/qt/GuiWorkArea.cpp b/src/frontends/qt/GuiWorkArea.cpp index 1c76928ab9..02e03aaaeb 100644 --- a/src/frontends/qt/GuiWorkArea.cpp +++ b/src/frontends/qt/GuiWorkArea.cpp @@ -40,9 +40,6 @@ #include "Undo.h" #include "version.h" -#include "graphics/GraphicsImage.h" -#include "graphics/GraphicsLoader.h" - #include "support/convert.h" #include "support/debug.h" #include "support/lassert.h" @@ -96,7 +93,7 @@ static mouse_button::state q_button_state(Qt::MouseButton button) case Qt::LeftButton: b = mouse_button::button1; break; - case Qt::MidButton: + case Qt::MiddleButton: b = mouse_button::button2; break; case Qt::RightButton: @@ -115,7 +112,7 @@ mouse_button::state q_motion_state(Qt::MouseButtons state) mouse_button::state b = mouse_button::none; if (state & Qt::LeftButton) b |= mouse_button::button1; - if (state & Qt::MidButton) + if (state & Qt::MiddleButton) b |= mouse_button::button2; if (state & Qt::RightButton) b |= mouse_button::button3; @@ -133,26 +130,15 @@ SyntheticMouseEvent::SyntheticMouseEvent() GuiWorkArea::Private::Private(GuiWorkArea * parent) -: p(parent), buffer_view_(nullptr), lyx_view_(nullptr), - caret_visible_(false), need_resize_(false), preedit_lines_(1), - last_pixel_ratio_(1.0), completer_(new GuiCompleter(p, p)), - dialog_mode_(false), shell_escape_(false), read_only_(false), - clean_(true), externally_modified_(false), needs_caret_geometry_update_(true) -{ -/* Qt on macOS and Wayland does not respect the - * Qt::WA_OpaquePaintEvent attribute and resets the widget backing - * store at each update. Therefore, we use our own backing store in - * these two cases. */ -#if QT_VERSION >= 0x050000 + : p(parent), completer_(new GuiCompleter(p, p)) +{ + /* Qt on macOS and Wayland does not respect the + * Qt::WA_OpaquePaintEvent attribute and resets the widget backing + * store at each update. Therefore, we use our own backing store + * in these two cases. + */ use_backingstore_ = guiApp->platformName() == "cocoa" || guiApp->platformName().contains("wayland"); -#else -# ifdef Q_OS_MAC - use_backingstore_ = true; -# else - use_backingstore_ = false; -# endif -#endif int const time = QApplication::cursorFlashTime() / 2; if (time > 0) { @@ -1563,7 +1549,7 @@ TabWorkArea::TabWorkArea(QWidget * parent) void TabWorkArea::mousePressEvent(QMouseEvent *me) { - if (me->button() == Qt::MidButton) + if (me->button() == Qt::MiddleButton) midpressed_tab_ = tabBar()->tabAt(me->pos()); else QTabWidget::mousePressEvent(me); @@ -1572,7 +1558,7 @@ void TabWorkArea::mousePressEvent(QMouseEvent *me) void TabWorkArea::mouseReleaseEvent(QMouseEvent *me) { - if (me->button() == Qt::MidButton) { + if (me->button() == Qt::MiddleButton) { int const midreleased_tab = tabBar()->tabAt(me->pos()); if (midpressed_tab_ == midreleased_tab && posIsTab(me->pos())) closeTab(midreleased_tab);