ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.175 by root, Sat Dec 11 17:18:29 2004 UTC vs.
Revision 1.178 by root, Wed Dec 15 00:53:23 2004 UTC

1058rxvt_term::pty_cb (io_watcher &w, short revents) 1058rxvt_term::pty_cb (io_watcher &w, short revents)
1059{ 1059{
1060 SET_R (this); 1060 SET_R (this);
1061 SET_LOCALE (locale); 1061 SET_LOCALE (locale);
1062 1062
1063 if (revents & EVENT_WRITE)
1064 tt_write (0, 0);
1065 else if (revents & EVENT_READ) 1063 if (revents & EVENT_READ)
1066 // loop, but don't allow a single term to monopolize us 1064 // loop, but don't allow a single term to monopolize us
1067 while (pty_fill ()) 1065 while (pty_fill ())
1068 if (cmd_parse ()) 1066 if (cmd_parse ())
1069 break; 1067 break;
1068
1069 if (revents & EVENT_WRITE)
1070 pty_write ();
1070} 1071}
1071 1072
1072void 1073void
1073rxvt_term::pointer_unblank () 1074rxvt_term::pointer_unblank ()
1074{ 1075{
1336 &ActualType, &ActualFormat, 1337 &ActualType, &ActualFormat,
1337 &Size, &RemainingBytes, 1338 &Size, &RemainingBytes,
1338 &data); 1339 &data);
1339 set_string_property (XA_CUT_BUFFER0, data); 1340 set_string_property (XA_CUT_BUFFER0, data);
1340 XFree (data); 1341 XFree (data);
1341 selection_paste (display->root, XA_CUT_BUFFER0, True); 1342 selection_paste (display->root, XA_CUT_BUFFER0, true);
1342 XSetInputFocus (display->display, display->root, RevertToNone, CurrentTime); 1343 XSetInputFocus (display->display, display->root, RevertToNone, CurrentTime);
1343 } 1344 }
1344#endif /* OFFIX_DND */ 1345#endif /* OFFIX_DND */
1345 break; 1346 break;
1346 1347
1468 selection_clear (); 1469 selection_clear ();
1469 break; 1470 break;
1470 1471
1471 case SelectionNotify: 1472 case SelectionNotify:
1472 if (selection_wait == Sel_normal) 1473 if (selection_wait == Sel_normal)
1473 selection_paste (ev.xselection.requestor, 1474 selection_paste (ev.xselection.requestor, ev.xselection.property, true);
1474 ev.xselection.property, True);
1475 break; 1475 break;
1476 1476
1477 case SelectionRequest: 1477 case SelectionRequest:
1478 selection_send (ev.xselectionrequest); 1478 selection_send (ev.xselectionrequest);
1479 break; 1479 break;
1668 case PropertyNotify: 1668 case PropertyNotify:
1669 /* 1669 /*
1670 * if user used some Esetroot compatible prog to set the root bg, 1670 * if user used some Esetroot compatible prog to set the root bg,
1671 * use the property to determine the pixmap. We use it later on. 1671 * use the property to determine the pixmap. We use it later on.
1672 */ 1672 */
1673 if (xa[XA_XROOTPMAPID] == 0)
1674 xa[XA_XROOTPMAPID] = XInternAtom (display->display, "_XROOTPMAP_ID", False);
1675
1676 if (ev.xproperty.atom != xa[XA_XROOTPMAPID]) 1673 if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID]
1674 || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
1677 return; 1675 return;
1678 1676
1679 /* FALLTHROUGH */ 1677 /* FALLTHROUGH */
1680 case ReparentNotify: 1678 case ReparentNotify:
1681 if ((options & Opt_transparent) && check_our_parents () && am_transparent) 1679 if ((options & Opt_transparent) && check_our_parents () && am_transparent)
2351 /* 2349 /*
2352 * Make the frame window set by the window manager have 2350 * Make the frame window set by the window manager have
2353 * the root background. Some window managers put multiple nested frame 2351 * the root background. Some window managers put multiple nested frame
2354 * windows for each client, so we have to take care about that. 2352 * windows for each client, so we have to take care about that.
2355 */ 2353 */
2356 i = (xa[XA_XROOTPMAPID] 2354 i = (xa[XA_XROOTPMAP_ID]
2357 && XGetWindowProperty (display->display, display->root, xa[XA_XROOTPMAPID], 2355 && XGetWindowProperty (display->display, display->root, xa[XA_XROOTPMAP_ID],
2358 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2356 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2359 &nitems, &bytes_after, &prop) == Success); 2357 &nitems, &bytes_after, &prop) == Success);
2360 2358
2361 if (!i || prop == NULL) 2359 if (!i || prop == NULL)
2362 i = (xa[XA_XSETROOTID] 2360 i = (xa[XA_ESETROOT_PMAP_ID]
2363 && XGetWindowProperty (display->display, display->root, xa[XA_XSETROOTID], 2361 && XGetWindowProperty (display->display, display->root, xa[XA_ESETROOT_PMAP_ID],
2364 0L, 1L, False, XA_PIXMAP, &atype, &aformat, 2362 0L, 1L, False, XA_PIXMAP, &atype, &aformat,
2365 &nitems, &bytes_after, &prop) == Success); 2363 &nitems, &bytes_after, &prop) == Success);
2366 2364
2367 if (!i || prop == NULL 2365 if (!i || prop == NULL
2368#if TINTING 2366#if TINTING
4283 4281
4284/* ---------------------------------------------------------------------- */ 4282/* ---------------------------------------------------------------------- */
4285/* Write data to the pty as typed by the user, pasted with the mouse, 4283/* Write data to the pty as typed by the user, pasted with the mouse,
4286 * or generated by us in response to a query ESC sequence. 4284 * or generated by us in response to a query ESC sequence.
4287 */ 4285 */
4286const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT
4287
4288void 4288void
4289rxvt_term::tt_write (const unsigned char *data, unsigned int len) 4289rxvt_term::tt_write (const unsigned char *data, unsigned int len)
4290{ 4290{
4291 const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT 4291 if (v_buflen == 0)
4292 {
4293 ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE));
4292 4294
4293 if (len) 4295 if ((unsigned int)written == len)
4296 return;
4297
4298 data += written;
4299 len -= written;
4294 { 4300 }
4301
4302 v_buffer = (unsigned char *)realloc (v_buffer, v_buflen + len);
4303
4304 memcpy (v_buffer + v_buflen, data, len);
4305 v_buflen += len;
4306
4307 pty_ev.set (EVENT_READ | EVENT_WRITE);
4308}
4309
4310void rxvt_term::pty_write ()
4311{
4312 int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE));
4313
4314 if (written > 0)
4315 {
4316 v_buflen -= written;
4317
4295 if (v_buflen == 0) 4318 if (v_buflen == 0)
4296 { 4319 {
4297 ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE));
4298
4299 if ((unsigned int)written == len)
4300 return;
4301
4302 data += written;
4303 len -= written;
4304 }
4305
4306
4307 v_buffer = (unsigned char *)realloc (v_buffer, v_buflen + len);
4308
4309 memcpy (v_buffer + v_buflen, data, len);
4310 v_buflen += len;
4311 }
4312
4313 for (;;)
4314 {
4315 int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE));
4316
4317 if (written > 0)
4318 {
4319 v_buflen -= written;
4320
4321 if (v_buflen == 0)
4322 {
4323 free (v_buffer); 4320 free (v_buffer);
4324 v_buffer = 0; 4321 v_buffer = 0;
4325 v_buflen = 0; 4322 v_buflen = 0;
4326 4323
4327 pty_ev.set (EVENT_READ); 4324 pty_ev.set (EVENT_READ);
4328 return;
4329 }
4330
4331 memmove (v_buffer, v_buffer + written, v_buflen);
4332 }
4333 else if (written != -1 || (errno != EAGAIN && errno != EINTR))
4334 // original code just ignores this...
4335 destroy ();
4336 else
4337 {
4338 pty_ev.set (EVENT_READ | EVENT_WRITE);
4339 return; 4325 return;
4340 } 4326 }
4327
4328 memmove (v_buffer, v_buffer + written, v_buflen);
4341 } 4329 }
4330 else if (written != -1 || (errno != EAGAIN && errno != EINTR))
4331 // original code just ignores this...
4332 destroy ();
4342} 4333}
4343 4334
4344/*----------------------- end-of-file (C source) -----------------------*/ 4335/*----------------------- end-of-file (C source) -----------------------*/
4345 4336

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines