* * rct2: 0x006E8DA7 */
| 1235 | * rct2: 0x006E8DA7 |
| 1236 | */ |
| 1237 | void InputStateWidgetPressed( |
| 1238 | const ScreenCoordsXY& screenCoords, MouseState state, WidgetIndex widgetIndex, WindowBase* w, Widget* widget) |
| 1239 | { |
| 1240 | WindowClass cursor_w_class; |
| 1241 | WindowNumber cursor_w_number; |
| 1242 | cursor_w_class = gPressedWidget.windowClassification; |
| 1243 | cursor_w_number = gPressedWidget.windowNumber; |
| 1244 | WidgetIndex cursor_widgetIndex = gPressedWidget.widgetIndex; |
| 1245 | |
| 1246 | auto* windowMgr = GetWindowManager(); |
| 1247 | WindowBase* cursor_w = windowMgr->FindByNumber(cursor_w_class, cursor_w_number); |
| 1248 | if (cursor_w == nullptr) |
| 1249 | { |
| 1250 | _inputState = InputState::reset; |
| 1251 | return; |
| 1252 | } |
| 1253 | |
| 1254 | if (w != nullptr && state == MouseState::leftRelease) |
| 1255 | { |
| 1256 | if (w->widgets[widgetIndex].type == WidgetType::closeBox && cursor_w_class == w->classification |
| 1257 | && cursor_w_number == w->number && widgetIndex == cursor_widgetIndex) |
| 1258 | { |
| 1259 | auto& im = GetInputManager(); |
| 1260 | if (im.isModifierKeyPressed(ModifierKey::shift)) |
| 1261 | { |
| 1262 | gLastCloseModifier.window.number = w->number; |
| 1263 | gLastCloseModifier.window.classification = w->classification; |
| 1264 | gLastCloseModifier.modifier = CloseWindowModifier::shift; |
| 1265 | } |
| 1266 | else if (im.isModifierKeyPressed(ModifierKey::ctrl)) |
| 1267 | { |
| 1268 | gLastCloseModifier.window.number = w->number; |
| 1269 | gLastCloseModifier.window.classification = w->classification; |
| 1270 | gLastCloseModifier.modifier = CloseWindowModifier::control; |
| 1271 | } |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | switch (state) |
| 1276 | { |
| 1277 | case MouseState::released: |
| 1278 | if (w == nullptr || cursor_w_class != w->classification || cursor_w_number != w->number |
| 1279 | || widgetIndex != cursor_widgetIndex) |
| 1280 | break; |
| 1281 | |
| 1282 | if (widgetIsDisabled(*w, widgetIndex)) |
| 1283 | break; |
| 1284 | |
| 1285 | // If this variable is non-zero then its the last tick the mouse down event was fired. |
| 1286 | if (_clickRepeatTicks.has_value()) |
| 1287 | { |
| 1288 | // The initial amount of time in ticks to wait until the first click repeat. |
| 1289 | constexpr auto kTicksUntilRepeats = 16u; |
| 1290 | |
| 1291 | // The amount of ticks between each click repeat. |
| 1292 | constexpr auto kEventDelayInTicks = 3u; |
| 1293 | |
| 1294 | // The amount of ticks since the last click repeat. |
no test coverage detected