discarding inputs during initialization?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
User avatar
bsenftner
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu May 26, 2016 9:19 pm

discarding inputs during initialization?

Post by bsenftner » Tue May 26, 2020 5:27 pm

I have a moderately complex wxWidgets application with multiple windows, each having notebooks with multiple panels, some panels display video streams from IP sources, controlling toolbars, arrays of buttons that pop dialogs and so on. Each time the application is launched, it recreates the multiple window and panel layout it had when last terminated. Application launch can take a minute or two for a complex multi-window, multi-monitor layout.

The application was released years ago, with multiple releases and upgrades over time.

At some point an atomic flag was added signaling all windows and threads of the application that initialization/launch is complete, signaling the GUI in all locations to become live and operational.

One of the reasons this "we're initialized and ready for work" flag was added was because (we suspect) a mouse click or hot-key that becomes queued due to the application's initialization block of system events contains a mouse/key event causing one of our dialogs to pop. Which dialog pops seems to vary with where the window appears and the application icon's location beneath. The situation is not consistent, it does not occur in Debug builds, so it is difficult to narrow down the cause. If I try to create mouse/key events during initialization they seem to get blocked fine by looking at our flag. But then some random launch of the application pops a random dialog as if the dialog's launching button/hot-key were pressed.

So, I'm wondering if this is a case for using DeletePendingEvents() across all event handlers just before clearing the "we're initialized and ready for work" flag? Does this "receiving input during initialization" situation sound familiar to others, or is this a signal the application's initialization is not being handled correctly?

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4539
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: discarding inputs during initialization?

Post by ONEEYEMAN » Tue May 26, 2020 5:45 pm

Hi,
It's probably an initialization issue.
Do you know the pattern on which this happens?
Can you maybe try to remove the optimization for both wxWidgets and you software when you build the Release mode?
Are you starting the program by clicking on the icon or starting from the Terminal/Command Prompt?

Thank you.

User avatar
doublemax
Moderator
Moderator
Posts: 15276
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: discarding inputs during initialization?

Post by doublemax » Tue May 26, 2020 7:01 pm

Did you override wxAppConsole::FilterEvent()?
https://docs.wxwidgets.org/trunk/classw ... c6f602e20c

That would be the ideal place to filter/ignore all events until your app is ready and could also be a good place to log all events. Maybe this helps to find out what triggers the dialogs opening in your application.
Use the source, Luke!

Post Reply