summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl_Text_Editor.H9
-rw-r--r--src/Fl_Text_Editor.cxx9
2 files changed, 17 insertions, 1 deletions
diff --git a/FL/Fl_Text_Editor.H b/FL/Fl_Text_Editor.H
index c688f6260..1a01dfc8d 100644
--- a/FL/Fl_Text_Editor.H
+++ b/FL/Fl_Text_Editor.H
@@ -78,10 +78,19 @@ class FL_EXPORT Fl_Text_Editor : public Fl_Text_Display {
/** Removes all of the key bindings associated with the text editor or list. */
void remove_all_key_bindings() { remove_all_key_bindings(&key_bindings); }
void add_default_key_bindings(Key_Binding** list);
+#if FLTK_ABI_VERSION < 10304
+ // OLD: non-const
Key_Func bound_key_function(int key, int state, Key_Binding* list);
/** Returns the function associated with a key binding. */
Key_Func bound_key_function(int key, int state)
{ return bound_key_function(key, state, key_bindings); }
+#else
+ // NEW: const (STR#3306)
+ Key_Func bound_key_function(int key, int state, Key_Binding* list) const;
+ /** Returns the function associated with a key binding. */
+ Key_Func bound_key_function(int key, int state) const
+ { return bound_key_function(key, state, key_bindings); }
+#endif
/** Sets the default key function for unassigned keys. */
void default_key_function(Key_Func f) { default_key_function_ = f; }
diff --git a/src/Fl_Text_Editor.cxx b/src/Fl_Text_Editor.cxx
index 09435d2e3..b2ec38456 100644
--- a/src/Fl_Text_Editor.cxx
+++ b/src/Fl_Text_Editor.cxx
@@ -163,7 +163,14 @@ void Fl_Text_Editor::add_default_key_bindings(Key_Binding** list) {
}
/** Returns the function associated with a key binding.*/
-Fl_Text_Editor::Key_Func Fl_Text_Editor::bound_key_function(int key, int state, Key_Binding* list) {
+#if FLTK_ABI_VERSION < 10304
+// OLD - non-const
+Fl_Text_Editor::Key_Func Fl_Text_Editor::bound_key_function(int key, int state, Key_Binding* list)
+#else
+// NEW - const (STR#3306)
+Fl_Text_Editor::Key_Func Fl_Text_Editor::bound_key_function(int key, int state, Key_Binding* list) const
+#endif
+{
Key_Binding* cur;
for (cur = list; cur; cur = cur->next)
if (cur->key == key)