fix #1387 (update to new libcaca api)
authorRafaël Carré <funman@videolan.org>
Mon, 21 Jan 2008 16:30:36 +0000 (16:30 +0000)
committerRafaël Carré <funman@videolan.org>
Mon, 21 Jan 2008 16:30:36 +0000 (16:30 +0000)
configure.ac
modules/video_output/caca.c

index 948ff83..b50b2f5 100644 (file)
@@ -4631,6 +4631,13 @@ then
     VLC_ADD_PLUGINS([caca])
     VLC_ADD_CFLAGS([caca],[`${CACA_CONFIG} --cflags`])
     VLC_ADD_LIBS([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
 
index eb565db..1d8ff52 100644 (file)
@@ -304,14 +304,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
@@ -334,10 +342,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;