The chat window should receive focus automatically
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
Low
|
Hans Joachim Desserud |
Bug Description
A while back I noticed the chat/debug window had different behaviour depending on how it was opened. Currently this happens:
Click chat button: need to click in the textfield for it to receive focus, remains open after sending a message.
Press enter: textfield focused automatically, closes after sending a message.
Press f6 (debug): textfield focused automatically, remains open after sending a message.
I found it confusing that these similar actions had different results, so I looked into how to change it. I have attached a branch where I have moved the code for focus into the constructor so that it is always called. With automatic focus, it was possible to remove some lines in other places which would tell the chat window to do this. This was my main goal, so that the window will always be focused when it is opened so that people can start typing right away.
However, during this I discovered that enter was handled in different ways as well when a message had been typed. At the same time I decided to give the textfield focus by default, I also settled on keeping the window open after sending a message. However, I do wonder if it was intentional to have different behaviour for the chat button and enter key, or if I'm overthinking things. When clicking the chat button the player would be able to type several messages and the window is left open for chatting with other players, but the enter key could be useful for quick messages. For instance <enter>Help. Under attack<enter> which would quickly open the chat window, the player writes the message, sends it and the window closes, leaving the player to continue doing other things in the game. If this behaviour is intentional, the last commit could be left out, so that chat windows opened by enter would close after sending a message.
Related branches
- SirVer: Approve
-
Diff: 45 lines (+3/-5)3 files modifiedsrc/wui/game_chat_menu.cc (+3/-1)
src/wui/interactive_base.cc (+0/-2)
src/wui/interactive_player.cc (+0/-2)
Oh, I forgot to mention, but I discovered this issue when I was looking at bug 565406 to figure out how focus was given to the textfields.