(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.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user