diff options
author | rubidium <rubidium@openttd.org> | 2009-06-18 17:16:29 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-06-18 17:16:29 +0000 |
commit | 904d2bc458e02a37752deec667ea7880a65726a2 (patch) | |
tree | e47b56dd04132ce9a8cad5e61e70f0e0212e6f1a | |
parent | 1359471d3fae941e928dc413474ddc9744e0863c (diff) | |
download | openttd-904d2bc458e02a37752deec667ea7880a65726a2.tar.xz |
(svn r16594) -Fix [FS#2969]: mouse would under some circumstances not be undrawn when drawing the first chat line causing two mouse pointers to be visible.
-rw-r--r-- | src/network/network_chat_gui.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index d3fa7245c..52138f2f6 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -124,28 +124,26 @@ void NetworkInitChatMessage() /** Hide the chatbox */ void NetworkUndrawChatMessage() { + /* Sometimes we also need to hide the cursor + * This is because both textmessage and the cursor take a shot of the + * screen before drawing. + * Now the textmessage takes his shot and paints his data before the cursor + * does, so in the shot of the cursor is the screen-data of the textmessage + * included when the cursor hangs somewhere over the textmessage. To + * avoid wrong repaints, we undraw the cursor in that case, and everything + * looks nicely ;) + * (and now hope this story above makes sense to you ;)) + */ + if (_cursor.visible && + _cursor.draw_pos.x + _cursor.draw_size.x >= _chatmsg_box.x && + _cursor.draw_pos.x <= _chatmsg_box.x + _chatmsg_box.width && + _cursor.draw_pos.y + _cursor.draw_size.y >= _screen.height - _chatmsg_box.y - _chatmsg_box.height && + _cursor.draw_pos.y <= _screen.height - _chatmsg_box.y) { + UndrawMouseCursor(); + } + if (_chatmessage_visible) { Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter(); - /* Sometimes we also need to hide the cursor - * This is because both textmessage and the cursor take a shot of the - * screen before drawing. - * Now the textmessage takes his shot and paints his data before the cursor - * does, so in the shot of the cursor is the screen-data of the textmessage - * included when the cursor hangs somewhere over the textmessage. To - * avoid wrong repaints, we undraw the cursor in that case, and everything - * looks nicely ;) - * (and now hope this story above makes sense to you ;)) - */ - - if (_cursor.visible) { - if (_cursor.draw_pos.x + _cursor.draw_size.x >= _chatmsg_box.x && - _cursor.draw_pos.x <= _chatmsg_box.x + _chatmsg_box.width && - _cursor.draw_pos.y + _cursor.draw_size.y >= _screen.height - _chatmsg_box.y - _chatmsg_box.height && - _cursor.draw_pos.y <= _screen.height - _chatmsg_box.y) { - UndrawMouseCursor(); - } - } - int x = _chatmsg_box.x; int y = _screen.height - _chatmsg_box.y - _chatmsg_box.height; int width = _chatmsg_box.width; |