eglfs/linuxfb: Add an env.var. to disable screen/cursor control

By default we disable screen blank and hide the cursor. This is something
inherited from Qt 4. Then reset to some default values when exiting.

This is not ideal when the system is configured with kernel parameters
like consoleblank=0 or vt.global_cursor_default=0.

So have a way to skip all tty voodoo. On systems where relevant,
one can now launch with QT_QPA_PRESERVE_CONSOLE_STATE=1 set.

[ChangeLog][Platform Specific Changes][Linux] Added an environment
variable QT_QPA_PRESERVE_CONSOLE_STATE that can be used to prevent
Qt from altering the tty screen and cursor settings when running
with platforms like linuxfb and eglfs.

Task-number: QTBUG-61916
Change-Id: I0e84e53f2d5fca992a7d26d0280ba35e30523379
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
bb10
Laszlo Agocs 2019-10-07 13:08:33 +02:00
parent 3dd8f6dc34
commit 45b76fc4ea
1 changed files with 4 additions and 0 deletions

View File

@ -70,6 +70,10 @@ QT_BEGIN_NAMESPACE
#ifdef VTH_ENABLED
static void setTTYCursor(bool enable)
{
static bool ignore = qEnvironmentVariableIntValue("QT_QPA_PRESERVE_CONSOLE_STATE");
if (ignore)
return;
const char * const devs[] = { "/dev/tty0", "/dev/tty", "/dev/console", 0 };
int fd = -1;
for (const char * const *dev = devs; *dev; ++dev) {