… | |
… | |
48 | #include "../config.h" /* NECESSARY */ |
48 | #include "../config.h" /* NECESSARY */ |
49 | #include "rxvt.h" /* NECESSARY */ |
49 | #include "rxvt.h" /* NECESSARY */ |
50 | #include "version.h" |
50 | #include "version.h" |
51 | #include "command.h" |
51 | #include "command.h" |
52 | |
52 | |
53 | #include <wchar.h> |
53 | #include <cwchar> |
54 | #include <signal.h> |
54 | #include <csignal> |
55 | |
55 | |
56 | /*----------------------------------------------------------------------*/ |
56 | /*----------------------------------------------------------------------*/ |
57 | |
57 | |
58 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
58 | #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) |
59 | |
59 | |
… | |
… | |
488 | #endif |
488 | #endif |
489 | |
489 | |
490 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
490 | if (keysym >= 0xFF00 && keysym <= 0xFFFF) |
491 | { |
491 | { |
492 | #ifdef KEYSYM_RESOURCE |
492 | #ifdef KEYSYM_RESOURCE |
493 | if (! (shft | ctrl) && Keysym_map[keysym & 0xFF] != NULL) |
493 | if (!(shft | ctrl) && Keysym_map[keysym & 0xFF] != NULL) |
494 | { |
494 | { |
495 | unsigned int l; |
495 | unsigned int l; |
496 | const unsigned char *kbuf0; |
496 | const unsigned char *kbuf0; |
497 | |
497 | |
498 | kbuf0 = (Keysym_map[keysym & 0xFF]); |
498 | kbuf0 = (Keysym_map[keysym & 0xFF]); |
… | |
… | |
785 | case XK_F35: /* "\033[49~" */ |
785 | case XK_F35: /* "\033[49~" */ |
786 | FKEY (31, XK_F17); |
786 | FKEY (31, XK_F17); |
787 | break; |
787 | break; |
788 | #undef FKEY |
788 | #undef FKEY |
789 | default: |
789 | default: |
790 | newlen = 0; |
790 | if (len == 0 |
791 | break; |
791 | && (keysym & 0xfff0) != 0xff70 |
|
|
792 | && (keysym & 0xfff0) != 0xffe0) |
|
|
793 | /* generate a keycode for every remaining keypress */ |
|
|
794 | sprintf ((char *)kbuf, "\033[%x;%xA", (unsigned char)ev.state, (unsigned short)keysym); |
792 | } |
795 | } |
|
|
796 | |
793 | if (newlen) |
797 | if (newlen) |
794 | len = strlen (kbuf); |
798 | len = strlen (kbuf); |
795 | } |
799 | } |
796 | |
800 | |
797 | /* |
801 | /* |
… | |
… | |
805 | } |
809 | } |
806 | else if (ctrl && keysym == XK_minus) |
810 | else if (ctrl && keysym == XK_minus) |
807 | { |
811 | { |
808 | len = 1; |
812 | len = 1; |
809 | kbuf[0] = '\037'; /* Ctrl-Minus generates ^_ (31) */ |
813 | kbuf[0] = '\037'; /* Ctrl-Minus generates ^_ (31) */ |
|
|
814 | } |
|
|
815 | else if (keysym == XK_ISO_Left_Tab) |
|
|
816 | { |
|
|
817 | strcpy (kbuf, "\033[Z"); |
|
|
818 | len = 3; |
|
|
819 | } |
|
|
820 | else if (len == 0 |
|
|
821 | && (keysym & 0xffe0) != 0xfe00 |
|
|
822 | && (keysym < 0xfe50 || keysym > 0xfe6f)) |
|
|
823 | { |
|
|
824 | /* generate a keycode for every remaining keypress */ |
|
|
825 | len = sprintf ((char *)kbuf, "\033[%x;%xA", (unsigned char)ev.state, (unsigned short)keysym); |
810 | } |
826 | } |
811 | else |
827 | else |
812 | { |
828 | { |
813 | #ifdef META8_OPTION |
829 | #ifdef META8_OPTION |
814 | /* set 8-bit on */ |
830 | /* set 8-bit on */ |
… | |
… | |
1668 | case PropertyNotify: |
1684 | case PropertyNotify: |
1669 | /* |
1685 | /* |
1670 | * if user used some Esetroot compatible prog to set the root bg, |
1686 | * if user used some Esetroot compatible prog to set the root bg, |
1671 | * use the property to determine the pixmap. We use it later on. |
1687 | * use the property to determine the pixmap. We use it later on. |
1672 | */ |
1688 | */ |
1673 | if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID] |
1689 | if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID] |
1674 | || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID]) |
1690 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1675 | return; |
1691 | return; |
1676 | |
1692 | |
1677 | /* FALLTHROUGH */ |
1693 | /* FALLTHROUGH */ |
1678 | case ReparentNotify: |
1694 | case ReparentNotify: |
1679 | if ((options & Opt_transparent) && check_our_parents () && am_transparent) |
1695 | if ((options & Opt_transparent) && check_our_parents () && am_transparent) |
… | |
… | |
2707 | if (len == (size_t)-1) |
2723 | if (len == (size_t)-1) |
2708 | return *cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2724 | return *cmdbuf_ptr++; // the _occasional_ latin1 character is allowed to slip through |
2709 | |
2725 | |
2710 | // assume wchar == unicode |
2726 | // assume wchar == unicode |
2711 | cmdbuf_ptr += len; |
2727 | cmdbuf_ptr += len; |
2712 | return wc; |
2728 | return wc & UNICODE_MASK; |
2713 | } |
2729 | } |
2714 | |
2730 | |
2715 | return NOCHAR; |
2731 | return NOCHAR; |
2716 | } |
2732 | } |
2717 | |
2733 | |