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 | { |
… | |
… | |
1119 | if (pixmap) |
1120 | if (pixmap) |
1120 | scr_touch (false); |
1121 | scr_touch (false); |
1121 | #endif |
1122 | #endif |
1122 | |
1123 | |
1123 | #ifdef USE_XIM |
1124 | #ifdef USE_XIM |
1124 | IMSetStatusPosition (); |
1125 | IMSetPosition (); |
1125 | #endif |
1126 | #endif |
1126 | } |
1127 | } |
1127 | |
1128 | |
1128 | /* |
1129 | /* |
1129 | * Set the width/height of the vt window in characters. Units are pixels. |
1130 | * Set the width/height of the vt window in characters. Units are pixels. |
… | |
… | |
1526 | preedit_attr, |
1527 | preedit_attr, |
1527 | status_attr ? XNStatusAttributes : NULL, |
1528 | status_attr ? XNStatusAttributes : NULL, |
1528 | status_attr, NULL); |
1529 | status_attr, NULL); |
1529 | |
1530 | |
1530 | if (preedit_attr) XFree (preedit_attr); |
1531 | if (preedit_attr) XFree (preedit_attr); |
1531 | if (status_attr) XFree (status_attr); |
1532 | if (status_attr) XFree (status_attr); |
1532 | if (fs) XFreeFontSet (dpy, fs); |
1533 | if (fs) XFreeFontSet (dpy, fs); |
1533 | |
1534 | |
1534 | if (Input_Context == NULL) |
1535 | if (Input_Context == NULL) |
1535 | { |
1536 | { |
1536 | rxvt_warn ("failed to create input context, continuing without XIM.\n"); |
1537 | rxvt_warn ("failed to create input context, continuing without XIM.\n"); |
1537 | im_destroy (); |
1538 | im_destroy (); |
… | |
… | |
1542 | // unfortunately, only the focus window is used by XIM, hard to fix |
1543 | // unfortunately, only the focus window is used by XIM, hard to fix |
1543 | if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL)) |
1544 | if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL)) |
1544 | vt_select_input (); |
1545 | vt_select_input (); |
1545 | #endif |
1546 | #endif |
1546 | |
1547 | |
1547 | if (input_style & XIMPreeditArea) |
|
|
1548 | IMSetStatusPosition (); |
1548 | IMSetPosition (); |
1549 | |
1549 | |
1550 | return true; |
1550 | return true; |
1551 | } |
1551 | } |
1552 | |
1552 | |
1553 | void |
1553 | void |
… | |
… | |
1611 | SET_LOCALE (locale); |
1611 | SET_LOCALE (locale); |
1612 | #endif |
1612 | #endif |
1613 | } |
1613 | } |
1614 | |
1614 | |
1615 | void |
1615 | void |
1616 | rxvt_term::IMSetStatusPosition () |
1616 | rxvt_term::IMSetPosition () |
1617 | { |
1617 | { |
1618 | XRectangle preedit_rect, status_rect, *needed_rect; |
1618 | XRectangle preedit_rect, status_rect, *needed_rect; |
1619 | XVaNestedList preedit_attr, status_attr; |
1619 | XVaNestedList preedit_attr, status_attr; |
1620 | |
1620 | |
1621 | if (!Input_Context |
1621 | if (!Input_Context |
1622 | || !focus |
1622 | || !focus |
1623 | || !(input_style & XIMPreeditArea) |
1623 | || !(input_style & (XIMPreeditArea | XIMPreeditPosition)) |
1624 | || !IMisRunning ()) |
1624 | || !IMisRunning ()) |
1625 | return; |
1625 | return; |
1626 | |
1626 | |
|
|
1627 | if (input_style & XIMPreeditPosition) |
|
|
1628 | { |
|
|
1629 | im_set_size (preedit_rect); |
|
|
1630 | preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL); |
|
|
1631 | |
|
|
1632 | XSetICValues (Input_Context, |
|
|
1633 | XNPreeditAttributes, preedit_attr, NULL); |
|
|
1634 | } |
|
|
1635 | else |
|
|
1636 | { |
1627 | /* Getting the necessary width of preedit area */ |
1637 | /* Getting the necessary width of preedit area */ |
1628 | status_attr = XVaCreateNestedList (0, XNAreaNeeded, &needed_rect, NULL); |
1638 | status_attr = XVaCreateNestedList (0, XNAreaNeeded, &needed_rect, NULL); |
1629 | XGetICValues (Input_Context, XNStatusAttributes, status_attr, NULL); |
1639 | XGetICValues (Input_Context, XNStatusAttributes, status_attr, NULL); |
1630 | XFree (status_attr); |
1640 | XFree (status_attr); |
1631 | |
1641 | |
1632 | im_set_preedit_area (preedit_rect, status_rect, *needed_rect); |
1642 | im_set_preedit_area (preedit_rect, status_rect, *needed_rect); |
1633 | XFree (needed_rect); |
1643 | XFree (needed_rect); |
1634 | |
1644 | |
1635 | preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL); |
1645 | preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL); |
1636 | status_attr = XVaCreateNestedList (0, XNArea, &status_rect, NULL); |
1646 | status_attr = XVaCreateNestedList (0, XNArea, &status_rect, NULL); |
1637 | |
1647 | |
1638 | XSetICValues (Input_Context, |
1648 | XSetICValues (Input_Context, |
1639 | XNPreeditAttributes, preedit_attr, |
1649 | XNPreeditAttributes, preedit_attr, |
1640 | XNStatusAttributes, status_attr, NULL); |
1650 | XNStatusAttributes, status_attr, |
|
|
1651 | NULL); |
1641 | |
1652 | |
|
|
1653 | XFree (status_attr); |
|
|
1654 | } |
|
|
1655 | |
1642 | XFree (preedit_attr); |
1656 | XFree (preedit_attr); |
1643 | XFree (status_attr); |
|
|
1644 | } |
1657 | } |
1645 | #endif /* USE_XIM */ |
1658 | #endif /* USE_XIM */ |
1646 | |
1659 | |
1647 | /*----------------------- end-of-file (C source) -----------------------*/ |
1660 | /*----------------------- end-of-file (C source) -----------------------*/ |