MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / keyUp

Function keyUp

src/OpenLoco/src/Ui/Windows/TextInputWindow.cpp:288–315  ·  view source on GitHub ↗

0x004CE910

Source from the content-addressed store, hash-verified

286
287 // 0x004CE910
288 static bool keyUp(Window& w, uint32_t charCode, uint32_t keyCode)
289 {
290 if (charCode == SDLK_RETURN)
291 {
292 w.callOnMouseUp(Widx::ok, w.widgets[Widx::ok].id);
293 return true;
294 }
295 else if (charCode == SDLK_ESCAPE)
296 {
297 w.callOnMouseUp(Widx::close, w.widgets[Widx::close].id);
298 return true;
299 }
300 else if (!Input::isFocused(w.type, w.number, Widx::input) || !inputSession.handleInput(charCode, keyCode))
301 {
302 return false;
303 }
304
305 WindowManager::invalidate(WindowType::textInput, 0);
306 inputSession.cursorFrame = 0;
307
308 int containerWidth = w.widgets[Widx::input].width() - 2;
309 if (inputSession.needsReoffsetting(containerWidth))
310 {
311 inputSession.calculateTextOffset(containerWidth);
312 }
313
314 return true;
315 }
316
317 static constexpr WindowEventList kEvents = {
318 .onMouseUp = onMouseUp,

Callers

nothing calls this directly

Calls 7

isFocusedFunction · 0.85
callOnMouseUpMethod · 0.80
handleInputMethod · 0.80
needsReoffsettingMethod · 0.80
calculateTextOffsetMethod · 0.80
invalidateFunction · 0.50
widthMethod · 0.45

Tested by

no test coverage detected