[vlc-devel] [PATCH] XCB windowless: add x11-xcb pkgconfig check
Cheng Sun
chengsun9 at gmail.com
Fri Jan 4 13:50:48 CET 2013
---
configure.ac | 4 ++++
npapi/Makefile.am | 8 ++++----
npapi/vlcplugin.h | 11 +++++++----
npapi/vlcshell.cpp | 2 ++
4 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8c5e7c5..1fefabe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -249,6 +249,7 @@ AC_ARG_WITH([gtk], AS_HELP_STRING([--with-gtk], [Build the GTK+ toolbars in NPAP
gtk_found=no
AS_IF([ test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ], [
PKG_CHECK_MODULES(XCB, [xcb],[xcb_found=yes])
+ PKG_CHECK_MODULES(X11_XCB, [x11-xcb],[x11_xcb_found=yes])
AS_IF([ test "x$with_gtk" != "xno" ],
[
PKG_CHECK_MODULES(GTK, [gtk+-2.0], [gtk_found=yes])
@@ -264,8 +265,11 @@ AS_IF([ test "x$gtk_found" = "xyes" ],
AC_DEFINE([USE_GTK], [1], [Define to 1 if using GTK+]))
AS_IF([ test "x$xcb_found" = "xyes" ],
AC_DEFINE([USE_XCB], [1], [Define to 1 if using XCB]))
+AS_IF([ test "x$x11_xcb_found" = "xyes" ],
+ AC_DEFINE([USE_X11_XCB], [1], [Define to 1 if using X11-XCB]))
AM_CONDITIONAL(WITH_GTK, [ test "x$gtk_found" = "xyes" ])
AM_CONDITIONAL(HAVE_XCB, [ test "x$xcb_found" = "xyes" ])
+AM_CONDITIONAL(HAVE_X11_XCB, [ test "x$x11_xcb_found" = "xyes" ])
dnl
dnl final flags for ActiveX
diff --git a/npapi/Makefile.am b/npapi/Makefile.am
index 147b4a1..21d33ab 100644
--- a/npapi/Makefile.am
+++ b/npapi/Makefile.am
@@ -66,7 +66,7 @@ SOURCES_support = \
if WITH_GTK
AM_CPPFLAGS += $(GTK_CFLAGS)
-libvlcplugin_la_LIBADD += $(GTK_LIBS) $(X_LIBS) $(X_PRE_LIBS) -lX11
+libvlcplugin_la_LIBADD += $(GTK_LIBS)
SOURCES_support += \
vlcplugin_gtk.cpp \
vlcplugin_gtk.h
@@ -78,9 +78,9 @@ SOURCES_support += \
vlcplugin_xcb.h
endif # !USE_GTK
-if HAVE_XCB
-AM_CPPFLAGS += $(XCB_CFLAGS)
-libvlcplugin_la_LIBADD += $(XCB_LIBS) -lX11-xcb
+if HAVE_X11_XCB
+AM_CPPFLAGS += $(XCB_CFLAGS) $(X11_XCB_CFLAGS)
+libvlcplugin_la_LIBADD += $(XCB_LIBS) $(X11_XCB_LIBS)
SOURCES_support += \
vlcwindowless_xcb.cpp \
vlcwindowless_xcb.h \
diff --git a/npapi/vlcplugin.h b/npapi/vlcplugin.h
index 82c4180..5accecd 100644
--- a/npapi/vlcplugin.h
+++ b/npapi/vlcplugin.h
@@ -36,10 +36,6 @@
#include "common.h"
#if defined(XP_UNIX) && !defined(XP_MACOSX)
-# if defined(USE_XCB)
-# include "vlcwindowless_xcb.h"
- typedef VlcWindowlessXCB VlcWindowless;
-# endif
# if defined(USE_GTK)
# include "vlcplugin_gtk.h"
typedef class VlcPluginGtk VlcPlugin;
@@ -47,18 +43,25 @@
# include "vlcplugin_xcb.h"
typedef class VlcPluginXcb VlcPlugin;
# endif
+# if defined(USE_XCB) && defined(USE_X11_XCB)
+# include "vlcwindowless_xcb.h"
+ typedef VlcWindowlessXCB VlcWindowless;
+# define HAVE_WINDOWLESS
+# endif
#elif defined(XP_WIN)
# include "vlcplugin_win.h"
typedef class VlcPluginWin VlcPlugin;
# include "vlcwindowless_win.h"
typedef class VlcWindowlessWin VlcWindowless;
+# define HAVE_WINDOWLESS
#elif defined(XP_MACOSX)
# include "vlcplugin_mac.h"
typedef class VlcPluginMac VlcPlugin;
# include "vlcwindowless_mac.h"
typedef class VlcWindowlessMac VlcWindowless;
+# define HAVE_WINDOWLESS
#endif
diff --git a/npapi/vlcshell.cpp b/npapi/vlcshell.cpp
index 74d9c2b..c19347b 100644
--- a/npapi/vlcshell.cpp
+++ b/npapi/vlcshell.cpp
@@ -245,6 +245,7 @@ NPError NPP_New( NPMIMEType, NPP instance,
return NPERR_INVALID_INSTANCE_ERROR;
}
+#ifdef HAVE_WINDOWLESS
bool windowless = false;
/* we need to tell whether the plugin will be windowless
* before it is instantiated */
@@ -277,6 +278,7 @@ NPError NPP_New( NPMIMEType, NPP instance,
p_plugin = new VlcWindowless( instance, mode );
}
else
+#endif
{
p_plugin = new VlcPlugin( instance, mode );
}
--
1.8.0.3
More information about the vlc-devel
mailing list