diff options
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/natkeyboard.cpp | 35 | ||||
-rw-r--r-- | src/emu/natkeyboard.h | 3 | ||||
-rw-r--r-- | src/emu/video.cpp | 2 | ||||
-rw-r--r-- | src/emu/video.h | 2 |
4 files changed, 40 insertions, 2 deletions
diff --git a/src/emu/natkeyboard.cpp b/src/emu/natkeyboard.cpp index 9a50109eb6f..17782815d22 100644 --- a/src/emu/natkeyboard.cpp +++ b/src/emu/natkeyboard.cpp @@ -486,6 +486,13 @@ void natural_keyboard::post_utf8(const char *text, size_t length, const attotime } +void natural_keyboard::post_utf8(const std::string &text, const attotime &rate) +{ + if (!text.empty()) + post_utf8(text.c_str(), text.size(), rate); +} + + //------------------------------------------------- // post_coded - post a coded string //------------------------------------------------- @@ -564,6 +571,34 @@ void natural_keyboard::post_coded(const char *text, size_t length, const attotim } +void natural_keyboard::post_coded(const std::string &text, const attotime &rate) +{ + if (!text.empty()) + post_coded(text.c_str(), text.size(), rate); +} + + +//------------------------------------------------- +// 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 diff --git a/src/emu/natkeyboard.h b/src/emu/natkeyboard.h index aa29bf4503c..fa3df156285 100644 --- a/src/emu/natkeyboard.h +++ b/src/emu/natkeyboard.h @@ -53,7 +53,10 @@ public: void post(char32_t ch); 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_utf8(const std::string &text, const attotime &rate = attotime::zero); void post_coded(const char *text, size_t length = 0, const attotime &rate = attotime::zero); + void post_coded(const std::string &text, const attotime &rate = attotime::zero); + void paste(); // debugging void dump(std::ostream &str) const; diff --git a/src/emu/video.cpp b/src/emu/video.cpp index c4ade5f7948..2c1617e4fb2 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -788,7 +788,7 @@ inline bool video_manager::effective_autoframeskip() const // forward //------------------------------------------------- -inline int video_manager::effective_frameskip() const +int video_manager::effective_frameskip() const { // if we're fast forwarding, use the maximum frameskip if (m_fastforward) diff --git a/src/emu/video.h b/src/emu/video.h index a5f76fa81f1..aa5390fd579 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -83,6 +83,7 @@ public: // current speed helpers std::string speed_text(); double speed_percent() const { return m_speed_percent; } + int effective_frameskip() const; // snapshots void save_snapshot(screen_device *screen, emu_file &file); @@ -117,7 +118,6 @@ private: // effective value helpers bool effective_autoframeskip() const; - int effective_frameskip() const; bool effective_throttle() const; // speed and throttling helpers |