… | |
… | |
25 | * - extensive modifications |
25 | * - extensive modifications |
26 | * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> |
26 | * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> |
27 | * Copyright (c) 2001 Marius Gedminas |
27 | * Copyright (c) 2001 Marius Gedminas |
28 | * - Ctrl/Mod4+Tab works like Meta+Tab (options) |
28 | * - Ctrl/Mod4+Tab works like Meta+Tab (options) |
29 | * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> |
29 | * Copyright (c) 2003 Rob McMullen <robm@flipturn.org> |
30 | * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> |
30 | * Copyright (c) 2003-2005 Marc Lehmann <pcg@goof.com> |
31 | * |
31 | * |
32 | * This program is free software; you can redistribute it and/or modify |
32 | * This program is free software; you can redistribute it and/or modify |
33 | * it under the terms of the GNU General Public License as published by |
33 | * it under the terms of the GNU General Public License as published by |
34 | * the Free Software Foundation; either version 2 of the License, or |
34 | * the Free Software Foundation; either version 2 of the License, or |
35 | * (at your option) any later version. |
35 | * (at your option) any later version. |
… | |
… | |
52 | |
52 | |
53 | #ifdef KEYSYM_RESOURCE |
53 | #ifdef KEYSYM_RESOURCE |
54 | # include "keyboard.h" |
54 | # include "keyboard.h" |
55 | #endif |
55 | #endif |
56 | |
56 | |
57 | #include <cwchar> |
|
|
58 | #include <csignal> |
57 | #include <csignal> |
59 | |
58 | |
60 | /*----------------------------------------------------------------------*/ |
59 | /*----------------------------------------------------------------------*/ |
61 | |
60 | |
62 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
61 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
… | |
… | |
118 | XK_Escape, 0x238b, |
117 | XK_Escape, 0x238b, |
119 | XK_Undo, 0x238c, |
118 | XK_Undo, 0x238c, |
120 | XK_Print, 0x2399, |
119 | XK_Print, 0x2399, |
121 | |
120 | |
122 | XK_space, 0x2423, |
121 | XK_space, 0x2423, |
|
|
122 | |
|
|
123 | #ifdef XK_KP_Begin |
|
|
124 | XK_KP_Prior, 0x21de, |
|
|
125 | XK_KP_Next, 0x21df, |
|
|
126 | XK_KP_Begin, 0x2320, |
|
|
127 | XK_KP_Insert, 0x2380, |
|
|
128 | XK_KP_Delete, 0x2326, |
123 | XK_KP_Space, 0x2422, |
129 | XK_KP_Space, 0x2422, |
|
|
130 | #endif |
124 | 0, |
131 | 0, |
125 | }; |
132 | }; |
126 | |
133 | |
127 | void |
134 | void |
128 | rxvt_term::iso14755_54 (int x, int y) |
135 | rxvt_term::iso14755_54 (int x, int y) |
… | |
… | |
277 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
284 | * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an |
278 | * escape sequence to toggle the Keypad. |
285 | * escape sequence to toggle the Keypad. |
279 | * |
286 | * |
280 | * Always permit `shift' to override the current setting |
287 | * Always permit `shift' to override the current setting |
281 | */ |
288 | */ |
282 | shft = (ev.state & ShiftMask); |
289 | shft = ev.state & ShiftMask; |
283 | ctrl = (ev.state & ControlMask); |
290 | ctrl = ev.state & ControlMask; |
284 | meta = (ev.state & ModMetaMask); |
291 | meta = ev.state & ModMetaMask; |
285 | |
292 | |
286 | if (numlock_state || (ev.state & ModNumLockMask)) |
293 | if (numlock_state || (ev.state & ModNumLockMask)) |
287 | { |
294 | { |
288 | numlock_state = (ev.state & ModNumLockMask); |
295 | numlock_state = (ev.state & ModNumLockMask); |
289 | PrivMode ((!numlock_state), PrivMode_aplKP); |
296 | PrivMode ((!numlock_state), PrivMode_aplKP); |
… | |
… | |
513 | else |
520 | else |
514 | strcpy (kbuf, key_backspace); |
521 | strcpy (kbuf, key_backspace); |
515 | break; |
522 | break; |
516 | #endif |
523 | #endif |
517 | #ifndef NO_DELETE_KEY |
524 | #ifndef NO_DELETE_KEY |
|
|
525 | # ifdef XK_KP_Prior |
|
|
526 | case XK_KP_Delete: |
|
|
527 | /* allow shift to override */ |
|
|
528 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
529 | { |
|
|
530 | strcpy (kbuf, "\033On"); |
|
|
531 | break; |
|
|
532 | } |
|
|
533 | /* FALLTHROUGH */ |
|
|
534 | # endif |
518 | case XK_Delete: |
535 | case XK_Delete: |
519 | strcpy (kbuf, key_delete); |
536 | strcpy (kbuf, key_delete); |
520 | break; |
537 | break; |
521 | #endif |
538 | #endif |
522 | case XK_Tab: |
539 | case XK_Tab: |
… | |
… | |
625 | #ifdef XK_KP_Begin |
642 | #ifdef XK_KP_Begin |
626 | case XK_KP_Begin: |
643 | case XK_KP_Begin: |
627 | strcpy (kbuf, "\033Ou"); |
644 | strcpy (kbuf, "\033Ou"); |
628 | break; |
645 | break; |
629 | |
646 | |
630 | case XK_KP_Insert: |
|
|
631 | strcpy (kbuf, "\033Op"); |
|
|
632 | break; |
|
|
633 | |
|
|
634 | case XK_KP_Delete: |
|
|
635 | strcpy (kbuf, "\033On"); |
|
|
636 | break; |
|
|
637 | #endif |
647 | #endif |
638 | case XK_KP_F1: /* "\033OP" */ |
648 | case XK_KP_F1: /* "\033OP" */ |
639 | case XK_KP_F2: /* "\033OQ" */ |
649 | case XK_KP_F2: /* "\033OQ" */ |
640 | case XK_KP_F3: /* "\033OR" */ |
650 | case XK_KP_F3: /* "\033OR" */ |
641 | case XK_KP_F4: /* "\033OS" */ |
651 | case XK_KP_F4: /* "\033OS" */ |
… | |
… | |
673 | break; |
683 | break; |
674 | |
684 | |
675 | case XK_Find: |
685 | case XK_Find: |
676 | strcpy (kbuf, "\033[1~"); |
686 | strcpy (kbuf, "\033[1~"); |
677 | break; |
687 | break; |
|
|
688 | |
|
|
689 | #ifdef XK_KP_End |
|
|
690 | case XK_KP_Insert: |
|
|
691 | /* allow shift to override */ |
|
|
692 | if ((priv_modes & PrivMode_aplKP) ? !shft : shft) |
|
|
693 | { |
|
|
694 | strcpy (kbuf, "\033Op"); |
|
|
695 | break; |
|
|
696 | } |
|
|
697 | /* FALLTHROUGH */ |
|
|
698 | #endif |
678 | case XK_Insert: |
699 | case XK_Insert: |
679 | strcpy (kbuf, "\033[2~"); |
700 | strcpy (kbuf, "\033[2~"); |
680 | break; |
701 | break; |
681 | #ifdef DXK_Remove /* support for DEC remove like key */ |
702 | #ifdef DXK_Remove /* support for DEC remove like key */ |
682 | case DXK_Remove: |
703 | case DXK_Remove: |
… | |
… | |
1309 | button_release (ev.xbutton); |
1330 | button_release (ev.xbutton); |
1310 | break; |
1331 | break; |
1311 | |
1332 | |
1312 | case ClientMessage: |
1333 | case ClientMessage: |
1313 | if (ev.xclient.format == 32 |
1334 | if (ev.xclient.format == 32 |
|
|
1335 | && ev.xclient.message_type == xa[XA_WM_PROTOCOLS] |
1314 | && (Atom)ev.xclient.data.l[0] == xa[XA_WMDELETEWINDOW]) |
1336 | && ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) |
1315 | destroy (); |
1337 | destroy (); |
|
|
1338 | #if ENABLE_XEMBED |
|
|
1339 | else if (ev.xclient.format == 32 |
|
|
1340 | && ev.xclient.message_type == xa[XA_XEMBED]) |
|
|
1341 | { |
|
|
1342 | if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) |
|
|
1343 | focus_in (); |
|
|
1344 | else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) |
|
|
1345 | focus_out (); |
|
|
1346 | } |
|
|
1347 | #endif |
1316 | #ifdef OFFIX_DND |
1348 | #ifdef OFFIX_DND |
1317 | /* OffiX Dnd (drag 'n' drop) protocol */ |
1349 | /* OffiX Dnd (drag 'n' drop) protocol */ |
1318 | else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL] |
1350 | else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL] |
1319 | && (ev.xclient.data.l[0] == DndFile |
1351 | && (ev.xclient.data.l[0] == DndFile |
1320 | || ev.xclient.data.l[0] == DndDir |
1352 | || ev.xclient.data.l[0] == DndDir |
1321 | || ev.xclient.data.l[0] == DndLink)) |
1353 | || ev.xclient.data.l[0] == DndLink)) |
1322 | { |
1354 | { |
1323 | /* Get Dnd data */ |
1355 | /* Get Dnd data */ |
1324 | Atom ActualType; |
1356 | Atom ActualType; |
1325 | int ActualFormat; |
1357 | int ActualFormat; |
1326 | unsigned char *data; |
1358 | unsigned char *data; |
… | |
… | |
1369 | break; |
1401 | break; |
1370 | } |
1402 | } |
1371 | break; |
1403 | break; |
1372 | |
1404 | |
1373 | case FocusIn: |
1405 | case FocusIn: |
1374 | if (!TermWin.focus) |
1406 | focus_in (); |
1375 | { |
|
|
1376 | TermWin.focus = 1; |
|
|
1377 | want_refresh = 1; |
|
|
1378 | #ifdef USE_XIM |
|
|
1379 | if (Input_Context != NULL) |
|
|
1380 | { |
|
|
1381 | IMSetStatusPosition (); |
|
|
1382 | XSetICFocus (Input_Context); |
|
|
1383 | } |
|
|
1384 | #endif |
|
|
1385 | #ifdef CURSOR_BLINK |
|
|
1386 | if (options & Opt_cursorBlink) |
|
|
1387 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
|
|
1388 | #endif |
|
|
1389 | #ifdef OFF_FOCUS_FADING |
|
|
1390 | if (rs[Rs_fade]) |
|
|
1391 | { |
|
|
1392 | pix_colors = pix_colors_focused; |
|
|
1393 | scr_recolour (); |
|
|
1394 | } |
|
|
1395 | #endif |
|
|
1396 | |
|
|
1397 | } |
|
|
1398 | break; |
1407 | break; |
1399 | |
1408 | |
1400 | case FocusOut: |
1409 | case FocusOut: |
1401 | if (TermWin.focus) |
1410 | focus_out (); |
1402 | { |
|
|
1403 | TermWin.focus = 0; |
|
|
1404 | want_refresh = 1; |
|
|
1405 | |
|
|
1406 | #if ENABLE_FRILLS || ISO_14755 |
|
|
1407 | iso14755buf = 0; |
|
|
1408 | #endif |
|
|
1409 | #if ENABLE_OVERLAY |
|
|
1410 | scr_overlay_off (); |
|
|
1411 | #endif |
|
|
1412 | #ifdef USE_XIM |
|
|
1413 | if (Input_Context != NULL) |
|
|
1414 | XUnsetICFocus (Input_Context); |
|
|
1415 | #endif |
|
|
1416 | #ifdef CURSOR_BLINK |
|
|
1417 | if (options & Opt_cursorBlink) |
|
|
1418 | cursor_blink_ev.stop (); |
|
|
1419 | hidden_cursor = 0; |
|
|
1420 | #endif |
|
|
1421 | #ifdef OFF_FOCUS_FADING |
|
|
1422 | if (rs[Rs_fade]) |
|
|
1423 | { |
|
|
1424 | pix_colors = pix_colors_unfocused; |
|
|
1425 | scr_recolour (); |
|
|
1426 | } |
|
|
1427 | #endif |
|
|
1428 | } |
|
|
1429 | break; |
1411 | break; |
1430 | |
1412 | |
1431 | case ConfigureNotify: |
1413 | case ConfigureNotify: |
1432 | if (ev.xconfigure.window == TermWin.parent[0]) |
1414 | if (ev.xconfigure.window == TermWin.parent[0]) |
1433 | { |
1415 | { |
… | |
… | |
1647 | scr_refresh (refresh_type); |
1629 | scr_refresh (refresh_type); |
1648 | refresh_limit = 0; |
1630 | refresh_limit = 0; |
1649 | scrollbar_show (1); |
1631 | scrollbar_show (1); |
1650 | } |
1632 | } |
1651 | break; |
1633 | break; |
|
|
1634 | } |
|
|
1635 | } |
|
|
1636 | |
|
|
1637 | void |
|
|
1638 | rxvt_term::focus_in () |
|
|
1639 | { |
|
|
1640 | if (!TermWin.focus) |
|
|
1641 | { |
|
|
1642 | TermWin.focus = 1; |
|
|
1643 | want_refresh = 1; |
|
|
1644 | #ifdef USE_XIM |
|
|
1645 | if (Input_Context != NULL) |
|
|
1646 | { |
|
|
1647 | IMSetStatusPosition (); |
|
|
1648 | XSetICFocus (Input_Context); |
|
|
1649 | } |
|
|
1650 | #endif |
|
|
1651 | #ifdef CURSOR_BLINK |
|
|
1652 | if (options & Opt_cursorBlink) |
|
|
1653 | cursor_blink_ev.start (NOW + BLINK_INTERVAL); |
|
|
1654 | #endif |
|
|
1655 | #ifdef OFF_FOCUS_FADING |
|
|
1656 | if (rs[Rs_fade]) |
|
|
1657 | { |
|
|
1658 | pix_colors = pix_colors_focused; |
|
|
1659 | scr_recolour (); |
|
|
1660 | } |
|
|
1661 | #endif |
|
|
1662 | } |
|
|
1663 | } |
|
|
1664 | |
|
|
1665 | void |
|
|
1666 | rxvt_term::focus_out () |
|
|
1667 | { |
|
|
1668 | if (TermWin.focus) |
|
|
1669 | { |
|
|
1670 | TermWin.focus = 0; |
|
|
1671 | want_refresh = 1; |
|
|
1672 | |
|
|
1673 | #if ENABLE_FRILLS || ISO_14755 |
|
|
1674 | iso14755buf = 0; |
|
|
1675 | #endif |
|
|
1676 | #if ENABLE_OVERLAY |
|
|
1677 | scr_overlay_off (); |
|
|
1678 | #endif |
|
|
1679 | #ifdef USE_XIM |
|
|
1680 | if (Input_Context != NULL) |
|
|
1681 | XUnsetICFocus (Input_Context); |
|
|
1682 | #endif |
|
|
1683 | #ifdef CURSOR_BLINK |
|
|
1684 | if (options & Opt_cursorBlink) |
|
|
1685 | cursor_blink_ev.stop (); |
|
|
1686 | hidden_cursor = 0; |
|
|
1687 | #endif |
|
|
1688 | #ifdef OFF_FOCUS_FADING |
|
|
1689 | if (rs[Rs_fade]) |
|
|
1690 | { |
|
|
1691 | pix_colors = pix_colors_unfocused; |
|
|
1692 | scr_recolour (); |
|
|
1693 | } |
|
|
1694 | #endif |
1652 | } |
1695 | } |
1653 | } |
1696 | } |
1654 | |
1697 | |
1655 | #if TRANSPARENT |
1698 | #if TRANSPARENT |
1656 | void |
1699 | void |
… | |
… | |
2581 | // some window managers resize the window early, and these programs |
2624 | // some window managers resize the window early, and these programs |
2582 | // then sometimes get the size wrong. |
2625 | // then sometimes get the size wrong. |
2583 | // unfortunately other programs are even more buggy and dislike |
2626 | // unfortunately other programs are even more buggy and dislike |
2584 | // being sent SIGWINCH, so only do it when we were in fact being |
2627 | // being sent SIGWINCH, so only do it when we were in fact being |
2585 | // resized. |
2628 | // resized. |
2586 | if (seen_resize) |
2629 | if (seen_resize && cmd_pid) |
2587 | kill (-cmd_pid, SIGWINCH); |
2630 | kill (-cmd_pid, SIGWINCH); |
2588 | } |
2631 | } |
2589 | |
2632 | |
2590 | /* Read a text string from the input buffer */ |
2633 | /* Read a text string from the input buffer */ |
2591 | unicode_t buf[UBUFSIZ]; |
2634 | unicode_t buf[UBUFSIZ]; |
… | |
… | |
3177 | { |
3220 | { |
3178 | switch (priv) |
3221 | switch (priv) |
3179 | { |
3222 | { |
3180 | case '>': |
3223 | case '>': |
3181 | if (ch == CSI_DA) /* secondary device attributes */ |
3224 | if (ch == CSI_DA) /* secondary device attributes */ |
3182 | tt_printf ("\033[>%d;%-.8s;0c", 'R', VSTRING); |
3225 | tt_printf ("\033[>%d;%c%c;0c", 'U', VERSION[0], VERSION[2]); |
3183 | break; |
3226 | break; |
3184 | case '?': |
3227 | case '?': |
3185 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3228 | if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') |
3186 | process_terminal_mode (ch, priv, nargs, arg); |
3229 | process_terminal_mode (ch, priv, nargs, arg); |
3187 | break; |
3230 | break; |