Jump to content

unigine should disable ime when there is no input widget in focus


photo

Recommended Posts

almost all game engine in our country support this, when a user need to input some text strings, he open a ime and input some text into the text widget, if text widget is not active, and when he press some key like 'w', the ime window will not receive this key, instead, the engine received the w key then character walks.

 

but in unigine, things are different, when I input some text into WidgetEditLine, then I close the window there will be no widget can receive text input, but when I press w/a/s/d, the active ime received the key, unigine doesn't respond to the movement keys.

 

I hope I've made my suggestions clear enough: when there is no gui widget in focus, unigine should receive the keys and don't let ime receive these keys.

Link to comment

For the editor this can be a bit tricky...

for my own stuff I used the following code when I need to make sure that nothing in the UI is focused.

 

Widget w = engine.app.getFocus();

if(w != 0) w.removeFocus();

 

input that uses the input system should work the way you have requested (I think).

Link to comment

well, actually, it's not a bug nor problem, any normal program will behave like this, look the attachement

post-49-0-17523300-1319201776_thumb.jpg

 

in this picture, I've activated ime to input some Chinese text

 

 

post-49-0-22459200-1319201783_thumb.jpg

 

in this picture, no widget is in focus, and I didn't close ime, then try to input some control keys to unigine, but all my input are captured by ime, I mean this can be improved, when there is no widget in focus, the ime should be temporary disable(not close). when there is a widget in focus again, the ime should be enable again.

Link to comment

solved, easy hack:

// get imm input handle
   HIMC context = ImmGetContext(app->window);
   if(context)
   {
  	 Widget *widget = engine.gui->getFocus();
  	 BOOL open = FALSE;
  	 if(widget)
  		 open = (widget->getType() == Widget::WIDGET_EDITLINE || widget->getType() == Widget::WIDGET_EDITTEXT);

  	 ImmSetOpenStatus(context, open);
  	 ImmReleaseContext(app->window, context);
   }

 

add these code to beginning of AppWindow::doUpdate(), this will test if current focused widget is a WidgetEditLine or WidgetEditText, if it is, it will enable ime input, if not it will disable ime input, so that unigine can capture all input by user.

Link to comment
  • 1 year later...
×
×
  • Create New...