383 : samples(5), currSample(0), numSamples(0)
403 const qint64 dX = (
s*(
e*sX -
b*sY) + xOff) / scale;
404 const qint64 dY = (
s*(
a*sY -
d*sX) + yOff) / scale;
444 #ifndef QT_NO_TEXTSTREAM 448 t <<
a <<
' ' <<
b <<
' ' <<
c <<
' ';
449 t <<
d <<
' ' <<
e <<
' ' <<
f <<
' ' <<
s <<
endl;
453 qCritical(
"QWSCalibratedMouseHandler::writeCalibration: " 454 "Could not save calibration into %s",
qPrintable(calFile));
475 #ifndef QT_NO_TEXTSTREAM 479 t >>
a >>
b >>
c >>
d >>
e >>
f >>
s;
487 qDebug() <<
"Could not read calibration:" <<calFile;
495 if (n & 0xffff0000) {
553 qint64 scale = ((xd0 - xd2)*(yd1 - yd2) - (xd1 - xd2)*(yd0 - yd2));
557 if (absScale > (1 << 16)) {
558 shift =
ilog2(absScale >> 16) + 1;
563 a = ((x0 - x2)*(yd1 - yd2) - (x1 - x2)*(yd0 - yd2)) >> shift;
564 b = ((xd0 - xd2)*(x1 - x2) - (x0 - x2)*(xd1 - xd2)) >> shift;
565 c = (yd0*(xd2*x1 - xd1*x2) + yd1*(xd0*x2 - xd2*x0) + yd2*(xd1*x0 - xd0*x1)) >>
shift;
566 d = ((y0 - y2)*(yd1 - yd2) - (y1 - y2)*(yd0 - yd2)) >> shift;
567 e = ((xd0 - xd2)*(y1 - y2) - (y0 - y2)*(xd1 - xd2)) >> shift;
568 f = (yd0*(xd2*y1 - xd1*y2) + yd1*(xd0*y2 - xd2*y0) + yd2*(xd1*y0 - xd0*y1)) >>
shift;
593 tp.
setX((
a * position.
x() +
b * position.
y() +
c) /
s);
594 tp.
setY((
d * position.
x() +
e * position.
y() +
f) /
s);
QPoint transform(const QPoint &)
Transforms the given position from device coordinates to screen coordinates, and returns the transfor...
Q_GUI_EXPORT QScreen * qt_screen
Status status() const
Returns the status of the text stream.
static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qreal threshold)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
static void sendMouseEvent(const QPoint &pos, int state, int wheel=0)
Send a mouse event.
QPoint devPoints[5]
the raw device coordinates for each value of the Location enum.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
void readCalibration()
Reads previously written calibration parameters which are stored in /etc/pointercal (separated by whi...
int count(const T &t) const
Returns the number of occurrences of value in the vector.
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
virtual void getCalibration(QWSPointerCalibrationData *) const
Fills cd with the device coordinates corresponding to the given screen coordinates.
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
static bool ignore(const char *test, const char *const *table)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int deviceWidth() const
Returns the physical width of the framebuffer device in pixels.
virtual void calibrate(const QWSPointerCalibrationData *)
Updates the calibration parameters based on coordinate mapping of the given data. ...
The QString class provides a Unicode character string.
const QPoint & pos() const
Returns the current mouse position.
QPoint screenPoints[5]
the logical screen coordinates for each value of the Location enum.
void mouseChanged(const QPoint &pos, int bstate, int wheel=0)
Notifies the system of a new mouse event.
Q_DECL_CONSTEXPR T qAbs(const T &t)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void resize(int size)
Sets the size of the vector to size.
virtual void clearCalibration()
Clears the current calibration, i.e., makes the mouse driver return mouse events in raw device coordi...
Q_CORE_EXPORT void qDebug(const char *,...)
bool sendFiltered(const QPoint &, int button)
Notifies the system of a new mouse event after applying a noise reduction filter. ...
#define QT_BEGIN_NAMESPACE
This macro expands to.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static int ilog2(quint32 n)
static const char * data(const QByteArray &arr)
void writeCalibration()
Saves the current calibration parameters in /etc/pointercal (separated by whitespace and in alphabeti...
QWSMouseHandler(const QString &driver=QString(), const QString &device=QString())
Constructs a mouse driver.
The QWSPointerCalibrationData class is a container for mouse calibration data in Qt for Embedded Linu...
void setY(int y)
Sets the y coordinate of this point to the given y coordinate.
The QFile class provides an interface for reading from and writing to files.
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
int deviceHeight() const
Returns the full height of the framebuffer device in pixels.
The QTextStream class provides a convenient interface for reading and writing text.
QWSMouseHandlerPrivate * d_ptr
The QPoint class defines a point in the plane using integer precision.
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
int y() const
Returns the y coordinate of this point.
int x() const
Returns the x coordinate of this point.
void limitToScreen(QPoint &pt)
Ensures that the given position is within the screen's boundaries, changing the position if necessary...
#define qPrintable(string)
void setX(int x)
Sets the x coordinate of this point to the given x coordinate.
QWSCalibratedMouseHandler(const QString &driver=QString(), const QString &device=QString())
virtual ~QWSMouseHandler()
Destroys this mouse driver.
Q_CORE_EXPORT void qCritical(const char *,...)
QPoint offset() const
Returns the logical offset of the screen, i.
void setScreen(const QScreen *screen)
Sets the screen for this mouse driver to be the given screen.
void setFilterSize(int)
Sets the size of the filter used in noise reduction to the given size.
Q_CORE_EXPORT QTextStream & endl(QTextStream &s)