|
|
Now I use FLTK 1.3.7. I test the version 1.3.7 and 1.40 (latest commit), all have the same problem.
The key function fl_set_spot are called twice in Fl_Input_ class (Fl_Input_.cxx), one is in FL_FOCUS handler(1.3.7: line 1011; 1.4.0: line 1021), the other is in Fl_Input_::drawtext (1.3.7: line 414; 1.4.0: line 400). The call in drawtext causes a bug in Fl_Multiline_Input: when inputting multi-line text, move the caret (cursor) to the middle line, the hint bar of IME will appear at the last line. See line 415(1.3.7) or line 401(1.4.0):
if (Fl::focus() == this) {
fl_set_spot(textfont(), textsize(),
(int)xpos+curx, Y+ypos-fl_descent(), W, H, window());
}
The calculation of x coordination (int)xpos+curx is correct. But the calculation of y coordination Y+ypos-fl_descent() is not correct because ypos is changed after drawing the cursor (1.3.7 : line 374-397; 1.4.0 : line 364-383) in a loop (1.3.7 : line 294-401; 1.4.0 : line 288-387).
A solution is listed as follows:
- Add a local variable in line 294 (1.3.7) and line 288 (1.4.0):
int ypos_cur = ypos;
- Add
ypos_cur = ypos+height; in line 394 (1,3.7) and line 380 (1.4.0).
- Modify line 416 (1.3.7) and line 402 (1.4.0) :
(int)xpos+curx, Y+ypos_cur-fl_descent(), W, H, window());
fl_set_spot is not called in Fl_Text_Display and Fl_Text_Editor, so it raises this bug. A solution is listed as follows:
- Add
fl_set_spot(textfont(), textsize(), x(), y(), w(), h(), window()); to case FL_FOCUS in Fl_Text_Editor::handle(...) .
- Add
if (Fl::focus() == this) { fl_set_spot(textfont(), textsize(), X, bot, ,... to the end of Fl_Text_Display::draw_cursor() .
I find Fl::insertion_point_location is called in Fl_Input_::drawtext and Fl_Text_Display::draw_cursor , but only Fl_Cocoa_Screen_Driver::insertion_point_location is implemented.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
[ Direct Link to Message ] | |
|
| |