#1086 Ticking continues after focus lost

Scintilla (793)

On Windows, the timer used for caret blink and auto-scrolling continues to tick after the control has lost the focus, causing unnecessary CPU usage and context switches.

Adding a call to SetTicking(false) in the WM_KILLFOCUS handler appears to solve this with no ill effects.

(Patch attached.)


Bugs: #1532


  • Neil Hodgson

    Neil Hodgson - 2011-01-10

    The other activities currently performed in Tick are automatic horizontal scroll bar sizing and dwell notifications.

    It may be OK to disable scroll bar sizing although it is possible for the container to push longer lines into Scintilla while it does not have focus. The user may not be aware that new data is present even though it is not in the current view and the scroll bar is not showing any scrolling is possible.

    Dwell events are supposed to fire even when Scintilla does not have focus. A common requirement is for debuggers to show data tips when the mouse is hovered over variables in an unfocussed editor.

    Scintilla also has a complex focus system. The container can override the system focus when it has moved system focus to another window but wishes Scintilla to be the logical focus and display as such with blinking caret.

    There are performance and resource benefits to avoiding unnecessary ticking but it is much more important for Scintilla to continue to display all current tick-based features and to allow additional tick based features in the future. If you want to go down this path, think about a generic tick control object that allows different tick features to register and decide when they need ticks and only disable ticking if no feature needs it. For example, dwell events are not needed if the dwell period is SC_TIME_FOREVER.

  • Neil Hodgson

    Neil Hodgson - 2011-01-10
    • assigned_to: nobody --> nyamatongwe
    • milestone: --> Feature_Request
  • Jordan Russell

    Jordan Russell - 2011-01-17

    Thanks for the clarification. I had suspected this might have been an inadvertent omission after noticing that ScintillaMacOSX.cxx does disable ticking when losing the focus...

    I'll just not worry about it for now. :)

  • Neil Hodgson

    Neil Hodgson - 2011-02-03
    • priority: 5 --> 3
  • Neil Hodgson

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

    Neil Hodgson - 2014-08-14

    This is fixed in 3.5.0 with separate timers for each task.


Log in to post a comment.

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

Sign up for the SourceForge newsletter:

No, thanks