Codechange: Add constant for INVALID_WIDGET. (#14649)
Replaces direct use of -1, making it easier to find.
This commit is contained in:
@@ -1824,7 +1824,7 @@ void Window::InitNested(WindowNumber window_number)
|
||||
* Empty constructor, initialization has been moved to #InitNested() called from the constructor of the derived class.
|
||||
* @param desc The description of the window.
|
||||
*/
|
||||
Window::Window(WindowDesc &desc) : window_desc(desc), scale(_gui_scale), mouse_capture_widget(-1)
|
||||
Window::Window(WindowDesc &desc) : window_desc(desc), scale(_gui_scale), mouse_capture_widget(INVALID_WIDGET)
|
||||
{
|
||||
this->z_position = _z_windows.insert(_z_windows.end(), this);
|
||||
}
|
||||
@@ -1906,7 +1906,7 @@ static void DecreaseWindowCounters()
|
||||
NWidgetScrollbar *sb = static_cast<NWidgetScrollbar*>(nwid);
|
||||
if (sb->disp_flags.Any({NWidgetDisplayFlag::ScrollbarUp, NWidgetDisplayFlag::ScrollbarDown})) {
|
||||
sb->disp_flags.Reset({NWidgetDisplayFlag::ScrollbarUp, NWidgetDisplayFlag::ScrollbarDown});
|
||||
w->mouse_capture_widget = -1;
|
||||
w->mouse_capture_widget = INVALID_WIDGET;
|
||||
sb->SetDirty(w);
|
||||
}
|
||||
}
|
||||
@@ -2416,7 +2416,7 @@ static EventState HandleActiveWidget()
|
||||
/* Abort if no button is clicked any more. */
|
||||
if (!_left_button_down) {
|
||||
w->SetWidgetDirty(w->mouse_capture_widget);
|
||||
w->mouse_capture_widget = -1;
|
||||
w->mouse_capture_widget = INVALID_WIDGET;
|
||||
return ES_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user