mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Disable full screen on Windows with OpenGL (#1715)
This commit is contained in:
parent
e6028cd9a4
commit
c21e6e2b97
5 changed files with 32 additions and 2 deletions
|
@ -53,6 +53,7 @@ actions-previous-card-info = Previous Card Info
|
|||
# By convention, the name of a menu action is suffixed with "..." if additional
|
||||
# input is required before it can be performed. E.g. "Export..." vs. "Delete".
|
||||
actions-with-ellipsis = { $action }...
|
||||
actions-currently-unsupported = This action is currently not supported on your system.
|
||||
|
||||
## Flags
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ message HelpPageLinkRequest {
|
|||
CUSTOMIZING_FIELDS = 14;
|
||||
DECK_OPTIONS = 15;
|
||||
EDITING_FEATURES = 16;
|
||||
FULL_SCREEN_ISSUE = 17;
|
||||
}
|
||||
HelpPage page = 1;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ from aqt.utils import (
|
|||
checkInvalidFilename,
|
||||
current_window,
|
||||
disable_help_button,
|
||||
disallow_full_screen,
|
||||
getFile,
|
||||
getOnlyText,
|
||||
openHelp,
|
||||
|
@ -1273,8 +1274,17 @@ title="{}" {}>{}</button>""".format(
|
|||
##########################################################################
|
||||
|
||||
def on_toggle_full_screen(self) -> None:
|
||||
window = self.app.activeWindow()
|
||||
window.setWindowState(window.windowState() ^ Qt.WindowState.WindowFullScreen)
|
||||
if disallow_full_screen():
|
||||
showWarning(
|
||||
tr.actions_currently_unsupported(),
|
||||
parent=self,
|
||||
help=HelpPage.FULL_SCREEN_ISSUE,
|
||||
)
|
||||
else:
|
||||
window = self.app.activeWindow()
|
||||
window.setWindowState(
|
||||
window.windowState() ^ Qt.WindowState.WindowFullScreen
|
||||
)
|
||||
|
||||
# Auto update
|
||||
##########################################################################
|
||||
|
|
|
@ -852,6 +852,23 @@ def qtMenuShortcutWorkaround(qmenu: QMenu) -> None:
|
|||
######################################################################
|
||||
|
||||
|
||||
def disallow_full_screen() -> bool:
|
||||
"""Test for OpenGl on Windows, which is known to cause issues with full screen mode.
|
||||
On Qt6, the driver is not detectable, so check if it has been set explicitly.
|
||||
"""
|
||||
from aqt import mw
|
||||
from aqt.profiles import VideoDriver
|
||||
|
||||
return is_win and (
|
||||
(qtmajor == 5 and mw.pm.video_driver() == VideoDriver.OpenGL)
|
||||
or (
|
||||
qtmajor == 6
|
||||
and not os.environ.get("ANKI_SOFTWAREOPENGL")
|
||||
and os.environ.get("QT_OPENGL") != "software"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def add_ellipsis_to_action_label(*actions: QAction) -> None:
|
||||
"""Pass actions to add '...' to their labels, indicating that more input is
|
||||
required before they can be performed.
|
||||
|
|
|
@ -29,6 +29,7 @@ impl HelpPage {
|
|||
HelpPage::CustomizingFields => "editing.html#customizing-fields",
|
||||
HelpPage::DeckOptions => "deck-options.html",
|
||||
HelpPage::EditingFeatures => "editing.html#editing-features",
|
||||
HelpPage::FullScreenIssue => "platform/windows/display-issues.html#full-screen",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue