* Hide the window and all its child windows, and mark them for a later deletion. */
| 1102 | * Hide the window and all its child windows, and mark them for a later deletion. |
| 1103 | */ |
| 1104 | void Window::Close([[maybe_unused]] int data) |
| 1105 | { |
| 1106 | /* Don't close twice. */ |
| 1107 | if (*this->z_position == nullptr) return; |
| 1108 | |
| 1109 | *this->z_position = nullptr; |
| 1110 | |
| 1111 | if (_thd.window_class == this->window_class && |
| 1112 | _thd.window_number == this->window_number) { |
| 1113 | ResetObjectToPlace(); |
| 1114 | } |
| 1115 | |
| 1116 | /* Prevent Mouseover() from resetting mouse-over coordinates on a non-existing window */ |
| 1117 | if (_mouseover_last_w == this) _mouseover_last_w = nullptr; |
| 1118 | |
| 1119 | /* We can't scroll the window when it's closed. */ |
| 1120 | if (_last_scroll_window == this) _last_scroll_window = nullptr; |
| 1121 | |
| 1122 | /* Make sure we don't try to access non-existing query strings. */ |
| 1123 | this->querystrings.clear(); |
| 1124 | |
| 1125 | /* Make sure we don't try to access this window as the focused window when it doesn't exist anymore. */ |
| 1126 | if (_focused_window == this) { |
| 1127 | this->OnFocusLost(true); |
| 1128 | _focused_window = nullptr; |
| 1129 | } |
| 1130 | |
| 1131 | this->CloseChildWindows(); |
| 1132 | |
| 1133 | this->SetDirty(); |
| 1134 | |
| 1135 | Window::closed_windows.push_back(this); |
| 1136 | } |
| 1137 | |
| 1138 | /** |
| 1139 | * Remove window and all its child windows from the window stack. |
no test coverage detected