File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -310,7 +310,21 @@ struct $modify(EditorUI) {
310310
311311 static inline bool s_allowPassThrough = false ;
312312
313+ // popups are frequently in use, and we don't want keybinds to interfere with them
314+ bool isTopLevel () {
315+ if (CCIMEDispatcher::sharedDispatcher ()->hasDelegate ()) return false ;
316+
317+ if (auto handler = static_cast <CCKeyboardHandler*>(CCKeyboardDispatcher::get ()->m_pDelegates ->lastObject ())) {
318+ // fix the pointer for comparison
319+ return static_cast <CCKeyboardDelegate*>(this ) == handler->m_pDelegate ;
320+ }
321+
322+ return true ;
323+ }
324+
313325 void passThroughKeyDown (enumKeyCodes key, double timestamp, KeyboardModifier modifiers = KeyboardModifier::None) {
326+ if (!isTopLevel ()) return ;
327+
314328 s_allowPassThrough = true ;
315329 auto d = CCKeyboardDispatcher::get ();
316330 auto alt = d->m_bAltPressed ;
You can’t perform that action at this time.
0 commit comments