Qt 4.8
Public Functions | Public Variables | List of all members
QRfbKeyEvent Class Reference

#include <qscreenvnc_p.h>

Public Functions

bool read (QTcpSocket *s)
 
bool read (QTcpSocket *s)
 

Public Variables

char down
 
int keycode
 
int unicode
 

Detailed Description

Definition at line 213 of file qscreenvnc_p.h.

Functions

◆ read() [1/2]

bool QRfbKeyEvent::read ( QTcpSocket s)

Definition at line 495 of file qscreenvnc_qws.cpp.

Referenced by buttonChange(), and QVNCServer::keyEvent().

496 {
497  if (s->bytesAvailable() < 7)
498  return false;
499 
500  s->read(&down, 1);
501  quint16 tmp;
502  s->read((char *)&tmp, 2); // padding
503 
504  quint32 key;
505  s->read((char *)&key, 4);
506  key = ntohl(key);
507 
508  unicode = 0;
509  keycode = 0;
510  int i = 0;
511  while (keyMap[i].keysym && !keycode) {
512  if (keyMap[i].keysym == (int)key)
513  keycode = keyMap[i].keycode;
514  i++;
515  }
516 
517  if (keycode >= ' ' && keycode <= '~')
518  unicode = keycode;
519 
520  if (!keycode) {
521  if (key <= 0xff) {
522  unicode = key;
523  if (key >= 'a' && key <= 'z')
524  keycode = Qt::Key_A + key - 'a';
525  else if (key >= ' ' && key <= '~')
526  keycode = Qt::Key_Space + key - ' ';
527  }
528  }
529 
530  return true;
531 }
static const struct @345 keyMap[]
qint64 bytesAvailable() const
Returns the number of incoming bytes that are waiting to be read.
int keysym
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
Definition: qiodevice.cpp:791
unsigned short quint16
Definition: qglobal.h:936
int key
unsigned int quint32
Definition: qglobal.h:938

◆ read() [2/2]

bool QRfbKeyEvent::read ( QTcpSocket s)

Properties

◆ down

char QRfbKeyEvent::down

Definition at line 218 of file qscreenvnc_p.h.

Referenced by buttonChange(), and QVNCServer::keyEvent().

◆ keycode

int QRfbKeyEvent::keycode

Definition at line 219 of file qscreenvnc_p.h.

Referenced by buttonChange(), and QVNCServer::keyEvent().

◆ unicode

int QRfbKeyEvent::unicode

Definition at line 220 of file qscreenvnc_p.h.

Referenced by buttonChange(), and QVNCServer::keyEvent().


The documentation for this class was generated from the following files: