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(
20
20
void BroadcastEventHandler::OnBroadcastReceived (const std::string& topic,
21
21
const std::string& message) {
22
22
if (onBroadcastReceivedCallback_) {
23
+ std::cout << " BroadcastEventHandler::OnBroadcastReceived() " << topic << " "
24
+ << message << std::endl;
23
25
onBroadcastReceivedCallback_ (topic, message);
24
26
}
25
27
}
Original file line number Diff line number Diff line change 10
10
11
11
namespace nativeapi {
12
12
13
- // Static map to store BroadcastCenter instances
14
- static std::map<BroadcastCenter*, std::string> g_broadcast_centers;
15
-
16
13
void BroadcastCenter::SendBroadcast (const std::string& topic, const std::string& message) {
17
14
NSDistributedNotificationCenter * center = [NSDistributedNotificationCenter defaultCenter ];
18
15
[center postNotificationName: [NSString stringWithUTF8String: topic.c_str ()]
27
24
object: nil
28
25
queue: [NSOperationQueue mainQueue ]
29
26
usingBlock: ^(NSNotification * notification) {
27
+ std::string topic = [notification.name UTF8String ];
30
28
std::string message = [notification.userInfo[@" message" ] UTF8String ];
31
29
receiver->OnBroadcastReceived (topic, message);
32
30
}];
Original file line number Diff line number Diff line change 49
49
50
50
std::shared_ptr<Window> WindowManager::GetCurrent () {
51
51
NSApplication * app = [NSApplication sharedApplication ];
52
+ NSArray * ns_windows = [[NSApplication sharedApplication ] windows ];
52
53
NSWindow * ns_window = [app mainWindow ];
54
+ if (ns_window == nil ) {
55
+ ns_window = [ns_windows objectAtIndex: 0 ];
56
+ }
53
57
if (ns_window != nil ) {
54
58
return Get ([ns_window windowNumber ]);
55
59
}
You can’t perform that action at this time.
0 commit comments