diff --git a/bochs/gui/wx.cc b/bochs/gui/wx.cc index 18b9685a2..892295d61 100644 --- a/bochs/gui/wx.cc +++ b/bochs/gui/wx.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////// -// $Id: wx.cc,v 1.41 2002-10-05 18:27:24 bdenney Exp $ +// $Id: wx.cc,v 1.42 2002-10-07 04:49:50 bdenney Exp $ ///////////////////////////////////////////////////////////////// // // wxWindows VGA display for Bochs. wx.cc implements a custom @@ -142,10 +142,24 @@ void MyPanel::OnPaint(wxPaintEvent& WXUNUSED(event)) needRefresh = false; } -void MyPanel::ToggleMouse () +void MyPanel::ToggleMouse (bool fromToolbar) { + static bool first_enable = true; bx_param_bool_c *enable = SIM->get_param_bool (BXP_MOUSE_ENABLED); bool en = ! enable->get (); + bool needmutex = isSimThread(); + if (needmutex) wxMutexGuiEnter(); + if (fromToolbar && first_enable && en) { + // only show this help if you click on the toolbar. If they already + // know the shortcut, don't annoy them with the message. + wxString msg = + "You have enabled the mouse in Bochs, so now your mouse actions will\n" + "be sent into the simulator. The usual mouse cursor will be trapped\n" + "inside the Bochs window until you press F12 or press the middle button\n" + "to turn mouse capture off."; + wxMessageBox(msg, "Mouse Capture Enabled", wxOK | wxICON_INFORMATION); + first_enable = false; + } enable->set (en); IFDBG_MOUSE (wxLogDebug ("now mouse is %sabled", en ? "en" : "dis")); if (en) { @@ -156,6 +170,7 @@ void MyPanel::ToggleMouse () } else { SetCursor (wxNullCursor); } + if (needmutex) wxMutexGuiLeave(); } void MyPanel::OnMouse(wxMouseEvent& event) @@ -177,7 +192,7 @@ void MyPanel::OnMouse(wxMouseEvent& event) ) if (event.MiddleDown ()) { - ToggleMouse (); + ToggleMouse (false); return; } @@ -228,7 +243,7 @@ MyPanel::MyRefresh () void MyPanel::OnKeyDown(wxKeyEvent& event) { if(event.GetKeyCode() == WXK_F12) { - ToggleMouse (); + ToggleMouse (false); return; } wxCriticalSectionLocker lock(event_thread_lock); @@ -769,7 +784,7 @@ void bx_gui_c::handle_events(void) case BX_TOOLBAR_PASTE: paste_handler (); break; case BX_TOOLBAR_SNAPSHOT: snapshot_handler (); break; case BX_TOOLBAR_CONFIG: config_handler (); break; - case BX_TOOLBAR_MOUSE_EN: toggle_mouse_enable (); break; + case BX_TOOLBAR_MOUSE_EN: thePanel->ToggleMouse (true); break; case BX_TOOLBAR_USER: userbutton_handler (); break; default: wxLogDebug ("unknown toolbar id %d", event_queue[i].u.toolbar.button); diff --git a/bochs/gui/wxmain.cc b/bochs/gui/wxmain.cc index 936d723fc..c9be7ced2 100644 --- a/bochs/gui/wxmain.cc +++ b/bochs/gui/wxmain.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////// -// $Id: wxmain.cc,v 1.64 2002-10-07 04:00:59 bdenney Exp $ +// $Id: wxmain.cc,v 1.65 2002-10-07 04:49:50 bdenney Exp $ ///////////////////////////////////////////////////////////////// // // wxmain.cc implements the wxWindows frame, toolbar, menus, and dialogs. @@ -425,7 +425,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, // Omit config button because the whole wxWindows interface is like // one really big config button. //BX_ADD_TOOL(ID_Toolbar_Config, configbutton_xpm, "Runtime Configuration"); - BX_ADD_TOOL(ID_Toolbar_Mouse_en, mouse_xpm, "Enable/disable mouse\nAlso, middle mouse button does the same thing."); + BX_ADD_TOOL(ID_Toolbar_Mouse_en, mouse_xpm, "Enable/disable mouse capture\nThere are also two shortcuts for this: F12 and the middle mouse button."); BX_ADD_TOOL(ID_Toolbar_User, userbutton_xpm, "Keyboard shortcut"); tb->Realize(); diff --git a/bochs/gui/wxmain.h b/bochs/gui/wxmain.h index 2a60cf9d1..5d1b130f9 100644 --- a/bochs/gui/wxmain.h +++ b/bochs/gui/wxmain.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////// -// $Id: wxmain.h,v 1.32 2002-10-07 04:01:00 bdenney Exp $ +// $Id: wxmain.h,v 1.33 2002-10-07 04:49:50 bdenney Exp $ ///////////////////////////////////////////////////////////////// // This file defines variables and classes that the wxWindows .cc files // share. It should be included only by wx.cc and wxmain.cc. @@ -145,7 +145,7 @@ public: void OnPaint(wxPaintEvent& event); void OnMouse(wxMouseEvent& event); void MyRefresh (); - void ToggleMouse (); + void ToggleMouse (bool fromToolbar); private: wxCursor *blankCursor; bool needRefresh;