… | |
… | |
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 | } |
… | |
… | |
237 | #endif |
237 | #endif |
238 | |
238 | |
239 | if (display) |
239 | if (display) |
240 | { |
240 | { |
241 | selection_clear (); |
241 | selection_clear (); |
|
|
242 | selection_clear (true); |
242 | |
243 | |
243 | #ifdef USE_XIM |
244 | #ifdef USE_XIM |
244 | im_destroy (); |
245 | im_destroy (); |
245 | #endif |
246 | #endif |
246 | scrollBar.destroy (); |
247 | scrollBar.destroy (); |
… | |
… | |
271 | /* clear all resources */ |
272 | /* clear all resources */ |
272 | for (int i = 0; i < allocated.size (); i++) |
273 | for (int i = 0; i < allocated.size (); i++) |
273 | free (allocated [i]); |
274 | free (allocated [i]); |
274 | |
275 | |
275 | free (selection.text); |
276 | free (selection.text); |
|
|
277 | free (selection.clip_text); |
276 | // TODO: manage env vars in child only(!) |
278 | // TODO: manage env vars in child only(!) |
277 | free (env_display); |
279 | free (env_display); |
278 | free (env_term); |
280 | free (env_term); |
279 | free (locale); |
281 | free (locale); |
280 | free (v_buffer); |
282 | free (v_buffer); |
… | |
… | |
388 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->request_code); |
390 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->request_code); |
389 | sprintf(number, "%d", event->request_code); |
391 | sprintf(number, "%d", event->request_code); |
390 | XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); |
392 | XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); |
391 | rxvt_warn ("(which is %s)\n", buffer); |
393 | rxvt_warn ("(which is %s)\n", buffer); |
392 | if (event->request_code >= 128) { |
394 | if (event->request_code >= 128) { |
393 | XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", |
395 | XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", |
394 | mesg, BUFSIZ); |
396 | mesg, BUFSIZ); |
395 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->minor_code); |
397 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->minor_code); |
396 | } |
398 | } |
397 | if ((event->error_code == BadWindow) || |
399 | if ((event->error_code == BadWindow) || |
398 | (event->error_code == BadPixmap) || |
400 | (event->error_code == BadPixmap) || |
399 | (event->error_code == BadCursor) || |
401 | (event->error_code == BadCursor) || |
400 | (event->error_code == BadFont) || |
402 | (event->error_code == BadFont) || |
401 | (event->error_code == BadDrawable) || |
403 | (event->error_code == BadDrawable) || |
402 | (event->error_code == BadColor) || |
404 | (event->error_code == BadColor) || |
403 | (event->error_code == BadGC) || |
405 | (event->error_code == BadGC) || |
404 | (event->error_code == BadIDChoice) || |
406 | (event->error_code == BadIDChoice) || |
405 | (event->error_code == BadValue) || |
407 | (event->error_code == BadValue) || |
406 | (event->error_code == BadAtom)) { |
408 | (event->error_code == BadAtom)) { |
407 | if (event->error_code == BadValue) |
409 | if (event->error_code == BadValue) |
408 | XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", |
410 | XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", |
409 | mesg, BUFSIZ); |
411 | mesg, BUFSIZ); |
410 | else if (event->error_code == BadAtom) |
412 | else if (event->error_code == BadAtom) |
411 | XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", |
413 | XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", |
412 | mesg, BUFSIZ); |
414 | mesg, BUFSIZ); |
413 | else |
415 | else |
414 | XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", |
416 | XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", |
415 | mesg, BUFSIZ); |
417 | mesg, BUFSIZ); |
416 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->resourceid); |
418 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->resourceid); |
417 | } |
419 | } |
418 | XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", |
420 | XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", |
419 | mesg, BUFSIZ); |
421 | mesg, BUFSIZ); |
420 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->serial); |
422 | rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->serial); |
421 | } |
423 | } |
422 | #endif |
424 | #endif |
423 | |
425 | |
424 | int |
426 | int |
… | |
… | |
625 | szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; |
627 | szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; |
626 | |
628 | |
627 | if (recalc_y) |
629 | if (recalc_y) |
628 | szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth; |
630 | szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth; |
629 | |
631 | |
630 | ncol = width / fwidth; |
632 | ncol = width / fwidth; |
631 | nrow = height / fheight; |
633 | nrow = height / fheight; |
632 | } |
634 | } |
633 | |
635 | |
634 | /*----------------------------------------------------------------------*/ |
636 | /*----------------------------------------------------------------------*/ |
635 | /* |
637 | /* |
… | |
… | |
646 | |
648 | |
647 | ws.ws_col = ncol; |
649 | ws.ws_col = ncol; |
648 | ws.ws_row = nrow; |
650 | ws.ws_row = nrow; |
649 | ws.ws_xpixel = width; |
651 | ws.ws_xpixel = width; |
650 | ws.ws_ypixel = height; |
652 | ws.ws_ypixel = height; |
651 | (void)ioctl (pty->pty, TIOCSWINSZ, &ws); |
653 | ioctl (pty->pty, TIOCSWINSZ, &ws); |
652 | |
654 | |
653 | #if 0 |
655 | #if 0 |
654 | // TIOCSWINSZ is supposed to do this automatically and correctly |
656 | // TIOCSWINSZ is supposed to do this automatically and correctly |
655 | if (cmd_pid) /* force through to the command */ |
657 | if (cmd_pid) /* force through to the command */ |
656 | kill (-cmd_pid, SIGWINCH); |
658 | kill (-cmd_pid, SIGWINCH); |
… | |
… | |
686 | #endif |
688 | #endif |
687 | |
689 | |
688 | delete fontset[0]; |
690 | delete fontset[0]; |
689 | fontset[0] = fs; |
691 | fontset[0] = fs; |
690 | |
692 | |
691 | prop = (*fs)[1]->properties (); |
693 | prop = (*fs)[rxvt_fontset::firstFont]->properties (); |
692 | prop.height += lineSpace; |
694 | prop.height += lineSpace; |
|
|
695 | prop.width += letterSpace; |
693 | |
696 | |
694 | fs->set_prop (prop, false); |
697 | fs->set_prop (prop, false); |
695 | |
698 | |
696 | fwidth = prop.width; |
699 | fwidth = prop.width; |
697 | fheight = prop.height; |
700 | fheight = prop.height; |
… | |
… | |
911 | int old_width = szHint.width; |
914 | int old_width = szHint.width; |
912 | int old_height = szHint.height; |
915 | int old_height = szHint.height; |
913 | |
916 | |
914 | window_calc (newwidth, newheight); |
917 | window_calc (newwidth, newheight); |
915 | |
918 | |
916 | 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); |
917 | XSetWMNormalHints (dpy, parent[0], &szHint); |
925 | XSetWMNormalHints (dpy, parent[0], &szHint); |
|
|
926 | szHint.flags |= PBaseSize | PResizeInc; |
|
|
927 | } |
918 | |
928 | |
919 | if (!ignoreparent) |
929 | if (!ignoreparent) |
920 | { |
930 | { |
921 | #ifdef SMART_RESIZE |
931 | #ifdef SMART_RESIZE |
922 | /* |
932 | /* |
… | |
… | |
962 | #else |
972 | #else |
963 | XResizeWindow (dpy, parent[0], szHint.width, szHint.height); |
973 | XResizeWindow (dpy, parent[0], szHint.width, szHint.height); |
964 | #endif |
974 | #endif |
965 | } |
975 | } |
966 | |
976 | |
|
|
977 | if (set_hint) |
|
|
978 | XSetWMNormalHints (dpy, parent[0], &szHint); |
|
|
979 | |
967 | fix_screen = ncol != prev_ncol || nrow != prev_nrow; |
980 | fix_screen = ncol != prev_ncol || nrow != prev_nrow; |
968 | |
981 | |
969 | if (fix_screen || newwidth != old_width || newheight != old_height) |
982 | if (fix_screen || newwidth != old_width || newheight != old_height) |
970 | { |
983 | { |
971 | if (scrollBar.state) |
984 | if (scrollBar.state) |
… | |
… | |
977 | |
990 | |
978 | #ifdef HAVE_BG_PIXMAP |
991 | #ifdef HAVE_BG_PIXMAP |
979 | if (bgPixmap.window_size_sensitive ()) |
992 | if (bgPixmap.window_size_sensitive ()) |
980 | update_background (); |
993 | update_background (); |
981 | #endif |
994 | #endif |
982 | |
|
|
983 | scr_clear (); |
|
|
984 | } |
995 | } |
985 | |
996 | |
986 | if (fix_screen || old_height == 0) |
997 | if (fix_screen || old_height == 0) |
987 | scr_reset (); |
998 | scr_reset (); |
988 | |
|
|
989 | // TODO, with nvidia-8178, resizes kill the alpha channel, report if not fixed in newer version |
|
|
990 | //scr_touch (false); |
|
|
991 | |
999 | |
992 | #ifdef HAVE_BG_PIXMAP |
1000 | #ifdef HAVE_BG_PIXMAP |
993 | // 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 ? |
994 | // if (bgPixmap.pixmap) |
1002 | // if (bgPixmap.pixmap) |
995 | // scr_touch (false); |
1003 | // scr_touch (false); |
… | |
… | |
1067 | |
1075 | |
1068 | /* Checking whether input method is running. */ |
1076 | /* Checking whether input method is running. */ |
1069 | bool |
1077 | bool |
1070 | rxvt_term::IMisRunning () |
1078 | rxvt_term::IMisRunning () |
1071 | { |
1079 | { |
1072 | char *p; |
|
|
1073 | Atom atom; |
1080 | Atom atom; |
1074 | Window win; |
1081 | Window win; |
1075 | char server[IMBUFSIZ]; |
1082 | char server[IMBUFSIZ]; |
1076 | |
1083 | |
1077 | /* get current locale modifier */ |
1084 | /* get current locale modifier */ |
1078 | if ((p = XSetLocaleModifiers (NULL)) != NULL) |
1085 | if (char *p = XSetLocaleModifiers (0)) |
1079 | { |
1086 | { |
1080 | strcpy (server, "@server="); |
1087 | strcpy (server, "@server="); |
1081 | strncat (server, & (p[4]), IMBUFSIZ - 9); /* skip "@im=" */ |
1088 | strncat (server, p + 4, IMBUFSIZ - 9); /* skip "@im=" */ |
1082 | |
1089 | |
1083 | if ((p = strchr (server + 1, '@')) != NULL) /* first one only */ |
1090 | if (p = strchr (server + 1, '@')) /* first one only */ |
1084 | *p = '\0'; |
1091 | *p = '\0'; |
1085 | |
1092 | |
1086 | atom = XInternAtom (dpy, server, False); |
1093 | atom = XInternAtom (dpy, server, False); |
1087 | win = XGetSelectionOwner (dpy, atom); |
1094 | win = XGetSelectionOwner (dpy, atom); |
1088 | |
1095 | |
… | |
… | |
1155 | |
1162 | |
1156 | term->make_current (); |
1163 | term->make_current (); |
1157 | |
1164 | |
1158 | if (text) |
1165 | if (text) |
1159 | { |
1166 | { |
1160 | void *str; |
1167 | wchar_t *str; |
1161 | |
1168 | |
1162 | if (!text->encoding_is_wchar && text->string.multi_byte) |
1169 | if (!text->encoding_is_wchar && text->string.multi_byte) |
1163 | { |
1170 | { |
1164 | // of course, X makes it ugly again |
1171 | // of course, X makes it ugly again |
1165 | if (term->rs[Rs_imLocale]) |
1172 | if (term->rs[Rs_imLocale]) |
1166 | SET_LOCALE (term->rs[Rs_imLocale]); |
1173 | SET_LOCALE (term->rs[Rs_imLocale]); |
1167 | |
1174 | |
1168 | str = rxvt_temp_buf ((text->length + 1) * sizeof (wchar_t)); |
1175 | str = rxvt_temp_buf<wchar_t> (text->length + 1); |
1169 | mbstowcs ((wchar_t *)str, text->string.multi_byte, text->length + 1); |
1176 | mbstowcs (str, text->string.multi_byte, text->length + 1); |
1170 | |
1177 | |
1171 | if (term->rs[Rs_imLocale]) |
1178 | if (term->rs[Rs_imLocale]) |
1172 | SET_LOCALE (term->locale); |
1179 | SET_LOCALE (term->locale); |
1173 | } |
1180 | } |
1174 | else |
1181 | else |
1175 | str = (void *)text->string.wide_char; |
1182 | str = text->string.wide_char; |
1176 | |
1183 | |
1177 | HOOK_INVOKE ((term, HOOK_XIM_PREEDIT_DRAW, |
1184 | HOOK_INVOKE ((term, HOOK_XIM_PREEDIT_DRAW, |
1178 | DT_INT, call_data->caret, |
1185 | DT_INT, call_data->caret, |
1179 | DT_INT, call_data->chg_first, |
1186 | DT_INT, call_data->chg_first, |
1180 | DT_INT, call_data->chg_length, |
1187 | DT_INT, call_data->chg_length, |