diff --git a/src/3rdparty/xorg/wacomcfg.h b/src/3rdparty/xorg/wacomcfg.h deleted file mode 100644 index 03528df82..000000000 --- a/src/3rdparty/xorg/wacomcfg.h +++ /dev/null @@ -1,138 +0,0 @@ -/***************************************************************************** -** wacomcfg.h -** -** Copyright (C) 2003 - John E. Joganic -** Copyright (C) 2004-2008 - Ping Cheng -** -** This program is free software; you can redistribute it and/or -** modify it under the terms of the GNU Lesser General Public License -** as published by the Free Software Foundation; either version 2 -** of the License, or (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU Lesser General Public License for more details. -** -** You should have received a copy of the GNU Lesser General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -** -****************************************************************************/ - -#ifndef __LINUXWACOM_WACOMCFG_H -#define __LINUXWACOM_WACOMCFG_H - -#include -#include -#include - -/* JEJ - NOTE WE DO NOT INCLUDE Xwacom.h HERE. THIS ELIMINATES A CONFLICT - * WHEN THIS FILE IS INSTALLED SINCE Xwacom.h WILL IN MANY CASES NOT - * GO WITH IT. SOMEDAY IT MAY BE PART OF XFREE86. */ - -typedef struct _WACOMCONFIG WACOMCONFIG; -typedef struct _WACOMDEVICE WACOMDEVICE; -typedef void (*WACOMERRORFUNC)(int err, const char* pszText); -typedef struct _WACOMDEVICEINFO WACOMDEVICEINFO; - -typedef enum -{ - WACOMDEVICETYPE_UNKNOWN, - WACOMDEVICETYPE_CURSOR, - WACOMDEVICETYPE_STYLUS, - WACOMDEVICETYPE_ERASER, - WACOMDEVICETYPE_PAD, - WACOMDEVICETYPE_TOUCH, - WACOMDEVICETYPE_MAX -} WACOMDEVICETYPE; - -struct _WACOMDEVICEINFO -{ - const char* pszName; - WACOMDEVICETYPE type; -}; - -struct _WACOMCONFIG -{ - Display* pDisp; - WACOMERRORFUNC pfnError; - XDeviceInfo * pDevs; - int nDevCnt; -}; - -struct _WACOMDEVICE -{ - WACOMCONFIG* pCfg; - XDevice* pDev; -}; - - -/***************************************************************************** -** Functions -*****************************************************************************/ - -WACOMCONFIG * WacomConfigInit(Display* pDisplay, WACOMERRORFUNC pfnErrorHandler); -/* Initializes configuration library. - * pDisplay - display to configure - * pfnErrorHandler - handler to which errors are reported; may be NULL - * Returns WACOMCONFIG handle on success, NULL on error. - * errno contains error code. */ - -void WacomConfigTerm(WACOMCONFIG * hConfig); -/* Terminates configuration library, releasing display. */ - -int WacomConfigListDevices(WACOMCONFIG * hConfig, WACOMDEVICEINFO** ppInfo, - unsigned int* puCount); -/* Returns a list of wacom devices. - * ppInfo - pointer to WACOMDEVICEINFO* to receive device data - * puSize - pointer to receive device count - * Returns 0 on success, -1 on failure. errno contains error code. - * Comments: You must free this structure using WacomConfigFree. */ - -WACOMDEVICE * WacomConfigOpenDevice(WACOMCONFIG * hConfig, - const char* pszDeviceName); -/* Open a device by name. - * pszDeviceName - name of XInput device corresponding to wacom device - * Returns handle to device on success, NULL on error. - * errno contains error code. - * Comments: Close using WacomConfigCloseDevice */ - -int WacomConfigCloseDevice(WACOMDEVICE * hDevice); -/* Closes a device. - * Returns 0 on success, -1 on error. errno contains error code. */ - -int WacomConfigSetRawParam(WACOMDEVICE * hDevice, int nParam, int nValue, unsigned * keys); -/* Sets the raw device parameter to specified value. - * nParam - valid paramters can be found Xwacom.h which is not - * automatically included. - * nValue - 32 bit integer value - * keys - an array of keys and modifiers - * Returns 0 on success, -1 on error. errno contains error code. - * EINVAL - invalid parameter or value - * EIO - unknown X failure, use XSetErrorHandler to capture complete - * error code and message - * Comments: Data is sent to wacom_drv module without any error checking. - * Generally, you should use the more specific handler functions in this - * library, but for some parameters, particularly experimental ones, you - * will probably have to set them directly. */ - -int WacomConfigGetRawParam(WACOMDEVICE *hDevice, int nParam, int *nValue, int valu, unsigned * keys); -/* Gets the raw device parameter. - * nParam - valid paramters can be found Xwacom.h which is not - * automatically included. - * nValue - the device parameter is returned in the integer - * pointed by this parameter. - * valu - calling valuator value: 1: Get 3: GetDefault - * keys - an array of keys and modifiers - * Returns 0 on success, -1 on error. errno contains error code. - * EINVAL - invalid parameter or value - * EIO - unknown X failure, use XSetErrorHandler to capture complete - * error code and message - */ - -void WacomConfigFree(void* pvData); -/* Frees memory allocated by library. */ - -#endif /* __LINUXWACOM_WACOMCFG_H */ - diff --git a/src/core/global/qconfig.h.cmake b/src/core/global/qconfig.h.cmake index f1faaee21..5ab9bede9 100644 --- a/src/core/global/qconfig.h.cmake +++ b/src/core/global/qconfig.h.cmake @@ -87,6 +87,8 @@ #define QT_NO_SOUND #define QT_NO_EGL #define QT_NO_OPENGL +#define QT_NO_TABLET +#define QT_NO_TABLETEVENT /* Qt build specs */ #ifndef QT_EDITION @@ -300,8 +302,6 @@ #cmakedefine QT_NO_SYSTEMSEMAPHORE #cmakedefine QT_NO_SYSTEMTRAYICON #cmakedefine QT_NO_TABBAR -#cmakedefine QT_NO_TABLET -#cmakedefine QT_NO_TABLETEVENT #cmakedefine QT_NO_TABLEVIEW #cmakedefine QT_NO_TABLEWIDGET #cmakedefine QT_NO_TABWIDGET diff --git a/src/core/kernel/qcoreevent.cpp b/src/core/kernel/qcoreevent.cpp index 71e5acd74..227fd5f3d 100644 --- a/src/core/kernel/qcoreevent.cpp +++ b/src/core/kernel/qcoreevent.cpp @@ -193,11 +193,6 @@ QT_BEGIN_NAMESPACE \value StateMachineWrapped The event is a wrapper for, i.e., contains, another event (QStateMachine::WrappedEvent). \value StatusTip A status tip is requested (QStatusTipEvent). \value StyleChange Widget's style has been changed. - \value TabletMove Wacom tablet move (QTabletEvent). - \value TabletPress Wacom tablet press (QTabletEvent). - \value TabletRelease Wacom tablet release (QTabletEvent). - \value TabletEnterProximity Wacom tablet enter proximity event (QTabletEvent), sent to QApplication. - \value TabletLeaveProximity Wacom tablet leave proximity event (QTabletEvent), sent to QApplication. \value Timer Regular timer events (QTimerEvent). \value ToolBarChange The toolbar button is toggled on Mac OS X. \value ToolTip A tooltip was requested (QHelpEvent). diff --git a/src/core/kernel/qcoreevent.h b/src/core/kernel/qcoreevent.h index fb6e6c207..5b9cfa977 100644 --- a/src/core/kernel/qcoreevent.h +++ b/src/core/kernel/qcoreevent.h @@ -122,132 +122,126 @@ public: ContextMenu = 55, // context popup menu AccessibilityPrepare = 56, // accessibility information is requested - TabletMove = 57, // Wacom tablet event - LocaleChange = 58, // the system locale changed - LanguageChange = 59, // the application language changed - LayoutDirectionChange = 60, // the layout direction changed - Style = 61, // internal style event - TabletPress = 62, // tablet press - TabletRelease = 63, // tablet release + LocaleChange = 57, // the system locale changed + LanguageChange = 58, // the application language changed + LayoutDirectionChange = 59, // the layout direction changed + Style = 60, // internal style event - IconDrag = 64, // proxy icon dragged + IconDrag = 61, // proxy icon dragged - FontChange = 65, // font has changed - EnabledChange = 66, // enabled state has changed - ActivationChange = 67, // window activation has changed - StyleChange = 68, // style has changed - IconTextChange = 69, // icon text has changed - ModifiedChange = 70, // modified state has changed - MouseTrackingChange = 71, // mouse tracking state has changed + FontChange = 62, // font has changed + EnabledChange = 63, // enabled state has changed + ActivationChange = 64, // window activation has changed + StyleChange = 65, // style has changed + IconTextChange = 66, // icon text has changed + ModifiedChange = 67, // modified state has changed + MouseTrackingChange = 68, // mouse tracking state has changed - WindowBlocked = 72, // window is about to be blocked modally - WindowUnblocked = 73, // windows modal blocking has ended - WindowStateChange = 74, + WindowBlocked = 69, // window is about to be blocked modally + WindowUnblocked = 70, // windows modal blocking has ended + WindowStateChange = 71, - ToolTip = 75, - WhatsThis = 76, - StatusTip = 77, + ToolTip = 72, + WhatsThis = 73, + StatusTip = 74, - ActionChanged = 78, - ActionAdded = 79, - ActionRemoved = 80, + ActionChanged = 75, + ActionAdded = 76, + ActionRemoved = 77, - FileOpen = 81, // file open request + FileOpen = 78, // file open request - Shortcut = 82, // shortcut triggered - ShortcutOverride = 83, // shortcut override request + Shortcut = 79, // shortcut triggered + ShortcutOverride = 80, // shortcut override request - WhatsThisClicked = 84, + WhatsThisClicked = 81, - ToolBarChange = 85, // toolbar visibility toggled + ToolBarChange = 82, // toolbar visibility toggled - ApplicationActivate = 86, // application has been changed to active - ApplicationDeactivate = 87, // application has been changed to inactive + ApplicationActivate = 83, // application has been changed to active + ApplicationDeactivate = 84, // application has been changed to inactive - QueryWhatsThis = 88, // query what's this widget help - EnterWhatsThisMode = 89, - LeaveWhatsThisMode = 90, + QueryWhatsThis = 85, // query what's this widget help + EnterWhatsThisMode = 86, + LeaveWhatsThisMode = 87, - ZOrderChange = 91, // child widget has had its z-order changed + ZOrderChange = 88, // child widget has had its z-order changed - HoverEnter = 92, // mouse cursor enters a hover widget - HoverLeave = 93, // mouse cursor leaves a hover widget - HoverMove = 94, // mouse cursor move inside a hover widget + HoverEnter = 89, // mouse cursor enters a hover widget + HoverLeave = 90, // mouse cursor leaves a hover widget + HoverMove = 91, // mouse cursor move inside a hover widget - AccessibilityHelp = 95, // accessibility help text request - AccessibilityDescription = 96, // accessibility description text request + AccessibilityHelp = 92, // accessibility help text request + AccessibilityDescription = 93, // accessibility description text request #ifdef QT_KEYPAD_NAVIGATION - EnterEditFocus = 97, // enter edit mode in keypad navigation (Defined only with QT_KEYPAD_NAVIGATION) - LeaveEditFocus = 98, // leave edit mode in keypad navigation (Defined only with QT_KEYPAD_NAVIGATION) + EnterEditFocus = 94, // enter edit mode in keypad navigation (Defined only with QT_KEYPAD_NAVIGATION) + LeaveEditFocus = 95, // leave edit mode in keypad navigation (Defined only with QT_KEYPAD_NAVIGATION) #endif - AcceptDropsChange = 99, + AcceptDropsChange = 96, - GraphicsSceneMouseMove = 100, // GraphicsView - GraphicsSceneMousePress = 101, - GraphicsSceneMouseRelease = 102, - GraphicsSceneMouseDoubleClick = 103, - GraphicsSceneContextMenu = 104, - GraphicsSceneHoverEnter = 105, - GraphicsSceneHoverMove = 106, - GraphicsSceneHoverLeave = 107, - GraphicsSceneHelp = 108, - GraphicsSceneDragEnter = 109, - GraphicsSceneDragMove = 110, - GraphicsSceneDragLeave = 111, - GraphicsSceneDrop = 112, - GraphicsSceneWheel = 113, + GraphicsSceneMouseMove = 97, // GraphicsView + GraphicsSceneMousePress = 98, + GraphicsSceneMouseRelease = 99, + GraphicsSceneMouseDoubleClick = 100, + GraphicsSceneContextMenu = 101, + GraphicsSceneHoverEnter = 102, + GraphicsSceneHoverMove = 103, + GraphicsSceneHoverLeave = 104, + GraphicsSceneHelp = 105, + GraphicsSceneDragEnter = 106, + GraphicsSceneDragMove = 107, + GraphicsSceneDragLeave = 108, + GraphicsSceneDrop = 109, + GraphicsSceneWheel = 110, - KeyboardLayoutChange = 114, // keyboard layout changed + KeyboardLayoutChange = 111, // keyboard layout changed - DynamicPropertyChange = 115, // A dynamic property was changed through setProperty/property + DynamicPropertyChange = 112, // A dynamic property was changed through setProperty/property - TabletEnterProximity = 116, - TabletLeaveProximity = 117, + NonClientAreaMouseMove = 113, + NonClientAreaMouseButtonPress = 114, + NonClientAreaMouseButtonRelease = 115, + NonClientAreaMouseButtonDblClick = 116, - NonClientAreaMouseMove = 118, - NonClientAreaMouseButtonPress = 119, - NonClientAreaMouseButtonRelease = 120, - NonClientAreaMouseButtonDblClick = 121, + ContentsRectChange = 117, // sent by QWidget::setContentsMargins (internal) - ContentsRectChange = 122, // sent by QWidget::setContentsMargins (internal) + FutureCallOut = 118, - FutureCallOut = 123, + GraphicsSceneResize = 119, + GraphicsSceneMove = 120, - GraphicsSceneResize = 124, - GraphicsSceneMove = 125, + CursorChange = 121, + ToolTipChange = 122, - CursorChange = 126, - ToolTipChange = 127, + NetworkReplyUpdated = 123, // Internal for QNetworkReply - NetworkReplyUpdated = 128, // Internal for QNetworkReply + GrabMouse = 124, + UngrabMouse = 125, + GrabKeyboard = 126, + UngrabKeyboard = 127, - GrabMouse = 129, - UngrabMouse = 130, - GrabKeyboard = 131, - UngrabKeyboard = 132, + StateMachineSignal = 128, + StateMachineWrapped = 129, - StateMachineSignal = 133, - StateMachineWrapped = 134, - - TouchBegin = 135, - TouchUpdate = 136, - TouchEnd = 137, + TouchBegin = 130, + TouchUpdate = 131, + TouchEnd = 132, #ifndef QT_NO_GESTURES - NativeGesture = 138, // Internal for platform gesture support + NativeGesture = 133, // Internal for platform gesture support #endif - RequestSoftwareInputPanel = 139, - CloseSoftwareInputPanel = 140, + RequestSoftwareInputPanel = 134, + CloseSoftwareInputPanel = 135, - WinIdChange = 141, + WinIdChange = 136, #ifndef QT_NO_GESTURES - Gesture = 142, - GestureOverride = 143, + Gesture = 137, + GestureOverride = 138, #endif - PlatformPanel = 144, + PlatformPanel = 139, User = 1000, // first user event id MaxUser = 65535 // last user event id diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index bfa9f9f56..54b25724c 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -260,12 +260,9 @@ set(GUI_PUBLIC_HEADERS QStylePlugin QSupportedWritingSystems QSwipeGesture - QSymbianEvent - QSymbianGraphicsSystemHelper QSyntaxHighlighter QSystemTrayIcon QTabBar - QTabletEvent QTableView QTableWidget QTableWidgetItem diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index 81d8b2f8a..43524e46a 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -209,7 +209,6 @@ protected: virtual void polishEvent(); virtual void resizeEvent(QGraphicsSceneResizeEvent *event); virtual void showEvent(QShowEvent *event); - //virtual void tabletEvent(QTabletEvent *event); //virtual bool x11Event(XEvent *event); virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index dbb365340..85ae44299 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -3323,22 +3323,13 @@ bool QApplication::notify(QObject *receiver, QEvent *e) QApplicationPrivate::mouse_buttons |= me->button(); else QApplicationPrivate::mouse_buttons &= ~me->button(); - } -#if !defined(QT_NO_WHEELEVENT) || !defined(QT_NO_TABLETEVENT) - else if (false -# ifndef QT_NO_WHEELEVENT - || e->type() == QEvent::Wheel -# endif -# ifndef QT_NO_TABLETEVENT - || e->type() == QEvent::TabletMove - || e->type() == QEvent::TabletPress - || e->type() == QEvent::TabletRelease -# endif - ) { + } +#ifndef QT_NO_WHEELEVENT + else if (e->type() == QEvent::Wheel) { QInputEvent *ie = static_cast(e); QApplicationPrivate::modifier_buttons = ie->modifiers(); } -#endif // !QT_NO_WHEELEVENT || !QT_NO_TABLETEVENT +#endif // !QT_NO_WHEELEVENT } #ifndef QT_NO_GESTURES @@ -3632,38 +3623,6 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } break; #endif // QT_NO_CONTEXTMENU -#ifndef QT_NO_TABLETEVENT - case QEvent::TabletMove: - case QEvent::TabletPress: - case QEvent::TabletRelease: - { - QWidget *w = static_cast(receiver); - QTabletEvent *tablet = static_cast(e); - QPoint relpos = tablet->pos(); - bool eventAccepted = tablet->isAccepted(); - while (w) { - QTabletEvent te(tablet->type(), relpos, tablet->globalPos(), - tablet->hiResGlobalPos(), tablet->device(), tablet->pointerType(), - tablet->pressure(), tablet->xTilt(), tablet->yTilt(), - tablet->tangentialPressure(), tablet->rotation(), tablet->z(), - tablet->modifiers(), tablet->uniqueId()); - te.spont = e->spontaneous(); - res = d->notify_helper(w, w == receiver ? tablet : &te); - eventAccepted = ((w == receiver) ? tablet : &te)->isAccepted(); - e->spont = false; - if ((res && eventAccepted) - || w->isWindow() - || w->testAttribute(Qt::WA_NoMousePropagation)) - break; - - relpos += w->pos(); - w = w->parentWidget(); - } - tablet->setAccepted(eventAccepted); - qt_tabletChokeMouse = tablet->isAccepted(); - } - break; -#endif // QT_NO_TABLETEVENT #if !defined(QT_NO_TOOLTIP) || !defined(QT_NO_WHATSTHIS) case QEvent::ToolTip: diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 1869b0c00..4ceef18e4 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -87,68 +87,6 @@ extern bool qt_is_gui_used; extern QClipboard *qt_clipboard; #endif -#ifndef QT_NO_TABLET -struct QTabletDeviceData -{ - int minPressure; - int maxPressure; - int minTanPressure; - int maxTanPressure; - int minX, maxX, minY, maxY, minZ, maxZ; - inline QPointF scaleCoord(int coordX, int coordY, int outOriginX, int outExtentX, - int outOriginY, int outExtentY) const; - -#if defined(Q_WS_X11) - QPointer widgetToGetPress; - - int deviceType; - enum { - TOTAL_XINPUT_EVENTS = 64 - }; - void *device; - int eventCount; - long unsigned int eventList[TOTAL_XINPUT_EVENTS]; // XEventClass is in fact a long unsigned int - - int xinput_motion; - int xinput_key_press; - int xinput_key_release; - int xinput_button_press; - int xinput_button_release; - int xinput_proximity_in; - int xinput_proximity_out; -#endif -}; - -static inline int sign(int x) -{ - return x >= 0 ? 1 : -1; -} - -inline QPointF QTabletDeviceData::scaleCoord(int coordX, int coordY, - int outOriginX, int outExtentX, - int outOriginY, int outExtentY) const -{ - QPointF ret; - - if (sign(outExtentX) == sign(maxX)) - ret.setX(((coordX - minX) * qAbs(outExtentX) / qAbs(qreal(maxX - minX))) + outOriginX); - else - ret.setX(((qAbs(maxX) - (coordX - minX)) * qAbs(outExtentX) / qAbs(qreal(maxX - minX))) - + outOriginX); - - if (sign(outExtentY) == sign(maxY)) - ret.setY(((coordY - minY) * qAbs(outExtentY) / qAbs(qreal(maxY - minY))) + outOriginY); - else - ret.setY(((qAbs(maxY) - (coordY - minY)) * qAbs(outExtentY) / qAbs(qreal(maxY - minY))) - + outOriginY); - - return ret; -} - -typedef QList QTabletDeviceDataList; -QTabletDeviceDataList *qt_tablet_devices(); -#endif - typedef QHash FontHash; FontHash *qt_app_fonts_hash(); diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 33da07d7a..ce810c611 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -79,14 +79,6 @@ #include "qkde_p.h" #include "qthread_p.h" -#if !defined(QT_NO_TABLET) -extern "C" { -# define class c_class //XIproto.h has a name member named 'class' which the c++ compiler doesn't like -# include -# undef class -} -#endif - #ifndef QT_GUI_DOUBLE_CLICK_RADIUS #define QT_GUI_DOUBLE_CLICK_RADIUS 5 #endif @@ -299,16 +291,6 @@ static const char * x11_atomnames = { // XEMBED "_XEMBED\0" "_XEMBED_INFO\0" - - // Wacom old. (before version 0.10) - "Wacom Stylus\0" - "Wacom Cursor\0" - "Wacom Eraser\0" - - // Tablet - "STYLUS\0" - "ERASER\0" - "TABLET\0" }; Q_GUI_EXPORT QX11Data *qt_x11Data = 0; @@ -371,16 +353,6 @@ bool qt_sm_blockUserInput = false; // session management Q_GUI_EXPORT int qt_xfocusout_grab_counter = 0; -#if !defined (QT_NO_TABLET) -Q_GLOBAL_STATIC(QTabletDeviceDataList, tablet_devices) -QTabletDeviceDataList *qt_tablet_devices() -{ - return tablet_devices(); -} - -extern bool qt_tabletChokeMouse; -#endif - typedef bool(*QX11FilterFunction)(XEvent *event); Q_GLOBAL_STATIC(QList, x11Filters) @@ -476,9 +448,6 @@ public: bool translateScrollDoneEvent(const XEvent *); bool translateWheelEvent(int global_x, int global_y, int delta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::Orientation orient); -#if !defined (QT_NO_TABLET) - bool translateXinputEvent(const XEvent*, QTabletDeviceData *tablet); -#endif bool translatePropertyEvent(const XEvent *); void doDeferredMap() @@ -1420,27 +1389,6 @@ static void qt_check_focus_model() X11->focus_model = QX11Data::FM_Other; } -#ifndef QT_NO_TABLET - -// from include/Xwacom.h -# define XWACOM_PARAM_TOOLID 322 -# define XWACOM_PARAM_TOOLSERIAL 323 - -typedef WACOMCONFIG * (*PtrWacomConfigInit) (Display*, WACOMERRORFUNC); -typedef WACOMDEVICE * (*PtrWacomConfigOpenDevice) (WACOMCONFIG*, const char*); -typedef int *(*PtrWacomConfigGetRawParam) (WACOMDEVICE*, int, int*, int, unsigned*); -typedef int (*PtrWacomConfigCloseDevice) (WACOMDEVICE *); -typedef void (*PtrWacomConfigTerm) (WACOMCONFIG *); - -static PtrWacomConfigInit ptrWacomConfigInit = 0; -static PtrWacomConfigOpenDevice ptrWacomConfigOpenDevice = 0; -static PtrWacomConfigGetRawParam ptrWacomConfigGetRawParam = 0; -static PtrWacomConfigCloseDevice ptrWacomConfigCloseDevice = 0; -static PtrWacomConfigTerm ptrWacomConfigTerm = 0; -Q_GLOBAL_STATIC(QByteArray, wacomDeviceName) - -#endif - /***************************************************************************** qt_init() - initializes Qt for X11 *****************************************************************************/ @@ -2103,138 +2051,6 @@ void qt_init(QApplicationPrivate *priv, int, QApplicationPrivate::setSystemFont(f); } -#if !defined (QT_NO_TABLET) - if (X11->use_xinput) { - int ndev, - i, - j; - bool gotStylus, gotEraser; - XDeviceInfo *devices = 0, *devs; - XInputClassInfo *ip; - XAnyClassPtr any; - XValuatorInfoPtr v; - XAxisInfoPtr a; - XDevice *dev = 0; - - devices = XListInputDevices(X11->display, &ndev); - if (!devices) { - qWarning("QApplication: Failed to get list of tablet devices"); - ndev = -1; - } - - QTabletEvent::TabletDevice deviceType; - for (devs = devices, i = 0; i < ndev && devs; i++, devs++) { - dev = 0; - deviceType = QTabletEvent::NoDevice; - gotStylus = false; - gotEraser = false; - - // qDebug() << "found input device" << devs->name << "type" << devs->type << XGetAtomName(X11->display, devs->type); - if (devs->type == ATOM(XWacomStylus) || devs->type == ATOM(XTabletStylus) || devs->type == ATOM(XTablet)) { - deviceType = QTabletEvent::Stylus; - if (wacomDeviceName()->isEmpty()) - wacomDeviceName()->append(devs->name); - gotStylus = true; - } else if (devs->type == ATOM(XWacomEraser) || devs->type == ATOM(XTabletEraser)) { - deviceType = QTabletEvent::XFreeEraser; - gotEraser = true; - } - if (deviceType == QTabletEvent::NoDevice) - continue; - - if (gotStylus || gotEraser) { - dev = XOpenDevice(X11->display, devs->id); - - if (!dev) - continue; - - QTabletDeviceData device_data; - device_data.deviceType = deviceType; - device_data.eventCount = 0; - device_data.device = dev; - device_data.xinput_motion = -1; - device_data.xinput_key_press = -1; - device_data.xinput_key_release = -1; - device_data.xinput_button_press = -1; - device_data.xinput_button_release = -1; - device_data.xinput_proximity_in = -1; - device_data.xinput_proximity_out = -1; - device_data.widgetToGetPress = 0; - - if (dev->num_classes > 0) { - for (ip = dev->classes, j = 0; j < dev->num_classes; - ip++, j++) { - switch (ip->input_class) { - case KeyClass: - DeviceKeyPress(dev, device_data.xinput_key_press, - device_data.eventList[device_data.eventCount]); - if (device_data.eventList[device_data.eventCount]) - ++device_data.eventCount; - DeviceKeyRelease(dev, device_data.xinput_key_release, - device_data.eventList[device_data.eventCount]); - if (device_data.eventList[device_data.eventCount]) - ++device_data.eventCount; - break; - case ButtonClass: - DeviceButtonPress(dev, device_data.xinput_button_press, - device_data.eventList[device_data.eventCount]); - if (device_data.eventList[device_data.eventCount]) - ++device_data.eventCount; - DeviceButtonRelease(dev, device_data.xinput_button_release, - device_data.eventList[device_data.eventCount]); - if (device_data.eventList[device_data.eventCount]) - ++device_data.eventCount; - break; - case ValuatorClass: - // I'm only going to be interested in motion when the - // stylus is already down anyway! - DeviceMotionNotify(dev, device_data.xinput_motion, - device_data.eventList[device_data.eventCount]); - if (device_data.eventList[device_data.eventCount]) - ++device_data.eventCount; - ProximityIn(dev, device_data.xinput_proximity_in, device_data.eventList[device_data.eventCount]); - if (device_data.eventList[device_data.eventCount]) - ++device_data.eventCount; - ProximityOut(dev, device_data.xinput_proximity_out, device_data.eventList[device_data.eventCount]); - if (device_data.eventList[device_data.eventCount]) - ++device_data.eventCount; - default: - break; - } - } - } - - // get the min/max value for pressure! - any = (XAnyClassPtr) (devs->inputclassinfo); - for (j = 0; j < devs->num_classes; j++) { - if (any->c_class == ValuatorClass) { - v = (XValuatorInfoPtr) any; - a = (XAxisInfoPtr) ((char *) v + - sizeof (XValuatorInfo)); - device_data.minX = a[0].min_value; - device_data.maxX = a[0].max_value; - device_data.minY = a[1].min_value; - device_data.maxY = a[1].max_value; - device_data.minPressure = a[2].min_value; - device_data.maxPressure = a[2].max_value; - device_data.minTanPressure = 0; - device_data.maxTanPressure = 0; - device_data.minZ = 0; - device_data.maxZ = 0; - - // got the max pressure no need to go further... - break; - } - any = (XAnyClassPtr) ((char *) any + any->length); - } // end of for loop - - tablet_devices()->append(device_data); - } // if (gotStylus || gotEraser) - } - XFreeDeviceList(devices); - } -#endif // QT_NO_TABLET - X11->startupId = getenv("DESKTOP_STARTUP_ID"); if (X11->startupId) { #ifndef QT_NO_UNSETENV @@ -2275,26 +2091,6 @@ void qt_init(QApplicationPrivate *priv, int, settings.endGroup(); // Qt } } - -#if !defined (QT_NO_TABLET) - QLibrary wacom(QString::fromLatin1("wacomcfg"), 0); // version 0 is the latest release at time of writing this. - wacom.setLoadHints(QLibrary::ImprovedSearchHeuristics); - // NOTE: C casts instead of reinterpret_cast for GCC 3.3.x - ptrWacomConfigInit = (PtrWacomConfigInit)wacom.resolve("WacomConfigInit"); - ptrWacomConfigOpenDevice = (PtrWacomConfigOpenDevice)wacom.resolve("WacomConfigOpenDevice"); - ptrWacomConfigGetRawParam = (PtrWacomConfigGetRawParam)wacom.resolve("WacomConfigGetRawParam"); - ptrWacomConfigCloseDevice = (PtrWacomConfigCloseDevice)wacom.resolve("WacomConfigCloseDevice"); - ptrWacomConfigTerm = (PtrWacomConfigTerm)wacom.resolve("WacomConfigTerm"); - - if (ptrWacomConfigInit == 0 || ptrWacomConfigOpenDevice == 0 || ptrWacomConfigGetRawParam == 0 - || ptrWacomConfigCloseDevice == 0 || ptrWacomConfigTerm == 0) { // either we have all, or we have none. - ptrWacomConfigInit = 0; - ptrWacomConfigOpenDevice = 0; - ptrWacomConfigGetRawParam = 0; - ptrWacomConfigCloseDevice = 0; - ptrWacomConfigTerm = 0; - } -#endif } /***************************************************************************** @@ -2308,13 +2104,6 @@ void qt_cleanup() QCursorData::cleanup(); QFont::cleanup(); QColormap::cleanup(); - -#if !defined (QT_NO_TABLET) - QTabletDeviceDataList *devices = qt_tablet_devices(); - for (int i = 0; i < devices->size(); ++i) - XCloseDevice(X11->display, (XDevice*)devices->at(i).device); - devices->clear(); -#endif } #ifndef QT_NO_XRENDER @@ -2900,22 +2689,6 @@ int QApplication::x11ProcessEvent(XEvent* event) if (widget->x11Event(event)) // send through widget filter return 1; -#if !defined (QT_NO_TABLET) - if (!qt_xdnd_dragging) { - QTabletDeviceDataList *tablets = qt_tablet_devices(); - for (int i = 0; i < tablets->size(); ++i) { - QTabletDeviceData &tab = tablets->operator [](i); - if (event->type == tab.xinput_motion - || event->type == tab.xinput_button_release - || event->type == tab.xinput_button_press - || event->type == tab.xinput_proximity_in - || event->type == tab.xinput_proximity_out) { - widget->translateXinputEvent(event, &tab); - return 0; - } - } - } -#endif #ifndef QT_NO_XRANDR if (X11->use_xrandr && event->type == (X11->xrandr_eventbase + RRScreenChangeNotify)) { @@ -2981,27 +2754,19 @@ int QApplication::x11ProcessEvent(XEvent* event) qt_net_update_user_time(widget->window(), X11->userTime); // fall through intended case MotionNotify: -#if !defined(QT_NO_TABLET) - if (!qt_tabletChokeMouse) { -#endif - if (widget->testAttribute(Qt::WA_TransparentForMouseEvents)) { - QPoint pos(event->xbutton.x, event->xbutton.y); - pos = widget->d_func()->mapFromWS(pos); - QWidget *window = widget->window(); - pos = widget->mapTo(window, pos); - if (QWidget *child = window->childAt(pos)) { - widget = static_cast(child); - pos = child->mapFrom(window, pos); - event->xbutton.x = pos.x(); - event->xbutton.y = pos.y(); - } + if (widget->testAttribute(Qt::WA_TransparentForMouseEvents)) { + QPoint pos(event->xbutton.x, event->xbutton.y); + pos = widget->d_func()->mapFromWS(pos); + QWidget *window = widget->window(); + pos = widget->mapTo(window, pos); + if (QWidget *child = window->childAt(pos)) { + widget = static_cast(child); + pos = child->mapFrom(window, pos); + event->xbutton.x = pos.x(); + event->xbutton.y = pos.y(); } - widget->translateMouseEvent(event); -#if !defined(QT_NO_TABLET) - } else { - qt_tabletChokeMouse = false; } -#endif + widget->translateMouseEvent(event); break; case XKeyPress: // keyboard event @@ -4032,283 +3797,6 @@ bool QETWidget::translateWheelEvent(int global_x, int global_y, int delta, // // XInput Translation Event // -#if !defined (QT_NO_TABLET) -void fetchWacomToolId(int &deviceType, qint64 &serialId) -{ - if (ptrWacomConfigInit == 0) // we actually have the lib - return; - WACOMCONFIG *config = ptrWacomConfigInit(X11->display, 0); - if (config == 0) - return; - WACOMDEVICE *device = ptrWacomConfigOpenDevice (config, wacomDeviceName()->constData()); - if (device == 0) - return; - unsigned keys[1]; - int serialInt; - ptrWacomConfigGetRawParam (device, XWACOM_PARAM_TOOLSERIAL, &serialInt, 1, keys); - serialId = serialInt; - int toolId; - ptrWacomConfigGetRawParam (device, XWACOM_PARAM_TOOLID, &toolId, 1, keys); - switch(toolId) { - case 0x007: /* Mouse 4D and 2D */ - case 0x017: /* Intuos3 2D Mouse */ - case 0x094: - case 0x09c: - deviceType = QTabletEvent::FourDMouse; - break; - case 0x096: /* Lens cursor */ - case 0x097: /* Intuos3 Lens cursor */ - deviceType = QTabletEvent::Puck; - break; - case 0x0fa: - case 0x81b: /* Intuos3 Classic Pen Eraser */ - case 0x82a: /* Eraser */ - case 0x82b: /* Intuos3 Grip Pen Eraser */ - case 0x85a: - case 0x91a: - case 0x91b: /* Intuos3 Airbrush Eraser */ - case 0xd1a: - deviceType = QTabletEvent::XFreeEraser; - break; - case 0x112: - case 0x912: - case 0x913: /* Intuos3 Airbrush */ - case 0xd12: - deviceType = QTabletEvent::Airbrush; - break; - case 0x012: - case 0x022: - case 0x032: - case 0x801: /* Intuos3 Inking pen */ - case 0x812: /* Inking pen */ - case 0x813: /* Intuos3 Classic Pen */ - case 0x822: /* Pen */ - case 0x823: /* Intuos3 Grip Pen */ - case 0x832: /* Stroke pen */ - case 0x842: - case 0x852: - case 0x885: /* Intuos3 Marker Pen */ - default: /* Unknown tool */ - deviceType = QTabletEvent::Stylus; - } - - /* Close device and return */ - ptrWacomConfigCloseDevice (device); - ptrWacomConfigTerm(config); -} - -struct qt_tablet_motion_data -{ - bool filterByWidget; - const QWidget *widget; - const QWidget *etWidget; - int tabletMotionType; - bool error; // found a reason to stop searching -}; - -static Bool qt_mouseMotion_scanner(Display *, XEvent *event, XPointer arg) -{ - qt_tablet_motion_data *data = (qt_tablet_motion_data *) arg; - if (data->error) - return false; - - if (event->type == MotionNotify) - return true; - - data->error = event->type != data->tabletMotionType; // we stop compression when another event gets in between. - return false; -} - -static Bool qt_tabletMotion_scanner(Display *, XEvent *event, XPointer arg) -{ - qt_tablet_motion_data *data = (qt_tablet_motion_data *) arg; - if (data->error) - return false; - if (event->type == data->tabletMotionType) { - const XDeviceMotionEvent *const motion = reinterpret_cast(event); - if (data->filterByWidget) { - const QPoint curr(motion->x, motion->y); - const QWidget *w = data->etWidget; - const QWidget *const child = w->childAt(curr); - if (child) { - w = child; - } - if (w == data->widget) - return true; - } else { - return true; - } - } - - data->error = event->type != MotionNotify; // we stop compression when another event gets in between. - return false; -} - -bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet) -{ - Q_ASSERT(tablet != 0); - - QWidget *w = this; - QPoint global, - curr; - QPointF hiRes; - qreal pressure = 0; - int xTilt = 0, - yTilt = 0, - z = 0; - qreal tangentialPressure = 0; - qreal rotation = 0; - int deviceType = QTabletEvent::NoDevice; - int pointerType = QTabletEvent::UnknownPointer; - const XDeviceMotionEvent *motion = 0; - XDeviceButtonEvent *button = 0; - const XProximityNotifyEvent *proximity = 0; - QEvent::Type t; - Qt::KeyboardModifiers modifiers = 0; - XID device_id; - - if (ev->type == tablet->xinput_motion) { - motion = reinterpret_cast(ev); - t = QEvent::TabletMove; - global = QPoint(motion->x_root, motion->y_root); - curr = QPoint(motion->x, motion->y); - device_id = motion->deviceid; - } else if (ev->type == tablet->xinput_button_press || ev->type == tablet->xinput_button_release) { - if (ev->type == tablet->xinput_button_press) { - t = QEvent::TabletPress; - } else { - t = QEvent::TabletRelease; - } - button = (XDeviceButtonEvent*)ev; - - global = QPoint(button->x_root, button->y_root); - curr = QPoint(button->x, button->y); - device_id = button->deviceid; - } else { // Proximity - if (ev->type == tablet->xinput_proximity_in) - t = QEvent::TabletEnterProximity; - else - t = QEvent::TabletLeaveProximity; - proximity = (const XProximityNotifyEvent*)ev; - device_id = proximity->deviceid; - } - - qint64 uid = 0; - // We've been passed in data for a tablet device that handles this type - // of event, but it isn't necessarily the tablet device that originated - // the event. Use the device id to find the originating device if we - // have it. - QTabletDeviceDataList *tablet_list = qt_tablet_devices(); - for (int i = 0; i < tablet_list->size(); ++i) { - QTabletDeviceData &tab = tablet_list->operator[](i); - if (device_id == static_cast(tab.device)->device_id) { - // Replace the tablet passed in with this one. - tablet = &tab; - deviceType = tab.deviceType; - if (tab.deviceType == QTabletEvent::XFreeEraser) { - deviceType = QTabletEvent::Stylus; - pointerType = QTabletEvent::Eraser; - } else if (tab.deviceType == QTabletEvent::Stylus) { - pointerType = QTabletEvent::Pen; - } - break; - } - } - - fetchWacomToolId(deviceType, uid); - - QRect screenArea = qApp->desktop()->rect(); - if (motion) { - xTilt = (short) motion->axis_data[3]; - yTilt = (short) motion->axis_data[4]; - rotation = ((short) motion->axis_data[5]) / 64.0; - pressure = (short) motion->axis_data[2]; - modifiers = X11->translateModifiers(motion->state); - hiRes = tablet->scaleCoord(motion->axis_data[0], motion->axis_data[1], - screenArea.x(), screenArea.width(), - screenArea.y(), screenArea.height()); - } else if (button) { - xTilt = (short) button->axis_data[3]; - yTilt = (short) button->axis_data[4]; - rotation = ((short) button->axis_data[5]) / 64.0; - pressure = (short) button->axis_data[2]; - modifiers = X11->translateModifiers(button->state); - hiRes = tablet->scaleCoord(button->axis_data[0], button->axis_data[1], - screenArea.x(), screenArea.width(), - screenArea.y(), screenArea.height()); - } else if (proximity) { - pressure = 0; - modifiers = 0; - } - if (deviceType == QTabletEvent::Airbrush) { - tangentialPressure = rotation; - rotation = 0.; - } - - if (tablet->widgetToGetPress) { - w = tablet->widgetToGetPress; - } else { - QWidget *child = w->childAt(curr); - if (child) - w = child; - } - curr = w->mapFromGlobal(global); - - if (t == QEvent::TabletPress) { - tablet->widgetToGetPress = w; - } else if (t == QEvent::TabletRelease && tablet->widgetToGetPress) { - w = tablet->widgetToGetPress; - curr = w->mapFromGlobal(global); - tablet->widgetToGetPress = 0; - } - - QTabletEvent e(t, curr, global, hiRes, - deviceType, pointerType, - qreal(pressure / qreal(tablet->maxPressure - tablet->minPressure)), - xTilt, yTilt, tangentialPressure, rotation, z, modifiers, uid); - if (proximity) { - QApplication::sendSpontaneousEvent(qApp, &e); - } else { - QApplication::sendSpontaneousEvent(w, &e); - const bool accepted = e.isAccepted(); - if (!accepted && ev->type == tablet->xinput_motion) { - // If the widget does not accept tablet events, we drop the next ones from the event queue - // for this widget so it is not overloaded with the numerous tablet events. - qt_tablet_motion_data tabletMotionData; - tabletMotionData.tabletMotionType = tablet->xinput_motion; - tabletMotionData.widget = w; - tabletMotionData.etWidget = this; - // if nothing is pressed, the events are filtered by position - tabletMotionData.filterByWidget = (tablet->widgetToGetPress == 0); - - bool reinsertMouseEvent = false; - XEvent mouseMotionEvent; - while (true) { - // Find first mouse event since we expect them in pairs inside Qt - tabletMotionData.error =false; - if (XCheckIfEvent(X11->display, &mouseMotionEvent, &qt_mouseMotion_scanner, (XPointer) &tabletMotionData)) { - reinsertMouseEvent = true; - } else { - break; - } - - // Now discard any duplicate tablet events. - tabletMotionData.error = false; - XEvent dummy; - while (XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) { - // just discard the event - } - } - - if (reinsertMouseEvent) { - XPutBackEvent(X11->display, &mouseMotionEvent); - } - } - } - return true; -} -#endif - bool QETWidget::translatePropertyEvent(const XEvent *event) { Q_D(QWidget); diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 3c97e18fb..06fd218ec 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -1372,324 +1372,6 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos) Returns the reason for this context event. */ -#ifndef QT_NO_TABLETEVENT - -/*! - \class QTabletEvent - \brief The QTabletEvent class contains parameters that describe a Tablet event. - - \ingroup events - - Tablet Events are generated from a Wacom tablet. Most of the time you will - want to deal with events from the tablet as if they were events from a - mouse; for example, you would retrieve the cursor position with x(), y(), - pos(), globalX(), globalY(), and globalPos(). In some situations you may - wish to retrieve the extra information provided by the tablet device - driver; for example, you might want to do subpixeling with higher - resolution coordinates or you may want to adjust color brightness based on - pressure. QTabletEvent allows you to read the pressure(), the xTilt(), and - yTilt(), as well as the type of device being used with device() (see - \l{TabletDevice}). It can also give you the minimum and maximum values for - each device's pressure and high resolution coordinates. - - A tablet event contains a special accept flag that indicates whether the - receiver wants the event. You should call QTabletEvent::accept() if you - handle the tablet event; otherwise it will be sent to the parent widget. - The exception are TabletEnterProximity and TabletLeaveProximity events, - these are only sent to QApplication and don't check whether or not they are - accepted. - - The QWidget::setEnabled() function can be used to enable or - disable mouse and keyboard events for a widget. - - The event handler QWidget::tabletEvent() receives all three types of - tablet events. Qt will first send a tabletEvent then, if it is not - accepted, it will send a mouse event. This allows applications that - don't utilize tablets to use a tablet like a mouse, while also - enabling those who want to use both tablets and mouses differently. - - \section1 Notes for X11 Users - - Qt uses the following hard-coded names to identify tablet - devices from the xorg.conf file on X11 (apart from IRIX): - 'stylus', 'pen', and 'eraser'. If the devices have other names, - they will not be picked up Qt. -*/ - -/*! - \enum QTabletEvent::TabletDevice - - This enum defines what type of device is generating the event. - - \value NoDevice No device, or an unknown device. - \value Puck A Puck (a device that is similar to a flat mouse with - a transparent circle with cross-hairs). - \value Stylus A Stylus. - \value Airbrush An airbrush - \value FourDMouse A 4D Mouse. - \value RotationStylus A special stylus that also knows about rotation - (a 6D stylus). \since 4.1 - \omitvalue XFreeEraser -*/ - -/*! - \enum QTabletEvent::PointerType - - This enum defines what type of point is generating the event. - - \value UnknownPointer An unknown device. - \value Pen Tip end of a stylus-like device (the narrow end of the pen). - \value Cursor Any puck-like device. - \value Eraser Eraser end of a stylus-like device (the broad end of the pen). - - \sa pointerType() -*/ - -/*! - Construct a tablet event of the given \a type. - - The \a pos parameter indicates where the event occurred in the - widget; \a globalPos is the corresponding position in absolute - coordinates. The \a hiResGlobalPos contains a high resolution - measurement of the position. - - \a pressure contains the pressure exerted on the \a device. - - \a pointerType describes the type of pen that is being used. - - \a xTilt and \a yTilt contain the device's degree of tilt from the - x and y axes respectively. - - \a keyState specifies which keyboard modifiers are pressed (e.g., - \key{Ctrl}). - - The \a uniqueID parameter contains the unique ID for the current device. - - The \a z parameter contains the coordinate of the device on the tablet, this - is usually given by a wheel on 4D mouse. If the device does not support a - Z-axis, pass zero here. - - The \a tangentialPressure parameter contins the tangential pressure of an air - brush. If the device does not support tangential pressure, pass 0 here. - - \a rotation contains the device's rotation in degrees. 4D mice support - rotation. If the device does not support rotation, pass 0 here. - - \sa pos() globalPos() device() pressure() xTilt() yTilt() uniqueId(), rotation(), tangentialPressure(), z() -*/ - -QTabletEvent::QTabletEvent(Type type, const QPoint &pos, const QPoint &globalPos, - const QPointF &hiResGlobalPos, int device, int pointerType, - qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, - qreal rotation, int z, Qt::KeyboardModifiers keyState, qint64 uniqueID) - : QInputEvent(type, keyState), - mPos(pos), - mGPos(globalPos), - mHiResGlobalPos(hiResGlobalPos), - mDev(device), - mPointerType(pointerType), - mXT(xTilt), - mYT(yTilt), - mZ(z), - mPress(pressure), - mTangential(tangentialPressure), - mRot(rotation), - mUnique(uniqueID), - mExtra(0) -{ -} - -/*! - \internal -*/ -QTabletEvent::~QTabletEvent() -{ -} - -/*! - \fn TabletDevices QTabletEvent::device() const - - Returns the type of device that generated the event. - - \sa TabletDevice -*/ - -/*! - \fn PointerType QTabletEvent::pointerType() const - - Returns the type of point that generated the event. -*/ - -/*! - \fn qreal QTabletEvent::tangentialPressure() const - - Returns the tangential pressure for the device. This is typically given by a finger - wheel on an airbrush tool. The range is from -1.0 to 1.0. 0.0 indicates a - neutral position. Current airbrushes can only move in the positive - direction from the neutrual position. If the device does not support - tangential pressure, this value is always 0.0. - - \sa pressure() -*/ - -/*! - \fn qreal QTabletEvent::rotation() const - - Returns the rotation of the current device in degress. This is usually - given by a 4D Mouse. If the device doesn't support rotation this value is - always 0.0. - -*/ - -/*! - \fn qreal QTabletEvent::pressure() const - - Returns the pressure for the device. 0.0 indicates that the stylus is not - on the tablet, 1.0 indicates the maximum amount of pressure for the stylus. - - \sa tangentialPressure() -*/ - -/*! - \fn int QTabletEvent::xTilt() const - - Returns the angle between the device (a pen, for example) and the - perpendicular in the direction of the x axis. - Positive values are towards the tablet's physical right. The angle - is in the range -60 to +60 degrees. - - \img qtabletevent-tilt.png - - \sa yTilt() -*/ - -/*! - \fn int QTabletEvent::yTilt() const - - Returns the angle between the device (a pen, for example) and the - perpendicular in the direction of the y axis. - Positive values are towards the bottom of the tablet. The angle is - within the range -60 to +60 degrees. - - \sa xTilt() -*/ - -/*! - \fn const QPoint &QTabletEvent::pos() const - - Returns the position of the device, relative to the widget that - received the event. - - If you move widgets around in response to mouse events, use - globalPos() instead of this function. - - \sa x() y() globalPos() -*/ - -/*! - \fn int QTabletEvent::x() const - - Returns the x position of the device, relative to the widget that - received the event. - - \sa y() pos() -*/ - -/*! - \fn int QTabletEvent::y() const - - Returns the y position of the device, relative to the widget that - received the event. - - \sa x() pos() -*/ - -/*! - \fn int QTabletEvent::z() const - - Returns the z position of the device. Typically this is represented by a - wheel on a 4D Mouse. If the device does not support a Z-axis, this value is - always zero. This is \bold not the same as pressure. - - \sa pressure() -*/ - -/*! - \fn const QPoint &QTabletEvent::globalPos() const - - Returns the global position of the device \e{at the time of the - event}. This is important on asynchronous windows systems like X11; - whenever you move your widgets around in response to mouse events, - globalPos() can differ significantly from the current position - QCursor::pos(). - - \sa globalX() globalY() hiResGlobalPos() -*/ - -/*! - \fn int QTabletEvent::globalX() const - - Returns the global x position of the mouse pointer at the time of - the event. - - \sa globalY() globalPos() hiResGlobalX() -*/ - -/*! - \fn int QTabletEvent::globalY() const - - Returns the global y position of the tablet device at the time of - the event. - - \sa globalX() globalPos() hiResGlobalY() -*/ - -/*! - \fn qint64 QTabletEvent::uniqueId() const - - Returns a unique ID for the current device, making it possible - to differentiate between multiple devices being used at the same - time on the tablet. - - Support of this feature is dependent on the tablet. - - Values for the same device may vary from OS to OS. - - Later versions of the Wacom driver for Linux will now report - the ID information. If you have a tablet that supports unique ID - and are not getting the information on Linux, consider upgrading - your driver. - - As of Qt 4.2, the unique ID is the same regardless of the orientation - of the pen. Earlier versions would report a different value when using - the eraser-end versus the pen-end of the stylus on some OS's. - - \sa pointerType() -*/ - -/*! - \fn const QPointF &QTabletEvent::hiResGlobalPos() const - - The high precision coordinates delivered from the tablet expressed. - Sub pixeling information is in the fractional part of the QPointF. - - \sa globalPos() hiResGlobalX() hiResGlobalY() -*/ - -/*! - \fn qreal &QTabletEvent::hiResGlobalX() const - - The high precision x position of the tablet device. -*/ - -/*! - \fn qreal &QTabletEvent::hiResGlobalY() const - - The high precision y position of the tablet device. -*/ - -#endif // QT_NO_TABLETEVENT - #ifndef QT_NO_DRAGANDDROP /*! Creates a QDragMoveEvent of the required \a type indicating @@ -2692,13 +2374,7 @@ static const char *eventClassName(QEvent::Type t) case QEvent::HoverEnter: case QEvent::HoverLeave: case QEvent::HoverMove: - return "QHoverEvent"; - case QEvent::TabletEnterProximity: - case QEvent::TabletLeaveProximity: - case QEvent::TabletPress: - case QEvent::TabletMove: - case QEvent::TabletRelease: - return "QTabletEvent"; + return "QHoverEvent";; case QEvent::StatusTip: return "QStatusTipEvent"; case QEvent::ToolTip: @@ -2782,34 +2458,6 @@ static void formatDropEvent(QDebug d, const QDropEvent *e) # endif // !QT_NO_DRAGANDDROP -# ifndef QT_NO_TABLETEVENT - -static void formatTabletEvent(QDebug d, const QTabletEvent *e) -{ - const QEvent::Type type = e->type(); - - static const int deviceEnumIdx = QTabletEvent::staticMetaObject.indexOfEnumerator("TabletDevice"); - static const int pointerTypeEnumIdx = QTabletEvent::staticMetaObject.indexOfEnumerator("PointerType"); - const char* device = QTabletEvent::staticMetaObject.enumerator(deviceEnumIdx).valueToKey(e->device()); - const char* pointerType = QTabletEvent::staticMetaObject.enumerator(pointerTypeEnumIdx).valueToKey(e->pointerType()); - - d << eventClassName(type) << '(' << eventTypeName(type) - << ", device=" << device - << ", pointerType=" << pointerType - << ", uniqueId=" << e->uniqueId() - << ", z=" << e->z() - << ", xTilt=" << e->xTilt() - << ", yTilt=" << e->yTilt(); - if (type == QEvent::TabletPress || type == QEvent::TabletMove) - d << ", pressure=" << e->pressure(); - if (e->device() == QTabletEvent::RotationStylus || e->device() == QTabletEvent::FourDMouse) - d << ", rotation=" << e->rotation(); - if (e->device() == QTabletEvent::Airbrush) - d << ", tangentialPressure=" << e->tangentialPressure(); -} - -# endif // !QT_NO_TABLETEVENT - QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp) { formatTouchPoint(dbg, tp); @@ -2930,15 +2578,6 @@ QDebug operator<<(QDebug dbg, const QEvent *e) { case QEvent::ContextMenu: dbg << "QContextMenuEvent(" << static_cast(e)->pos() << ')'; break; -# ifndef QT_NO_TABLETEVENT - case QEvent::TabletEnterProximity: - case QEvent::TabletLeaveProximity: - case QEvent::TabletPress: - case QEvent::TabletMove: - case QEvent::TabletRelease: - formatTabletEvent(dbg, static_cast(e)); - break; -# endif // !QT_NO_TABLETEVENT case QEvent::Timer: dbg << "QTimerEvent(id=" << static_cast(e)->timerId() << ')'; break; diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 6f9b44982..e65aacd3f 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -153,52 +153,6 @@ protected: }; #endif -#ifndef QT_NO_TABLETEVENT -class Q_GUI_EXPORT QTabletEvent : public QInputEvent -{ -public: - enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse, - XFreeEraser /*internal*/, RotationStylus }; - enum PointerType { UnknownPointer, Pen, Cursor, Eraser }; - QTabletEvent(Type t, const QPoint &pos, const QPoint &globalPos, const QPointF &hiResGlobalPos, - int device, int pointerType, qreal pressure, int xTilt, int yTilt, - qreal tangentialPressure, qreal rotation, int z, - Qt::KeyboardModifiers keyState, qint64 uniqueID); - ~QTabletEvent(); - - inline const QPoint &pos() const { return mPos; } - inline const QPoint &globalPos() const { return mGPos; } - inline const QPointF &hiResGlobalPos() const { return mHiResGlobalPos; } - inline int x() const { return mPos.x(); } - inline int y() const { return mPos.y(); } - inline int globalX() const { return mGPos.x(); } - inline int globalY() const { return mGPos.y(); } - inline qreal hiResGlobalX() const { return mHiResGlobalPos.x(); } - inline qreal hiResGlobalY() const { return mHiResGlobalPos.y(); } - inline TabletDevice device() const { return TabletDevice(mDev); } - inline PointerType pointerType() const { return PointerType(mPointerType); } - inline qint64 uniqueId() const { return mUnique; } - inline qreal pressure() const { return mPress; } - inline int z() const { return mZ; } - inline qreal tangentialPressure() const { return mTangential; } - inline qreal rotation() const { return mRot; } - inline int xTilt() const { return mXT; } - inline int yTilt() const { return mYT; } - -protected: - QPoint mPos, mGPos; - QPointF mHiResGlobalPos; - int mDev, mPointerType, mXT, mYT, mZ; - qreal mPress, mTangential, mRot; - qint64 mUnique; - - // I don't know what the future holds for tablets but there could be some - // new devices coming along, and there seem to be "holes" in the - // OS-specific events for this. - void *mExtra; -}; -#endif // QT_NO_TABLETEVENT - class Q_GUI_EXPORT QKeyEvent : public QInputEvent { public: diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index 1db08922c..48222037e 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -88,10 +88,6 @@ # include #endif // QT_NO_XSHAPE -#ifndef QT_NO_TABLET -# include -#endif // QT_NO_TABLET - #ifndef QT_NO_XINERAMA # include #endif // QT_NO_XINERAMA @@ -476,14 +472,6 @@ struct QX11Data _XEMBED, _XEMBED_INFO, - XWacomStylus, - XWacomCursor, - XWacomEraser, - - XTabletStylus, - XTabletEraser, - XTablet, - NPredefinedAtoms, _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 55cd7664d..47bc6ba16 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -7466,9 +7466,6 @@ bool QWidget::event(QEvent *event) // ignore mouse events when disabled if (!isEnabled()) { switch(event->type()) { - case QEvent::TabletPress: - case QEvent::TabletRelease: - case QEvent::TabletMove: case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: @@ -7516,13 +7513,6 @@ bool QWidget::event(QEvent *event) case QEvent::Wheel: wheelEvent((QWheelEvent*)event); break; -#endif -#ifndef QT_NO_TABLETEVENT - case QEvent::TabletMove: - case QEvent::TabletPress: - case QEvent::TabletRelease: - tabletEvent((QTabletEvent*)event); - break; #endif case QEvent::KeyPress: { QKeyEvent *k = (QKeyEvent *)event; @@ -8095,27 +8085,6 @@ void QWidget::wheelEvent(QWheelEvent *event) } #endif // QT_NO_WHEELEVENT -#ifndef QT_NO_TABLETEVENT -/*! - This event handler, for event \a event, can be reimplemented in a - subclass to receive tablet events for the widget. - - If you reimplement this handler, it is very important that you - \link QTabletEvent ignore()\endlink the event if you do not handle - it, so that the widget's parent can interpret it. - - The default implementation ignores the event. - - \sa QTabletEvent::ignore(), QTabletEvent::accept(), event(), - QTabletEvent -*/ - -void QWidget::tabletEvent(QTabletEvent *event) -{ - event->ignore(); -} -#endif // QT_NO_TABLETEVENT - /*! This event handler, for event \a event, can be reimplemented in a subclass to receive key press events for the widget. diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index 19f66ad1e..66f4992de 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -73,7 +73,6 @@ class QMoveEvent; class QResizeEvent; class QCloseEvent; class QContextMenuEvent; -class QTabletEvent; class QDragEnterEvent; class QDragMoveEvent; class QDragLeaveEvent; @@ -594,9 +593,6 @@ protected: #ifndef QT_NO_CONTEXTMENU virtual void contextMenuEvent(QContextMenuEvent *); #endif -#ifndef QT_NO_TABLETEVENT - virtual void tabletEvent(QTabletEvent *); -#endif #ifndef QT_NO_ACTION virtual void actionEvent(QActionEvent *); #endif diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index d9f5a4237..209eb6b19 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -843,14 +843,6 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO XSelectInput(dpy, id, stdDesktopEventMask); } else if (q->internalWinId()) { XSelectInput(dpy, id, stdWidgetEventMask); -#if !defined (QT_NO_TABLET) - QTabletDeviceDataList *tablet_list = qt_tablet_devices(); - for (int i = 0; i < tablet_list->size(); ++i) { - QTabletDeviceData tablet = tablet_list->at(i); - XSelectExtensionEvent(dpy, id, reinterpret_cast(tablet.eventList), - tablet.eventCount); - } -#endif } if (desktop) { diff --git a/src/gui/widgets/qabstractbutton.cpp b/src/gui/widgets/qabstractbutton.cpp index e196f6184..c46093c7c 100644 --- a/src/gui/widgets/qabstractbutton.cpp +++ b/src/gui/widgets/qabstractbutton.cpp @@ -1035,9 +1035,6 @@ bool QAbstractButton::event(QEvent *e) // events. This avoids surprising click-through scenarios if (!isEnabled()) { switch(e->type()) { - case QEvent::TabletPress: - case QEvent::TabletRelease: - case QEvent::TabletMove: case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: diff --git a/src/shared/qclass_lib_map.h b/src/shared/qclass_lib_map.h index 7ca46e94c..9a65a3495 100644 --- a/src/shared/qclass_lib_map.h +++ b/src/shared/qclass_lib_map.h @@ -351,7 +351,6 @@ static const ClassInfoEntry qclass_lib_map[] = { { "QMouseEvent", "QtGui/qevent.h"}, { "QHoverEvent", "QtGui/qevent.h"}, { "QWheelEvent", "QtGui/qevent.h"}, - { "QTabletEvent", "QtGui/qevent.h"}, { "QKeyEvent", "QtGui/qevent.h"}, { "QFocusEvent", "QtGui/qevent.h"}, { "QPaintEvent", "QtGui/qevent.h"}, @@ -704,6 +703,6 @@ static const ClassInfoEntry qclass_lib_map[] = { { "QSqlRecord", "QtSql/qsqlrecord.h"}, { "QSqlResult", "QtSql/qsqlresult.h"}, }; -static const int qclass_lib_count = 698; +static const int qclass_lib_count = 697; #endif diff --git a/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp b/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp index 7523a31d2..107e1533e 100644 --- a/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp +++ b/tests/benchmarks/gui/image/qpixmap/tst_qpixmap.cpp @@ -76,8 +76,7 @@ Q_DECLARE_METATYPE(Qt::TransformationMode) QPixmap rasterPixmap(int width, int height) { - QPixmapData *data = - new QRasterPixmapData(QPixmapData::PixmapType); + QPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType); data->resize(width, height); @@ -91,8 +90,7 @@ QPixmap rasterPixmap(const QSize &size) QPixmap rasterPixmap(const QImage &image) { - QPixmapData *data = - new QRasterPixmapData(QPixmapData::PixmapType); + QPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType); data->fromImage(image, Qt::AutoColor);