From 5bab46940c9dc6ad272e4cbf7970a7261aaff210 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Fri, 7 Jan 2022 16:34:44 +0100 Subject: Re-organize cross-platform support for text input methods. FLTK 1.3 supports complex text input methods (TIMs) for the 3 platforms (X11, Windows, macOS). This support has an interface with FLTK that is common for X11 and Windows, via (undocumented) functions fl_set_spot(), fl_set_status() and fl_reset_spot(). In contrast, and because it's been developed independently, the interface between the macOS TIM and FLTK 1.3 is completely different : static functions FL::insertion_point_location() and Fl::reset_marked_text(). The present change implements a single TIM/FLTK interface used by all platforms based on functions fl_set_spot() and fl_reset_spot(). The previous macOS-specific functions FL::insertion_point_location() and Fl::reset_marked_text() are maintained only for compatibility with 1.3 and deprecated. --- src/Fl_cocoa.mm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/Fl_cocoa.mm') diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index faab62392..6da31ad43 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -2674,7 +2674,7 @@ static FLTextInputContext* fltextinputcontext_instance = nil; - (void)unmarkText { fl_lock_function(); - Fl::reset_marked_text(); + Fl_Cocoa_Screen_Driver::reset_marked_text(); fl_unlock_function(); //NSLog(@"unmarkText"); } @@ -2720,7 +2720,7 @@ static FLTextInputContext* fltextinputcontext_instance = nil; glyphRect.size.width = 0; int x, y, height; - if (((Fl_Cocoa_Screen_Driver*)Fl::screen_driver())->insertion_point_location(&x, &y, &height)) { + if (Fl_Cocoa_Screen_Driver::insertion_point_location(&x, &y, &height)) { glyphRect.origin.x = (CGFloat)x; glyphRect.origin.y = (CGFloat)y; } else { @@ -4624,3 +4624,12 @@ void Fl_Cocoa_Screen_Driver::default_icons(const Fl_RGB_Image *icons[], int coun default_icon = rgb_to_nsimage(icons[0]); } } + +// Deprecated in 1.4 - only for backward compatibility with 1.3 +void Fl::insertion_point_location(int x, int y, int height) { + Fl_Cocoa_Screen_Driver::insertion_point_location(x, y, height); +} +// Deprecated in 1.4 - only for backward compatibility with 1.3 +void Fl::reset_marked_text() { + Fl_Cocoa_Screen_Driver::reset_marked_text(); +} -- cgit v1.2.3