diff options
author | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2003-06-02 06:36:30 +0000 |
---|---|---|
committer | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2003-06-02 06:36:30 +0000 |
commit | 4b2bf6fdebc77fca044d9aa043dd56726d10e7d1 (patch) | |
tree | 21fe7b3fd1e5e2885f9d5686795121e83f9929a1 | |
parent | 620c5284eda213c0b7d0596ea405de5fd4e22aa0 (diff) | |
download | xine-lib-4b2bf6fdebc77fca044d9aa043dd56726d10e7d1.tar.gz xine-lib-4b2bf6fdebc77fca044d9aa043dd56726d10e7d1.tar.bz2 |
new event which inform UI when the mouse pointer enter and leave a spu button (DVD navigation)
CVS patchset: 4997
CVS date: 2003/06/02 06:36:30
-rw-r--r-- | include/xine.h.in | 7 | ||||
-rw-r--r-- | src/input/input_dvd.c | 103 | ||||
-rw-r--r-- | src/input/libdvdnav/highlight.c | 5 |
3 files changed, 103 insertions, 12 deletions
diff --git a/include/xine.h.in b/include/xine.h.in index 9a0cefcac..2fec4c118 100644 --- a/include/xine.h.in +++ b/include/xine.h.in @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.h.in,v 1.87 2003/05/28 04:26:02 miguelfreitas Exp $ + * $Id: xine.h.in,v 1.88 2003/06/02 06:36:30 f1rmb Exp $ * * public xine-lib (libxine) interface and documentation * @@ -1255,6 +1255,7 @@ void xine_config_reset (xine_t *self); #define XINE_EVENT_PROGRESS 8 /* index creation/network connections */ #define XINE_EVENT_MRL_REFERENCE 9 /* demuxer->frontend: MRL reference(s) for the real stream */ #define XINE_EVENT_UI_NUM_BUTTONS 10 /* number of buttons for interactive menus */ +#define XINE_EVENT_SPU_BUTTON 11 /* the mouse pointer enter/leave a button */ /* input events coming from frontend */ #define XINE_EVENT_INPUT_MOUSE_BUTTON 101 @@ -1458,6 +1459,10 @@ typedef struct { } xine_set_mpeg_data_t; +typedef struct { + int direction; /* 0 leave, 1 enter */ + int32_t button; /* button number */ +} xine_spu_button_t; #ifdef XINE_ENABLE_EXPERIMENTAL_FEATURES diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 6c324db17..4e4048a78 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_dvd.c,v 1.164 2003/05/23 10:34:13 mroi Exp $ + * $Id: input_dvd.c,v 1.165 2003/06/02 06:36:32 f1rmb Exp $ * */ @@ -188,6 +188,9 @@ typedef struct { int64_t pg_start; int32_t buttonN; int typed_buttonN;/* for XINE_EVENT_INPUT_NUMBER_* */ + + int32_t mouse_buttonN; + int mouse_in; /* Flags */ int opened; /* 1 if the DVD device is already open */ @@ -320,6 +323,31 @@ void language_changed_cb(void *this_gen, xine_cfg_entry_t *entry) { dvdnav_spu_language_select(this->dvdnav, entry->str_value); } } + +static void send_mouse_enter_leave_event(dvd_input_plugin_t *this, int direction) { + + if(direction && this->mouse_in) + this->mouse_in = !this->mouse_in; + + if(direction != this->mouse_in) { + xine_event_t event; + xine_spu_button_t spu_event; + + spu_event.direction = direction; + spu_event.button = this->mouse_buttonN; + + event.type = XINE_EVENT_SPU_BUTTON; + event.stream = this->stream; + event.data = &spu_event; + event.data_length = sizeof(spu_event); + xine_event_send(this->stream, &event); + + this->mouse_in = direction; + } + + if(!direction) + this->mouse_buttonN = -1; +} void update_title_display(dvd_input_plugin_t *this) { xine_event_t uevent; @@ -841,9 +869,13 @@ static void xine_dvd_send_button_update(dvd_input_plugin_t *this, int mode) { if (!this || !(this->stream) || !(this->stream->spu_decoder_plugin) ) { return; } + dvdnav_get_current_highlight(this->dvdnav, &button); - if (button == this->buttonN && (mode ==0) ) return; + + if (button == this->buttonN && (mode == 0) ) return; + this->buttonN = button; /* Avoid duplicate sending of button info */ + #ifdef INPUT_DEBUG printf("input_dvd: sending_button_update button=%d mode=%d\n", button, mode); #endif @@ -987,8 +1019,16 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { } if (this->stream->spu_decoder_plugin->get_interact_info(this->stream->spu_decoder_plugin, &nav_pci) ) { xine_input_data_t *input = event->data; - if (dvdnav_mouse_activate(this->dvdnav, &nav_pci, input->x, input->y) == DVDNAV_STATUS_OK) + if (dvdnav_mouse_activate(this->dvdnav, + &nav_pci, input->x, input->y) == DVDNAV_STATUS_OK) { xine_dvd_send_button_update(this, 1); + + if(this->mouse_in) + send_mouse_enter_leave_event(this, 0); + + this->mouse_buttonN = -1; + + } } } break; @@ -1013,7 +1053,22 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { if (this->stream->spu_decoder_plugin->get_interact_info(this->stream->spu_decoder_plugin, &nav_pci) ) { xine_input_data_t *input = event->data; /* printf("input_dvd: Mouse move (x,y) = (%i,%i)\n", input->x, input->y); */ - dvdnav_mouse_select(this->dvdnav, &nav_pci, input->x, input->y); + if(dvdnav_mouse_select(this->dvdnav, &nav_pci, input->x, input->y) == DVDNAV_STATUS_OK) { + int32_t button; + + dvdnav_get_current_highlight(this->dvdnav, &button); + + if(this->mouse_buttonN != button) { + this->mouse_buttonN = button; + send_mouse_enter_leave_event(this, 1); + } + + } + else { + if(this->mouse_in) + send_mouse_enter_leave_event(this, 0); + + } } } break; @@ -1022,8 +1077,13 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { pci_t nav_pci; if(!this->stream || !this->stream->spu_decoder_plugin) return; - if (this->stream->spu_decoder_plugin->get_interact_info(this->stream->spu_decoder_plugin, &nav_pci) ) + if (this->stream->spu_decoder_plugin->get_interact_info(this->stream->spu_decoder_plugin, &nav_pci) ) { dvdnav_upper_button_select(this->dvdnav, &nav_pci); + + if(this->mouse_in) + send_mouse_enter_leave_event(this, 0); + + } break; } case XINE_EVENT_INPUT_DOWN: @@ -1031,8 +1091,13 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { pci_t nav_pci; if(!this->stream || !this->stream->spu_decoder_plugin) return; - if (this->stream->spu_decoder_plugin->get_interact_info(this->stream->spu_decoder_plugin, &nav_pci) ) + if (this->stream->spu_decoder_plugin->get_interact_info(this->stream->spu_decoder_plugin, &nav_pci) ) { dvdnav_lower_button_select(this->dvdnav, &nav_pci); + + if(this->mouse_in) + send_mouse_enter_leave_event(this, 0); + + } break; } case XINE_EVENT_INPUT_LEFT: @@ -1040,8 +1105,13 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { pci_t nav_pci; if(!this->stream || !this->stream->spu_decoder_plugin) return; - if (this->stream->spu_decoder_plugin->get_interact_info(this->stream->spu_decoder_plugin, &nav_pci) ) + if (this->stream->spu_decoder_plugin->get_interact_info(this->stream->spu_decoder_plugin, &nav_pci) ) { dvdnav_left_button_select(this->dvdnav, &nav_pci); + + if(this->mouse_in) + send_mouse_enter_leave_event(this, 0); + + } break; } case XINE_EVENT_INPUT_RIGHT: @@ -1049,8 +1119,13 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { pci_t nav_pci; if(!this->stream || !this->stream->spu_decoder_plugin) return; - if (this->stream->spu_decoder_plugin->get_interact_info(this->stream->spu_decoder_plugin, &nav_pci) ) + if (this->stream->spu_decoder_plugin->get_interact_info(this->stream->spu_decoder_plugin, &nav_pci) ) { dvdnav_right_button_select(this->dvdnav, &nav_pci); + + if(this->mouse_in) + send_mouse_enter_leave_event(this, 0); + + } break; } case XINE_EVENT_INPUT_NUMBER_9: @@ -1077,8 +1152,13 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { if(!this->stream || !this->stream->spu_decoder_plugin) return; if (this->stream->spu_decoder_plugin->get_interact_info(this->stream->spu_decoder_plugin, &nav_pci) ) { - if (dvdnav_button_select_and_activate(this->dvdnav, &nav_pci, this->typed_buttonN) == DVDNAV_STATUS_OK) + if (dvdnav_button_select_and_activate(this->dvdnav, &nav_pci, this->typed_buttonN) == DVDNAV_STATUS_OK) { xine_dvd_send_button_update(this, 1); + + if(this->mouse_in) + send_mouse_enter_leave_event(this, 0); + } + this->typed_buttonN = 0; } break; @@ -1444,6 +1524,8 @@ static input_plugin_t *dvd_class_get_instance (input_class_t *class_gen, xine_st this->opened = 0; this->seekable = 0; this->buttonN = 0; + this->mouse_buttonN = -1; + this->mouse_in = 0; this->typed_buttonN = 0; this->pause_timer = 0; this->pg_length = 0; @@ -1636,6 +1718,9 @@ static void *init_class (xine_t *xine, void *data) { /* * $Log: input_dvd.c,v $ + * Revision 1.165 2003/06/02 06:36:32 f1rmb + * new event which inform UI when the mouse pointer enter and leave a spu button (DVD navigation) + * * Revision 1.164 2003/05/23 10:34:13 mroi * make alternative devices (dvd:<path> and dvd:<device> style MRLs) work with * raw devices configured diff --git a/src/input/libdvdnav/highlight.c b/src/input/libdvdnav/highlight.c index c85f59e2c..f8dc4aaba 100644 --- a/src/input/libdvdnav/highlight.c +++ b/src/input/libdvdnav/highlight.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: highlight.c,v 1.15 2003/05/16 09:56:50 mroi Exp $ + * $Id: highlight.c,v 1.16 2003/06/02 06:36:33 f1rmb Exp $ * */ @@ -213,7 +213,8 @@ dvdnav_status_t dvdnav_get_current_highlight(dvdnav_t *this, int32_t *button) { } /* Simply return the appropriate value based on the SPRM */ - (*button) = this->position_current.button; + if(((*button) = this->position_current.button) == -1) + (*button) = this->vm->state.HL_BTNN_REG >> 10; return DVDNAV_STATUS_OK; } |