… | |
… | |
530 | * Catch a fatal signal and tidy up before quitting |
530 | * Catch a fatal signal and tidy up before quitting |
531 | */ |
531 | */ |
532 | void |
532 | void |
533 | sig_term (sig_watcher &w) |
533 | sig_term (sig_watcher &w) |
534 | { |
534 | { |
535 | #ifdef DEBUG_CMD |
|
|
536 | rxvt_warn ("caught signal %d, exiting.\n", w.signum); |
|
|
537 | #endif |
|
|
538 | rxvt_emergency_cleanup (); |
535 | rxvt_emergency_cleanup (); |
539 | signal (w.signum, SIG_DFL); |
536 | signal (w.signum, SIG_DFL); |
540 | kill (getpid (), w.signum); |
537 | kill (getpid (), w.signum); |
541 | } |
538 | } |
542 | |
539 | |
… | |
… | |
620 | int x, y, sb_w, flags; |
617 | int x, y, sb_w, flags; |
621 | unsigned int w, h; |
618 | unsigned int w, h; |
622 | unsigned int max_width, max_height; |
619 | unsigned int max_width, max_height; |
623 | dDisp; |
620 | dDisp; |
624 | |
621 | |
625 | D_SIZE ((stderr, "< Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d", |
|
|
626 | ncol, nrow, szHint.width, szHint.height)); |
|
|
627 | |
|
|
628 | szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; |
622 | szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; |
629 | szHint.win_gravity = NorthWestGravity; |
623 | szHint.win_gravity = NorthWestGravity; |
630 | /* szHint.min_aspect.x = szHint.min_aspect.y = 1; */ |
624 | /* szHint.min_aspect.x = szHint.min_aspect.y = 1; */ |
631 | |
625 | |
632 | recalc_x = recalc_y = 0; |
626 | recalc_x = recalc_y = 0; |
… | |
… | |
734 | if (recalc_y) |
728 | if (recalc_y) |
735 | szHint.y += DisplayHeight (disp, display->screen) - szHint.height - 2 * ext_bwidth; |
729 | szHint.y += DisplayHeight (disp, display->screen) - szHint.height - 2 * ext_bwidth; |
736 | |
730 | |
737 | ncol = width / fwidth; |
731 | ncol = width / fwidth; |
738 | nrow = height / fheight; |
732 | nrow = height / fheight; |
739 | D_SIZE ((stderr, "> Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d", |
|
|
740 | ncol, nrow, szHint.width, |
|
|
741 | szHint.height)); |
|
|
742 | return; |
|
|
743 | } |
733 | } |
744 | |
734 | |
745 | /*----------------------------------------------------------------------*/ |
735 | /*----------------------------------------------------------------------*/ |
746 | /* |
736 | /* |
747 | * Tell the teletype handler what size the window is. |
737 | * Tell the teletype handler what size the window is. |
… | |
… | |
1031 | * -------------------------------------------------------------------- */ |
1021 | * -------------------------------------------------------------------- */ |
1032 | void |
1022 | void |
1033 | rxvt_term::resize_all_windows (unsigned int newwidth, unsigned int newheight, int ignoreparent) |
1023 | rxvt_term::resize_all_windows (unsigned int newwidth, unsigned int newheight, int ignoreparent) |
1034 | { |
1024 | { |
1035 | int fix_screen; |
1025 | int fix_screen; |
1036 | int old_width = szHint.width, old_height = szHint.height; |
1026 | int old_width = szHint.width; |
|
|
1027 | int old_height = szHint.height; |
1037 | dDisp; |
1028 | dDisp; |
1038 | |
1029 | |
1039 | window_calc (newwidth, newheight); |
1030 | window_calc (newwidth, newheight); |
1040 | XSetWMNormalHints (disp, parent[0], &szHint); |
1031 | XSetWMNormalHints (disp, parent[0], &szHint); |
1041 | |
1032 | |
… | |
… | |
1063 | { |
1054 | { |
1064 | x -= x1; |
1055 | x -= x1; |
1065 | y -= y1; |
1056 | y -= y1; |
1066 | } |
1057 | } |
1067 | |
1058 | |
1068 | x1 = (DisplayWidth (disp, display->screen) - old_width) / 2; |
1059 | x1 = (DisplayWidth (disp, display->screen) - old_width ) / 2; |
1069 | y1 = (DisplayHeight (disp, display->screen) - old_height) / 2; |
1060 | y1 = (DisplayHeight (disp, display->screen) - old_height) / 2; |
1070 | dx = old_width - szHint.width; |
1061 | dx = old_width - szHint.width; |
1071 | dy = old_height - szHint.height; |
1062 | dy = old_height - szHint.height; |
1072 | |
1063 | |
1073 | /* Check position of the center of the window */ |
1064 | /* Check position of the center of the window */ |
1074 | if (x < x1) /* left half */ |
1065 | if (x < x1) /* left half */ |
1075 | dx = 0; |
1066 | dx = 0; |
… | |
… | |
1108 | resize_pixmap (); |
1099 | resize_pixmap (); |
1109 | #endif |
1100 | #endif |
1110 | } |
1101 | } |
1111 | |
1102 | |
1112 | if (fix_screen || old_height == 0) |
1103 | if (fix_screen || old_height == 0) |
1113 | { |
|
|
1114 | int curr_screen = -1; |
|
|
1115 | int old_ncol = prev_ncol; |
|
|
1116 | |
|
|
1117 | /* scr_reset only works on the primary screen */ |
|
|
1118 | if (old_height) /* this is not the first time through */ |
|
|
1119 | { |
|
|
1120 | unsigned int ocol = ncol; |
|
|
1121 | ncol = prev_ncol; // save b/c scr_blank_screen_mem uses this |
|
|
1122 | curr_screen = scr_change_screen (PRIMARY); |
|
|
1123 | ncol = ocol; |
|
|
1124 | } |
|
|
1125 | |
|
|
1126 | scr_reset (); |
1104 | scr_reset (); |
1127 | |
|
|
1128 | if (curr_screen >= 0) /* this is not the first time through */ |
|
|
1129 | { |
|
|
1130 | scr_change_screen (curr_screen); |
|
|
1131 | selection_check (old_ncol != ncol ? 4 : 0); |
|
|
1132 | } |
|
|
1133 | } |
|
|
1134 | |
|
|
1135 | old_width = szHint.width; |
|
|
1136 | old_height = szHint.height; |
|
|
1137 | |
1105 | |
1138 | #ifdef XPM_BACKGROUND |
1106 | #ifdef XPM_BACKGROUND |
1139 | if (pixmap) |
1107 | if (pixmap) |
1140 | scr_touch (false); |
1108 | scr_touch (false); |
1141 | #endif |
1109 | #endif |
… | |
… | |
1295 | set_environ (envv); |
1263 | set_environ (envv); |
1296 | |
1264 | |
1297 | if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) |
1265 | if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) |
1298 | return false; |
1266 | return false; |
1299 | |
1267 | |
1300 | D_MAIN ((stderr, "rxvt_IM_get_IC ()")); |
|
|
1301 | input_method = display->get_xim (locale, modifiers); |
1268 | input_method = display->get_xim (locale, modifiers); |
1302 | if (input_method == NULL) |
1269 | if (input_method == NULL) |
1303 | return false; |
1270 | return false; |
1304 | |
1271 | |
1305 | xim = input_method->xim; |
1272 | xim = input_method->xim; |
… | |
… | |
1451 | rxvt_warn ("failed to create input context, continuing without XIM.\n"); |
1418 | rxvt_warn ("failed to create input context, continuing without XIM.\n"); |
1452 | im_destroy (); |
1419 | im_destroy (); |
1453 | return false; |
1420 | return false; |
1454 | } |
1421 | } |
1455 | |
1422 | |
|
|
1423 | if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL)) |
|
|
1424 | vt_select_input (); |
|
|
1425 | |
1456 | if (input_style & XIMPreeditArea) |
1426 | if (input_style & XIMPreeditArea) |
1457 | IMSetStatusPosition (); |
1427 | IMSetStatusPosition (); |
1458 | |
1428 | |
1459 | D_MAIN ((stderr, "rxvt_IM_get_IC () - successful connection")); |
|
|
1460 | return true; |
1429 | return true; |
1461 | } |
1430 | } |
1462 | |
1431 | |
1463 | void |
1432 | void |
1464 | rxvt_term::im_cb () |
1433 | rxvt_term::im_cb () |
… | |
… | |
1470 | |
1439 | |
1471 | make_current (); |
1440 | make_current (); |
1472 | |
1441 | |
1473 | im_destroy (); |
1442 | im_destroy (); |
1474 | |
1443 | |
1475 | D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()")); |
|
|
1476 | if (Input_Context) |
1444 | if (Input_Context) |
1477 | return; |
1445 | return; |
1478 | |
1446 | |
1479 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1447 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1480 | if (rs[Rs_imLocale]) |
1448 | if (rs[Rs_imLocale]) |