1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*----------------------------------------------------------------------* |
2 | * File: main.C |
2 | * File: main.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * All portions of code are copyright by their respective author/s. |
5 | * All portions of code are copyright by their respective author/s. |
6 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
6 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
… | |
… | |
198 | void rxvt_term::emergency_cleanup () |
198 | void rxvt_term::emergency_cleanup () |
199 | { |
199 | { |
200 | if (cmd_pid) |
200 | if (cmd_pid) |
201 | kill (-cmd_pid, SIGHUP); |
201 | kill (-cmd_pid, SIGHUP); |
202 | |
202 | |
|
|
203 | pty_ev.stop (); |
203 | delete pty; pty = 0; |
204 | delete pty; pty = 0; |
204 | } |
205 | } |
205 | |
206 | |
206 | rxvt_term::~rxvt_term () |
207 | rxvt_term::~rxvt_term () |
207 | { |
208 | { |
… | |
… | |
704 | |
705 | |
705 | if (!OPTION (Opt_scrollBar_right)) |
706 | if (!OPTION (Opt_scrollBar_right)) |
706 | window_vt_x += sb_w; |
707 | window_vt_x += sb_w; |
707 | } |
708 | } |
708 | |
709 | |
709 | szHint.width_inc = fwidth; |
710 | szHint.width_inc = fwidth; |
710 | szHint.height_inc = fheight; |
711 | szHint.height_inc = fheight; |
711 | szHint.min_width = szHint.base_width + szHint.width_inc; |
712 | szHint.min_width = szHint.base_width + szHint.width_inc; |
712 | szHint.min_height = szHint.base_height + szHint.height_inc; |
713 | szHint.min_height = szHint.base_height + szHint.height_inc; |
713 | |
714 | |
714 | if (newwidth && newwidth - szHint.base_width < max_width) |
715 | if (newwidth && newwidth - szHint.base_width < max_width) |
715 | { |
716 | { |
716 | szHint.width = newwidth; |
717 | szHint.width = newwidth; |
… | |
… | |
935 | pix_colors_focused[idx] = xcol; |
936 | pix_colors_focused[idx] = xcol; |
936 | |
937 | |
937 | /* XSetWindowAttributes attr; */ |
938 | /* XSetWindowAttributes attr; */ |
938 | /* Cursor cursor; */ |
939 | /* Cursor cursor; */ |
939 | done: |
940 | done: |
940 | |
|
|
941 | #if OFF_FOCUS_FADING |
|
|
942 | if (rs[Rs_fade]) |
|
|
943 | { |
|
|
944 | rgba c; |
|
|
945 | pix_colors [Color_fade].get (c); |
|
|
946 | pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); |
|
|
947 | } |
|
|
948 | #endif |
|
|
949 | |
|
|
950 | /*TODO: handle Color_BD, scrollbar background, etc. */ |
941 | /*TODO: handle Color_BD, scrollbar background, etc. */ |
951 | |
942 | |
|
|
943 | update_fade_color (idx); |
952 | recolour_cursor (); |
944 | recolour_cursor (); |
953 | scr_recolour (); |
945 | scr_recolour (); |
954 | } |
946 | } |
955 | |
947 | |
956 | #else |
948 | #else |
… | |
… | |
1033 | int fix_screen; |
1025 | int fix_screen; |
1034 | int old_width = szHint.width; |
1026 | int old_width = szHint.width; |
1035 | int old_height = szHint.height; |
1027 | int old_height = szHint.height; |
1036 | |
1028 | |
1037 | window_calc (newwidth, newheight); |
1029 | window_calc (newwidth, newheight); |
|
|
1030 | |
|
|
1031 | if (!HOOK_INVOKE ((this, HOOK_RESIZE_ALL_WINDOWS, DT_INT, newwidth, DT_INT, newheight, DT_END))) |
1038 | XSetWMNormalHints (dpy, parent[0], &szHint); |
1032 | XSetWMNormalHints (dpy, parent[0], &szHint); |
1039 | |
1033 | |
1040 | if (!ignoreparent) |
1034 | if (!ignoreparent) |
1041 | { |
1035 | { |
1042 | #ifdef SMART_RESIZE |
1036 | #ifdef SMART_RESIZE |
1043 | /* |
1037 | /* |
… | |
… | |
1117 | if (pixmap) |
1111 | if (pixmap) |
1118 | scr_touch (false); |
1112 | scr_touch (false); |
1119 | #endif |
1113 | #endif |
1120 | |
1114 | |
1121 | #ifdef USE_XIM |
1115 | #ifdef USE_XIM |
1122 | IMSetStatusPosition (); |
1116 | IMSetPosition (); |
1123 | #endif |
1117 | #endif |
1124 | } |
1118 | } |
1125 | |
1119 | |
1126 | /* |
1120 | /* |
1127 | * Set the width/height of the vt window in characters. Units are pixels. |
1121 | * Set the width/height of the vt window in characters. Units are pixels. |
… | |
… | |
1524 | preedit_attr, |
1518 | preedit_attr, |
1525 | status_attr ? XNStatusAttributes : NULL, |
1519 | status_attr ? XNStatusAttributes : NULL, |
1526 | status_attr, NULL); |
1520 | status_attr, NULL); |
1527 | |
1521 | |
1528 | if (preedit_attr) XFree (preedit_attr); |
1522 | if (preedit_attr) XFree (preedit_attr); |
1529 | if (status_attr) XFree (status_attr); |
1523 | if (status_attr) XFree (status_attr); |
1530 | if (fs) XFreeFontSet (dpy, fs); |
1524 | if (fs) XFreeFontSet (dpy, fs); |
1531 | |
1525 | |
1532 | if (Input_Context == NULL) |
1526 | if (Input_Context == NULL) |
1533 | { |
1527 | { |
1534 | rxvt_warn ("failed to create input context, continuing without XIM.\n"); |
1528 | rxvt_warn ("failed to create input context, continuing without XIM.\n"); |
1535 | im_destroy (); |
1529 | im_destroy (); |
… | |
… | |
1540 | // unfortunately, only the focus window is used by XIM, hard to fix |
1534 | // unfortunately, only the focus window is used by XIM, hard to fix |
1541 | if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL)) |
1535 | if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL)) |
1542 | vt_select_input (); |
1536 | vt_select_input (); |
1543 | #endif |
1537 | #endif |
1544 | |
1538 | |
1545 | if (input_style & XIMPreeditArea) |
|
|
1546 | IMSetStatusPosition (); |
1539 | IMSetPosition (); |
1547 | |
1540 | |
1548 | return true; |
1541 | return true; |
1549 | } |
1542 | } |
1550 | |
1543 | |
1551 | void |
1544 | void |
… | |
… | |
1609 | SET_LOCALE (locale); |
1602 | SET_LOCALE (locale); |
1610 | #endif |
1603 | #endif |
1611 | } |
1604 | } |
1612 | |
1605 | |
1613 | void |
1606 | void |
1614 | rxvt_term::IMSetStatusPosition () |
1607 | rxvt_term::IMSetPosition () |
1615 | { |
1608 | { |
1616 | XRectangle preedit_rect, status_rect, *needed_rect; |
1609 | XRectangle preedit_rect, status_rect, *needed_rect; |
1617 | XVaNestedList preedit_attr, status_attr; |
1610 | XVaNestedList preedit_attr, status_attr; |
1618 | |
1611 | |
1619 | if (!Input_Context |
1612 | if (!Input_Context |
1620 | || !focus |
1613 | || !focus |
1621 | || !(input_style & XIMPreeditArea) |
1614 | || !(input_style & (XIMPreeditArea | XIMPreeditPosition)) |
1622 | || !IMisRunning ()) |
1615 | || !IMisRunning ()) |
1623 | return; |
1616 | return; |
1624 | |
1617 | |
|
|
1618 | if (input_style & XIMPreeditPosition) |
|
|
1619 | { |
|
|
1620 | im_set_size (preedit_rect); |
|
|
1621 | preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL); |
|
|
1622 | |
|
|
1623 | XSetICValues (Input_Context, |
|
|
1624 | XNPreeditAttributes, preedit_attr, NULL); |
|
|
1625 | } |
|
|
1626 | else |
|
|
1627 | { |
1625 | /* Getting the necessary width of preedit area */ |
1628 | /* Getting the necessary width of preedit area */ |
1626 | status_attr = XVaCreateNestedList (0, XNAreaNeeded, &needed_rect, NULL); |
1629 | status_attr = XVaCreateNestedList (0, XNAreaNeeded, &needed_rect, NULL); |
1627 | XGetICValues (Input_Context, XNStatusAttributes, status_attr, NULL); |
1630 | XGetICValues (Input_Context, XNStatusAttributes, status_attr, NULL); |
1628 | XFree (status_attr); |
1631 | XFree (status_attr); |
1629 | |
1632 | |
1630 | im_set_preedit_area (preedit_rect, status_rect, *needed_rect); |
1633 | im_set_preedit_area (preedit_rect, status_rect, *needed_rect); |
1631 | XFree (needed_rect); |
1634 | XFree (needed_rect); |
1632 | |
1635 | |
1633 | preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL); |
1636 | preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL); |
1634 | status_attr = XVaCreateNestedList (0, XNArea, &status_rect, NULL); |
1637 | status_attr = XVaCreateNestedList (0, XNArea, &status_rect, NULL); |
1635 | |
1638 | |
1636 | XSetICValues (Input_Context, |
1639 | XSetICValues (Input_Context, |
1637 | XNPreeditAttributes, preedit_attr, |
1640 | XNPreeditAttributes, preedit_attr, |
1638 | XNStatusAttributes, status_attr, NULL); |
1641 | XNStatusAttributes, status_attr, |
|
|
1642 | NULL); |
1639 | |
1643 | |
|
|
1644 | XFree (status_attr); |
|
|
1645 | } |
|
|
1646 | |
1640 | XFree (preedit_attr); |
1647 | XFree (preedit_attr); |
1641 | XFree (status_attr); |
|
|
1642 | } |
1648 | } |
1643 | #endif /* USE_XIM */ |
1649 | #endif /* USE_XIM */ |
1644 | |
1650 | |
1645 | /*----------------------- end-of-file (C source) -----------------------*/ |
1651 | /*----------------------- end-of-file (C source) -----------------------*/ |