Qt 4.8
Public Functions | Properties | List of all members
QWSPcMouseSubHandler_ms Class Reference
Inheritance diagram for QWSPcMouseSubHandler_ms:
QWSPcMouseSubHandler_serial QWSPcMouseSubHandler

Public Functions

void init ()
 
 QWSPcMouseSubHandler_ms (int f)
 
int tryData ()
 
- Public Functions inherited from QWSPcMouseSubHandler_serial
 QWSPcMouseSubHandler_serial (int f)
 
- Public Functions inherited from QWSPcMouseSubHandler
void appendData (uchar *data, int length)
 
int buttonState () const
 
void closeIfNot (int &f)
 
int file () const
 
void initState ()
 
bool motionPending () const
 
 QWSPcMouseSubHandler (int f)
 
bool reliable () const
 
QPoint takeMotion ()
 
int takeWheel ()
 
UsageResult useData ()
 
void worse (int by=1)
 
virtual ~QWSPcMouseSubHandler ()
 

Properties

int mman
 

Additional Inherited Members

- Public Types inherited from QWSPcMouseSubHandler
enum  UsageResult { Insufficient, Motion, Button }
 
- Protected Types inherited from QWSPcMouseSubHandler
enum  { max_buf =32 }
 
- Protected Functions inherited from QWSPcMouseSubHandler_serial
void setflags (int f)
 
- Protected Variables inherited from QWSPcMouseSubHandler
int badness
 
int bstate
 
uchar buffer [max_buf]
 
int fd
 
int goodness
 
QPoint motion
 
int nbuf
 
int wheel
 

Detailed Description

Definition at line 409 of file qmousepc_qws.cpp.

Constructors and Destructors

◆ QWSPcMouseSubHandler_ms()

QWSPcMouseSubHandler_ms::QWSPcMouseSubHandler_ms ( int  f)
inline

Definition at line 412 of file qmousepc_qws.cpp.

413  {
414  mman=0;
415  init();
416  }

Functions

◆ init()

void QWSPcMouseSubHandler_ms::init ( )
inline

Definition at line 418 of file qmousepc_qws.cpp.

419  {
420  setflags(B1200|CS7);
421  // 60Hz
422  if (QT_WRITE(fd, "R", 1)!=1) {
423  badness = 100;
424  return;
425  }
426  if (tcflush(fd,TCIOFLUSH) == -1) {
427 #ifdef QWS_MOUSE_DEBUG
428  perror("QWSPcMouseSubHandler_ms: tcflush");
429 #endif
430  }
431  }
#define QT_WRITE
Definition: qcore_unix_p.h:289

◆ tryData()

int QWSPcMouseSubHandler_ms::tryData ( )
inlinevirtual

Implements QWSPcMouseSubHandler.

Definition at line 433 of file qmousepc_qws.cpp.

434  {
435  if (!(buffer[0] & 0x40)) {
436  if (buffer[0] == 0x20 && (bstate & Qt::MidButton)) {
437  mman=1; // mouseman extension
438  }
439  return 1;
440  }
441  int extra = mman&&(bstate & Qt::MidButton);
442  if (nbuf >= 3+extra) {
443  int nbstate = 0;
444  if (buffer[0] == 0x40 && !bstate && !buffer[1] && !buffer[2]) {
445  nbstate = Qt::MidButton;
446  } else {
447  nbstate = ((buffer[0] & 0x20) >> 5)
448  | ((buffer[0] & 0x10) >> 3);
449  if (extra && buffer[3] == 0x20)
450  nbstate = Qt::MidButton;
451  }
452 
453  if (buffer[1] & 0x40) {
454  badness++;
455  return 1;
456  } else {
457  motion +=
458  QPoint((signed char)((buffer[0]&0x3)<<6)
459  |(signed char)(buffer[1]&0x3f),
460  (signed char)((buffer[0]&0xc)<<4)
461  |(signed char)(buffer[2]&0x3f));
462  if (motion.x() || motion.y() || bstate != nbstate) {
463  bstate = nbstate;
464  goodness++;
465  } else {
466  badness++;
467  return 1;
468  }
469  return 3+extra;
470  }
471  }
472  return 0;
473  }
uchar buffer[max_buf]
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128

Properties

◆ mman

int QWSPcMouseSubHandler_ms::mman
private

Definition at line 410 of file qmousepc_qws.cpp.


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