Skip to content

Commit 942cadd

Browse files
author
徐扬斌
committed
GTK: When using CEF and yield, process CEF pending events.
We should process CEF pending events when yield, it is essential for clipboard interection to use the same event loop weaved for two literally indenpendent applications(our own app and CEF).
1 parent 17e9a7b commit 942cadd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/gtk/evtloop.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#ifndef WX_PRECOMP
2727
#include "wx/app.h"
2828
#include "wx/log.h"
29+
#include "wx/event.h"
2930
#endif // WX_PRECOMP
3031

3132
#include "wx/private/eventloopsourcesmanager.h"
@@ -411,8 +412,17 @@ void wxGUIEventLoop::DoYieldFor(long eventsToProcess)
411412
wxgtk_main_do_event(gdk_event_, this);
412413
gdk_event_free(gdk_event_);
413414
}
414-
else
415+
else {
416+
// while no local gdk events pending,
417+
// we should schedule one time trigger to allow events for CEF
418+
// to be handled, this is essential to unblock us from clipboard
419+
// interaction with CEF.
420+
// this bogus event will let the DoMessageLoopWork() kick in.
421+
wxCommandEvent cef_jobs_trigger{};
422+
if (wxTheApp)
423+
wxTheApp->ProcessEvent(dynamic_cast<wxEvent&>(cef_jobs_trigger));
415424
break;
425+
}
416426
}
417427
}
418428
else {

0 commit comments

Comments
 (0)