- Timestamp:
- Nov 28, 2009, 12:29:23 PM (10 years ago)
- Location:
- neercs/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
neercs/trunk/src/client.c
r4056 r4057 89 89 caca_get_event_resize_width(&ev), 90 90 caca_get_event_resize_height(&ev)); 91 buf[bytes] = '\0'; 92 debug("Sending '%s', %d bytes\n", buf, strlen(buf)); 93 return write(screen_list->socket[SOCK_SERVER], buf, strlen(buf)+1) <= 0; 94 } 95 else if (t & CACA_EVENT_MOUSE_PRESS) 96 { 97 char buf[52]; 98 int bytes; 99 bytes = snprintf(buf, sizeof(buf) - 1, "MOUSEP %10d %10d %10d", 100 caca_get_mouse_x (screen_list->dp), 101 caca_get_mouse_y (screen_list->dp), 102 caca_get_event_mouse_button(&ev)); 91 103 buf[bytes] = '\0'; 92 104 debug("Sending '%s', %d bytes\n", buf, strlen(buf)); … … 234 246 ret = caca_get_event(screen_list->dp, 235 247 CACA_EVENT_KEY_PRESS 248 | CACA_EVENT_MOUSE_PRESS 249 | CACA_EVENT_MOUSE_RELEASE 250 | CACA_EVENT_MOUSE_MOTION 236 251 | CACA_EVENT_RESIZE 237 252 | CACA_EVENT_QUIT, &ev, 10000); -
neercs/trunk/src/neercs.h
r4055 r4057 133 133 int orig_x, orig_y; /* Used by recurrents */ 134 134 int orig_w, orig_h; /* Used by recurrents */ 135 136 int report_mouse; /* ANSI */ 137 135 138 }; 136 139 -
neercs/trunk/src/screens.c
r4026 r4057 45 45 s->h = h; 46 46 s->bell = 0; 47 s->report_mouse = 0; 47 48 48 49 s->fd = create_pty_grab(pid, w, h, &s->pid); -
neercs/trunk/src/server.c
r4056 r4057 48 48 if (!screen_list->socket[SOCK_CLIENT]) 49 49 connect_socket(screen_list, SOCK_CLIENT); 50 debug("Sending message (%s,%d) to client on socket %d", msg, size,51 screen_list->socket[SOCK_CLIENT]);52 50 if (!screen_list->socket[SOCK_CLIENT]) 53 51 ret = -1; … … 212 210 ssize_t n; 213 211 char buf[128]; 214 212 215 213 /* Read program output */ 216 214 refresh = update_screens_contents(screen_list); 217 215 218 216 /* Check if we got something from the client */ 219 217 while (screen_list->socket[SOCK_SERVER] … … 242 240 /* FIXME check the length before calling atoi */ 243 241 screen_list->cv = 244 caca_create_canvas(atoi(buf + 7), atoi(buf + 18));242 caca_create_canvas(atoi(buf + 7), atoi(buf + 18)); 245 243 screen_list->changed = 1; 246 244 refresh = 1; … … 251 249 refresh |= handle_key(screen_list, c, refresh); 252 250 } 251 else if (!strncmp("MOUSEP ", buf, 6)) 252 { 253 if (screen_list->screen[screen_list->pty]->report_mouse) 254 { 255 int x = atoi(buf + 7); 256 int y = atoi(buf + 18); 257 int b = atoi(buf + 28); 258 debug("mouse %d %d button %d\n", x, y, b); 259 sprintf(buf, "\x1b[M%c%c%c", '@'+(b-1), x+32, y+32); 260 debug("mouse sending CSI '%s' to term.\n", &buf[1]); 261 send_ansi_sequence(screen_list, buf); 262 } 263 } 253 264 else 254 265 { … … 256 267 } 257 268 } 258 269 259 270 /* No more screens, exit */ 260 271 if (!screen_list->count) 261 272 return -1; 262 273 263 274 /* User requested to exit */ 264 275 if (quit) 265 276 return -2; 266 277 267 278 /* Update each screen canvas */ 268 279 refresh |= update_terms(screen_list); 269 280 270 281 /* Launch recurrents if any */ 271 282 refresh |= handle_recurrents(screen_list); 272 283 273 284 /* Refresh screen */ 274 285 refresh_screen(screen_list, refresh); 275 286 276 287 eof = 1; 277 288 for (i = 0; i < screen_list->count; i++) … … 299 310 for (;;) 300 311 { 301 if(server_iteration(screen_list)) break; 312 if (server_iteration(screen_list)) 313 break; 302 314 } 303 315 -
neercs/trunk/src/term.c
r4056 r4057 459 459 unsigned int param, inter, junk, final; 460 460 461 if (buffer[i + 2] == '?') 462 { 463 debug("CSI? %c%c%c%c%c\n", 464 buffer[i + 3], buffer[i + 4], buffer[i + 5], 465 buffer[i + 6], buffer[i + 7]); 466 } 461 467 462 468 /* Compute offsets to parameter bytes, intermediate bytes and to … … 526 532 debug("ansi import: private sequence \"^[[%.*s\"", 527 533 final - param + 1, buffer + i + param); 534 /* FIXME better parsing */ 535 if (buffer[i + 2] == '?') 536 { 537 char arg[5]; 538 int a = 0; 539 int c, p; 540 for (p = 0; p < 4; p++) 541 { 542 if (buffer[i + 3 + p] >= '0' 543 && buffer[i + 3 + p] <= '9') 544 { 545 arg[a] = buffer[i + 3 + p]; 546 arg[a + 1] = 0; 547 a++; 548 debug("private a now '%s'\n", arg); 549 } 550 else 551 { 552 break; 553 } 554 } 555 c = buffer[i + 3 + 4]; 556 int Pm = atoi(arg); 557 debug("private mouse : command %c, arg %d", c, Pm); 558 if (c == 'h') /* DECSET DEC Private Mode Set */ 559 { 560 561 switch (Pm) 562 { 563 /* FIXME Handle different modes */ 564 case 1000: /* Send Mouse X & Y on button press 565 and release. */ 566 case 1001: /* Use Hilite Mouse Tracking. */ 567 case 1002: /* Use Cell Motion Mouse Tracking. */ 568 case 1003: /* Use All Motion Mouse Tracking. */ 569 sc->report_mouse = 1; 570 break; 571 default: 572 break; 573 } 574 } 575 else if (c == 'l') /* DECRST DEC Private Mode Reset */ 576 { 577 Pm = atoi(arg); 578 switch (Pm) 579 { 580 /* FIXME Handle different modes */ 581 case 1000: /* Send Mouse X & Y on button press 582 and release. */ 583 case 1001: /* Use Hilite Mouse Tracking. */ 584 case 1002: /* Use Cell Motion Mouse Tracking. */ 585 case 1003: /* Use All Motion Mouse Tracking. */ 586 sc->report_mouse = 0; 587 break; 588 default: 589 break; 590 } 591 } 592 } 528 593 continue; /* Private sequence, skip it entirely */ 529 594 } … … 634 699 if (!argc || argv[0] == 0) 635 700 argv[0] = 1; /* echo -ne 'foobar\r\e[0P\n' */ 636 /* Jylam : Start from x, not 0 */ 701 637 702 for (j = x; (unsigned int)(j + argv[0]) < width; j++) 638 703 { … … 642 707 caca_get_attr(sc->cv, j + argv[0], y)); 643 708 } 644 break; /* Jylam: this one was missing I guess */709 break; 645 710 #if 0 646 711 savedattr = caca_get_attr(sc->cv, -1, -1); … … 662 727 0 Base VT100, no options 1 Processor options (STP) 2 663 728 Advanced video option (AVO) 3 AVO and STP 4 Graphics 664 processor option (GPO) 5 GPO and STP 6 GPO and AVO 7 665 GPO,STP, and AVO */729 processor option (GPO) 5 GPO and STP 6 GPO and AVO 7 GPO, 730 STP, and AVO */ 666 731 /* Warning, argument is Pn */ 667 732 debug("ansi Got command c, argc %d, argv[0] (%d)\n", argc,
Note: See TracChangeset
for help on using the changeset viewer.