… | |
… | |
38 | #include <limits> |
38 | #include <limits> |
39 | |
39 | |
40 | #include <csignal> |
40 | #include <csignal> |
41 | #include <cstring> |
41 | #include <cstring> |
42 | |
42 | |
43 | #ifdef TTY_GID_SUPPORT |
|
|
44 | # include <grp.h> |
|
|
45 | #endif |
|
|
46 | |
|
|
47 | #ifdef HAVE_TERMIOS_H |
43 | #ifdef HAVE_TERMIOS_H |
48 | # include <termios.h> |
44 | # include <termios.h> |
|
|
45 | #endif |
|
|
46 | |
|
|
47 | #ifdef HAVE_XSETLOCALE |
|
|
48 | # define X_LOCALE |
|
|
49 | # include <X11/Xlocale.h> |
|
|
50 | #else |
|
|
51 | # ifdef HAVE_SETLOCALE |
|
|
52 | # include <clocale> |
|
|
53 | # endif |
49 | #endif |
54 | #endif |
50 | |
55 | |
51 | vector<rxvt_term *> rxvt_term::termlist; |
56 | vector<rxvt_term *> rxvt_term::termlist; |
52 | |
57 | |
53 | // used to tell global functions which terminal instance is "active" |
58 | // used to tell global functions which terminal instance is "active" |
… | |
… | |
88 | class rxvt_composite_vec rxvt_composite; |
93 | class rxvt_composite_vec rxvt_composite; |
89 | |
94 | |
90 | text_t rxvt_composite_vec::compose (unicode_t c1, unicode_t c2) |
95 | text_t rxvt_composite_vec::compose (unicode_t c1, unicode_t c2) |
91 | { |
96 | { |
92 | compose_char *cc; |
97 | compose_char *cc; |
93 | |
98 | |
94 | // break compose chains, as stupid readline really likes to duplicate |
99 | // break compose chains, as stupid readline really likes to duplicate |
95 | // composing characters for some reason near the end of a line. |
100 | // composing characters for some reason near the end of a line. |
96 | cc = (*this)[c1]; |
101 | cc = (*this)[c1]; |
97 | while (cc) |
102 | while (cc) |
98 | { |
103 | { |
… | |
… | |
178 | pointer_ev (this, &rxvt_term::pointer_cb), |
183 | pointer_ev (this, &rxvt_term::pointer_cb), |
179 | #endif |
184 | #endif |
180 | #ifdef USE_XIM |
185 | #ifdef USE_XIM |
181 | im_ev (this, &rxvt_term::im_cb), |
186 | im_ev (this, &rxvt_term::im_cb), |
182 | #endif |
187 | #endif |
183 | #ifndef NO_BELL |
188 | #ifndef NO_BELL |
184 | bell_ev (this, &rxvt_term::bell_cb), |
189 | bell_ev (this, &rxvt_term::bell_cb), |
185 | #endif |
190 | #endif |
186 | termwin_ev (this, &rxvt_term::x_cb), |
191 | termwin_ev (this, &rxvt_term::x_cb), |
187 | vt_ev (this, &rxvt_term::x_cb), |
192 | vt_ev (this, &rxvt_term::x_cb), |
188 | child_ev (this, &rxvt_term::child_cb), |
193 | child_ev (this, &rxvt_term::child_cb), |
… | |
… | |
429 | else |
434 | else |
430 | XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", |
435 | XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", |
431 | mesg, BUFSIZ); |
436 | mesg, BUFSIZ); |
432 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->resourceid); |
437 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->resourceid); |
433 | } |
438 | } |
434 | XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", |
439 | XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", |
435 | mesg, BUFSIZ); |
440 | mesg, BUFSIZ); |
436 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->serial); |
441 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->serial); |
437 | } |
442 | } |
438 | #endif |
443 | #endif |
439 | |
444 | |
… | |
… | |
513 | |
518 | |
514 | #ifdef ENABLE_TRANSPARENCY |
519 | #ifdef ENABLE_TRANSPARENCY |
515 | if (option (Opt_transparent)) |
520 | if (option (Opt_transparent)) |
516 | { |
521 | { |
517 | bgPixmap.set_transparent (); |
522 | bgPixmap.set_transparent (); |
518 | #ifdef HAVE_AFTERIMAGE |
523 | #ifdef HAVE_AFTERIMAGE |
519 | if (rs [Rs_blurradius]) |
524 | if (rs [Rs_blurradius]) |
520 | bgPixmap.set_blur_radius (rs [Rs_blurradius]); |
525 | bgPixmap.set_blur_radius (rs [Rs_blurradius]); |
521 | #endif |
526 | #endif |
522 | if (ISSET_PIXCOLOR (Color_tint)) |
527 | if (ISSET_PIXCOLOR (Color_tint)) |
523 | bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
528 | bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
524 | if (rs [Rs_shade]) |
529 | if (rs [Rs_shade]) |
525 | bgPixmap.set_shade (rs [Rs_shade]); |
530 | bgPixmap.set_shade (rs [Rs_shade]); |
526 | |
531 | |
… | |
… | |
585 | } |
590 | } |
586 | |
591 | |
587 | static struct sig_handlers |
592 | static struct sig_handlers |
588 | { |
593 | { |
589 | sig_watcher sw_term, sw_int; |
594 | sig_watcher sw_term, sw_int; |
590 | |
595 | |
591 | /* |
596 | /* |
592 | * Catch a fatal signal and tidy up before quitting |
597 | * Catch a fatal signal and tidy up before quitting |
593 | */ |
598 | */ |
594 | void |
599 | void |
595 | sig_term (sig_watcher &w) |
600 | sig_term (sig_watcher &w) |
… | |
… | |
897 | if (parent[0]) |
902 | if (parent[0]) |
898 | { |
903 | { |
899 | resize_all_windows (0, 0, 0); |
904 | resize_all_windows (0, 0, 0); |
900 | scr_remap_chars (); |
905 | scr_remap_chars (); |
901 | scr_touch (true); |
906 | scr_touch (true); |
902 | } |
907 | } |
903 | |
908 | |
904 | return true; |
909 | return true; |
905 | } |
910 | } |
906 | |
911 | |
907 | void |
912 | void |
… | |
… | |
951 | rxvt_term::set_window_color (int idx, const char *color) |
956 | rxvt_term::set_window_color (int idx, const char *color) |
952 | { |
957 | { |
953 | #ifdef XTERM_COLOR_CHANGE |
958 | #ifdef XTERM_COLOR_CHANGE |
954 | rxvt_color xcol; |
959 | rxvt_color xcol; |
955 | int i; |
960 | int i; |
956 | |
961 | |
957 | if (color == NULL || *color == '\0') |
962 | if (color == NULL || *color == '\0') |
958 | return; |
963 | return; |
959 | |
964 | |
960 | color = strdup (color); |
965 | color = strdup (color); |
961 | allocated.push_back ((void *)color); |
966 | allocated.push_back ((void *)color); |
… | |
… | |
1342 | if (term->rs[Rs_imLocale]) |
1347 | if (term->rs[Rs_imLocale]) |
1343 | SET_LOCALE (term->locale); |
1348 | SET_LOCALE (term->locale); |
1344 | } |
1349 | } |
1345 | else |
1350 | else |
1346 | str = (void *)text->string.wide_char; |
1351 | str = (void *)text->string.wide_char; |
1347 | |
1352 | |
1348 | HOOK_INVOKE ((term, HOOK_XIM_PREEDIT_DRAW, |
1353 | HOOK_INVOKE ((term, HOOK_XIM_PREEDIT_DRAW, |
1349 | DT_INT, call_data->caret, |
1354 | DT_INT, call_data->caret, |
1350 | DT_INT, call_data->chg_first, |
1355 | DT_INT, call_data->chg_first, |
1351 | DT_INT, call_data->chg_length, |
1356 | DT_INT, call_data->chg_length, |
1352 | DT_LCS_LEN, (void *)text->feedback, text->feedback ? (int)text->length : 0, |
1357 | DT_LCS_LEN, (void *)text->feedback, text->feedback ? (int)text->length : 0, |
… | |
… | |
1671 | |
1676 | |
1672 | if (input_style & XIMPreeditPosition) |
1677 | if (input_style & XIMPreeditPosition) |
1673 | { |
1678 | { |
1674 | im_set_size (preedit_rect); |
1679 | im_set_size (preedit_rect); |
1675 | preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL); |
1680 | preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL); |
1676 | |
1681 | |
1677 | XSetICValues (Input_Context, |
1682 | XSetICValues (Input_Context, |
1678 | XNPreeditAttributes, preedit_attr, NULL); |
1683 | XNPreeditAttributes, preedit_attr, NULL); |
1679 | } |
1684 | } |
1680 | else |
1685 | else |
1681 | { |
1686 | { |