Index: src/window.cpp =================================================================== --- src/window.cpp (revision 17741) +++ src/window.cpp (working copy) @@ -360,7 +360,18 @@ DeleteWindowById(WC_OSK, 0); } - focused_widget_changed = w->SetFocusedWidget(widget_index); + /* focused_widget_changed is false since before if the clicked window + * had global focus since before. However, if the window gained focus by this + * left click then focused_widget_changed has already been set to true above. + * Therefore, we should only change the variable to true if local widget focus changed, + * but not set to false if the same widget already had local focus was clicked. + * + * If this is not preserved, then the OSK window for example would be opened when + * a user has the edit box focused and then click on another window and then back + * again on the edit box (to type some text). + */ + if (w->SetFocusedWidget(widget_index)) + focused_widget_changed = true; } if (widget_type & WWB_PUSHBUTTON) {