… | |
… | |
24 | *----------------------------------------------------------------------*/ |
24 | *----------------------------------------------------------------------*/ |
25 | |
25 | |
26 | #include "../config.h" /* NECESSARY */ |
26 | #include "../config.h" /* NECESSARY */ |
27 | #include "rxvt.h" /* NECESSARY */ |
27 | #include "rxvt.h" /* NECESSARY */ |
28 | |
28 | |
|
|
29 | #include <new> |
|
|
30 | |
|
|
31 | // alas new/delete cannot be specified as inline in C++11 (see 17.6.4.6) |
|
|
32 | void * |
|
|
33 | operator new (size_t s) |
|
|
34 | #if !ECB_CPP11 |
|
|
35 | throw (std::bad_alloc) |
|
|
36 | #endif |
|
|
37 | { |
|
|
38 | return rxvt_malloc (s); |
|
|
39 | } |
|
|
40 | |
|
|
41 | void |
|
|
42 | operator delete (void *p) |
|
|
43 | #if ECB_CPP11 |
|
|
44 | noexcept |
|
|
45 | #else |
|
|
46 | throw () |
|
|
47 | #endif |
|
|
48 | { |
|
|
49 | free (p); |
|
|
50 | } |
|
|
51 | |
29 | char * |
52 | char * |
30 | rxvt_wcstombs (const wchar_t *str, int len) |
53 | rxvt_wcstombs (const wchar_t *str, int len) |
31 | { |
54 | { |
32 | if (len < 0) len = wcslen (str); |
55 | if (len < 0) len = wcslen (str); |
33 | |
56 | |
… | |
… | |
327 | if (!p) |
350 | if (!p) |
328 | rxvt_fatal ("memory allocation failure. aborting.\n"); |
351 | rxvt_fatal ("memory allocation failure. aborting.\n"); |
329 | |
352 | |
330 | return p; |
353 | return p; |
331 | } |
354 | } |
|
|
355 | |
|
|
356 | KeySym |
|
|
357 | rxvt_XKeycodeToKeysym (Display *dpy, KeyCode code, int index) |
|
|
358 | { |
|
|
359 | int size; |
|
|
360 | KeySym *mapping = XGetKeyboardMapping (dpy, code, 1, &size); |
|
|
361 | KeySym keysym = IN_RANGE_EXC (index, 0, size) ? mapping[index] : NoSymbol; |
|
|
362 | XFree (mapping); |
|
|
363 | return keysym; |
|
|
364 | } |