MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / LInput_KeyDown

Function LInput_KeyDown

src/LWidgets.c:282–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280}
281
282static cc_bool LInput_KeyDown(void* widget, int key, cc_bool was, struct InputDevice* device) {
283 struct LInput* w = (struct LInput*)widget;
284 if (key == CCKEY_BACKSPACE) {
285 LInput_Backspace(w);
286 } else if (key == CCKEY_DELETE) {
287 LInput_Delete(w);
288 } else if (key == INPUT_CLIPBOARD_COPY) {
289 if (w->text.length) Clipboard_SetText(&w->text);
290 } else if (key == INPUT_CLIPBOARD_PASTE) {
291 LInput_CopyFromClipboard(w);
292 } else if (key == device->escapeButton) {
293 if (w->text.length) LInput_SetString(w, &String_Empty);
294 } else if (key == device->leftButton) {
295 LInput_AdvanceCaretPos(w, false);
296 } else if (key == device->rightButton) {
297 LInput_AdvanceCaretPos(w, true);
298 } else { return false; }
299
300 return true;
301}
302
303static cc_bool LInput_CanAppend(struct LInput* w, char c) {
304 switch (w->inputType) {

Callers

nothing calls this directly

Calls 6

LInput_BackspaceFunction · 0.85
LInput_DeleteFunction · 0.85
LInput_CopyFromClipboardFunction · 0.85
LInput_SetStringFunction · 0.85
LInput_AdvanceCaretPosFunction · 0.85
Clipboard_SetTextFunction · 0.70

Tested by

no test coverage detected