summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorPeter Yard <peter.yard@nokia.com>2009-07-24 04:20:16 (GMT)
committerPeter Yard <peter.yard@nokia.com>2009-07-24 04:20:16 (GMT)
commited159f974aa99e2ba3cc3112f7e3a1ced26b14b1 (patch)
treea0fbfb009316f8fb9b2600db7a86fadbeef966e4 /src/gui
parent3d272951dc9f055e9fc5064098f6a165a8c3e623 (diff)
parent9ec431c161202d9f06f3a7c59181cb0ab523958a (diff)
downloadQt-ed159f974aa99e2ba3cc3112f7e3a1ced26b14b1.zip
Qt-ed159f974aa99e2ba3cc3112f7e3a1ced26b14b1.tar.gz
Qt-ed159f974aa99e2ba3cc3112f7e3a1ced26b14b1.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.h1
-rw-r--r--src/gui/accessible/qaccessible_win.cpp2
-rw-r--r--src/gui/dialogs/qmessagebox.cpp6
-rw-r--r--src/gui/embedded/embedded.pri40
-rw-r--r--src/gui/embedded/qkbd_qws.cpp8
-rw-r--r--src/gui/embedded/qkbddriverfactory_qws.cpp24
-rw-r--r--src/gui/embedded/qkbdlinuxinput_qws.cpp13
-rw-r--r--src/gui/embedded/qkbdsl5000_qws.cpp367
-rw-r--r--src/gui/embedded/qkbdsl5000_qws.h92
-rw-r--r--src/gui/embedded/qkbdtty_qws.cpp20
-rw-r--r--src/gui/embedded/qkbdvr41xx_qws.cpp186
-rw-r--r--src/gui/embedded/qkbdvr41xx_qws.h73
-rw-r--r--src/gui/embedded/qkbdyopy_qws.cpp211
-rw-r--r--src/gui/embedded/qkbdyopy_qws.h73
-rw-r--r--src/gui/embedded/qmousebus_qws.cpp239
-rw-r--r--src/gui/embedded/qmousedriverfactory_qws.cpp34
-rw-r--r--src/gui/embedded/qmouselinuxinput_qws.cpp205
-rw-r--r--src/gui/embedded/qmouselinuxinput_qws.h (renamed from src/gui/embedded/qmousebus_qws.h)30
-rw-r--r--src/gui/embedded/qmousevr41xx_qws.cpp251
-rw-r--r--src/gui/embedded/qmousevr41xx_qws.h80
-rw-r--r--src/gui/embedded/qmouseyopy_qws.cpp185
-rw-r--r--src/gui/embedded/qmouseyopy_qws.h80
-rw-r--r--src/gui/embedded/qscreenproxy_qws.cpp8
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp103
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h3
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h6
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp141
-rw-r--r--src/gui/graphicsview/qgraphicsscene.h5
-rw-r--r--src/gui/graphicsview/qgraphicsscene_p.h2
-rw-r--r--src/gui/image/qimage.cpp49
-rw-r--r--src/gui/image/qpixmap.cpp70
-rw-r--r--src/gui/image/qpixmapcache.cpp14
-rw-r--r--src/gui/kernel/qapplication.cpp10
-rw-r--r--src/gui/kernel/qapplication_p.h141
-rw-r--r--src/gui/kernel/qapplication_win.cpp16
-rw-r--r--src/gui/kernel/qapplication_x11.cpp35
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm9
-rw-r--r--src/gui/kernel/qguivariant.cpp161
-rw-r--r--src/gui/kernel/qkeymapper_mac.cpp4
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac_p.h3
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp47
-rw-r--r--src/gui/math3d/qmatrix4x4.h9
-rw-r--r--src/gui/math3d/qquaternion.cpp45
-rw-r--r--src/gui/math3d/qquaternion.h9
-rw-r--r--src/gui/math3d/qvector2d.cpp42
-rw-r--r--src/gui/math3d/qvector2d.h9
-rw-r--r--src/gui/math3d/qvector3d.cpp45
-rw-r--r--src/gui/math3d/qvector3d.h9
-rw-r--r--src/gui/math3d/qvector4d.cpp47
-rw-r--r--src/gui/math3d/qvector4d.h9
-rw-r--r--src/gui/painting/qgraphicssystemfactory.cpp4
-rw-r--r--src/gui/painting/qpdf.cpp9
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp7
-rw-r--r--src/gui/styles/qcommonstyle.cpp3
-rw-r--r--src/gui/styles/qgtkstyle.cpp4
-rw-r--r--src/gui/styles/qplastiquestyle.cpp3
-rw-r--r--src/gui/text/qtextcontrol.cpp3
-rw-r--r--src/gui/widgets/qlineedit.cpp3
-rw-r--r--src/gui/widgets/qmdisubwindow.cpp2
-rw-r--r--src/gui/widgets/qmenu_mac.mm8
-rw-r--r--src/gui/widgets/qprogressbar.cpp6
61 files changed, 1055 insertions, 2268 deletions
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 19080de..8dc8159 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -210,6 +210,7 @@ public:
PageTabList = 0x0000003C,
Clock = 0x0000003D,
Splitter = 0x0000003E,
+ // Additional Qt roles where enum value does not map directly to MSAA:
LayeredPane = 0x0000003F,
UserRole = 0x0000ffff
};
diff --git a/src/gui/accessible/qaccessible_win.cpp b/src/gui/accessible/qaccessible_win.cpp
index bfacb94..85f1a8d 100644
--- a/src/gui/accessible/qaccessible_win.cpp
+++ b/src/gui/accessible/qaccessible_win.cpp
@@ -1051,6 +1051,8 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accRole(VARIANT varID, VARIANT
Role role = accessible->role(varID.lVal);
if (role != NoRole) {
+ if (role == LayeredPane)
+ role = QAccessible::Pane;
(*pvarRole).vt = VT_I4;
(*pvarRole).lVal = role;
} else {
diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp
index b7fa420..31f73b9 100644
--- a/src/gui/dialogs/qmessagebox.cpp
+++ b/src/gui/dialogs/qmessagebox.cpp
@@ -1362,8 +1362,10 @@ void QMessageBox::setVisible(bool visible)
/*!
\overload
- Opens the dialog and connects its accepted() signal to the slot specified
- by \a receiver and \a member.
+ Opens the dialog and connects its finished() or buttonClicked() signal to
+ the slot specified by \a receiver and \a member. If the slot in \a member
+ has a pointer for its first parameter the connection is to buttonClicked(),
+ otherwise the connection is to finished().
The signal will be disconnected from the slot when the dialog is closed.
*/
diff --git a/src/gui/embedded/embedded.pri b/src/gui/embedded/embedded.pri
index 4a9aa3f..53a2512 100644
--- a/src/gui/embedded/embedded.pri
+++ b/src/gui/embedded/embedded.pri
@@ -141,15 +141,7 @@ embedded {
!contains( kbd-drivers, qvfb ) {
kbd-drivers += qvfb
}
- }
-
- contains( kbd-drivers, sl5000 ) {
- HEADERS +=embedded/qkbdsl5000_qws.h
- SOURCES +=embedded/qkbdsl5000_qws.cpp
- !contains( kbd-drivers, tty ) {
- kbd-drivers += tty
- }
- }
+ }
contains( kbd-drivers, tty ) {
HEADERS +=embedded/qkbdtty_qws.h
@@ -166,16 +158,6 @@ embedded {
SOURCES +=embedded/qkbdum_qws.cpp
}
- contains( kbd-drivers, yopy ) {
- HEADERS +=embedded/qkbdyopy_qws.h
- SOURCES +=embedded/qkbdyopy_qws.cpp
- }
-
- contains( kbd-drivers, vr41xx ) {
- HEADERS +=embedded/qkbdvr41xx_qws.h
- SOURCES +=embedded/qkbdvr41xx_qws.cpp
- }
-
#
# Mouse drivers
#
@@ -189,29 +171,19 @@ embedded {
SOURCES +=embedded/qmousepc_qws.cpp
}
- contains( mouse-drivers, bus ) {
- HEADERS +=embedded/qmousebus_qws.h
- SOURCES +=embedded/qmousebus_qws.cpp
- }
-
contains( mouse-drivers, linuxtp ) {
HEADERS +=embedded/qmouselinuxtp_qws.h
SOURCES +=embedded/qmouselinuxtp_qws.cpp
}
- contains( mouse-drivers, vr41xx ) {
- HEADERS +=embedded/qmousevr41xx_qws.h
- SOURCES +=embedded/qmousevr41xx_qws.cpp
- }
-
- contains( mouse-drivers, yopy ) {
- HEADERS +=embedded/qmouseyopy_qws.h
- SOURCES +=embedded/qmouseyopy_qws.cpp
- }
-
contains( mouse-drivers, tslib ) {
LIBS += -lts
HEADERS +=embedded/qmousetslib_qws.h
SOURCES +=embedded/qmousetslib_qws.cpp
}
+
+ contains( mouse-drivers, linuxinput ) {
+ HEADERS +=embedded/qmouselinuxinput_qws.h
+ SOURCES +=embedded/qmouselinuxinput_qws.cpp
+ }
}
diff --git a/src/gui/embedded/qkbd_qws.cpp b/src/gui/embedded/qkbd_qws.cpp
index 7799339..756a398 100644
--- a/src/gui/embedded/qkbd_qws.cpp
+++ b/src/gui/embedded/qkbd_qws.cpp
@@ -453,8 +453,9 @@ void QWSKeyboardHandler::endAutoRepeat()
Maps \a keycode according to a keymap and sends that key event to the
\l{Qt for Embedded Linux} server application.
- Please see the QWS_KEYBOARD documentation for a description on how to
- create and use keymap files.
+ Please see the \l{Qt for Embedded Linux Character Input} and the \l
+ {kmap2qmap} documentations for a description on how to create and use
+ keymap files.
The key event is identified by its \a keycode value and the \a isPress
and \a autoRepeat parameters.
@@ -475,9 +476,6 @@ void QWSKeyboardHandler::endAutoRepeat()
implementation needs to take care of a special action, like console
switching or LED handling.
- Standard Linux console keymaps can be found at the
- \l {http://lct.sourceforege.net}{LCT project}
-
If standard Linux console keymaps are used, \a keycode must be one of the
standardized values defined in \c /usr/include/linux/input.h
diff --git a/src/gui/embedded/qkbddriverfactory_qws.cpp b/src/gui/embedded/qkbddriverfactory_qws.cpp
index c599396..b77eb72 100644
--- a/src/gui/embedded/qkbddriverfactory_qws.cpp
+++ b/src/gui/embedded/qkbddriverfactory_qws.cpp
@@ -47,10 +47,7 @@
#include "qkbdtty_qws.h"
#include "qkbdlinuxinput_qws.h"
#include "qkbdum_qws.h"
-#include "qkbdsl5000_qws.h"
#include "qkbdvfb_qws.h"
-#include "qkbdyopy_qws.h"
-#include "qkbdvr41xx_qws.h"
#include <stdlib.h>
#include "private/qfactoryloader_p.h"
#include "qkbddriverplugin_qws.h"
@@ -104,18 +101,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
QWSKeyboardHandler *QKbdDriverFactory::create(const QString& key, const QString& device)
{
QString driver = key.toLower();
-#ifndef QT_NO_QWS_KBD_SL5000
- if (driver == QLatin1String("sl5000") || driver.isEmpty())
- return new QWSSL5000KeyboardHandler(device);
-#endif
-#ifndef QT_NO_QWS_KBD_YOPY
- if (driver == QLatin1String("yopy") || driver.isEmpty())
- return new QWSYopyKeyboardHandler(device);
-#endif
-#ifndef QT_NO_QWS_KBD_VR41XX
- if (driver == QLatin1String("vr41xx") || driver.isEmpty())
- return new QWSVr41xxKeyboardHandler(device);
-#endif
#ifndef QT_NO_QWS_KEYBOARD
# ifndef QT_NO_QWS_KBD_TTY
if (driver == QLatin1String("tty") || driver.isEmpty())
@@ -158,15 +143,6 @@ QStringList QKbdDriverFactory::keys()
{
QStringList list;
-#ifndef QT_NO_QWS_KBD_SL5000
- list << QLatin1String("SL5000");
-#endif
-#ifndef QT_NO_QWS_KBD_YOPY
- list << QLatin1String("YOPY");
-#endif
-#ifndef QT_NO_QWS_KBD_VR41XX
- list << QLatin1String("VR41xx");
-#endif
#ifndef QT_NO_QWS_KBD_TTY
list << QLatin1String("TTY");
#endif
diff --git a/src/gui/embedded/qkbdlinuxinput_qws.cpp b/src/gui/embedded/qkbdlinuxinput_qws.cpp
index e552731..6aa6633 100644
--- a/src/gui/embedded/qkbdlinuxinput_qws.cpp
+++ b/src/gui/embedded/qkbdlinuxinput_qws.cpp
@@ -76,6 +76,7 @@ private:
int m_fd;
int m_tty_fd;
struct termios m_tty_attr;
+ int m_orig_kbmode;
};
QWSLinuxInputKeyboardHandler::QWSLinuxInputKeyboardHandler(const QString &device)
@@ -95,8 +96,7 @@ bool QWSLinuxInputKeyboardHandler::filterInputEvent(quint16 &, qint32 &)
}
QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h, const QString &device)
- : m_handler(h), m_fd(-1), m_tty_fd(-1)
-
+ : m_handler(h), m_fd(-1), m_tty_fd(-1), m_orig_kbmode(K_XLATE)
{
setObjectName(QLatin1String("LinuxInputSubsystem Keyboard Handler"));
@@ -135,7 +135,10 @@ QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h,
struct ::termios termdata;
tcgetattr(m_tty_fd, &termdata);
- // setting this tranlation mode is also needed in INPUT mode to prevent
+ // record the original mode so we can restore it again in the destructor.
+ ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode);
+
+ // setting this tranlation mode is even needed in INPUT mode to prevent
// the shell from also interpreting codes, if the process has a tty
// attached: e.g. Ctrl+C wouldn't copy, but kill the application.
::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW);
@@ -152,7 +155,7 @@ QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h,
tcsetattr(m_tty_fd, TCSANOW, &termdata);
}
} else {
- qWarning("Cannot open input device '%s': %s", qPrintable(dev), strerror(errno));
+ qWarning("Cannot open keyboard input device '%s': %s", qPrintable(dev), strerror(errno));
return;
}
}
@@ -160,7 +163,7 @@ QWSLinuxInputKbPrivate::QWSLinuxInputKbPrivate(QWSLinuxInputKeyboardHandler *h,
QWSLinuxInputKbPrivate::~QWSLinuxInputKbPrivate()
{
if (m_tty_fd >= 0) {
- ::ioctl(m_tty_fd, KDSKBMODE, K_XLATE);
+ ::ioctl(m_tty_fd, KDSKBMODE, m_orig_kbmode);
tcsetattr(m_tty_fd, TCSANOW, &m_tty_attr);
}
if (m_fd >= 0)
diff --git a/src/gui/embedded/qkbdsl5000_qws.cpp b/src/gui/embedded/qkbdsl5000_qws.cpp
deleted file mode 100644
index cf82c10..0000000
--- a/src/gui/embedded/qkbdsl5000_qws.cpp
+++ /dev/null
@@ -1,367 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkbdsl5000_qws.h"
-
-#ifndef QT_NO_QWS_KBD_SL5000
-
-#include "qwindowsystem_qws.h"
-#include "qwsutils_qws.h"
-#include "qscreen_qws.h"
-
-#include "qapplication.h"
-#include "qnamespace.h"
-#include "qtimer.h"
-
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <signal.h>
-
-#include <asm/sharp_char.h>
-
-#include <string.h>
-
-QT_BEGIN_NAMESPACE
-
-static const QWSKeyMap sl5000KeyMap[] = {
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 00
- { Qt::Key_A, 'a' , 'A' , 'A'-64 }, // 01
- { Qt::Key_B, 'b' , 'B' , 'B'-64 }, // 02
- { Qt::Key_C, 'c' , 'C' , 'C'-64 }, // 03
- { Qt::Key_D, 'd' , 'D' , 'D'-64 }, // 04
- { Qt::Key_E, 'e' , 'E' , 'E'-64 }, // 05
- { Qt::Key_F, 'f' , 'F' , 'F'-64 }, // 06
- { Qt::Key_G, 'g' , 'G' , 'G'-64 }, // 07
- { Qt::Key_H, 'h' , 'H' , 'H'-64 }, // 08
- { Qt::Key_I, 'i' , 'I' , 'I'-64 }, // 09
- { Qt::Key_J, 'j' , 'J' , 'J'-64 }, // 0a 10
- { Qt::Key_K, 'k' , 'K' , 'K'-64 }, // 0b
- { Qt::Key_L, 'l' , 'L' , 'L'-64 }, // 0c
- { Qt::Key_M, 'm' , 'M' , 'M'-64 }, // 0d
- { Qt::Key_N, 'n' , 'N' , 'N'-64 }, // 0e
- { Qt::Key_O, 'o' , 'O' , 'O'-64 }, // 0f
- { Qt::Key_P, 'p' , 'P' , 'P'-64 }, // 10
- { Qt::Key_Q, 'q' , 'Q' , 'Q'-64 }, // 11
- { Qt::Key_R, 'r' , 'R' , 'R'-64 }, // 12
- { Qt::Key_S, 's' , 'S' , 'S'-64 }, // 13
- { Qt::Key_T, 't' , 'T' , 'T'-64 }, // 14 20
- { Qt::Key_U, 'u' , 'U' , 'U'-64 }, // 15
- { Qt::Key_V, 'v' , 'V' , 'V'-64 }, // 16
- { Qt::Key_W, 'w' , 'W' , 'W'-64 }, // 17
- { Qt::Key_X, 'x' , 'X' , 'X'-64 }, // 18
- { Qt::Key_Y, 'y' , 'Y' , 'Y'-64 }, // 19
- { Qt::Key_Z, 'z' , 'Z' , 'Z'-64 }, // 1a
- { Qt::Key_Shift, 0xffff , 0xffff , 0xffff }, // 1b
- { Qt::Key_Return, 13 , 13 , 0xffff }, // 1c
- { Qt::Key_F11, 0xffff , 0xffff , 0xffff }, // 1d todo
- { Qt::Key_F22, 0xffff , 0xffff , 0xffff }, // 1e 30
- { Qt::Key_Backspace, 8 , 8 , 0xffff }, // 1f
- { Qt::Key_F31, 0xffff , 0xffff , 0xffff }, // 20
- { Qt::Key_F35, 0xffff , 0xffff , 0xffff }, // 21 light
- { Qt::Key_Escape, 0xffff , 0xffff , 0xffff }, // 22
-
- // Direction key code are for *UNROTATED* display.
- { Qt::Key_Up, 0xffff , 0xffff , 0xffff }, // 23
- { Qt::Key_Right, 0xffff , 0xffff , 0xffff }, // 24
- { Qt::Key_Left, 0xffff , 0xffff , 0xffff }, // 25
- { Qt::Key_Down, 0xffff , 0xffff , 0xffff }, // 26
-
- { Qt::Key_F33, 0xffff , 0xffff , 0xffff }, // 27 OK
- { Qt::Key_F12, 0xffff , 0xffff , 0xffff }, // 28 40 home
- { Qt::Key_1, '1' , 'q' , 'Q'-64 }, // 29
- { Qt::Key_2, '2' , 'w' , 'W'-64 }, // 2a
- { Qt::Key_3, '3' , 'e' , 'E'-64 }, // 2b
- { Qt::Key_4, '4' , 'r' , 'R'-64 }, // 2c
- { Qt::Key_5, '5' , 't' , 'T'-64 }, // 2d
- { Qt::Key_6, '6' , 'y' , 'Y'-64 }, // 2e
- { Qt::Key_7, '7' , 'u' , 'U'-64 }, // 2f
- { Qt::Key_8, '8' , 'i' , 'I'-64 }, // 30
- { Qt::Key_9, '9' , 'o' , 'O'-64 }, // 31
- { Qt::Key_0, '0' , 'p' , 'P'-64 }, // 32 50
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 33
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 34
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 35
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 36
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 37
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 38
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 39
- { Qt::Key_Minus, '-' , 'b' , 'B'-64 }, // 3a
- { Qt::Key_Plus, '+' , 'n' , 'N'-64 }, // 3b
- { Qt::Key_CapsLock, 0xffff , 0xffff , 0xffff }, // 3c 60
- { Qt::Key_At, '@' , 's' , 'S'-64 }, // 3d
- { Qt::Key_Question, '?' , '?' , 0xffff }, // 3e
- { Qt::Key_Comma, ',' , ',' , 0xffff }, // 3f
- { Qt::Key_Period, '.' , '.' , 0xffff }, // 40
- { Qt::Key_Tab, 9 , '\\' , 0xffff }, // 41
- { Qt::Key_X, 0xffff , 'x' , 'X'-64 }, // 42
- { Qt::Key_C, 0xffff , 'c' , 'C'-64 }, // 43
- { Qt::Key_V, 0xffff , 'v' , 'V'-64 }, // 44
- { Qt::Key_Slash, '/' , '/' , 0xffff }, // 45
- { Qt::Key_Apostrophe, '\'' , '\'' , 0xffff }, // 46 70
- { Qt::Key_Semicolon, ';' , ';' , 0xffff }, // 47
- { Qt::Key_QuoteDbl, '\"' , '\"' , 0xffff }, // 48
- { Qt::Key_Colon, ':' , ':' , 0xffff }, // 49
- { Qt::Key_NumberSign, '#' , 'd' , 'D'-64 }, // 4a
- { Qt::Key_Dollar, '$' , 'f' , 'F'-64 }, // 4b
- { Qt::Key_Percent, '%' , 'g' , 'G'-64 }, // 4c
- { Qt::Key_Underscore, '_' , 'h' , 'H'-64 }, // 4d
- { Qt::Key_Ampersand, '&' , 'j' , 'J'-64 }, // 4e
- { Qt::Key_Asterisk, '*' , 'k' , 'K'-64 }, // 4f
- { Qt::Key_ParenLeft, '(' , 'l' , 'L'-64 }, // 50 80
- { Qt::Key_Delete, '[' , '[' , '[' }, // 51
- { Qt::Key_Z, 0xffff , 'z' , 'Z'-64 }, // 52
- { Qt::Key_Equal, '=' , 'm' , 'M'-64 }, // 53
- { Qt::Key_ParenRight, ')' , ']' , ']' }, // 54
- { Qt::Key_AsciiTilde, '~' , '^' , '^' }, // 55
- { Qt::Key_Less, '<' , '{' , '{' }, // 56
- { Qt::Key_Greater, '>' , '}' , '}' }, // 57
- { Qt::Key_F9, 0xffff , 0xffff , 0xffff }, // 58 datebook
- { Qt::Key_F10, 0xffff , 0xffff , 0xffff }, // 59 address
- { Qt::Key_F13, 0xffff , 0xffff , 0xffff }, // 5a 90 email
- { Qt::Key_F30, ' ' , ' ' , 0xffff }, // 5b select
- { Qt::Key_Space, ' ' , '|' , '`' }, // 5c
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 5d
- { Qt::Key_Exclam, '!' , 'a' , 'A'-64 }, // 5e
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 5f
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 60
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 61
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 62
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 63
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 64
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 65
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 66
- { Qt::Key_Meta, 0xffff , 0xffff , 0xffff }, // 67
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 68
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 69
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 6a
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 6b
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 6c
- { Qt::Key_F34, 0xffff , 0xffff , 0xffff }, // 6d power
- { Qt::Key_F13, 0xffff , 0xffff , 0xffff }, // 6e mail long
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 6f
- { Qt::Key_NumLock, 0xffff , 0xffff , 0xffff }, // 70
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 71
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 72
- { 0x20ac, 0xffff , 0x20ac , 0x20ac }, // 73 Euro sign
- { Qt::Key_unknown, 0xffff , 0xffff , 0xffff }, // 74
- { Qt::Key_F32, 0xffff , 0xffff , 0xffff }, // 75 Sync
- { 0, 0xffff , 0xffff , 0xffff }
-};
-
-static const int keyMSize = sizeof(sl5000KeyMap)/sizeof(QWSKeyMap)-1;
-
-QWSSL5000KeyboardHandler::QWSSL5000KeyboardHandler(const QString &device)
- : QWSTtyKeyboardHandler(device)
-{
- shift = false;
- alt = false;
- ctrl = false;
- extended = 0;
- prevuni = 0;
- prevkey = 0;
- caps = false;
- meta = false;
- fn = false;
- numLock = false;
-
- sharp_kbdctl_modifstat st;
- int dev = QT_OPEN(device.isEmpty()?"/dev/sharp_kbdctl":device.toLocal8Bit().constData(), O_RDWR);
- if (dev >= 0) {
- memset(&st, 0, sizeof(st));
- st.which = 3;
- int ret = ioctl(dev, SHARP_KBDCTL_GETMODIFSTAT, (char*)&st);
- if(!ret)
- numLock = (bool)st.stat;
- QT_CLOSE(dev);
- }
-}
-
-QWSSL5000KeyboardHandler::~QWSSL5000KeyboardHandler()
-{
-}
-
-const QWSKeyMap *QWSSL5000KeyboardHandler::keyMap() const
-{
- return sl5000KeyMap;
-}
-
-bool QWSSL5000KeyboardHandler::filterKeycode(char &code)
-{
- int keyCode = Qt::Key_unknown;
- bool release = false;
-
- if (code & 0x80) {
- release = true;
- code &= 0x7f;
- }
-
- if (fn && !meta && (code >= 0x42 && code <= 0x52)) {
- ushort unicode=0;
- int scan=0;
- if (code == 0x42) { unicode='X'-'@'; scan=Qt::Key_X; } // Cut
- else if (code == 0x43) { unicode='C'-'@'; scan=Qt::Key_C; } // Copy
- else if (code == 0x44) { unicode='V'-'@'; scan=Qt::Key_V; } // Paste
- else if (code == 0x52) { unicode='Z'-'@'; scan=Qt::Key_Z; } // Undo
- if (scan) {
- processKeyEvent(unicode, scan, Qt::ControlModifier, !release, false);
- return true;
- }
- }
-
- if (code < keyMSize) {
- keyCode = keyMap()[int(code)].key_code;
- }
-
- bool repeatable = true;
-
- if (release && (keyCode == Qt::Key_F34 || keyCode == Qt::Key_F35))
- return true; // no release for power and light keys
- if ((keyCode >= Qt::Key_F1 && keyCode <= Qt::Key_F35)
- || keyCode == Qt::Key_Escape || keyCode == Qt::Key_Home
- || keyCode == Qt::Key_Shift || keyCode == Qt::Key_Meta)
- repeatable = false;
-
- if (qt_screen->isTransformed()
- && keyCode >= Qt::Key_Left && keyCode <= Qt::Key_Down)
- {
- keyCode = transformDirKey(keyCode);
- }
-
- // Ctrl-Alt-Delete exits qws
- if (ctrl && alt && keyCode == Qt::Key_Delete) {
- qApp->quit();
- }
-
- if (keyCode == Qt::Key_F22) { /* Fn key */
- fn = !release;
- } else if (keyCode == Qt::Key_NumLock) {
- if (release)
- numLock = !numLock;
- } else if (keyCode == Qt::AltModifier) {
- alt = !release;
- } else if (keyCode == Qt::ControlModifier) {
- ctrl = !release;
- } else if (keyCode == Qt::ShiftModifier) {
- shift = !release;
- } else if (keyCode == Qt::MetaModifier) {
- meta = !release;
- } else if (keyCode == Qt::Key_CapsLock && release) {
- caps = !caps;
- }
- if (keyCode != Qt::Key_unknown) {
- bool bAlt = alt;
- bool bCtrl = ctrl;
- bool bShift = shift;
- int unicode = 0;
- if (code < keyMSize) {
- bool bCaps = caps ^ shift;
- if (fn) {
- if (shift) {
- bCaps = bShift = false;
- bCtrl = true;
- }
- if (meta) {
- bCaps = bShift = true;
- bAlt = true;
- }
- } else if (meta) {
- bCaps = bShift = true;
- }
- if (code > 40 && caps) {
- // fn-keys should only react to shift, not caps
- bCaps = bShift = shift;
- }
- if (numLock) {
- if (keyCode != Qt::Key_Space && keyCode != Qt::Key_Tab)
- bCaps = bShift = false;
- }
- if (keyCode == Qt::Key_Delete && (bAlt || bCtrl)) {
- keyCode = Qt::Key_BraceLeft;
- unicode = '[';
- bCaps = bShift = bAlt = bCtrl = false;
- } else if (keyCode == Qt::Key_F31 && bCtrl) {
- keyCode = Qt::Key_QuoteLeft;
- unicode = '`';
- } else if (bCtrl)
- unicode = keyMap()[int(code)].ctrl_unicode ? keyMap()[int(code)].ctrl_unicode : 0xffff;
- else if (bCaps)
- unicode = keyMap()[int(code)].shift_unicode ? keyMap()[int(code)].shift_unicode : 0xffff;
- else
- unicode = keyMap()[int(code)].unicode ? keyMap()[int(code)].unicode : 0xffff;
- }
-
- modifiers = 0;
- if (bAlt) modifiers |= Qt::AltModifier;
- if (bCtrl) modifiers |= Qt::ControlModifier;
- if (bShift) modifiers |= Qt::ShiftModifier;
-
- // looks wrong -- WWA
- bool repeat = false;
- if (prevuni == unicode && prevkey == keyCode && !release)
- repeat = true;
-
- processKeyEvent(unicode, keyCode, modifiers, !release, repeat);
-
- if (!release) {
- prevuni = unicode;
- prevkey = keyCode;
- } else {
- prevkey = prevuni = 0;
- }
- }
-
- if (repeatable && !release)
- beginAutoRepeat(prevuni, prevkey, modifiers);
- else
- endAutoRepeat();
-
- return true;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_QWS_KBD_SL5000
diff --git a/src/gui/embedded/qkbdsl5000_qws.h b/src/gui/embedded/qkbdsl5000_qws.h
deleted file mode 100644
index 42afbe1..0000000
--- a/src/gui/embedded/qkbdsl5000_qws.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBDSL5000_QWS_H
-#define QKBDSL5000_QWS_H
-
-#include <QtGui/qkbdtty_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_KBD_SL5000
-
-struct QWSKeyMap {
- uint key_code;
- ushort unicode;
- ushort shift_unicode;
- ushort ctrl_unicode;
-};
-
-
-class QWSSL5000KeyboardHandler : public QWSTtyKeyboardHandler
-{
-public:
- explicit QWSSL5000KeyboardHandler(const QString&);
- virtual ~QWSSL5000KeyboardHandler();
-
- bool filterKeycode(char &keycode);
- virtual const QWSKeyMap *keyMap() const;
-
-private:
- bool shift;
- bool alt;
- bool ctrl;
- bool caps;
- uint extended:2;
- Qt::KeyboardModifiers modifiers;
- int prevuni;
- int prevkey;
- bool meta;
- bool fn;
- bool numLock;
-};
-
-#endif // QT_NO_QWS_KBD_SL5000
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBDSL5000_QWS_H
diff --git a/src/gui/embedded/qkbdtty_qws.cpp b/src/gui/embedded/qkbdtty_qws.cpp
index 8c1e79b..f107567 100644
--- a/src/gui/embedded/qkbdtty_qws.cpp
+++ b/src/gui/embedded/qkbdtty_qws.cpp
@@ -90,7 +90,7 @@ private:
struct termios m_tty_attr;
char m_last_keycode;
int m_vt_qws;
- int m_originalKbdMode;
+ int m_orig_kbmode;
};
@@ -111,7 +111,7 @@ bool QWSTtyKeyboardHandler::filterKeycode(char &)
}
QWSTtyKbPrivate::QWSTtyKbPrivate(QWSTtyKeyboardHandler *h, const QString &device)
- : m_handler(h), m_tty_fd(-1), m_last_keycode(0), m_vt_qws(0)
+ : m_handler(h), m_tty_fd(-1), m_last_keycode(0), m_vt_qws(0), m_orig_kbmode(K_XLATE)
{
setObjectName(QLatin1String("TTY Keyboard Handler"));
#ifndef QT_NO_QWS_SIGNALHANDLER
@@ -152,15 +152,15 @@ QWSTtyKbPrivate::QWSTtyKbPrivate(QWSTtyKeyboardHandler *h, const QString &device
tcgetattr(m_tty_fd, &termdata);
#if defined(Q_OS_LINUX)
- // record the original mode so we can restore it again in the constructor
- ::ioctl(m_tty_fd, KDGKBMODE, m_originalKbdMode);
+ // record the original mode so we can restore it again in the destructor.
+ ::ioctl(m_tty_fd, KDGKBMODE, &m_orig_kbmode);
// PLEASE NOTE:
- // The tty keycode interface can only report keycodes 0x01 .. 0x7f
+ // the tty keycode interface can only report keycodes 0x01 .. 0x7f
// KEY_MAX is however defined to 0x1ff. In practice this is sufficient
// for a PC style keyboard though.
- // we don't support K_RAW anymore - if you need, you habe to add a
- // scan- to keycode converter.
+ // we don't support K_RAW anymore - if you need that, you have to add
+ // a scan- to keycode converter yourself.
::ioctl(m_tty_fd, KDSKBMODE, K_MEDIUMRAW);
#endif
@@ -211,12 +211,10 @@ QWSTtyKbPrivate::~QWSTtyKbPrivate()
{
if (m_tty_fd >= 0) {
#if defined(Q_OS_LINUX)
- ::ioctl(m_tty_fd, KDSKBMODE, m_originalKbdMode);
+ ::ioctl(m_tty_fd, KDSKBMODE, m_orig_kbmode);
#endif
tcsetattr(m_tty_fd, TCSANOW, &m_tty_attr);
-
- // we're leaking m_tty_fd here?
- //QT_CLOSE(m_tty_fd);
+ QT_CLOSE(m_tty_fd);
}
}
diff --git a/src/gui/embedded/qkbdvr41xx_qws.cpp b/src/gui/embedded/qkbdvr41xx_qws.cpp
deleted file mode 100644
index 6d8299b..0000000
--- a/src/gui/embedded/qkbdvr41xx_qws.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkbdvr41xx_qws.h"
-
-#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_VR41XX)
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <termios.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <qsocketnotifier.h>
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-QT_BEGIN_NAMESPACE
-
-class QWSVr41xxKbPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSVr41xxKbPrivate(QWSVr41xxKeyboardHandler *h, const QString&);
- virtual ~QWSVr41xxKbPrivate();
-
- bool isOpen() { return buttonFD > 0; }
-
-private slots:
- void readKeyboardData();
-
-private:
- QString terminalName;
- int buttonFD;
- int kbdIdx;
- int kbdBufferLen;
- unsigned char *kbdBuffer;
- QSocketNotifier *notifier;
- QWSVr41xxKeyboardHandler *handler;
-};
-
-QWSVr41xxKeyboardHandler::QWSVr41xxKeyboardHandler(const QString &device)
-{
- d = new QWSVr41xxKbPrivate(this, device);
-}
-
-QWSVr41xxKeyboardHandler::~QWSVr41xxKeyboardHandler()
-{
- delete d;
-}
-
-QWSVr41xxKbPrivate::QWSVr41xxKbPrivate(QWSVr41xxKeyboardHandler *h, const QString &device) : handler(h)
-{
- terminalName = device;
- if (terminalName.isEmpty())
- terminalName = QLatin1String("/dev/buttons");
- buttonFD = -1;
- notifier = 0;
-
- buttonFD = QT_OPEN(terminalName.toLatin1().constData(), O_RDWR | O_NDELAY, 0);;
- if (buttonFD < 0) {
- qWarning("Cannot open %s\n", qPrintable(terminalName));
- return;
- }
-
- if (buttonFD >= 0) {
- notifier = new QSocketNotifier(buttonFD, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)),this,
- SLOT(readKeyboardData()));
- }
-
- kbdBufferLen = 80;
- kbdBuffer = new unsigned char [kbdBufferLen];
- kbdIdx = 0;
-}
-
-QWSVr41xxKbPrivate::~QWSVr41xxKbPrivate()
-{
- if (buttonFD > 0) {
- QT_CLOSE(buttonFD);
- buttonFD = -1;
- }
- delete notifier;
- notifier = 0;
- delete [] kbdBuffer;
-}
-
-void QWSVr41xxKbPrivate::readKeyboardData()
-{
- int n = 0;
- do {
- n = QT_READ(buttonFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx);
- if (n > 0)
- kbdIdx += n;
- } while (n > 0);
-
- int idx = 0;
- while (kbdIdx - idx >= 2) {
- unsigned char *next = kbdBuffer + idx;
- unsigned short *code = (unsigned short *)next;
- int keycode = Qt::Key_unknown;
- switch ((*code) & 0x0fff) {
- case 0x7:
- keycode = Qt::Key_Up;
- break;
- case 0x9:
- keycode = Qt::Key_Right;
- break;
- case 0x8:
- keycode = Qt::Key_Down;
- break;
- case 0xa:
- keycode = Qt::Key_Left;
- break;
- case 0x3:
- keycode = Qt::Key_Up;
- break;
- case 0x4:
- keycode = Qt::Key_Down;
- break;
- case 0x1:
- keycode = Qt::Key_Return;
- break;
- case 0x2:
- keycode = Qt::Key_F4;
- break;
- default:
- qDebug("Unrecognised key sequence %d", *code);
- }
- if ((*code) & 0x8000)
- handler->processKeyEvent(0, keycode, 0, false, false);
- else
- handler->processKeyEvent(0, keycode, 0, true, false);
- idx += 2;
- }
-
- int surplus = kbdIdx - idx;
- for (int i = 0; i < surplus; i++)
- kbdBuffer[i] = kbdBuffer[idx+i];
- kbdIdx = surplus;
-}
-
-QT_END_NAMESPACE
-
-#include "qkbdvr41xx_qws.moc"
-
-#endif // QT_NO_QWS_KBD_VR41XX
diff --git a/src/gui/embedded/qkbdvr41xx_qws.h b/src/gui/embedded/qkbdvr41xx_qws.h
deleted file mode 100644
index 1a657b9..0000000
--- a/src/gui/embedded/qkbdvr41xx_qws.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBDVR41XX_QWS_H
-#define QKBDVR41XX_QWS_H
-
-#include <QtGui/qkbd_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#if !defined(QT_NO_QWS_KEYBOARD) && !defined(QT_NO_QWS_KBD_VR41XX)
-
-class QWSVr41xxKbPrivate;
-
-class QWSVr41xxKeyboardHandler : public QWSKeyboardHandler
-{
-public:
- explicit QWSVr41xxKeyboardHandler(const QString&);
- virtual ~QWSVr41xxKeyboardHandler();
-
-private:
- QWSVr41xxKbPrivate *d;
-};
-
-#endif // QT_NO_QWS_KBD_VR41XX
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBDVR41XX_QWS_H
diff --git a/src/gui/embedded/qkbdyopy_qws.cpp b/src/gui/embedded/qkbdyopy_qws.cpp
deleted file mode 100644
index edb732c..0000000
--- a/src/gui/embedded/qkbdyopy_qws.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- * YOPY buttons driver
- * Contributed by Ron Victorelli (victorrj at icubed.com)
- */
-
-#include "qkbdyopy_qws.h"
-
-#ifndef QT_NO_QWS_KBD_YOPY
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <termios.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <linux/kd.h>
-#include <linux/fb.h>
-#include <linux/yopy_button.h>
-
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-extern "C" {
- int getpgid(int);
-}
-
-#include <qwidget.h>
-#include <qsocketnotifier.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWSYopyKbPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSYopyKbPrivate(QWSYopyKeyboardHandler *h, const QString&);
- virtual ~QWSYopyKbPrivate();
-
- bool isOpen() { return buttonFD > 0; }
-
-private slots:
- void readKeyboardData();
-
-private:
- QString terminalName;
- int buttonFD;
- struct termios newT, oldT;
- QSocketNotifier *notifier;
- QWSYopyKeyboardHandler *handler;
-};
-
-QWSYopyKeyboardHandler::QWSYopyKeyboardHandler(const QString &device)
-{
- d = new QWSYopyKbPrivate(this, device);
-}
-
-QWSYopyKeyboardHandler::~QWSYopyKeyboardHandler()
-{
- delete d;
-}
-
-QWSYopyKbPrivate::QWSYopyKbPrivate(QWSYopyKeyboardHandler *h, const QString &device) : handler(h)
-{
- terminalName = device.isEmpty()?"/dev/tty1":device.toLatin1().constData();
- buttonFD = -1;
- notifier = 0;
-
- buttonFD = QT_OPEN(terminalName.toLatin1().constData(), O_RDWR | O_NDELAY, 0);
- if (buttonFD < 0) {
- qWarning("Cannot open %s\n", qPrintable(terminalName));
- return;
- } else {
-
- tcsetpgrp(buttonFD, getpgid(0));
-
- /* put tty into "straight through" mode.
- */
- if (tcgetattr(buttonFD, &oldT) < 0) {
- qFatal("Linux-kbd: tcgetattr failed");
- }
-
- newT = oldT;
- newT.c_lflag &= ~(ICANON | ECHO | ISIG);
- newT.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | IXOFF | IXON);
- newT.c_iflag |= IGNBRK;
- newT.c_cc[VMIN] = 0;
- newT.c_cc[VTIME] = 0;
-
-
- if (tcsetattr(buttonFD, TCSANOW, &newT) < 0) {
- qFatal("Linux-kbd: TCSANOW tcsetattr failed");
- }
-
- if (ioctl(buttonFD, KDSKBMODE, K_MEDIUMRAW) < 0) {
- qFatal("Linux-kbd: KDSKBMODE tcsetattr failed");
- }
-
- notifier = new QSocketNotifier(buttonFD, QSocketNotifier::Read, this);
- connect(notifier, SIGNAL(activated(int)),this,
- SLOT(readKeyboardData()));
- }
-}
-
-QWSYopyKbPrivate::~QWSYopyKbPrivate()
-{
- if (buttonFD > 0) {
- ::close(buttonFD);
- buttonFD = -1;
- }
-}
-
-void QWSYopyKbPrivate::readKeyboardData()
-{
- uchar buf[1];
- char c='1';
- int fd;
-
- int n=read(buttonFD,buf,1);
- if (n<0) {
- qDebug("Keyboard read error %s",strerror(errno));
- } else {
- uint code = buf[0]&YPBUTTON_CODE_MASK;
- bool press = !(buf[0]&0x80);
- // printf("Key=%d/%d/%d\n",buf[1],code,press);
- int k=(-1);
- switch(code) {
- case 39: k=Qt::Key_Up; break;
- case 44: k=Qt::Key_Down; break;
- case 41: k=Qt::Key_Left; break;
- case 42: k=Qt::Key_Right; break;
- case 56: k=Qt::Key_F1; break; //windows
- case 29: k=Qt::Key_F2; break; //cycle
- case 24: k=Qt::Key_F3; break; //record
- case 23: k=Qt::Key_F4; break; //mp3
- case 4: k=Qt::Key_F5; break; // PIMS
- case 1: k=Qt::Key_Escape; break; // Escape
- case 40: k=Qt::Key_Up; break; // prev
- case 45: k=Qt::Key_Down; break; // next
- case 35: if(!press) {
- fd = QT_OPEN("/proc/sys/pm/sleep",O_RDWR,0);
- if(fd >= 0) {
- QT_WRITE(fd,&c,sizeof(c));
- QT_CLOSE(fd);
- //
- // Updates all widgets.
- //
- QWidgetList list = QApplication::allWidgets();
- for (int i = 0; i < list.size(); ++i) {
- QWidget *w = list.at(i);
- w->update();
- }
- }
- }
- break;
-
- default: k=(-1); break;
- }
-
- if (k >= 0) {
- handler->processKeyEvent(0, k, 0, press, false);
- }
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qkbdyopy_qws.moc"
-
-#endif // QT_NO_QWS_KBD_YOPY
diff --git a/src/gui/embedded/qkbdyopy_qws.h b/src/gui/embedded/qkbdyopy_qws.h
deleted file mode 100644
index b4e45bd..0000000
--- a/src/gui/embedded/qkbdyopy_qws.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKBDYOPY_QWS_H
-#define QKBDYOPY_QWS_H
-
-#include <QtGui/qkbd_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_KBD_YOPY
-
-class QWSYopyKbPrivate;
-
-class QWSYopyKeyboardHandler : public QWSKeyboardHandler
-{
-public:
- explicit QWSYopyKeyboardHandler(const QString&);
- virtual ~QWSYopyKeyboardHandler();
-
-private:
- QWSYopyKbPrivate *d;
-};
-
-#endif // QT_NO_QWS_KBD_YOPY
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QKBDYOPY_QWS_H
diff --git a/src/gui/embedded/qmousebus_qws.cpp b/src/gui/embedded/qmousebus_qws.cpp
deleted file mode 100644
index 0b674b6..0000000
--- a/src/gui/embedded/qmousebus_qws.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmousebus_qws.h"
-
-#ifndef QT_NO_QWS_MOUSE_BUS
-
-#include "qwindowsystem_qws.h"
-#include "qsocketnotifier.h"
-
-#include "qapplication.h"
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-
-QT_BEGIN_NAMESPACE
-
-/*
- * bus mouse driver (a.k.a. Logitech busmouse)
- */
-
-class QWSBusMouseHandlerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSBusMouseHandlerPrivate(QWSBusMouseHandler *h, const QString &driver, const QString &device);
- ~QWSBusMouseHandlerPrivate();
-
- void suspend();
- void resume();
-
-private slots:
- void readMouseData();
-
-protected:
- enum { mouseBufSize = 128 };
- QWSBusMouseHandler *handler;
- QSocketNotifier *mouseNotifier;
- int mouseFD;
- int mouseIdx;
- int obstate;
- uchar mouseBuf[mouseBufSize];
-};
-
-QWSBusMouseHandler::QWSBusMouseHandler(const QString &driver, const QString &device)
- : QWSMouseHandler(driver, device)
-{
- d = new QWSBusMouseHandlerPrivate(this, driver, device);
-}
-
-QWSBusMouseHandler::~QWSBusMouseHandler()
-{
- delete d;
-}
-
-void QWSBusMouseHandler::suspend()
-{
- d->suspend();
-}
-
-void QWSBusMouseHandler::resume()
-{
- d->resume();
-}
-
-
-QWSBusMouseHandlerPrivate::QWSBusMouseHandlerPrivate(QWSBusMouseHandler *h,
- const QString &, const QString &device)
- : handler(h)
-
-{
- QString mouseDev = device;
- if (mouseDev.isEmpty())
- mouseDev = QLatin1String("/dev/mouse");
- obstate = -1;
- mouseFD = -1;
- mouseFD = QT_OPEN(mouseDev.toLocal8Bit(), O_RDWR | O_NDELAY);
- if (mouseFD < 0)
- mouseFD = QT_OPEN(mouseDev.toLocal8Bit(), O_RDONLY | O_NDELAY);
- if (mouseFD < 0)
- qDebug("Cannot open %s (%s)", qPrintable(mouseDev), strerror(errno));
-
- // Clear pending input
- tcflush(mouseFD,TCIFLUSH);
- usleep(50000);
-
- char buf[100]; // busmouse driver will not read if bufsize < 3, YYD
- while (QT_READ(mouseFD, buf, 100) > 0) { } // eat unwanted replies
-
- mouseIdx = 0;
-
- mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
-}
-
-QWSBusMouseHandlerPrivate::~QWSBusMouseHandlerPrivate()
-{
- if (mouseFD >= 0) {
- tcflush(mouseFD,TCIFLUSH); // yyd.
- QT_CLOSE(mouseFD);
- }
-}
-
-
-void QWSBusMouseHandlerPrivate::suspend()
-{
- mouseNotifier->setEnabled(false);
-}
-
-
-void QWSBusMouseHandlerPrivate::resume()
-{
- mouseIdx = 0;
- obstate = -1;
- mouseNotifier->setEnabled(true);
-}
-
-void QWSBusMouseHandlerPrivate::readMouseData()
-{
- int n;
- // It'll only read 3 bytes a time and return all other buffer zeroed, thus cause protocol errors
- for (;;) {
- if (mouseBufSize - mouseIdx < 3)
- break;
- n = QT_READ(mouseFD, mouseBuf+mouseIdx, 3);
- if (n != 3)
- break;
- mouseIdx += 3;
- }
-
- static const int accel_limit = 5;
- static const int accel = 2;
-
- int idx = 0;
- int bstate = 0;
- int dx = 0, dy = 0;
- bool sendEvent = false;
- int tdx = 0, tdy = 0;
-
- while (mouseIdx-idx >= 3) {
-#if 0 // debug
- qDebug("Got mouse data");
-#endif
- uchar *mb = mouseBuf+idx;
- bstate = 0;
- dx = 0;
- dy = 0;
- sendEvent = false;
- if (((mb[0] & 0x04)))
- bstate |= Qt::LeftButton;
- if (((mb[0] & 0x01)))
- bstate |= Qt::RightButton;
-
- dx=(signed char)mb[1];
- dy=(signed char)mb[2];
- sendEvent=true;
-
- if (sendEvent) {
- if (qAbs(dx) > accel_limit || qAbs(dy) > accel_limit) {
- dx *= accel;
- dy *= accel;
- }
- tdx += dx;
- tdy += dy;
- if (bstate != obstate) {
- QPoint pos = handler->pos() + QPoint(tdx,-tdy);
- handler->limitToScreen(pos);
- handler->mouseChanged(pos,bstate);
- sendEvent = false;
- tdx = 0;
- tdy = 0;
- obstate = bstate;
- }
- }
- idx += 3;
- }
- if (sendEvent) {
- QPoint pos = handler->pos() + QPoint(tdx,-tdy);
- handler->limitToScreen(pos);
- handler->mouseChanged(pos,bstate);
- }
-
- int surplus = mouseIdx - idx;
- for (int i = 0; i < surplus; i++)
- mouseBuf[i] = mouseBuf[idx+i];
- mouseIdx = surplus;
-}
-
-QT_END_NAMESPACE
-
-#include "qmousebus_qws.moc"
-
-#endif // QT_NO_QWS_MOUSE_BUS
diff --git a/src/gui/embedded/qmousedriverfactory_qws.cpp b/src/gui/embedded/qmousedriverfactory_qws.cpp
index 7e51818..46898ae 100644
--- a/src/gui/embedded/qmousedriverfactory_qws.cpp
+++ b/src/gui/embedded/qmousedriverfactory_qws.cpp
@@ -43,10 +43,8 @@
#include "qapplication.h"
#include "qmousepc_qws.h"
-#include "qmousebus_qws.h"
-#include "qmousevr41xx_qws.h"
-#include "qmouseyopy_qws.h"
#include "qmouselinuxtp_qws.h"
+#include "qmouselinuxinput_qws.h"
#include "qmousevfb_qws.h"
#include "qmousetslib_qws.h"
#include <stdlib.h>
@@ -108,14 +106,6 @@ QWSMouseHandler *QMouseDriverFactory::create(const QString& key, const QString &
if (driver == QLatin1String("linuxtp") || driver.isEmpty())
return new QWSLinuxTPMouseHandler(key, device);
#endif
-#ifndef QT_NO_QWS_MOUSE_YOPY
- if (driver == QLatin1String("yopy") || driver.isEmpty())
- return new QWSYopyMouseHandler(key, device);
-#endif
-#ifndef QT_NO_QWS_MOUSE_VR41XX
- if (driver == QLatin1String("vr41xx") || driver.isEmpty())
- return new QWSVr41xxMouseHandler(key, device);
-#endif
#ifndef QT_NO_QWS_MOUSE_PC
if (driver == QLatin1String("auto")
|| driver == QLatin1String("intellimouse")
@@ -126,14 +116,16 @@ QWSMouseHandler *QMouseDriverFactory::create(const QString& key, const QString &
return new QWSPcMouseHandler(key, device);
}
#endif
-#ifndef QT_NO_QWS_MOUSE_BUS
- if (driver == QLatin1String("bus"))
- return new QWSBusMouseHandler(key, device);
-#endif
#ifndef QT_NO_QWS_MOUSE_TSLIB
if (driver == QLatin1String("tslib") || driver.isEmpty())
return new QWSTslibMouseHandler(key, device);
#endif
+# ifndef QT_NO_QWS_MOUSE_LINUXINPUT
+ if (driver == QLatin1String("linuxinput") || \
+ driver == QLatin1String("usb") || \
+ driver == QLatin1String("linuxis"))
+ return new QWSLinuxInputMouseHandler(device);
+# endif
#ifndef QT_NO_QWS_MOUSE_QVFB
if (driver == QLatin1String("qvfbmouse") || driver == QLatin1String("qvfb"))
return new QVFbMouseHandler(key, device);
@@ -160,12 +152,6 @@ QStringList QMouseDriverFactory::keys()
#ifndef QT_NO_QWS_MOUSE_LINUXTP
list << QLatin1String("LinuxTP");
#endif
-#ifndef QT_NO_QWS_MOUSE_YOPY
- list << QLatin1String("Yopy");
-#endif
-#ifndef QT_NO_QWS_MOUSE_VR41XX
- list << QLatin1String("VR41xx");
-#endif
#ifndef QT_NO_QWS_MOUSE_PC
list << QLatin1String("Auto")
<< QLatin1String("IntelliMouse")
@@ -173,12 +159,12 @@ QStringList QMouseDriverFactory::keys()
<< QLatin1String("MouseSystems")
<< QLatin1String("MouseMan");
#endif
-#ifndef QT_NO_QWS_MOUSE_BUS
- list << QLatin1String("Bus");
-#endif
#ifndef QT_NO_QWS_MOUSE_TSLIB
list << QLatin1String("Tslib");
#endif
+#ifndef QT_NO_QWS_MOUSE_LINUXINPUT
+ list << QLatin1String("LinuxInput");
+#endif
#if !defined(Q_OS_WIN32) || defined(QT_MAKEDLL)
#ifndef QT_NO_LIBRARY
diff --git a/src/gui/embedded/qmouselinuxinput_qws.cpp b/src/gui/embedded/qmouselinuxinput_qws.cpp
new file mode 100644
index 0000000..6ea8807
--- /dev/null
+++ b/src/gui/embedded/qmouselinuxinput_qws.cpp
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmouselinuxinput_qws.h"
+
+#include <QScreen>
+#include <QSocketNotifier>
+
+#include <qplatformdefs.h>
+#include <private/qcore_unix_p.h> // overrides QT_OPEN
+
+#include <errno.h>
+
+#include <linux/input.h>
+
+QT_BEGIN_NAMESPACE
+
+
+class QWSLinuxInputMousePrivate : public QObject
+{
+ Q_OBJECT
+public:
+ QWSLinuxInputMousePrivate(QWSLinuxInputMouseHandler *, const QString &);
+ ~QWSLinuxInputMousePrivate();
+
+ void enable(bool on);
+
+private Q_SLOTS:
+ void readMouseData();
+
+private:
+ QWSLinuxInputMouseHandler *m_handler;
+ QSocketNotifier * m_notify;
+ int m_fd;
+ int m_x, m_y;
+ int m_buttons;
+};
+
+QWSLinuxInputMouseHandler::QWSLinuxInputMouseHandler(const QString &device)
+ : QWSCalibratedMouseHandler(device)
+{
+ d = new QWSLinuxInputMousePrivate(this, device);
+}
+
+QWSLinuxInputMouseHandler::~QWSLinuxInputMouseHandler()
+{
+ delete d;
+}
+
+void QWSLinuxInputMouseHandler::suspend()
+{
+ d->enable(false);
+}
+
+void QWSLinuxInputMouseHandler::resume()
+{
+ d->enable(true);
+}
+
+QWSLinuxInputMousePrivate::QWSLinuxInputMousePrivate(QWSLinuxInputMouseHandler *h, const QString &device)
+ : m_handler(h), m_notify(0), m_x(0), m_y(0), m_buttons(0)
+{
+ setObjectName(QLatin1String("LinuxInputSubsystem Mouse Handler"));
+
+ QString dev = QLatin1String("/dev/input/event0");
+ if (device.startsWith(QLatin1String("/dev/")))
+ dev = device;
+
+ m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
+ if (m_fd >= 0) {
+ m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
+ connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData()));
+ } else {
+ qWarning("Cannot open mouse input device '%s': %s", qPrintable(dev), strerror(errno));
+ return;
+ }
+}
+
+QWSLinuxInputMousePrivate::~QWSLinuxInputMousePrivate()
+{
+ if (m_fd >= 0)
+ QT_CLOSE(m_fd);
+}
+
+void QWSLinuxInputMousePrivate::enable(bool on)
+{
+ if (m_notify)
+ m_notify->setEnabled(on);
+}
+
+void QWSLinuxInputMousePrivate::readMouseData()
+{
+ if (!qt_screen)
+ return;
+
+ struct ::input_event buffer[32];
+ int n = 0;
+
+ forever {
+ n = QT_READ(m_fd, reinterpret_cast<char *>(buffer) + n, sizeof(buffer) - n);
+
+ if (n == 0) {
+ qWarning("Got EOF from the input device.");
+ return;
+ } else if (n < 0 && (errno != EINTR && errno != EAGAIN)) {
+ qWarning("Could not read from input device: %s", strerror(errno));
+ return;
+ } else if (n % sizeof(buffer[0]) == 0) {
+ break;
+ }
+ }
+
+ n /= sizeof(buffer[0]);
+
+ for (int i = 0; i < n; ++i) {
+ struct ::input_event *data = &buffer[i];
+
+ bool unknown = false;
+ if (data->type == EV_ABS) {
+ if (data->code == ABS_X) {
+ m_x = data->value;
+ } else if (data->code == ABS_Y) {
+ m_y = data->value;
+ } else {
+ unknown = true;
+ }
+ } else if (data->type == EV_REL) {
+ if (data->code == REL_X) {
+ m_x += data->value;
+ } else if (data->code == REL_Y) {
+ m_y += data->value;
+ } else {
+ unknown = true;
+ }
+ } else if (data->type == EV_KEY && data->code == BTN_TOUCH) {
+ m_buttons = data->value ? Qt::LeftButton : 0;
+ } else if (data->type == EV_KEY) {
+ int button = 0;
+ switch (data->code) {
+ case BTN_LEFT: button = Qt::LeftButton; break;
+ case BTN_MIDDLE: button = Qt::MidButton; break;
+ case BTN_RIGHT: button = Qt::RightButton; break;
+ }
+ if (data->value)
+ m_buttons |= button;
+ else
+ m_buttons &= ~button;
+ } else if (data->type == EV_SYN && data->code == SYN_REPORT) {
+ QPoint pos(m_x, m_y);
+ pos = m_handler->transform(pos);
+ m_handler->limitToScreen(pos);
+ m_handler->mouseChanged(pos, m_buttons);
+ } else if (data->type == EV_MSC && data->code == MSC_SCAN) {
+ // kernel encountered an unmapped key - just ignore it
+ continue;
+ } else {
+ unknown = true;
+ }
+ if (unknown) {
+ qWarning("unknown mouse event type=%x, code=%x, value=%x", data->type, data->code, data->value);
+ }
+ }
+}
+
+QT_END_NAMESPACE
+
+#include "qmouselinuxinput_qws.moc"
diff --git a/src/gui/embedded/qmousebus_qws.h b/src/gui/embedded/qmouselinuxinput_qws.h
index 407da98..25e351f 100644
--- a/src/gui/embedded/qmousebus_qws.h
+++ b/src/gui/embedded/qmouselinuxinput_qws.h
@@ -3,7 +3,7 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#ifndef QMOUSEBUS_QWS_H
-#define QMOUSEBUS_QWS_H
+#ifndef QMOUSELINUXINPUT_QWS_H
+#define QMOUSELINUXINPUT_QWS_H
-#include <QtGui/qmouse_qws.h>
+#include <QtGui/QWSCalibratedMouseHandler>
QT_BEGIN_HEADER
@@ -50,27 +50,29 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-#ifndef QT_NO_QWS_MOUSE_BUS
+#ifndef QT_NO_QWS_MOUSE_LINUXINPUT
-class QWSBusMouseHandlerPrivate;
+class QWSLinuxInputMousePrivate;
-class QWSBusMouseHandler : public QWSMouseHandler
+class QWSLinuxInputMouseHandler : public QWSCalibratedMouseHandler
{
public:
- explicit QWSBusMouseHandler(const QString & = QString(),
- const QString & = QString());
- ~QWSBusMouseHandler();
+ QWSLinuxInputMouseHandler(const QString &);
+ ~QWSLinuxInputMouseHandler();
void suspend();
void resume();
-protected:
- QWSBusMouseHandlerPrivate *d;
+
+private:
+ QWSLinuxInputMousePrivate *d;
+
+ friend class QWSLinuxInputMousePrivate;
};
-#endif // QT_NO_QWS_MOUSE_BUS
+#endif // QT_NO_QWS_MOUSE_LINUXINPUT
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMOUSEBUS_QWS_H
+#endif // QMOUSELINUXINPUT_QWS_H
diff --git a/src/gui/embedded/qmousevr41xx_qws.cpp b/src/gui/embedded/qmousevr41xx_qws.cpp
deleted file mode 100644
index b7491d9..0000000
--- a/src/gui/embedded/qmousevr41xx_qws.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmousevr41xx_qws.h"
-
-#ifndef QT_NO_QWS_MOUSE_VR41XX
-#include "qwindowsystem_qws.h"
-#include "qsocketnotifier.h"
-#include "qtimer.h"
-#include "qapplication.h"
-#include "qscreen_qws.h"
-#include <qstringlist.h>
-#include <qvarlengtharray.h>
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-
-QT_BEGIN_NAMESPACE
-
-static const int defaultFilterSize = 3;
-
-class QWSVr41xxMouseHandlerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSVr41xxMouseHandlerPrivate(QWSVr41xxMouseHandler *, const QString &, const QString &);
- ~QWSVr41xxMouseHandlerPrivate();
-
- void resume();
- void suspend();
-
-private slots:
- void sendRelease();
- void readMouseData();
-
-private:
- bool getSample();
- ushort currSample[6];
- uint currLength;
-
- int mouseFD;
- int mouseIdx;
- QTimer *rtimer;
- QSocketNotifier *mouseNotifier;
- QWSVr41xxMouseHandler *handler;
- QPoint lastPos;
- bool isPressed;
- int filterSize;
- int pressLimit;
-};
-
-QWSVr41xxMouseHandler::QWSVr41xxMouseHandler(const QString &drv, const QString &dev)
- : QWSCalibratedMouseHandler(drv, dev)
-{
- d = new QWSVr41xxMouseHandlerPrivate(this, drv, dev);
-}
-
-QWSVr41xxMouseHandler::~QWSVr41xxMouseHandler()
-{
- delete d;
-}
-
-void QWSVr41xxMouseHandler::resume()
-{
- d->resume();
-}
-
-void QWSVr41xxMouseHandler::suspend()
-{
- d->suspend();
-}
-
-QWSVr41xxMouseHandlerPrivate::QWSVr41xxMouseHandlerPrivate(QWSVr41xxMouseHandler *h, const QString &, const QString &device)
- : currLength(0), handler(h)
-{
- QStringList options = device.split(QLatin1String(":"));
- int index = -1;
-
- filterSize = defaultFilterSize;
- QRegExp filterRegExp(QLatin1String("filter=(\\d+)"));
- index = options.indexOf(filterRegExp);
- if (index != -1) {
- filterSize = qMax(1, filterRegExp.cap(1).toInt());
- options.removeAt(index);
- }
- handler->setFilterSize(filterSize);
-
- pressLimit = 750;
- QRegExp pressRegExp(QLatin1String("press=(\\d+)"));
- index = options.indexOf(pressRegExp);
- if (index != -1) {
- pressLimit = filterRegExp.cap(1).toInt();
- options.removeAt(index);
- }
-
- QString dev;
- if (options.isEmpty())
- dev = QLatin1String("/dev/vrtpanel");
- else
- dev = options.first();
-
- if ((mouseFD = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY)) < 0) {
- qWarning("Cannot open %s (%s)", qPrintable(dev), strerror(errno));
- return;
- }
- sleep(1);
-
- if (fcntl(mouseFD, F_SETFL, O_NONBLOCK) < 0) {
- qWarning("Error initializing touch panel.");
- return;
- }
-
- mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read, this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
-
- rtimer = new QTimer(this);
- rtimer->setSingleShot(true);
- connect(rtimer, SIGNAL(timeout()), this, SLOT(sendRelease()));
- mouseIdx = 0;
-}
-
-QWSVr41xxMouseHandlerPrivate::~QWSVr41xxMouseHandlerPrivate()
-{
- if (mouseFD >= 0)
- QT_CLOSE(mouseFD);
-}
-
-void QWSVr41xxMouseHandlerPrivate::suspend()
-{
- mouseNotifier->setEnabled(false);
-}
-
-
-void QWSVr41xxMouseHandlerPrivate::resume()
-{
- mouseIdx = 0;
- mouseNotifier->setEnabled(true);
-}
-
-void QWSVr41xxMouseHandlerPrivate::sendRelease()
-{
- handler->sendFiltered(lastPos, Qt::NoButton);
- isPressed = false;
-}
-
-bool QWSVr41xxMouseHandlerPrivate::getSample()
-{
- const int n = QT_READ(mouseFD,
- reinterpret_cast<uchar*>(currSample) + currLength,
- sizeof(currSample) - currLength);
-
- if (n > 0)
- currLength += n;
-
- if (currLength < sizeof(currSample))
- return false;
-
- currLength = 0;
- return true;
-}
-
-void QWSVr41xxMouseHandlerPrivate::readMouseData()
-{
- const int sampleLength = sizeof(currSample) / sizeof(ushort);
- QVarLengthArray<ushort, sampleLength * defaultFilterSize> samples(sampleLength * filterSize);
-
- // Only return last 'filterSize' samples
- int head = 0;
- int tail = 0;
- int nSamples = 0;
- while (getSample()) {
- if (!(currSample[0] & 0x8000) || (currSample[5] < pressLimit))
- continue;
-
- ushort *data = samples.data() + head * sampleLength;
- memcpy(data, currSample, sizeof(currSample));
- ++nSamples;
- head = (head + 1) % filterSize;
- if (nSamples >= filterSize)
- tail = (tail + 1) % filterSize;
- }
-
- if (nSamples == 0)
- return;
-
- // send mouse events
- while (tail != head || filterSize == 1) {
- const ushort *data = samples.data() + tail * sampleLength;
- lastPos = QPoint(data[3] - data[4], data[2] - data[1]);
- handler->sendFiltered(lastPos, Qt::LeftButton);
- isPressed = true;
- tail = (tail + 1) % filterSize;
- if (filterSize == 1)
- break;
- }
-
- if (isPressed)
- rtimer->start(50); // release unreliable
-}
-
-QT_END_NAMESPACE
-
-#include "qmousevr41xx_qws.moc"
-
-#endif //QT_NO_QWS_MOUSE_VR41
diff --git a/src/gui/embedded/qmousevr41xx_qws.h b/src/gui/embedded/qmousevr41xx_qws.h
deleted file mode 100644
index 46d07e0..0000000
--- a/src/gui/embedded/qmousevr41xx_qws.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSEVR41XX_QWS_H
-#define QMOUSEVR41XX_QWS_H
-
-#include <QtGui/qmouse_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_MOUSE_VR41XX
-
-class QWSVr41xxMouseHandlerPrivate;
-
-class QWSVr41xxMouseHandler : public QWSCalibratedMouseHandler
-{
-public:
- explicit QWSVr41xxMouseHandler(const QString & = QString(),
- const QString & = QString());
- ~QWSVr41xxMouseHandler();
-
- void resume();
- void suspend();
-
-protected:
- QWSVr41xxMouseHandlerPrivate *d;
-
-private:
- friend class QWSVr41xxMouseHandlerPrivate;
-};
-
-#endif // QT_NO_QWS_MOUSE_VR41XX
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMOUSEVR41XX_QWS_H
diff --git a/src/gui/embedded/qmouseyopy_qws.cpp b/src/gui/embedded/qmouseyopy_qws.cpp
deleted file mode 100644
index 3a541d3..0000000
--- a/src/gui/embedded/qmouseyopy_qws.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmouseyopy_qws.h"
-
-#ifndef QT_NO_QWS_MOUSE_YOPY
-#include "qwindowsystem_qws.h"
-#include "qsocketnotifier.h"
-#include "qapplication.h"
-#include "qscreen_qws.h"
-#include <private/qcore_unix_p.h> // overrides QT_OPEN
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <termios.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWSYopyMouseHandlerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QWSYopyMouseHandlerPrivate(QWSYopyMouseHandler *h);
- ~QWSYopyMouseHandlerPrivate();
-
- void suspend();
- void resume();
-
-private slots:
- void readMouseData();
-
-private:
- int mouseFD;
- int prevstate;
- QSocketNotifier *mouseNotifier;
- QWSYopyMouseHandler *handler;
-};
-
-QWSYopyMouseHandler::QWSYopyMouseHandler(const QString &driver, const QString &device)
- : QWSMouseHandler(driver, device)
-{
- d = new QWSYopyMouseHandlerPrivate(this);
-}
-
-QWSYopyMouseHandler::~QWSYopyMouseHandler()
-{
- delete d;
-}
-
-void QWSYopyMouseHandler::resume()
-{
- d->resume();
-}
-
-void QWSYopyMouseHandler::suspend()
-{
- d->suspend();
-}
-
-QWSYopyMouseHandlerPrivate::QWSYopyMouseHandlerPrivate(QWSYopyMouseHandler *h)
- : handler(h)
-{
- if ((mouseFD = QT_OPEN("/dev/ts", O_RDONLY)) < 0) {
- qWarning("Cannot open /dev/ts (%s)", strerror(errno));
- return;
- } else {
- sleep(1);
- }
- prevstate=0;
- mouseNotifier = new QSocketNotifier(mouseFD, QSocketNotifier::Read,
- this);
- connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData()));
-}
-
-QWSYopyMouseHandlerPrivate::~QWSYopyMouseHandlerPrivate()
-{
- if (mouseFD >= 0)
- QT_CLOSE(mouseFD);
-}
-
-#define YOPY_XPOS(d) (d[1]&0x3FF)
-#define YOPY_YPOS(d) (d[2]&0x3FF)
-#define YOPY_PRES(d) (d[0]&0xFF)
-#define YOPY_STAT(d) (d[3]&0x01)
-
-struct YopyTPdata {
-
- unsigned char status;
- unsigned short xpos;
- unsigned short ypos;
-
-};
-
-void QWSYopyMouseHandlerPrivate::suspend()
-{
- mouseNotifier->setEnabled(false);
-}
-
-
-void QWSYopyMouseHandlerPrivate::resume()
-{
- prevstate = 0;
- mouseNotifier->setEnabled(true);
-}
-
-void QWSYopyMouseHandlerPrivate::readMouseData()
-{
- if(!qt_screen)
- return;
- YopyTPdata data;
-
- unsigned int yopDat[4];
-
- int ret;
-
- ret=QT_READ(mouseFD,&yopDat,sizeof(yopDat));
-
- if(ret) {
- data.status= (YOPY_PRES(yopDat)) ? 1 : 0;
- data.xpos=YOPY_XPOS(yopDat);
- data.ypos=YOPY_YPOS(yopDat);
- QPoint q;
- q.setX(data.xpos);
- q.setY(data.ypos);
- if (data.status && !prevstate) {
- handler->mouseChanged(q,Qt::LeftButton);
- } else if(!data.status && prevstate) {
- handler->mouseChanged(q,0);
- }
- prevstate = data.status;
- }
- if(ret<0) {
- qDebug("Error %s",strerror(errno));
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qmouseyopy_qws.moc"
-
-#endif //QT_NO_QWS_MOUSE_YOPY
diff --git a/src/gui/embedded/qmouseyopy_qws.h b/src/gui/embedded/qmouseyopy_qws.h
deleted file mode 100644
index 0d24a8f..0000000
--- a/src/gui/embedded/qmouseyopy_qws.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://www.qtsoftware.com/contact.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSEYOPY_QWS_H
-#define QMOUSEYOPY_QWS_H
-
-#include <QtGui/qmouse_qws.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-#ifndef QT_NO_QWS_MOUSE_YOPY
-
-// YOPY touch panel support based on changes contributed by Ron Victorelli
-// (victorrj at icubed.com) to Custom TP driver.
-
-class QWSYopyMouseHandlerPrivate;
-
-class QWSYopyMouseHandler : public QWSMouseHandler
-{
-public:
- explicit QWSYopyMouseHandler(const QString & = QString(),
- const QString & = QString());
- ~QWSYopyMouseHandler();
-
- void resume();
- void suspend();
-
-protected:
- QWSYopyMouseHandlerPrivate *d;
-};
-
-#endif // QT_NO_QWS_MOUSE_YOPY
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QMOUSEYOPY_QWS_H
diff --git a/src/gui/embedded/qscreenproxy_qws.cpp b/src/gui/embedded/qscreenproxy_qws.cpp
index ade16ca..3d7451b 100644
--- a/src/gui/embedded/qscreenproxy_qws.cpp
+++ b/src/gui/embedded/qscreenproxy_qws.cpp
@@ -537,7 +537,7 @@ int QProxyScreen::transformOrientation() const
}
/*!
-\reimp
+\internal
*/
int QProxyScreen::memoryNeeded(const QString &str)
{
@@ -548,7 +548,7 @@ int QProxyScreen::memoryNeeded(const QString &str)
}
/*!
-\reimp
+\internal
*/
int QProxyScreen::sharedRamSize(void *ptr)
{
@@ -559,7 +559,7 @@ int QProxyScreen::sharedRamSize(void *ptr)
}
/*!
-\reimp
+\internal
*/
void QProxyScreen::haltUpdates()
{
@@ -568,7 +568,7 @@ void QProxyScreen::haltUpdates()
}
/*!
-\reimp
+\internal
*/
void QProxyScreen::resumeUpdates()
{
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index ae2a2c3..0ff3685 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -307,8 +307,6 @@
QStyleOptionGraphicsItem::exposedRect or QStyleOptionGraphicsItem::matrix.
By default, the exposedRect is initialized to the item's boundingRect and
the matrix is untransformed. Enable this flag for more fine-grained values.
- Note that QStyleOptionGraphicsItem::levelOfDetail is unaffected by this flag
- and is always initialized to 1.
Use QStyleOptionGraphicsItem::levelOfDetailFromTransform for a more
fine-grained value.
@@ -1237,7 +1235,7 @@ void QGraphicsItem::setGroup(QGraphicsItemGroup *group)
Returns a pointer to this item's parent item. If this item does not have a
parent, 0 is returned.
- \sa setParentItem(), children()
+ \sa setParentItem(), childItems()
*/
QGraphicsItem *QGraphicsItem::parentItem() const
{
@@ -1353,7 +1351,7 @@ const QGraphicsObject *QGraphicsItem::toGraphicsObject() const
the parent. You should not \l{QGraphicsScene::addItem()}{add} the
item to the scene yourself.
- \sa parentItem(), children()
+ \sa parentItem(), childItems()
*/
void QGraphicsItem::setParentItem(QGraphicsItem *parent)
{
@@ -2298,10 +2296,10 @@ bool QGraphicsItem::acceptsHoverEvents() const
stays "hovered" until the cursor leaves its area, including its
children's areas.
- If a parent item handles child events (setHandlesChildEvents()), it will
- receive hover move, drag move, and drop events as the cursor passes
- through its children, but it does not receive hover enter and hover leave,
- nor drag enter and drag leave events on behalf of its children.
+ If a parent item handles child events, it will receive hover move,
+ drag move, and drop events as the cursor passes through its
+ children, but it does not receive hover enter and hover leave, nor
+ drag enter and drag leave events on behalf of its children.
A QGraphicsWidget with window decorations will accept hover events
regardless of the value of acceptHoverEvents().
@@ -2455,6 +2453,8 @@ void QGraphicsItem::setHandlesChildEvents(bool enabled)
*/
bool QGraphicsItem::hasFocus() const
{
+ if (d_ptr->focusProxy)
+ return d_ptr->focusProxy->hasFocus();
return (d_ptr->scene && d_ptr->scene->focusItem() == this);
}
@@ -2480,12 +2480,16 @@ void QGraphicsItem::setFocus(Qt::FocusReason focusReason)
{
if (!d_ptr->scene || !isEnabled() || hasFocus() || !(d_ptr->flags & ItemIsFocusable))
return;
- if (isVisible()) {
+ QGraphicsItem *item = this;
+ QGraphicsItem *f;
+ while ((f = item->d_ptr->focusProxy))
+ item = f;
+ if (item->isVisible()) {
// Visible items immediately gain focus from scene.
- d_ptr->scene->setFocusItem(this, focusReason);
- } else if (d_ptr->isWidget) {
+ d_ptr->scene->d_func()->setFocusItemHelper(item, focusReason);
+ } else if (item->d_ptr->isWidget) {
// Just set up subfocus.
- static_cast<QGraphicsWidget *>(this)->d_func()->setFocusWidget();
+ static_cast<QGraphicsWidget *>(item)->d_func()->setFocusWidget();
}
}
@@ -2508,13 +2512,73 @@ void QGraphicsItem::clearFocus()
// Invisible widget items with focus must explicitly clear subfocus.
static_cast<QGraphicsWidget *>(this)->d_func()->clearFocusWidget();
}
- if (d_ptr->scene->focusItem() == this) {
+ if (hasFocus()) {
// If this item has the scene's input focus, clear it.
d_ptr->scene->setFocusItem(0);
}
}
/*!
+ \since 4.6
+
+ Returns this item's focus proxy, or 0 if the item
+ does not have any focus proxy.
+
+ \sa setFocusProxy()
+*/
+QGraphicsItem *QGraphicsItem::focusProxy() const
+{
+ return d_ptr->focusProxy;
+}
+
+/*!
+ \since 4.6
+
+ Sets the item's focus proxy to \a item.
+
+ If an item has a focus proxy, the focus proxy will receive
+ input focus when the item gains input focus. The item itself
+ will still have focus (i.e., hasFocus() will return true),
+ but only the focus proxy will receive the keyboard input.
+
+ A focus proxy can itself have a focus proxy, and so on. In
+ such case, keyboard input will be handled by the outermost
+ focus proxy.
+
+ \sa focusProxy()
+*/
+void QGraphicsItem::setFocusProxy(QGraphicsItem *item)
+{
+ if (item == d_ptr->focusProxy)
+ return;
+ if (item == this) {
+ qWarning("QGraphicsItem::setFocusProxy: cannot assign self as focus proxy");
+ return;
+ }
+ if (item) {
+ if (item->d_ptr->scene != d_ptr->scene) {
+ qWarning("QGraphicsItem::setFocusProxy: focus proxy must be in same scene");
+ return;
+ }
+ for (QGraphicsItem *f = item->focusProxy(); f != 0; f = f->focusProxy()) {
+ if (f == this) {
+ qWarning("QGraphicsItem::setFocusProxy: %p is already in the focus proxy chain", item);
+ return;
+ }
+ }
+ }
+
+ QGraphicsItem *lastFocusProxy = d_ptr->focusProxy;
+ d_ptr->focusProxy = item;
+ if (d_ptr->scene) {
+ if (lastFocusProxy)
+ d_ptr->scene->d_func()->focusProxyReverseMap.remove(lastFocusProxy, this);
+ if (item)
+ d_ptr->scene->d_func()->focusProxyReverseMap.insert(item, this);
+ }
+}
+
+/*!
\since 4.4
Grabs the mouse input.
@@ -2649,7 +2713,7 @@ void QGraphicsItem::ungrabKeyboard()
For convenience, you can also call scenePos() to determine the
item's position in scene coordinates, regardless of its parent.
- \sa x(), y(), setPos(), matrix(), {The Graphics View Coordinate System}
+ \sa x(), y(), setPos(), transform(), {The Graphics View Coordinate System}
*/
QPointF QGraphicsItem::pos() const
{
@@ -9640,13 +9704,10 @@ QVariant QGraphicsSimpleTextItem::extension(const QVariant &variant) const
setParentItem().
The boundingRect() function of QGraphicsItemGroup returns the
- bounding rectangle of all items in the item group. In addition,
- item groups have handlesChildEvents() enabled by default, so all
- events sent to a member of the group go to the item group (i.e.,
- selecting one item in a group will select them all).
- QGraphicsItemGroup ignores the ItemIgnoresTransformations flag on its
- children (i.e., with respect to the geometry of the group item, the
- children are treated as if they were transformable).
+ bounding rectangle of all items in the item group.
+ QGraphicsItemGroup ignores the ItemIgnoresTransformations flag on
+ its children (i.e., with respect to the geometry of the group
+ item, the children are treated as if they were transformable).
There are two ways to construct an item group. The easiest and
most common approach is to pass a list of items (e.g., all
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index a307622..5c9297f 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -226,6 +226,9 @@ public:
void setFocus(Qt::FocusReason focusReason = Qt::OtherFocusReason);
void clearFocus();
+ QGraphicsItem *focusProxy() const;
+ void setFocusProxy(QGraphicsItem *item);
+
void grabMouse();
void ungrabMouse();
void grabKeyboard();
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 4729634..1cf188e 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -122,6 +122,7 @@ public:
index(-1),
siblingIndex(-1),
depth(0),
+ focusProxy(0),
acceptedMouseButtons(0x1f),
visible(1),
explicitlyHidden(0),
@@ -409,6 +410,7 @@ public:
int index;
int siblingIndex;
int depth;
+ QGraphicsItem *focusProxy;
// Packed 32 bytes
quint32 acceptedMouseButtons : 5;
@@ -438,7 +440,7 @@ public:
// New 32 bits
quint32 fullUpdatePending : 1;
- quint32 flags : 12;
+ quint32 flags : 13;
quint32 dirtyChildrenBoundingRect : 1;
quint32 paintedViewBoundingRectsNeedRepaint : 1;
quint32 dirtySceneTransform : 1;
@@ -451,7 +453,7 @@ public:
quint32 acceptedTouchBeginEvent : 1;
quint32 filtersDescendantEvents : 1;
quint32 sceneTransformTranslateOnly : 1;
- quint32 unused : 7; // feel free to use
+ quint32 unused : 6; // feel free to use
// Optional stacking order
int globalStackingOrder;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 38e5938..4796436 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -491,6 +491,13 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
item->d_func()->scene = 0;
+ // Unregister focus proxy.
+ QMultiHash<QGraphicsItem *, QGraphicsItem *>::iterator it = focusProxyReverseMap.find(item);
+ while (it != focusProxyReverseMap.end() && it.key() == item) {
+ it.value()->d_ptr->focusProxy = 0;
+ it = focusProxyReverseMap.erase(it);
+ }
+
// Remove from parent, or unregister from toplevels.
if (QGraphicsItem *parentItem = item->parentItem()) {
if (parentItem->scene()) {
@@ -559,6 +566,58 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
/*!
\internal
*/
+void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
+ Qt::FocusReason focusReason)
+{
+ Q_Q(QGraphicsScene);
+ if (item == focusItem)
+ return;
+ if (item && (!(item->flags() & QGraphicsItem::ItemIsFocusable)
+ || !item->isVisible() || !item->isEnabled())) {
+ item = 0;
+ }
+
+ if (item) {
+ q->setFocus(focusReason);
+ if (item == focusItem)
+ return;
+ }
+
+ if (focusItem) {
+ QFocusEvent event(QEvent::FocusOut, focusReason);
+ lastFocusItem = focusItem;
+ focusItem = 0;
+ sendEvent(lastFocusItem, &event);
+
+ if (lastFocusItem
+ && (lastFocusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) {
+ // Reset any visible preedit text
+ QInputMethodEvent imEvent;
+ sendEvent(lastFocusItem, &imEvent);
+
+ // Close any external input method panel
+ for (int i = 0; i < views.size(); ++i)
+ views.at(i)->inputContext()->reset();
+ }
+ }
+
+ if (item) {
+ if (item->isWidget()) {
+ // Update focus child chain.
+ static_cast<QGraphicsWidget *>(item)->d_func()->setFocusWidget();
+ }
+
+ focusItem = item;
+ QFocusEvent event(QEvent::FocusIn, focusReason);
+ sendEvent(item, &event);
+ }
+
+ updateInputMethodSensitivityInViews();
+}
+
+/*!
+ \internal
+*/
void QGraphicsScenePrivate::addPopup(QGraphicsWidget *widget)
{
Q_ASSERT(widget);
@@ -1926,21 +1985,42 @@ QPainterPath QGraphicsScene::selectionArea() const
}
/*!
+ \since 4.6
+
Sets the selection area to \a path. All items within this area are
immediately selected, and all items outside are unselected. You can get
the list of all selected items by calling selectedItems().
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
+
For an item to be selected, it must be marked as \e selectable
(QGraphicsItem::ItemIsSelectable).
\sa clearSelection(), selectionArea()
*/
+void QGraphicsScene::setSelectionArea(const QPainterPath &path, const QTransform &deviceTransform)
+{
+ setSelectionArea(path, Qt::IntersectsItemShape, deviceTransform);
+}
+
+/*!
+ \obsolete
+ \overload
+
+ Sets the selection area to \a path.
+
+ This function is deprecated and leads to incorrect results if the scene
+ contains items that ignore transformations. Use the overload that takes
+ a QTransform instead.
+*/
void QGraphicsScene::setSelectionArea(const QPainterPath &path)
{
- setSelectionArea(path, Qt::IntersectsItemShape);
+ setSelectionArea(path, Qt::IntersectsItemShape, QTransform());
}
/*!
+ \obsolete
\overload
\since 4.3
@@ -2576,49 +2656,10 @@ QGraphicsItem *QGraphicsScene::focusItem() const
void QGraphicsScene::setFocusItem(QGraphicsItem *item, Qt::FocusReason focusReason)
{
Q_D(QGraphicsScene);
- if (item == d->focusItem)
- return;
- if (item && (!(item->flags() & QGraphicsItem::ItemIsFocusable)
- || !item->isVisible() || !item->isEnabled())) {
- item = 0;
- }
-
- if (item) {
- setFocus(focusReason);
- if (item == d->focusItem)
- return;
- }
-
- if (d->focusItem) {
- QFocusEvent event(QEvent::FocusOut, focusReason);
- d->lastFocusItem = d->focusItem;
- d->focusItem = 0;
- d->sendEvent(d->lastFocusItem, &event);
-
- if (d->lastFocusItem
- && (d->lastFocusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) {
- // Reset any visible preedit text
- QInputMethodEvent imEvent;
- d->sendEvent(d->lastFocusItem, &imEvent);
-
- // Close any external input method panel
- for (int i = 0; i < d->views.size(); ++i)
- d->views.at(i)->inputContext()->reset();
- }
- }
-
- if (item) {
- if (item->isWidget()) {
- // Update focus child chain.
- static_cast<QGraphicsWidget *>(item)->d_func()->setFocusWidget();
- }
-
- d->focusItem = item;
- QFocusEvent event(QEvent::FocusIn, focusReason);
- d->sendEvent(item, &event);
- }
-
- d->updateInputMethodSensitivityInViews();
+ if (item)
+ item->setFocus(focusReason);
+ else
+ d->setFocusItemHelper(item, focusReason);
}
/*!
@@ -2673,15 +2714,17 @@ void QGraphicsScene::clearFocus()
/*!
\property QGraphicsScene::stickyFocus
- \brief whether or not clicking the scene will clear focus
+ \brief whether clicking into the scene background will clear focus
\since 4.6
- If this property is false (the default), then clicking on the scene
- background or on an item that does not accept focus, will clear
- focus. Otherwise, focus will remain unchanged.
+ In a QGraphicsScene with stickyFocus set to true, focus will remain
+ unchanged when the user clicks into the scene background or on an item
+ that does not accept focus. Otherwise, focus will be cleared.
+
+ By default, this property is false.
- The focus change happens in response to a mouse press. You can reimplement
+ Focus changes in response to a mouse press. You can reimplement
mousePressEvent() in a subclass of QGraphicsScene to toggle this property
based on where the user has clicked.
diff --git a/src/gui/graphicsview/qgraphicsscene.h b/src/gui/graphicsview/qgraphicsscene.h
index d790f90..c0c6e75 100644
--- a/src/gui/graphicsview/qgraphicsscene.h
+++ b/src/gui/graphicsview/qgraphicsscene.h
@@ -182,8 +182,9 @@ public:
QList<QGraphicsItem *> selectedItems() const;
QPainterPath selectionArea() const;
- void setSelectionArea(const QPainterPath &path);
- void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode);
+ void setSelectionArea(const QPainterPath &path); // ### obsolete
+ void setSelectionArea(const QPainterPath &path, const QTransform &deviceTransform);
+ void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode); // ### obsolete
void setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode, const QTransform &deviceTransform);
QGraphicsItemGroup *createItemGroup(const QList<QGraphicsItem *> &items);
diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h
index 9a91acc..a4bbdd2 100644
--- a/src/gui/graphicsview/qgraphicsscene_p.h
+++ b/src/gui/graphicsview/qgraphicsscene_p.h
@@ -130,6 +130,8 @@ public:
QGraphicsWidget *tabFocusFirst;
QGraphicsWidget *activeWindow;
int activationRefCount;
+ void setFocusItemHelper(QGraphicsItem *item, Qt::FocusReason focusReason);
+ QMultiHash<QGraphicsItem *, QGraphicsItem *> focusProxyReverseMap;
QList<QGraphicsWidget *> popupWidgets;
void addPopup(QGraphicsWidget *widget);
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index ad55dcd..ec36224 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1691,12 +1691,8 @@ void QImage::setColorTable(const QVector<QRgb> colors)
d->colortable = colors;
d->has_alpha_clut = false;
- for (int i = 0; i < d->colortable.size(); ++i) {
- if (qAlpha(d->colortable.at(i)) != 255) {
- d->has_alpha_clut = true;
- break;
- }
- }
+ for (int i = 0; i < d->colortable.size(); ++i)
+ d->has_alpha_clut |= (qAlpha(d->colortable.at(i)) != 255);
}
/*!
@@ -3951,8 +3947,10 @@ QImage QImage::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::Transf
if (newSize == size())
return copy();
- QTransform wm = QTransform::fromScale((qreal)newSize.width() / width(), (qreal)newSize.height() / height());
- QImage img = transformed(wm, mode);
+ QImage img;
+ QTransform wm;
+ wm.scale((qreal)newSize.width() / width(), (qreal)newSize.height() / height());
+ img = transformed(wm, mode);
return img;
}
@@ -3979,8 +3977,9 @@ QImage QImage::scaledToWidth(int w, Qt::TransformationMode mode) const
if (w <= 0)
return QImage();
+ QTransform wm;
qreal factor = (qreal) w / width();
- QTransform wm = QTransform::fromScale(factor, factor);
+ wm.scale(factor, factor);
return transformed(wm, mode);
}
@@ -4007,8 +4006,9 @@ QImage QImage::scaledToHeight(int h, Qt::TransformationMode mode) const
if (h <= 0)
return QImage();
+ QTransform wm;
qreal factor = (qreal) h / height();
- QTransform wm = QTransform::fromScale(factor, factor);
+ wm.scale(factor, factor);
return transformed(wm, mode);
}
@@ -4629,14 +4629,17 @@ bool QImage::loadFromData(const uchar *data, int len, const char *format)
\fn QImage QImage::fromData(const uchar *data, int size, const char *format)
Constructs a QImage from the first \a size bytes of the given
- binary \a data. The loader attempts to read the image using the
- specified \a format. If \a format is not specified (which is the default),
- the loader probes the file for a header to guess the file format.
+ binary \a data. The loader attempts to read the image, either using the
+ optional image \a format specified or by determining the image format from
+ the data.
- If the loading of the image failed, this object is a null image.
+ If \a format is not specified (which is the default), the loader probes the
+ file for a header to determine the file format. If \a format is specified,
+ it must be one of the values returned by QImageReader::supportedImageFormats().
+
+ If the loading of the image fails, the image returned will be a null image.
- \sa load(), save(), {QImage#Reading and Writing Image
- Files}{Reading and Writing Image Files}
+ \sa load(), save(), {QImage#Reading and Writing Image Files}{Reading and Writing Image Files}
*/
QImage QImage::fromData(const uchar *data, int size, const char *format)
{
@@ -4764,7 +4767,7 @@ QDataStream &operator>>(QDataStream &s, QImage &image)
image = QImageReader(s.device(), 0).read();
return s;
}
-#endif // QT_NO_DATASTREAM
+#endif
#ifdef QT3_SUPPORT
@@ -4854,6 +4857,8 @@ bool QImage::operator==(const QImage & i) const
return false;
if (d->format != Format_RGB32) {
+ if (d->colortable != i.d->colortable)
+ return false;
if (d->format >= Format_ARGB32) { // all bits defined
const int n = d->width * d->depth / 8;
if (n == d->bytes_per_line && n == i.d->bytes_per_line) {
@@ -4866,13 +4871,11 @@ bool QImage::operator==(const QImage & i) const
}
}
} else {
- const int w = width();
- const int h = height();
- const QVector<QRgb> &colortable = d->colortable;
- const QVector<QRgb> &icolortable = i.d->colortable;
+ int w = width();
+ int h = height();
for (int y=0; y<h; ++y) {
for (int x=0; x<w; ++x) {
- if (colortable[pixelIndex(x, y)] != icolortable[i.pixelIndex(x, y)])
+ if (pixelIndex(x, y) != i.pixelIndex(x, y))
return false;
}
}
@@ -5269,7 +5272,7 @@ QPaintEngine *QImage::paintEngine() const
/*!
- \internal
+ \reimp
Returns the size for the specified \a metric on the device.
*/
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 72fdec0..3e5c9b7 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1572,24 +1572,24 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
designed and optimized for showing images on screen. QBitmap is
only a convenience class that inherits QPixmap, ensuring a depth
of 1. The isQBitmap() function returns true if a QPixmap object is
- really a bitmap, otherwise returns false. Finally, the QPicture class is a
- paint device that records and replays QPainter commands.
+ really a bitmap, otherwise returns false. Finally, the QPicture class
+ is a paint device that records and replays QPainter commands.
A QPixmap can easily be displayed on the screen using QLabel or
one of QAbstractButton's subclasses (such as QPushButton and
QToolButton). QLabel has a pixmap property, whereas
- QAbstractButton has an icon property. And because QPixmap is a
- QPaintDevice subclass, QPainter can be used to draw directly onto
- pixmaps.
+ QAbstractButton has an icon property.
In addition to the ordinary constructors, a QPixmap can be
constructed using the static grabWidget() and grabWindow()
functions which creates a QPixmap and paints the given widget, or
- window, in it.
+ window, into it.
+
+ QPixmap objects can be passed around by value since the QPixmap
+ class uses implicit data sharing. For more information, see the \l
+ {Implicit Data Sharing} documentation. QPixmap objects can also be
+ streamed.
- Note that the pixel data in a pixmap is internal and is managed by
- the underlying window system. Pixels can only be accessed through
- QPainter functions or by converting the QPixmap to a QImage.
Depending on the system, QPixmap is stored using a RGB32 or a
premultiplied alpha format. If the image has an alpha channel, and
if the system allows, the preferred format is premultiplied alpha.
@@ -1600,6 +1600,13 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
QPixmap are stored on the client side and don't use any GDI
resources).
+ Note that the pixel data in a pixmap is internal and is managed by
+ the underlying window system. Because QPixmap is a QPaintDevice
+ subclass, QPainter can be used to draw directly onto pixmaps.
+ Pixels can only be accessed through QPainter functions or by
+ converting the QPixmap to a QImage. However, the fill() function
+ is available for initializing the entire pixmap with a given color.
+
There are functions to convert between QImage and
QPixmap. Typically, the QImage class is used to load an image
file, optionally manipulating the image data, before the QImage
@@ -1614,11 +1621,6 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
there are several functions that enables transformation of the
pixmap.
- QPixmap objects can be passed around by value since the QPixmap
- class uses implicit data sharing. For more information, see the \l
- {Implicit Data Sharing} documentation. QPixmap objects can also be
- streamed.
-
\tableofcontents
\section1 Reading and Writing Image Files
@@ -1675,12 +1677,15 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
The hasAlphaChannel() returns true if the pixmap has a format that
respects the alpha channel, otherwise returns false, while the
hasAlpha() function returns true if the pixmap has an alpha
- channel \e or a mask (otherwise false).
+ channel \e or a mask (otherwise false). The mask() function returns
+ the mask as a QBitmap object, which can be set using setMask().
- The alphaChannel() function returns the alpha channel as a new
- QPixmap object, while the mask() function returns the mask as a
- QBitmap object. The alpha channel and mask can be set using the
- setAlphaChannel() and setMask() functions, respectively.
+ The createHeuristicMask() function creates and returns a 1-bpp
+ heuristic mask (i.e. a QBitmap) for this pixmap. It works by
+ selecting a color from one of the corners and then chipping away
+ pixels of that color, starting at all the edges. The
+ createMaskFromColor() function creates and returns a mask (i.e. a
+ QBitmap) for the pixmap based on a given color.
\row
\o Low-level information
@@ -1718,14 +1723,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
\section1 Pixmap Transformations
QPixmap supports a number of functions for creating a new pixmap
- that is a transformed version of the original: The
- createHeuristicMask() function creates and returns a 1-bpp
- heuristic mask (i.e. a QBitmap) for this pixmap. It works by
- selecting a color from one of the corners and then chipping away
- pixels of that color, starting at all the edges. The
- createMaskFromColor() function creates and returns a mask (i.e. a
- QBitmap) for the pixmap based on a given color.
-
+ that is a transformed version of the original:
The scaled(), scaledToWidth() and scaledToHeight() functions
return scaled copies of the pixmap, while the copy() function
@@ -1740,11 +1738,6 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
function returns the actual matrix used for transforming the
pixmap.
- There are also functions for changing attributes of a pixmap.
- in-place: The fill() function fills the entire image with the
- given color, the setMask() function sets a mask bitmap, and the
- setAlphaChannel() function sets the pixmap's alpha channel.
-
\sa QBitmap, QImage, QImageReader, QImageWriter
*/
@@ -1763,7 +1756,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
Returns true if this pixmap has an alpha channel, \e or has a
mask, otherwise returns false.
- \sa hasAlphaChannel(), alphaChannel(), mask()
+ \sa hasAlphaChannel(), mask()
*/
bool QPixmap::hasAlpha() const
{
@@ -1774,7 +1767,7 @@ bool QPixmap::hasAlpha() const
Returns true if the pixmap has a format that respects the alpha
channel, otherwise returns false.
- \sa alphaChannel(), hasAlpha()
+ \sa hasAlpha()
*/
bool QPixmap::hasAlphaChannel() const
{
@@ -1791,6 +1784,7 @@ int QPixmap::metric(PaintDeviceMetric metric) const
/*!
\fn void QPixmap::setAlphaChannel(const QPixmap &alphaChannel)
+ \obsolete
Sets the alpha channel of this pixmap to the given \a alphaChannel
by converting the \a alphaChannel into 32 bit and using the
@@ -1828,6 +1822,8 @@ void QPixmap::setAlphaChannel(const QPixmap &alphaChannel)
}
/*!
+ \obsolete
+
Returns the alpha channel of the pixmap as a new grayscale QPixmap in which
each pixel's red, green, and blue values are given the alpha value of the
original pixmap. The color depth of the returned pixmap is the system depth
@@ -1846,7 +1842,9 @@ void QPixmap::setAlphaChannel(const QPixmap &alphaChannel)
\image alphachannelimage.png The pixmap and channelImage QPixmaps
\warning This is an expensive operation. The alpha channel of the
- pixmap is extracted dynamically from the pixeldata.
+ pixmap is extracted dynamically from the pixeldata. Most usecases of this
+ function are covered by QPainter and compositionModes which will normally
+ execute faster.
\sa setAlphaChannel(), {QPixmap#Pixmap Information}{Pixmap
Information}
@@ -1867,7 +1865,7 @@ QPaintEngine *QPixmap::paintEngine() const
/*!
\fn QBitmap QPixmap::mask() const
- Extracts a bitmap mask from the pixmap's alphachannel.
+ Extracts a bitmap mask from the pixmap's alpha channel.
\warning This is potentially an expensive operation. The mask of
the pixmap is extracted dynamically from the pixeldata.
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 82069d0..ecdcd8c 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -64,7 +64,8 @@ QT_BEGIN_NAMESPACE
access the global pixmap cache. It creates an internal QCache
object for caching the pixmaps.
- The cache associates a pixmap with a string as a key or with a QPixmapCache::Key.
+ The cache associates a pixmap with a user-provided string as a key,
+ or with a QPixmapCache::Key that the cache generates.
Using QPixmapCache::Key for keys is faster than using strings. The string API is
very convenient for complex keys but the QPixmapCache::Key API will be very
efficient and convenient for a one-to-one object-to-pixmap mapping \mdash in
@@ -92,6 +93,17 @@ static int cache_limit = 10240; // 10 MB cache limit for desktop
#endif
/*!
+ \class QPixmapCache::Key
+ \brief The QPixmapCache::Key class can be used for efficient access
+ to the QPixmapCache.
+ \since 4.6
+
+ Use QPixmapCache::insert() to receive an instance of Key generated
+ by the pixmap cache. You can store the key in your own objects for
+ a very efficient one-to-one object-to-pixmap mapping.
+*/
+
+/*!
Constructs an empty Key object.
*/
QPixmapCache::Key::Key() : d(0)
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index b168188..3453408 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -819,6 +819,12 @@ QApplication::QApplication(Display *dpy, int &argc, char **argv,
#endif // Q_WS_X11
extern void qInitDrawhelperAsm();
+extern int qRegisterGuiVariant();
+extern int qUnregisterGuiVariant();
+#ifndef QT_NO_STATEMACHINE
+extern int qRegisterGuiStateMachine();
+extern int qUnregisterGuiStateMachine();
+#endif
/*!
\fn void QApplicationPrivate::initialize()
@@ -832,11 +838,9 @@ void QApplicationPrivate::initialize()
if (qt_appType != QApplication::Tty)
(void) QApplication::style(); // trigger creation of application style
// trigger registering of QVariant's GUI types
- extern int qRegisterGuiVariant();
qRegisterGuiVariant();
#ifndef QT_NO_STATEMACHINE
// trigger registering of QStateMachine's GUI types
- extern int qRegisterGuiStateMachine();
qRegisterGuiStateMachine();
#endif
@@ -1060,11 +1064,9 @@ QApplication::~QApplication()
#ifndef QT_NO_STATEMACHINE
// trigger unregistering of QStateMachine's GUI types
- extern int qUnregisterGuiStateMachine();
qUnregisterGuiStateMachine();
#endif
// trigger unregistering of QVariant's GUI types
- extern int qUnregisterGuiVariant();
qUnregisterGuiVariant();
}
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 3692160..595f220 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -192,99 +192,54 @@ extern "C" {
#endif
#if defined(Q_WS_WIN)
-typedef BOOL (WINAPI *qt_RegisterTouchWindowPtr)(HWND, ULONG);
-typedef BOOL (WINAPI *qt_GetTouchInputInfoPtr)(HANDLE, UINT, PVOID, int);
-typedef BOOL (WINAPI *qt_CloseTouchInputHandlePtr)(HANDLE);
-
-typedef BOOL (WINAPI *PtrGetGestureInfo)(HANDLE hGestureInfo, PVOID pGestureInfo);
-typedef BOOL (WINAPI *PtrGetGestureExtraArgs)(HANDLE hGestureInfo, UINT cbExtraArgs, PBYTE pExtraArgs);
-typedef BOOL (WINAPI *PtrCloseGestureInfoHandle)(HANDLE hGestureInfo);
-typedef BOOL (WINAPI *PtrSetGestureConfig)(HWND hwnd, DWORD dwReserved, UINT cIDs,
- PVOID pGestureConfig,
- UINT cbSize);
-typedef BOOL (WINAPI *PtrGetGestureConfig)(HWND hwnd, DWORD dwReserved,
- DWORD dwFlags, PUINT pcIDs,
- PVOID pGestureConfig,
- UINT cbSize);
-
-typedef BOOL (WINAPI *PtrBeginPanningFeedback)(HWND hwnd);
-typedef BOOL (WINAPI *PtrUpdatePanningFeedback)(HWND hwnd, LONG, LONG, BOOL);
-typedef BOOL (WINAPI *PtrEndPanningFeedback)(HWND hwnd, BOOL);
+typedef BOOL (WINAPI *PtrRegisterTouchWindow)(HWND, ULONG);
+typedef BOOL (WINAPI *PtrGetTouchInputInfo)(HANDLE, UINT, PVOID, int);
+typedef BOOL (WINAPI *PtrCloseTouchInputHandle)(HANDLE);
+
+typedef BOOL (WINAPI *PtrGetGestureInfo)(HANDLE, PVOID);
+typedef BOOL (WINAPI *PtrGetGestureExtraArgs)(HANDLE, UINT, PBYTE);
+typedef BOOL (WINAPI *PtrCloseGestureInfoHandle)(HANDLE);
+typedef BOOL (WINAPI *PtrSetGestureConfig)(HWND, DWORD, UINT, PVOID, UINT);
+typedef BOOL (WINAPI *PtrGetGestureConfig)(HWND, DWORD, DWORD, PUINT, PVOID, UINT);
+
+typedef BOOL (WINAPI *PtrBeginPanningFeedback)(HWND);
+typedef BOOL (WINAPI *PtrUpdatePanningFeedback)(HWND, LONG, LONG, BOOL);
+typedef BOOL (WINAPI *PtrEndPanningFeedback)(HWND, BOOL);
#ifndef WM_GESTURE
+# define WM_GESTURE 0x0119
+
+# define GID_BEGIN 1
+# define GID_END 2
+# define GID_ZOOM 3
+# define GID_PAN 4
+# define GID_ROTATE 5
+# define GID_TWOFINGERTAP 6
+# define GID_ROLLOVER 7
-#define WM_GESTURE 0x0119
-#define WM_GESTURE_NOTIFY 0x011A
-
-DECLARE_HANDLE(HGESTUREINFO);
-
-#define GF_BEGIN 0x00000001
-#define GF_INERTIA 0x00000002
-#define GF_END 0x00000004
-
-/*
- * Gesture IDs
- */
-#define GID_BEGIN 1
-#define GID_END 2
-#define GID_ZOOM 3
-#define GID_PAN 4
-#define GID_ROTATE 5
-#define GID_TWOFINGERTAP 6
-#define GID_ROLLOVER 7
-
-typedef struct tagGESTUREINFO {
- UINT cbSize; // size, in bytes, of this structure (including variable length Args field)
- DWORD dwFlags; // see GF_* flags
- DWORD dwID; // gesture ID, see GID_* defines
- HWND hwndTarget; // handle to window targeted by this gesture
- POINTS ptsLocation; // current location of this gesture
- DWORD dwInstanceID; // internally used
- DWORD dwSequenceID; // internally used
- ULONGLONG ullArguments; // arguments for gestures whose arguments fit in 8 BYTES
- UINT cbExtraArgs; // size, in bytes, of extra arguments, if any, that accompany this gesture
-} GESTUREINFO, *PGESTUREINFO;
-typedef GESTUREINFO const * PCGESTUREINFO;
-
-typedef struct tagGESTURENOTIFYSTRUCT {
- UINT cbSize; // size, in bytes, of this structure
- DWORD dwFlags; // unused
- HWND hwndTarget; // handle to window targeted by the gesture
- POINTS ptsLocation; // starting location
- DWORD dwInstanceID; // internally used
-} GESTURENOTIFYSTRUCT, *PGESTURENOTIFYSTRUCT;
-
-/*
- * Gesture argument helpers
- * - Angle should be a double in the range of -2pi to +2pi
- * - Argument should be an unsigned 16-bit value
- */
-#define GID_ROTATE_ANGLE_TO_ARGUMENT(_arg_) ((USHORT)((((_arg_) + 2.0 * 3.14159265) / (4.0 * 3.14159265)) * 65535.0))
-#define GID_ROTATE_ANGLE_FROM_ARGUMENT(_arg_) ((((double)(_arg_) / 65535.0) * 4.0 * 3.14159265) - 2.0 * 3.14159265)
-
-typedef struct tagGESTURECONFIG {
- DWORD dwID; // gesture ID
- DWORD dwWant; // settings related to gesture ID that are to be turned on
- DWORD dwBlock; // settings related to gesture ID that are to be turned off
-} GESTURECONFIG, *PGESTURECONFIG;
-
-#define GC_ALLGESTURES 0x00000001
-#define GC_ZOOM 0x00000001
-#define GC_PAN 0x00000001
-#define GC_PAN_WITH_SINGLE_FINGER_VERTICALLY 0x00000002
-#define GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY 0x00000004
-#define GC_PAN_WITH_GUTTER 0x00000008
-#define GC_PAN_WITH_INERTIA 0x00000010
-#define GC_ROTATE 0x00000001
-#define GC_TWOFINGERTAP 0x00000001
-#define GC_ROLLOVER 0x00000001
-#define GESTURECONFIGMAXCOUNT 256 // Maximum number of gestures that can be included
- // in a single call to SetGestureConfig / GetGestureConfig
-
-
-
-#define GCF_INCLUDE_ANCESTORS 0x00000001 // If specified, GetGestureConfig returns consolidated configuration
- // for the specified window and it's parent window chain
+typedef struct tagGESTUREINFO
+{
+ UINT cbSize;
+ DWORD dwFlags;
+ DWORD dwID;
+ HWND hwndTarget;
+ POINTS ptsLocation;
+ DWORD dwInstanceID;
+ DWORD dwSequenceID;
+ ULONGLONG ullArguments;
+ UINT cbExtraArgs;
+} GESTUREINFO;
+
+# define GC_PAN 0x00000001
+# define GC_PAN_WITH_SINGLE_FINGER_VERTICALLY 0x00000002
+# define GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY 0x00000004
+
+typedef struct tagGESTURECONFIG
+{
+ DWORD dwID;
+ DWORD dwWant;
+ DWORD dwBlock;
+} GESTURECONFIG;
#endif // WM_GESTURE
@@ -559,9 +514,9 @@ public:
const QList<QTouchEvent::TouchPoint> &touchPoints);
#if defined(Q_WS_WIN)
- static qt_RegisterTouchWindowPtr RegisterTouchWindow;
- static qt_GetTouchInputInfoPtr GetTouchInputInfo;
- static qt_CloseTouchInputHandlePtr CloseTouchInputHandle;
+ static PtrRegisterTouchWindow RegisterTouchWindow;
+ static PtrGetTouchInputInfo GetTouchInputInfo;
+ static PtrCloseTouchInputHandle CloseTouchInputHandle;
QHash<DWORD, int> touchInputIDToTouchPointID;
QList<QTouchEvent::TouchPoint> appAllTouchPoints;
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index cbcac9a..d5c820c 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -3727,7 +3727,7 @@ bool QETWidget::translateGestureEvent(const MSG &msg)
gi.dwSequenceID = 0;
QApplicationPrivate *qAppPriv = getQApplicationPrivateInternal();
- BOOL bResult = qAppPriv->GetGestureInfo((HGESTUREINFO)msg.lParam, &gi);
+ BOOL bResult = qAppPriv->GetGestureInfo((HANDLE)msg.lParam, &gi);
const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos);
@@ -3765,7 +3765,7 @@ bool QETWidget::translateGestureEvent(const MSG &msg)
if (dwErr > 0)
qWarning() << "translateGestureEvent: error = " << dwErr;
}
- qAppPriv->CloseGestureInfoHandle((HGESTUREINFO)msg.lParam);
+ qAppPriv->CloseGestureInfoHandle((HANDLE)msg.lParam);
return true;
}
@@ -3951,17 +3951,17 @@ void QSessionManager::cancel()
#endif //QT_NO_SESSIONMANAGER
-qt_RegisterTouchWindowPtr QApplicationPrivate::RegisterTouchWindow = 0;
-qt_GetTouchInputInfoPtr QApplicationPrivate::GetTouchInputInfo = 0;
-qt_CloseTouchInputHandlePtr QApplicationPrivate::CloseTouchInputHandle = 0;
+PtrRegisterTouchWindow QApplicationPrivate::RegisterTouchWindow = 0;
+PtrGetTouchInputInfo QApplicationPrivate::GetTouchInputInfo = 0;
+PtrCloseTouchInputHandle QApplicationPrivate::CloseTouchInputHandle = 0;
void QApplicationPrivate::initializeMultitouch_sys()
{
QLibrary library(QLatin1String("user32"));
// MinGW (g++ 3.4.5) accepts only C casts.
- RegisterTouchWindow = (qt_RegisterTouchWindowPtr)(library.resolve("RegisterTouchWindow"));
- GetTouchInputInfo = (qt_GetTouchInputInfoPtr)(library.resolve("GetTouchInputInfo"));
- CloseTouchInputHandle = (qt_CloseTouchInputHandlePtr)(library.resolve("CloseTouchInputHandle"));
+ RegisterTouchWindow = (PtrRegisterTouchWindow)(library.resolve("RegisterTouchWindow"));
+ GetTouchInputInfo = (PtrGetTouchInputInfo)(library.resolve("GetTouchInputInfo"));
+ CloseTouchInputHandle = (PtrCloseTouchInputHandle)(library.resolve("CloseTouchInputHandle"));
touchInputIDToTouchPointID.clear();
}
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 76138f8..4016563 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -3246,48 +3246,43 @@ int QApplication::x11ProcessEvent(XEvent* event)
#ifdef ALIEN_DEBUG
//qDebug() << "QApplication::x11ProcessEvent:" << event->type;
#endif
- Time time = 0, userTime = 0;
switch (event->type) {
case ButtonPress:
pressed_window = event->xbutton.window;
- userTime = event->xbutton.time;
+ X11->userTime = event->xbutton.time;
// fallthrough intended
case ButtonRelease:
- time = event->xbutton.time;
+ X11->time = event->xbutton.time;
break;
case MotionNotify:
- time = event->xmotion.time;
+ X11->time = event->xmotion.time;
break;
case XKeyPress:
- userTime = event->xkey.time;
+ X11->userTime = event->xkey.time;
// fallthrough intended
case XKeyRelease:
- time = event->xkey.time;
+ X11->time = event->xkey.time;
break;
case PropertyNotify:
- time = event->xproperty.time;
+ X11->time = event->xproperty.time;
break;
case EnterNotify:
case LeaveNotify:
- time = event->xcrossing.time;
+ X11->time = event->xcrossing.time;
break;
case SelectionClear:
- time = event->xselectionclear.time;
+ X11->time = event->xselectionclear.time;
break;
default:
-#ifndef QT_NO_XFIXES
- if (X11->use_xfixes && event->type == (X11->xfixes_eventbase + XFixesSelectionNotify)) {
- XFixesSelectionNotifyEvent *req =
- reinterpret_cast<XFixesSelectionNotifyEvent *>(event);
- time = req->selection_timestamp;
- }
-#endif
break;
}
- if (time > X11->time)
- X11->time = time;
- if (userTime > X11->userTime)
- X11->userTime = userTime;
+#ifndef QT_NO_XFIXES
+ if (X11->use_xfixes && event->type == (X11->xfixes_eventbase + XFixesSelectionNotify)) {
+ XFixesSelectionNotifyEvent *req =
+ reinterpret_cast<XFixesSelectionNotifyEvent *>(event);
+ X11->time = req->selection_timestamp;
+ }
+#endif
QETWidget *widget = (QETWidget*)QWidget::find((WId)event->xany.window);
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 3e5bfb6..3bc348c 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -1039,7 +1039,7 @@ extern "C" {
- (void) insertText:(id)aString
{
- if ([aString length]) {
+ if ([aString length] && composing) {
// Send the commit string to the widget.
QString commitText;
if ([aString isKindOfClass:[NSAttributedString class]]) {
@@ -1052,7 +1052,14 @@ extern "C" {
QInputMethodEvent e;
e.setCommitString(commitText);
qt_sendSpontaneousEvent(qwidget, &e);
+ } else {
+ // The key sequence "`q" on a French Keyboard will generate two calls to insertText before
+ // it returns from interpretKeyEvents. The first call will turn off 'composing' and accept
+ // the "`" key. The last keyDown event needs to be processed by the widget to get the
+ // character "q". The string parameter is ignored for the second call.
+ sendKeyEvents = true;
}
+
composingText->clear();
}
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 01df47d..ab69cdf 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -60,6 +60,11 @@
#include "qregion.h"
#include "qsizepolicy.h"
#include "qtextformat.h"
+#include "qmatrix4x4.h"
+#include "qvector2d.h"
+#include "qvector3d.h"
+#include "qvector4d.h"
+#include "qquaternion.h"
#include "private/qvariant_p.h"
@@ -148,6 +153,31 @@ static void construct(QVariant::Private *x, const void *copy)
v_construct<QColor>(x, &color);
break;
}
+#ifndef QT_NO_MATRIX4X4
+ case QVariant::Matrix4x4:
+ v_construct<QMatrix4x4>(x, copy);
+ break;
+#endif
+#ifndef QT_NO_VECTOR2D
+ case QVariant::Vector2D:
+ v_construct<QVector2D>(x, copy);
+ break;
+#endif
+#ifndef QT_NO_VECTOR3D
+ case QVariant::Vector3D:
+ v_construct<QVector3D>(x, copy);
+ break;
+#endif
+#ifndef QT_NO_VECTOR4D
+ case QVariant::Vector4D:
+ v_construct<QVector4D>(x, copy);
+ break;
+#endif
+#ifndef QT_NO_QUATERNION
+ case QVariant::Quaternion:
+ v_construct<QQuaternion>(x, copy);
+ break;
+#endif
default:
qcoreVariantHandler()->construct(x, copy);
return;
@@ -221,6 +251,31 @@ static void clear(QVariant::Private *d)
case QVariant::Pen:
v_clear<QPen>(d);
break;
+#ifndef QT_NO_MATRIX4X4
+ case QVariant::Matrix4x4:
+ v_clear<QMatrix4x4>(d);
+ break;
+#endif
+#ifndef QT_NO_VECTOR2D
+ case QVariant::Vector2D:
+ v_clear<QVector2D>(d);
+ break;
+#endif
+#ifndef QT_NO_VECTOR3D
+ case QVariant::Vector3D:
+ v_clear<QVector3D>(d);
+ break;
+#endif
+#ifndef QT_NO_VECTOR4D
+ case QVariant::Vector4D:
+ v_clear<QVector4D>(d);
+ break;
+#endif
+#ifndef QT_NO_QUATERNION
+ case QVariant::Quaternion:
+ v_clear<QVector4D>(d);
+ break;
+#endif
default:
qcoreVariantHandler()->clear(d);
return;
@@ -266,7 +321,26 @@ static bool isNull(const QVariant::Private *d)
case QVariant::KeySequence:
#endif
case QVariant::Pen:
+#ifndef QT_NO_MATRIX4X4
+ case QVariant::Matrix4x4:
+#endif
break;
+#ifndef QT_NO_VECTOR2D
+ case QVariant::Vector2D:
+ return v_cast<QVector2D>(d)->isNull();
+#endif
+#ifndef QT_NO_VECTOR3D
+ case QVariant::Vector3D:
+ return v_cast<QVector3D>(d)->isNull();
+#endif
+#ifndef QT_NO_VECTOR4D
+ case QVariant::Vector4D:
+ return v_cast<QVector4D>(d)->isNull();
+#endif
+#ifndef QT_NO_QUATERNION
+ case QVariant::Quaternion:
+ return v_cast<QQuaternion>(d)->isNull();
+#endif
default:
return qcoreVariantHandler()->isNull(d);
}
@@ -326,6 +400,26 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
#endif
case QVariant::Pen:
return *v_cast<QPen>(a) == *v_cast<QPen>(b);
+#ifndef QT_NO_MATRIX4X4
+ case QVariant::Matrix4x4:
+ return *v_cast<QMatrix4x4>(a) == *v_cast<QMatrix4x4>(b);
+#endif
+#ifndef QT_NO_VECTOR2D
+ case QVariant::Vector2D:
+ return *v_cast<QVector2D>(a) == *v_cast<QVector2D>(b);
+#endif
+#ifndef QT_NO_VECTOR3D
+ case QVariant::Vector3D:
+ return *v_cast<QVector3D>(a) == *v_cast<QVector3D>(b);
+#endif
+#ifndef QT_NO_VECTOR4D
+ case QVariant::Vector4D:
+ return *v_cast<QVector4D>(a) == *v_cast<QVector4D>(b);
+#endif
+#ifndef QT_NO_QUATERNION
+ case QVariant::Quaternion:
+ return *v_cast<QQuaternion>(a) == *v_cast<QQuaternion>(b);
+#endif
default:
break;
}
@@ -513,6 +607,31 @@ static void streamDebug(QDebug dbg, const QVariant &v)
case QVariant::Pen:
dbg.nospace() << qvariant_cast<QPen>(v);
break;
+#ifndef QT_NO_MATRIX4X4
+ case QVariant::Matrix4x4:
+ dbg.nospace() << qvariant_cast<QMatrix4x4>(v);
+ break;
+#endif
+#ifndef QT_NO_VECTOR2D
+ case QVariant::Vector2D:
+ dbg.nospace() << qvariant_cast<QVector2D>(v);
+ break;
+#endif
+#ifndef QT_NO_VECTOR3D
+ case QVariant::Vector3D:
+ dbg.nospace() << qvariant_cast<QVector3D>(v);
+ break;
+#endif
+#ifndef QT_NO_VECTOR4D
+ case QVariant::Vector4D:
+ dbg.nospace() << qvariant_cast<QVector4D>(v);
+ break;
+#endif
+#ifndef QT_NO_QUATERNION
+ case QVariant::Quaternion:
+ dbg.nospace() << qvariant_cast<QQuaternion>(v);
+ break;
+#endif
default:
qcoreVariantHandler()->debugStream(dbg, v);
break;
@@ -596,6 +715,21 @@ Q_DECL_METATYPE_HELPER(QTextLength)
Q_DECL_METATYPE_HELPER(QTextFormat)
Q_DECL_METATYPE_HELPER(QMatrix)
Q_DECL_METATYPE_HELPER(QTransform)
+#ifndef QT_NO_MATRIX4X4
+Q_DECL_METATYPE_HELPER(QMatrix4x4)
+#endif
+#ifndef QT_NO_VECTOR2D
+Q_DECL_METATYPE_HELPER(QVector2D)
+#endif
+#ifndef QT_NO_VECTOR3D
+Q_DECL_METATYPE_HELPER(QVector3D)
+#endif
+#ifndef QT_NO_VECTOR4D
+Q_DECL_METATYPE_HELPER(QVector4D)
+#endif
+#ifndef QT_NO_QUATERNION
+Q_DECL_METATYPE_HELPER(QQuaternion)
+#endif
#ifdef QT_NO_DATASTREAM
# define Q_IMPL_METATYPE_HELPER(TYPE) \
@@ -645,7 +779,32 @@ static const QMetaTypeGuiHelper qVariantGuiHelper[] = {
Q_IMPL_METATYPE_HELPER(QTextLength),
Q_IMPL_METATYPE_HELPER(QTextFormat),
Q_IMPL_METATYPE_HELPER(QMatrix),
- Q_IMPL_METATYPE_HELPER(QTransform)
+ Q_IMPL_METATYPE_HELPER(QTransform),
+#ifndef QT_NO_MATRIX4X4
+ Q_IMPL_METATYPE_HELPER(QMatrix4x4),
+#else
+ {0, 0, 0, 0},
+#endif
+#ifndef QT_NO_VECTOR2D
+ Q_IMPL_METATYPE_HELPER(QVector2D),
+#else
+ {0, 0, 0, 0},
+#endif
+#ifndef QT_NO_VECTOR3D
+ Q_IMPL_METATYPE_HELPER(QVector3D),
+#else
+ {0, 0, 0, 0},
+#endif
+#ifndef QT_NO_VECTOR4D
+ Q_IMPL_METATYPE_HELPER(QVector4D),
+#else
+ {0, 0, 0, 0},
+#endif
+#ifndef QT_NO_QUATERNION
+ Q_IMPL_METATYPE_HELPER(QQuaternion)
+#else
+ {0, 0, 0, 0}
+#endif
};
static const QVariant::Handler *qt_guivariant_last_handler = 0;
diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp
index 017c13c..8eee665 100644
--- a/src/gui/kernel/qkeymapper_mac.cpp
+++ b/src/gui/kernel/qkeymapper_mac.cpp
@@ -729,8 +729,10 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e
QString text(ourChar);
/* This is actually wrong - but unfortunatly it is the best that can be
done for now because of the Control/Meta mapping problems */
- if (modifiers & (Qt::ControlModifier | Qt::MetaModifier))
+ if (modifiers & (Qt::ControlModifier | Qt::MetaModifier)
+ && !qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
text = QString();
+ }
if (widget) {
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
index 99f058b..af3b4cb 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h
+++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
@@ -105,6 +105,8 @@
#include <qpoint.h>
#include "private/qt_mac_p.h"
+struct HIContentBorderMetrics;
+
#ifdef Q_WS_MAC32
typedef struct _NSPoint NSPoint; // Just redefine here so I don't have to pull in all of Cocoa.
#else
@@ -122,7 +124,6 @@ bool macWindowToolbarIsVisible( void * /*OSWindowRef*/ window );
void macWindowSetHasShadow( void * /*OSWindowRef*/ window, bool hasShadow );
void macWindowFlush(void * /*OSWindowRef*/ window);
void macSendToolbarChangeEvent(QWidget *widget);
-struct HIContentBorderMetrics;
void qt_mac_updateContentBorderMetricts(void * /*OSWindowRef */window, const ::HIContentBorderMetrics &metrics);
void * /*NSImage */qt_mac_create_nsimage(const QPixmap &pm);
void qt_mac_update_mouseTracking(QWidget *widget);
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index 88f58c8..b4c54a0 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -1794,6 +1794,51 @@ QDebug operator<<(QDebug dbg, const QMatrix4x4 &m)
#endif
-#endif
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QMatrix4x4 &matrix)
+ \relates QMatrix4x4
+
+ Writes the given \a matrix to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator<<(QDataStream &stream, const QMatrix4x4 &matrix)
+{
+ for (int row = 0; row < 4; ++row)
+ for (int col = 0; col < 4; ++col)
+ stream << double(matrix(row, col));
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QMatrix4x4 &matrix)
+ \relates QMatrix4x4
+
+ Reads a 4x4 matrix from the given \a stream into the given \a matrix
+ and returns a reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QMatrix4x4 &matrix)
+{
+ double x;
+ for (int row = 0; row < 4; ++row) {
+ for (int col = 0; col < 4; ++col) {
+ stream >> x;
+ matrix(row, col) = float(x);
+ }
+ }
+ matrix.inferSpecialType();
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
+#endif // QT_NO_MATRIX4X4
QT_END_NAMESPACE
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index d63de70..f7246bb 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -960,6 +960,11 @@ inline float *QMatrix4x4::data()
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QMatrix4x4 &m);
#endif
+#ifndef QT_NO_DATASTREAM
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QMatrix4x4 &);
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix4x4 &);
+#endif
+
template <int N, int M>
QMatrix4x4 qGenericMatrixToMatrix4x4(const QGenericMatrix<N, M, qreal, float>& matrix)
{
@@ -989,10 +994,6 @@ QGenericMatrix<N, M, qreal, float> qGenericMatrixFromMatrix4x4(const QMatrix4x4&
QT_END_NAMESPACE
-#ifndef QT_NO_MATRIX4X4
-Q_DECLARE_METATYPE(QMatrix4x4)
-#endif
-
QT_END_HEADER
#endif
diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp
index d9d4160..841a4c0 100644
--- a/src/gui/math3d/qquaternion.cpp
+++ b/src/gui/math3d/qquaternion.cpp
@@ -571,6 +571,51 @@ QDebug operator<<(QDebug dbg, const QQuaternion &q)
#endif
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QQuaternion &quaternion)
+ \relates QQuaternion
+
+ Writes the given \a quaternion to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator<<(QDataStream &stream, const QQuaternion &quaternion)
+{
+ stream << double(quaternion.scalar()) << double(quaternion.x())
+ << double(quaternion.y()) << double(quaternion.z());
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QQuaternion &quaternion)
+ \relates QQuaternion
+
+ Reads a quaternion from the given \a stream into the given \a quaternion
+ and returns a reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QQuaternion &quaternion)
+{
+ double scalar, x, y, z;
+ stream >> scalar;
+ stream >> x;
+ stream >> y;
+ stream >> z;
+ quaternion.setScalar(qreal(scalar));
+ quaternion.setX(qreal(x));
+ quaternion.setY(qreal(y));
+ quaternion.setZ(qreal(z));
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
#endif
QT_END_NAMESPACE
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index 6b24a04..55c871d 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -324,14 +324,15 @@ inline QVector4D QQuaternion::toVector4D() const
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QQuaternion &q);
#endif
+#ifndef QT_NO_DATASTREAM
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QQuaternion &);
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QQuaternion &);
#endif
-QT_END_NAMESPACE
-
-#ifndef QT_NO_QUATERNION
-Q_DECLARE_METATYPE(QQuaternion)
#endif
+QT_END_NAMESPACE
+
QT_END_HEADER
#endif
diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp
index b492aa8..28f6b7a 100644
--- a/src/gui/math3d/qvector2d.cpp
+++ b/src/gui/math3d/qvector2d.cpp
@@ -410,6 +410,46 @@ QDebug operator<<(QDebug dbg, const QVector2D &vector)
#endif
-#endif
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QVector2D &vector)
+ \relates QVector2D
+
+ Writes the given \a vector to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator<<(QDataStream &stream, const QVector2D &vector)
+{
+ stream << double(vector.x()) << double(vector.y());
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QVector2D &vector)
+ \relates QVector2D
+
+ Reads a 2D vector from the given \a stream into the given \a vector
+ and returns a reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QVector2D &vector)
+{
+ double x, y;
+ stream >> x;
+ stream >> y;
+ vector.setX(qreal(x));
+ vector.setY(qreal(y));
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
+#endif // QT_NO_VECTOR2D
QT_END_NAMESPACE
diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h
index bb62afe..d473c2f 100644
--- a/src/gui/math3d/qvector2d.h
+++ b/src/gui/math3d/qvector2d.h
@@ -243,14 +243,15 @@ inline QPointF QVector2D::toPointF() const
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QVector2D &vector);
#endif
+#ifndef QT_NO_DATASTREAM
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QVector2D &);
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector2D &);
#endif
-QT_END_NAMESPACE
-
-#ifndef QT_NO_VECTOR2D
-Q_DECLARE_METATYPE(QVector2D)
#endif
+QT_END_NAMESPACE
+
QT_END_HEADER
#endif
diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp
index 95550cd..881f47c 100644
--- a/src/gui/math3d/qvector3d.cpp
+++ b/src/gui/math3d/qvector3d.cpp
@@ -558,6 +558,49 @@ QDebug operator<<(QDebug dbg, const QVector3D &vector)
#endif
-#endif
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QVector3D &vector)
+ \relates QVector3D
+
+ Writes the given \a vector to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator<<(QDataStream &stream, const QVector3D &vector)
+{
+ stream << double(vector.x()) << double(vector.y())
+ << double(vector.z());
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QVector3D &vector)
+ \relates QVector3D
+
+ Reads a 3D vector from the given \a stream into the given \a vector
+ and returns a reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QVector3D &vector)
+{
+ double x, y, z;
+ stream >> x;
+ stream >> y;
+ stream >> z;
+ vector.setX(qreal(x));
+ vector.setY(qreal(y));
+ vector.setZ(qreal(z));
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
+#endif // QT_NO_VECTOR3D
QT_END_NAMESPACE
diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h
index 873b388..7494dcf 100644
--- a/src/gui/math3d/qvector3d.h
+++ b/src/gui/math3d/qvector3d.h
@@ -271,14 +271,15 @@ inline QPointF QVector3D::toPointF() const
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QVector3D &vector);
#endif
+#ifndef QT_NO_DATASTREAM
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QVector3D &);
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector3D &);
#endif
-QT_END_NAMESPACE
-
-#ifndef QT_NO_VECTOR3D
-Q_DECLARE_METATYPE(QVector3D)
#endif
+QT_END_NAMESPACE
+
QT_END_HEADER
#endif
diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp
index 1f7d921..1a84db6 100644
--- a/src/gui/math3d/qvector4d.cpp
+++ b/src/gui/math3d/qvector4d.cpp
@@ -509,6 +509,51 @@ QDebug operator<<(QDebug dbg, const QVector4D &vector)
#endif
-#endif
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QVector4D &vector)
+ \relates QVector4D
+
+ Writes the given \a vector to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator<<(QDataStream &stream, const QVector4D &vector)
+{
+ stream << double(vector.x()) << double(vector.y())
+ << double(vector.z()) << double(vector.w());
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QVector4D &vector)
+ \relates QVector4D
+
+ Reads a 4D vector from the given \a stream into the given \a vector
+ and returns a reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QVector4D &vector)
+{
+ double x, y, z, w;
+ stream >> x;
+ stream >> y;
+ stream >> z;
+ stream >> w;
+ vector.setX(qreal(x));
+ vector.setY(qreal(y));
+ vector.setZ(qreal(z));
+ vector.setW(qreal(w));
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
+#endif // QT_NO_VECTOR4D
QT_END_NAMESPACE
diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h
index dcfd87a..cd61496 100644
--- a/src/gui/math3d/qvector4d.h
+++ b/src/gui/math3d/qvector4d.h
@@ -276,14 +276,15 @@ inline QPointF QVector4D::toPointF() const
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QVector4D &vector);
#endif
+#ifndef QT_NO_DATASTREAM
+Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QVector4D &);
+Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector4D &);
#endif
-QT_END_NAMESPACE
-
-#ifndef QT_NO_VECTOR4D
-Q_DECLARE_METATYPE(QVector4D)
#endif
+QT_END_NAMESPACE
+
QT_END_HEADER
#endif
diff --git a/src/gui/painting/qgraphicssystemfactory.cpp b/src/gui/painting/qgraphicssystemfactory.cpp
index b618d8b..ddc66f3 100644
--- a/src/gui/painting/qgraphicssystemfactory.cpp
+++ b/src/gui/painting/qgraphicssystemfactory.cpp
@@ -64,6 +64,10 @@ QGraphicsSystem *QGraphicsSystemFactory::create(const QString& key)
if (system.isEmpty()) {
system = QLatin1String("opengl");
}
+#elif defined (QT_GRAPHICSSYSTEM_OPENVG)
+ if (system.isEmpty()) {
+ system = QLatin1String("openvg");
+ }
#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN)
if (system.isEmpty()) {
system = QLatin1String("raster");
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 178d519..6735ee6 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -968,8 +968,7 @@ QPdfBaseEngine::QPdfBaseEngine(QPdfBaseEnginePrivate &dd, PaintEngineFeatures f)
void QPdfBaseEngine::drawPoints (const QPointF *points, int pointCount)
{
- Q_D(QPdfBaseEngine);
- if (!points || !d->hasPen)
+ if (!points)
return;
QPainterPath p;
@@ -999,6 +998,12 @@ void QPdfBaseEngine::drawRects (const QRectF *rects, int rectCount)
return;
Q_D(QPdfBaseEngine);
+ if (d->useAlphaEngine) {
+ QAlphaPaintEngine::drawRects(rects, rectCount);
+ if (!continueCall())
+ return;
+ }
+
if (d->clipEnabled && d->allClipped)
return;
if (!d->hasPen && !d->hasBrush)
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 01f19c6..8f88781 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -1745,10 +1745,9 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
int maxWidth = rect.width() - 4;
int minWidth = 4;
- qint64 progress = (qint64)qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar
- double vc6_workaround = ((progress - qint64(bar->minimum)) / qMax(double(1.0), double(qint64(bar->maximum) - qint64(bar->minimum))) * maxWidth);
- int progressBarWidth = (int(vc6_workaround) > minWidth ) ? int(vc6_workaround) : minWidth;
- int width = indeterminate ? maxWidth : progressBarWidth;
+ qreal progress = qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar
+ int progressBarWidth = (progress - bar->minimum) * qreal(maxWidth) / qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum);
+ int width = indeterminate ? maxWidth : qMax(minWidth, progressBarWidth);
bool reverse = (!vertical && (bar->direction == Qt::RightToLeft)) || vertical;
if (inverted)
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 308a0b8..ba28e75 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -2960,6 +2960,9 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
horizontalShift *= -1;
verticalShift *= -1;
}
+ if (tab->shape == QTabBar::RoundedWest || tab->shape == QTabBar::TriangularWest)
+ horizontalShift = -horizontalShift;
+
tr.adjust(0, 0, horizontalShift, verticalShift);
if (selected)
{
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index b6ef4c9..660b4c3 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -2075,8 +2075,8 @@ void QGtkStyle::drawControl(ControlElement element,
}
if (vertical)
rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
- const int progressIndicatorPos = static_cast<int>((bar->progress - qint64(bar->minimum)) /
- qMax(double(1.0), double(qint64(bar->maximum) - qint64(bar->minimum))) * rect.width());
+ const int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) * rect.width() /
+ qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum);
if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.width())
leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height());
if (vertical)
diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp
index cd0bd0a..80c9881 100644
--- a/src/gui/styles/qplastiquestyle.cpp
+++ b/src/gui/styles/qplastiquestyle.cpp
@@ -2571,8 +2571,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
painter->setTransform(m, true);
}
- double vc6_workaround = ((bar->progress - qint64(bar->minimum)) / qMax(double(1.0), double(qint64(bar->maximum) - qint64(bar->minimum))) * rect.width());
- int progressIndicatorPos = int(vc6_workaround);
+ int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) / qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum) * rect.width();
bool flip = (!vertical && (((bar->direction == Qt::RightToLeft) && !inverted)
|| ((bar->direction == Qt::LeftToRight) && inverted))) || (vertical && ((!inverted && !bottomToTop) || (inverted && bottomToTop)));
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 2a590fd..b2ad686 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1245,8 +1245,7 @@ void QTextControlPrivate::keyPressEvent(QKeyEvent *e)
process:
{
QString text = e->text();
- if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t')) &&
- ((e->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)) == Qt::NoModifier)) {
+ if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) {
if (overwriteMode
// no need to call deleteChar() if we have a selection, insertText
// does it already
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index d1067a8..c7f3e97 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -2169,8 +2169,7 @@ void QLineEdit::keyPressEvent(QKeyEvent *event)
if (unknown && !d->readOnly) {
QString t = event->text();
- if (!t.isEmpty() && t.at(0).isPrint() &&
- ((event->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)) == Qt::NoModifier)) {
+ if (!t.isEmpty() && t.at(0).isPrint()) {
insert(t);
#ifndef QT_NO_COMPLETER
d->complete(event->key());
diff --git a/src/gui/widgets/qmdisubwindow.cpp b/src/gui/widgets/qmdisubwindow.cpp
index 24dea37..e8de957 100644
--- a/src/gui/widgets/qmdisubwindow.cpp
+++ b/src/gui/widgets/qmdisubwindow.cpp
@@ -1066,7 +1066,7 @@ void QMdiSubWindowPrivate::createSystemMenu()
addToSystemMenu(CloseAction, QMdiSubWindow::tr("&Close"), SLOT(close()));
actions[CloseAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarCloseButton, 0, q));
#if !defined(QT_NO_SHORTCUT)
- actions[CloseAction]->setShortcut(QKeySequence::Close);
+ actions[CloseAction]->setShortcuts(QKeySequence::Close);
#endif
updateActions();
}
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index 77e98c4..87f6f82 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -1376,8 +1376,9 @@ QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action)
accel = qt_mac_menu_merge_accel(action);
}
}
+ // Show multiple key sequences as part of the menu text.
if (accel.count() > 1)
- text += QLatin1String(" (****)"); //just to denote a multi stroke shortcut
+ text += QLatin1String(" (") + accel.toString(QKeySequence::NativeText) + QLatin1String(")");
QString finalString = qt_mac_removeMnemonics(text);
@@ -1459,14 +1460,15 @@ QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action)
data.whichData |= kMenuItemDataCmdKey;
data.whichData |= kMenuItemDataCmdKeyModifiers;
data.whichData |= kMenuItemDataCmdKeyGlyph;
- if (!accel.isEmpty()) {
+ if (accel.count() == 1) {
qt_mac_get_accel(accel[0], (quint32*)&data.cmdKeyModifiers, (quint32*)&data.cmdKeyGlyph);
if (data.cmdKeyGlyph == 0)
data.cmdKey = (UniChar)accel[0];
}
#else
[item setSubmenu:0];
- if (!accel.isEmpty()) {
+ // No key equivalent set for multiple key QKeySequence.
+ if (accel.count() == 1) {
[item setKeyEquivalent:keySequenceToKeyEqivalent(accel)];
[item setKeyEquivalentModifierMask:keySequenceModifierMask(accel)];
} else {
diff --git a/src/gui/widgets/qprogressbar.cpp b/src/gui/widgets/qprogressbar.cpp
index d168028..6593cd6 100644
--- a/src/gui/widgets/qprogressbar.cpp
+++ b/src/gui/widgets/qprogressbar.cpp
@@ -443,11 +443,11 @@ QSize QProgressBar::minimumSizeHint() const
QString QProgressBar::text() const
{
Q_D(const QProgressBar);
- if (d->maximum == 0 || d->value < d->minimum
+ if ((d->maximum == 0 && d->minimum == 0) || d->value < d->minimum
|| (d->value == INT_MIN && d->minimum == INT_MIN))
return QString();
- qint64 totalSteps = qint64(d->maximum) - qint64(d->minimum);
+ qint64 totalSteps = qint64(d->maximum) - d->minimum;
QString result = d->format;
result.replace(QLatin1String("%m"), QString::number(totalSteps));
@@ -461,7 +461,7 @@ QString QProgressBar::text() const
return result;
}
- int progress = int(((qreal(d->value) - qreal(d->minimum)) * 100.0) / totalSteps);
+ int progress = (qreal(d->value) - d->minimum) * 100.0 / totalSteps;
result.replace(QLatin1String("%p"), QString::number(progress));
return result;
}