From b07d98ba4f4ed7eb7e5124d953be601ff88b0ff0 Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Sat, 29 Nov 2014 08:50:49 +0800 Subject: [PATCH] =?UTF-8?q?Bug=20#213=20=09myipc.cpp:136:=20error:=20?= =?UTF-8?q?=E2=80=98gtk=5Fwidget=5Fget=5Fwindow=E2=80=99=20was=20not=20dec?= =?UTF-8?q?lared=20in=20this=20scope?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile.in | 4 +-- configure | 87 ++++++++++++++++++++++++++++++------------------ configure.ac | 21 ++++++------ data/Makefile.in | 4 +-- m4/Makefile.in | 4 +-- src/Makefile.am | 4 +-- src/Makefile.in | 8 ++--- src/myipc.cpp | 8 ++--- src/myipc.h | 6 ++-- 9 files changed, 84 insertions(+), 62 deletions(-) mode change 100644 => 100755 configure.ac mode change 100644 => 100755 src/myipc.cpp mode change 100644 => 100755 src/myipc.h diff --git a/Makefile.in b/Makefile.in index 5eb4a36..9a6f11a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -143,8 +143,8 @@ FGREP = @FGREP@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMSGFMT = @GMSGFMT@ GREP = @GREP@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ +GTK2_CFLAGS = @GTK2_CFLAGS@ +GTK2_LIBS = @GTK2_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/configure b/configure index ee4ebb2..1b0c4ea 100755 --- a/configure +++ b/configure @@ -613,15 +613,15 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS -GTK_LIBS -GTK_CFLAGS +WX_LIBS +GTK2_LIBS +GTK2_CFLAGS ASPELL_LIBS ENCHANT_LIBS ENCHANT_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG -WX_LIBS CXXCPP CPP OTOOL64 @@ -810,8 +810,8 @@ PKG_CONFIG_PATH PKG_CONFIG_LIBDIR ENCHANT_CFLAGS ENCHANT_LIBS -GTK_CFLAGS -GTK_LIBS' +GTK2_CFLAGS +GTK2_LIBS' # Initialize some variables set by options. @@ -1474,8 +1474,8 @@ Some influential environment variables: C compiler flags for ENCHANT, overriding pkg-config ENCHANT_LIBS linker flags for ENCHANT, overriding pkg-config - GTK_CFLAGS C compiler flags for GTK, overriding pkg-config - GTK_LIBS linker flags for GTK, overriding pkg-config + GTK2_CFLAGS C compiler flags for GTK2, overriding pkg-config + GTK2_LIBS linker flags for GTK2, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -15824,7 +15824,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu CPPFLAGS="$CPPFLAGS -Wall -g -fexceptions" -CXXFLAGS="$CXXFLAGS -Wall -g -fexceptions" +CXXFLAGS?= WXCONFIG=wx-config LIBXMLCONFIG=xml2-config @@ -15907,11 +15907,6 @@ $as_echo "not found" >&6; } as_fn_error $? "libxslt" "$LINENO" 5 fi -CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" -CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS" - - - # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; @@ -16222,11 +16217,11 @@ fi # It is needed to make single-instance-check work pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTK" >&5 -$as_echo_n "checking for GTK... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTK2" >&5 +$as_echo_n "checking for GTK2... " >&6; } -if test -n "$GTK_CFLAGS"; then - pkg_cv_GTK_CFLAGS="$GTK_CFLAGS" +if test -n "$GTK2_CFLAGS"; then + pkg_cv_GTK2_CFLAGS="$GTK2_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0\""; } >&5 @@ -16234,7 +16229,7 @@ if test -n "$GTK_CFLAGS"; then ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_GTK_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0" 2>/dev/null` + pkg_cv_GTK2_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -16242,8 +16237,8 @@ fi else pkg_failed=untried fi -if test -n "$GTK_LIBS"; then - pkg_cv_GTK_LIBS="$GTK_LIBS" +if test -n "$GTK2_LIBS"; then + pkg_cv_GTK2_LIBS="$GTK2_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0\""; } >&5 @@ -16251,7 +16246,7 @@ if test -n "$GTK_LIBS"; then ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_GTK_LIBS=`$PKG_CONFIG --libs "gtk+-2.0" 2>/dev/null` + pkg_cv_GTK2_LIBS=`$PKG_CONFIG --libs "gtk+-2.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -16272,30 +16267,56 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - GTK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gtk+-2.0" 2>&1` + GTK2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gtk+-2.0" 2>&1` else - GTK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gtk+-2.0" 2>&1` + GTK2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gtk+-2.0" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$GTK_PKG_ERRORS" >&5 + echo "$GTK2_PKG_ERRORS" >&5 - CXXFLAGS="$CXXFLAGS -D__NO_GTK__" - #[PKG_CHECK_MODULES(GTK, [gtk+-3.0], [AC_MSG_RESULT([gtk+-3.0])])] + as_fn_error $? "Package requirements (gtk+-2.0) were not met: +$GTK2_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables GTK2_CFLAGS +and GTK2_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - CXXFLAGS="$CXXFLAGS -D__NO_GTK__" - #[PKG_CHECK_MODULES(GTK, [gtk+-3.0], [AC_MSG_RESULT([gtk+-3.0])])] + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. +Alternatively, you may set the environment variables GTK2_CFLAGS +and GTK2_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } else - GTK_CFLAGS=$pkg_cv_GTK_CFLAGS - GTK_LIBS=$pkg_cv_GTK_LIBS + GTK2_CFLAGS=$pkg_cv_GTK2_CFLAGS + GTK2_LIBS=$pkg_cv_GTK2_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: gtk+-2.0" >&5 -$as_echo "gtk+-2.0" >&6; } + +$as_echo "#define HAVE_GTK2 1" >>confdefs.h + + #, [PKG_CHECK_MODULES(GTK, [gtk+-3.0], [AC_MSG_RESULT([gtk+-3.0])])] + fi +#AC_SUBST(GTK2_CFLAGS) +#AC_SUBST(GTK2_LIBS) + +CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" +CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS" + + ac_config_files="$ac_config_files Makefile data/Makefile m4/Makefile po/Makefile.in src/Makefile" @@ -18824,7 +18845,7 @@ echo "Debug Enabled" else echo "Debug Disabled" fi -if [ "$GTK_LIBS" = "" ]; then +if [ "$GTK2_LIBS" = "" ]; then echo "GTK No. There will be problems when single instance is enabled." fi diff --git a/configure.ac b/configure.ac old mode 100644 new mode 100755 index ac4f4cf..7dfd45b --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL CPPFLAGS="$CPPFLAGS -Wall -g -fexceptions" -CXXFLAGS="$CXXFLAGS -Wall -g -fexceptions" +CXXFLAGS?= WXCONFIG=wx-config LIBXMLCONFIG=xml2-config @@ -93,11 +93,6 @@ AC_DEFUN([LIBXSLTTEST], # Call XSLT TEST func LIBXSLTTEST -CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" -CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS" - -AC_SUBST(WX_LIBS) - AC_ARG_ENABLE(debug, [ --enable-debug, Enable debug build], [ @@ -151,10 +146,16 @@ AC_SUBST(ASPELL_LIBS) # Check gtk # This has to match the one wxWidgets linked with # It is needed to make single-instance-check work -PKG_CHECK_MODULES(GTK, [gtk+-2.0], [AC_MSG_RESULT([gtk+-2.0])], - [CXXFLAGS="$CXXFLAGS -D__NO_GTK__"] - #[PKG_CHECK_MODULES(GTK, [gtk+-3.0], [AC_MSG_RESULT([gtk+-3.0])])] +PKG_CHECK_MODULES([GTK2], [gtk+-2.0], [AC_DEFINE([HAVE_GTK2], [1], [Define if gtk+-2.0 exist.])] + #, [PKG_CHECK_MODULES(GTK, [gtk+-3.0], [AC_MSG_RESULT([gtk+-3.0])])] ) +#AC_SUBST(GTK2_CFLAGS) +#AC_SUBST(GTK2_LIBS) + +CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" +CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS" + +AC_SUBST(WX_LIBS) AC_OUTPUT(Makefile data/Makefile m4/Makefile po/Makefile.in src/Makefile) @@ -168,7 +169,7 @@ echo "Debug Enabled" else echo "Debug Disabled" fi -if [[ "$GTK_LIBS" = "" ]]; then +if [[ "$GTK2_LIBS" = "" ]]; then echo "GTK No. There will be problems when single instance is enabled." fi diff --git a/data/Makefile.in b/data/Makefile.in index ec798e0..75c4ed9 100644 --- a/data/Makefile.in +++ b/data/Makefile.in @@ -118,8 +118,8 @@ FGREP = @FGREP@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMSGFMT = @GMSGFMT@ GREP = @GREP@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ +GTK2_CFLAGS = @GTK2_CFLAGS@ +GTK2_LIBS = @GTK2_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/m4/Makefile.in b/m4/Makefile.in index 1224a19..d48cb33 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -84,8 +84,8 @@ FGREP = @FGREP@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMSGFMT = @GMSGFMT@ GREP = @GREP@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ +GTK2_CFLAGS = @GTK2_CFLAGS@ +GTK2_LIBS = @GTK2_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/src/Makefile.am b/src/Makefile.am index 7faf540..d1d0703 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -34,7 +34,7 @@ xmlcopyeditor_SOURCES = aboutdialog.cpp associatedialog.cpp binaryfile.cpp \ xmlcopyeditor.spec xmlcopyeditor.png custom.xpm xmlcopyeditor_LDADD = $(WX_LIBS) \ - -lexpat -lxslt -lxml2 -lpcre -lxerces-c $(ASPELL_LIBS) $(ENCHANT_LIBS) $(GTK_LIBS) + -lexpat -lxslt -lxml2 -lpcre -lxerces-c $(ASPELL_LIBS) $(ENCHANT_LIBS) $(GTK2_LIBS) nobase_dist_xmlcopyeditor_DATA = $(srcdir)/catalog/catalog \ $(srcdir)/dtd/*.* \ @@ -84,5 +84,5 @@ EXTRA_DIST = \ $(srcdir)/xmlcopyeditor.rc \ $(srcdir)/xmlschemaparser.cpp -AM_CPPFLAGS = -I/usr/include/libxml2 $(ENCHANT_CFLAGS) $(GTK_CFLAGS) +AM_CPPFLAGS = -I/usr/include/libxml2 $(ENCHANT_CFLAGS) $(GTK2_CFLAGS) diff --git a/src/Makefile.in b/src/Makefile.in index e75918f..93f4282 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -170,8 +170,8 @@ FGREP = @FGREP@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMSGFMT = @GMSGFMT@ GREP = @GREP@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_LIBS = @GTK_LIBS@ +GTK2_CFLAGS = @GTK2_CFLAGS@ +GTK2_LIBS = @GTK2_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -308,7 +308,7 @@ xmlcopyeditor_SOURCES = aboutdialog.cpp associatedialog.cpp binaryfile.cpp \ xmlcopyeditor.spec xmlcopyeditor.png custom.xpm xmlcopyeditor_LDADD = $(WX_LIBS) \ - -lexpat -lxslt -lxml2 -lpcre -lxerces-c $(ASPELL_LIBS) $(ENCHANT_LIBS) $(GTK_LIBS) + -lexpat -lxslt -lxml2 -lpcre -lxerces-c $(ASPELL_LIBS) $(ENCHANT_LIBS) $(GTK2_LIBS) nobase_dist_xmlcopyeditor_DATA = $(srcdir)/catalog/catalog \ $(srcdir)/dtd/*.* \ @@ -357,7 +357,7 @@ EXTRA_DIST = \ $(srcdir)/xmlcopyeditor.rc \ $(srcdir)/xmlschemaparser.cpp -AM_CPPFLAGS = -I/usr/include/libxml2 $(ENCHANT_CFLAGS) $(GTK_CFLAGS) +AM_CPPFLAGS = -I/usr/include/libxml2 $(ENCHANT_CFLAGS) $(GTK2_CFLAGS) all: all-am .SUFFIXES: diff --git a/src/myipc.cpp b/src/myipc.cpp old mode 100644 new mode 100755 index e3d42ce..802e0f9 --- a/src/myipc.cpp +++ b/src/myipc.cpp @@ -21,7 +21,7 @@ #include "myipc.h" #include "xmlcopyeditor.h" #include "pathresolver.h" -#if defined ( __WXGTK__ ) && !defined ( __NO_GTK__ ) +#ifdef HAVE_GTK2 #include guint32 XTimeNow() @@ -30,7 +30,7 @@ guint32 XTimeNow() clock_gettime ( CLOCK_MONOTONIC, &ts ); return ts.tv_sec * 1000 + ts.tv_nsec / 1000000; } -#endif // __WXGTK__ +#endif // HAVE_GTK2 MyServerConnection *server_connection = 0; MyClientConnection *client_connection = 0; @@ -94,7 +94,7 @@ bool MyServerConnection::OnPoke ( //frame->addToFileQueue ( ( wxString& ) item ); // prevent event loop problems } #ifndef __WXMSW__ -#if defined ( __WXGTK__ ) && !defined ( __NO_GTK__ ) +#ifdef HAVE_GTK2 // Processes mostly cannot raise their own windows. // http://osdir.com/ml/gnome.gaim.devel/2004-12/msg00077.html GtkWidget *widget = frame->GetHandle(); @@ -105,7 +105,7 @@ bool MyServerConnection::OnPoke ( //gdk_window_show ( window ); //gdk_window_raise ( window ); //gtk_window_present ( GTK_WINDOW ( widget ) ); -#endif // __WXGTK__ && !__NO_GTK__ +#endif // HAVE_GTK2 frame->Show(); frame->Raise(); #endif // __WXMSW__ diff --git a/src/myipc.h b/src/myipc.h old mode 100644 new mode 100755 index 73a3358..53f7b13 --- a/src/myipc.h +++ b/src/myipc.h @@ -26,7 +26,7 @@ #include #include -#if defined ( __WXGTK__ ) && !defined ( __NO_GTK__ ) +#ifdef HAVE_GTK2 #if wxCHECK_VERSION(2,9,0) // GSocket is defined in wxWidgets 2.8 #include #else // wxCHECK_VERSION(2,9,0) @@ -34,7 +34,7 @@ #include #undef GSocket #endif // wxCHECK_VERSION(2,9,0) -#endif // __WXGTK__ && !__NO_GTK__ +#endif // HAVE_GTK2 #define IPC_SERVICE _T("4242") #define IPC_TOPIC _T("IPC TEST") @@ -71,7 +71,7 @@ class MyServerConnection : public wxConnection IPCSize_t *size, wxIPCFormat format = wxIPC_PRIVATE ); protected: -#if defined ( __WXGTK__ ) && !defined ( __NO_GTK__ ) +#ifdef HAVE_GTK2 GdkNativeWindow mFrameWnd; #else WXWidget mFrameWnd;