mirror of https://github.com/OpenTTD/OpenTTD
(svn r4304) The chat box' parent window (the main toolbar, wtf?) doesn't care for the WE_ON_EDIT_TEXT_CANCEL event, so don't send one. This code looks like it was mindlessly copy&pasted from the query box
parent
3a1cef5af8
commit
04d6788bfd
|
@ -1469,13 +1469,10 @@ void ShowJoinStatusWindowAfterJoin(void)
|
||||||
/* uses querystr_d WP macro */
|
/* uses querystr_d WP macro */
|
||||||
static void ChatWindowWndProc(Window *w, WindowEvent *e)
|
static void ChatWindowWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
static bool closed = false;
|
|
||||||
|
|
||||||
switch (e->event) {
|
switch (e->event) {
|
||||||
case WE_CREATE:
|
case WE_CREATE:
|
||||||
SendWindowMessage(WC_NEWS_WINDOW, 0, WE_CREATE, w->height, 0);
|
SendWindowMessage(WC_NEWS_WINDOW, 0, WE_CREATE, w->height, 0);
|
||||||
SETBIT(_no_scroll, SCROLL_CHAT); // do not scroll the game with the arrow-keys
|
SETBIT(_no_scroll, SCROLL_CHAT); // do not scroll the game with the arrow-keys
|
||||||
closed = false;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
|
@ -1496,9 +1493,6 @@ press_ok:;
|
||||||
WindowNumber wnd_num = WP(w, querystr_d).wnd_num;
|
WindowNumber wnd_num = WP(w, querystr_d).wnd_num;
|
||||||
Window *parent;
|
Window *parent;
|
||||||
|
|
||||||
// Mask the edit-box as closed, so we don't send out a CANCEL
|
|
||||||
closed = true;
|
|
||||||
|
|
||||||
DeleteWindow(w);
|
DeleteWindow(w);
|
||||||
|
|
||||||
parent = FindWindowById(wnd_class, wnd_num);
|
parent = FindWindowById(wnd_class, wnd_num);
|
||||||
|
@ -1534,15 +1528,6 @@ press_ok:;
|
||||||
case WE_DESTROY:
|
case WE_DESTROY:
|
||||||
SendWindowMessage(WC_NEWS_WINDOW, 0, WE_DESTROY, 0, 0);
|
SendWindowMessage(WC_NEWS_WINDOW, 0, WE_DESTROY, 0, 0);
|
||||||
CLRBIT(_no_scroll, SCROLL_CHAT);
|
CLRBIT(_no_scroll, SCROLL_CHAT);
|
||||||
// If the window is not closed yet, it means it still needs to send a CANCEL
|
|
||||||
if (!closed) {
|
|
||||||
Window *parent = FindWindowById(WP(w,querystr_d).wnd_class, WP(w,querystr_d).wnd_num);
|
|
||||||
if (parent != NULL) {
|
|
||||||
WindowEvent e;
|
|
||||||
e.event = WE_ON_EDIT_TEXT_CANCEL;
|
|
||||||
parent->wndproc(parent, &e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue