From d46c80562e8bd7ab2702096e6989d1073223ff32 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Tue, 26 Jan 2021 07:22:58 +0000 Subject: [PATCH] Some wx gui related changes. - Moved wx gui plugin entry point to wx.cc, so we can use the macro PLUGIN_ENTRY_FOR_GUI_MODULE to be compatible with the other guis. - Updated gui Makefile dependencies. --- bochs/gui/Makefile.in | 6 ++---- bochs/gui/wx.cc | 15 ++++++++++++++- bochs/gui/wxmain.cc | 21 ++++----------------- bochs/gui/wxmain.h | 1 + 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/bochs/gui/Makefile.in b/bochs/gui/Makefile.in index 7afc4ad16..8838d5df6 100644 --- a/bochs/gui/Makefile.in +++ b/bochs/gui/Makefile.in @@ -307,8 +307,7 @@ wx.o: wx.@CPP_SUFFIX@ ../config.h ../bochs.h ../config.h ../osdep.h \ ../instrument/stubs/instrument.h ../param_names.h keymap.h \ ../iodev/iodev.h ../plugin.h ../extplugin.h font/vga.bitmap.h wxmain.h wxdialog.o: wxdialog.@CPP_SUFFIX@ ../config.h ../param_names.h ../osdep.h \ - ../gui/siminterface.h ../cpudb.h ../gui/paramtree.h ../bxversion.h \ - wxdialog.h wxmain.h + ../gui/siminterface.h ../cpudb.h ../gui/paramtree.h wxdialog.h wxmain.h wxmain.o: wxmain.@CPP_SUFFIX@ ../config.h ../param_names.h ../osdep.h \ ../gui/siminterface.h ../cpudb.h ../gui/paramtree.h ../bxversion.h \ wxdialog.h wxmain.h ../extplugin.h bitmaps/cdromd.xpm bitmaps/copy.xpm \ @@ -429,8 +428,7 @@ wx.lo: wx.@CPP_SUFFIX@ ../config.h ../bochs.h ../config.h ../osdep.h \ ../instrument/stubs/instrument.h ../param_names.h keymap.h \ ../iodev/iodev.h ../plugin.h ../extplugin.h font/vga.bitmap.h wxmain.h wxdialog.lo: wxdialog.@CPP_SUFFIX@ ../config.h ../param_names.h ../osdep.h \ - ../gui/siminterface.h ../cpudb.h ../gui/paramtree.h ../bxversion.h \ - wxdialog.h wxmain.h + ../gui/siminterface.h ../cpudb.h ../gui/paramtree.h wxdialog.h wxmain.h wxmain.lo: wxmain.@CPP_SUFFIX@ ../config.h ../param_names.h ../osdep.h \ ../gui/siminterface.h ../cpudb.h ../gui/paramtree.h ../bxversion.h \ wxdialog.h wxmain.h ../extplugin.h bitmaps/cdromd.xpm bitmaps/copy.xpm \ diff --git a/bochs/gui/wx.cc b/bochs/gui/wx.cc index f3536e305..a6782c4e9 100644 --- a/bochs/gui/wx.cc +++ b/bochs/gui/wx.cc @@ -2,7 +2,7 @@ // $Id$ ///////////////////////////////////////////////////////////////// // -// Copyright (C) 2002-2020 The Bochs Project +// Copyright (C) 2002-2021 The Bochs Project // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -69,6 +69,19 @@ ////////////////////////////////////////////////////////////// // plugin support ////////////////////////////////////////////////////////////// +PLUGIN_ENTRY_FOR_GUI_MODULE(wx) +{ + if (init) { + wxLogDebug(wxT("plugin_entry() for wxmain.cc")); + wxLogDebug(wxT("installing wxWidgets as the configuration interface")); + SIM->register_configuration_interface("wx", wx_ci_callback, NULL); + wxLogDebug(wxT("installing %s as the Bochs GUI"), wxT("wxWidgets")); + SIM->get_param_enum(BXPN_SEL_DISPLAY_LIBRARY)->set_enabled(0); + MyPanel::OnPluginInit(); + } + return 0; // success +} + class bx_wx_gui_c : public bx_gui_c { public: bx_wx_gui_c(void) {} diff --git a/bochs/gui/wxmain.cc b/bochs/gui/wxmain.cc index f53e9d5bd..5f210f003 100644 --- a/bochs/gui/wxmain.cc +++ b/bochs/gui/wxmain.cc @@ -180,7 +180,7 @@ public: // wxWidgets startup ////////////////////////////////////////////////////////////////////// -static int ci_callback(void *userdata, ci_command_t command) +int wx_ci_callback(void *userdata, ci_command_t command) { switch (command) { @@ -209,19 +209,6 @@ static int ci_callback(void *userdata, ci_command_t command) return 0; } -extern "C" int libwx_gui_plugin_entry(plugin_t *plugin, plugintype_t type, bool init) -{ - if (init) { - wxLogDebug(wxT("plugin_entry() for wxmain.cc")); - wxLogDebug(wxT("installing wxWidgets as the configuration interface")); - SIM->register_configuration_interface("wx", ci_callback, NULL); - wxLogDebug(wxT("installing %s as the Bochs GUI"), wxT("wxWidgets")); - SIM->get_param_enum(BXPN_SEL_DISPLAY_LIBRARY)->set_enabled(0); - MyPanel::OnPluginInit(); - } - return 0; // success -} - ////////////////////////////////////////////////////////////////////// // MyApp: the wxWidgets application @@ -232,11 +219,11 @@ IMPLEMENT_APP_NO_MAIN(MyApp) // this is the entry point of the wxWidgets code. It is called as follows: // 1. main() loads the wxWidgets plugin (if necessary) and calls // libwx_LTX_plugin_entry(), which installs a function pointer to the -// ci_callback() function. +// wx_ci_callback() function. // 2. main() calls SIM->configuration_interface. // 3. bx_real_sim_c::configuration_interface calls the function pointer that -// points to ci_callback() in this file, with command=CI_START. -// 4. ci_callback() calls wxEntry() in the wxWidgets library +// points to wx_ci_callback() in this file, with command=CI_START. +// 4. wx_ci_callback() calls wxEntry() in the wxWidgets library // 5. wxWidgets library creates the app and calls OnInit(). // // Before this code is called, the command line has already been parsed, and a diff --git a/bochs/gui/wxmain.h b/bochs/gui/wxmain.h index 60f5f6558..63a4d9061 100644 --- a/bochs/gui/wxmain.h +++ b/bochs/gui/wxmain.h @@ -136,6 +136,7 @@ enum // defined in wxmain.cc +int wx_ci_callback(void *userdata, ci_command_t command); void safeWxStrcpy(char *dest, wxString src, int destlen); /// the MyPanel methods are defined in wx.cc