Fix crash when typing unicode characters above 7fff into text field

Can be reproduced when typing Shift+AltGr+5 into a DirectEntry on macOS.
This commit is contained in:
rdb 2018-03-29 14:17:39 +02:00
parent 63b1e44977
commit 95bffa8503
4 changed files with 6 additions and 6 deletions

View File

@ -41,7 +41,7 @@ ButtonEvent(ButtonHandle button, ButtonEvent::Type type, double time) :
*
*/
INLINE ButtonEvent::
ButtonEvent(short keycode, double time) :
ButtonEvent(int keycode, double time) :
_button(ButtonHandle::none()),
_keycode(keycode),
_highlight_start(0),

View File

@ -84,7 +84,7 @@ write_datagram(Datagram &dg) const {
break;
case T_keystroke:
dg.add_int16(_keycode);
dg.add_uint16(_keycode);
break;
case T_candidate:
@ -119,7 +119,7 @@ read_datagram(DatagramIterator &scan) {
break;
case T_keystroke:
_keycode = scan.get_int16();
_keycode = scan.get_uint16();
break;
case T_candidate:

View File

@ -86,7 +86,7 @@ public:
INLINE ButtonEvent();
INLINE ButtonEvent(ButtonHandle button, Type type, double time = ClockObject::get_global_clock()->get_frame_time());
INLINE ButtonEvent(short keycode, double time = ClockObject::get_global_clock()->get_frame_time());
INLINE ButtonEvent(int keycode, double time = ClockObject::get_global_clock()->get_frame_time());
INLINE ButtonEvent(const wstring &candidate_string, size_t highlight_start,
size_t highlight_end, size_t cursor_pos);
INLINE ButtonEvent(const ButtonEvent &copy);
@ -109,7 +109,7 @@ public:
// _keycode will be filled in if type is T_keystroke. It will be the
// Unicode character that was typed.
short _keycode;
int _keycode;
// _candidate_string will be filled in if type is T_candidate.
wstring _candidate_string;

View File

@ -74,7 +74,7 @@ PUBLISHED:
public:
ButtonHandle _button;
short _keycode;
int _keycode;
wstring _candidate_string;
size_t _highlight_start;
size_t _highlight_end;