… | |
… | |
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 "init.h" |
35 | #include "keyboard.h" |
36 | #include "keyboard.h" |
36 | #include "rxvtperl.h" |
37 | #include "rxvtperl.h" |
37 | |
38 | |
38 | #include <limits> |
39 | #include <limits> |
39 | |
40 | |
|
|
41 | #include <cassert> |
40 | #include <csignal> |
42 | #include <csignal> |
41 | #include <cstring> |
43 | #include <cstring> |
42 | |
44 | |
43 | #include <termios.h> |
45 | #include <termios.h> |
44 | |
46 | |
… | |
… | |
49 | # ifdef HAVE_SETLOCALE |
51 | # ifdef HAVE_SETLOCALE |
50 | # include <clocale> |
52 | # include <clocale> |
51 | # endif |
53 | # endif |
52 | #endif |
54 | #endif |
53 | |
55 | |
|
|
56 | struct termios rxvt_term::def_tio; |
54 | vector<rxvt_term *> rxvt_term::termlist; |
57 | vector<rxvt_term *> rxvt_term::termlist; |
55 | |
58 | |
56 | // used to tell global functions which terminal instance is "active" |
59 | // used to tell global functions which terminal instance is "active" |
57 | rxvt_t rxvt_current_term; |
60 | rxvt_t rxvt_current_term; |
58 | |
61 | |
… | |
… | |
101 | { |
104 | { |
102 | if (cc->c2 == c2) return c1; |
105 | if (cc->c2 == c2) return c1; |
103 | cc = (*this)[cc->c1]; |
106 | cc = (*this)[cc->c1]; |
104 | } |
107 | } |
105 | |
108 | |
106 | // check to see wether this combination already exists otherwise |
109 | // check to see whether this combination already exists otherwise |
107 | for (cc = v.end (); cc-- > v.begin (); ) |
110 | for (cc = v.end (); cc-- > v.begin (); ) |
108 | { |
111 | { |
109 | if (cc->c1 == c1 && cc->c2 == c2) |
112 | if (cc->c1 == c1 && cc->c2 == c2) |
110 | return COMPOSE_LO + (cc - v.begin ()); |
113 | return COMPOSE_LO + (cc - v.begin ()); |
111 | } |
114 | } |
… | |
… | |
237 | #endif |
240 | #endif |
238 | |
241 | |
239 | if (display) |
242 | if (display) |
240 | { |
243 | { |
241 | selection_clear (); |
244 | selection_clear (); |
|
|
245 | selection_clear (true); |
242 | |
246 | |
243 | #ifdef USE_XIM |
247 | #ifdef USE_XIM |
244 | im_destroy (); |
248 | im_destroy (); |
245 | #endif |
249 | #endif |
246 | scrollBar.destroy (); |
250 | scrollBar.destroy (); |
… | |
… | |
271 | /* clear all resources */ |
275 | /* clear all resources */ |
272 | for (int i = 0; i < allocated.size (); i++) |
276 | for (int i = 0; i < allocated.size (); i++) |
273 | free (allocated [i]); |
277 | free (allocated [i]); |
274 | |
278 | |
275 | free (selection.text); |
279 | free (selection.text); |
|
|
280 | free (selection.clip_text); |
276 | // TODO: manage env vars in child only(!) |
281 | // TODO: manage env vars in child only(!) |
277 | free (env_display); |
282 | free (env_display); |
278 | free (env_term); |
283 | free (env_term); |
279 | free (locale); |
284 | free (locale); |
280 | free (v_buffer); |
285 | free (v_buffer); |
… | |
… | |
380 | char mesg[BUFSIZ]; |
385 | char mesg[BUFSIZ]; |
381 | char number[32]; |
386 | char number[32]; |
382 | char *mtype = "XlibMessage"; |
387 | char *mtype = "XlibMessage"; |
383 | XGetErrorText(dpy, event->error_code, buffer, BUFSIZ); |
388 | XGetErrorText(dpy, event->error_code, buffer, BUFSIZ); |
384 | XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ); |
389 | XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ); |
385 | rxvt_warn ("An X Error occured, trying to continue after report.\n"); |
390 | rxvt_warn ("An X Error occurred, trying to continue after report.\n"); |
386 | rxvt_warn ("%s: %s\n", mesg, buffer); |
391 | rxvt_warn ("%s: %s\n", mesg, buffer); |
387 | XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d", mesg, BUFSIZ); |
392 | XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d", mesg, BUFSIZ); |
388 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->request_code); |
393 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->request_code); |
389 | sprintf(number, "%d", event->request_code); |
394 | sprintf(number, "%d", event->request_code); |
390 | XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); |
395 | XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); |
391 | rxvt_warn ("(which is %s)\n", buffer); |
396 | rxvt_warn ("(which is %s)\n", buffer); |
392 | if (event->request_code >= 128) { |
397 | if (event->request_code >= 128) { |
393 | XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", |
398 | XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", |
394 | mesg, BUFSIZ); |
399 | mesg, BUFSIZ); |
395 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->minor_code); |
400 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->minor_code); |
396 | } |
401 | } |
397 | if ((event->error_code == BadWindow) || |
402 | if ((event->error_code == BadWindow) || |
398 | (event->error_code == BadPixmap) || |
403 | (event->error_code == BadPixmap) || |
399 | (event->error_code == BadCursor) || |
404 | (event->error_code == BadCursor) || |
400 | (event->error_code == BadFont) || |
405 | (event->error_code == BadFont) || |
401 | (event->error_code == BadDrawable) || |
406 | (event->error_code == BadDrawable) || |
402 | (event->error_code == BadColor) || |
407 | (event->error_code == BadColor) || |
403 | (event->error_code == BadGC) || |
408 | (event->error_code == BadGC) || |
404 | (event->error_code == BadIDChoice) || |
409 | (event->error_code == BadIDChoice) || |
405 | (event->error_code == BadValue) || |
410 | (event->error_code == BadValue) || |
406 | (event->error_code == BadAtom)) { |
411 | (event->error_code == BadAtom)) { |
407 | if (event->error_code == BadValue) |
412 | if (event->error_code == BadValue) |
408 | XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", |
413 | XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", |
409 | mesg, BUFSIZ); |
414 | mesg, BUFSIZ); |
410 | else if (event->error_code == BadAtom) |
415 | else if (event->error_code == BadAtom) |
411 | XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", |
416 | XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", |
412 | mesg, BUFSIZ); |
417 | mesg, BUFSIZ); |
413 | else |
418 | else |
414 | XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", |
419 | XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", |
415 | mesg, BUFSIZ); |
420 | mesg, BUFSIZ); |
416 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->resourceid); |
421 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->resourceid); |
417 | } |
422 | } |
418 | XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", |
423 | XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", |
419 | mesg, BUFSIZ); |
424 | mesg, BUFSIZ); |
420 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->serial); |
425 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->serial); |
421 | } |
426 | } |
422 | #endif |
427 | #endif |
423 | |
428 | |
424 | int |
429 | int |
… | |
… | |
471 | rxvt_emergency_cleanup (); |
476 | rxvt_emergency_cleanup (); |
472 | w.stop (); |
477 | w.stop (); |
473 | kill (getpid (), w.signum); |
478 | kill (getpid (), w.signum); |
474 | } |
479 | } |
475 | |
480 | |
|
|
481 | static void |
|
|
482 | rxvt_get_ttymode (struct termios *tio) |
|
|
483 | { |
|
|
484 | if (tcgetattr (STDIN_FILENO, tio) < 0) |
|
|
485 | memset (tio, 0, sizeof (struct termios)); |
|
|
486 | |
|
|
487 | for (int i = 0; i < NCCS; i++) |
|
|
488 | tio->c_cc[i] = VDISABLE; |
|
|
489 | |
|
|
490 | tio->c_cc[VINTR] = CINTR; |
|
|
491 | tio->c_cc[VQUIT] = CQUIT; |
|
|
492 | tio->c_cc[VERASE] = CERASE; |
|
|
493 | #ifdef VERASE2 |
|
|
494 | tio->c_cc[VERASE2] = CERASE2; |
|
|
495 | #endif |
|
|
496 | tio->c_cc[VKILL] = CKILL; |
|
|
497 | tio->c_cc[VEOF] = CEOF; |
|
|
498 | tio->c_cc[VSTART] = CSTART; |
|
|
499 | tio->c_cc[VSTOP] = CSTOP; |
|
|
500 | tio->c_cc[VSUSP] = CSUSP; |
|
|
501 | # ifdef VDSUSP |
|
|
502 | tio->c_cc[VDSUSP] = CDSUSP; |
|
|
503 | # endif |
|
|
504 | # ifdef VREPRINT |
|
|
505 | tio->c_cc[VREPRINT] = CRPRNT; |
|
|
506 | # endif |
|
|
507 | # ifdef VDISCRD |
|
|
508 | tio->c_cc[VDISCRD] = CFLUSH; |
|
|
509 | # endif |
|
|
510 | # ifdef VWERSE |
|
|
511 | tio->c_cc[VWERSE] = CWERASE; |
|
|
512 | # endif |
|
|
513 | # ifdef VLNEXT |
|
|
514 | tio->c_cc[VLNEXT] = CLNEXT; |
|
|
515 | # endif |
|
|
516 | # ifdef VSTATUS |
|
|
517 | tio->c_cc[VSTATUS] = CSTATUS; |
|
|
518 | # endif |
|
|
519 | |
|
|
520 | # if VMIN != VEOF |
|
|
521 | tio->c_cc[VMIN] = 1; |
|
|
522 | # endif |
|
|
523 | # if VTIME != VEOL |
|
|
524 | tio->c_cc[VTIME] = 0; |
|
|
525 | # endif |
|
|
526 | |
|
|
527 | /* input modes */ |
|
|
528 | tio->c_iflag = (BRKINT | IGNPAR | ICRNL |
|
|
529 | # ifdef IMAXBEL |
|
|
530 | | IMAXBEL |
|
|
531 | # endif |
|
|
532 | | IXON); |
|
|
533 | |
|
|
534 | /* output modes */ |
|
|
535 | tio->c_oflag = (OPOST | ONLCR); |
|
|
536 | |
|
|
537 | /* control modes */ |
|
|
538 | tio->c_cflag = (CS8 | CREAD); |
|
|
539 | |
|
|
540 | /* local modes */ |
|
|
541 | tio->c_lflag = (ISIG | ICANON | IEXTEN | ECHO |
|
|
542 | # if defined (ECHOCTL) && defined (ECHOKE) |
|
|
543 | | ECHOCTL | ECHOKE |
|
|
544 | # endif |
|
|
545 | | ECHOE | ECHOK); |
|
|
546 | } |
|
|
547 | |
476 | char **rxvt_environ; // startup environment |
548 | char **rxvt_environ; // startup environment |
477 | |
549 | |
478 | void |
550 | void |
479 | rxvt_init () |
551 | rxvt_init () |
480 | { |
552 | { |
481 | ptytty::init (); |
553 | assert (("fontMask must not overlap other RS masks", |
|
|
554 | 0 == (RS_fontMask & (RS_Sel | RS_baseattrMask | RS_customMask | RS_bgMask | RS_fgMask)))); |
482 | |
555 | |
|
|
556 | rxvt_get_ttymode (&rxvt_term::def_tio); |
|
|
557 | |
|
|
558 | // get rid of stdin/stdout as we don't need them, to free resources |
|
|
559 | dup2 (STDERR_FILENO, STDIN_FILENO); |
|
|
560 | dup2 (STDERR_FILENO, STDOUT_FILENO); |
|
|
561 | |
483 | if (!ev_default_loop (0)) |
562 | if (!ev_default_loop ()) |
484 | rxvt_fatal ("cannot initialise libev (bad value for LIBEV_METHODS?)\n"); |
563 | rxvt_fatal ("cannot initialise libev (bad value for LIBEV_METHODS?)\n"); |
485 | |
564 | |
486 | rxvt_environ = environ; |
565 | rxvt_environ = environ; |
487 | |
566 | |
488 | signal (SIGHUP, SIG_IGN); |
567 | signal (SIGHUP, SIG_IGN); |
489 | signal (SIGPIPE, SIG_IGN); |
568 | signal (SIGPIPE, SIG_IGN); |
490 | |
569 | |
491 | sig_handlers.sw_term.start (SIGTERM); ev_unref (); |
570 | sig_handlers.sw_term.start (SIGTERM); ev_unref (); |
492 | sig_handlers.sw_int.start (SIGINT); ev_unref (); |
571 | sig_handlers.sw_int.start (SIGINT); ev_unref (); |
493 | |
|
|
494 | /* need to trap SIGURG for SVR4 (Unixware) rlogin */ |
|
|
495 | /* signal (SIGURG, SIG_DFL); */ |
|
|
496 | |
572 | |
497 | old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler); |
573 | old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler); |
498 | // TODO: handle this with exceptions and tolerate the memory loss |
574 | // TODO: handle this with exceptions and tolerate the memory loss |
499 | XSetIOErrorHandler (rxvt_xioerror_handler); |
575 | XSetIOErrorHandler (rxvt_xioerror_handler); |
500 | |
576 | |
… | |
… | |
646 | |
722 | |
647 | ws.ws_col = ncol; |
723 | ws.ws_col = ncol; |
648 | ws.ws_row = nrow; |
724 | ws.ws_row = nrow; |
649 | ws.ws_xpixel = width; |
725 | ws.ws_xpixel = width; |
650 | ws.ws_ypixel = height; |
726 | ws.ws_ypixel = height; |
651 | (void)ioctl (pty->pty, TIOCSWINSZ, &ws); |
727 | ioctl (pty->pty, TIOCSWINSZ, &ws); |
652 | |
728 | |
653 | #if 0 |
729 | #if 0 |
654 | // TIOCSWINSZ is supposed to do this automatically and correctly |
730 | // TIOCSWINSZ is supposed to do this automatically and correctly |
655 | if (cmd_pid) /* force through to the command */ |
731 | if (cmd_pid) /* force through to the command */ |
656 | kill (-cmd_pid, SIGWINCH); |
732 | kill (-cmd_pid, SIGWINCH); |
… | |
… | |
686 | #endif |
762 | #endif |
687 | |
763 | |
688 | delete fontset[0]; |
764 | delete fontset[0]; |
689 | fontset[0] = fs; |
765 | fontset[0] = fs; |
690 | |
766 | |
691 | prop = (*fs)[1]->properties (); |
767 | prop = (*fs)[rxvt_fontset::firstFont]->properties (); |
692 | prop.height += lineSpace; |
768 | prop.height += lineSpace; |
|
|
769 | prop.width += letterSpace; |
693 | |
770 | |
694 | fs->set_prop (prop, false); |
771 | fs->set_prop (prop, false); |
695 | |
772 | |
696 | fwidth = prop.width; |
773 | fwidth = prop.width; |
697 | fheight = prop.height; |
774 | fheight = prop.height; |
… | |
… | |
747 | prop, XA_STRING, 8, PropModeReplace, |
824 | prop, XA_STRING, 8, PropModeReplace, |
748 | (const unsigned char *)str, len >= 0 ? len : strlen (str)); |
825 | (const unsigned char *)str, len >= 0 ? len : strlen (str)); |
749 | } |
826 | } |
750 | |
827 | |
751 | void |
828 | void |
|
|
829 | rxvt_term::set_mbstring_property (Atom prop, const char *str, int len) |
|
|
830 | { |
|
|
831 | XTextProperty ct; |
|
|
832 | |
|
|
833 | if (XmbTextListToTextProperty (dpy, (char **)&str, 1, XStdICCTextStyle, &ct) >= 0) |
|
|
834 | { |
|
|
835 | XSetTextProperty (dpy, parent[0], &ct, prop); |
|
|
836 | XFree (ct.value); |
|
|
837 | } |
|
|
838 | } |
|
|
839 | |
|
|
840 | void |
752 | rxvt_term::set_utf8_property (Atom prop, const char *str, int len) |
841 | rxvt_term::set_utf8_property (Atom prop, const char *str, int len) |
753 | { |
842 | { |
754 | wchar_t *ws = rxvt_mbstowcs (str, len); |
843 | wchar_t *ws = rxvt_mbstowcs (str, len); |
755 | char *s = rxvt_wcstoutf8 (ws); |
844 | char *s = rxvt_wcstoutf8 (ws); |
756 | |
845 | |
… | |
… | |
766 | /*----------------------------------------------------------------------*/ |
855 | /*----------------------------------------------------------------------*/ |
767 | /* xterm sequences - title, iconName, color (exptl) */ |
856 | /* xterm sequences - title, iconName, color (exptl) */ |
768 | void |
857 | void |
769 | rxvt_term::set_title (const char *str) |
858 | rxvt_term::set_title (const char *str) |
770 | { |
859 | { |
771 | set_string_property (XA_WM_NAME, str); |
860 | set_mbstring_property (XA_WM_NAME, str); |
772 | #if ENABLE_EWMH |
861 | #if ENABLE_EWMH |
773 | set_utf8_property (xa[XA_NET_WM_NAME], str); |
862 | set_utf8_property (xa[XA_NET_WM_NAME], str); |
774 | #endif |
863 | #endif |
775 | } |
864 | } |
776 | |
865 | |
777 | void |
866 | void |
778 | rxvt_term::set_icon_name (const char *str) |
867 | rxvt_term::set_icon_name (const char *str) |
779 | { |
868 | { |
780 | set_string_property (XA_WM_ICON_NAME, str); |
869 | set_mbstring_property (XA_WM_ICON_NAME, str); |
781 | #if ENABLE_EWMH |
870 | #if ENABLE_EWMH |
782 | set_utf8_property (xa[XA_NET_WM_ICON_NAME], str); |
871 | set_utf8_property (xa[XA_NET_WM_ICON_NAME], str); |
783 | #endif |
872 | #endif |
784 | } |
873 | } |
785 | |
874 | |
… | |
… | |
969 | #else |
1058 | #else |
970 | XResizeWindow (dpy, parent[0], szHint.width, szHint.height); |
1059 | XResizeWindow (dpy, parent[0], szHint.width, szHint.height); |
971 | #endif |
1060 | #endif |
972 | } |
1061 | } |
973 | |
1062 | |
|
|
1063 | if (set_hint) |
|
|
1064 | XSetWMNormalHints (dpy, parent[0], &szHint); |
|
|
1065 | |
974 | fix_screen = ncol != prev_ncol || nrow != prev_nrow; |
1066 | fix_screen = ncol != prev_ncol || nrow != prev_nrow; |
975 | |
1067 | |
976 | if (fix_screen || newwidth != old_width || newheight != old_height) |
1068 | if (fix_screen || newwidth != old_width || newheight != old_height) |
977 | { |
1069 | { |
978 | if (scrollBar.state) |
1070 | if (scrollBar.state) |
… | |
… | |
984 | |
1076 | |
985 | #ifdef HAVE_BG_PIXMAP |
1077 | #ifdef HAVE_BG_PIXMAP |
986 | if (bgPixmap.window_size_sensitive ()) |
1078 | if (bgPixmap.window_size_sensitive ()) |
987 | update_background (); |
1079 | update_background (); |
988 | #endif |
1080 | #endif |
989 | |
|
|
990 | scr_clear (); |
|
|
991 | } |
1081 | } |
992 | |
|
|
993 | if (set_hint) |
|
|
994 | XSetWMNormalHints (dpy, parent[0], &szHint); |
|
|
995 | |
1082 | |
996 | if (fix_screen || old_height == 0) |
1083 | if (fix_screen || old_height == 0) |
997 | scr_reset (); |
1084 | scr_reset (); |
998 | |
|
|
999 | // TODO, with nvidia-8178, resizes kill the alpha channel, report if not fixed in newer version |
|
|
1000 | //scr_touch (false); |
|
|
1001 | |
1085 | |
1002 | #ifdef HAVE_BG_PIXMAP |
1086 | #ifdef HAVE_BG_PIXMAP |
1003 | // TODO: this don't seem to have any effect - do we still need it ? If so - in which case exactly ? |
1087 | // TODO: this don't seem to have any effect - do we still need it ? If so - in which case exactly ? |
1004 | // if (bgPixmap.pixmap) |
1088 | // if (bgPixmap.pixmap) |
1005 | // scr_touch (false); |
1089 | // scr_touch (false); |
… | |
… | |
1077 | |
1161 | |
1078 | /* Checking whether input method is running. */ |
1162 | /* Checking whether input method is running. */ |
1079 | bool |
1163 | bool |
1080 | rxvt_term::IMisRunning () |
1164 | rxvt_term::IMisRunning () |
1081 | { |
1165 | { |
1082 | char *p; |
|
|
1083 | Atom atom; |
1166 | Atom atom; |
1084 | Window win; |
1167 | Window win; |
1085 | char server[IMBUFSIZ]; |
1168 | char server[IMBUFSIZ]; |
1086 | |
1169 | |
1087 | /* get current locale modifier */ |
1170 | /* get current locale modifier */ |
1088 | if ((p = XSetLocaleModifiers (NULL)) != NULL) |
1171 | if (char *p = XSetLocaleModifiers (0)) |
1089 | { |
1172 | { |
1090 | strcpy (server, "@server="); |
1173 | strcpy (server, "@server="); |
1091 | strncat (server, & (p[4]), IMBUFSIZ - 9); /* skip "@im=" */ |
1174 | strncat (server, p + 4, IMBUFSIZ - 9); /* skip "@im=" */ |
1092 | |
1175 | |
1093 | if ((p = strchr (server + 1, '@')) != NULL) /* first one only */ |
1176 | if (p = strchr (server + 1, '@')) /* first one only */ |
1094 | *p = '\0'; |
1177 | *p = '\0'; |
1095 | |
1178 | |
1096 | atom = XInternAtom (dpy, server, False); |
1179 | atom = XInternAtom (dpy, server, False); |
1097 | win = XGetSelectionOwner (dpy, atom); |
1180 | win = XGetSelectionOwner (dpy, atom); |
1098 | |
1181 | |
… | |
… | |
1165 | |
1248 | |
1166 | term->make_current (); |
1249 | term->make_current (); |
1167 | |
1250 | |
1168 | if (text) |
1251 | if (text) |
1169 | { |
1252 | { |
1170 | void *str; |
1253 | wchar_t *str; |
1171 | |
1254 | |
1172 | if (!text->encoding_is_wchar && text->string.multi_byte) |
1255 | if (!text->encoding_is_wchar && text->string.multi_byte) |
1173 | { |
1256 | { |
1174 | // of course, X makes it ugly again |
1257 | // of course, X makes it ugly again |
1175 | if (term->rs[Rs_imLocale]) |
1258 | if (term->rs[Rs_imLocale]) |
1176 | SET_LOCALE (term->rs[Rs_imLocale]); |
1259 | SET_LOCALE (term->rs[Rs_imLocale]); |
1177 | |
1260 | |
1178 | str = rxvt_temp_buf ((text->length + 1) * sizeof (wchar_t)); |
1261 | str = rxvt_temp_buf<wchar_t> (text->length + 1); |
1179 | mbstowcs ((wchar_t *)str, text->string.multi_byte, text->length + 1); |
1262 | mbstowcs (str, text->string.multi_byte, text->length + 1); |
1180 | |
1263 | |
1181 | if (term->rs[Rs_imLocale]) |
1264 | if (term->rs[Rs_imLocale]) |
1182 | SET_LOCALE (term->locale); |
1265 | SET_LOCALE (term->locale); |
1183 | } |
1266 | } |
1184 | else |
1267 | else |
1185 | str = (void *)text->string.wide_char; |
1268 | str = text->string.wide_char; |
1186 | |
1269 | |
1187 | HOOK_INVOKE ((term, HOOK_XIM_PREEDIT_DRAW, |
1270 | HOOK_INVOKE ((term, HOOK_XIM_PREEDIT_DRAW, |
1188 | DT_INT, call_data->caret, |
1271 | DT_INT, call_data->caret, |
1189 | DT_INT, call_data->chg_first, |
1272 | DT_INT, call_data->chg_first, |
1190 | DT_INT, call_data->chg_length, |
1273 | DT_INT, call_data->chg_length, |
… | |
… | |
1544 | void |
1627 | void |
1545 | rxvt_term::get_window_origin (int &x, int &y) |
1628 | rxvt_term::get_window_origin (int &x, int &y) |
1546 | { |
1629 | { |
1547 | Window cr; |
1630 | Window cr; |
1548 | XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr); |
1631 | XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr); |
1549 | /* fprintf (stderr, "origin is %+d%+d\n", x, y);*/ |
|
|
1550 | } |
1632 | } |
1551 | |
1633 | |
1552 | Pixmap |
1634 | Pixmap |
1553 | rxvt_term::get_pixmap_property (int prop_id) |
1635 | rxvt_term::get_pixmap_property (int prop_id) |
1554 | { |
1636 | { |
… | |
… | |
1568 | |
1650 | |
1569 | return None; |
1651 | return None; |
1570 | } |
1652 | } |
1571 | |
1653 | |
1572 | #ifdef HAVE_BG_PIXMAP |
1654 | #ifdef HAVE_BG_PIXMAP |
1573 | # if TRACE_PIXMAPS |
|
|
1574 | # undef update_background |
|
|
1575 | void |
|
|
1576 | rxvt_term::trace_update_background (const char *file, int line) |
|
|
1577 | { |
|
|
1578 | fprintf (stderr, "%s:%d:update_background()\n", file, line); |
|
|
1579 | update_background (); |
|
|
1580 | } |
|
|
1581 | # endif |
|
|
1582 | |
1655 | |
1583 | void |
1656 | void |
1584 | rxvt_term::update_background () |
1657 | rxvt_term::update_background () |
1585 | { |
1658 | { |
1586 | if (update_background_ev.is_active ()) |
1659 | if (update_background_ev.is_active ()) |