mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
Add lyxrc option to force the use of backing store
LyX relies on a a backing store to draw when running under macOS or Wayland, because Qt arbitrarily overwrites parts of the workarea before we paint (and we paint only the parts that need to be painted). However it seems that this is also necessary on X11 when the WM theme is translucid. Since there is no way that I know of to detect this situation, this patch adds a LyXRC setting to manually select this drawing strategy. Note that using a backing store is not always a good solution, since this disables subpixel aliasing. At this point there is no UI for the variable. Fixes bug #12119 (cherry picked from commitc213eb7f75
) (cherry picked from commit1ed9257c6d
)
This commit is contained in:
parent
4455585608
commit
1def11d296
@ -1,3 +1,14 @@
|
|||||||
|
!Important Change in LyX 2.3.7
|
||||||
|
|
||||||
|
The following pref variable was added:
|
||||||
|
|
||||||
|
* \draw_strategy partial|backingstore: when this is set to
|
||||||
|
"backingstore", the drawing code will force the use of an
|
||||||
|
intermediate surface, instead of just drawing changed regions on
|
||||||
|
screen. Note that "backingstore" is actually always enforced on
|
||||||
|
macOS and Wayland (default: partial).
|
||||||
|
|
||||||
|
|
||||||
!Important Change in LyX 2.3.1
|
!Important Change in LyX 2.3.1
|
||||||
|
|
||||||
* A change to how math macros are output can break some documents that use
|
* A change to how math macros are output can break some documents that use
|
||||||
|
@ -105,6 +105,7 @@ LexerKeyword lyxrcTags[] = {
|
|||||||
{ "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
|
{ "\\dialogs_iconify_with_main", LyXRC::RC_DIALOGS_ICONIFY_WITH_MAIN },
|
||||||
{ "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
|
{ "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
|
||||||
{ "\\document_path", LyXRC::RC_DOCUMENTPATH },
|
{ "\\document_path", LyXRC::RC_DOCUMENTPATH },
|
||||||
|
{ "\\draw_strategy", LyXRC::RC_DRAW_STRATEGY },
|
||||||
{ "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES },
|
{ "\\editor_alternatives", LyXRC::RC_EDITOR_ALTERNATIVES },
|
||||||
{ "\\escape_chars", LyXRC::RC_ESC_CHARS },
|
{ "\\escape_chars", LyXRC::RC_ESC_CHARS },
|
||||||
{ "\\example_path", LyXRC::RC_EXAMPLEPATH },
|
{ "\\example_path", LyXRC::RC_EXAMPLEPATH },
|
||||||
@ -1244,6 +1245,20 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
|
|||||||
lexrc >> mouse_middlebutton_paste;
|
lexrc >> mouse_middlebutton_paste;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RC_DRAW_STRATEGY:
|
||||||
|
if (lexrc.next()) {
|
||||||
|
string const tmp = lexrc.getString();
|
||||||
|
if (tmp == "partial")
|
||||||
|
draw_strategy = DS_PARTIAL;
|
||||||
|
else if (tmp == "backingstore")
|
||||||
|
draw_strategy = DS_BACKINGSTORE;
|
||||||
|
else {
|
||||||
|
draw_strategy = DS_PARTIAL;
|
||||||
|
LYXERR0("Unrecognized draw strategy " << tmp <<'"');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case RC_LAST:
|
case RC_LAST:
|
||||||
break; // this is just a dummy
|
break; // this is just a dummy
|
||||||
}
|
}
|
||||||
@ -2064,10 +2079,28 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
|||||||
}
|
}
|
||||||
if (tag != RC_LAST)
|
if (tag != RC_LAST)
|
||||||
break;
|
break;
|
||||||
|
// fall through
|
||||||
|
case RC_DRAW_STRATEGY:
|
||||||
|
if (ignore_system_lyxrc ||
|
||||||
|
draw_strategy != system_lyxrc.draw_strategy) {
|
||||||
|
string status;
|
||||||
|
switch (draw_strategy) {
|
||||||
|
case DS_PARTIAL:
|
||||||
|
status = "partial";
|
||||||
|
break;
|
||||||
|
case DS_BACKINGSTORE:
|
||||||
|
status = "backingstore";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
os << "\\draw_strategy " << status << '\n';
|
||||||
|
}
|
||||||
|
if (tag != RC_LAST)
|
||||||
|
break;
|
||||||
|
// fall through
|
||||||
|
|
||||||
os << "\n#\n"
|
os << "\n#\n"
|
||||||
<< "# COLOR SECTION ###################################\n"
|
<< "# COLOR SECTION ###################################\n"
|
||||||
<< "#\n\n";
|
<< "#\n\n";
|
||||||
|
|
||||||
// fall through
|
// fall through
|
||||||
case RC_SET_COLOR:
|
case RC_SET_COLOR:
|
||||||
@ -2963,6 +2996,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
|
|||||||
package().document_dir() = FileName(lyxrc.document_path);
|
package().document_dir() = FileName(lyxrc.document_path);
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
|
case LyXRC::RC_DRAW_STRATEGY:
|
||||||
case LyXRC::RC_EDITOR_ALTERNATIVES:
|
case LyXRC::RC_EDITOR_ALTERNATIVES:
|
||||||
case LyXRC::RC_ESC_CHARS:
|
case LyXRC::RC_ESC_CHARS:
|
||||||
case LyXRC::RC_EXAMPLEPATH:
|
case LyXRC::RC_EXAMPLEPATH:
|
||||||
|
12
src/LyXRC.h
12
src/LyXRC.h
@ -183,6 +183,7 @@ public:
|
|||||||
RC_VIEWER_ALTERNATIVES,
|
RC_VIEWER_ALTERNATIVES,
|
||||||
RC_VISUAL_CURSOR,
|
RC_VISUAL_CURSOR,
|
||||||
RC_CLOSE_BUFFER_WITH_LAST_VIEW,
|
RC_CLOSE_BUFFER_WITH_LAST_VIEW,
|
||||||
|
RC_DRAW_STRATEGY,
|
||||||
RC_LAST
|
RC_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -533,6 +534,17 @@ public:
|
|||||||
int cursor_width;
|
int cursor_width;
|
||||||
/// One of: yes, no, ask
|
/// One of: yes, no, ask
|
||||||
std::string close_buffer_with_last_view;
|
std::string close_buffer_with_last_view;
|
||||||
|
|
||||||
|
enum DrawStrategy {
|
||||||
|
// draw all (not implemented yet)
|
||||||
|
// FS_FULL,
|
||||||
|
// draw only what has changed
|
||||||
|
DS_PARTIAL,
|
||||||
|
// draw in backing store (only what has changed)
|
||||||
|
DS_BACKINGSTORE
|
||||||
|
};
|
||||||
|
///
|
||||||
|
DrawStrategy draw_strategy = DS_PARTIAL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -2509,6 +2509,26 @@ Menus & GuiApplication::menus()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GuiApplication::needsBackingStore() const
|
||||||
|
{
|
||||||
|
/* 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. It is also possible to force the use of the
|
||||||
|
* backing store for cases like x11 with transparent WM themes.
|
||||||
|
*/
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
return platformName() == "cocoa" || platformName().contains("wayland");
|
||||||
|
#else
|
||||||
|
# ifdef Q_OS_MAC
|
||||||
|
return true;
|
||||||
|
# else
|
||||||
|
return false;
|
||||||
|
# endif // Q_OS_MAC
|
||||||
|
#endif // QT_VERSION
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QList<int> GuiApplication::viewIds() const
|
QList<int> GuiApplication::viewIds() const
|
||||||
{
|
{
|
||||||
return d->views_.keys();
|
return d->views_.keys();
|
||||||
|
@ -103,6 +103,9 @@ public:
|
|||||||
///
|
///
|
||||||
Menus & menus();
|
Menus & menus();
|
||||||
|
|
||||||
|
/// \returns true if painting the workarea requires a backing store.
|
||||||
|
bool needsBackingStore() const;
|
||||||
|
|
||||||
/// \name Methods inherited from QApplication class
|
/// \name Methods inherited from QApplication class
|
||||||
//@{
|
//@{
|
||||||
bool notify(QObject * receiver, QEvent * event) override;
|
bool notify(QObject * receiver, QEvent * event) override;
|
||||||
|
@ -245,20 +245,10 @@ GuiWorkArea::Private::Private(GuiWorkArea * parent)
|
|||||||
dialog_mode_(false), shell_escape_(false), read_only_(false),
|
dialog_mode_(false), shell_escape_(false), read_only_(false),
|
||||||
clean_(true), externally_modified_(false), needs_caret_geometry_update_(true)
|
clean_(true), externally_modified_(false), needs_caret_geometry_update_(true)
|
||||||
{
|
{
|
||||||
/* Qt on macOS and Wayland does not respect the
|
use_backingstore_ = lyxrc.draw_strategy == LyXRC::DS_BACKINGSTORE
|
||||||
* Qt::WA_OpaquePaintEvent attribute and resets the widget backing
|
|| guiApp->needsBackingStore();
|
||||||
* store at each update. Therefore, we use our own backing store in
|
LYXERR(Debug::WORKAREA, "Drawing strategy is: "
|
||||||
* these two cases. */
|
<< (use_backingstore_ ? "backingstore" : "partial"));
|
||||||
#if QT_VERSION >= 0x050000
|
|
||||||
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;
|
int const time = QApplication::cursorFlashTime() / 2;
|
||||||
if (time > 0) {
|
if (time > 0) {
|
||||||
|
@ -44,6 +44,9 @@ What's new
|
|||||||
|
|
||||||
- Fix broken modifier handling for Qt-5.12 on Mac (bug 12247).
|
- Fix broken modifier handling for Qt-5.12 on Mac (bug 12247).
|
||||||
|
|
||||||
|
- Add new pref variable \draw_strategy to fix some cases where display
|
||||||
|
is blinking (bug 12119).
|
||||||
|
|
||||||
|
|
||||||
* DOCUMENTATION AND LOCALIZATION
|
* DOCUMENTATION AND LOCALIZATION
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user