I'm trying to input some Chinese characters in my fltk program running on linux but failed. I'm using fcitx, and specifically fcitx-googlepinyin
as the Chinese input method.
The following code will produce a single window containing a single input box.
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Input.H>
int main(int argc, char **argv) {
Fl::scheme("GTK+");
Fl::background(35, 35, 35);
Fl::background2(90, 90, 90);
Fl::foreground(240, 240, 240);
Fl_Window *window = new Fl_Window(640, 480);
Fl_Input *input = new Fl_Input(20, 20, 200, 20);
window->end();
window->show(argc, argv);
return Fl::run();
}
When I click on the input box, I can't switch to my Chinese input method by pressing ctrl + space
in the fltk program. But in other GUI programs like Firefox or Atom the Chinese input method works well.
I've set some variables as follows:
export XIM="fcitx"
export XIM_PROGRAM="fcitx"
export XMODIFIERS="@im=fcitx"
export GTK_IM_MODULE="fcitx"
export QT_IM_MODULE="fcitx"
How to enable fcitx input method in an fltk program?