mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Only apply Wayland workaround in Wayland path
https://github.com/ankitects/anki/issues/1767#issuecomment-1562695240
This commit is contained in:
parent
b618ab93a5
commit
93e1a6be22
1 changed files with 17 additions and 15 deletions
|
@ -523,12 +523,19 @@ def _run(argv: Optional[list[str]] = None, exec: bool = True) -> Optional[AnkiAp
|
||||||
profiler = cProfile.Profile()
|
profiler = cProfile.Profile()
|
||||||
profiler.enable()
|
profiler.enable()
|
||||||
|
|
||||||
if (
|
packaged = getattr(sys, "frozen", False)
|
||||||
getattr(sys, "frozen", False)
|
x11_available = os.getenv("DISPLAY")
|
||||||
and (os.getenv("QT_QPA_PLATFORM") == "wayland" or os.getenv("WAYLAND_DISPLAY"))
|
wayland_configured = qtmajor > 5 and (
|
||||||
and not os.getenv("ANKI_WAYLAND")
|
os.getenv("QT_QPA_PLATFORM") == "wayland" or os.getenv("WAYLAND_DISPLAY")
|
||||||
):
|
)
|
||||||
if not os.getenv("DISPLAY"):
|
wayland_forced = os.getenv("ANKI_WAYLAND")
|
||||||
|
|
||||||
|
if packaged and wayland_configured:
|
||||||
|
if wayland_forced or not x11_available:
|
||||||
|
# Work around broken fractional scaling in Wayland
|
||||||
|
# https://bugreports.qt.io/browse/QTBUG-113574
|
||||||
|
os.environ["QT_SCALE_FACTOR_ROUNDING_POLICY"] = "RoundPreferFloor"
|
||||||
|
if not x11_available:
|
||||||
print(
|
print(
|
||||||
"Trying to use X11, but it is not available. Falling back to Wayland, which has some bugs:"
|
"Trying to use X11, but it is not available. Falling back to Wayland, which has some bugs:"
|
||||||
)
|
)
|
||||||
|
@ -576,11 +583,6 @@ def _run(argv: Optional[list[str]] = None, exec: bool = True) -> Optional[AnkiAp
|
||||||
if os.environ.get("ANKI_SOFTWAREOPENGL"):
|
if os.environ.get("ANKI_SOFTWAREOPENGL"):
|
||||||
QCoreApplication.setAttribute(Qt.ApplicationAttribute.AA_UseSoftwareOpenGL)
|
QCoreApplication.setAttribute(Qt.ApplicationAttribute.AA_UseSoftwareOpenGL)
|
||||||
|
|
||||||
# Work around broken fractional scaling in Wayland
|
|
||||||
# https://bugreports.qt.io/browse/QTBUG-113574
|
|
||||||
if is_lin and qtmajor > 5:
|
|
||||||
os.environ["QT_SCALE_FACTOR_ROUNDING_POLICY"] = "RoundPreferFloor"
|
|
||||||
|
|
||||||
# fix an issue on Windows, where Ctrl+Alt shortcuts are triggered by AltGr,
|
# fix an issue on Windows, where Ctrl+Alt shortcuts are triggered by AltGr,
|
||||||
# preventing users from typing things like "@" through AltGr+Q on a German
|
# preventing users from typing things like "@" through AltGr+Q on a German
|
||||||
# keyboard.
|
# keyboard.
|
||||||
|
|
Loading…
Reference in a new issue