From 9a27303afa1cad954571b9842845a843bbed5a23 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Mon, 11 Nov 2019 19:40:09 +0000 Subject: [PATCH] Some work for GTK version 3 compatiblity - if wxGTK uses GTK 3.x, also use it for the gui debugger to avoid trouble - the name of the include file for GDK keysyms now depends on GDK version, so the temporary translation table can be removed - small fix to compile the gui debugger with GTK 3.x (warnings still exist) --- bochs/config.h.in | 4 ++- bochs/configure | 43 +++++++++++++++++---------- bochs/configure.in | 39 +++++++++++++++--------- bochs/gui/gtk_enh_dbg_osdep.cc | 2 +- bochs/gui/wx.cc | 54 ++-------------------------------- 5 files changed, 60 insertions(+), 82 deletions(-) diff --git a/bochs/config.h.in b/bochs/config.h.in index cfcbd4364..167d5a938 100644 --- a/bochs/config.h.in +++ b/bochs/config.h.in @@ -1,5 +1,5 @@ // -// Copyright (C) 2001-2017 The Bochs Project +// Copyright (C) 2001-2019 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 @@ -311,6 +311,8 @@ // set to 1 if wxMSW is a unicode version #define WX_MSW_UNICODE 0 +// set to GDK major version for wxGTK +#define WX_GDK_VERSION 0 // A certain functions must NOT be fastcall even if compiled with fastcall // option, and those are callbacks from Windows which are defined either diff --git a/bochs/configure b/bochs/configure index 2bcf25f86..57eca955b 100755 --- a/bochs/configure +++ b/bochs/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 13559 2019-04-21 20:08:32Z vruppert . +# From configure.in Id: configure.in 13588 2019-11-02 19:30:39Z vruppert . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # @@ -24443,8 +24443,7 @@ $as_echo "$WX_CONFIG" >&6; } ok_wx_version=0 wx_multi_lib=0 needs_gtk2=0 -wx_needs_gdk2=0 -wx_needs_gdk3=0 +wx_needs_gdk_version=0 wx_msw_unicode=0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wxWidgets library version" >&5 $as_echo_n "checking for wxWidgets library version... " >&6; } @@ -24465,7 +24464,7 @@ if test x$WX_CONFIG != xnot_found; then ok_wx_version=1 wx_multi_lib=1 case x$WX_BASENAME in - xwx_gtk2|xwx_gtk2u) wx_needs_gdk2=1 ;; + xwx_gtk2|xwx_gtk2u) wx_needs_gdk_version=2 ;; *) ;; esac ;; @@ -24473,8 +24472,8 @@ if test x$WX_CONFIG != xnot_found; then ok_wx_version=1 wx_multi_lib=1 case x$WX_BASENAME in - xwx_gtk2|xwx_gtk2u) wx_needs_gdk2=1 ;; - xwx_gtk3|xwx_gtk3u) wx_needs_gdk3=1 ;; + xwx_gtk2|xwx_gtk2u) wx_needs_gdk_version=2 ;; + xwx_gtk3|xwx_gtk3u) wx_needs_gdk_version=3 ;; *) ;; esac ;; @@ -24836,15 +24835,19 @@ if test "$with_wx" = yes; then SPECIFIC_GUI_SUPPORT_OBJS="$SPECIFIC_GUI_SUPPORT_OBJS \$(GUI_OBJS_WX_SUPPORT)" WX_CFLAGS="`$WX_CONFIG --cflags`" WX_CXXFLAGS="`$WX_CONFIG --cxxflags`" - if test "$wx_needs_gdk2" = 1; then + if test "$wx_needs_gdk_version" = 2; then GDK_CFLAGS="`pkg-config --cflags gdk-2.0`" WX_CFLAGS="$WX_CFLAGS $GDK_CFLAGS" WX_CXXFLAGS="$WX_CXXFLAGS $GDK_CFLAGS" + $as_echo "#define WX_GDK_VERSION 2" >>confdefs.h + fi - if test "$wx_needs_gdk3" = 1; then + if test "$wx_needs_gdk_version" = 3; then GDK_CFLAGS="`pkg-config --cflags gdk-3.0`" WX_CFLAGS="$WX_CFLAGS $GDK_CFLAGS" WX_CXXFLAGS="$WX_CXXFLAGS $GDK_CFLAGS" + $as_echo "#define WX_GDK_VERSION 3" >>confdefs.h + fi if test "$wx_multi_lib" = 1; then GUI_LINK_OPTS_WX="`$WX_CONFIG --libs core,base`" @@ -24898,15 +24901,25 @@ if test "$display_libs" = ""; then fi # some display libraries and the enhanced debugger may depend on the GTK+ software package -bx_have_gtk2=0 +bx_have_gtk_version=0 if test "$needs_gtk2" = 1; then # pkg-config is required to set TOOLKIT_CXXFLAGS and LIBS if test "$PKGCONFIG" != not_found; then - pkg-config --exists gtk+-2.0 - if test x$? = x0; then - TOOLKIT_CXXFLAGS="`pkg-config --cflags gtk+-2.0`" - LIBS="$LIBS `pkg-config --libs gtk+-2.0`" - bx_have_gtk2=1 + # if wxGTK is based on GTK 3.0, use it for gui debugger to avoid conflicts + if test "$wx_needs_gdk_version" = 3; then + pkg-config --exists gtk+-3.0 + if test x$? = x0; then + TOOLKIT_CXXFLAGS="`pkg-config --cflags gtk+-3.0`" + LIBS="$LIBS `pkg-config --libs gtk+-3.0`" + bx_have_gtk_version=3 + fi + else + pkg-config --exists gtk+-2.0 + if test x$? = x0; then + TOOLKIT_CXXFLAGS="`pkg-config --cflags gtk+-2.0`" + LIBS="$LIBS `pkg-config --libs gtk+-2.0`" + bx_have_gtk_version=2 + fi fi else echo "ERROR: pkg-config was not found, or unable to access the gtk+-2.0 package." @@ -25148,7 +25161,7 @@ esac ENH_DBG_OBJS="" if test "$gui_debugger" = 1; then - if test "$bx_have_gtk2" = 1; then + if test "$bx_have_gtk_version" > 1; then ENH_DBG_OBJS="enh_dbg.o gtk_enh_dbg_osdep.o" $as_echo "#define BX_DEBUGGER_GUI 1" >>confdefs.h diff --git a/bochs/configure.in b/bochs/configure.in index 6a4bd1155..56ffe1278 100644 --- a/bochs/configure.in +++ b/bochs/configure.in @@ -2262,8 +2262,7 @@ AC_MSG_RESULT($WX_CONFIG) ok_wx_version=0 wx_multi_lib=0 needs_gtk2=0 -wx_needs_gdk2=0 -wx_needs_gdk3=0 +wx_needs_gdk_version=0 wx_msw_unicode=0 AC_MSG_CHECKING(for wxWidgets library version) if test x$WX_CONFIG != xnot_found; then @@ -2283,7 +2282,7 @@ if test x$WX_CONFIG != xnot_found; then ok_wx_version=1 wx_multi_lib=1 case x$WX_BASENAME in - xwx_gtk2|xwx_gtk2u) wx_needs_gdk2=1 ;; + xwx_gtk2|xwx_gtk2u) wx_needs_gdk_version=2 ;; *) ;; esac ;; @@ -2291,8 +2290,8 @@ if test x$WX_CONFIG != xnot_found; then ok_wx_version=1 wx_multi_lib=1 case x$WX_BASENAME in - xwx_gtk2|xwx_gtk2u) wx_needs_gdk2=1 ;; - xwx_gtk3|xwx_gtk3u) wx_needs_gdk3=1 ;; + xwx_gtk2|xwx_gtk2u) wx_needs_gdk_version=2 ;; + xwx_gtk3|xwx_gtk3u) wx_needs_gdk_version=3 ;; *) ;; esac ;; @@ -2575,15 +2574,17 @@ if test "$with_wx" = yes; then SPECIFIC_GUI_SUPPORT_OBJS="$SPECIFIC_GUI_SUPPORT_OBJS \$(GUI_OBJS_WX_SUPPORT)" WX_CFLAGS="`$WX_CONFIG --cflags`" WX_CXXFLAGS="`$WX_CONFIG --cxxflags`" - if test "$wx_needs_gdk2" = 1; then + if test "$wx_needs_gdk_version" = 2; then GDK_CFLAGS="`pkg-config --cflags gdk-2.0`" WX_CFLAGS="$WX_CFLAGS $GDK_CFLAGS" WX_CXXFLAGS="$WX_CXXFLAGS $GDK_CFLAGS" + AC_DEFINE(WX_GDK_VERSION, 2) fi - if test "$wx_needs_gdk3" = 1; then + if test "$wx_needs_gdk_version" = 3; then GDK_CFLAGS="`pkg-config --cflags gdk-3.0`" WX_CFLAGS="$WX_CFLAGS $GDK_CFLAGS" WX_CXXFLAGS="$WX_CXXFLAGS $GDK_CFLAGS" + AC_DEFINE(WX_GDK_VERSION, 3) fi if test "$wx_multi_lib" = 1; then GUI_LINK_OPTS_WX="`$WX_CONFIG --libs core,base`" @@ -2634,15 +2635,25 @@ if test "$display_libs" = ""; then fi # some display libraries and the enhanced debugger may depend on the GTK+ software package -bx_have_gtk2=0 +bx_have_gtk_version=0 if test "$needs_gtk2" = 1; then # pkg-config is required to set TOOLKIT_CXXFLAGS and LIBS if test "$PKGCONFIG" != not_found; then - pkg-config --exists gtk+-2.0 - if test x$? = x0; then - TOOLKIT_CXXFLAGS="`pkg-config --cflags gtk+-2.0`" - LIBS="$LIBS `pkg-config --libs gtk+-2.0`" - bx_have_gtk2=1 + # if wxGTK is based on GTK 3.0, use it for gui debugger to avoid conflicts + if test "$wx_needs_gdk_version" = 3; then + pkg-config --exists gtk+-3.0 + if test x$? = x0; then + TOOLKIT_CXXFLAGS="`pkg-config --cflags gtk+-3.0`" + LIBS="$LIBS `pkg-config --libs gtk+-3.0`" + bx_have_gtk_version=3 + fi + else + pkg-config --exists gtk+-2.0 + if test x$? = x0; then + TOOLKIT_CXXFLAGS="`pkg-config --cflags gtk+-2.0`" + LIBS="$LIBS `pkg-config --libs gtk+-2.0`" + bx_have_gtk_version=2 + fi fi else echo "ERROR: pkg-config was not found, or unable to access the gtk+-2.0 package." @@ -2818,7 +2829,7 @@ AC_SUBST(CXXFLAGS_CONSOLE) ENH_DBG_OBJS="" if test "$gui_debugger" = 1; then - if test "$bx_have_gtk2" = 1; then + if test "$bx_have_gtk_version" > 1; then ENH_DBG_OBJS="enh_dbg.o gtk_enh_dbg_osdep.o" AC_DEFINE(BX_DEBUGGER_GUI, 1) elif test "$DEFAULT_GUI" = win32 -o "$with_win32" = yes; then diff --git a/bochs/gui/gtk_enh_dbg_osdep.cc b/bochs/gui/gtk_enh_dbg_osdep.cc index be89f7f43..1f3ecde80 100644 --- a/bochs/gui/gtk_enh_dbg_osdep.cc +++ b/bochs/gui/gtk_enh_dbg_osdep.cc @@ -2327,7 +2327,7 @@ bx_bool OSInit() g_object_ref(PTree); // keep an extra ref to both ScrlWin[2] widgets, g_object_ref(LV[2]); // so they don't get deleted when removed from their container - g_object_ref_sink(GTK_OBJECT (PTree)); // the PTree reference is "floating", so "sink" it + g_object_ref_sink(G_OBJECT(PTree)); // the PTree reference is "floating", so "sink" it AttachSignals(); // this must be called AFTER InitMenus() TakeInputFocus(); diff --git a/bochs/gui/wx.cc b/bochs/gui/wx.cc index f1a181b98..ba7d796a6 100644 --- a/bochs/gui/wx.cc +++ b/bochs/gui/wx.cc @@ -622,58 +622,10 @@ bx_bool MyPanel::fillBxKeyEvent_MSW (wxKeyEvent& wxev, BxKeyEvent& bxev, bx_bool #if defined (wxHAS_RAW_KEY_CODES) && defined(__WXGTK__) // get those keysym definitions +#if WX_GDK_VERSION == 3 +#include +#else #include - -#if defined(GDK_KEY_space) -#define GDK_space GDK_KEY_space -#define GDK_asciitilde GDK_KEY_asciitilde -#define GDK_KP_1 GDK_KEY_KP_1 -#define GDK_KP_2 GDK_KEY_KP_2 -#define GDK_KP_3 GDK_KEY_KP_3 -#define GDK_KP_4 GDK_KEY_KP_4 -#define GDK_KP_5 GDK_KEY_KP_5 -#define GDK_KP_6 GDK_KEY_KP_6 -#define GDK_KP_7 GDK_KEY_KP_7 -#define GDK_KP_8 GDK_KEY_KP_8 -#define GDK_KP_9 GDK_KEY_KP_9 -#define GDK_KP_0 GDK_KEY_KP_0 -#define GDK_KP_Decimal GDK_KEY_KP_Decimal -#define GDK_KP_Subtract GDK_KEY_KP_Subtract -#define GDK_KP_Add GDK_KEY_KP_Add -#define GDK_KP_Multiply GDK_KEY_KP_Multiply -#define GDK_KP_Divide GDK_KEY_KP_Divide -#define GDK_Up GDK_KEY_Up -#define GDK_Down GDK_KEY_Down -#define GDK_Left GDK_KEY_Left -#define GDK_Right GDK_KEY_Right -#define GDK_Delete GDK_KEY_Delete -#define GDK_BackSpace GDK_KEY_BackSpace -#define GDK_Tab GDK_KEY_Tab -#define GDK_Return GDK_KEY_Return -#define GDK_Escape GDK_KEY_Escape -#define GDK_F1 GDK_KEY_F1 -#define GDK_F2 GDK_KEY_F2 -#define GDK_F3 GDK_KEY_F3 -#define GDK_F4 GDK_KEY_F4 -#define GDK_F5 GDK_KEY_F5 -#define GDK_F6 GDK_KEY_F6 -#define GDK_F7 GDK_KEY_F7 -#define GDK_F8 GDK_KEY_F8 -#define GDK_F9 GDK_KEY_F9 -#define GDK_F10 GDK_KEY_F10 -#define GDK_F11 GDK_KEY_F11 -#define GDK_F12 GDK_KEY_F12 -#define GDK_Control_L GDK_KEY_Control_L -#define GDK_Shift_L GDK_KEY_Shift_L -#define GDK_Shift_R GDK_KEY_Shift_R -#define GDK_Alt_L GDK_KEY_Alt_L -#define GDK_Caps_Lock GDK_KEY_Caps_Lock -#define GDK_Num_Lock GDK_KEY_Num_Lock -#define GDK_Insert GDK_KEY_Insert -#define GDK_Home GDK_KEY_Home -#define GDK_End GDK_KEY_End -#define GDK_Page_Up GDK_KEY_Page_Up -#define GDK_Page_Down GDK_KEY_Page_Down #endif #endif