Skip to content

Commit

Permalink
GTK: When using CEF and yield, process CEF pending events.
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
徐扬斌 committed Dec 4, 2024
1 parent 17e9a7b commit 942cadd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/gtk/evtloop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/log.h"
#include "wx/event.h"
#endif // WX_PRECOMP

#include "wx/private/eventloopsourcesmanager.h"
Expand Down Expand Up @@ -411,8 +412,17 @@ void wxGUIEventLoop::DoYieldFor(long eventsToProcess)
wxgtk_main_do_event(gdk_event_, this);
gdk_event_free(gdk_event_);
}
else
else {
// while no local gdk events pending,
// we should schedule one time trigger to allow events for CEF
// to be handled, this is essential to unblock us from clipboard
// interaction with CEF.
// this bogus event will let the DoMessageLoopWork() kick in.
wxCommandEvent cef_jobs_trigger{};
if (wxTheApp)
wxTheApp->ProcessEvent(dynamic_cast<wxEvent&>(cef_jobs_trigger));
break;
}
}
}
else {
Expand Down

0 comments on commit 942cadd

Please sign in to comment.