diff options
author | Dan Gudmundsson <[email protected]> | 2018-12-12 13:15:58 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2018-12-12 13:15:58 +0100 |
commit | 57e980c90bd8d4c8eaa90f7dcc0246d4dc22af70 (patch) | |
tree | 58dd4d62c9a39ab4f6a6b153456946b7f0f7120a /lib | |
parent | 3825199794da28d79b21052a2e69e2335921d55e (diff) | |
download | otp-57e980c90bd8d4c8eaa90f7dcc0246d4dc22af70.tar.gz otp-57e980c90bd8d4c8eaa90f7dcc0246d4dc22af70.tar.bz2 otp-57e980c90bd8d4c8eaa90f7dcc0246d4dc22af70.zip |
Let wxwidgets check events
Check events more often not just inside batches but also when X
commands have been processed.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/wx/c_src/wxe_impl.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp index bd22502d00..43b5476073 100644 --- a/lib/wx/c_src/wxe_impl.cpp +++ b/lib/wx/c_src/wxe_impl.cpp @@ -267,7 +267,7 @@ int WxeApp::dispatch_cmds() return more; } -#define BREAK_BATCH 10000 +#define CHECK_EVENTS 10000 int WxeApp::dispatch(wxeFifo * batch) { @@ -278,13 +278,14 @@ int WxeApp::dispatch(wxeFifo * batch) erl_drv_mutex_lock(wxe_batch_locker_m); while(true) { while((event = batch->Get()) != NULL) { + wait += 1; erl_drv_mutex_unlock(wxe_batch_locker_m); switch(event->op) { case WXE_BATCH_END: if(blevel>0) { blevel--; if(blevel==0) - wait += BREAK_BATCH/4; + wait += CHECK_EVENTS/4; } break; case WXE_BATCH_BEGIN: @@ -314,21 +315,18 @@ int WxeApp::dispatch(wxeFifo * batch) break; } event->Delete(); + if(wait > CHECK_EVENTS) + return 1; // Let wx check for events erl_drv_mutex_lock(wxe_batch_locker_m); batch->Cleanup(); } - if(blevel <= 0 || wait >= BREAK_BATCH) { + if(blevel <= 0) { erl_drv_mutex_unlock(wxe_batch_locker_m); - if(blevel > 0) { - return 1; // We are still in a batch but we can let wx check for events - } else { - return 0; - } + return 0; } // sleep until something happens // fprintf(stderr, "%s:%d sleep %d %d %d\r\n", __FILE__, __LINE__, batch->m_n, blevel, wait);fflush(stderr); wxe_needs_signal = 1; - wait += 1; while(batch->m_n == 0) { erl_drv_cond_wait(wxe_batch_locker_c, wxe_batch_locker_m); } |