diff options
author | peter1138 <peter1138@openttd.org> | 2009-02-01 22:32:07 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2009-02-01 22:32:07 +0000 |
commit | aad67b5736ce1f265eaf8aa0596c80c089f659ec (patch) | |
tree | 11498b2611a021129b26fdd96527d3ab137b426e /src/window.cpp | |
parent | 7cd579e7efa1052ba2a1d47e9f635861191f1043 (diff) | |
download | openttd-aad67b5736ce1f265eaf8aa0596c80c089f659ec.tar.xz |
(svn r15312) -Codechange: Handle closing of drop down menus when clicking in a window in a single place, instead of in the OnClick event for some windows. This standardises behaviour so that clicking anywhere in a window will close its drop down menu, which happened before for some windows but not all. In addition the dubious feature of hiding a drop down menu by opening the same menu has been removed. This only caused wasted CPU cycles as a whole new list was generated and then destroyed. Breathe.
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp index 50d93117a..f5fed776d 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -22,6 +22,7 @@ #include "tilehighlight_func.h" #include "network/network.h" #include "querystring_gui.h" +#include "widgets/dropdown_func.h" #include "table/sprites.h" @@ -188,6 +189,10 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, bool double_click) } } + /* Close any child drop down menus. If the button pressed was the drop down + * list's own button, then we should not process the click any further. */ + if (HideDropDownMenu(w) == widget) return; + if (w->desc_flags & WDF_STD_BTN) { if (widget == 0) { /* 'X' */ delete w; |