|
|
|
@ -32,11 +32,16 @@ bool dockClickHandler(id self,SEL _cmd,...) {
@@ -32,11 +32,16 @@ bool dockClickHandler(id self,SEL _cmd,...) {
|
|
|
|
|
|
|
|
|
|
void setupDockClickHandler() { |
|
|
|
|
Class cls = objc_getClass("NSApplication"); |
|
|
|
|
id appInst = objc_msgSend((id)cls, sel_registerName("sharedApplication")); |
|
|
|
|
|
|
|
|
|
// Fixed objc_msgSend mismatched arguments error. |
|
|
|
|
typedef id (*send_type)(void*, SEL); |
|
|
|
|
send_type typed_msgSend = (send_type)objc_msgSend; |
|
|
|
|
|
|
|
|
|
id appInst = typed_msgSend((id)cls, sel_registerName("sharedApplication")); |
|
|
|
|
|
|
|
|
|
if (appInst != nullptr) { |
|
|
|
|
id delegate = objc_msgSend(appInst, sel_registerName("delegate")); |
|
|
|
|
Class delClass = (Class)objc_msgSend(delegate, sel_registerName("class")); |
|
|
|
|
id delegate = typed_msgSend(appInst, sel_registerName("delegate")); |
|
|
|
|
Class delClass = (Class)typed_msgSend(delegate, sel_registerName("class")); |
|
|
|
|
SEL shouldHandle = sel_registerName("applicationShouldHandleReopen:hasVisibleWindows:"); |
|
|
|
|
if (class_getInstanceMethod(delClass, shouldHandle)) |
|
|
|
|
class_replaceMethod(delClass, shouldHandle, (IMP)dockClickHandler, "B@:"); |
|
|
|
|