changeset 19912:3fdb44285fe7

introduced new MP_CMD_DVDNAV_MOUSECLICK command (bound to mouse0); it's used to activate the button corresponding to the last mouse position. This is a workaround against possibly buggy implementation of upper_lower/upper_button_select() and friends; will be removed when possible
author nicodvb
date Tue, 19 Sep 2006 23:50:21 +0000
parents 2ca75d2fbcc6
children ae5618f5f517
files input/input.c input/input.h stream/stream_dvdnav.c stream/stream_dvdnav.h
diffstat 4 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/input/input.c	Tue Sep 19 22:59:05 2006 +0000
+++ b/input/input.c	Tue Sep 19 23:50:21 2006 +0000
@@ -317,7 +317,7 @@
   { { KEY_KP6, 0 }, "dvdnav 4" },   // right
   { { KEY_KP5, 0 }, "dvdnav 5" },   // menu
   { { KEY_KPENTER, 0 }, "dvdnav 6" },   // select
-  { { MOUSE_BTN0, 0 }, "dvdnav 6" },   //select
+  { { MOUSE_BTN0, 0 }, "dvdnav 8" },   //select
   { { KEY_KP7, 0 }, "dvdnav 7" },   // previous menu
 #endif
 
--- a/input/input.h	Tue Sep 19 22:59:05 2006 +0000
+++ b/input/input.h	Tue Sep 19 23:50:21 2006 +0000
@@ -113,6 +113,7 @@
 #define MP_CMD_DVDNAV_MENU      5
 #define MP_CMD_DVDNAV_SELECT    6
 #define MP_CMD_DVDNAV_PREVMENU  7
+#define MP_CMD_DVDNAV_MOUSECLICK  8
 
 /// Console commands
 #define MP_CMD_CHELP 7000
--- a/stream/stream_dvdnav.c	Tue Sep 19 22:59:05 2006 +0000
+++ b/stream/stream_dvdnav.c	Tue Sep 19 23:50:21 2006 +0000
@@ -362,6 +362,16 @@
       status = dvdnav_button_activate(nav, pci);
       if(status == DVDNAV_STATUS_OK) reset = 1;
       break;
+    case MP_CMD_DVDNAV_MOUSECLICK:
+      /*
+        this is a workaround: in theory the simple dvdnav_lower_button_select()+dvdnav_button_activate()
+        should be enough (and generally it is), but there are cases when the calls to dvdnav_lower_button_select()
+        and friends fail! Hence we have to call dvdnav_mouse_activate(priv->mousex, priv->mousey) with
+        the coodinates saved by mp_dvdnav_update_mouse_pos().
+        This last call always works well
+      */
+      status = dvdnav_mouse_activate(nav, pci, dvdnav_priv->mousex, dvdnav_priv->mousey);
+      break;
     default:
       mp_msg(MSGT_CPLAYER, MSGL_V, "Unknown DVDNAV cmd %d\n", cmd);
       break;
@@ -384,6 +394,8 @@
   status = dvdnav_mouse_select(nav, pci, x, y);
   if(status == DVDNAV_STATUS_OK) dvdnav_get_current_highlight(nav, button);
   else *button = -1;
+  dvdnav_priv->mousex = x;
+  dvdnav_priv->mousey = y;
 }
 
 
--- a/stream/stream_dvdnav.h	Tue Sep 19 22:59:05 2006 +0000
+++ b/stream/stream_dvdnav.h	Tue Sep 19 23:50:21 2006 +0000
@@ -19,6 +19,7 @@
   unsigned char    prebuf[STREAM_BUFFER_SIZE]; /* prefill buffer */
   int              prelen;              /* length of prefill buffer */
   unsigned int     duration;            /* in milliseconds */
+  int              mousex, mousey;
 } dvdnav_priv_t;
 
 extern int dvd_nav_still;