summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Input_.cxx17
-rw-r--r--src/Fl_Text_Display.cxx16
2 files changed, 30 insertions, 3 deletions
diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx
index da3d8e3ba..bf96bd4c9 100644
--- a/src/Fl_Input_.cxx
+++ b/src/Fl_Input_.cxx
@@ -339,10 +339,25 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
int offset2;
if (pp <= e) x2 = xpos + (float)expandpos(p, pp, buf, &offset2);
else offset2 = (int) strlen(buf);
+#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state != 0) text
+ if (Fl::compose_state) {
+ fl_color(textcolor());
+ }
+ else
+#endif
+ {
fl_color(selection_color());
fl_rectf((int)(x1+0.5), Y+ypos, (int)(x2-x1+0.5), height);
fl_color(fl_contrast(textcolor(), selection_color()));
+ }
fl_draw(buf+offset1, offset2-offset1, x1, (float)(Y+ypos+desc));
+#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state != 0) text
+ if (Fl::compose_state) {
+ fl_color( fl_color_average(textcolor(), color(), 0.6) );
+ float width = fl_width(buf+offset1, offset2-offset1);
+ fl_line(x1, Y+ypos+height-1, x1+width, Y+ypos+height-1);
+ }
+#endif
if (pp < e) {
fl_color(tc);
fl_draw(buf+offset2, (int) strlen(buf+offset2), x2, (float)(Y+ypos+desc));
@@ -357,7 +372,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
CONTINUE2:
// draw the cursor:
- if (Fl::focus() == this && selstart == selend &&
+ if (Fl::focus() == this && (Fl::compose_state || selstart == selend) &&
position() >= p-value() && position() <= e-value()) {
fl_color(cursor_color());
// cursor position may need to be recomputed (see STR #2486)
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx
index 03be48e60..fb0eee61c 100644
--- a/src/Fl_Text_Display.cxx
+++ b/src/Fl_Text_Display.cxx
@@ -1940,7 +1940,13 @@ void Fl_Text_Display::draw_string(int style,
fsize = styleRec->size;
if (style & PRIMARY_MASK) {
- if (Fl::focus() == (Fl_Widget*)this) background = selection_color();
+ if (Fl::focus() == (Fl_Widget*)this) {
+#ifdef __APPLE__
+ if (Fl::compose_state) background = color();// Mac OS: underline marked text
+ else
+#endif
+ background = selection_color();
+ }
else background = fl_color_average(color(), selection_color(), 0.4f);
} else if (style & HIGHLIGHT_MASK) {
if (Fl::focus() == (Fl_Widget*)this) background = fl_color_average(color(), selection_color(), 0.5f);
@@ -1972,6 +1978,12 @@ void Fl_Text_Display::draw_string(int style,
fl_push_clip(X, Y, toX - X, mMaxsize);
#endif
fl_draw( string, nChars, X, Y + mMaxsize - fl_descent());
+#ifdef __APPLE__ // Mac OS: underline marked (= selected + Fl::compose_state != 0) text
+ if (Fl::compose_state && (style & PRIMARY_MASK)) {
+ fl_color( fl_color_average(foreground, background, 0.6) );
+ fl_line(X, Y + mMaxsize - 1, X + fl_width(string, nChars), Y + mMaxsize - 1);
+ }
+#endif
#if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT
fl_pop_clip();
#endif
@@ -3457,7 +3469,7 @@ void Fl_Text_Display::draw(void) {
// draw the text cursor
if (damage() & (FL_DAMAGE_ALL | FL_DAMAGE_SCROLL | FL_DAMAGE_EXPOSE)
- && !buffer()->primary_selection()->selected() &&
+ && (Fl::compose_state || !buffer()->primary_selection()->selected()) &&
mCursorOn && Fl::focus() == (Fl_Widget*)this ) {
fl_push_clip(text_area.x-LEFT_MARGIN,
text_area.y,