Skip to content

Commit 935d965

Browse files
authored
Merge pull request #5677 from slowhei/master
Fix Drawin addObserver methods and add support for new Objc_Block
2 parents 72f8baf + a454633 commit 935d965

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

core/sys/darwin/Foundation/NSNotification.odin

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,22 @@ NotificationCenter_defaultCenter :: proc "c" () -> ^NotificationCenter {
5050
return msgSend(^NotificationCenter, NotificationCenter, "defaultCenter")
5151
}
5252

53+
@(objc_type=NotificationCenter, objc_name="addObserverForName")
54+
NotificationCenter_addObserverForName :: proc{NotificationCenter_addObserverForName_old, NotificationCenter_addObserverForName_new}
55+
56+
NotificationCenter_addObserverForName_old :: proc "c" (self: ^NotificationCenter, name: NotificationName, pObj: ^Object, pQueue: rawptr, block: ^Block) -> ^Object {
57+
return msgSend(^Object, self, "addObserverForName:object:queue:usingBlock:", name, pObj, pQueue, block)
58+
}
59+
60+
NotificationCenter_addObserverForName_new :: proc "c" (self: ^NotificationCenter, name: NotificationName, pObj: ^Object, pQueue: rawptr, block: ^Objc_Block) -> ^Object {
61+
return msgSend(^Object, self, "addObserverForName:object:queue:usingBlock:", name, pObj, pQueue, block)
62+
}
63+
5364
@(objc_type=NotificationCenter, objc_name="addObserver")
54-
NotificationCenter_addObserverName :: proc "c" (self: ^NotificationCenter, name: NotificationName, pObj: ^Object, pQueue: rawptr, block: ^Block) -> ^Object {
55-
return msgSend(^Object, self, "addObserverName:object:queue:block:", name, pObj, pQueue, block)
65+
NotificationCenter_addObserver :: proc "c" (self: ^NotificationCenter, observer: ^Object, selector: SEL, name: NotificationName, object: ^Object) {
66+
msgSend(nil, self, "addObserver:selector:name:object:", observer, selector, name, object)
5667
}
68+
5769
@(objc_type=NotificationCenter, objc_name="removeObserver")
5870
NotificationCenter_removeObserver :: proc "c" (self: ^NotificationCenter, pObserver: ^Object) {
5971
msgSend(nil, self, "removeObserver:", pObserver)

0 commit comments

Comments
 (0)