|
|
@ -32,11 +32,16 @@ bool dockClickHandler(id self,SEL _cmd,...) { |
|
|
|
|
|
|
|
|
|
|
|
void setupDockClickHandler() { |
|
|
|
void setupDockClickHandler() { |
|
|
|
Class cls = objc_getClass("NSApplication"); |
|
|
|
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) { |
|
|
|
if (appInst != nullptr) { |
|
|
|
id delegate = objc_msgSend(appInst, sel_registerName("delegate")); |
|
|
|
id delegate = typed_msgSend(appInst, sel_registerName("delegate")); |
|
|
|
Class delClass = (Class)objc_msgSend(delegate, sel_registerName("class")); |
|
|
|
Class delClass = (Class)typed_msgSend(delegate, sel_registerName("class")); |
|
|
|
SEL shouldHandle = sel_registerName("applicationShouldHandleReopen:hasVisibleWindows:"); |
|
|
|
SEL shouldHandle = sel_registerName("applicationShouldHandleReopen:hasVisibleWindows:"); |
|
|
|
if (class_getInstanceMethod(delClass, shouldHandle)) |
|
|
|
if (class_getInstanceMethod(delClass, shouldHandle)) |
|
|
|
class_replaceMethod(delClass, shouldHandle, (IMP)dockClickHandler, "B@:"); |
|
|
|
class_replaceMethod(delClass, shouldHandle, (IMP)dockClickHandler, "B@:"); |
|
|
|