… | |
… | |
253 | //if (menuBar.win) |
253 | //if (menuBar.win) |
254 | // XDestroyWindow (disp, menuBar.win); |
254 | // XDestroyWindow (disp, menuBar.win); |
255 | #endif |
255 | #endif |
256 | delete TermWin.drawable; |
256 | delete TermWin.drawable; |
257 | // destroy all windows |
257 | // destroy all windows |
258 | if (TermWin.parent[0]) |
258 | if (TermWin.parent[0] |
|
|
259 | #if ENABLE_FRILLS |
|
|
260 | && !rs[Rs_embed] |
|
|
261 | #endif |
|
|
262 | ) |
259 | XDestroyWindow (disp, TermWin.parent[0]); |
263 | XDestroyWindow (disp, TermWin.parent[0]); |
260 | } |
264 | } |
261 | |
265 | |
262 | // TODO: free pixcolours, colours should become part of rxvt_display |
266 | // TODO: free pixcolours, colours should become part of rxvt_display |
263 | |
267 | |
… | |
… | |
362 | { |
366 | { |
363 | for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) |
367 | for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) |
364 | (*t)->emergency_cleanup (); |
368 | (*t)->emergency_cleanup (); |
365 | } |
369 | } |
366 | |
370 | |
|
|
371 | #if ENABLE_FRILLS |
|
|
372 | static void |
|
|
373 | print_x_error (Display *dpy, XErrorEvent *event) |
|
|
374 | { |
|
|
375 | char buffer[BUFSIZ]; |
|
|
376 | char mesg[BUFSIZ]; |
|
|
377 | char number[32]; |
|
|
378 | char *mtype = "XlibMessage"; |
|
|
379 | XGetErrorText(dpy, event->error_code, buffer, BUFSIZ); |
|
|
380 | XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ); |
|
|
381 | rxvt_warn ("An X Error occured, trying to continue after report.\n"); |
|
|
382 | rxvt_warn ("%s: %s\n", mesg, buffer); |
|
|
383 | XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d", mesg, BUFSIZ); |
|
|
384 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->request_code); |
|
|
385 | sprintf(number, "%d", event->request_code); |
|
|
386 | XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); |
|
|
387 | rxvt_warn ("(which is %s)\n", buffer); |
|
|
388 | if (event->request_code >= 128) { |
|
|
389 | XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", |
|
|
390 | mesg, BUFSIZ); |
|
|
391 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->minor_code); |
|
|
392 | } |
|
|
393 | if ((event->error_code == BadWindow) || |
|
|
394 | (event->error_code == BadPixmap) || |
|
|
395 | (event->error_code == BadCursor) || |
|
|
396 | (event->error_code == BadFont) || |
|
|
397 | (event->error_code == BadDrawable) || |
|
|
398 | (event->error_code == BadColor) || |
|
|
399 | (event->error_code == BadGC) || |
|
|
400 | (event->error_code == BadIDChoice) || |
|
|
401 | (event->error_code == BadValue) || |
|
|
402 | (event->error_code == BadAtom)) { |
|
|
403 | if (event->error_code == BadValue) |
|
|
404 | XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", |
|
|
405 | mesg, BUFSIZ); |
|
|
406 | else if (event->error_code == BadAtom) |
|
|
407 | XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", |
|
|
408 | mesg, BUFSIZ); |
|
|
409 | else |
|
|
410 | XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", |
|
|
411 | mesg, BUFSIZ); |
|
|
412 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->resourceid); |
|
|
413 | } |
|
|
414 | XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", |
|
|
415 | mesg, BUFSIZ); |
|
|
416 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->serial); |
|
|
417 | } |
|
|
418 | #endif |
|
|
419 | |
367 | int |
420 | int |
368 | rxvt_xerror_handler (Display *display, XErrorEvent *event) |
421 | rxvt_xerror_handler (Display *display, XErrorEvent *event) |
369 | { |
422 | { |
370 | if (GET_R->allowedxerror == -1) |
423 | if (GET_R->allowedxerror == -1) |
371 | GET_R->allowedxerror = event->error_code; |
424 | GET_R->allowedxerror = event->error_code; |
372 | else |
425 | else |
373 | { |
426 | { |
374 | //TODO: GET_R is most likely not the terminal which caused the error |
427 | //TODO: GET_R is most likely not the terminal which caused the error |
375 | //TODO: maybe just output the error and continue? |
428 | //TODO: maybe just output the error and continue? |
|
|
429 | #if ENABLE_FRILLS |
|
|
430 | print_x_error (display, event); |
|
|
431 | #else |
376 | old_xerror_handler (display, event); |
432 | old_xerror_handler (display, event); |
377 | GET_R->destroy (); |
433 | #endif |
378 | } |
434 | } |
379 | |
435 | |
380 | return 0; |
436 | return 0; |
381 | } |
437 | } |
382 | |
438 | |
… | |
… | |
660 | if (!parsed_geometry) |
716 | if (!parsed_geometry) |
661 | { |
717 | { |
662 | parsed_geometry = 1; |
718 | parsed_geometry = 1; |
663 | if (rs[Rs_geometry]) |
719 | if (rs[Rs_geometry]) |
664 | flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); |
720 | flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); |
|
|
721 | |
665 | if (flags & WidthValue) |
722 | if (flags & WidthValue) |
666 | { |
723 | { |
667 | TermWin.ncol = BOUND_POSITIVE_INT16 (w); |
724 | TermWin.ncol = BOUND_POSITIVE_INT16 (w); |
668 | szHint.flags |= USSize; |
725 | szHint.flags |= USSize; |
669 | } |
726 | } |
|
|
727 | |
670 | if (flags & HeightValue) |
728 | if (flags & HeightValue) |
671 | { |
729 | { |
672 | TermWin.nrow = BOUND_POSITIVE_INT16 (h); |
730 | TermWin.nrow = BOUND_POSITIVE_INT16 (h); |
673 | szHint.flags |= USSize; |
731 | szHint.flags |= USSize; |
674 | } |
732 | } |
|
|
733 | |
675 | if (flags & XValue) |
734 | if (flags & XValue) |
676 | { |
735 | { |
677 | szHint.x = x; |
736 | szHint.x = x; |
678 | szHint.flags |= USPosition; |
737 | szHint.flags |= USPosition; |
679 | if (flags & XNegative) |
738 | if (flags & XNegative) |
680 | { |
739 | { |
681 | recalc_x = 1; |
740 | recalc_x = 1; |
682 | szHint.win_gravity = NorthEastGravity; |
741 | szHint.win_gravity = NorthEastGravity; |
683 | } |
742 | } |
684 | } |
743 | } |
|
|
744 | |
685 | if (flags & YValue) |
745 | if (flags & YValue) |
686 | { |
746 | { |
687 | szHint.y = y; |
747 | szHint.y = y; |
688 | szHint.flags |= USPosition; |
748 | szHint.flags |= USPosition; |
689 | if (flags & YNegative) |
749 | if (flags & YNegative) |
… | |
… | |
1501 | int i, found, had_im; |
1561 | int i, found, had_im; |
1502 | const char *p; |
1562 | const char *p; |
1503 | char **s; |
1563 | char **s; |
1504 | char buf[IMBUFSIZ]; |
1564 | char buf[IMBUFSIZ]; |
1505 | |
1565 | |
|
|
1566 | SET_R (this); |
|
|
1567 | |
1506 | im_destroy (); |
1568 | im_destroy (); |
1507 | |
1569 | |
1508 | D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()")); |
1570 | D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()")); |
1509 | if (Input_Context) |
1571 | if (Input_Context) |
1510 | return; |
1572 | return; |