#1532 Ticking timer not turned off when focus lost

Bug
closed-fixed
scintilla (297)
5
2014-08-14
2013-10-03
No

In Editor::ShowCaretAtCurrentPosition() the ticking timer is turned on when the container has the focus, but it is not turned off when it has not.

Please see the attached patch that turns ticking off in ShowCaretAtCurrentPosition() and DropCaret(). I hope these are all the relevant places.

1 Attachments

Discussion

  • Neil Hodgson

    Neil Hodgson - 2013-10-04

    The ticker is required when Scintilla does not have the focus.

     
  • Neil Hodgson

    Neil Hodgson - 2013-10-04
    • labels: --> scintilla
    • status: open --> open-invalid
    • assigned_to: Neil Hodgson
     
  • Markus Nißl

    Markus Nißl - 2013-10-04

    Let me give you the big picture:

    We recently enhanced our MFC desktop application to use a new UI framework supporting ribbons. We then noticed that the CPU load suddenly increased when opening MDI windows hosting Scintilla.

    That's when we found out about the two Scintilla timers: ticker and idler.

    The MFC framework uses the idle state to update UI elements (whether to enable them or not). Alas, the timer messages sent by Scintilla stop the idle state every 100 milliseconds, so this again makes MFC do the UI element checking again. As ribbons show a lot of UI elements, this checking is more CPU intense.

    Now imagine that you have about 10 MDI windows open that are hosting Scintilla. This reduces the idle time from 100 ms down to only 10 ms on average.

    We solved this issue in our application by skipping the UI checking if the idle state was entered after having processed a Scintilla timer message.

    Nonetheless we were asking ourselves why the ticker never gets disabled as it only gets enabled if Scintilla has the focus.

    According to what we saw, the ticker is used for caret blinking, dwell starts and automatic scrolling.

    Your statement that the ticker is also needed if Scintilla does not have the focus leads to question: what if Scintilla never got the focus?

    So, as the ticker gets enabled when the focus is gained, we thought that it could be disabled when the focus is lost.

     
  • Markus Nißl

    Markus Nißl - 2013-10-08

    Are you still thinking about this issue or do you still consider my bug report to be invalid?

    Even if we could reduce the high CPU load coming from the MFC UI checking, there is nonetheless this unnecessary CPU load when having multiple Scintilla windows open while only one instance is visible.

    Don't you agree to only enable the ticker while it is needed, similar to the idler?

     
  • Neil Hodgson

    Neil Hodgson - 2013-10-08

    The patch causes a loss of functionality so will not be accepted.

    The ticker implementation is not a priority for me so I'd prefer to avoid working on it.

     
  • Markus Nißl

    Markus Nißl - 2013-10-09

    I understand that the provided patch is inadequate as it does not resolve the problem while preserving other functionality.

    But please keep in mind that this is not a specific problem to our application, but common to all usages on the Windows platform with more than one Scintilla instance.

    While it's not uncommon to have a couple of MDI windows open, we also use Scintilla as a sophisticated single line editor which serves as a replacement of the regular CEdit control in dialogs. So if the user opens such a dialog, he or she can be presented with about 10 Scintilla controls, while only one can have the focus of course.

    Not to forget that this unnecessary CPU load drains the battery on laptops.

    We don't have the insight into Scintilla internals like you to work on this issue, I'm afraid. Shall I create a "feature request" in order not to lose track of this issue so that it might be resolved in a future release of Scintilla?

     
  • Neil Hodgson

    Neil Hodgson - 2013-10-09
     

    Related

    Bugs: #1086

  • Neil Hodgson

    Neil Hodgson - 2014-08-14

    This is fixed in 3.5.0.

     
  • Neil Hodgson

    Neil Hodgson - 2014-08-14
    • status: open-invalid --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2014-08-14
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks