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

Function ProcessMouse

src/Window_Terminal.c:320–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318}
319
320static void ProcessMouse(char* buf, int n) {
321 char cpy[256 + 2];
322 strncpy(cpy, buf, n);
323 char* tok = strtok(cpy + 3, ";");
324 int mouse;
325 if (!tok) return;
326
327 switch (tok[0]) {
328 case '0':
329 mouse = strchr(buf, 'm') == NULL;
330 UpdatePointerPosition(tok);
331 Input_SetNonRepeatable(CCMOUSE_L, mouse);
332 break;
333 case '1':
334 mouse = strchr(buf, 'm') == NULL;
335 UpdatePointerPosition(tok);
336 Input_SetNonRepeatable(CCMOUSE_M, mouse);
337 break;
338 case '2':
339 mouse = strchr(buf, 'm') == NULL;
340 UpdatePointerPosition(tok);
341 Input_SetNonRepeatable(CCMOUSE_R, mouse);
342 break;
343 case '3':
344 mouse = (strcmp(tok, "32") == 0);
345 UpdatePointerPosition(tok);
346 break;
347 }
348}
349
350static int MapKey(int key) {
351 if (key == ' ') return CCKEY_SPACE;

Callers 1

ProcessConsoleInputFunction · 0.70

Calls 2

UpdatePointerPositionFunction · 0.85
Input_SetNonRepeatableFunction · 0.85

Tested by

no test coverage detected