summaryrefslogtreecommitdiffstats
path: root/src/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/mame/luaengine.cpp19
-rw-r--r--src/frontend/mame/ui/ui.cpp23
-rw-r--r--src/frontend/mame/ui/ui.h1
3 files changed, 20 insertions, 23 deletions
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp
index 9a374f66095..1a9e5c1a389 100644
--- a/src/frontend/mame/luaengine.cpp
+++ b/src/frontend/mame/luaengine.cpp
@@ -1671,6 +1671,7 @@ void lua_engine::initialize()
sol().registry().new_usertype<ioport_manager>("ioport", "new", sol::no_constructor,
"count_players", &ioport_manager::count_players,
+ "natkeyboard", &ioport_manager::natkeyboard,
"ports", sol::property([this](ioport_manager &im) {
sol::table port_table = sol().create_table();
for (auto &port : im.ports())
@@ -1678,6 +1679,23 @@ void lua_engine::initialize()
return port_table;
}));
+/* natkeyboard library
+ *
+ * manager:machine():ioport():natkeyboard()
+ *
+ * natkeyboard.empty - is the natural keyboard buffer empty?
+ * natkeyboard.in_use - is the natural keyboard in use?
+ * natkeyboard:paste() - paste clipboard data
+ * natkeyboard:post() - post data to natural keyboard
+ * natkeyboard:post_coded() - post data to natural keyboard
+ */
+
+ sol().registry().new_usertype<natural_keyboard>("natkeyboard", "new", sol::no_constructor,
+ "empty", sol::property(&natural_keyboard::empty),
+ "in_use", sol::property(&natural_keyboard::in_use, &natural_keyboard::set_in_use),
+ "paste", &natural_keyboard::paste,
+ "post", [](natural_keyboard &nat, const std::string &text) { nat.post_utf8(text); },
+ "post_coded", [](natural_keyboard &nat, const std::string &text) { nat.post_coded(text); });
/* ioport_port library
*
@@ -1850,6 +1868,7 @@ void lua_engine::initialize()
"skip_this_frame", &video_manager::skip_this_frame,
"speed_factor", &video_manager::speed_factor,
"speed_percent", &video_manager::speed_percent,
+ "effective_frameskip", &video_manager::effective_frameskip,
"frame_update", &video_manager::frame_update,
"size", [](video_manager &vm) {
s32 width, height;
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index a0b55307dc6..20badec3162 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -915,27 +915,6 @@ bool mame_ui_manager::can_paste()
//-------------------------------------------------
-// paste - does a paste from the keyboard
-//-------------------------------------------------
-
-void mame_ui_manager::paste()
-{
- // retrieve the clipboard text
- char *text = osd_get_clipboard_text();
-
- // was a result returned?
- if (text != nullptr)
- {
- // post the text
- machine().ioport().natkeyboard().post_utf8(text);
-
- // free the string
- free(text);
- }
-}
-
-
-//-------------------------------------------------
// draw_fps_counter
//-------------------------------------------------
@@ -1115,7 +1094,7 @@ uint32_t mame_ui_manager::handler_ingame(render_container &container)
{
// paste command
if (machine().ui_input().pressed(IPT_UI_PASTE))
- paste();
+ machine().ioport().natkeyboard().paste();
}
image_handler_ingame();
diff --git a/src/frontend/mame/ui/ui.h b/src/frontend/mame/ui/ui.h
index 9f37485e260..6367fa5a54f 100644
--- a/src/frontend/mame/ui/ui.h
+++ b/src/frontend/mame/ui/ui.h
@@ -203,7 +203,6 @@ public:
void show_mouse(bool status);
virtual bool is_menu_active() override;
bool can_paste();
- void paste();
void image_handler_ingame();
void increase_frameskip();
void decrease_frameskip();