Cocoa change for styling and update UI
Neil Hodgson <[email protected]> Sun, 19 Jul 2026 18:20:56 -0700 (PDT)
| Newsgroups | gmane.comp.lib.scintilla.devel |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_335982_588725999.1784510456177 Content-Type: multipart/alternative; boundary="----=_Part_335983_209318929.1784510456177" ------=_Part_335983_209318929.1784510456177 Content-Type: text/plain; charset="UTF-8" When experimenting with the proposed SC_UPDATE_TEXT flag of SCN_UPDATEUI on MacOS Cocoa, I noticed that the stack trace for the SCN_UPDATEUI handler included Editor::Paint. This meant that code that tried to improve performance by moving styling and notifications out of Editor::Paint was now failing. The high-priority idle technique chosen by Win32 and GTK had been implemented for Cocoa with a run-loop observer but Scintilla's callback was being called after drawing. Changing the order parameter which determines priority from 0 to -1 changed this but -1 is the priority for input events so could cause poor performance by calling Scintilla continuously during rapid mouse/keyboard use instead of coalescing input events. Before drawing, Cocoa calls the view's viewWillDraw method which was also able to perform styling and notifications. This wasn't working since the call to find the area being redrawn getRectsBeingDrawn was returning nothing. It is possible there have been platform updates that have changed this and there are online reports that this method is no longer dependable. viewWillDraw was changed to use the whole content area if getRectsBeingDrawn returns nothing. This appears to fix the problem and should avoid drawing abandonment caused by styling. https://sourceforge.net/p/scintilla/code/ci/8c82401bf8b57b422d660b72879ffe7e34e93556/ Neil -- You received this message because you are subscribed to the Google Groups "scintilla-interest" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/scintilla-interest/a1df66e0-c928-459d-bf58-1729ee5f22ebn%40googlegroups.com. ------=_Part_335983_209318929.1784510456177 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div>When experimenting with the proposed=C2=A0<span style=3D"color: rgb(34= , 34, 34); font-family: Arial, Helvetica, sans-serif; font-size: small; fon= t-style: normal; font-variant-ligatures: normal; font-variant-caps: normal;= font-weight: 400; letter-spacing: normal; text-align: start; text-indent: = 0px; text-transform: none; word-spacing: 0px; white-space: normal; backgrou= nd-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-deco= ration-style: initial; text-decoration-color: initial; display: inline; flo= at: none;">SC_UPDATE_TEXT flag of=C2=A0</span><span style=3D"color: rgb(34,= 34, 34); font-family: Arial, Helvetica, sans-serif; font-size: small; font= -style: normal; font-variant-ligatures: normal; font-variant-caps: normal; = font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0= px; text-transform: none; word-spacing: 0px; white-space: normal; backgroun= d-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decor= ation-style: initial; text-decoration-color: initial; display: inline; floa= t: none;">SCN_UPDATEUI on MacOS Cocoa, I noticed that the stack trace for t= he=C2=A0</span><span style=3D"color: rgb(34, 34, 34); font-family: Arial, H= elvetica, sans-serif; font-size: small; font-style: normal; font-variant-li= gatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacin= g: normal; text-align: start; text-indent: 0px; text-transform: none; word-= spacing: 0px; white-space: normal; background-color: rgb(255, 255, 255); te= xt-decoration-thickness: initial; text-decoration-style: initial; text-deco= ration-color: initial; display: inline; float: none;">SCN_UPDATEUI handler = included=C2=A0</span>Editor::Paint.</div><div><br /></div><div>This meant t= hat code that tried to improve performance by moving styling and notificati= ons out of Editor::Paint was now failing.</div><div><br /></div><div>The hi= gh-priority idle technique chosen by Win32 and GTK had been implemented for= Cocoa with a run-loop observer but Scintilla's callback was being called a= fter drawing. Changing the order parameter which determines priority from 0= to -1 changed this but -1 is the priority for input events so could cause = poor performance by calling Scintilla continuously during rapid mouse/keybo= ard use instead of coalescing input events.</div><div><br /></div><div>Befo= re drawing, Cocoa calls the view's=C2=A0viewWillDraw method which was also = able to perform styling and notifications. This wasn't working since the ca= ll to find the area being redrawn=C2=A0getRectsBeingDrawn was returning not= hing. It is possible there have been platform updates that have changed thi= s and there are online reports that this method is no longer dependable.</d= iv><div><br /></div><div> <p style=3D"margin: 0px; text-indent: 0px;">viewWillDraw was changed to use= the whole content area if=C2=A0getRectsBeingDrawn returns nothing. This ap= pears to fix the problem and should avoid drawing abandonment caused by sty= ling.</p><p style=3D"margin: 0px; text-indent: 0px;"><br /></p><p style=3D"= margin: 0px; text-indent: 0px;">https://sourceforge.net/p/scintilla/code/ci= /8c82401bf8b57b422d660b72879ffe7e34e93556/</p><p style=3D"margin: 0px; text= -indent: 0px;"><br /></p><p style=3D"margin: 0px; text-indent: 0px;">Neil</= p></div> <p></p> -- <br /> You received this message because you are subscribed to the Google Groups &= quot;scintilla-interest" group.<br /> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]">= [email protected]</a>.<br /> To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/= scintilla-interest/a1df66e0-c928-459d-bf58-1729ee5f22ebn%40googlegroups.com= ?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/= scintilla-interest/a1df66e0-c928-459d-bf58-1729ee5f22ebn%40googlegroups.com= </a>.<br /> ------=_Part_335983_209318929.1784510456177-- ------=_Part_335982_588725999.1784510456177--