summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-09-23 07:21:08 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-09-24 13:08:04 (GMT)
commit2517576790923578b021b3aaede060647f2d318e (patch)
treec65e28e7deef307edc94213d67ad4bc1d8633e0e /src/gui
parent836bbfced3e8c76cc0ac7458a54c7a2982ebea1c (diff)
downloadQt-2517576790923578b021b3aaede060647f2d318e.zip
Qt-2517576790923578b021b3aaede060647f2d318e.tar.gz
Qt-2517576790923578b021b3aaede060647f2d318e.tar.bz2
Added some documentation for a hackish workaround into the mac code
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qnspanelproxy_mac.mm15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gui/dialogs/qnspanelproxy_mac.mm b/src/gui/dialogs/qnspanelproxy_mac.mm
index 97ad287..4f6ff90 100644
--- a/src/gui/dialogs/qnspanelproxy_mac.mm
+++ b/src/gui/dialogs/qnspanelproxy_mac.mm
@@ -144,14 +144,21 @@ void macStartIntercept(SEL originalSel, SEL fakeSel, Class baseClass, Class prox
#endif
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+ // The following code replaces the _implementation_ for the selector we want to hack
+ // (originalSel) with the implementation found in proxyClass. Then it creates
+ // a new 'backup' method inside baseClass containing the old, original,
+ // implementation (fakeSel). You can let the proxy implementation of originalSel
+ // call fakeSel if needed (similar approach to calling a super class implementation).
+ // fakeSel must also be implemented in proxyClass, as the signature is used
+ // as template for the method one we add into baseClass.
+ // NB: You will typically never create any instances of proxyClass; we use it
+ // only for stealing its contents and put it into baseClass.
Method originalMethod = class_getInstanceMethod(baseClass, originalSel);
Method newMethod = class_getInstanceMethod(proxyClass, originalSel);
Method fakeMethod = class_getInstanceMethod(proxyClass, fakeSel);
- IMP originalCtorImp = method_setImplementation(originalMethod,
- method_getImplementation(newMethod));
- class_addMethod(baseClass, fakeSel, originalCtorImp,
- method_getTypeEncoding(fakeMethod));
+ IMP originalImp = method_setImplementation(originalMethod, method_getImplementation(newMethod));
+ class_addMethod(baseClass, fakeSel, originalImp, method_getTypeEncoding(fakeMethod));
#endif
}
}