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

Comparing rxvt-unicode/src/main.C (file contents):
Revision 1.134 by root, Fri Feb 4 11:41:23 2005 UTC vs.
Revision 1.143 by root, Sun Feb 20 00:09:25 2005 UTC

30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 *---------------------------------------------------------------------*/ 31 *---------------------------------------------------------------------*/
32 32
33#include "../config.h" /* NECESSARY */ 33#include "../config.h" /* NECESSARY */
34#include "rxvt.h" /* NECESSARY */ 34#include "rxvt.h" /* NECESSARY */
35#include "main.intpro" /* PROTOS for internal routines */
36 35
37#include <csignal> 36#include <csignal>
38#include <cstring> 37#include <cstring>
39 38
40#ifdef TTY_GID_SUPPORT 39#ifdef TTY_GID_SUPPORT
362{ 361{
363 for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) 362 for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++)
364 (*t)->emergency_cleanup (); 363 (*t)->emergency_cleanup ();
365} 364}
366 365
366#if ENABLE_FRILLS
367static void
368print_x_error (Display *dpy, XErrorEvent *event)
369{
370 char buffer[BUFSIZ];
371 char mesg[BUFSIZ];
372 char number[32];
373 char *mtype = "XlibMessage";
374 XGetErrorText(dpy, event->error_code, buffer, BUFSIZ);
375 XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ);
376 rxvt_warn ("An X Error occured, trying to continue after report.\n");
377 rxvt_warn ("%s: %s\n", mesg, buffer);
378 XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d", mesg, BUFSIZ);
379 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->request_code);
380 sprintf(number, "%d", event->request_code);
381 XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
382 rxvt_warn ("(which is %s)\n", buffer);
383 if (event->request_code >= 128) {
384 XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d",
385 mesg, BUFSIZ);
386 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->minor_code);
387 }
388 if ((event->error_code == BadWindow) ||
389 (event->error_code == BadPixmap) ||
390 (event->error_code == BadCursor) ||
391 (event->error_code == BadFont) ||
392 (event->error_code == BadDrawable) ||
393 (event->error_code == BadColor) ||
394 (event->error_code == BadGC) ||
395 (event->error_code == BadIDChoice) ||
396 (event->error_code == BadValue) ||
397 (event->error_code == BadAtom)) {
398 if (event->error_code == BadValue)
399 XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x",
400 mesg, BUFSIZ);
401 else if (event->error_code == BadAtom)
402 XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x",
403 mesg, BUFSIZ);
404 else
405 XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x",
406 mesg, BUFSIZ);
407 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->resourceid);
408 }
409 XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d",
410 mesg, BUFSIZ);
411 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->serial);
412}
413#endif
414
367int 415int
368rxvt_xerror_handler (Display *display, XErrorEvent *event) 416rxvt_xerror_handler (Display *display, XErrorEvent *event)
369{ 417{
370 if (GET_R->allowedxerror == -1) 418 if (GET_R->allowedxerror == -1)
371 GET_R->allowedxerror = event->error_code; 419 GET_R->allowedxerror = event->error_code;
372 else 420 else
373 { 421 {
374 //TODO: GET_R is most likely not the terminal which caused the error 422 //TODO: GET_R is most likely not the terminal which caused the error
375 //TODO: maybe just output the error and continue? 423 //TODO: maybe just output the error and continue?
424#if ENABLE_FRILLS
425 print_x_error (display, event);
426#else
376 old_xerror_handler (display, event); 427 old_xerror_handler (display, event);
377 GET_R->destroy (); 428#endif
378 } 429 }
379 430
380 return 0; 431 return 0;
381} 432}
382 433
534 rxvt_fatal ("memory allocation failure. aborting.\n"); 585 rxvt_fatal ("memory allocation failure. aborting.\n");
535 586
536 return p; 587 return p;
537} 588}
538 589
539/* INTPROTO */
540void * 590void *
541rxvt_calloc (size_t number, size_t size) 591rxvt_calloc (size_t number, size_t size)
542{ 592{
543 void *p = calloc (number, size); 593 void *p = calloc (number, size);
544 594
546 rxvt_fatal ("memory allocation failure. aborting.\n"); 596 rxvt_fatal ("memory allocation failure. aborting.\n");
547 597
548 return p; 598 return p;
549} 599}
550 600
551/* INTPROTO */
552void * 601void *
553rxvt_realloc (void *ptr, size_t size) 602rxvt_realloc (void *ptr, size_t size)
554{ 603{
555 void *p = realloc (ptr, size); 604 void *p = realloc (ptr, size);
556 605
660 if (!parsed_geometry) 709 if (!parsed_geometry)
661 { 710 {
662 parsed_geometry = 1; 711 parsed_geometry = 1;
663 if (rs[Rs_geometry]) 712 if (rs[Rs_geometry])
664 flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); 713 flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h);
714
665 if (flags & WidthValue) 715 if (flags & WidthValue)
666 { 716 {
667 TermWin.ncol = BOUND_POSITIVE_INT16 (w); 717 TermWin.ncol = BOUND_POSITIVE_INT16 (w);
668 szHint.flags |= USSize; 718 szHint.flags |= USSize;
669 } 719 }
720
670 if (flags & HeightValue) 721 if (flags & HeightValue)
671 { 722 {
672 TermWin.nrow = BOUND_POSITIVE_INT16 (h); 723 TermWin.nrow = BOUND_POSITIVE_INT16 (h);
673 szHint.flags |= USSize; 724 szHint.flags |= USSize;
674 } 725 }
726
675 if (flags & XValue) 727 if (flags & XValue)
676 { 728 {
677 szHint.x = x; 729 szHint.x = x;
678 szHint.flags |= USPosition; 730 szHint.flags |= USPosition;
679 if (flags & XNegative) 731 if (flags & XNegative)
680 { 732 {
681 recalc_x = 1; 733 recalc_x = 1;
682 szHint.win_gravity = NorthEastGravity; 734 szHint.win_gravity = NorthEastGravity;
683 } 735 }
684 } 736 }
737
685 if (flags & YValue) 738 if (flags & YValue)
686 { 739 {
687 szHint.y = y; 740 szHint.y = y;
688 szHint.flags |= USPosition; 741 szHint.flags |= USPosition;
689 if (flags & YNegative) 742 if (flags & YNegative)
788 (void)ioctl (pty.pty, TIOCSWINSZ, &ws); 841 (void)ioctl (pty.pty, TIOCSWINSZ, &ws);
789 842
790#if 0 843#if 0
791 // TIOCSWINSZ⎈ is supposed to do this automatically and correctly 844 // TIOCSWINSZ⎈ is supposed to do this automatically and correctly
792 if (cmd_pid) /* force through to the command */ 845 if (cmd_pid) /* force through to the command */
793 kill (cmd_pid, SIGWINCH); 846 kill (-cmd_pid, SIGWINCH);
794#endif 847#endif
795} 848}
796 849
797/*----------------------------------------------------------------------*/ 850/*----------------------------------------------------------------------*/
798/* set_fonts () - load and set the various fonts 851/* set_fonts () - load and set the various fonts
1193 XWindowAttributes wattr; 1246 XWindowAttributes wattr;
1194 1247
1195 if (width == 0 || height == 0) 1248 if (width == 0 || height == 0)
1196 { 1249 {
1197 XGetWindowAttributes (display->display, display->root, &wattr); 1250 XGetWindowAttributes (display->display, display->root, &wattr);
1251
1198 if (width == 0) 1252 if (width == 0)
1199 width = wattr.width - szHint.base_width; 1253 width = wattr.width - szHint.base_width;
1200 if (height == 0) 1254 if (height == 0)
1201 height = wattr.height - szHint.base_height; 1255 height = wattr.height - szHint.base_height;
1202 } 1256 }
1500{ 1554{
1501 int i, found, had_im; 1555 int i, found, had_im;
1502 const char *p; 1556 const char *p;
1503 char **s; 1557 char **s;
1504 char buf[IMBUFSIZ]; 1558 char buf[IMBUFSIZ];
1559
1560 SET_R (this);
1505 1561
1506 im_destroy (); 1562 im_destroy ();
1507 1563
1508 D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()")); 1564 D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()"));
1509 if (Input_Context) 1565 if (Input_Context)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines