1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: command.c |
2 | * File: command.c |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * $Id: command.C,v 1.16 2003/12/17 09:00:35 pcg Exp $ |
4 | * $Id: command.C,v 1.18 2003/12/18 02:07:12 pcg Exp $ |
5 | * |
5 | * |
6 | * All portions of code are copyright by their respective author/s. |
6 | * All portions of code are copyright by their respective author/s. |
7 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
7 | * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> |
8 | * - original version |
8 | * - original version |
9 | * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> |
9 | * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> |
… | |
… | |
88 | if (R->Input_Context) |
88 | if (R->Input_Context) |
89 | { |
89 | { |
90 | Status status_return; |
90 | Status status_return; |
91 | |
91 | |
92 | #ifdef X_HAVE_UTF8_STRING |
92 | #ifdef X_HAVE_UTF8_STRING |
93 | len = Xutf8LookupString(R->Input_Context, ev, (char *)kbuf, |
93 | len = Xutf8LookupString (R->Input_Context, ev, (char *)kbuf, |
94 | KBUFSZ, &keysym, &status_return); |
94 | KBUFSZ, &keysym, &status_return); |
95 | #else |
95 | #else |
|
|
96 | wchar_t wkbuf[KBUFSZ + 1]; |
|
|
97 | |
|
|
98 | // assume wchar_t == unicode or better |
96 | len = XmbLookupString(R->Input_Context, ev, (char *)kbuf, |
99 | len = XwcLookupString (R->Input_Context, ev, wkbuf, |
97 | KBUFSZ, &keysym, &status_return); |
100 | KBUFSZ, &keysym, &status_return); |
|
|
101 | |
|
|
102 | if (status_return == XLookupChars |
|
|
103 | || status_return == XLookupBoth) |
|
|
104 | { |
|
|
105 | wkbuf[len] = 0; |
|
|
106 | len = wcstombs ((char *)kbuf, wkbuf, KBUFSZ); |
|
|
107 | } |
|
|
108 | else |
|
|
109 | len = 0; |
98 | #endif |
110 | #endif |
99 | valid_keysym = ((status_return == XLookupKeySym) |
111 | valid_keysym = status_return == XLookupKeySym |
100 | || (status_return == XLookupBoth)); |
112 | || status_return == XLookupBoth; |
101 | } |
113 | } |
102 | else |
114 | else |
103 | #endif |
115 | #endif |
104 | { |
116 | { |
105 | len = XLookupString(ev, (char *)kbuf, KBUFSZ, &keysym, &R->compose); |
117 | len = XLookupString (ev, (char *)kbuf, KBUFSZ, &keysym, &R->compose); |
106 | valid_keysym = !len; |
118 | valid_keysym = !len; |
107 | } |
119 | } |
108 | |
120 | |
109 | if (valid_keysym) |
121 | if (valid_keysym) |
110 | { |
122 | { |
… | |
… | |
1543 | */ |
1555 | */ |
1544 | if (ev->window == R->TermWin.vt) |
1556 | if (ev->window == R->TermWin.vt) |
1545 | { |
1557 | { |
1546 | #if RXVT_GRAPHICS |
1558 | #if RXVT_GRAPHICS |
1547 | if (ev->subwindow != None) |
1559 | if (ev->subwindow != None) |
1548 | rxvt_Gr_ButtonPress(ev->x, ev->y); |
1560 | rxvt_Gr_ButtonPress (ev->x, ev->y); |
1549 | else |
1561 | else |
1550 | #endif |
1562 | #endif |
1551 | { |
1563 | { |
1552 | clickintime = ev->time - R->MEvent.time < MULTICLICK_TIME; |
1564 | clickintime = ev->time - R->MEvent.time < MULTICLICK_TIME; |
1553 | if (reportmode) |
1565 | if (reportmode) |
… | |
… | |
1818 | break; |
1830 | break; |
1819 | #ifdef MOUSE_WHEEL |
1831 | #ifdef MOUSE_WHEEL |
1820 | case Button4: |
1832 | case Button4: |
1821 | case Button5: |
1833 | case Button5: |
1822 | { |
1834 | { |
1823 | int i, v; |
1835 | int i; |
|
|
1836 | page_dirn v; |
1824 | |
1837 | |
1825 | v = (ev->button == Button4) ? UP : DN; |
1838 | v = (ev->button == Button4) ? UP : DN; |
1826 | if (ev->state & ShiftMask) |
1839 | if (ev->state & ShiftMask) |
1827 | i = 1; |
1840 | i = 1; |
1828 | else if ((R->Options & Opt_mouseWheelScrollPage)) |
1841 | else if ((R->Options & Opt_mouseWheelScrollPage)) |
… | |
… | |
2003 | n = 0; |
2016 | n = 0; |
2004 | if (pchanged) { |
2017 | if (pchanged) { |
2005 | for (; n < (unsigned int)i; n++) { |
2018 | for (; n < (unsigned int)i; n++) { |
2006 | XGetWindowAttributes(R->Xdisplay, R->TermWin.parent[n], &wattr); |
2019 | XGetWindowAttributes(R->Xdisplay, R->TermWin.parent[n], &wattr); |
2007 | D_X((stderr, "InheritPixmap Checking Parent[%d]: %s", n, (wattr.depth == rootdepth && wattr.class != InputOnly) ? "OK" : "FAIL")); |
2020 | D_X((stderr, "InheritPixmap Checking Parent[%d]: %s", n, (wattr.depth == rootdepth && wattr.class != InputOnly) ? "OK" : "FAIL")); |
2008 | if (wattr.depth != rootdepth || wattr.class == InputOnly) { |
2021 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) { |
2009 | n = (int)(sizeof(R->TermWin.parent) / sizeof(Window)) + 1; |
2022 | n = (int)(sizeof(R->TermWin.parent) / sizeof(Window)) + 1; |
2010 | break; |
2023 | break; |
2011 | } |
2024 | } |
2012 | } |
2025 | } |
2013 | } |
2026 | } |
… | |
… | |
3361 | } |
3374 | } |
3362 | |
3375 | |
3363 | if ((cmd == 'T') && (nargs >= 5)) { |
3376 | if ((cmd == 'T') && (nargs >= 5)) { |
3364 | int i, len = args[4]; |
3377 | int i, len = args[4]; |
3365 | |
3378 | |
3366 | text = rxvt_malloc((len + 1) * sizeof(char)); |
3379 | text = (unsigned char *)rxvt_malloc((len + 1) * sizeof(char)); |
3367 | |
3380 | |
3368 | if (text != NULL) { |
3381 | if (text != NULL) { |
3369 | for (i = 0; i < len; i++) |
3382 | for (i = 0; i < len; i++) |
3370 | text[i] = rxvt_cmd_getc(aR); |
3383 | text[i] = rxvt_cmd_getc(aR); |
3371 | text[len] = '\0'; |
3384 | text[len] = '\0'; |