summaryrefslogtreecommitdiff
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorRohan McGovern <rohan@mcgovern.id.au>2010-03-07 09:44:26 +1000
committerRohan McGovern <rohan@mcgovern.id.au>2010-03-07 09:44:26 +1000
commitad341d612129287793620bc84d3077afd64f97a4 (patch)
tree3d62b038c34985046ad1f3ff56c1c4e85a194ed2 /src/gui/kernel
parentb20ef0ade0aec89b969bd0ae7f754c680e390c67 (diff)
parent2458cb45665b0fe3144266122f876bd541de9c42 (diff)
downloadqt4-tools-ad341d612129287793620bc84d3077afd64f97a4.tar.gz
Merge remote branch 'origin/4.6' into qt-4.7-from-4.6
Conflicts: configure.exe examples/multimedia/audioinput/audioinput.cpp src/corelib/io/qfsfileengine.cpp src/gui/egl/qegl_wince.cpp src/gui/egl/qeglproperties.cpp src/gui/egl/qeglproperties_p.h src/gui/embedded/directfb.pri src/gui/kernel/qapplication_win.cpp src/gui/painting/qdrawutil.cpp src/opengl/qgl_p.h src/sql/drivers/odbc/qsql_odbc.cpp src/sql/drivers/odbc/qsql_odbc.h tests/auto/auto.pro tests/auto/qgl/tst_qgl.cpp translations/assistant_adp_ru.ts
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qapplication_p.h1
-rw-r--r--src/gui/kernel/qapplication_s60.cpp42
-rw-r--r--src/gui/kernel/qapplication_win.cpp37
-rw-r--r--src/gui/kernel/qapplication_x11.cpp18
-rw-r--r--src/gui/kernel/qgesturemanager.cpp4
-rw-r--r--src/gui/kernel/qguifunctions_wince.cpp9
-rw-r--r--src/gui/kernel/qkeymapper_x11.cpp6
-rw-r--r--src/gui/kernel/qmime_win.cpp10
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60.cpp32
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60_p.h2
-rw-r--r--src/gui/kernel/qsound_mac.mm1
-rw-r--r--src/gui/kernel/qt_x11_p.h3
-rw-r--r--src/gui/kernel/qwidget.cpp30
-rw-r--r--src/gui/kernel/qwidget_mac.mm18
-rw-r--r--src/gui/kernel/qwidget_s60.cpp41
-rw-r--r--src/gui/kernel/qwidget_win.cpp2
-rw-r--r--src/gui/kernel/qwinnativepangesturerecognizer_win_p.h32
17 files changed, 235 insertions, 53 deletions
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 8653dec229..6d71cfe466 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -543,6 +543,7 @@ public:
const QList<QTouchEvent::TouchPoint> &touchPoints);
#if defined(Q_WS_WIN)
+ static bool HasTouchSupport;
static PtrRegisterTouchWindow RegisterTouchWindow;
static PtrGetTouchInputInfo GetTouchInputInfo;
static PtrCloseTouchInputHandle CloseTouchInputHandle;
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index baefdfd1f9..ccc39c960a 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -597,9 +597,9 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod
TUint s60Keysym = QApplicationPrivate::resolveS60ScanCode(keyEvent.iScanCode,
keyEvent.iCode);
int keyCode;
- if (s60Keysym == EKeyNull){ //some key events have 0 in iCode, for them iScanCode should be used
- keyCode = qt_keymapper_private()->mapS60ScanCodesToQt(keyEvent.iScanCode);
- } else if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) {
+ if (s60Keysym == EKeyNull){ //some key events have 0 in iCode, for them iScanCode should be used
+ keyCode = qt_keymapper_private()->mapS60ScanCodesToQt(keyEvent.iScanCode);
+ } else if (s60Keysym >= 0x20 && s60Keysym < ENonCharacterKeyBase) {
// Normal characters keys.
keyCode = s60Keysym;
} else {
@@ -966,13 +966,26 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle());
#ifdef Q_WS_S60
// If widget is fullscreen/minimized, hide status pane and button container otherwise show them.
- CEikStatusPane* statusPane = S60->statusPane();
- CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer();
+ CEikStatusPane *statusPane = S60->statusPane();
+ CEikButtonGroupContainer *buttonGroup = S60->buttonGroupContainer();
TBool visible = !(qwidget->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized));
if (statusPane)
statusPane->MakeVisible(visible);
- if (buttonGroup)
- buttonGroup->MakeVisible(visible);
+ if (buttonGroup) {
+ // Visibility
+ const TBool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen;
+ const TBool cbaVisibilityHint = qwidget->windowFlags() & Qt::WindowSoftkeysVisibleHint;
+ buttonGroup->MakeVisible(visible || (isFullscreen && cbaVisibilityHint));
+
+ // Responsiviness
+ CEikCba *cba = static_cast<CEikCba *>( buttonGroup->ButtonGroup() ); // downcast from MEikButtonGroup
+ TUint cbaFlags = cba->ButtonGroupFlags();
+ if(qwidget->windowFlags() & Qt::WindowSoftkeysRespondHint)
+ cbaFlags |= EAknCBAFlagRespondWhenInvisible;
+ else
+ cbaFlags &= ~EAknCBAFlagRespondWhenInvisible;
+ cba->SetButtonGroupFlags(cbaFlags);
+ }
#endif
} else if (QApplication::activeWindow() == qwidget->window()) {
if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) {
@@ -1016,6 +1029,16 @@ void QSymbianControl::HandleResourceChange(int resourceType)
} else if (qwidget->isMaximized()) {
TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
SetExtent(r.iTl, r.Size());
+ } else if (!qwidget->isMinimized()){ // Normal geometry
+ if (!qwidget->testAttribute(Qt::WA_Resized)) {
+ qwidget->adjustSize();
+ qwidget->setAttribute(Qt::WA_Resized, false); //not a user resize
+ }
+ if (!qwidget->testAttribute(Qt::WA_Moved)) {
+ TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();
+ SetPosition(r.iTl);
+ qwidget->setAttribute(Qt::WA_Moved, false); // not really an explicit position
+ }
}
break;
}
@@ -1229,7 +1252,7 @@ void qt_init(QApplicationPrivate * /* priv */, int)
S60->avkonComponentsSupportTransparency = (value==1) ? true : false;
}
}
-#endif
+#endif
if (touch) {
QApplicationPrivate::navigationMode = Qt::NavigationModeNone;
@@ -1450,6 +1473,9 @@ void QApplicationPrivate::closePopup(QWidget *popup)
QWidget *fw = QApplicationPrivate::active_window ? QApplicationPrivate::active_window->focusWidget()
: q_func()->focusWidget();
if (fw) {
+ if(fw->window()->isModal()) // restore pointer capture for modal window
+ fw->effectiveWinId()->SetPointerCapture(true);
+
if (fw != q_func()->focusWidget()) {
fw->setFocus(Qt::PopupFocusReason);
} else {
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 131b9bb7dd..9872514b9f 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -115,6 +115,8 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c
# include <winable.h>
#endif
+#include "private/qwinnativepangesturerecognizer_win_p.h"
+
#ifndef WM_TOUCH
# define WM_TOUCH 0x0240
@@ -2524,6 +2526,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
}
result = false;
break;
+#if !defined(Q_WS_WINCE) || defined(QT_WINCE_GESTURES)
case WM_GESTURE: {
GESTUREINFO gi;
memset(&gi, 0, sizeof(GESTUREINFO));
@@ -2556,6 +2559,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
result = true;
break;
}
+#endif // !defined(Q_WS_WINCE) || defined(QT_WINCE_GESTURES)
#ifndef QT_NO_CURSOR
case WM_SETCURSOR: {
QCursor *ovr = QApplication::overrideCursor();
@@ -4012,12 +4016,45 @@ void QSessionManager::cancel()
#endif //QT_NO_SESSIONMANAGER
+bool QApplicationPrivate::HasTouchSupport = false;
PtrRegisterTouchWindow QApplicationPrivate::RegisterTouchWindow = 0;
PtrGetTouchInputInfo QApplicationPrivate::GetTouchInputInfo = 0;
PtrCloseTouchInputHandle QApplicationPrivate::CloseTouchInputHandle = 0;
void QApplicationPrivate::initializeMultitouch_sys()
{
+ static const IID QT_IID_IInkTablets = {0x112086D9, 0x7779, 0x4535, {0xA6, 0x99, 0x86, 0x2B, 0x43, 0xAC, 0x18, 0x63} };
+ static const IID QT_IID_IInkTablet2 = {0x90c91ad2, 0xfa36, 0x49d6, {0x95, 0x16, 0xce, 0x8d, 0x57, 0x0f, 0x6f, 0x85} };
+ static const CLSID QT_CLSID_InkTablets = {0x6E4FCB12, 0x510A, 0x4d40, {0x93, 0x04, 0x1D, 0xA1, 0x0A, 0xE9, 0x14, 0x7C} };
+
+ IInkTablets *iInkTablets = 0;
+ HRESULT hr = CoCreateInstance(QT_CLSID_InkTablets, NULL, CLSCTX_ALL, QT_IID_IInkTablets, (void**)&iInkTablets);
+ if (SUCCEEDED(hr)) {
+ long count = 0;
+ iInkTablets->get_Count(&count);
+ for (long i = 0; i < count; ++i) {
+ IInkTablet *iInkTablet = 0;
+ hr = iInkTablets->Item(i, &iInkTablet);
+ if (FAILED(hr))
+ continue;
+ IInkTablet2 *iInkTablet2 = 0;
+ hr = iInkTablet->QueryInterface(QT_IID_IInkTablet2, (void**)&iInkTablet2);
+ iInkTablet->Release();
+ if (FAILED(hr))
+ continue;
+ TabletDeviceKind kind;
+ hr = iInkTablet2->get_DeviceKind(&kind);
+ iInkTablet2->Release();
+ if (FAILED(hr))
+ continue;
+ if (kind == TDK_Touch) {
+ QApplicationPrivate::HasTouchSupport = true;
+ break;
+ }
+ }
+ iInkTablets->Release();
+ }
+
QLibrary library(QLatin1String("user32"));
// MinGW (g++ 3.4.5) accepts only C casts.
RegisterTouchWindow = (PtrRegisterTouchWindow)(library.resolve("RegisterTouchWindow"));
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 3c2c743dfa..20a7ff2908 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -96,6 +96,11 @@ extern "C" {
}
#endif
+#ifndef QT_GUI_DOUBLE_CLICK_RADIUS
+#define QT_GUI_DOUBLE_CLICK_RADIUS 5
+#endif
+
+
//#define ALIEN_DEBUG
#if !defined(QT_NO_GLIB)
@@ -312,9 +317,14 @@ static const char * x11_atomnames = {
"_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"
};
Q_GUI_EXPORT QX11Data *qt_x11Data = 0;
@@ -2340,12 +2350,12 @@ void qt_init(QApplicationPrivate *priv, int,
gotStylus = true;
}
#else
- if (devs->type == ATOM(XWacomStylus)) {
+ if (devs->type == ATOM(XWacomStylus) || devs->type == ATOM(XTabletStylus)) {
deviceType = QTabletEvent::Stylus;
if (wacomDeviceName()->isEmpty())
wacomDeviceName()->append(devs->name);
gotStylus = true;
- } else if (devs->type == ATOM(XWacomEraser)) {
+ } else if (devs->type == ATOM(XWacomEraser) || devs->type == ATOM(XTabletEraser)) {
deviceType = QTabletEvent::XFreeEraser;
gotEraser = true;
}
@@ -4194,8 +4204,8 @@ bool QETWidget::translateMouseEvent(const XEvent *event)
mouseButtonPressed == button &&
(long)event->xbutton.time -(long)mouseButtonPressTime
< QApplication::doubleClickInterval() &&
- qAbs(event->xbutton.x - mouseXPos) < 5 &&
- qAbs(event->xbutton.y - mouseYPos) < 5) {
+ qAbs(event->xbutton.x - mouseXPos) < QT_GUI_DOUBLE_CLICK_RADIUS &&
+ qAbs(event->xbutton.y - mouseYPos) < QT_GUI_DOUBLE_CLICK_RADIUS) {
type = QEvent::MouseButtonDblClick;
mouseButtonPressTime -= 2000; // no double-click next time
} else {
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index 89ad94d339..aa6720e802 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -45,6 +45,7 @@
#include "private/qgesture_p.h"
#include "private/qgraphicsitem_p.h"
#include "private/qevent_p.h"
+#include "private/qapplication_p.h"
#include "qgesture.h"
#include "qevent.h"
#include "qgraphicsitem.h"
@@ -86,7 +87,8 @@ QGestureManager::QGestureManager(QObject *parent)
#endif
#if defined(Q_OS_WIN)
#if !defined(QT_NO_NATIVE_GESTURES)
- registerGestureRecognizer(new QWinNativePanGestureRecognizer);
+ if (QApplicationPrivate::HasTouchSupport)
+ registerGestureRecognizer(new QWinNativePanGestureRecognizer);
#endif
#else
registerGestureRecognizer(new QTapAndHoldGestureRecognizer);
diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp
index ac4cdc8ddd..f5004b09ff 100644
--- a/src/gui/kernel/qguifunctions_wince.cpp
+++ b/src/gui/kernel/qguifunctions_wince.cpp
@@ -278,7 +278,14 @@ int qt_wince_get_version()
bool qt_wince_is_windows_mobile_65()
{
- return ((qt_wince_get_version() == 52) && (qt_wince_get_build() > 2000));
+ const DWORD dwFirstWM65BuildNumber = 21139;
+ OSVERSIONINFO osvi;
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ if (!GetVersionEx(&osvi))
+ return false;
+ return osvi.dwMajorVersion > 5
+ || (osvi.dwMajorVersion == 5 && (osvi.dwMinorVersion > 2 ||
+ (osvi.dwMinorVersion == 2 && osvi.dwBuildNumber >= dwFirstWM65BuildNumber)));
}
bool qt_wince_is_pocket_pc() {
diff --git a/src/gui/kernel/qkeymapper_x11.cpp b/src/gui/kernel/qkeymapper_x11.cpp
index 4e6c847c60..b32b62672d 100644
--- a/src/gui/kernel/qkeymapper_x11.cpp
+++ b/src/gui/kernel/qkeymapper_x11.cpp
@@ -1073,8 +1073,8 @@ static const unsigned int KeyTbl[] = {
XF86XK_AudioNext, Qt::Key_MediaNext,
XF86XK_AudioRecord, Qt::Key_MediaRecord,
XF86XK_Mail, Qt::Key_LaunchMail,
- XF86XK_MyComputer, Qt::Key_Launch0,
- XF86XK_Calculator, Qt::Key_Calculator,
+ XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 5: remap properly
+ XF86XK_Calculator, Qt::Key_Launch1,
XF86XK_Memo, Qt::Key_Memo,
XF86XK_ToDoList, Qt::Key_ToDoList,
XF86XK_Calendar, Qt::Key_Calendar,
@@ -1172,7 +1172,7 @@ static const unsigned int KeyTbl[] = {
XF86XK_Bluetooth, Qt::Key_Bluetooth,
XF86XK_Suspend, Qt::Key_Suspend,
XF86XK_Hibernate, Qt::Key_Hibernate,
- XF86XK_Launch0, Qt::Key_Launch2,
+ XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly
XF86XK_Launch1, Qt::Key_Launch3,
XF86XK_Launch2, Qt::Key_Launch4,
XF86XK_Launch3, Qt::Key_Launch5,
diff --git a/src/gui/kernel/qmime_win.cpp b/src/gui/kernel/qmime_win.cpp
index e191d7b72f..39633bf7c0 100644
--- a/src/gui/kernel/qmime_win.cpp
+++ b/src/gui/kernel/qmime_win.cpp
@@ -640,14 +640,18 @@ bool QWindowsMimeURI::convertFromMime(const FORMATETC &formatetc, const QMimeDat
} else if (getCf(formatetc) == CF_INETURL_W) {
QList<QUrl> urls = mimeData->urls();
QByteArray result;
- QString url = urls.at(0).toString();
- result = QByteArray((const char *)url.utf16(), url.length() * sizeof(ushort));
+ if (!urls.isEmpty()) {
+ QString url = urls.at(0).toString();
+ result = QByteArray((const char *)url.utf16(), url.length() * sizeof(ushort));
+ }
result.append('\0');
result.append('\0');
return setData(result, pmedium);
} else if (getCf(formatetc) == CF_INETURL) {
QList<QUrl> urls = mimeData->urls();
- QByteArray result = urls.at(0).toString().toLocal8Bit();
+ QByteArray result;
+ if (!urls.isEmpty())
+ result = urls.at(0).toString().toLocal8Bit();
return setData(result, pmedium);
}
}
diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp
index 8ac1e31e64..3a0304c586 100644
--- a/src/gui/kernel/qsoftkeymanager_s60.cpp
+++ b/src/gui/kernel/qsoftkeymanager_s60.cpp
@@ -60,7 +60,7 @@ const int LSK_POSITION = 0;
const int MSK_POSITION = 3;
const int RSK_POSITION = 2;
-QSoftKeyManagerPrivateS60::QSoftKeyManagerPrivateS60()
+QSoftKeyManagerPrivateS60::QSoftKeyManagerPrivateS60() : cbaHasImage(4) // 4 since MSK position index is 3
{
cachedCbaIconSize[0] = QSize(0,0);
cachedCbaIconSize[1] = QSize(0,0);
@@ -73,11 +73,21 @@ bool QSoftKeyManagerPrivateS60::skipCbaUpdate()
// Lets not update softkeys if
// 1. We don't have application panes, i.e. cba
// 2. Our CBA is not active, i.e. S60 native dialog or menu with custom CBA is shown
+ // 2.1. Except if thre is no current CBA at all and WindowSoftkeysRespondHint is set
+
// Note: Cannot use IsDisplayingMenuOrDialog since CBA update can be triggered before
// menu/dialog CBA is actually displayed i.e. it is being costructed.
CEikButtonGroupContainer *appUiCba = S60->buttonGroupContainer();
+ // CEikButtonGroupContainer::Current returns 0 if CBA is not visible at all
CEikButtonGroupContainer *currentCba = CEikButtonGroupContainer::Current();
- if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) || appUiCba != currentCba) {
+ // Check if softkey need to be update even they are not visible
+ bool cbaRespondsWhenInvisible = false;
+ QWidget *window = QApplication::activeWindow();
+ if (window && (window->windowFlags() & Qt::WindowSoftkeysRespondHint))
+ cbaRespondsWhenInvisible = true;
+
+ if (QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)
+ || (appUiCba != currentCba && !cbaRespondsWhenInvisible)) {
return true;
}
return false;
@@ -255,10 +265,14 @@ bool QSoftKeyManagerPrivateS60::setSoftkeyImage(CEikButtonGroupContainer *cba,
myimage->SetPicture( nBitmap, nMask ); // nBitmap and nMask ownership transfered
EikSoftkeyImage::SetImage(cba, *myimage, left); // Takes myimage ownership
+ cbaHasImage[position] = true;
ret = true;
} else {
// Restore softkey to text based
- EikSoftkeyImage::SetLabel(cba, left);
+ if (cbaHasImage[position]) {
+ EikSoftkeyImage::SetLabel(cba, left);
+ cbaHasImage[position] = false;
+ }
}
}
return ret;
@@ -274,7 +288,12 @@ bool QSoftKeyManagerPrivateS60::setSoftkey(CEikButtonGroupContainer &cba,
TPtrC nativeText = qt_QString2TPtrC(text);
int command = S60_COMMAND_START + position;
setNativeSoftkey(cba, position, command, nativeText);
- cba.DimCommand(command, !action->isEnabled());
+ // QMainWindow "Options" action is set to invisible in order it does not appear in context menu
+ // and all invisible actions are by default disabled.
+ // However we never want to dim options softkey, even it is set to invisible
+ QVariant property = action->property(MENU_ACTION_PROPERTY);
+ const bool dimmed = (property.isValid() && property.toBool()) ? false : !action->isEnabled();
+ cba.DimCommand(command, dimmed);
realSoftKeyActions.insert(command, action);
return true;
}
@@ -311,7 +330,10 @@ bool QSoftKeyManagerPrivateS60::setRightSoftkey(CEikButtonGroupContainer &cba)
if (windowType != Qt::Dialog && windowType != Qt::Popup) {
QString text(QSoftKeyManager::tr("Exit"));
TPtrC nativeText = qt_QString2TPtrC(text);
- EikSoftkeyImage::SetLabel(&cba, false);
+ if (cbaHasImage[RSK_POSITION]) {
+ EikSoftkeyImage::SetLabel(&cba, false);
+ cbaHasImage[RSK_POSITION] = false;
+ }
setNativeSoftkey(cba, RSK_POSITION, EAknSoftkeyExit, nativeText);
return true;
}
diff --git a/src/gui/kernel/qsoftkeymanager_s60_p.h b/src/gui/kernel/qsoftkeymanager_s60_p.h
index 823a2db63f..a5e5016f4a 100644
--- a/src/gui/kernel/qsoftkeymanager_s60_p.h
+++ b/src/gui/kernel/qsoftkeymanager_s60_p.h
@@ -53,6 +53,7 @@
// We mean it.
//
+#include "qbitarray.h"
#include "private/qobject_p.h"
#include "private/qsoftkeymanager_common_p.h"
@@ -98,6 +99,7 @@ private:
private:
QHash<int, QAction*> realSoftKeyActions;
QSize cachedCbaIconSize[4];
+ QBitArray cbaHasImage;
};
diff --git a/src/gui/kernel/qsound_mac.mm b/src/gui/kernel/qsound_mac.mm
index 61e42ba309..71fd663c62 100644
--- a/src/gui/kernel/qsound_mac.mm
+++ b/src/gui/kernel/qsound_mac.mm
@@ -174,6 +174,7 @@ NSSound *QAuServerMac::createNSSound(const QString &fileName, QSound *qSound)
NSSound * const nsSound = [[NSSound alloc] initWithContentsOfFile: nsFileName byReference:YES];
QMacSoundDelegate * const delegate = [[QMacSoundDelegate alloc] initWithQSound:qSound:this];
[nsSound setDelegate:delegate];
+ [nsFileName release];
return nsSound;
}
diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h
index 167557bdf6..8af4df538c 100644
--- a/src/gui/kernel/qt_x11_p.h
+++ b/src/gui/kernel/qt_x11_p.h
@@ -672,6 +672,9 @@ struct QX11Data
XWacomCursor,
XWacomEraser,
+ XTabletStylus,
+ XTabletEraser,
+
NPredefinedAtoms,
_QT_SETTINGS_TIMESTAMP = NPredefinedAtoms,
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index ed9d5deb51..e5310eab78 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -7583,6 +7583,23 @@ void QWidgetPrivate::hideChildren(bool spontaneous)
QWidget *widget = qobject_cast<QWidget*>(childList.at(i));
if (!widget || widget->isWindow() || widget->testAttribute(Qt::WA_WState_Hidden))
continue;
+#ifdef QT_MAC_USE_COCOA
+ // Before doing anything we need to make sure that we don't leave anything in a non-consistent state.
+ // When hiding a widget we need to make sure that no mouse_down events are active, because
+ // the mouse_up event will never be received by a hidden widget or one of its descendants.
+ // The solution is simple, before going through with this we check if there are any mouse_down events in
+ // progress, if so we check if it is related to this widget or not. If so, we just reset the mouse_down and
+ // then we continue.
+ // In X11 and Windows we send a mouse_release event, however we don't do that here because we were already
+ // ignoring that from before. I.e. Carbon did not send the mouse release event, so we will not send the
+ // mouse release event. There are two ways to interpret this:
+ // 1. If we don't send the mouse release event, the widget might get into an inconsistent state, i.e. it
+ // might be waiting for a release event that will never arrive.
+ // 2. If we send the mouse release event, then the widget might decide to trigger an action that is not
+ // supposed to trigger because it is not visible.
+ if(widget == qt_button_down)
+ qt_button_down = 0;
+#endif // QT_MAC_USE_COCOA
if (spontaneous)
widget->setAttribute(Qt::WA_Mapped, false);
else
@@ -7975,13 +7992,16 @@ inline void setDisabledStyle(QWidget *w, bool setStyle)
// set/reset WS_DISABLED style.
if(w && w->isWindow() && w->isVisible() && w->isEnabled()) {
LONG dwStyle = GetWindowLong(w->winId(), GWL_STYLE);
+ LONG newStyle = dwStyle;
if (setStyle)
- dwStyle |= WS_DISABLED;
+ newStyle |= WS_DISABLED;
else
- dwStyle &= ~WS_DISABLED;
- SetWindowLong(w->winId(), GWL_STYLE, dwStyle);
- // we might need to repaint in some situations (eg. menu)
- w->repaint();
+ newStyle &= ~WS_DISABLED;
+ if (newStyle != dwStyle) {
+ SetWindowLong(w->winId(), GWL_STYLE, newStyle);
+ // we might need to repaint in some situations (eg. menu)
+ w->repaint();
+ }
}
}
#endif
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 6d8c97b844..5889589954 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -152,6 +152,7 @@ static bool qt_mac_raise_process = true;
static OSWindowRef qt_root_win = 0;
QWidget *mac_mouse_grabber = 0;
QWidget *mac_keyboard_grabber = 0;
+extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
#ifndef QT_MAC_USE_COCOA
#ifdef QT_NAMESPACE
@@ -872,7 +873,6 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
& ~Qt::WindowMaximized));
QApplication::sendSpontaneousEvent(widget, &e);
}
- extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
qt_button_down = 0;
} else if(ekind == kEventWindowCollapsed) {
if (!widget->isMinimized()) {
@@ -900,7 +900,6 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
//we send a hide to be like X11/Windows
QEvent e(QEvent::Hide);
QApplication::sendSpontaneousEvent(widget, &e);
- extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
qt_button_down = 0;
} else if(ekind == kEventWindowToolbarSwitchMode) {
macSendToolbarChangeEvent(widget);
@@ -1274,6 +1273,11 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event,
if (widget->isVisible() && widget->updatesEnabled()) { //process the actual paint event.
if(widget->testAttribute(Qt::WA_WState_InPaintEvent))
qWarning("QWidget::repaint: Recursive repaint detected");
+ if (widget->isWindow() && !widget->d_func()->isOpaque
+ && !widget->testAttribute(Qt::WA_MacBrushedMetal)) {
+ QRect qrgnRect = qrgn.boundingRect();
+ CGContextClearRect(cg, CGRectMake(qrgnRect.x(), qrgnRect.y(), qrgnRect.width(), qrgnRect.height()));
+ }
QPoint redirectionOffset(0, 0);
QWidget *tl = widget->window();
@@ -1324,13 +1328,6 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event,
widget->d_func()->restoreRedirected();
}
- if (widget->isWindow() && !widget->d_func()->isOpaque
- && !widget->testAttribute(Qt::WA_MacBrushedMetal)) {
- QRect qrgnRect = qrgn.boundingRect();
- CGContextClearRect(cg, CGRectMake(qrgnRect.x(), qrgnRect.y(), qrgnRect.width(), qrgnRect.height()));
- }
-
-
if(!HIObjectIsOfClass((HIObjectRef)hiview, kObjectQWidget))
CallNextEventHandler(er, event);
@@ -1527,7 +1524,6 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event,
if (widget) {
qt_event_request_window_change(widget);
if (!HIViewIsVisible(HIViewRef(widget->winId()))) {
- extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
if (widget == qt_button_down)
qt_button_down = 0;
}
@@ -1536,7 +1532,6 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event,
break; }
case kEventClassMouse: {
bool send_to_app = false;
- extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
if(qt_button_down)
send_to_app = true;
if(send_to_app) {
@@ -3493,7 +3488,6 @@ void QWidgetPrivate::hide_sys()
Q_Q(QWidget);
if((q->windowType() == Qt::Desktop)) //you can't hide the desktop!
return;
-
QMacCocoaAutoReleasePool pool;
if(q->isWindow()) {
#ifdef QT_MAC_USE_COCOA
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index ebd289c6e5..7fb21d2c41 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -1042,7 +1042,13 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
Q_D(QWidget);
Qt::WindowStates oldstate = windowState();
- if (oldstate == newstate)
+
+ const TBool isFullscreen = newstate & Qt::WindowFullScreen;
+ const TBool cbaRequested = windowFlags() & Qt::WindowSoftkeysVisibleHint;
+ const TBool cbaVisible = CEikButtonGroupContainer::Current() ? true : false;
+ const TBool softkeyVisibilityChange = isFullscreen && (cbaRequested != cbaVisible);
+
+ if (oldstate == newstate && !softkeyVisibilityChange)
return;
if (isWindow()) {
@@ -1058,16 +1064,27 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
#ifdef Q_WS_S60
// Hide window decoration when switching to fullsccreen / minimized otherwise show decoration.
- // The window decoration visibility has to be changed before doing actual window state
- // change since in that order the availableGeometry will return directly the right size and
+ // The window decoration visibility has to be changed before doing actual window state
+ // change since in that order the availableGeometry will return directly the right size and
// we will avoid unnecessarty redraws
- CEikStatusPane* statusPane = S60->statusPane();
- CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer();
- TBool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized));
+ CEikStatusPane *statusPane = S60->statusPane();
+ CEikButtonGroupContainer *buttonGroup = S60->buttonGroupContainer();
+ TBool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized));
if (statusPane)
statusPane->MakeVisible(visible);
- if (buttonGroup)
- buttonGroup->MakeVisible(visible);
+ if (buttonGroup) {
+ // Visibility
+ buttonGroup->MakeVisible(visible || (isFullscreen && cbaRequested));
+
+ // Responsiviness
+ CEikCba *cba = static_cast<CEikCba *>( buttonGroup->ButtonGroup() ); // downcast from MEikButtonGroup
+ TUint cbaFlags = cba->ButtonGroupFlags();
+ if(windowFlags() & Qt::WindowSoftkeysRespondHint)
+ cbaFlags |= EAknCBAFlagRespondWhenInvisible;
+ else
+ cbaFlags &= ~EAknCBAFlagRespondWhenInvisible;
+ cba->SetButtonGroupFlags(cbaFlags);
+ }
#endif // Q_WS_S60
createWinId();
@@ -1080,7 +1097,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
const QRect normalGeometry = (top->normalGeometry.width() < 0) ? geometry() : top->normalGeometry;
if (newstate & Qt::WindowFullScreen)
- setGeometry(qApp->desktop()->screenGeometry(this));
+ setGeometry(qApp->desktop()->availableGeometry(this));
else if (newstate & Qt::WindowMaximized)
setGeometry(qApp->desktop()->availableGeometry(this));
else
@@ -1220,8 +1237,10 @@ void QWidget::releaseMouse()
{
if (!qt_nograb() && QWidgetPrivate::mouseGrabber == this) {
Q_ASSERT(testAttribute(Qt::WA_WState_Created));
- WId id = effectiveWinId();
- id->SetPointerCapture(false);
+ if(!window()->isModal()) {
+ WId id = effectiveWinId();
+ id->SetPointerCapture(false);
+ }
QWidgetPrivate::mouseGrabber = 0;
#ifndef QT_NO_CURSOR
QApplication::restoreOverrideCursor();
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 8cab387eab..2dcbfc3e31 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -2073,6 +2073,8 @@ void QWidgetPrivate::winSetupGestures()
if (!q || !q->isVisible() || !nativeGesturePanEnabled)
return;
+ if (!QApplicationPrivate::HasTouchSupport)
+ return;
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
if (!qAppPriv->SetGestureConfig)
return;
diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
index c65fa5055e..146b067b5e 100644
--- a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
+++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
@@ -54,6 +54,38 @@
//
#include <QGestureRecognizer>
+#include <objbase.h>
+
+class IInkRectangle;
+class TabletHardwareCapabilities;
+class TabletPropertyMetricUnit;
+DECLARE_INTERFACE_(IInkTablet, IDispatch)
+{
+ STDMETHOD(get_Name)(THIS_ BSTR *Name) PURE;
+ STDMETHOD(get_PlugAndPlayId)(THIS_ BSTR *Id) PURE;
+ STDMETHOD(get_MaximumInputRectangle)(THIS_ IInkRectangle **Rectangle) PURE;
+ STDMETHOD(get_HardwareCapabilities)(THIS_ TabletHardwareCapabilities *Capabilities) PURE;
+ STDMETHOD(IsPacketPropertySupported)(THIS_ BSTR packetPropertyName) PURE;
+ STDMETHOD(GetPropertyMetrics)(THIS_ BSTR propertyName, long *Minimum, long *Maximum, TabletPropertyMetricUnit *Units, float *Resolution) PURE;
+};
+enum TabletDeviceKind
+{
+ TDK_Mouse = 0,
+ TDK_Pen = 1,
+ TDK_Touch = 2
+};
+DECLARE_INTERFACE_(IInkTablet2, IDispatch)
+{
+ STDMETHOD(get_DeviceKind)(THIS_ TabletDeviceKind *Kind) PURE;
+};
+DECLARE_INTERFACE_(IInkTablets, IDispatch)
+{
+ STDMETHOD(get_Count)(THIS_ long *Count) PURE;
+ STDMETHOD(get__NewEnum)(THIS_ IUnknown **_NewEnum) PURE;
+ STDMETHOD(get_DefaultTablet)(THIS_ IInkTablet **DefaultTablet) PURE;
+ STDMETHOD(Item)(THIS_ long Index, IInkTablet **Tablet) PURE;
+ STDMETHOD(IsPacketPropertySupported)(THIS_ BSTR packetPropertyName, VARIANT_BOOL *Supported) PURE;
+};
QT_BEGIN_NAMESPACE