Mercurial > libdvdnav.hg
diff highlight.c @ 166:3bfaec0c1288 src
* fix warnings with gcc 3.3
* some menu sanity checking in highlight.c (the button functions should do nothing,
when called outside a menu)
* escape should take us to the Root menu, not the Title menu, since this is what
the standard "Menu" button on a DVD player does
author | mroi |
---|---|
date | Mon, 21 Apr 2003 13:18:06 +0000 |
parents | 175d5fef21e4 |
children | 90b1f6f0520e |
line wrap: on
line diff
--- a/highlight.c Tue Apr 08 13:51:55 2003 +0000 +++ b/highlight.c Mon Apr 21 13:18:06 2003 +0000 @@ -175,7 +175,9 @@ fprintf(MSG_OUT, "libdvdnav: %02x ", btni->cmd.bytes[k]); } fprintf(MSG_OUT, "| "); +#ifdef TRACE vm_print_mnemonic(&btni->cmd); +#endif fprintf(MSG_OUT, "\n"); } } @@ -223,10 +225,14 @@ printerr("Passed a NULL pointer."); return S_ERR; } + if(!pci->hli.hl_gi.hli_ss) { + printerr("Not in a menu."); + return S_ERR; + } button = this->vm->state.HL_BTNN_REG >> 10; #ifdef BUTTON_TESTING - nav_print_PCI(&(this->pci)); + nav_print_PCI(pci); #endif return &(pci->hli.btnit[button-1]); @@ -312,10 +318,13 @@ #ifdef BUTTON_TESTING fprintf(MSG_OUT, "libdvdnav: Button get_highlight_area %i\n", button); #endif - + + if(!nav_pci->hli.hl_gi.hli_ss) + return S_ERR; if((button <= 0) || (button > nav_pci->hli.hl_gi.btn_ns)) return S_ERR; + button_ptr = &nav_pci->hli.btnit[button-1]; highlight->sx = button_ptr->x_start; @@ -348,6 +357,10 @@ printerr("Passed a NULL pointer."); return S_ERR; } + if(!pci->hli.hl_gi.hli_ss) { + printerr("Not in a menu."); + return S_ERR; + } pthread_mutex_lock(&this->vm_lock); @@ -355,12 +368,12 @@ if((button <= 0) || (button > pci->hli.hl_gi.btn_ns)) { /* Special code to handle still menus with no buttons. - * the navigation is expected to report to the appicatino that a STILL is + * The navigation is expected to report to the application that a STILL is * underway. In turn, the application is supposed to report to the user - * that the playback is pause. The user is then expected to undo the pause. + * that the playback is paused. The user is then expected to undo the pause, * ie: hit play. At that point, the navigation should release the still and * go to the next Cell. - * Explanation by Mathieu Lavage <mathieu_lacage@realmagic.fr> + * Explanation by Mathieu Lacage <mathieu_lacage@realmagic.fr> * Code added by jcdutton. */ if (this->position_current.still != 0) { @@ -426,6 +439,10 @@ printerr("Passed a NULL pointer."); return S_ERR; } + if(!pci->hli.hl_gi.hli_ss) { + printerr("Not in a menu."); + return S_ERR; + } #ifdef BUTTON_TESTING fprintf(MSG_OUT, "libdvdnav: Button select %i\n", button); @@ -452,13 +469,17 @@ dvdnav_status_t dvdnav_mouse_select(dvdnav_t *this, pci_t *pci, int x, int y) { int button, cur_button; - uint32_t best,dist; - int mx,my,dx,dy,d; + int best,dist,d; + int mx,my,dx,dy; if(!this) { printerr("Passed a NULL pointer."); return S_ERR; } + if(!pci->hli.hl_gi.hli_ss) { + printerr("Not in a menu."); + return S_ERR; + } cur_button = this->vm->state.HL_BTNN_REG >> 10;