mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
Fix for UI Paste with the Default Serial Terminal (#6648)
* This fixes the ability for one to use UI Paste with the Default Serial Terminal. Without this fix, 8 characters @^&()\:" cannot be pasted from the UI.
This commit is contained in:
parent
c7251935a7
commit
8ff84bc0c9
@ -661,7 +661,6 @@ INPUT_PORTS_START(matrix_dk)
|
|||||||
INPUT_PORTS_END
|
INPUT_PORTS_END
|
||||||
|
|
||||||
INPUT_PORTS_START(matrix_ch)
|
INPUT_PORTS_START(matrix_ch)
|
||||||
// FIXME: natural keyboard doesn't play nicely with PORT_CONDITION, but it's an issue with natural keyboard itself
|
|
||||||
PORT_INCLUDE(matrix_common)
|
PORT_INCLUDE(matrix_common)
|
||||||
|
|
||||||
PORT_START("CFG")
|
PORT_START("CFG")
|
||||||
|
@ -644,13 +644,11 @@ void natural_keyboard::build_codes(ioport_manager &manager)
|
|||||||
{
|
{
|
||||||
if (((code < UCHAR_SHIFT_BEGIN) || (code > UCHAR_SHIFT_END)) && (code != 0))
|
if (((code < UCHAR_SHIFT_BEGIN) || (code > UCHAR_SHIFT_END)) && (code != 0))
|
||||||
{
|
{
|
||||||
// prefer lowest shift state
|
|
||||||
keycode_map::iterator const found(m_keycode_map.find(code));
|
keycode_map::iterator const found(m_keycode_map.find(code));
|
||||||
if ((m_keycode_map.end() == found) || (found->second.shift > curshift))
|
|
||||||
{
|
|
||||||
keycode_map_entry newcode;
|
keycode_map_entry newcode;
|
||||||
std::fill(std::begin(newcode.field), std::end(newcode.field), nullptr);
|
std::fill(std::begin(newcode.field), std::end(newcode.field), nullptr);
|
||||||
newcode.shift = curshift;
|
newcode.shift = curshift;
|
||||||
|
newcode.condition = field.condition();
|
||||||
|
|
||||||
unsigned fieldnum = 0;
|
unsigned fieldnum = 0;
|
||||||
for (unsigned i = 0, bits = curshift; (i < SHIFT_COUNT) && bits; ++i, bits >>= 1)
|
for (unsigned i = 0, bits = curshift; (i < SHIFT_COUNT) && bits; ++i, bits >>= 1)
|
||||||
@ -661,9 +659,13 @@ void natural_keyboard::build_codes(ioport_manager &manager)
|
|||||||
|
|
||||||
newcode.field[fieldnum] = &field;
|
newcode.field[fieldnum] = &field;
|
||||||
if (m_keycode_map.end() == found)
|
if (m_keycode_map.end() == found)
|
||||||
m_keycode_map.emplace(code, newcode);
|
{
|
||||||
|
keycode_map_list map_list;
|
||||||
|
map_list.emplace_back(newcode);
|
||||||
|
m_keycode_map.emplace(code, map_list);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
found->second = newcode;
|
found->second.emplace_back(newcode);
|
||||||
|
|
||||||
if (LOG_NATURAL_KEYBOARD)
|
if (LOG_NATURAL_KEYBOARD)
|
||||||
{
|
{
|
||||||
@ -677,7 +679,6 @@ void natural_keyboard::build_codes(ioport_manager &manager)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -879,7 +880,13 @@ std::string natural_keyboard::unicode_to_string(char32_t ch) const
|
|||||||
const natural_keyboard::keycode_map_entry *natural_keyboard::find_code(char32_t ch) const
|
const natural_keyboard::keycode_map_entry *natural_keyboard::find_code(char32_t ch) const
|
||||||
{
|
{
|
||||||
keycode_map::const_iterator const found(m_keycode_map.find(ch));
|
keycode_map::const_iterator const found(m_keycode_map.find(ch));
|
||||||
return (m_keycode_map.end() != found) ? &found->second : nullptr;
|
if (m_keycode_map.end() == found) return nullptr;
|
||||||
|
for(const keycode_map_entry &entry : found->second)
|
||||||
|
{
|
||||||
|
if (entry.condition.eval())
|
||||||
|
return &entry;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -901,14 +908,17 @@ void natural_keyboard::dump(std::ostream &str) const
|
|||||||
// pad with spaces
|
// pad with spaces
|
||||||
util::stream_format(str, "%-*s", left_column_width, description);
|
util::stream_format(str, "%-*s", left_column_width, description);
|
||||||
|
|
||||||
|
for (auto &entry : code.second)
|
||||||
|
{
|
||||||
// identify the keys used
|
// identify the keys used
|
||||||
for (std::size_t field = 0; (code.second.field.size() > field) && code.second.field[field]; ++field)
|
for (std::size_t field = 0; (entry.field.size() > field) && entry.field[field]; ++field)
|
||||||
util::stream_format(str, "%s'%s'", first ? "" : ", ", code.second.field[field]->name());
|
util::stream_format(str, "%s'%s'", first ? "" : ", ", entry.field[field]->name());
|
||||||
|
|
||||||
// carriage return
|
// carriage return
|
||||||
str << '\n';
|
str << '\n';
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,8 +74,10 @@ private:
|
|||||||
{
|
{
|
||||||
std::array<ioport_field *, SHIFT_COUNT + 1> field;
|
std::array<ioport_field *, SHIFT_COUNT + 1> field;
|
||||||
unsigned shift;
|
unsigned shift;
|
||||||
|
ioport_condition condition;
|
||||||
};
|
};
|
||||||
typedef std::unordered_map<char32_t, keycode_map_entry> keycode_map;
|
typedef std::list<keycode_map_entry> keycode_map_list;
|
||||||
|
typedef std::unordered_map<char32_t, keycode_map_list> keycode_map;
|
||||||
|
|
||||||
// internal helpers
|
// internal helpers
|
||||||
void build_codes(ioport_manager &manager);
|
void build_codes(ioport_manager &manager);
|
||||||
|
Loading…
Reference in New Issue
Block a user