# https://github.com/psi-im/psi/commit/73cd894861345ee7cca10e4296e455efa85c0f1d

--- src/CocoaUtilities/CocoaTrayClick.cpp.orig	2020-09-06 15:44:34.000000000 +0800
+++ src/CocoaUtilities/CocoaTrayClick.cpp	2023-06-22 02:36:05.000000000 +0800
@@ -28,6 +28,9 @@
 
 //#define DEBUG_OUTPUT
 
+typedef objc_object* (*object_type)(struct objc_object *self, SEL _cmd);
+object_type objc_msgSendObject = (object_type)objc_msgSend;
+
 bool dockClickHandler(id /*self*/, SEL /*_cmd*/, ...)
 {
 	CocoaTrayClick::instance()->emitTrayClicked();
@@ -47,11 +50,11 @@
 	: QObject(qApp)
 {
 	Class cls = objc_getClass("NSApplication");
-	objc_object *appInst = objc_msgSend((objc_object*)cls, sel_registerName("sharedApplication"));
+	objc_object *appInst = objc_msgSendObject((objc_object*)cls, sel_registerName("sharedApplication"));
 
 	if(appInst != NULL) {
-		objc_object* delegate = objc_msgSend(appInst, sel_registerName("delegate"));
-		Class delClass = (Class)objc_msgSend(delegate,  sel_registerName("class"));
+		objc_object* delegate = objc_msgSendObject(appInst, sel_registerName("delegate"));
+		Class delClass = (Class)objc_msgSendObject(delegate, sel_registerName("class"));
 		SEL shouldHandle = sel_registerName("applicationShouldHandleReopen:hasVisibleWindows:");
 		if (class_getInstanceMethod(delClass, shouldHandle)) {
 			if (class_replaceMethod(delClass, shouldHandle, (IMP)dockClickHandler, "B@:")) {
