[vlc-devel] commit: fix #1387 (update to new libcaca api) ( Rafaël Carré )

git version control git at videolan.org
Sun May 25 21:20:29 CEST 2008


vlc | branch: 0.8.6-bugfix | Rafaël Carré <funman at videolan.org> | Mon Jan 21 16:30:36 2008 +0000| [43132559e1deaf044f1517776121d66b644bf1fb]

fix #1387 (update to new libcaca api)

Cherry-picked from [82ca50d33fc3342f74fb4c26fe09f60ae079c7ea]

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=43132559e1deaf044f1517776121d66b644bf1fb
---

 configure.ac                |    7 +++++++
 modules/video_output/caca.c |   24 ++++++++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2caa4ba..2515602 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4111,6 +4111,13 @@ then
     VLC_ADD_PLUGINS([caca])
     VLC_ADD_CFLAGS([caca],[`${CACA_CONFIG} --cflags`])
     VLC_ADD_LDFLAGS([caca],[`${CACA_CONFIG} --plugin-libs`])
+    AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <caca.h>
+                                        caca_event_t ev;]],
+                                        [[ev.type = 0;]]
+                       )],
+                       [],
+      [AC_DEFINE(CACA_EVENT_OPAQUE, [1], ["Define if struct caca_event is opaque and must not be accessed directly"])]
+    )
   fi
 fi
 
diff --git a/modules/video_output/caca.c b/modules/video_output/caca.c
index f68f4f8..d826972 100644
--- a/modules/video_output/caca.c
+++ b/modules/video_output/caca.c
@@ -306,14 +306,22 @@ static int Manage( vout_thread_t *p_vout )
         vlc_value_t val;
 
 #ifdef CACA_API_VERSION_1
+#ifdef CACA_EVENT_OPAQUE
+        switch( caca_get_event_type( &ev ) )
+#else
         switch( ev.type )
+#endif /* CACA_EVENT_OPAQUE */
 #else
         switch( ev )
 #endif
         {
         case CACA_EVENT_KEY_RELEASE:
 #ifdef CACA_API_VERSION_1
+#ifdef CACA_EVENT_OPAQUE
+            switch( caca_get_event_key_ch( &ev ) )
+#else
             switch( ev.data.key.ch )
+#endif /* CACA_EVENT_OPAQUE */
 #else
             switch( ev & 0x00ffffff )
 #endif
@@ -336,10 +344,22 @@ static int Manage( vout_thread_t *p_vout )
             break;
 #ifdef CACA_API_VERSION_1
         case  CACA_EVENT_MOUSE_MOTION:
-            val.i_int = ev.data.mouse.x * p_vout->render.i_width
+            val.i_int =
+#ifdef CACA_EVENT_OPAQUE
+                caca_get_event_mouse_x( &ev )
+#else
+                ev.data.mouse.x
+#endif /* CACA_EVENT_OPAQUE */
+                * p_vout->render.i_width
                          / cucul_get_canvas_width( p_vout->p_sys->p_cv );
             var_Set( p_vout, "mouse-x", val );
-            val.i_int = ev.data.mouse.y * p_vout->render.i_height
+            val.i_int =
+#ifdef CACA_EVENT_OPAQUE
+                caca_get_event_mouse_y( &ev ) 
+#else
+                ev.data.mouse.y
+#endif /* CACA_EVENT_OPAQUE */
+                * p_vout->render.i_height
                          / cucul_get_canvas_height( p_vout->p_sys->p_cv );
             var_Set( p_vout, "mouse-y", val );
             val.b_bool = VLC_TRUE;




More information about the vlc-devel mailing list