Hmm not sure if that's good or bad :?
Good insofar as if it really reduces the load by one half for you, then we have a hint that my theory may at least partially be right (though other people have reported no visible difference).
Bad insofar as those messages are needed to keep the menu states in sync, and it'll be a horror to remove them...
ummmmm. Maybe not. Notice that in main.cpp the same code is being executed over and over again for a single UI cycle. For example:
EVT_UPDATE_UI(idEditUndo, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditRedo, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditCopy, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditCut, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditPaste, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditSwapHeaderSource, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditGotoMatchingBrace, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditFoldAll, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditUnfoldAll, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditToggleAllFolds, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditFoldBlock, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditUnfoldBlock, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditToggleFoldBlock, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditEOLCRLF, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditEOLCR, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditEOLLF, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditEncoding, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditSelectAll, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditBookmarksToggle, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditBookmarksNext, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditBookmarksPrevious, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditCommentSelected, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditAutoComplete, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditUncommentSelected, MainFrame::OnEditMenuUpdateUI)
EVT_UPDATE_UI(idEditToggleCommentSelected, MainFrame::OnEditMenuUpdateUI)
This is just one example of many.
Is there anyway on secondary calls to set a flag that says, "Hey, I've already done this for now"; then on the last call clear the flag?
Is there any correlation between OnIdle and UI updates? If so, a flag might be set there?
Can a timer be set to only honor UI calls every xxx mils?
Using a timer and poll events every 100 ms or so would be great, but unluckily I don't see a way how you can do that with wxWidgets. For all I know there are no functions to actually manipulate the event queue in such a way as we would need (peek at and pop off one message, then remove all duplicates).
AFAIK, No timer is necessary. You need to set UpdateInterval during app initialization. The following code should do the job.
wxUpdateUIEvent::SetUpdateInterval(100);
It will set the value of updating ui to 100 milliseconds. :)
I tested it sometimes back for one of my app.
Regards,
Biplab