From 5d12ea5ab12d3b911777bb8cbdeb70c3d183267c Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Thu, 31 Mar 2016 19:23:38 +0000 Subject: Move marked text-related data to the Fl_Cocoa_Screen_Driver class. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11488 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/mac.H | 1 - src/Fl_cocoa.mm | 3 ++- src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H | 6 +++++- src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx | 11 ++++++----- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/FL/mac.H b/FL/mac.H index 7beeba3e2..667c14cfb 100644 --- a/FL/mac.H +++ b/FL/mac.H @@ -171,7 +171,6 @@ public: static void *get_carbon_function(const char *name); static void screen_work_area(int &X, int &Y, int &W, int &H, int n); // compute work area of a given screen static int next_marked_length; // next length of marked text after current marked text will have been replaced - static int insertion_point_location(int *px, int *py, int *pheight); // computes window coordinates & height of insertion point static const int CoreText_threshold; // Mac OS version from which the Core Text API is used to display text static Fl_Fontdesc* calc_fl_fonts(void); // computes the fl_fonts global variable static int calc_mac_os_version(void); // computes the fl_mac_os_version global variable diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 97f72d388..3c51afe6c 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -38,6 +38,7 @@ extern "C" { #include #include #include +#include #include #include #include @@ -2683,7 +2684,7 @@ static FLTextInputContext* fltextinputcontext_instance = nil; glyphRect.size.width = 0; int x, y, height; - if (Fl_X::insertion_point_location(&x, &y, &height)) { + if (((Fl_Cocoa_Screen_Driver*)Fl::screen_driver())->insertion_point_location(&x, &y, &height)) { glyphRect.origin.x = (CGFloat)x; glyphRect.origin.y = (CGFloat)y; } else { diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H index ff0dcb062..60e2355d8 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H @@ -48,7 +48,10 @@ protected: XRectangle screens[MAX_SCREENS]; float dpi_h[MAX_SCREENS]; float dpi_v[MAX_SCREENS]; - + static int insertion_point_x; + static int insertion_point_y; + static int insertion_point_height; + static bool insertion_point_location_is_valid; public: // --- display management // --- screen configuration @@ -79,6 +82,7 @@ public: virtual int has_marked_text(); virtual void reset_marked_text(); virtual void insertion_point_location(int x, int y, int height); + int insertion_point_location(int *px, int *py, int *pheight); }; diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx index 0e8f480d1..3ca490153 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx @@ -235,10 +235,10 @@ int Fl_Cocoa_Screen_Driver::has_marked_text() { } -static int insertion_point_x = 0; -static int insertion_point_y = 0; -static int insertion_point_height = 0; -static bool insertion_point_location_is_valid = false; +int Fl_Cocoa_Screen_Driver::insertion_point_x = 0; +int Fl_Cocoa_Screen_Driver::insertion_point_y = 0; +int Fl_Cocoa_Screen_Driver::insertion_point_height = 0; +bool Fl_Cocoa_Screen_Driver::insertion_point_location_is_valid = false; void Fl_Cocoa_Screen_Driver::reset_marked_text() { Fl::compose_state = 0; @@ -246,7 +246,8 @@ void Fl_Cocoa_Screen_Driver::reset_marked_text() { insertion_point_location_is_valid = false; } -int Fl_X::insertion_point_location(int *px, int *py, int *pheight) +// computes window coordinates & height of insertion point +int Fl_Cocoa_Screen_Driver::insertion_point_location(int *px, int *py, int *pheight) // return true if the current coordinates of the insertion point are available { if ( ! insertion_point_location_is_valid ) return false; -- cgit v1.2.3