44 #if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_TTY) 46 #include <QSocketNotifier> 47 #include <QStringList> 49 #include <qplatformdefs.h> 50 #include <private/qcore_unix_p.h> 55 #if defined Q_OS_LINUX 56 # include <linux/kd.h> 57 # include <linux/vt.h> 62 # include "private/qwindowsurface_qws_p.h" 63 # include "private/qwssignalhandler_p.h" 65 # define VTACQSIG SIGUSR1 66 # define VTRELSIG SIGUSR2 114 : m_handler(h), m_tty_fd(-1), m_last_keycode(0), m_vt_qws(0), m_orig_kbmode(K_XLATE)
117 #ifndef QT_NO_QWS_SIGNALHANDLER 122 int repeat_delay = -1;
123 int repeat_rate = -1;
126 foreach (
const QString &arg, args) {
137 if (repeat_delay > 0 && repeat_rate > 0) {
138 #if defined(Q_OS_LINUX) 139 struct ::kbd_repeat kbdrep = { repeat_delay, repeat_rate };
140 ::ioctl(
m_tty_fd, KDKBDREP, &kbdrep);
151 struct ::termios termdata;
154 #if defined(Q_OS_LINUX) 164 ::ioctl(
m_tty_fd, KDSKBMODE, K_MEDIUMRAW);
168 termdata.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
169 termdata.c_oflag = 0;
170 termdata.c_cflag = CREAD | CS8;
171 termdata.c_lflag = 0;
172 termdata.c_cc[VTIME]=0;
173 termdata.c_cc[VMIN]=1;
174 cfsetispeed(&termdata, 9600);
175 cfsetospeed(&termdata, 9600);
176 tcsetattr(
m_tty_fd, TCSANOW, &termdata);
178 #if defined(Q_OS_LINUX) 184 struct ::vt_mode vtMode;
185 if (::ioctl(
m_tty_fd, VT_GETMODE, &vtMode) == 0) {
186 vtMode.mode = VT_PROCESS;
190 if (::ioctl(
m_tty_fd, VT_SETMODE, &vtMode) == 0) {
191 struct ::vt_stat vtStat;
192 ::memset(&vtStat, 0,
sizeof(vtStat));
194 if (::ioctl(
m_tty_fd, VT_GETSTATE, &vtStat) == 0 ) {
201 qWarning(
"Could not initialize virtual console switching");
213 #if defined(Q_OS_LINUX) 225 #if defined(Q_OS_LINUX) 228 ::ioctl(
m_tty_fd, KDGETLED, &ledstate);
233 ::ioctl(
m_tty_fd, KDSETLED, ledstate);
246 qWarning(
"Got EOF from the input device.");
248 }
else if (n < 0 && (
errno != EINTR &&
errno != EAGAIN)) {
249 qWarning(
"Could not read from input device: %s", strerror(
errno));
256 for (
int i = 0; i < n; ++i) {
302 #if defined(Q_OS_LINUX) 310 #if defined(Q_OS_LINUX) 315 if (::ioctl(
m_tty_fd, VT_RELDISP, VT_ACKACQ) == 0) {
325 bool allWindowsHidden =
true;
327 for (
int i = 0; i < windows.
size(); ++i) {
331 allWindowsHidden =
false;
336 if (!allWindowsHidden) {
339 }
else if (::ioctl(
m_tty_fd, VT_RELDISP, 1) == 0) {
351 #include "qkbdtty_qws.moc" 353 #endif // QT_NO_QWS_KEYBOARD || QT_NO_QWS_KBD_TTY Q_GUI_EXPORT QScreen * qt_screen
The QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux...
The QWSKeyboardHandler class is a base class for keyboard drivers in Qt for Embedded Linux...
#define QT_END_NAMESPACE
This macro expands to.
static QWSServer * instance()
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
void refresh()
Refreshes the display by making the screen driver update the entire display.
virtual void restore()
Restores the previously saved state of the graphics card.
void switchConsole(int vt)
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QRegion allocatedRegion() const
Returns the region that the window is allowed to draw onto, including any window decorations but excl...
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
void addObject(QObject *object)
The QSocketNotifier class provides support for monitoring activity on a file descriptor.
void setObjectName(const QString &name)
static QWSSignalHandler * instance()
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
#define QT_BEGIN_NAMESPACE
This macro expands to.
static void watchUnixSignal(int signal, bool watch)
void enablePainting(bool)
Enables painting onto the screen if enable is true; otherwise painting is disabled.
void switchLed(char, bool)
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
void resumeMouse()
Resumes pointer handling by reactivating all the mouse drivers registered by the QWS_MOUSE_PROTO envi...
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
QWSTtyKbPrivate(QWSTtyKeyboardHandler *handler, const QString &device)
Q_CORE_EXPORT void qWarning(const char *,...)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
KeycodeAction
This enum describes the various special actions that actual QWSKeyboardHandler implementations have t...
virtual bool filterKeycode(char &code)
QWSTtyKeyboardHandler * m_handler
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
struct termios m_tty_attr
void suspendMouse()
Suspends pointer handling by deactivating all the mouse drivers registered by the QWS_MOUSE_PROTO env...
const char * constData() const
Returns a pointer to the data stored in the byte array.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
virtual void save()
Saves the current state of the graphics card.
static QCoreApplication * instance()
Returns a pointer to the application's QCoreApplication (or QApplication) instance.
virtual ~QWSTtyKeyboardHandler()
bool isRegionReserved() const
Returns true if the QWSWindowSurface::RegionReserved is set; otherwise returns false.
Q_DECL_CONSTEXPR const T & qBound(const T &min, const T &val, const T &max)
int size() const
Returns the number of items in the list.
QWSWindowSurface * windowSurface() const
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
QImageIOHandler * handler
#define qPrintable(string)
KeycodeAction processKeycode(quint16 keycode, bool pressed, bool autorepeat)
Maps keycode according to a keymap and sends that key event to the Qt for Embedded Linux server appli...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
void handleConsoleSwitch(int sig)
QWSServer Q_GUI_EXPORT * qwsServer
const QList< QWSWindow * > & clientWindows()
Returns the list of current top-level windows.
The QList class is a template class that provides lists.
QWSTtyKeyboardHandler(const QString &)
#define forever
This macro is provided for convenience for writing infinite loops.