File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed
Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ BroadcastEventHandler::BroadcastEventHandler(
2020void BroadcastEventHandler::OnBroadcastReceived (const std::string& topic,
2121 const std::string& message) {
2222 if (onBroadcastReceivedCallback_) {
23+ std::cout << " BroadcastEventHandler::OnBroadcastReceived() " << topic << " "
24+ << message << std::endl;
2325 onBroadcastReceivedCallback_ (topic, message);
2426 }
2527}
Original file line number Diff line number Diff line change 1010
1111namespace nativeapi {
1212
13- // Static map to store BroadcastCenter instances
14- static std::map<BroadcastCenter*, std::string> g_broadcast_centers;
15-
1613void BroadcastCenter::SendBroadcast (const std::string& topic, const std::string& message) {
1714 NSDistributedNotificationCenter * center = [NSDistributedNotificationCenter defaultCenter ];
1815 [center postNotificationName: [NSString stringWithUTF8String: topic.c_str ()]
2724 object: nil
2825 queue: [NSOperationQueue mainQueue ]
2926 usingBlock: ^(NSNotification * notification) {
27+ std::string topic = [notification.name UTF8String ];
3028 std::string message = [notification.userInfo[@" message" ] UTF8String ];
3129 receiver->OnBroadcastReceived (topic, message);
3230 }];
Original file line number Diff line number Diff line change 4949
5050std::shared_ptr<Window> WindowManager::GetCurrent () {
5151 NSApplication * app = [NSApplication sharedApplication ];
52+ NSArray * ns_windows = [[NSApplication sharedApplication ] windows ];
5253 NSWindow * ns_window = [app mainWindow ];
54+ if (ns_window == nil ) {
55+ ns_window = [ns_windows objectAtIndex: 0 ];
56+ }
5357 if (ns_window != nil ) {
5458 return Get ([ns_window windowNumber ]);
5559 }
You can’t perform that action at this time.
0 commit comments