diff options
author | 2019-07-19 07:47:24 -0400 | |
---|---|---|
committer | 2019-07-19 09:29:23 -0400 | |
commit | 3aa9ee49927cd39b1dd7c06eaa1f4851ebf69b08 (patch) | |
tree | 7c509da5184cc10023248ad6db25fed6af704c7b /src/emu | |
parent | a0ca0e8e7d2ba3f9c86436bb025a2db7f35cc5e6 (diff) |
Moving paste() from mame_ui_manager class to natural_keyboard class,
exposing to LUA
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/natkeyboard.cpp | 21 | ||||
-rw-r--r-- | src/emu/natkeyboard.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/emu/natkeyboard.cpp b/src/emu/natkeyboard.cpp index 9a50109eb6f..3851d98719e 100644 --- a/src/emu/natkeyboard.cpp +++ b/src/emu/natkeyboard.cpp @@ -565,6 +565,27 @@ void natural_keyboard::post_coded(const char *text, size_t length, const attotim //------------------------------------------------- +// paste - does a paste from the keyboard +//------------------------------------------------- + +void natural_keyboard::paste() +{ + // retrieve the clipboard text + char *text = osd_get_clipboard_text(); + + // was a result returned? + if (text != nullptr) + { + // post the text + post_utf8(text); + + // free the string + free(text); + } +} + + +//------------------------------------------------- // build_codes - given an input port table, create // an input code table useful for mapping unicode // chars diff --git a/src/emu/natkeyboard.h b/src/emu/natkeyboard.h index aa29bf4503c..b90eeb9d88e 100644 --- a/src/emu/natkeyboard.h +++ b/src/emu/natkeyboard.h @@ -54,6 +54,7 @@ public: void post(const char32_t *text, size_t length = 0, const attotime &rate = attotime::zero); void post_utf8(const char *text, size_t length = 0, const attotime &rate = attotime::zero); void post_coded(const char *text, size_t length = 0, const attotime &rate = attotime::zero); + void paste(); // debugging void dump(std::ostream &str) const; |