diff options
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 25 | ||||
-rw-r--r-- | src/gui/kernel/qapplication.h | 12 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 5 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 122 | ||||
-rw-r--r-- | src/gui/kernel/qkeymapper_win.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qt_s60_p.h | 10 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 15 | ||||
-rw-r--r-- | src/gui/kernel/symbian.pri | 3 |
8 files changed, 120 insertions, 76 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 6f6d706..f48c551 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -68,9 +68,6 @@ #include "private/qstylesheetstyle_p.h" #include "private/qstyle_p.h" #include "qmessagebox.h" -#include "qlineedit.h" -#include "qlistview.h" -#include "qtextedit.h" #include <QtGui/qgraphicsproxywidget.h> #include "qinputcontext.h" @@ -2501,6 +2498,8 @@ void QApplication::setActiveWindow(QWidget* act) */ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool next) { + uint focus_flag = qt_tab_all_widgets ? Qt::TabFocus : Qt::StrongFocus; + QWidget *f = toplevel->focusWidget(); if (!f) f = toplevel; @@ -2508,22 +2507,11 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool QWidget *w = f; QWidget *test = f->d_func()->focus_next; while (test && test != f) { - if ((test->focusPolicy() & Qt::TabFocus) + if ((test->focusPolicy() & focus_flag) == focus_flag && !(test->d_func()->extra && test->d_func()->extra->focus_proxy) && test->isVisibleTo(toplevel) && test->isEnabled() && !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test)) - && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test)) - && (qt_tab_all_widgets -#ifndef QT_NO_LINEEDIT - || qobject_cast<QLineEdit*>(test) -#endif -#ifndef QT_NO_TEXTEDIT - || qobject_cast<QTextEdit*>(test) -#endif -#ifndef QT_NO_ITEMVIEWS - || qobject_cast<QListView*>(test) -#endif - )) { + && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) { w = test; if (next) break; @@ -2662,7 +2650,10 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave) { if (!isAlien(w)) break; if (w->testAttribute(Qt::WA_SetCursor)) { - parentOfLeavingCursor = w->parentWidget(); + QWidget *parent = w->parentWidget(); + while (parent && parent->d_func()->data.in_destructor) + parent = parent->parentWidget(); + parentOfLeavingCursor = parent; //continue looping, we need to find the downest alien widget with a cursor. // (downest on the screen) } diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 12b398d..5a8e325 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -61,9 +61,6 @@ QT_BEGIN_HEADER -#if defined(Q_OS_SYMBIAN) -class TWsEvent; -#endif #if defined(Q_WS_S60) class CApaApplication; #endif @@ -83,6 +80,9 @@ class QLocale; #if defined(Q_WS_QWS) class QDecoration; #endif +#if defined(Q_OS_SYMBIAN) +class QSymbianEvent; +#endif class QApplication; class QApplicationPrivate; @@ -241,10 +241,8 @@ public: int x11ProcessEvent(XEvent*); #endif #if defined(Q_OS_SYMBIAN) - int s60ProcessEvent(TWsEvent *event); - virtual bool s60EventFilter(TWsEvent *aEvent); - void symbianHandleCommand(int command); - void symbianResourceChange(int type); + int symbianProcessEvent(const QSymbianEvent *event); + virtual bool symbianEventFilter(const QSymbianEvent *event); #endif #if defined(Q_WS_QWS) virtual bool qwsEventFilter(QWSEvent *); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 2d3d18c..65f61e9 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -503,6 +503,11 @@ public: static void setNavigationMode(Qt::NavigationMode mode); static TUint resolveS60ScanCode(TInt scanCode, TUint keysym); QSet<WId> nativeWindows; + + int symbianProcessWsEvent(const TWsEvent *event); + int symbianHandleCommand(int command); + int symbianResourceChange(int type); + #endif #if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) void sendSyntheticEnterLeave(QWidget *widget); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index cb9dda4..689429e 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -42,6 +42,7 @@ #include "qapplication_p.h" #include "qsessionmanager.h" #include "qevent.h" +#include "qsymbianevent.h" #include "qeventdispatcher_s60_p.h" #include "qwidget.h" #include "qdesktopwidget.h" @@ -1056,6 +1057,13 @@ void qt_init(QApplicationPrivate * /* priv */, int) TDisplayMode mode = S60->screenDevice()->DisplayMode(); S60->screenDepth = TDisplayModeUtils::NumDisplayModeBitsPerPixel(mode); + //NB: RWsSession::GetColorModeList tells you what window modes are supported, + //not what bitmap formats. + if(QSysInfo::symbianVersion() == QSysInfo::SV_9_2) + S60->supportsPremultipliedAlpha = 0; + else + S60->supportsPremultipliedAlpha = 1; + RProcess me; TSecureId securId = me.SecureId(); S60->uid = securId.operator TUid(); @@ -1084,6 +1092,13 @@ void qt_init(QApplicationPrivate * /* priv */, int) err = HAL::Get(HALData::EPen, touch); if (err != KErrNone || touchIsUnsupportedOnSystem) touch = 0; +#ifdef __WINS__ + if(QSysInfo::symbianVersion() <= QSysInfo::SV_9_4) { + //for symbian SDK emulator, force values to match typical devices. + mouse = 0; + touch = touchIsUnsupportedOnSystem ? 0 : 1; + } +#endif if (mouse || machineUID == KMachineUidSamsungI8510) { S60->hasTouchscreen = false; S60->virtualMouseRequired = false; @@ -1419,43 +1434,47 @@ void QApplication::beep() \warning This function is only available on Symbian. \since 4.6 - This function processes an individual Symbian window server + This function processes an individual Symbian event \a event. It returns 1 if the event was handled, 0 if the \a event was not handled, and -1 if the event was - not handled because the event handle (\c{TWsEvent::Handle()}) - is not known to Qt. + not handled because the event is not known to Qt. */ -int QApplication::s60ProcessEvent(TWsEvent *event) + +int QApplication::symbianProcessEvent(const QSymbianEvent *event) { - bool handled = s60EventFilter(event); - if (handled) + Q_D(QApplication); + + QScopedLoopLevelCounter counter(d->threadData); + + QWidget *w = qApp ? qApp->focusWidget() : 0; + if (w) { + QInputContext *ic = w->inputContext(); + if (ic && ic->symbianFilterEvent(w, event)) + return 1; + } + + if (symbianEventFilter(event)) return 1; + switch (event->type()) { + case QSymbianEvent::WindowServerEvent: + return d->symbianProcessWsEvent(event->windowServerEvent()); + case QSymbianEvent::CommandEvent: + return d->symbianHandleCommand(event->command()); + case QSymbianEvent::ResourceChangeEvent: + return d->symbianResourceChange(event->resourceChangeType()); + default: + return -1; + } +} + +int QApplicationPrivate::symbianProcessWsEvent(const TWsEvent *event) +{ // Qt event handling. Handle some events regardless of if the handle is in our // widget map or not. CCoeControl* control = reinterpret_cast<CCoeControl*>(event->Handle()); const bool controlInMap = QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control); switch (event->Type()) { -#if !defined(QT_NO_IM) && defined(Q_WS_S60) - case EEventKey: - case EEventKeyUp: - case EEventKeyDown: - { - // The control doesn't seem to be any of our widgets, so rely on the focused - // widget instead. If the user needs the control, it can be found inside the - // event structure. - QWidget *w = qApp ? qApp->focusWidget() : 0; - if (w) { - QInputContext *ic = w->inputContext(); - if (ic && ic->s60FilterEvent(w, event)) { - return 1; - } else { - return 0; - } - } - break; - } -#endif case EEventPointerEnter: if (controlInMap) return 1; // Qt::Enter will be generated in HandlePointerL @@ -1544,15 +1563,15 @@ int QApplication::s60ProcessEvent(TWsEvent *event) If you create an application that inherits QApplication and reimplement this function, you get direct access to events that the are received - from the Symbian window server. The events are passed in the TWsEvent - \a aEvent parameter. + from Symbian. The events are passed in the \a event parameter. Return true if you want to stop the event from being processed. Return - false for normal event dispatching. The default implementation - false, and does nothing with \a aEvent. + false for normal event dispatching. The default implementation returns + false, and does nothing with \a event. */ -bool QApplication::s60EventFilter(TWsEvent * /* aEvent */) +bool QApplication::symbianEventFilter(const QSymbianEvent *event) { + Q_UNUSED(event); return false; } @@ -1567,32 +1586,39 @@ bool QApplication::s60EventFilter(TWsEvent * /* aEvent */) \sa s60EventFilter(), s60ProcessEvent() */ -void QApplication::symbianHandleCommand(int command) +int QApplicationPrivate::symbianHandleCommand(int command) { - QScopedLoopLevelCounter counter(d_func()->threadData); + Q_Q(QApplication); + int ret = 0; + switch (command) { #ifdef Q_WS_S60 case EAknSoftkeyExit: { QCloseEvent ev; - QApplication::sendSpontaneousEvent(this, &ev); - if (ev.isAccepted()) - quit(); + QApplication::sendSpontaneousEvent(q, &ev); + if (ev.isAccepted()) { + q->quit(); + ret = 1; + } break; } #endif case EEikCmdExit: - quit(); + q->quit(); + ret = 1; break; default: bool handled = QSoftKeyManager::handleCommand(command); + if (handled) + ret = 1; #ifdef Q_WS_S60 - if (!handled) - QMenuBarPrivate::symbianCommands(command); -#else - Q_UNUSED(handled); + else + ret = QMenuBarPrivate::symbianCommands(command); #endif break; } + + return ret; } /*! @@ -1604,8 +1630,10 @@ void QApplication::symbianHandleCommand(int command) Currently, KEikDynamicLayoutVariantSwitch and KAknsMessageSkinChange are handled. */ -void QApplication::symbianResourceChange(int type) +int QApplicationPrivate::symbianResourceChange(int type) { + int ret = 0; + switch (type) { #ifdef Q_WS_S60 case KEikDynamicLayoutVariantSwitch: @@ -1624,22 +1652,28 @@ void QApplication::symbianResourceChange(int type) #endif s60Style = qobject_cast<QS60Style*>(QApplication::style()); - if (s60Style) + if (s60Style) { s60Style->d_func()->handleDynamicLayoutVariantSwitch(); + ret = 1; + } #endif } break; #ifndef QT_NO_STYLE_S60 case KAknsMessageSkinChange: - if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style())) + if (QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style())) { s60Style->d_func()->handleSkinChange(); + ret = 1; + } break; #endif #endif // Q_WS_S60 default: break; } + + return ret; } #ifndef QT_NO_WHEELEVENT diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp index be207df..f95efa2 100644 --- a/src/gui/kernel/qkeymapper_win.cpp +++ b/src/gui/kernel/qkeymapper_win.cpp @@ -438,10 +438,10 @@ static const Qt::KeyboardModifiers ModsTbl[] = { */ inline int winceKeyBend(int keyCode) { -#ifdef Q_OS_WINCE_WM +#if defined(Q_OS_WINCE_WM) && defined(QT_KEYPAD_NAVIGATION) // remap return or action key to select key for windows mobile. // will be changed to a table remapping function in the next version (4.6/7). - if (keyCode == 13) + if (keyCode == VK_RETURN && QApplication::keypadNavigationEnabled()) return Qt::Key_Select; else return KeyTbl[keyCode]; diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index d33791b..e25bc81 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -81,6 +81,9 @@ QT_BEGIN_NAMESPACE // system events seems to start with 0x10 const TInt KInternalStatusPaneChange = 0x50000000; +//this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2 +#define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13) + class QS60Data { public: @@ -108,6 +111,7 @@ public: int mouseInteractionEnabled : 1; int virtualMouseRequired : 1; int qtOwnsS60Environment : 1; + int supportsPremultipliedAlpha : 1; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type static inline void updateScreenSize(); static inline RWsSession& wsSession(); @@ -199,7 +203,7 @@ inline void QS60Data::updateScreenSize() S60->screenHeightInPixels = params.iPixelSize.iHeight; S60->screenWidthInTwips = params.iTwipsSize.iWidth; S60->screenHeightInTwips = params.iTwipsSize.iHeight; - + S60->virtualMouseMaxAccel = qMax(S60->screenHeightInPixels, S60->screenWidthInPixels) / 20; TReal inches = S60->screenHeightInTwips / (TReal)KTwipsPerInch; @@ -302,11 +306,9 @@ static inline QImage::Format qt_TDisplayMode2Format(TDisplayMode mode) case EColor16MA: format = QImage::Format_ARGB32; break; -#if !defined(__SERIES60_31__) && !defined(__S60_32__) - case EColor16MAP: + case Q_SYMBIAN_ECOLOR16MAP: format = QImage::Format_ARGB32_Premultiplied; break; -#endif default: format = QImage::Format_Invalid; break; diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index c966aa3..05c6a5b 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -305,6 +305,8 @@ bool qt_mac_insideKeyWindow(const QWidget *w) { #ifdef QT_MAC_USE_COCOA return [[reinterpret_cast<NSView *>(w->winId()) window] isKeyWindow]; +#else + Q_UNUSED(w); #endif return false; } @@ -3301,7 +3303,11 @@ void QWidgetPrivate::show_sys() [window miniaturize:window]; #endif } else if (!q->testAttribute(Qt::WA_ShowWithoutActivating)) { +#ifndef QT_MAC_USE_COCOA qt_event_request_activate(q); +#else + [qt_mac_window_for(q) makeKeyWindow]; +#endif } } else if(topData()->embedded || !q->parentWidget() || q->parentWidget()->isVisible()) { #ifndef QT_MAC_USE_COCOA @@ -3404,8 +3410,13 @@ void QWidgetPrivate::hide_sys() } #endif } - if(w && w->isVisible() && !w->isMinimized()) - qt_event_request_activate(w); + if(w && w->isVisible() && !w->isMinimized()) { +#ifndef QT_MAC_USE_COCOA + qt_event_request_activate(w); +#else + [qt_mac_window_for(w) makeKeyWindow]; +#endif + } } } else { invalidateBuffer(q->rect()); diff --git a/src/gui/kernel/symbian.pri b/src/gui/kernel/symbian.pri index 5497ccb..69422dd 100644 --- a/src/gui/kernel/symbian.pri +++ b/src/gui/kernel/symbian.pri @@ -1,4 +1,7 @@ symbian { contains(QT_CONFIG, s60): LIBS+= $$QMAKE_LIBS_S60 RESOURCES += symbian/symbianresources.qrc + + HEADERS += symbian/qsymbianevent.h + SOURCES += symbian/qsymbianevent.cpp } |