diff options
Diffstat (limited to 'src/scintilla_backports/6117_23546875480b.patch')
-rw-r--r-- | src/scintilla_backports/6117_23546875480b.patch | 313 |
1 files changed, 313 insertions, 0 deletions
diff --git a/src/scintilla_backports/6117_23546875480b.patch b/src/scintilla_backports/6117_23546875480b.patch new file mode 100644 index 00000000..bd0057ac --- /dev/null +++ b/src/scintilla_backports/6117_23546875480b.patch @@ -0,0 +1,313 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1488885645 -39600 +# Node ID 23546875480b1ee4a3f309c738f64166a0409a46 +# Parent 6c62b379a52e1d4a2feda80bcec9b352f120dcb6 +Bug [#1910]. Accessibility support may be queried and, on GTK+, disabled. + +diff -r 6c62b379a52e -r 23546875480b cocoa/ScintillaCocoa.mm +--- a/cocoa/ScintillaCocoa.mm Tue Mar 07 15:54:33 2017 +1100 ++++ b/cocoa/ScintillaCocoa.mm Tue Mar 07 22:20:45 2017 +1100 +@@ -906,6 +906,9 @@ + return r; + } + ++ case SCI_GETACCESSIBILITY: ++ return SC_ACCESSIBILITY_ENABLED; ++ + default: + sptr_t r = ScintillaBase::WndProc(iMessage, wParam, lParam); + +diff -r 6c62b379a52e -r 23546875480b doc/ScintillaDoc.html +--- a/doc/ScintillaDoc.html Tue Mar 07 15:54:33 2017 +1100 ++++ b/doc/ScintillaDoc.html Tue Mar 07 22:20:45 2017 +1100 +@@ -367,17 +367,17 @@ + <tr> + <td>○ <a class="toc" href="#LongLines">Long lines</a></td> + ++ <td>○ <a class="toc" href="#Accessibility">Accessibility</a></td> ++ + <td>○ <a class="toc" href="#Lexer">Lexer</a></td> + ++ </tr> ++ ++ <tr> + <td>○ <a class="toc" href="#LexerObjects">Lexer objects</a></td> + +- </tr> +- +- <tr> + <td>○ <a class="toc" href="#Notifications">Notifications</a></td> + +- <td>○ <a class="toc" href="#Accessibility">Accessibility</a></td> +- + <td>○ <a class="toc" href="#Images">Images</a></td> + + </tr> +@@ -6511,6 +6511,60 @@ + of a space character in <code>STYLE_DEFAULT</code>. All the edges can be cleared with + <code>SCI_MULTIEDGECLEARALL</code>.</p> + ++ <h2 id="Accessibility">Accessibility</h2> ++ ++ <p>Scintilla supports some platform accessibility features. ++ This support differs between platforms. ++ On GTK+ and Cocoa the platform accessibility APIs are implemented sufficiently to ++ make screen readers work. ++ On Win32, the system caret is manipulated to help screen readers. ++ </p> ++ ++ <code><a class="message" href="#SCI_SETACCESSIBILITY">SCI_SETACCESSIBILITY(int accessibility)</a><br /> ++ <a class="message" href="#SCI_GETACCESSIBILITY">SCI_GETACCESSIBILITY → int</a><br /> ++ </code> ++ ++ <p><b id="SCI_SETACCESSIBILITY">SCI_SETACCESSIBILITY(int accessibility)</b><br /> ++ <b id="SCI_GETACCESSIBILITY">SCI_GETACCESSIBILITY → int</b><br /> ++ These messages may enable or disable accessibility and report its current status.</p> ++ ++ <p>On most platforms, accessibility is either implemented or not implemented and this can be ++ discovered with <code>SCI_GETACCESSIBILITY</code> with ++ <code>SCI_SETACCESSIBILITY</code> performing no action. ++ On GTK+, there are storage and performance costs to accessibility, so it can be disabled ++ by calling <code>SCI_SETACCESSIBILITY</code>. ++ </p> ++ ++ <table class="standard" summary="Accessibility status"> ++ <tbody> ++ <tr> ++ <th align="left">Symbol</th> ++ ++ <th>Value</th> ++ ++ <th align="left">Accessibility status</th> ++ </tr> ++ </tbody> ++ ++ <tbody valign="top"> ++ <tr> ++ <td align="left"><code>SC_ACCESSIBILITY_DISABLED</code></td> ++ ++ <td align="center">0</td> ++ ++ <td>Accessibility is disabled.</td> ++ </tr> ++ ++ <tr> ++ <td align="left"><code>SC_ACCESSIBILITY_ENABLED</code></td> ++ ++ <td align="center">1</td> ++ ++ <td>Accessibility is enabled.</td> ++ </tr> ++ </tbody> ++ </table> ++ + <h2 id="Lexer">Lexer</h2> + + <p>If you define the symbol <code>SCI_LEXER</code> when building Scintilla, (this is sometimes +@@ -7891,15 +7945,6 @@ + <a class="jump" href="#SCN_AUTOCSELECTION">SCN_AUTOCSELECTION</a></code> + notification.</p> + +- <h2 id="Accessibility">Accessibility</h2> +- +- <p>Scintilla supports some platform accessibility features. +- This support differs between platforms. +- On GTK+ and Cocoa the platform accessibility APIs are implemented sufficiently to +- make screen readers work. +- On Win32, the system caret is manipulated to help screen readers. +- </p> +- + <h2 id="Images">Images</h2> + + <p>Two formats are supported for images used in margin markers and autocompletion lists, RGBA and XPM.</p> +diff -r 6c62b379a52e -r 23546875480b doc/ScintillaHistory.html +--- a/doc/ScintillaHistory.html Tue Mar 07 15:54:33 2017 +1100 ++++ b/doc/ScintillaHistory.html Tue Mar 07 22:20:45 2017 +1100 +@@ -527,6 +527,10 @@ + Released 19 February 2017. + </li> + <li> ++ Accessibility support may be queried with SCI_GETACCESSIBILITY. ++ On GTK+, accessibility may be disabled by calling SCI_SETACCESSIBILITY. ++ </li> ++ <li> + Lexer added for "indent" language which is styled as plain text but folded by indentation level. + </li> + <li> +diff -r 6c62b379a52e -r 23546875480b gtk/ScintillaGTK.cxx +--- a/gtk/ScintillaGTK.cxx Tue Mar 07 15:54:33 2017 +1100 ++++ b/gtk/ScintillaGTK.cxx Tue Mar 07 22:20:45 2017 +1100 +@@ -175,6 +175,7 @@ + rgnUpdate(0), + repaintFullWindow(false), + styleIdleID(0), ++ accessibilityEnabled(SC_ACCESSIBILITY_ENABLED), + accessible(0) { + sci = sci_; + wMain = GTK_WIDGET(sci); +@@ -875,6 +876,19 @@ + return ret; + } + ++ case SCI_GETACCESSIBILITY: ++ return accessibilityEnabled; ++ ++ case SCI_SETACCESSIBILITY: ++ accessibilityEnabled = wParam; ++ if (accessible) { ++ ScintillaGTKAccessible *sciAccessible = ScintillaGTKAccessible::FromAccessible(accessible); ++ if (sciAccessible) { ++ sciAccessible->SetAccessibility(); ++ } ++ } ++ break; ++ + default: + return ScintillaBase::WndProc(iMessage, wParam, lParam); + } +diff -r 6c62b379a52e -r 23546875480b gtk/ScintillaGTK.h +--- a/gtk/ScintillaGTK.h Tue Mar 07 15:54:33 2017 +1100 ++++ b/gtk/ScintillaGTK.h Tue Mar 07 22:20:45 2017 +1100 +@@ -68,6 +68,7 @@ + bool repaintFullWindow; + + guint styleIdleID; ++ int accessibilityEnabled; + AtkObject *accessible; + + // Private so ScintillaGTK objects can not be copied +diff -r 6c62b379a52e -r 23546875480b gtk/ScintillaGTKAccessible.cxx +--- a/gtk/ScintillaGTKAccessible.cxx Tue Mar 07 15:54:33 2017 +1100 ++++ b/gtk/ScintillaGTKAccessible.cxx Tue Mar 07 22:20:45 2017 +1100 +@@ -788,6 +788,10 @@ + //~ iface->set_run_attributes = SetRunAttributes; + } + ++bool ScintillaGTKAccessible::Enabled() const { ++ return sci->accessibilityEnabled == SC_ACCESSIBILITY_ENABLED; ++} ++ + // Callbacks + + void ScintillaGTKAccessible::UpdateCursor() { +@@ -820,6 +824,10 @@ + } + + void ScintillaGTKAccessible::ChangeDocument(Document *oldDoc, Document *newDoc) { ++ if (!Enabled()) { ++ return; ++ } ++ + if (oldDoc == newDoc) { + return; + } +@@ -854,7 +862,15 @@ + #endif + } + ++void ScintillaGTKAccessible::SetAccessibility() { ++ // Called by ScintillaGTK when application has enabled or disabled accessibility ++ character_offsets.resize(0); ++ character_offsets.push_back(0); ++} ++ + void ScintillaGTKAccessible::Notify(GtkWidget *, gint, SCNotification *nt) { ++ if (!Enabled()) ++ return; + switch (nt->nmhdr.code) { + case SCN_MODIFIED: { + if (nt->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { +@@ -864,6 +880,13 @@ + character_offsets.resize(line + 1); + } + } ++ if (nt->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { ++ // invalidate character offset cache if applicable ++ const Position line = sci->pdoc->LineFromPosition(nt->position); ++ if (character_offsets.size() > static_cast<size_t>(line + 1)) { ++ character_offsets.resize(line + 1); ++ } ++ } + if (nt->modificationType & SC_MOD_INSERTTEXT) { + int startChar = CharacterOffsetFromByteOffset(nt->position); + int lengthChar = sci->pdoc->CountCharacters(nt->position, nt->position + nt->length); +diff -r 6c62b379a52e -r 23546875480b gtk/ScintillaGTKAccessible.h +--- a/gtk/ScintillaGTKAccessible.h Tue Mar 07 15:54:33 2017 +1100 ++++ b/gtk/ScintillaGTKAccessible.h Tue Mar 07 22:20:45 2017 +1100 +@@ -23,12 +23,16 @@ + // cache holding character offset for each line start, see CharacterOffsetFromByteOffset() + std::vector<Position> character_offsets; + ++ // cache holding character offset for each line start, see CharacterOffsetFromByteOffset() ++ std::vector<Position> character_offsets; ++ + // cached length of the deletion, in characters (see Notify()) + int deletionLengthChar; + // local state for comparing + Position old_pos; + std::vector<SelectionRange> old_sels; + ++ bool Enabled() const; + void UpdateCursor(); + void Notify(GtkWidget *widget, gint code, SCNotification *nt); + static void SciNotify(GtkWidget *widget, gint code, SCNotification *nt, gpointer data) { +@@ -136,6 +140,7 @@ + // So ScintillaGTK can notify us + void ChangeDocument(Document *oldDoc, Document *newDoc); + void NotifyReadOnly(); ++ void SetAccessibility(); + + // Helper GtkWidget methods + static AtkObject *WidgetGetAccessibleImpl(GtkWidget *widget, AtkObject **cache, gpointer widget_parent_class); +diff -r 6c62b379a52e -r 23546875480b include/Scintilla.h +--- a/include/Scintilla.h Tue Mar 07 15:54:33 2017 +1100 ++++ b/include/Scintilla.h Tue Mar 07 22:20:45 2017 +1100 +@@ -593,6 +593,10 @@ + #define SCI_LINESSPLIT 2289 + #define SCI_SETFOLDMARGINCOLOUR 2290 + #define SCI_SETFOLDMARGINHICOLOUR 2291 ++#define SC_ACCESSIBILITY_DISABLED 0 ++#define SC_ACCESSIBILITY_ENABLED 1 ++#define SCI_SETACCESSIBILITY 2702 ++#define SCI_GETACCESSIBILITY 2703 + #define SCI_LINEDOWN 2300 + #define SCI_LINEDOWNEXTEND 2301 + #define SCI_LINEUP 2302 +diff -r 6c62b379a52e -r 23546875480b include/Scintilla.iface +--- a/include/Scintilla.iface Tue Mar 07 15:54:33 2017 +1100 ++++ b/include/Scintilla.iface Tue Mar 07 22:20:45 2017 +1100 +@@ -1476,6 +1476,16 @@ + # Set the other colour used as a chequerboard pattern in the fold margin + fun void SetFoldMarginHiColour=2291(bool useSetting, colour fore) + ++enu Accessibility=SC_ACCESSIBILITY_ ++val SC_ACCESSIBILITY_DISABLED=0 ++val SC_ACCESSIBILITY_ENABLED=1 ++ ++# Enable or disable accessibility. ++set void SetAccessibility=2702(int accessibility,) ++ ++# Report accessibility status. ++get int GetAccessibility=2703(,) ++ + ## New messages go here + + ## Start of key messages +diff -r 6c62b379a52e -r 23546875480b src/Editor.cxx +--- a/src/Editor.cxx Tue Mar 07 15:54:33 2017 +1100 ++++ b/src/Editor.cxx Tue Mar 07 22:20:45 2017 +1100 +@@ -7554,6 +7554,13 @@ + std::vector<EdgeProperties>().swap(vs.theMultiEdge); // Free vector and memory, C++03 compatible + InvalidateStyleRedraw(); + break; ++ ++ case SCI_GETACCESSIBILITY: ++ return SC_ACCESSIBILITY_DISABLED; ++ ++ case SCI_SETACCESSIBILITY: ++ // May be implemented by platform code. ++ break; + + case SCI_GETDOCPOINTER: + return reinterpret_cast<sptr_t>(pdoc); |