diff options
author | David Boddie <dboddie@trolltech.com> | 2009-11-25 15:20:49 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2009-11-25 15:20:49 (GMT) |
commit | e58b0e2e562f1c5284ced8671d85df748a4a9639 (patch) | |
tree | cd60fd60d504d5613a24dac97a46c8fc4d51ba92 /src | |
parent | 6b760aa0701bd6dbbd7f2f16db2f554979273c1d (diff) | |
parent | 4d7b7dc0bdd12188d92a5d05a35991af7b53cc81 (diff) | |
download | Qt-e58b0e2e562f1c5284ced8671d85df748a4a9639.zip Qt-e58b0e2e562f1c5284ced8671d85df748a4a9639.tar.gz Qt-e58b0e2e562f1c5284ced8671d85df748a4a9639.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qfsfileengine_unix.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 2 | ||||
-rw-r--r-- | src/corelib/thread/qbasicatomic.h | 7 | ||||
-rw-r--r-- | src/corelib/xml/qxmlstream.g | 1 | ||||
-rw-r--r-- | src/corelib/xml/qxmlstream_p.h | 323 | ||||
-rw-r--r-- | src/dbus/qdbusconnection.cpp | 3 | ||||
-rw-r--r-- | src/dbus/qdbusconnection_p.h | 5 | ||||
-rw-r--r-- | src/dbus/qdbusconnectioninterface.cpp | 11 | ||||
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 18 | ||||
-rw-r--r-- | src/dbus/qdbusservicewatcher.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_win.cpp | 199 | ||||
-rw-r--r-- | src/gui/kernel/qcocoamenuloader_mac.mm | 7 | ||||
-rw-r--r-- | src/gui/widgets/qmenu_mac.mm | 6 |
13 files changed, 320 insertions, 269 deletions
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 35737b3..8cbf6a3 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1245,7 +1245,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla } if (offset < 0 || offset != qint64(QT_OFF_T(offset)) - || size < 0 || size > qint64(size_t(-1))) { + || size < 0 || quint64(size) > quint64(size_t(-1))) { q->setError(QFile::UnspecifiedError, qt_error_string(int(EINVAL))); return 0; } diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index b3497b9..b197b9d 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -725,7 +725,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) } } if (haveMessage) { - if (msg.message == WM_QT_SENDPOSTEDEVENTS) { + if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) { if (seenWM_QT_SENDPOSTEDEVENTS) { needWM_QT_SENDPOSTEDEVENTS = true; continue; diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index 7b86ee0..5017dbd 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -137,7 +137,12 @@ public: #if defined(QT_ARCH_WINDOWS) || defined(QT_ARCH_WINDOWSCE) union { T * volatile _q_value; - long volatile _q_value_integral; +# if !defined(Q_OS_WINCE) && !defined(__i386__) && !defined(_M_IX86) + qint64 +# else + long +# endif + volatile _q_value_integral; }; #else T * volatile _q_value; diff --git a/src/corelib/xml/qxmlstream.g b/src/corelib/xml/qxmlstream.g index 22ba33d..9921d41 100644 --- a/src/corelib/xml/qxmlstream.g +++ b/src/corelib/xml/qxmlstream.g @@ -915,6 +915,7 @@ markup ::= markup_start markup_list RBRACK; markup_list ::= markup_decl | space | pereference; markup_list ::= markup_list markup_decl | markup_list space | markup_list pereference; +markup_list ::=; markup_decl ::= element_decl | attlist_decl | entity_decl | entity_done | notation_decl | processing_instruction | comment; diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index 253f8bd..5eea065 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -121,7 +121,7 @@ public: XML = 54, ACCEPT_STATE = 416, - RULE_COUNT = 269, + RULE_COUNT = 270, STATE_COUNT = 427, TERMINAL_COUNT = 57, NON_TERMINAL_COUNT = 84, @@ -172,105 +172,105 @@ const char *const QXmlStreamReader_Table::spell [] = { const short QXmlStreamReader_Table::lhs [] = { 57, 57, 59, 59, 59, 59, 59, 59, 59, 59, 67, 68, 64, 72, 72, 72, 75, 66, 66, 66, - 66, 79, 78, 80, 80, 80, 80, 80, 80, 81, - 81, 81, 81, 81, 81, 81, 87, 83, 88, 88, - 88, 88, 91, 92, 93, 93, 93, 93, 94, 94, - 96, 96, 96, 97, 97, 98, 98, 99, 99, 100, - 100, 89, 89, 95, 90, 101, 101, 103, 103, 103, - 103, 103, 103, 103, 103, 103, 103, 104, 105, 105, - 105, 105, 107, 108, 109, 109, 84, 84, 110, 110, - 112, 112, 85, 85, 85, 65, 65, 76, 114, 63, - 115, 116, 86, 86, 86, 117, 117, 117, 117, 117, + 66, 79, 78, 80, 80, 80, 80, 80, 80, 80, + 81, 81, 81, 81, 81, 81, 81, 87, 83, 88, + 88, 88, 88, 91, 92, 93, 93, 93, 93, 94, + 94, 96, 96, 96, 97, 97, 98, 98, 99, 99, + 100, 100, 89, 89, 95, 90, 101, 101, 103, 103, + 103, 103, 103, 103, 103, 103, 103, 103, 104, 105, + 105, 105, 105, 107, 108, 109, 109, 84, 84, 110, + 110, 112, 112, 85, 85, 85, 65, 65, 76, 114, + 63, 115, 116, 86, 86, 86, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, - 117, 117, 117, 117, 117, 117, 117, 117, 118, 118, - 119, 119, 119, 119, 119, 119, 119, 119, 122, 70, - 70, 70, 70, 123, 124, 123, 124, 123, 124, 123, - 124, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 117, 117, 117, 117, 117, 117, 117, 117, 117, 118, + 118, 119, 119, 119, 119, 119, 119, 119, 119, 122, + 70, 70, 70, 70, 123, 124, 123, 124, 123, 124, + 123, 124, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 125, 73, 113, 113, 113, 113, 127, - 128, 127, 128, 127, 128, 127, 128, 129, 129, 129, + 126, 126, 126, 126, 125, 73, 113, 113, 113, 113, + 127, 128, 127, 128, 127, 128, 127, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, - 129, 129, 106, 106, 106, 106, 131, 132, 131, 132, - 131, 131, 132, 132, 133, 133, 133, 133, 135, 71, - 71, 71, 136, 136, 137, 62, 60, 61, 138, 121, - 82, 130, 134, 120, 139, 139, 139, 139, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 74, 69, - 69, 77, 111, 102, 102, 102, 102, 102, 140}; + 129, 129, 129, 106, 106, 106, 106, 131, 132, 131, + 132, 131, 131, 132, 132, 133, 133, 133, 133, 135, + 71, 71, 71, 136, 136, 137, 62, 60, 61, 138, + 121, 82, 130, 134, 120, 139, 139, 139, 139, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 74, + 69, 69, 77, 111, 102, 102, 102, 102, 102, 140}; const short QXmlStreamReader_Table::rhs [] = { 2, 1, 4, 2, 2, 2, 2, 2, 2, 0, 1, 1, 9, 2, 4, 0, 4, 4, 6, 6, - 4, 1, 3, 1, 1, 1, 2, 2, 2, 1, - 1, 1, 1, 1, 1, 1, 4, 4, 1, 1, - 1, 1, 1, 2, 1, 1, 1, 0, 2, 2, - 2, 6, 6, 1, 5, 1, 5, 3, 5, 0, - 1, 6, 8, 4, 2, 1, 5, 1, 1, 1, - 1, 1, 1, 1, 1, 6, 7, 1, 2, 2, - 1, 4, 3, 3, 1, 2, 5, 6, 4, 6, - 3, 5, 5, 3, 4, 4, 5, 2, 3, 2, - 2, 4, 5, 5, 7, 1, 1, 1, 1, 1, + 4, 1, 3, 1, 1, 1, 2, 2, 2, 0, + 1, 1, 1, 1, 1, 1, 1, 4, 4, 1, + 1, 1, 1, 1, 2, 1, 1, 1, 0, 2, + 2, 2, 6, 6, 1, 5, 1, 5, 3, 5, + 0, 1, 6, 8, 4, 2, 1, 5, 1, 1, + 1, 1, 1, 1, 1, 1, 6, 7, 1, 2, + 2, 1, 4, 3, 3, 1, 2, 5, 6, 4, + 6, 3, 5, 5, 3, 4, 4, 5, 2, 3, + 2, 2, 4, 5, 5, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, - 2, 3, 3, 2, 2, 2, 2, 1, 1, 1, + 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, + 2, 2, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 2, 2, 3, 3, 2, - 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, + 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 2, 3, 3, 2, 2, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 5, 0, - 1, 3, 1, 3, 2, 4, 3, 5, 1, 3, - 3, 3, 3, 4, 1, 1, 2, 2, 2, 4, - 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2}; + 1, 1, 1, 2, 2, 3, 3, 2, 2, 2, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 5, + 0, 1, 3, 1, 3, 2, 4, 3, 5, 1, + 3, 3, 3, 3, 4, 1, 1, 2, 2, 2, + 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 2}; const short QXmlStreamReader_Table::action_default [] = { - 10, 258, 0, 2, 1, 0, 124, 116, 118, 119, - 126, 128, 122, 11, 113, 107, 0, 108, 127, 110, - 114, 112, 120, 123, 125, 106, 109, 111, 117, 115, - 130, 121, 239, 12, 253, 135, 249, 252, 0, 129, - 139, 256, 16, 251, 137, 136, 0, 255, 138, 258, - 230, 257, 254, 0, 0, 263, 0, 246, 245, 0, - 248, 247, 244, 240, 98, 262, 0, 235, 0, 0, - 259, 96, 97, 100, 0, 131, 133, 132, 134, 0, - 0, 260, 0, 0, 175, 0, 172, 164, 166, 167, - 141, 153, 170, 161, 155, 156, 152, 158, 162, 160, - 168, 171, 151, 154, 157, 159, 165, 163, 173, 169, - 149, 174, 0, 143, 147, 145, 150, 140, 148, 0, - 146, 142, 144, 0, 15, 14, 261, 0, 22, 21, - 260, 0, 0, 20, 0, 0, 31, 36, 30, 0, - 32, 260, 0, 33, 0, 24, 0, 34, 0, 26, - 35, 25, 0, 241, 40, 39, 260, 42, 48, 260, - 41, 0, 43, 260, 48, 260, 0, 260, 0, 48, - 0, 47, 45, 46, 50, 51, 260, 260, 0, 56, - 260, 53, 260, 0, 57, 0, 54, 260, 52, 260, - 0, 55, 64, 0, 260, 60, 260, 0, 58, 61, - 62, 0, 260, 0, 0, 59, 63, 44, 49, 65, - 0, 38, 0, 0, 260, 0, 93, 94, 0, 0, - 0, 0, 260, 0, 209, 200, 202, 204, 177, 189, - 207, 198, 192, 190, 193, 188, 195, 197, 205, 208, - 187, 191, 194, 196, 201, 199, 203, 206, 210, 212, - 211, 185, 0, 0, 242, 179, 183, 181, 0, 0, - 92, 186, 176, 184, 0, 182, 178, 180, 91, 0, - 95, 0, 0, 0, 0, 0, 260, 85, 260, 0, - 261, 0, 86, 0, 88, 68, 73, 72, 69, 70, - 71, 260, 74, 75, 0, 0, 0, 268, 267, 265, - 266, 264, 66, 260, 0, 260, 0, 0, 67, 76, - 260, 0, 260, 0, 0, 77, 0, 78, 0, 81, - 84, 0, 0, 214, 224, 223, 0, 226, 228, 227, - 225, 0, 243, 216, 220, 218, 222, 213, 221, 0, - 219, 215, 217, 0, 80, 79, 0, 82, 0, 83, - 87, 99, 0, 37, 0, 0, 0, 0, 90, 89, - 0, 102, 23, 27, 29, 28, 0, 0, 260, 261, - 0, 260, 0, 105, 104, 260, 0, 103, 101, 0, - 0, 18, 260, 17, 0, 19, 0, 0, 250, 0, - 260, 0, 238, 0, 231, 237, 0, 236, 233, 260, - 260, 261, 232, 234, 0, 260, 0, 229, 260, 0, - 260, 0, 230, 0, 0, 13, 269, 9, 5, 8, - 4, 0, 7, 258, 6, 0, 3}; + 10, 259, 0, 2, 1, 0, 125, 117, 119, 120, + 127, 129, 123, 11, 114, 108, 0, 109, 128, 111, + 115, 113, 121, 124, 126, 107, 110, 112, 118, 116, + 131, 122, 240, 12, 254, 136, 250, 253, 0, 130, + 140, 257, 16, 252, 138, 137, 0, 256, 139, 259, + 231, 258, 255, 0, 0, 264, 0, 247, 246, 0, + 249, 248, 245, 241, 99, 263, 0, 236, 0, 0, + 260, 97, 98, 101, 0, 132, 134, 133, 135, 0, + 0, 261, 0, 0, 176, 0, 173, 165, 167, 168, + 142, 154, 171, 162, 156, 157, 153, 159, 163, 161, + 169, 172, 152, 155, 158, 160, 166, 164, 174, 170, + 150, 175, 0, 144, 148, 146, 151, 141, 149, 0, + 147, 143, 145, 0, 15, 14, 262, 0, 22, 21, + 261, 30, 0, 20, 0, 0, 32, 37, 31, 0, + 33, 261, 0, 34, 0, 24, 0, 35, 0, 26, + 36, 25, 0, 242, 41, 40, 261, 43, 49, 261, + 42, 0, 44, 261, 49, 261, 0, 261, 0, 49, + 0, 48, 46, 47, 51, 52, 261, 261, 0, 57, + 261, 54, 261, 0, 58, 0, 55, 261, 53, 261, + 0, 56, 65, 0, 261, 61, 261, 0, 59, 62, + 63, 0, 261, 0, 0, 60, 64, 45, 50, 66, + 0, 39, 0, 0, 261, 0, 94, 95, 0, 0, + 0, 0, 261, 0, 210, 201, 203, 205, 178, 190, + 208, 199, 193, 191, 194, 189, 196, 198, 206, 209, + 188, 192, 195, 197, 202, 200, 204, 207, 211, 213, + 212, 186, 0, 0, 243, 180, 184, 182, 0, 0, + 93, 187, 177, 185, 0, 183, 179, 181, 92, 0, + 96, 0, 0, 0, 0, 0, 261, 86, 261, 0, + 262, 0, 87, 0, 89, 69, 74, 73, 70, 71, + 72, 261, 75, 76, 0, 0, 0, 269, 268, 266, + 267, 265, 67, 261, 0, 261, 0, 0, 68, 77, + 261, 0, 261, 0, 0, 78, 0, 79, 0, 82, + 85, 0, 0, 215, 225, 224, 0, 227, 229, 228, + 226, 0, 244, 217, 221, 219, 223, 214, 222, 0, + 220, 216, 218, 0, 81, 80, 0, 83, 0, 84, + 88, 100, 0, 38, 0, 0, 0, 0, 91, 90, + 0, 103, 23, 27, 29, 28, 0, 0, 261, 262, + 0, 261, 0, 106, 105, 261, 0, 104, 102, 0, + 0, 18, 261, 17, 0, 19, 0, 0, 251, 0, + 261, 0, 239, 0, 232, 238, 0, 237, 234, 261, + 261, 262, 233, 235, 0, 261, 0, 230, 261, 0, + 261, 0, 231, 0, 0, 13, 270, 9, 5, 8, + 4, 0, 7, 259, 6, 0, 3}; const short QXmlStreamReader_Table::goto_default [] = { 2, 4, 3, 49, 388, 43, 37, 52, 47, 41, @@ -736,8 +736,8 @@ public: } }; -class QXmlStreamEntityResolver; +class QXmlStreamEntityResolver; #ifndef QT_NO_XMLSTREAMREADER class QXmlStreamReaderPrivate : public QXmlStreamReader_Table, public QXmlStreamPrivateTagStack{ QXmlStreamReader *q_ptr; @@ -1355,44 +1355,44 @@ bool QXmlStreamReaderPrivate::parse() scanDtd = false; break; - case 36: + case 37: if (!scanString(spell[EMPTY], EMPTY, false) && !scanString(spell[ANY], ANY, false) && atEnd) { - resume(36); + resume(37); return false; } break; - case 42: + case 43: if (!scanString(spell[PCDATA], PCDATA, false) && atEnd) { - resume(42); + resume(43); return false; } break; - case 67: { + case 68: { lastAttributeIsCData = true; } break; - case 77: + case 78: if (!scanAfterDefaultDecl() && atEnd) { - resume(77); + resume(78); return false; } break; - case 82: + case 83: sym(1) = sym(2); lastAttributeValue.clear(); lastAttributeIsCData = false; if (!scanAttType() && atEnd) { - resume(82); + resume(83); return false; } break; - case 83: { + case 84: { DtdAttribute &dtdAttribute = dtdAttributes.push(); dtdAttribute.tagName.clear(); dtdAttribute.isCDATA = lastAttributeIsCData; @@ -1413,7 +1413,7 @@ bool QXmlStreamReaderPrivate::parse() } } break; - case 87: { + case 88: { if (referenceToUnparsedEntityDetected && !standalone) break; int n = dtdAttributes.size(); @@ -1433,9 +1433,9 @@ bool QXmlStreamReaderPrivate::parse() } } break; - case 88: { + case 89: { if (!scanPublicOrSystem() && atEnd) { - resume(88); + resume(89); return false; } EntityDeclaration &entityDeclaration = entityDeclarations.push(); @@ -1443,9 +1443,9 @@ bool QXmlStreamReaderPrivate::parse() entityDeclaration.name = symString(3); } break; - case 89: { + case 90: { if (!scanPublicOrSystem() && atEnd) { - resume(89); + resume(90); return false; } EntityDeclaration &entityDeclaration = entityDeclarations.push(); @@ -1454,9 +1454,9 @@ bool QXmlStreamReaderPrivate::parse() entityDeclaration.parameter = true; } break; - case 90: { + case 91: { if (!scanNData() && atEnd) { - resume(90); + resume(91); return false; } EntityDeclaration &entityDeclaration = entityDeclarations.top(); @@ -1464,9 +1464,9 @@ bool QXmlStreamReaderPrivate::parse() entityDeclaration.external = true; } break; - case 91: { + case 92: { if (!scanNData() && atEnd) { - resume(91); + resume(92); return false; } EntityDeclaration &entityDeclaration = entityDeclarations.top(); @@ -1475,7 +1475,7 @@ bool QXmlStreamReaderPrivate::parse() entityDeclaration.external = true; } break; - case 92: { + case 93: { EntityDeclaration &entityDeclaration = entityDeclarations.top(); entityDeclaration.notationName = symString(3); if (entityDeclaration.parameter) @@ -1483,8 +1483,8 @@ bool QXmlStreamReaderPrivate::parse() } //fall through - case 93: - case 94: { + case 94: + case 95: { if (referenceToUnparsedEntityDetected && !standalone) { entityDeclarations.pop(); break; @@ -1502,7 +1502,7 @@ bool QXmlStreamReaderPrivate::parse() } } break; - case 95: { + case 96: { setType(QXmlStreamReader::ProcessingInstruction); int pos = sym(4).pos + sym(4).len; processingInstructionTarget = symString(3); @@ -1515,39 +1515,39 @@ bool QXmlStreamReaderPrivate::parse() else if(!QXmlUtils::isNCName(piTarget)) raiseWellFormedError(QXmlStream::tr("%1 is an invalid processing instruction name.").arg(piTarget)); } else if (type != QXmlStreamReader::Invalid){ - resume(95); + resume(96); return false; } } break; - case 96: + case 97: setType(QXmlStreamReader::ProcessingInstruction); processingInstructionTarget = symString(3); if (!processingInstructionTarget.toString().compare(QLatin1String("xml"), Qt::CaseInsensitive)) raiseWellFormedError(QXmlStream::tr("Invalid processing instruction name.")); break; - case 97: + case 98: if (!scanAfterLangleBang() && atEnd) { - resume(97); + resume(98); return false; } break; - case 98: + case 99: if (!scanUntil("--")) { - resume(98); + resume(99); return false; } break; - case 99: { + case 100: { setType(QXmlStreamReader::Comment); int pos = sym(1).pos + 4; text = QStringRef(&textBuffer, pos, textBuffer.size() - pos - 3); } break; - case 100: { + case 101: { setType(QXmlStreamReader::Characters); isCDATA = true; isWhitespace = false; @@ -1555,131 +1555,131 @@ bool QXmlStreamReaderPrivate::parse() if (scanUntil("]]>", -1)) { text = QStringRef(&textBuffer, pos, textBuffer.size() - pos - 3); } else { - resume(100); + resume(101); return false; } } break; - case 101: { + case 102: { if (!scanPublicOrSystem() && atEnd) { - resume(101); + resume(102); return false; } NotationDeclaration ¬ationDeclaration = notationDeclarations.push(); notationDeclaration.name = symString(3); } break; - case 102: { + case 103: { NotationDeclaration ¬ationDeclaration = notationDeclarations.top(); notationDeclaration.systemId = symString(3); notationDeclaration.publicId.clear(); } break; - case 103: { + case 104: { NotationDeclaration ¬ationDeclaration = notationDeclarations.top(); notationDeclaration.systemId.clear(); checkPublicLiteral((notationDeclaration.publicId = symString(3))); } break; - case 104: { + case 105: { NotationDeclaration ¬ationDeclaration = notationDeclarations.top(); checkPublicLiteral((notationDeclaration.publicId = symString(3))); notationDeclaration.systemId = symString(5); } break; - case 128: + case 129: isWhitespace = false; // fall through - case 129: + case 130: sym(1).len += fastScanContentCharList(); if (atEnd && !inParseEntity) { - resume(129); + resume(130); return false; } break; - case 138: + case 139: if (!textBuffer.isEmpty()) { setType(QXmlStreamReader::Characters); text = &textBuffer; } break; - case 139: case 140: + case 141: clearSym(); break; - case 141: case 142: + case 143: sym(1) = sym(2); break; - case 143: case 144: case 145: case 146: + case 147: sym(1).len += sym(2).len; break; - case 172: + case 173: if (normalizeLiterals) textBuffer.data()[textBuffer.size()-1] = QLatin1Char(' '); break; - case 173: + case 174: sym(1).len += fastScanLiteralContent(); if (atEnd) { - resume(173); + resume(174); return false; } break; - case 174: { + case 175: { if (!QXmlUtils::isPublicID(symString(1).toString())) { raiseWellFormedError(QXmlStream::tr("%1 is an invalid PUBLIC identifier.").arg(symString(1).toString())); - resume(174); + resume(175); return false; } } break; - case 175: case 176: + case 177: clearSym(); break; - case 177: case 178: + case 179: sym(1) = sym(2); break; - case 179: case 180: case 181: case 182: + case 183: sym(1).len += sym(2).len; break; - case 212: case 213: + case 214: clearSym(); break; - case 214: case 215: + case 216: sym(1) = sym(2); lastAttributeValue = symString(1); break; - case 216: case 217: case 218: case 219: + case 220: sym(1).len += sym(2).len; break; - case 228: { + case 229: { QStringRef prefix = symPrefix(1); if (prefix.isEmpty() && symString(1) == QLatin1String("xmlns") && namespaceProcessing) { NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push(); @@ -1749,7 +1749,7 @@ bool QXmlStreamReaderPrivate::parse() } } break; - case 234: { + case 235: { normalizeLiterals = true; Tag &tag = tagStack_push(); prefix = tag.namespaceDeclaration.prefix = addToStringStorage(symPrefix(2)); @@ -1759,11 +1759,11 @@ bool QXmlStreamReaderPrivate::parse() raiseWellFormedError(QXmlStream::tr("Invalid XML name.")); } break; - case 235: + case 236: isEmptyElement = true; // fall through - case 236: + case 237: setType(QXmlStreamReader::StartElement); resolveTag(); if (tagStack.size() == 1 && hasSeenTag && !inParseEntity) @@ -1771,7 +1771,7 @@ bool QXmlStreamReaderPrivate::parse() hasSeenTag = true; break; - case 237: { + case 238: { setType(QXmlStreamReader::EndElement); Tag &tag = tagStack_pop(); @@ -1782,7 +1782,7 @@ bool QXmlStreamReaderPrivate::parse() raiseWellFormedError(QXmlStream::tr("Opening and ending tag mismatch.")); } break; - case 238: + case 239: if (entitiesMustBeDeclared()) { raiseWellFormedError(QXmlStream::tr("Entity '%1' not declared.").arg(unresolvedEntity)); break; @@ -1791,7 +1791,7 @@ bool QXmlStreamReaderPrivate::parse() name = &unresolvedEntity; break; - case 239: { + case 240: { sym(1).len += sym(2).len + 1; QString reference = symString(2).toString(); if (entityHash.contains(reference)) { @@ -1830,7 +1830,7 @@ bool QXmlStreamReaderPrivate::parse() } break; - case 240: { + case 241: { sym(1).len += sym(2).len + 1; QString reference = symString(2).toString(); if (parameterEntityHash.contains(reference)) { @@ -1849,11 +1849,11 @@ bool QXmlStreamReaderPrivate::parse() } } break; - case 241: + case 242: sym(1).len += sym(2).len + 1; break; - case 242: { + case 243: { sym(1).len += sym(2).len + 1; QString reference = symString(2).toString(); if (entityHash.contains(reference)) { @@ -1889,7 +1889,7 @@ bool QXmlStreamReaderPrivate::parse() } } break; - case 243: { + case 244: { if (uint s = resolveCharRef(3)) { if (s >= 0xffff) putStringLiteral(QString::fromUcs4(&s, 1)); @@ -1903,43 +1903,43 @@ bool QXmlStreamReaderPrivate::parse() } } break; - case 246: case 247: + case 248: sym(1).len += sym(2).len; break; - case 258: + case 259: sym(1).len += fastScanSpace(); if (atEnd) { - resume(258); + resume(259); return false; } break; - case 261: { + case 262: { sym(1).len += fastScanName(&sym(1).prefix); if (atEnd) { - resume(261); + resume(262); return false; } } break; - case 262: + case 263: sym(1).len += fastScanName(); if (atEnd) { - resume(262); + resume(263); return false; } break; - case 263: case 264: case 265: case 266: case 267: + case 268: sym(1).len += fastScanNMTOKEN(); if (atEnd) { - resume(267); + resume(268); return false; } @@ -1958,7 +1958,8 @@ bool QXmlStreamReaderPrivate::parse() } return false; } +#endif //QT_NO_XMLSTREAMREADER.xml + -#endif //QT_NO_XMLSTREAMREADER #endif // QXMLSTREAM_P_H diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index d3aff6d..d7088ff 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -1005,9 +1005,6 @@ void QDBusConnectionPrivate::setBusService(const QDBusConnection &connection) busService = new QDBusConnectionInterface(connection, this); ref.deref(); // busService has increased the refcounting to us // avoid cyclic refcounting -// if (mode != PeerMode) - QObject::connect(busService, SIGNAL(serviceOwnerChanged(QString,QString,QString)), - this, SIGNAL(serviceOwnerChanged(QString,QString,QString))); QObject::connect(this, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)), busService, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)), diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index 830dac3..b65e101 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -199,9 +199,6 @@ public: QDBusMetaObject *findMetaObject(const QString &service, const QString &path, const QString &interface, QDBusError &error); - void registerService(const QString &serviceName); - void unregisterService(const QString &serviceName); - void postEventToThread(int action, QObject *target, QEvent *event); inline void serverConnection(const QDBusConnection &connection) @@ -238,6 +235,8 @@ public slots: void objectDestroyed(QObject *o); void relaySignal(QObject *obj, const QMetaObject *, int signalId, const QVariantList &args); void _q_serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner); + void registerService(const QString &serviceName); + void unregisterService(const QString &serviceName); signals: void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner); diff --git a/src/dbus/qdbusconnectioninterface.cpp b/src/dbus/qdbusconnectioninterface.cpp index 3b38432..0f9a67f 100644 --- a/src/dbus/qdbusconnectioninterface.cpp +++ b/src/dbus/qdbusconnectioninterface.cpp @@ -337,6 +337,11 @@ void QDBusConnectionInterface::connectNotify(const char *signalName) QDBusAbstractInterface::connectNotify(SIGNAL(NameLost(QString))); else if (qstrcmp(signalName, SIGNAL(serviceOwnerChanged(QString,QString,QString))) == 0) { + static bool warningPrinted = false; + if (!warningPrinted) { + qWarning("Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)"); + warningPrinted = true; + } QDBusAbstractInterface::connectNotify(SIGNAL(NameOwnerChanged(QString,QString,QString))); } } @@ -389,6 +394,12 @@ void QDBusConnectionInterface::disconnectNotify(const char *signalName) empty string, it means the name \a name has just been created; if \a newOwner is empty, the name \a name has no current owner and is no longer available. + + \note connecting to this signal will make the application listen for and + receive every single service ownership change on the bus. Depending on + how many services are running, this make the application be activated to + receive more signals than it needs. To avoid this problem, use the + QDBusServiceWatcher class, which can listen for specific changes. */ /*! diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 870ddd0..40febc4 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -948,9 +948,6 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) rootNode.flags = 0; watchedServiceNames[QLatin1String(DBUS_SERVICE_DBUS)] = 1; - - connect(this, SIGNAL(serviceOwnerChanged(QString,QString,QString)), - this, SLOT(_q_serviceOwnerChanged(QString,QString,QString))); } QDBusConnectionPrivate::~QDBusConnectionPrivate() @@ -1180,11 +1177,7 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in void QDBusConnectionPrivate::_q_serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner) { - if (oldOwner == baseService) - unregisterService(name); - if (newOwner == baseService) - registerService(name); - + Q_UNUSED(oldOwner); QDBusWriteLocker locker(UpdateSignalHookOwnerAction, this); QMutableHashIterator<QString, SignalHook> it(signalHooks); it.toFront(); @@ -1655,9 +1648,16 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError baseService = QString::fromUtf8(service); } else { - qWarning("QDBusConnectionPrivate::SetConnection: Unable to get base service"); + qWarning("QDBusConnectionPrivate::setConnection: Unable to get base service"); } + QString busService = QLatin1String(DBUS_SERVICE_DBUS); + connectSignal(busService, QString(), QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(), + this, SLOT(registerService(QString))); + connectSignal(busService, QString(), QString(), QString(), QLatin1String("NameLost"), QStringList(), QString(), + this, SLOT(unregisterService(QString))); + + q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0); //qDebug("base service: %s", service); diff --git a/src/dbus/qdbusservicewatcher.cpp b/src/dbus/qdbusservicewatcher.cpp index 1557b47..4328558 100644 --- a/src/dbus/qdbusservicewatcher.cpp +++ b/src/dbus/qdbusservicewatcher.cpp @@ -50,7 +50,6 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC_WITH_ARGS(QString, busService, (QLatin1String(DBUS_SERVICE_DBUS))) -Q_GLOBAL_STATIC_WITH_ARGS(QString, busPath, (QLatin1String(DBUS_PATH_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString, busInterface, (QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString, signalName, (QLatin1String("NameOwnerChanged"))) @@ -127,7 +126,7 @@ QStringList QDBusServiceWatcherPrivate::matchArgsForService(const QString &servi void QDBusServiceWatcherPrivate::addService(const QString &service) { QStringList matchArgs = matchArgsForService(service); - connection.connect(*busService(), *busPath(), *busInterface(), *signalName(), + connection.connect(*busService(), QString(), *busInterface(), *signalName(), matchArgs, QString(), q_func(), SLOT(_q_serviceOwnerChanged(QString,QString,QString))); } @@ -135,7 +134,7 @@ void QDBusServiceWatcherPrivate::addService(const QString &service) void QDBusServiceWatcherPrivate::removeService(const QString &service) { QStringList matchArgs = matchArgsForService(service); - connection.disconnect(*busService(), *busPath(), *busInterface(), *signalName(), + connection.disconnect(*busService(), QString(), *busInterface(), *signalName(), matchArgs, QString(), q_func(), SLOT(_q_serviceOwnerChanged(QString,QString,QString))); } diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 05e75a2..b677228 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -243,8 +243,12 @@ static PtrWTGet ptrWTGet = 0; static PACKET localPacketBuf[QT_TABLET_NPACKETQSIZE]; // our own tablet packet queue. HCTX qt_tablet_context; // the hardware context for the tablet (like a window handle) bool qt_tablet_tilt_support; -static void tabletInit(UINT wActiveCsr, HCTX hTab); + +#ifndef QT_NO_TABLETEVENT +static void tabletInit(const quint64 uniqueId, const UINT csr_type, HCTX hTab); +static void tabletUpdateCursor(QTabletDeviceData &tdd, const UINT currentCursor); static void initWinTabFunctions(); // resolve the WINTAB api functions +#endif // QT_NO_TABLETEVENT #ifndef QT_NO_ACCESSIBILITY @@ -256,7 +260,7 @@ extern QWidget* qt_get_tablet_widget(); extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); extern QRegion qt_dirtyRegion(QWidget *); -typedef QHash<UINT, QTabletDeviceData> QTabletCursorInfo; +typedef QHash<quint64, QTabletDeviceData> QTabletCursorInfo; Q_GLOBAL_STATIC(QTabletCursorInfo, tCursorInfo) QTabletDeviceData currentTabletPointer; @@ -791,7 +795,9 @@ void qt_init(QApplicationPrivate *priv, int) if (QApplication::desktopSettingsAware()) qt_set_windows_resources(); +#ifndef QT_NO_TABLETEVENT initWinTabFunctions(); +#endif // QT_NO_TABLETEVENT QApplicationPrivate::inputContext = new QWinInputContext(0); // Read the initial cleartype settings... @@ -2325,25 +2331,43 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam } break; case WT_PROXIMITY: - if (ptrWTPacketsGet) { - bool enteredProximity = LOWORD(lParam) != 0; - PACKET proximityBuffer[QT_TABLET_NPACKETQSIZE]; - int totalPacks = ptrWTPacketsGet(qt_tablet_context, QT_TABLET_NPACKETQSIZE, proximityBuffer); - if (totalPacks > 0 && enteredProximity) { - uint currentCursor = proximityBuffer[0].pkCursor; - if (!tCursorInfo()->contains(currentCursor)) - tabletInit(currentCursor, qt_tablet_context); - currentTabletPointer = tCursorInfo()->value(currentCursor); + + #ifndef QT_NO_TABLETEVENT + if (ptrWTPacketsGet && ptrWTInfo) { + const bool enteredProximity = LOWORD(lParam) != 0; + PACKET proximityBuffer[1]; // we are only interested in the first packet in this case + const int totalPacks = ptrWTPacketsGet(qt_tablet_context, 1, proximityBuffer); + if (totalPacks > 0) { + const UINT currentCursor = proximityBuffer[0].pkCursor; + + UINT csr_physid; + ptrWTInfo(WTI_CURSORS + currentCursor, CSR_PHYSID, &csr_physid); + UINT csr_type; + ptrWTInfo(WTI_CURSORS + currentCursor, CSR_TYPE, &csr_type); + const UINT deviceIdMask = 0xFF6; // device type mask && device color mask + quint64 uniqueId = (csr_type & deviceIdMask); + uniqueId = (uniqueId << 32) | csr_physid; + + // initialising and updating the cursor should be done in response to + // WT_CSRCHANGE. We do it in WT_PROXIMITY because some wintab never send + // the event WT_CSRCHANGE even if asked with CXO_CSRMESSAGES + const QTabletCursorInfo *const globalCursorInfo = tCursorInfo(); + if (!globalCursorInfo->contains(uniqueId)) + tabletInit(uniqueId, csr_type, qt_tablet_context); + + currentTabletPointer = globalCursorInfo->value(uniqueId); + tabletUpdateCursor(currentTabletPointer, currentCursor); } qt_tabletChokeMouse = false; -#ifndef QT_NO_TABLETEVENT + QTabletEvent tabletProximity(enteredProximity ? QEvent::TabletEnterProximity : QEvent::TabletLeaveProximity, QPoint(), QPoint(), QPointF(), currentTabletPointer.currentDevice, currentTabletPointer.currentPointerType, 0, 0, 0, 0, 0, 0, 0, currentTabletPointer.llId); QApplication::sendEvent(qApp, &tabletProximity); -#endif // QT_NO_TABLETEVENT } + #endif // QT_NO_TABLETEVENT + break; #ifdef Q_WS_WINCE_WM case WM_SETFOCUS: { @@ -3317,63 +3341,57 @@ bool QETWidget::translateWheelEvent(const MSG &msg) // the following is adapted from the wintab syspress example (public domain) /* -------------------------------------------------------------------------- */ -static void tabletInit(UINT wActiveCsr, HCTX hTab) +// Initialize the "static" information of a cursor device (pen, airbrush, etc). +// The QTabletDeviceData is initialized with the data that do not change in time +// (number of button, type of device, etc) but do not initialize the variable data +// (e.g.: pen or eraser) +#ifndef QT_NO_TABLETEVENT + +static void tabletInit(const quint64 uniqueId, const UINT csr_type, HCTX hTab) { + Q_ASSERT(ptrWTInfo); + Q_ASSERT(ptrWTGet); + + Q_ASSERT(!tCursorInfo()->contains(uniqueId)); + /* browse WinTab's many info items to discover pressure handling. */ - if (ptrWTInfo && ptrWTGet) { - AXIS np; - LOGCONTEXT lc; - BYTE wPrsBtn; - BYTE logBtns[32]; - UINT size; - - /* discover the LOGICAL button generated by the pressure channel. */ - /* get the PHYSICAL button from the cursor category and run it */ - /* through that cursor's button map (usually the identity map). */ - wPrsBtn = (BYTE)-1; - ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_NPBUTTON, &wPrsBtn); - size = ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_BUTTONMAP, &logBtns); - if ((UINT)wPrsBtn < size) - wPrsBtn = logBtns[wPrsBtn]; - - /* get the current context for its device variable. */ - ptrWTGet(hTab, &lc); - - /* get the size of the pressure axis. */ - QTabletDeviceData tdd; - ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_NPRESSURE, &np); - tdd.minPressure = int(np.axMin); - tdd.maxPressure = int(np.axMax); - - ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_TPRESSURE, &np); - tdd.minTanPressure = int(np.axMin); - tdd.maxTanPressure = int(np.axMax); - - LOGCONTEXT lcMine; - - /* get default region */ - ptrWTInfo(WTI_DEFCONTEXT, 0, &lcMine); - - tdd.minX = 0; - tdd.maxX = int(lcMine.lcInExtX) - int(lcMine.lcInOrgX); - - tdd.minY = 0; - tdd.maxY = int(lcMine.lcInExtY) - int(lcMine.lcInOrgY); - - tdd.minZ = 0; - tdd.maxZ = int(lcMine.lcInExtZ) - int(lcMine.lcInOrgZ); - - int csr_type, - csr_physid; - ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_TYPE, &csr_type); - ptrWTInfo(WTI_CURSORS + wActiveCsr, CSR_PHYSID, &csr_physid); - tdd.llId = csr_type & 0x0F06; - tdd.llId = (tdd.llId << 24) | csr_physid; -#ifndef QT_NO_TABLETEVENT - if (((csr_type & 0x0006) == 0x0002) && ((csr_type & 0x0F06) != 0x0902)) { - tdd.currentDevice = QTabletEvent::Stylus; - } else { - switch (csr_type & 0x0F06) { + AXIS np; + LOGCONTEXT lc; + + /* get the current context for its device variable. */ + ptrWTGet(hTab, &lc); + + /* get the size of the pressure axis. */ + QTabletDeviceData tdd; + tdd.llId = uniqueId; + + ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_NPRESSURE, &np); + tdd.minPressure = int(np.axMin); + tdd.maxPressure = int(np.axMax); + + ptrWTInfo(WTI_DEVICES + lc.lcDevice, DVC_TPRESSURE, &np); + tdd.minTanPressure = int(np.axMin); + tdd.maxTanPressure = int(np.axMax); + + LOGCONTEXT lcMine; + + /* get default region */ + ptrWTInfo(WTI_DEFCONTEXT, 0, &lcMine); + + tdd.minX = 0; + tdd.maxX = int(lcMine.lcInExtX) - int(lcMine.lcInOrgX); + + tdd.minY = 0; + tdd.maxY = int(lcMine.lcInExtY) - int(lcMine.lcInOrgY); + + tdd.minZ = 0; + tdd.maxZ = int(lcMine.lcInExtZ) - int(lcMine.lcInOrgZ); + + const uint cursorTypeBitMask = 0x0F06; // bitmask to find the specific cursor type (see Wacom FAQ) + if (((csr_type & 0x0006) == 0x0002) && ((csr_type & cursorTypeBitMask) != 0x0902)) { + tdd.currentDevice = QTabletEvent::Stylus; + } else { + switch (csr_type & cursorTypeBitMask) { case 0x0802: tdd.currentDevice = QTabletEvent::Stylus; break; @@ -3391,26 +3409,34 @@ static void tabletInit(UINT wActiveCsr, HCTX hTab) break; default: tdd.currentDevice = QTabletEvent::NoDevice; - } - } - - switch (wActiveCsr % 3) { - case 2: - tdd.currentPointerType = QTabletEvent::Eraser; - break; - case 1: - tdd.currentPointerType = QTabletEvent::Pen; - break; - case 0: - tdd.currentPointerType = QTabletEvent::Cursor; - break; - default: - tdd.currentPointerType = QTabletEvent::UnknownPointer; } + } + tCursorInfo()->insert(uniqueId, tdd); +} #endif // QT_NO_TABLETEVENT - tCursorInfo()->insert(wActiveCsr, tdd); + +// Update the "dynamic" informations of a cursor device (pen, airbrush, etc). +// The dynamic information is the information of QTabletDeviceData that can change +// in time (eraser or pen if a device is turned around). +#ifndef QT_NO_TABLETEVENT + +static void tabletUpdateCursor(QTabletDeviceData &tdd, const UINT currentCursor) +{ + switch (currentCursor % 3) { // %3 for dual track + case 0: + tdd.currentPointerType = QTabletEvent::Cursor; + break; + case 1: + tdd.currentPointerType = QTabletEvent::Pen; + break; + case 2: + tdd.currentPointerType = QTabletEvent::Eraser; + break; + default: + tdd.currentPointerType = QTabletEvent::UnknownPointer; } } +#endif // QT_NO_TABLETEVENT bool QETWidget::translateTabletEvent(const MSG &msg, PACKET *localPacketBuf, int numPackets) @@ -3546,6 +3572,10 @@ bool QETWidget::translateTabletEvent(const MSG &msg, PACKET *localPacketBuf, } extern bool qt_is_gui_used; + + +#ifndef QT_NO_TABLETEVENT + static void initWinTabFunctions() { #if defined(Q_OS_WINCE) @@ -3564,6 +3594,7 @@ static void initWinTabFunctions() } #endif // Q_OS_WINCE } +#endif // QT_NO_TABLETEVENT // diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm index 9ab077f..990571d 100644 --- a/src/gui/kernel/qcocoamenuloader_mac.mm +++ b/src/gui/kernel/qcocoamenuloader_mac.mm @@ -76,9 +76,14 @@ QT_USE_NAMESPACE - (void)ensureAppMenuInMenu:(NSMenu *)menu { + // The application menu is the menu in the menu bar that contains the + // 'Quit' item. When changing menu bar (e.g when swithing between + // windows with different menu bars), we never recreate this menu, but + // instead pull it out the current menu bar and place into the new one: NSMenu *mainMenu = [NSApp mainMenu]; if ([NSApp mainMenu] == menu) - return; // nothing to do! + return; // nothing to do (menu is the current menu bar)! + #ifndef QT_NAMESPACE Q_ASSERT(mainMenu); #endif diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 9510cc6..30bbd31 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -763,7 +763,9 @@ QMacMenuAction::~QMacMenuAction() { #ifdef QT_MAC_USE_COCOA [menu release]; - if (action) { + // Update the menu item if this action still owns it. For some items + // (like 'Quit') ownership will be transferred between all menu bars... + if (action && action.data() == reinterpret_cast<QAction *>([menuItem tag])) { QAction::MenuRole role = action->menuRole(); // Check if the item is owned by Qt, and should be hidden to keep it from causing // problems. Do it for everything but the quit menu item since that should always @@ -774,8 +776,8 @@ QMacMenuAction::~QMacMenuAction() && menuItem != [getMenuLoader() quitMenuItem]) { [menuItem setHidden:YES]; } + [menuItem setTag:nil]; } - [menuItem setTag:nil]; [menuItem release]; #endif } |