Input: evdevmouse plugin cleanup

Remove unused code and variables from the evdevmouse plugin.

Change-Id: Id7881bc726b5ffb2fa452e4d4dd082fe70f7ed28
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
This commit is contained in:
Johannes Zellner 2012-05-17 13:13:57 -07:00 committed by Qt by Nokia
parent 11fa02c5cd
commit 278e9cb65d
2 changed files with 13 additions and 22 deletions

View File

@ -72,8 +72,6 @@ QEvdevMouseHandler *QEvdevMouseHandler::createLinuxInputMouseHandler(const QStri
QString device = "/dev/input/event0";
bool compression = true;
bool clamp = true;
bool smooth = false;
int jitterLimit = 0;
int xoffset = 0;
int yoffset = 0;
@ -82,8 +80,6 @@ QEvdevMouseHandler *QEvdevMouseHandler::createLinuxInputMouseHandler(const QStri
foreach (const QString &arg, args) {
if (arg == "nocompress")
compression = false;
else if (arg == "noclamp")
clamp = false;
else if (arg.startsWith("dejitter="))
jitterLimit = arg.mid(9).toInt();
else if (arg.startsWith("xoffset="))
@ -101,16 +97,16 @@ QEvdevMouseHandler *QEvdevMouseHandler::createLinuxInputMouseHandler(const QStri
int fd;
fd = qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
if (fd >= 0) {
return new QEvdevMouseHandler(fd, compression, clamp, smooth, jitterLimit, xoffset, yoffset);
return new QEvdevMouseHandler(fd, compression, jitterLimit, xoffset, yoffset);
} else {
qWarning("Cannot open mouse input device '%s': %s", qPrintable(device), strerror(errno));
return 0;
}
}
QEvdevMouseHandler::QEvdevMouseHandler(int deviceDescriptor, bool compression, bool clamp, bool smooth, int jitterLimit, int xoffset, int yoffset)
QEvdevMouseHandler::QEvdevMouseHandler(int deviceDescriptor, bool compression, int jitterLimit, int xoffset, int yoffset)
: m_notify(0), m_x(0), m_y(0), m_prevx(0), m_prevy(0),
m_fd(deviceDescriptor), m_compression(compression), m_clamp(clamp), m_smooth(smooth),
m_fd(deviceDescriptor), m_compression(compression),
m_xoffset(xoffset), m_yoffset(yoffset), m_buttons(0)
{
setObjectName(QLatin1String("Evdev Mouse Handler"));
@ -131,18 +127,16 @@ QEvdevMouseHandler::~QEvdevMouseHandler()
void QEvdevMouseHandler::sendMouseEvent()
{
if (m_clamp) {
QRect g = QGuiApplication::primaryScreen()->virtualGeometry();
if (m_x + m_xoffset < g.left())
m_x = g.left() - m_xoffset;
else if (m_x + m_xoffset > g.right())
m_x = g.right() - m_xoffset;
QRect g = QGuiApplication::primaryScreen()->virtualGeometry();
if (m_x + m_xoffset < g.left())
m_x = g.left() - m_xoffset;
else if (m_x + m_xoffset > g.right())
m_x = g.right() - m_xoffset;
if (m_y + m_yoffset < g.top())
m_y = g.top() - m_yoffset;
else if (m_y + m_yoffset > g.bottom())
m_y = g.bottom() - m_yoffset;
}
if (m_y + m_yoffset < g.top())
m_y = g.top() - m_yoffset;
else if (m_y + m_yoffset > g.bottom())
m_y = g.bottom() - m_yoffset;
QPoint pos(m_x + m_xoffset, m_y + m_yoffset);

View File

@ -62,7 +62,7 @@ private slots:
void readMouseData();
private:
QEvdevMouseHandler(int deviceDescriptor, bool compression, bool clamp, bool smooth, int jitterLimit, int xoffset, int yoffset);
QEvdevMouseHandler(int deviceDescriptor, bool compression, int jitterLimit, int xoffset, int yoffset);
void sendMouseEvent();
@ -71,11 +71,8 @@ private:
int m_prevx, m_prevy;
int m_fd;
bool m_compression;
bool m_clamp;
bool m_smooth;
int m_xoffset, m_yoffset;
Qt::MouseButtons m_buttons;
int m_smoothx, m_smoothy;
int m_jitterLimitSquared;
};