Bug #213 myipc.cpp:136: error: ‘gtk_widget_get_window’ was not declared in this scope

This commit is contained in:
Zane U. Ji 2014-11-29 08:50:49 +08:00
parent 5c4f02b84c
commit b07d98ba4f
9 changed files with 84 additions and 62 deletions

View File

@ -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@

87
configure vendored
View File

@ -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 <http://pkg-config.freedesktop.org/>.
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

21
configure.ac Normal file → Executable file
View File

@ -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

View File

@ -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@

View File

@ -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@

View File

@ -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)

View File

@ -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:

8
src/myipc.cpp Normal file → Executable file
View File

@ -21,7 +21,7 @@
#include "myipc.h"
#include "xmlcopyeditor.h"
#include "pathresolver.h"
#if defined ( __WXGTK__ ) && !defined ( __NO_GTK__ )
#ifdef HAVE_GTK2
#include <gtk/gtk.h>
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__

6
src/myipc.h Normal file → Executable file
View File

@ -26,7 +26,7 @@
#include <wx/wx.h>
#include <wx/ipc.h>
#if defined ( __WXGTK__ ) && !defined ( __NO_GTK__ )
#ifdef HAVE_GTK2
#if wxCHECK_VERSION(2,9,0) // GSocket is defined in wxWidgets 2.8
#include <gdk/gdkx.h>
#else // wxCHECK_VERSION(2,9,0)
@ -34,7 +34,7 @@
#include <gdk/gdkx.h>
#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;