summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qcocoaapplication_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qcocoaapplication_mac.mm')
-rw-r--r--src/gui/kernel/qcocoaapplication_mac.mm8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/kernel/qcocoaapplication_mac.mm b/src/gui/kernel/qcocoaapplication_mac.mm
index 238b96b..9270213 100644
--- a/src/gui/kernel/qcocoaapplication_mac.mm
+++ b/src/gui/kernel/qcocoaapplication_mac.mm
@@ -117,15 +117,19 @@ QT_USE_NAMESPACE
quint64 lower = [event data1];
quint64 upper = [event data2];
QCocoaPostMessageArgs *args = reinterpret_cast<QCocoaPostMessageArgs *>(lower | (upper << 32));
+ // Special case for convenience: if the argument is an NSNumber, we unbox it directly.
+ // Use NSValue instead if this behaviour is unwanted.
+ id a1 = ([args->arg1 isKindOfClass:[NSNumber class]]) ? (id)[args->arg1 intValue] : args->arg1;
+ id a2 = ([args->arg2 isKindOfClass:[NSNumber class]]) ? (id)[args->arg2 intValue] : args->arg2;
switch (args->argCount) {
case 0:
[args->target performSelector:args->selector];
break;
case 1:
- [args->target performSelector:args->selector withObject:args->arg1];
+ [args->target performSelector:args->selector withObject:a1];
break;
case 3:
- [args->target performSelector:args->selector withObject:args->arg1 withObject:args->arg2];
+ [args->target performSelector:args->selector withObject:a1 withObject:a2];
break;
}