summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-03-19 10:14:56 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-03-23 09:26:34 +0000
commit39636e38fe905ed4f256a447e3451a62624405cd (patch)
tree510e5ad7ea57d5d112f47c0231bc258a18ca0a54 /src
parentddf6ac03cb40c4a299f14b7f0b0c9257587ee828 (diff)
eglfs: Disable the blinking cursor
Make eglfs and linuxfb use the same code via QFbVtHandler. Task-number: QTBUG-45106 Change-Id: I876bbf5f13bab6d4a81f616c01f15f9c98edf5fc Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/platformsupport/fbconvenience/qfbvthandler.cpp24
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp7
2 files changed, 24 insertions, 7 deletions
diff --git a/src/platformsupport/fbconvenience/qfbvthandler.cpp b/src/platformsupport/fbconvenience/qfbvthandler.cpp
index 84844d8eda..c46e470c34 100644
--- a/src/platformsupport/fbconvenience/qfbvthandler.cpp
+++ b/src/platformsupport/fbconvenience/qfbvthandler.cpp
@@ -38,9 +38,11 @@
#define VTH_ENABLED
+#include <private/qcore_unix_p.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
+#include <fcntl.h>
#include <sys/signalfd.h>
#include <sys/ioctl.h>
#include <linux/kd.h>
@@ -59,6 +61,24 @@
QT_BEGIN_NAMESPACE
+#ifdef VTH_ENABLED
+static void setTTYCursor(bool enable)
+{
+ const char * const devs[] = { "/dev/tty0", "/dev/tty", "/dev/console", 0 };
+ int fd = -1;
+ for (const char * const *dev = devs; *dev; ++dev) {
+ fd = QT_OPEN(*dev, O_RDWR);
+ if (fd != -1) {
+ // Enable/disable screen blanking and the blinking cursor.
+ const char *termctl = enable ? "\033[9;15]\033[?33h\033[?25h\033[?0c" : "\033[9;0]\033[?33l\033[?25l\033[?1c";
+ QT_WRITE(fd, termctl, strlen(termctl) + 1);
+ QT_CLOSE(fd);
+ return;
+ }
+ }
+}
+#endif
+
QFbVtHandler::QFbVtHandler(QObject *parent)
: QObject(parent),
m_tty(-1),
@@ -66,6 +86,8 @@ QFbVtHandler::QFbVtHandler(QObject *parent)
m_signalNotifier(0)
{
#ifdef VTH_ENABLED
+ setTTYCursor(false);
+
if (isatty(0)) {
m_tty = 0;
ioctl(m_tty, KDGKBMODE, &m_oldKbdMode);
@@ -114,6 +136,7 @@ QFbVtHandler::~QFbVtHandler()
{
#ifdef VTH_ENABLED
restoreKeyboard();
+ setTTYCursor(true);
if (m_signalFd != -1)
close(m_signalFd);
@@ -172,6 +195,7 @@ void QFbVtHandler::handleInt()
#ifdef VTH_ENABLED
emit interrupted();
restoreKeyboard();
+ setTTYCursor(true);
_exit(1);
#endif
}
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
index 5407fa66dc..91708c0a47 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
@@ -264,9 +264,6 @@ static bool switchToGraphicsMode(int ttyfd, int *oldMode)
return false;
}
- // No blankin' screen, no blinkin' cursor!, no cursor!
- const char termctl[] = "\033[9;0]\033[?33l\033[?25l\033[?1c";
- QT_WRITE(ttyfd, termctl, sizeof(termctl));
return true;
}
@@ -274,10 +271,6 @@ static void resetTty(int ttyfd, int oldMode)
{
ioctl(ttyfd, KDSETMODE, oldMode);
- // Blankin' screen, blinkin' cursor!
- const char termctl[] = "\033[9;15]\033[?33h\033[?25h\033[?0c";
- QT_WRITE(ttyfd, termctl, sizeof(termctl));
-
QT_CLOSE(ttyfd);
}