Merge remote-tracking branch 'upstream/master'

This commit is contained in:
dP
2023-06-10 18:12:04 +04:00
89 changed files with 2143 additions and 931 deletions

View File

@@ -23,7 +23,6 @@
#include "tilehighlight_func.h"
#include "network/network.h"
#include "querystring_gui.h"
#include "widgets/dropdown_func.h"
#include "strings_func.h"
#include "settings_type.h"
#include "settings_func.h"
@@ -463,6 +462,9 @@ void SetFocusedWindow(Window *w)
{
if (_focused_window == w) return;
/* Don't focus a tooltip */
if (w != nullptr && w->window_class == WC_TOOLTIPS) return;
/* Invalidate focused widget */
if (_focused_window != nullptr) {
if (_focused_window->nested_focus != nullptr) _focused_window->nested_focus->SetDirty(_focused_window);
@@ -682,6 +684,9 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, int click_count)
NWidgetCore *nw = w->nested_root->GetWidgetFromPos(x, y);
WidgetType widget_type = (nw != nullptr) ? nw->type : WWT_EMPTY;
/* Allow dropdown close flag detection to work. */
if (nw != nullptr) ClrBit(nw->disp_flags, NDB_DROPDOWN_CLOSED);
bool focused_widget_changed = false;
/* If clicked on a window that previously did not have focus */
if (_focused_window != w && // We already have focus, right?
@@ -714,9 +719,8 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, int click_count)
focused_widget_changed |= w->SetFocusedWidget(widget_index);
}
/* 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_index && widget_index >= 0) return;
/* Dropdown window of this widget was closed so don't process click this time. */
if (HasBit(nw->disp_flags, NDB_DROPDOWN_CLOSED)) return;
if ((widget_type & ~WWB_PUSHBUTTON) < WWT_LAST && (widget_type & WWB_PUSHBUTTON)) w->HandleButtonClick(widget_index);
@@ -2343,7 +2347,6 @@ static void StartWindowDrag(Window *w)
_drag_delta.y = w->top - _cursor.pos.y;
BringWindowToFront(w);
CloseWindowById(WC_DROPDOWN_MENU, 0);
}
/**
@@ -2361,7 +2364,6 @@ static void StartWindowSizing(Window *w, bool to_left)
_drag_delta.y = _cursor.pos.y;
BringWindowToFront(w);
CloseWindowById(WC_DROPDOWN_MENU, 0);
}
/**
@@ -3515,7 +3517,7 @@ void ChangeVehicleViewports(VehicleID from_index, VehicleID to_index)
*/
void RelocateAllWindows(int neww, int newh)
{
CloseWindowById(WC_DROPDOWN_MENU, 0);
CloseWindowByClass(WC_DROPDOWN_MENU);
for (Window *w : Window::Iterate()) {
int left, top;