diff options
| author | Manolo Gouy <Manolo> | 2016-03-28 16:17:39 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-03-28 16:17:39 +0000 |
| commit | 4fbbab8b41f4775752587f18c7d1b32bbd947c27 (patch) | |
| tree | 2b00fbd77ab8778f586bbe861cf715ffedee608f /src/drivers/Darwin | |
| parent | 28d1a2d6848d5abe555fd0ddae8b57cec6f900ca (diff) | |
Rewrite Fl_compose.cxx under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11454 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Darwin')
| -rw-r--r-- | src/drivers/Darwin/Fl_Darwin_System_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/Darwin/Fl_Darwin_System_Driver.cxx | 44 |
2 files changed, 45 insertions, 0 deletions
diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H index a95bac019..61a7c961e 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H @@ -43,6 +43,7 @@ class Fl_Darwin_System_Driver : public Fl_System_Driver public: virtual int single_arg(const char *arg); virtual int arg_and_value(const char *name, const char *value); + virtual int compose(int &del); }; #endif // FL_DARWIN_SYSTEM_DRIVER_H diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx index bbab50be9..590e23d0b 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx @@ -19,8 +19,12 @@ #include "../../config_lib.h" #include "Fl_Darwin_System_Driver.H" +#include <FL/Fl.H> +#include <FL/x.H> #include <string.h> +int Fl_X::next_marked_length = 0; + //const char* fl_local_alt = "\xe2\x8c\xa5\\"; // U+2325 (option key) const char* fl_local_alt = "⌥\\"; // U+2325 (option key) //const char* fl_local_ctrl = "\xe2\x8c\x83\\"; // U+2303 (up arrowhead) @@ -45,6 +49,46 @@ int Fl_Darwin_System_Driver::arg_and_value(const char *name, const char *value) return strcmp(name, "NSDocumentRevisionsDebugMode") == 0; } +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; + +void Fl::reset_marked_text() { + Fl::compose_state = 0; + Fl_X::next_marked_length = 0; + insertion_point_location_is_valid = false; +} + +int Fl_X::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; + *px = insertion_point_x; + *py = insertion_point_y; + *pheight = insertion_point_height; + return true; +} + +void Fl::insertion_point_location(int x, int y, int height) { + insertion_point_location_is_valid = true; + insertion_point_x = x; + insertion_point_y = y; + insertion_point_height = height; +} + +int Fl_Darwin_System_Driver::compose(int &del) { + int condition; + int has_text_key = Fl::compose_state || Fl::e_keysym <= '~' || Fl::e_keysym == FL_Iso_Key || + (Fl::e_keysym >= FL_KP && Fl::e_keysym <= FL_KP_Last && Fl::e_keysym != FL_KP_Enter); + condition = Fl::e_state&(FL_META | FL_CTRL) || + (Fl::e_keysym >= FL_Shift_L && Fl::e_keysym <= FL_Alt_R) || // called from flagsChanged + !has_text_key ; + if (condition) { del = 0; return 0;} // this stuff is to be treated as a function key + del = Fl::compose_state; + Fl::compose_state = Fl_X::next_marked_length; + return 1; +} // // End of "$Id$". |
