Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: ridge on January 25, 2017, 12:57:24 am

Title: Endless stream of events - CB-16.01
Post by: ridge on January 25, 2017, 12:57:24 am
I inserted DebugLog statements in main.cpp right before event.Skip() in each handler (e.g., OnEditMenuUpdateUI, OnViewMenuUpdateUI, OnSearchMenuUpdateUI).  Then, built and ran CB.  There appears to be an unexpected endless stream of events even when there is no UI activity.

OnEditMenuUpdateUI called
OnEditMenuUpdateUI called
OnEditMenuUpdateUI called
.
.
.
Is this expected?
Title: Re: Endless stream of events - CB-16.01
Post by: oBFusCATed on January 25, 2017, 01:15:23 am
Don't know. Have you tried to place a breakpoint to see what triggers the events?
Title: Re: Endless stream of events - CB-16.01
Post by: ollydbg on January 25, 2017, 02:47:03 pm
This is by design, because we update the menu item status in a single function, this function is called about 500ms(maybe another value, but I can't remember for now) at a time.
Title: Re: Endless stream of events - CB-16.01
Post by: yvesdm3000 on January 25, 2017, 03:18:30 pm
This is by design, because we update the menu item status in a single function, this function is called about 500ms(maybe another value, but I can't remember for now) at a time.
Shouldn't this happen when the menu is clicked e.g. opened ?

Yves
Title: Re: Endless stream of events - CB-16.01
Post by: ollydbg on January 25, 2017, 04:10:10 pm
This is by design, because we update the menu item status in a single function, this function is called about 500ms(maybe another value, but I can't remember for now) at a time.
Shouldn't this happen when the menu is clicked e.g. opened ?

Yves
It should. But as far as I know, there are too many menu items and to many menu status, so we have some alternative way to update the menu status, see discussions here: wxUpdateUIEvent performance issues (http://forums.codeblocks.org/index.php/topic,11669.msg79334.html#msg79334)

EDIT: I just see in the source code, we have 100ms setting values.
Code
MainFrame* CodeBlocksApp::InitFrame()
{
    static_assert(wxMinimumVersion<2,8,12>::eval, "wxWidgets 2.8.12 is required");

    MainFrame *frame = new MainFrame();
    wxUpdateUIEvent::SetUpdateInterval(100);
    SetTopWindow(nullptr);

    if (g_DDEServer && m_DDE)
        g_DDEServer->SetFrame(frame); // Set m_Frame in DDE-Server

    return frame;
}
Title: Re: Endless stream of events - CB-16.01
Post by: ridge on January 25, 2017, 08:11:02 pm
This is important information - thanks for the link.
It hasn't been discussed since 2009??
I think Jens' comments are worth noting - perhaps we should take heed in the release version?

1. Bind only one ID to the appropriate OnxxxMenuUpdateUI-function.
2. Set the update-interval to 500 ms (or 200 ms?).

What do you think?
I'd like to understand why we're binding all of the events - there must be a good reason - anybody know?
Title: Re: Endless stream of events - CB-16.01
Post by: oBFusCATed on January 25, 2017, 08:17:41 pm
Lets start with: What is the real problem?
Title: Re: Endless stream of events - CB-16.01
Post by: ridge on January 25, 2017, 08:34:54 pm
Good question.  My original post was a request for information (which I got).
I'm trying to figure out why wxChoice items don't show up on custom toolbars in CodeBlocks
(at least on MacOS).  As I began debugging, it was unexpected to receive so many events
(which seemed unnecessary) so I thought I'd ask.

I suppose the problem is that I don't have a design document for CodeBlocks.
Title: Re: Endless stream of events - CB-16.01
Post by: oBFusCATed on January 25, 2017, 09:31:53 pm
There is no such thing as design document. Use the code svn blame/git blame are your best friends.