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 | { |
… | |
… | |
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 |
… | |
… | |
1119 | if (pixmap) |
1111 | if (pixmap) |
1120 | scr_touch (false); |
1112 | scr_touch (false); |
1121 | #endif |
1113 | #endif |
1122 | |
1114 | |
1123 | #ifdef USE_XIM |
1115 | #ifdef USE_XIM |
1124 | IMSetStatusPosition (); |
1116 | IMSetPosition (); |
1125 | #endif |
1117 | #endif |
1126 | } |
1118 | } |
1127 | |
1119 | |
1128 | /* |
1120 | /* |
1129 | * 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. |
… | |
… | |
1526 | preedit_attr, |
1518 | preedit_attr, |
1527 | status_attr ? XNStatusAttributes : NULL, |
1519 | status_attr ? XNStatusAttributes : NULL, |
1528 | status_attr, NULL); |
1520 | status_attr, NULL); |
1529 | |
1521 | |
1530 | if (preedit_attr) XFree (preedit_attr); |
1522 | if (preedit_attr) XFree (preedit_attr); |
1531 | if (status_attr) XFree (status_attr); |
1523 | if (status_attr) XFree (status_attr); |
1532 | if (fs) XFreeFontSet (dpy, fs); |
1524 | if (fs) XFreeFontSet (dpy, fs); |
1533 | |
1525 | |
1534 | if (Input_Context == NULL) |
1526 | if (Input_Context == NULL) |
1535 | { |
1527 | { |
1536 | rxvt_warn ("failed to create input context, continuing without XIM.\n"); |
1528 | rxvt_warn ("failed to create input context, continuing without XIM.\n"); |
1537 | im_destroy (); |
1529 | im_destroy (); |
… | |
… | |
1542 | // 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 |
1543 | if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL)) |
1535 | if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL)) |
1544 | vt_select_input (); |
1536 | vt_select_input (); |
1545 | #endif |
1537 | #endif |
1546 | |
1538 | |
1547 | if (input_style & XIMPreeditArea) |
|
|
1548 | IMSetStatusPosition (); |
1539 | IMSetPosition (); |
1549 | |
1540 | |
1550 | return true; |
1541 | return true; |
1551 | } |
1542 | } |
1552 | |
1543 | |
1553 | void |
1544 | void |
… | |
… | |
1611 | SET_LOCALE (locale); |
1602 | SET_LOCALE (locale); |
1612 | #endif |
1603 | #endif |
1613 | } |
1604 | } |
1614 | |
1605 | |
1615 | void |
1606 | void |
1616 | rxvt_term::IMSetStatusPosition () |
1607 | rxvt_term::IMSetPosition () |
1617 | { |
1608 | { |
1618 | XRectangle preedit_rect, status_rect, *needed_rect; |
1609 | XRectangle preedit_rect, status_rect, *needed_rect; |
1619 | XVaNestedList preedit_attr, status_attr; |
1610 | XVaNestedList preedit_attr, status_attr; |
1620 | |
1611 | |
1621 | if (!Input_Context |
1612 | if (!Input_Context |
1622 | || !focus |
1613 | || !focus |
1623 | || !(input_style & XIMPreeditArea) |
1614 | || !(input_style & (XIMPreeditArea | XIMPreeditPosition)) |
1624 | || !IMisRunning ()) |
1615 | || !IMisRunning ()) |
1625 | return; |
1616 | return; |
1626 | |
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 | { |
1627 | /* Getting the necessary width of preedit area */ |
1628 | /* Getting the necessary width of preedit area */ |
1628 | status_attr = XVaCreateNestedList (0, XNAreaNeeded, &needed_rect, NULL); |
1629 | status_attr = XVaCreateNestedList (0, XNAreaNeeded, &needed_rect, NULL); |
1629 | XGetICValues (Input_Context, XNStatusAttributes, status_attr, NULL); |
1630 | XGetICValues (Input_Context, XNStatusAttributes, status_attr, NULL); |
1630 | XFree (status_attr); |
1631 | XFree (status_attr); |
1631 | |
1632 | |
1632 | im_set_preedit_area (preedit_rect, status_rect, *needed_rect); |
1633 | im_set_preedit_area (preedit_rect, status_rect, *needed_rect); |
1633 | XFree (needed_rect); |
1634 | XFree (needed_rect); |
1634 | |
1635 | |
1635 | preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL); |
1636 | preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL); |
1636 | status_attr = XVaCreateNestedList (0, XNArea, &status_rect, NULL); |
1637 | status_attr = XVaCreateNestedList (0, XNArea, &status_rect, NULL); |
1637 | |
1638 | |
1638 | XSetICValues (Input_Context, |
1639 | XSetICValues (Input_Context, |
1639 | XNPreeditAttributes, preedit_attr, |
1640 | XNPreeditAttributes, preedit_attr, |
1640 | XNStatusAttributes, status_attr, NULL); |
1641 | XNStatusAttributes, status_attr, |
|
|
1642 | NULL); |
1641 | |
1643 | |
|
|
1644 | XFree (status_attr); |
|
|
1645 | } |
|
|
1646 | |
1642 | XFree (preedit_attr); |
1647 | XFree (preedit_attr); |
1643 | XFree (status_attr); |
|
|
1644 | } |
1648 | } |
1645 | #endif /* USE_XIM */ |
1649 | #endif /* USE_XIM */ |
1646 | |
1650 | |
1647 | /*----------------------- end-of-file (C source) -----------------------*/ |
1651 | /*----------------------- end-of-file (C source) -----------------------*/ |