Changeset 4098
- Timestamp:
- Dec 7, 2009, 1:18:51 PM (11 years ago)
- Location:
- neercs/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
neercs/trunk/src/ansi.c
r4078 r4098 315 315 316 316 317 else if (!handle_duplet (&buffer[i], sc, &skip,318 317 else if (!handle_duplet(&buffer[i], sc, &skip, 318 top, bottom, width, height)) 319 319 { 320 320 … … 472 472 +-----+------------------+---------------------+-----------------+ 473 473 | CSI | parameter bytes | intermediate bytes | final byte | | | 474 474 0x30 - 0x3f | 0x20 - 0x2f | 0x40 - 0x7e | | ^[[ | 0123456789:;<=>? 475 475 | SPC !"#$%&'()*+,-./ | azAZ@[\]^_`{|}~ | 476 476 +-----+------------------+---------------------+-----------------+ */ … … 554 554 } 555 555 } 556 c = buffer[i + 3 + 4]; 557 int Pm = atoi(arg); 558 debug("private mouse : command %c, arg %d", c, Pm); 556 char *end; 557 int Pm = strtol(arg, &end, 10); 558 559 c = buffer[i + 3 + (end-arg)]; 560 561 debug("ansi private mouse : command %c, arg %d", c, Pm); 559 562 if (c == 'h') /* DECSET DEC Private Mode Set */ 560 563 { … … 563 566 { 564 567 /* FIXME Handle different modes */ 568 case 9: 565 569 case 1000: /* Send Mouse X & Y on button press 566 570 and release. */ … … 580 584 { 581 585 /* FIXME Handle different modes */ 586 case 9: 582 587 case 1000: /* Send Mouse X & Y on button press 583 588 and release. */ … … 586 591 case 1003: /* Use All Motion Mouse Tracking. */ 587 592 sc->report_mouse = 0; 593 debug("ansi private mouse : NOT reporting mouse"); 588 594 break; 589 595 default: … … 908 914 if (((ch > ' ') && (ch <= '~')) 909 915 && 910 (sc->conv_state. 911 gn[sc->conv_state.ss ? sc->conv_state. 912 gn[sc->conv_state.ss] : sc->conv_state.glr[0]] == '0')) 916 (sc-> 917 conv_state.gn[sc->conv_state.ss ? sc-> 918 conv_state.gn[sc->conv_state.ss] : sc-> 919 conv_state.glr[0]] == '0')) 913 920 { 914 921 ch = dec_acs(ch); -
neercs/trunk/src/client.c
r4075 r4098 38 38 39 39 40 int start_client(struct screen_list * 40 int start_client(struct screen_list *screen_list) 41 41 { 42 42 char *sess = NULL; … … 57 57 58 58 request_attach(screen_list); 59 59 60 60 return 0; 61 61 } … … 63 63 int send_event(caca_event_t ev, struct screen_list *screen_list) 64 64 { 65 65 66 66 enum caca_event_type t; 67 67 68 68 t = caca_get_event_type(&ev); 69 69 70 70 if (t & CACA_EVENT_KEY_PRESS) 71 71 { … … 73 73 int bytes; 74 74 bytes = 75 snprintf(buf, sizeof(buf) - 1, "KEY %d",76 caca_get_event_key_ch(&ev));75 snprintf(buf, sizeof(buf) - 1, "KEY %d", 76 caca_get_event_key_ch(&ev)); 77 77 buf[bytes] = '\0'; 78 78 debug("Sending key press to server: %s", buf); 79 79 debug("Sending '%s', %d bytes\n", buf, strlen(buf)); 80 return write(screen_list->comm.socket[SOCK_SERVER], buf, strlen(buf)+1) <= 0; 80 return write(screen_list->comm.socket[SOCK_SERVER], buf, 81 strlen(buf) + 1) <= 0; 81 82 } 82 83 else if (t & CACA_EVENT_RESIZE) 83 84 { 84 85 85 86 char buf[32]; 86 87 int bytes; … … 90 91 buf[bytes] = '\0'; 91 92 debug("Sending '%s', %d bytes\n", buf, strlen(buf)); 92 return write(screen_list->comm.socket[SOCK_SERVER], buf, strlen(buf)+1) <= 0; 93 return write(screen_list->comm.socket[SOCK_SERVER], buf, 94 strlen(buf) + 1) <= 0; 93 95 } 94 96 else if (t & CACA_EVENT_MOUSE_PRESS) … … 97 99 int bytes; 98 100 bytes = snprintf(buf, sizeof(buf) - 1, "MOUSEP %10d %10d %10d", 99 caca_get_mouse_x(screen_list->dp),100 caca_get_mouse_y(screen_list->dp),101 101 caca_get_mouse_x(screen_list->dp), 102 caca_get_mouse_y(screen_list->dp), 103 caca_get_event_mouse_button(&ev)); 102 104 buf[bytes] = '\0'; 103 105 debug("Sending '%s', %d bytes\n", buf, strlen(buf)); 104 return write(screen_list->comm.socket[SOCK_SERVER], buf, strlen(buf)+1) <= 0; 106 return write(screen_list->comm.socket[SOCK_SERVER], buf, 107 strlen(buf) + 1) <= 0; 108 } 109 else if (t & CACA_EVENT_MOUSE_MOTION) 110 { 111 int x = caca_get_mouse_x(screen_list->dp); 112 int y = caca_get_mouse_y(screen_list->dp); 113 if (x != screen_list->old_x || y != screen_list->old_y) 114 { 115 screen_list->old_x = caca_get_mouse_x(screen_list->dp); 116 screen_list->old_y = caca_get_mouse_y(screen_list->dp); 117 118 char buf[52]; 119 int bytes; 120 bytes = snprintf(buf, sizeof(buf) - 1, "MOUSEM %10d %10d", 121 caca_get_mouse_x(screen_list->dp), 122 caca_get_mouse_y(screen_list->dp)); 123 buf[bytes] = '\0'; 124 debug("Sending '%s', %d bytes\n", buf, strlen(buf)); 125 return write(screen_list->comm.socket[SOCK_SERVER], buf, 126 strlen(buf) + 1) <= 0; 127 } 128 return 0; 105 129 } 106 130 else if (t & CACA_EVENT_QUIT) 107 131 return write(screen_list->comm.socket[SOCK_SERVER], "QUIT", 108 132 strlen("QUIT")) <= 0; 109 133 110 134 return 0; 111 135 } … … 193 217 #else 194 218 l = caca_import_from_memory(screen_list->cv, buf, l2, 195 "caca");219 "caca"); 196 220 #endif 197 221 } 198 222 } 199 fcntl(screen_list->comm.socket[SOCK_CLIENT], F_SETFL, O_NONBLOCK); 223 fcntl(screen_list->comm.socket[SOCK_CLIENT], F_SETFL, 224 O_NONBLOCK); 200 225 } 201 226 else if (!strncmp("REFRESH ", buf, 8)) -
neercs/trunk/src/neercs.h
r4073 r4098 135 135 136 136 int report_mouse; /* ANSI */ 137 138 137 }; 139 138 … … 244 243 char *title; /* Window title */ 245 244 int width, height; /* caca window size */ 245 int old_x, old_y; /* Mouse */ 246 246 caca_canvas_t *cv; 247 247 caca_display_t *dp; -
neercs/trunk/src/server.c
r4071 r4098 260 260 } 261 261 } 262 else if (!strncmp("MOUSEM ", buf, 6)) 263 { 264 if (screen_list->screen[screen_list->pty]->report_mouse) 265 { 266 int x = atoi(buf + 7); 267 int y = atoi(buf + 18); 268 sprintf(buf, "\x1b[M%c%c%c", '@', x+32, y+32); 269 send_ansi_sequence(screen_list, buf); 270 } 271 } 262 272 else 263 273 {
Note: See TracChangeset
for help on using the changeset viewer.