… | |
… | |
101 | { |
101 | { |
102 | if (cc->c2 == c2) return c1; |
102 | if (cc->c2 == c2) return c1; |
103 | cc = (*this)[cc->c1]; |
103 | cc = (*this)[cc->c1]; |
104 | } |
104 | } |
105 | |
105 | |
106 | // check to see wether this combination already exists otherwise |
106 | // check to see whether this combination already exists otherwise |
107 | for (cc = v.end (); cc-- > v.begin (); ) |
107 | for (cc = v.end (); cc-- > v.begin (); ) |
108 | { |
108 | { |
109 | if (cc->c1 == c1 && cc->c2 == c2) |
109 | if (cc->c1 == c1 && cc->c2 == c2) |
110 | return COMPOSE_LO + (cc - v.begin ()); |
110 | return COMPOSE_LO + (cc - v.begin ()); |
111 | } |
111 | } |
… | |
… | |
227 | delete fontset[0]; |
227 | delete fontset[0]; |
228 | |
228 | |
229 | #ifdef HAVE_BG_PIXMAP |
229 | #ifdef HAVE_BG_PIXMAP |
230 | bgPixmap.destroy (); |
230 | bgPixmap.destroy (); |
231 | #endif |
231 | #endif |
|
|
232 | #ifdef HAVE_AFTERIMAGE |
|
|
233 | if (asv) |
|
|
234 | destroy_asvisual (asv, 0); |
|
|
235 | if (asimman) |
|
|
236 | destroy_image_manager (asimman, 0); |
|
|
237 | #endif |
232 | |
238 | |
233 | if (display) |
239 | if (display) |
234 | { |
240 | { |
235 | selection_clear (); |
241 | selection_clear (); |
|
|
242 | selection_clear (true); |
236 | |
243 | |
237 | #ifdef USE_XIM |
244 | #ifdef USE_XIM |
238 | im_destroy (); |
245 | im_destroy (); |
239 | #endif |
246 | #endif |
240 | scrollBar.destroy (); |
247 | scrollBar.destroy (); |
… | |
… | |
265 | /* clear all resources */ |
272 | /* clear all resources */ |
266 | for (int i = 0; i < allocated.size (); i++) |
273 | for (int i = 0; i < allocated.size (); i++) |
267 | free (allocated [i]); |
274 | free (allocated [i]); |
268 | |
275 | |
269 | free (selection.text); |
276 | free (selection.text); |
|
|
277 | free (selection.clip_text); |
270 | // TODO: manage env vars in child only(!) |
278 | // TODO: manage env vars in child only(!) |
271 | free (env_display); |
279 | free (env_display); |
272 | free (env_term); |
280 | free (env_term); |
273 | free (locale); |
281 | free (locale); |
274 | free (v_buffer); |
282 | free (v_buffer); |
… | |
… | |
522 | if (rs[Rs_geometry]) |
530 | if (rs[Rs_geometry]) |
523 | flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); |
531 | flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); |
524 | |
532 | |
525 | if (flags & WidthValue) |
533 | if (flags & WidthValue) |
526 | { |
534 | { |
|
|
535 | if (!w) |
|
|
536 | rxvt_fatal ("illegal window geometry (width and height must be non-zero), aborting.\n"); |
|
|
537 | |
527 | ncol = clamp (w, 0, std::numeric_limits<int16_t>::max ()); |
538 | ncol = clamp (w, 1, std::numeric_limits<int16_t>::max ()); |
528 | szHint.flags |= USSize; |
539 | szHint.flags |= USSize; |
529 | } |
540 | } |
530 | |
541 | |
531 | if (flags & HeightValue) |
542 | if (flags & HeightValue) |
532 | { |
543 | { |
|
|
544 | if (!h) |
|
|
545 | rxvt_fatal ("illegal window geometry (width and height must be non-zero), aborting.\n"); |
|
|
546 | |
533 | nrow = clamp (h, 0, std::numeric_limits<int16_t>::max ()); |
547 | nrow = clamp (h, 1, std::numeric_limits<int16_t>::max ()); |
534 | szHint.flags |= USSize; |
548 | szHint.flags |= USSize; |
535 | } |
549 | } |
536 | |
550 | |
537 | if (flags & XValue) |
551 | if (flags & XValue) |
538 | { |
552 | { |
… | |
… | |
559 | szHint.win_gravity = SouthEastGravity; |
573 | szHint.win_gravity = SouthEastGravity; |
560 | else |
574 | else |
561 | szHint.win_gravity = SouthWestGravity; |
575 | szHint.win_gravity = SouthWestGravity; |
562 | } |
576 | } |
563 | } |
577 | } |
564 | |
|
|
565 | if (!szHint.width || !szHint.height) |
|
|
566 | rxvt_fatal ("window width or height must not be zero, aborting.\n"); |
|
|
567 | } |
578 | } |
568 | |
579 | |
569 | /* TODO: BOUNDS */ |
580 | /* TODO: BOUNDS */ |
570 | width = ncol * fwidth; |
581 | width = ncol * fwidth; |
571 | height = nrow * fheight; |
582 | height = nrow * fheight; |
… | |
… | |
616 | szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; |
627 | szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; |
617 | |
628 | |
618 | if (recalc_y) |
629 | if (recalc_y) |
619 | szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth; |
630 | szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth; |
620 | |
631 | |
621 | ncol = width / fwidth; |
632 | ncol = width / fwidth; |
622 | nrow = height / fheight; |
633 | nrow = height / fheight; |
623 | } |
634 | } |
624 | |
635 | |
625 | /*----------------------------------------------------------------------*/ |
636 | /*----------------------------------------------------------------------*/ |
626 | /* |
637 | /* |
… | |
… | |
637 | |
648 | |
638 | ws.ws_col = ncol; |
649 | ws.ws_col = ncol; |
639 | ws.ws_row = nrow; |
650 | ws.ws_row = nrow; |
640 | ws.ws_xpixel = width; |
651 | ws.ws_xpixel = width; |
641 | ws.ws_ypixel = height; |
652 | ws.ws_ypixel = height; |
642 | (void)ioctl (pty->pty, TIOCSWINSZ, &ws); |
653 | ioctl (pty->pty, TIOCSWINSZ, &ws); |
643 | |
654 | |
644 | #if 0 |
655 | #if 0 |
645 | // TIOCSWINSZ is supposed to do this automatically and correctly |
656 | // TIOCSWINSZ is supposed to do this automatically and correctly |
646 | if (cmd_pid) /* force through to the command */ |
657 | if (cmd_pid) /* force through to the command */ |
647 | kill (-cmd_pid, SIGWINCH); |
658 | kill (-cmd_pid, SIGWINCH); |
… | |
… | |
677 | #endif |
688 | #endif |
678 | |
689 | |
679 | delete fontset[0]; |
690 | delete fontset[0]; |
680 | fontset[0] = fs; |
691 | fontset[0] = fs; |
681 | |
692 | |
682 | prop = (*fs)[1]->properties (); |
693 | prop = (*fs)[rxvt_fontset::firstFont]->properties (); |
683 | prop.height += lineSpace; |
694 | prop.height += lineSpace; |
|
|
695 | prop.width += letterSpace; |
684 | |
696 | |
685 | fs->set_prop (prop, false); |
697 | fs->set_prop (prop, false); |
686 | |
698 | |
687 | fwidth = prop.width; |
699 | fwidth = prop.width; |
688 | fheight = prop.height; |
700 | fheight = prop.height; |
… | |
… | |
902 | int old_width = szHint.width; |
914 | int old_width = szHint.width; |
903 | int old_height = szHint.height; |
915 | int old_height = szHint.height; |
904 | |
916 | |
905 | window_calc (newwidth, newheight); |
917 | window_calc (newwidth, newheight); |
906 | |
918 | |
907 | if (!HOOK_INVOKE ((this, HOOK_RESIZE_ALL_WINDOWS, DT_INT, newwidth, DT_INT, newheight, DT_END))) |
919 | bool set_hint = !HOOK_INVOKE ((this, HOOK_RESIZE_ALL_WINDOWS, DT_INT, newwidth, DT_INT, newheight, DT_END)); |
|
|
920 | |
|
|
921 | // to avoid races between us and the wm, we clear the incremental size hints around the xresizewindow |
|
|
922 | if (set_hint) |
|
|
923 | { |
|
|
924 | szHint.flags &= ~(PBaseSize | PResizeInc); |
908 | XSetWMNormalHints (dpy, parent[0], &szHint); |
925 | XSetWMNormalHints (dpy, parent[0], &szHint); |
|
|
926 | szHint.flags |= PBaseSize | PResizeInc; |
|
|
927 | } |
909 | |
928 | |
910 | if (!ignoreparent) |
929 | if (!ignoreparent) |
911 | { |
930 | { |
912 | #ifdef SMART_RESIZE |
931 | #ifdef SMART_RESIZE |
913 | /* |
932 | /* |
… | |
… | |
953 | #else |
972 | #else |
954 | XResizeWindow (dpy, parent[0], szHint.width, szHint.height); |
973 | XResizeWindow (dpy, parent[0], szHint.width, szHint.height); |
955 | #endif |
974 | #endif |
956 | } |
975 | } |
957 | |
976 | |
|
|
977 | if (set_hint) |
|
|
978 | XSetWMNormalHints (dpy, parent[0], &szHint); |
|
|
979 | |
958 | fix_screen = ncol != prev_ncol || nrow != prev_nrow; |
980 | fix_screen = ncol != prev_ncol || nrow != prev_nrow; |
959 | |
981 | |
960 | if (fix_screen || newwidth != old_width || newheight != old_height) |
982 | if (fix_screen || newwidth != old_width || newheight != old_height) |
961 | { |
983 | { |
962 | if (scrollBar.state) |
984 | if (scrollBar.state) |
… | |
… | |
968 | |
990 | |
969 | #ifdef HAVE_BG_PIXMAP |
991 | #ifdef HAVE_BG_PIXMAP |
970 | if (bgPixmap.window_size_sensitive ()) |
992 | if (bgPixmap.window_size_sensitive ()) |
971 | update_background (); |
993 | update_background (); |
972 | #endif |
994 | #endif |
973 | |
|
|
974 | scr_clear (); |
|
|
975 | } |
995 | } |
976 | |
996 | |
977 | if (fix_screen || old_height == 0) |
997 | if (fix_screen || old_height == 0) |
978 | scr_reset (); |
998 | scr_reset (); |
979 | |
|
|
980 | // TODO, with nvidia-8178, resizes kill the alpha channel, report if not fixed in newer version |
|
|
981 | //scr_touch (false); |
|
|
982 | |
999 | |
983 | #ifdef HAVE_BG_PIXMAP |
1000 | #ifdef HAVE_BG_PIXMAP |
984 | // TODO: this don't seem to have any effect - do we still need it ? If so - in which case exactly ? |
1001 | // TODO: this don't seem to have any effect - do we still need it ? If so - in which case exactly ? |
985 | // if (bgPixmap.pixmap) |
1002 | // if (bgPixmap.pixmap) |
986 | // scr_touch (false); |
1003 | // scr_touch (false); |
… | |
… | |
1058 | |
1075 | |
1059 | /* Checking whether input method is running. */ |
1076 | /* Checking whether input method is running. */ |
1060 | bool |
1077 | bool |
1061 | rxvt_term::IMisRunning () |
1078 | rxvt_term::IMisRunning () |
1062 | { |
1079 | { |
1063 | char *p; |
|
|
1064 | Atom atom; |
1080 | Atom atom; |
1065 | Window win; |
1081 | Window win; |
1066 | char server[IMBUFSIZ]; |
1082 | char server[IMBUFSIZ]; |
1067 | |
1083 | |
1068 | /* get current locale modifier */ |
1084 | /* get current locale modifier */ |
1069 | if ((p = XSetLocaleModifiers (NULL)) != NULL) |
1085 | if (char *p = XSetLocaleModifiers (0)) |
1070 | { |
1086 | { |
1071 | strcpy (server, "@server="); |
1087 | strcpy (server, "@server="); |
1072 | strncat (server, & (p[4]), IMBUFSIZ - 9); /* skip "@im=" */ |
1088 | strncat (server, p + 4, IMBUFSIZ - 9); /* skip "@im=" */ |
1073 | |
1089 | |
1074 | if ((p = strchr (server + 1, '@')) != NULL) /* first one only */ |
1090 | if (p = strchr (server + 1, '@')) /* first one only */ |
1075 | *p = '\0'; |
1091 | *p = '\0'; |
1076 | |
1092 | |
1077 | atom = XInternAtom (dpy, server, False); |
1093 | atom = XInternAtom (dpy, server, False); |
1078 | win = XGetSelectionOwner (dpy, atom); |
1094 | win = XGetSelectionOwner (dpy, atom); |
1079 | |
1095 | |
… | |
… | |
1146 | |
1162 | |
1147 | term->make_current (); |
1163 | term->make_current (); |
1148 | |
1164 | |
1149 | if (text) |
1165 | if (text) |
1150 | { |
1166 | { |
1151 | void *str; |
1167 | wchar_t *str; |
1152 | |
1168 | |
1153 | if (!text->encoding_is_wchar && text->string.multi_byte) |
1169 | if (!text->encoding_is_wchar && text->string.multi_byte) |
1154 | { |
1170 | { |
1155 | // of course, X makes it ugly again |
1171 | // of course, X makes it ugly again |
1156 | if (term->rs[Rs_imLocale]) |
1172 | if (term->rs[Rs_imLocale]) |
1157 | SET_LOCALE (term->rs[Rs_imLocale]); |
1173 | SET_LOCALE (term->rs[Rs_imLocale]); |
1158 | |
1174 | |
1159 | str = rxvt_temp_buf ((text->length + 1) * sizeof (wchar_t)); |
1175 | str = rxvt_temp_buf<wchar_t> (text->length + 1); |
1160 | mbstowcs ((wchar_t *)str, text->string.multi_byte, text->length + 1); |
1176 | mbstowcs (str, text->string.multi_byte, text->length + 1); |
1161 | |
1177 | |
1162 | if (term->rs[Rs_imLocale]) |
1178 | if (term->rs[Rs_imLocale]) |
1163 | SET_LOCALE (term->locale); |
1179 | SET_LOCALE (term->locale); |
1164 | } |
1180 | } |
1165 | else |
1181 | else |
1166 | str = (void *)text->string.wide_char; |
1182 | str = text->string.wide_char; |
1167 | |
1183 | |
1168 | HOOK_INVOKE ((term, HOOK_XIM_PREEDIT_DRAW, |
1184 | HOOK_INVOKE ((term, HOOK_XIM_PREEDIT_DRAW, |
1169 | DT_INT, call_data->caret, |
1185 | DT_INT, call_data->caret, |
1170 | DT_INT, call_data->chg_first, |
1186 | DT_INT, call_data->chg_first, |
1171 | DT_INT, call_data->chg_length, |
1187 | DT_INT, call_data->chg_length, |