garrynewman / GWEN

Abandoned: GWEN - GUI Without Extravagant Nonsense.
MIT License
429 stars 102 forks source link

Fix keyboard focus not being reset when no control with keyboard input is selected #31

Closed jamiehales closed 11 years ago

jamiehales commented 11 years ago

When a text control is selected, and then you click on an empty canvas (or any item that doesn't take keyboard input), the KeyboardFocus isn't reset. So when you then type, that control still receives input.

This patch checks and resets the KeyboardFocus to null if there is no valid focus.

DeeKayHT commented 11 years ago

Instead of setting Gwen::KeyboardFocus = NULL in OnMouseClicked(), I think it's much better to call Gwen::KeyboardFocus->Blur(). That way KeyboardFocus still gets set to NULL, but also sets elements to their "non-focus" color.

jamiehales commented 11 years ago

Noted. I've added a commit to do just that.