From a6a78b7185636ebb036c9566d354d56b997fc484 Mon Sep 17 00:00:00 2001 From: mfranz Date: Thu, 8 May 2008 10:07:51 +0000 Subject: [PATCH] - rename fgcommand "set-mouse" to "set-cursor" - write new {x,y} coords to /devices/status/mice/mouse/{x,y}, so that they are immediately available --- src/Main/fg_commands.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx index 56eb29fcf..34bc4a286 100644 --- a/src/Main/fg_commands.cxx +++ b/src/Main/fg_commands.cxx @@ -1151,15 +1151,19 @@ do_gui_redraw (const SGPropertyNode * arg) /** - * Set mouse coordinates and cursor. + * Set mouse cursor coordinates and cursor shape. */ static bool -do_set_mouse (const SGPropertyNode * arg) +do_set_cursor (const SGPropertyNode * arg) { if (arg->hasValue("x") || arg->hasValue("y")) { - int x = arg->getIntValue("x", fgGetInt("/devices/status/mice/mouse/x")); - int y = arg->getIntValue("y", fgGetInt("/devices/status/mice/mouse/y")); + SGPropertyNode *mx = fgGetNode("/devices/status/mice/mouse/x", true); + SGPropertyNode *my = fgGetNode("/devices/status/mice/mouse/y", true); + int x = arg->getIntValue("x", mx->getIntValue()); + int y = arg->getIntValue("y", my->getIntValue()); fgWarpMouse(x, y); + mx->setIntValue(x); + my->setIntValue(y); } SGPropertyNode *cursor = const_cast(arg)->getNode("cursor", true); @@ -1473,7 +1477,7 @@ static struct { { "dialog-update", do_dialog_update }, { "dialog-apply", do_dialog_apply }, { "gui-redraw", do_gui_redraw }, - { "set-mouse", do_set_mouse }, + { "set-cursor", do_set_cursor }, { "play-audio-sample", do_play_audio_sample }, { "presets-commit", do_presets_commit }, { "log-level", do_log_level }, -- 2.39.5