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

Comparing rxvt-unicode/src/misc.C (file contents):
Revision 1.27 by root, Wed Feb 16 21:37:10 2005 UTC vs.
Revision 1.35 by root, Mon Jan 16 17:11:12 2006 UTC

36 36
37 char *dst = r; 37 char *dst = r;
38 while (len--) 38 while (len--)
39 { 39 {
40 ssize_t l = wcrtomb (dst, *str++, mbs); 40 ssize_t l = wcrtomb (dst, *str++, mbs);
41
41 if (l < 0) 42 if (l < 0)
42 *dst++ = '?'; 43 *dst++ = '?';
43 else 44 else
44 dst += l; 45 dst += l;
45 } 46 }
437 * file searching 438 * file searching
438 */ 439 */
439 440
440/* #define DEBUG_SEARCH_PATH */ 441/* #define DEBUG_SEARCH_PATH */
441 442
442#if defined (XPM_BACKGROUND) || (MENUBAR_MAX) 443#ifdef XPM_BACKGROUND
443/* 444/*
444 * search for FILE in the current working directory, and within the 445 * search for FILE in the current working directory, and within the
445 * colon-delimited PATHLIST, adding the file extension EXT if required. 446 * colon-delimited PATHLIST, adding the file extension EXT if required.
446 * 447 *
447 * FILE is either semi-colon or zero terminated 448 * FILE is either semi-colon or zero terminated
524 char *f; 525 char *f;
525 526
526 if (file == NULL || *file == '\0') 527 if (file == NULL || *file == '\0')
527 return NULL; 528 return NULL;
528 529
529 /* search environment variables here too */
530 if ((f = rxvt_File_search_path (path, file, ext)) == NULL) 530 f = rxvt_File_search_path (path, file, ext);
531#ifdef PATH_ENV
532 if ((f = rxvt_File_search_path (getenv (PATH_ENV), file, ext)) == NULL)
533#endif
534 f = rxvt_File_search_path (getenv ("PATH"), file, ext);
535 531
536#ifdef DEBUG_SEARCH_PATH 532#ifdef DEBUG_SEARCH_PATH
537 if (f) 533 if (f)
538 fprintf (stderr, "found: \"%s\"\n", f); 534 fprintf (stderr, "found: \"%s\"\n", f);
539#endif 535#endif
540 536
541 return f; 537 return f;
542} 538}
543#endif /* defined (XPM_BACKGROUND) || (MENUBAR_MAX) */
544
545/*----------------------------------------------------------------------*
546 * miscellaneous drawing routines
547 */
548
549/*
550 * Draw top/left and bottom/right border shadows around windows
551 */
552#if defined(RXVT_SCROLLBAR) || defined(MENUBAR)
553void
554rxvt_Draw_Shadow (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int h)
555{
556 int shadow;
557
558 shadow = (w == 0 || h == 0) ? 1 : SHADOW;
559 w += x - 1;
560 h += y - 1;
561 for (; shadow-- > 0; x++, y++, w--, h--)
562 {
563 XDrawLine (display, win, topShadow, x, y, w, y);
564 XDrawLine (display, win, topShadow, x, y, x, h);
565 XDrawLine (display, win, botShadow, w, h, w, y + 1);
566 XDrawLine (display, win, botShadow, w, h, x + 1, h);
567 }
568}
569#endif 539#endif
570 540
571/* button shapes */ 541// should not be used in interactive programs, for obvious reasons
572#ifdef MENUBAR 542void rxvt_usleep (int usecs)
573void
574rxvt_Draw_Triangle (Display *display, Window win, GC topShadow, GC botShadow, int x, int y, int w, int type)
575{ 543{
576 switch (type) 544#if HAVE_NANOSLEEP
577 { 545 struct timespec ts;
578 case 'r': /* right triangle */
579 XDrawLine (display, win, topShadow, x, y, x, y + w);
580 XDrawLine (display, win, topShadow, x, y, x + w, y + w / 2);
581 XDrawLine (display, win, botShadow, x, y + w, x + w, y + w / 2);
582 break;
583 546
584 case 'l': /* left triangle */ 547 ts.tv_sec = 0;
585 XDrawLine (display, win, botShadow, x + w, y + w, x + w, y); 548 ts.tv_nsec = usecs * 1000;
586 XDrawLine (display, win, botShadow, x + w, y + w, x, y + w / 2); 549 nanosleep (&ts, NULL);
587 XDrawLine (display, win, topShadow, x, y + w / 2, x + w, y); 550#else
588 break; 551 /* use select for timing */
552 struct timeval tv;
589 553
590 case 'd': /* down triangle */ 554 tv.tv_sec = 0;
591 XDrawLine (display, win, topShadow, x, y, x + w / 2, y + w); 555 tv.tv_usec = usecs;
592 XDrawLine (display, win, topShadow, x, y, x + w, y); 556 select (0, NULL, NULL, NULL, &tv);
593 XDrawLine (display, win, botShadow, x + w, y, x + w / 2, y + w); 557#endif
594 break;
595
596 case 'u': /* up triangle */
597 XDrawLine (display, win, botShadow, x + w, y + w, x + w / 2, y);
598 XDrawLine (display, win, botShadow, x + w, y + w, x, y + w);
599 XDrawLine (display, win, topShadow, x, y + w, x + w / 2, y);
600 break;
601#if 0
602 case 's': /* square */
603 XDrawLine (display, win, topShadow, x + w, y, x, y);
604 XDrawLine (display, win, topShadow, x, y, x, y + w);
605 XDrawLine (display, win, botShadow, x, y + w, x + w, y + w);
606 XDrawLine (display, win, botShadow, x + w, y + w, x + w, y);
607 break;
608#endif
609
610 }
611} 558}
612#endif 559
613/*----------------------- end-of-file (C source) -----------------------*/ 560/*----------------------- end-of-file (C source) -----------------------*/
561

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines