summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl.H9
-rw-r--r--FL/Fl_System_Driver.H7
-rw-r--r--src/Fl.cxx8
-rw-r--r--src/Fl_Input.cxx4
-rw-r--r--src/Fl_Input_.cxx2
-rw-r--r--src/Fl_Text_Display.cxx2
-rw-r--r--src/Fl_Text_Editor.cxx4
-rw-r--r--src/drivers/Darwin/Fl_Darwin_System_Driver.H3
-rw-r--r--src/drivers/Darwin/Fl_Darwin_System_Driver.cxx8
9 files changed, 26 insertions, 21 deletions
diff --git a/FL/Fl.H b/FL/Fl.H
index 04dea16be..ba1af48ed 100644
--- a/FL/Fl.H
+++ b/FL/Fl.H
@@ -207,17 +207,8 @@ public: // should be private!
static Fl_Window* grab_;
static int compose_state; // used for dead keys (WIN32) or marked text (MacOS)
static void call_screen_init(); // recompute screen number and dimensions
-#ifdef __APPLE__ // PORTME: add for all platforms - additional functions
static void reset_marked_text(); // resets marked text
static void insertion_point_location(int x, int y, int height); // sets window coordinates & height of insertion point
-#elif defined(WIN32)
- // not needed in WIN32
-#elif defined(FL_PORTING)
-# pragma message "FL_PORTING: add these functions to all platforms?"
- // no default implementation
-#else
- // not needed in X11
-#endif
#endif // FL_DOXYGEN
diff --git a/FL/Fl_System_Driver.H b/FL/Fl_System_Driver.H
index 5599b2a83..902e8bc70 100644
--- a/FL/Fl_System_Driver.H
+++ b/FL/Fl_System_Driver.H
@@ -120,6 +120,13 @@ public:
virtual unsigned utf8from_mb(char* dst, unsigned dstlen, const char* src, unsigned srclen);
// implement to shield fprintf() from locale changes in decimal point
virtual int clocale_printf(FILE *output, const char *format, va_list args);
+ /* Implement to indicate whether complex text input may involve marked text.
+ When it does, has_marked_text returns non zero and reset_marked_text() and
+ insertion_point_location() must also be implemented.
+ */
+ virtual int has_marked_text() { return 0; }
+ virtual void reset_marked_text() {}
+ virtual void insertion_point_location(int x, int y, int height) {}
};
#endif // FL_SYSTEM_DRIVER_H
diff --git a/src/Fl.cxx b/src/Fl.cxx
index cb922858e..8c66965d8 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1882,6 +1882,14 @@ int Fl::dnd()
return Fl_System_Driver::driver()->dnd();
}
+void Fl::reset_marked_text() {
+ Fl_System_Driver::driver()->reset_marked_text();
+}
+
+void Fl::insertion_point_location(int x, int y, int height) { // sets window coordinates & height of insertion point
+ Fl_System_Driver::driver()->insertion_point_location(x, y, height);
+}
+
//
// End of "$Id$".
//
diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx
index f752b2b68..92daee5bd 100644
--- a/src/Fl_Input.cxx
+++ b/src/Fl_Input.cxx
@@ -599,14 +599,12 @@ int Fl_Input::handle(int event) {
static int dnd_save_position, dnd_save_mark, drag_start = -1, newpos;
static Fl_Widget *dnd_save_focus = NULL;
switch (event) {
-#ifdef __APPLE__ // PORTME: compose text
case FL_UNFOCUS:
- if (Fl::compose_state) {
+ if (Fl_System_Driver::driver()->has_marked_text() && Fl::compose_state) {
this->mark( this->position() );
Fl::reset_marked_text();
}
break;
-#endif
case FL_FOCUS:
switch (Fl::event_key()) {
case FL_Right:
diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx
index f80b59c8e..2230a0c7b 100644
--- a/src/Fl_Input_.cxx
+++ b/src/Fl_Input_.cxx
@@ -395,9 +395,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
} else {
fl_rectf((int)(xpos+curx+0.5), Y+ypos, 2, height);
}
-#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - compose
Fl::insertion_point_location(xpos+curx, Y+ypos+height, height);
-#endif
}
CONTINUE:
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx
index cf9e0c9e5..4d516c261 100644
--- a/src/Fl_Text_Display.cxx
+++ b/src/Fl_Text_Display.cxx
@@ -2303,9 +2303,7 @@ void Fl_Text_Display::draw_cursor( int X, int Y ) {
if ( X < text_area.x - 1 || X > text_area.x + text_area.w )
return;
-#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform compose
Fl::insertion_point_location(X, bot, fontHeight);
-#endif
/* For cursors other than the block, make them around 2/3 of a character
width, rounded to an even number of pixels so that X will draw an
odd number centered on the stem at x. */
diff --git a/src/Fl_Text_Editor.cxx b/src/Fl_Text_Editor.cxx
index 8ca2fd4b7..c43fb518c 100644
--- a/src/Fl_Text_Editor.cxx
+++ b/src/Fl_Text_Editor.cxx
@@ -586,13 +586,11 @@ int Fl_Text_Editor::handle(int event) {
case FL_UNFOCUS:
show_cursor(mCursorOn); // redraws the cursor
-#ifdef __APPLE__ // PORTME: Fl_Screen_Driver - platform compose
- if (buffer()->selected() && Fl::compose_state) {
+ if (Fl_System_Driver::driver()->has_marked_text() && buffer()->selected() && Fl::compose_state) {
int pos = insert_position();
buffer()->select(pos, pos);
Fl::reset_marked_text();
}
-#endif
if (buffer()->selected()) redraw(); // Redraw selections...
case FL_HIDE:
if (when() & FL_WHEN_RELEASE) maybe_do_callback();
diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H
index 12148fb55..29a658d5f 100644
--- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H
+++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H
@@ -64,6 +64,9 @@ public:
virtual int rmdir(const char* f) {return ::rmdir(f);}
virtual int rename(const char* f, const char *n) {return ::rename(f, n);}
virtual int clocale_printf(FILE *output, const char *format, va_list args);
+ virtual int has_marked_text();
+ virtual void reset_marked_text();
+ virtual void insertion_point_location(int x, int y, int height);
};
#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 ee8a0eb31..f112b3c9f 100644
--- a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx
+++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx
@@ -64,7 +64,11 @@ 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() {
+int Fl_Darwin_System_Driver::has_marked_text() {
+ return true;
+}
+
+void Fl_Darwin_System_Driver::reset_marked_text() {
Fl::compose_state = 0;
Fl_X::next_marked_length = 0;
insertion_point_location_is_valid = false;
@@ -80,7 +84,7 @@ int Fl_X::insertion_point_location(int *px, int *py, int *pheight)
return true;
}
-void Fl::insertion_point_location(int x, int y, int height) {
+void Fl_Darwin_System_Driver::insertion_point_location(int x, int y, int height) {
insertion_point_location_is_valid = true;
insertion_point_x = x;
insertion_point_y = y;