display_sdl: Make auto grab mouse optional.

Add a command line option to enable auto grab.
Default to the previous behavior before the auto grab feature was added.

Add a debugger command to enable or disable auto grab.

Notes:
Auto grab mouse currently only works for graphics controllers and guest
OSs that use a hardware cursor and only if the emulation sets
cursor_dirty to true (i.e. not emulation that uses cursor_ovl_cb).
This commit is contained in:
joevt authored and dingusdev committed 2026-08-09 21:01:00 -07:00
1 parent d542d9ef96
commit db5ab5f63c
3 files changed
+28 -1

No files matched your search

+16
View File
@@ -58,6 +58,8 @@ using namespace std;
#define COUT08X COUT0_X(8)
#define COUT04X COUT0_X(4)
extern bool g_auto_grab_mouse;
static uint32_t str2addr(string& addr_str) {
try {
return static_cast<uint32_t>(stoul(addr_str, NULL, 0));
@@ -116,6 +118,8 @@ static void show_help() {
cout << " printenv -- print current NVRAM settings." << endl;
cout << " setenv V N -- set NVRAM variable V to value N." << endl;
cout << endl;
cout << " autograbmouse H -- auto grab the mouse if H is not zero." << endl;
cout << endl;
cout << " restart -- restart the machine" << endl;
cout << " quit -- quit the debugger" << endl;
cout << endl;
@@ -1169,6 +1173,18 @@ void DppcDebugger::enter_debugger() {
via_obj->assert_int(irq_bit);
});
#endif
} else if (cmd == "autograbmouse") {
cmd = "";
string value;
int num;
ss >> value;
try {
num = str2num(value);
} catch (invalid_argument& exc) {
cout << exc.what() << endl;
continue;
}
g_auto_grab_mouse = num;
} else {
if (!cmd.empty()) {
cout << "Unknown command: " << cmd << endl;