@@ -59,18 +59,41 @@ std::unique_lock<std::mutex> *GetElgatoCloudLoopLock()
59
59
60
60
ElgatoCloud::ElgatoCloud (obs_module_t *m)
61
61
{
62
+ _openOnLaunch = false ;
63
+ _obsReady = false ;
62
64
_modulePtr = m;
63
65
// _translate = t;
64
66
_securerand = QRandomGenerator::securelySeeded ();
67
+ obs_frontend_add_event_callback (ElgatoCloud::FrontEndEventHandler, this );
65
68
_Initialize ();
66
69
_Listen ();
67
70
}
68
71
69
72
ElgatoCloud::~ElgatoCloud ()
70
73
{
74
+ obs_frontend_remove_event_callback (ElgatoCloud::FrontEndEventHandler, this );
71
75
obs_data_release (_config);
72
76
}
73
77
78
+ void ElgatoCloud::FrontEndEventHandler (enum obs_frontend_event event, void * data)
79
+ {
80
+ auto ec = static_cast <ElgatoCloud*>(data);
81
+ switch (event) {
82
+ case OBS_FRONTEND_EVENT_FINISHED_LOADING:
83
+ ec->_obsReady = true ;
84
+ if (ec->_openOnLaunch ) {
85
+ ec->_openOnLaunch = false ;
86
+ QMetaObject::invokeMethod (
87
+ QCoreApplication::instance ()
88
+ ->thread (),
89
+ [ec]() {
90
+ OpenElgatoCloudWindow ();
91
+ });
92
+ }
93
+ break ;
94
+ }
95
+ }
96
+
74
97
obs_data_t *ElgatoCloud::GetConfig ()
75
98
{
76
99
obs_data_addref (_config);
@@ -246,6 +269,10 @@ void ElgatoCloud::_Listen()
246
269
else if (d.find (" elgatolink://open" ) == 0 )
247
270
{
248
271
obs_log (LOG_INFO, " OPEN COMMAND RECEIEVED!" );
272
+ if (!_obsReady) {
273
+ _openOnLaunch = true ;
274
+ return ;
275
+ }
249
276
if (mainWindowOpen && window) {
250
277
QMetaObject::invokeMethod (
251
278
QCoreApplication::instance ()
0 commit comments