Mercurial > libdvdnav.hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
165:4e5ebc1491d5 | 166:3bfaec0c1288 |
---|---|
173 fprintf(MSG_OUT,"right %d\n", btni->right); | 173 fprintf(MSG_OUT,"right %d\n", btni->right); |
174 for(k = 0; k < 8; k++) { | 174 for(k = 0; k < 8; k++) { |
175 fprintf(MSG_OUT, "libdvdnav: %02x ", btni->cmd.bytes[k]); | 175 fprintf(MSG_OUT, "libdvdnav: %02x ", btni->cmd.bytes[k]); |
176 } | 176 } |
177 fprintf(MSG_OUT, "| "); | 177 fprintf(MSG_OUT, "| "); |
178 #ifdef TRACE | |
178 vm_print_mnemonic(&btni->cmd); | 179 vm_print_mnemonic(&btni->cmd); |
180 #endif | |
179 fprintf(MSG_OUT, "\n"); | 181 fprintf(MSG_OUT, "\n"); |
180 } | 182 } |
181 } | 183 } |
182 } | 184 } |
183 } | 185 } |
221 | 223 |
222 if(!this) { | 224 if(!this) { |
223 printerr("Passed a NULL pointer."); | 225 printerr("Passed a NULL pointer."); |
224 return S_ERR; | 226 return S_ERR; |
225 } | 227 } |
228 if(!pci->hli.hl_gi.hli_ss) { | |
229 printerr("Not in a menu."); | |
230 return S_ERR; | |
231 } | |
226 | 232 |
227 button = this->vm->state.HL_BTNN_REG >> 10; | 233 button = this->vm->state.HL_BTNN_REG >> 10; |
228 #ifdef BUTTON_TESTING | 234 #ifdef BUTTON_TESTING |
229 nav_print_PCI(&(this->pci)); | 235 nav_print_PCI(pci); |
230 #endif | 236 #endif |
231 | 237 |
232 return &(pci->hli.btnit[button-1]); | 238 return &(pci->hli.btnit[button-1]); |
233 } | 239 } |
234 | 240 |
310 btni_t *button_ptr; | 316 btni_t *button_ptr; |
311 | 317 |
312 #ifdef BUTTON_TESTING | 318 #ifdef BUTTON_TESTING |
313 fprintf(MSG_OUT, "libdvdnav: Button get_highlight_area %i\n", button); | 319 fprintf(MSG_OUT, "libdvdnav: Button get_highlight_area %i\n", button); |
314 #endif | 320 #endif |
315 | 321 |
322 if(!nav_pci->hli.hl_gi.hli_ss) | |
323 return S_ERR; | |
316 if((button <= 0) || (button > nav_pci->hli.hl_gi.btn_ns)) | 324 if((button <= 0) || (button > nav_pci->hli.hl_gi.btn_ns)) |
317 return S_ERR; | 325 return S_ERR; |
326 | |
318 | 327 |
319 button_ptr = &nav_pci->hli.btnit[button-1]; | 328 button_ptr = &nav_pci->hli.btnit[button-1]; |
320 | 329 |
321 highlight->sx = button_ptr->x_start; | 330 highlight->sx = button_ptr->x_start; |
322 highlight->sy = button_ptr->y_start; | 331 highlight->sy = button_ptr->y_start; |
346 | 355 |
347 if(!this) { | 356 if(!this) { |
348 printerr("Passed a NULL pointer."); | 357 printerr("Passed a NULL pointer."); |
349 return S_ERR; | 358 return S_ERR; |
350 } | 359 } |
360 if(!pci->hli.hl_gi.hli_ss) { | |
361 printerr("Not in a menu."); | |
362 return S_ERR; | |
363 } | |
351 | 364 |
352 pthread_mutex_lock(&this->vm_lock); | 365 pthread_mutex_lock(&this->vm_lock); |
353 | 366 |
354 button = this->vm->state.HL_BTNN_REG >> 10; | 367 button = this->vm->state.HL_BTNN_REG >> 10; |
355 | 368 |
356 if((button <= 0) || (button > pci->hli.hl_gi.btn_ns)) { | 369 if((button <= 0) || (button > pci->hli.hl_gi.btn_ns)) { |
357 /* Special code to handle still menus with no buttons. | 370 /* Special code to handle still menus with no buttons. |
358 * the navigation is expected to report to the appicatino that a STILL is | 371 * The navigation is expected to report to the application that a STILL is |
359 * underway. In turn, the application is supposed to report to the user | 372 * underway. In turn, the application is supposed to report to the user |
360 * that the playback is pause. The user is then expected to undo the pause. | 373 * that the playback is paused. The user is then expected to undo the pause, |
361 * ie: hit play. At that point, the navigation should release the still and | 374 * ie: hit play. At that point, the navigation should release the still and |
362 * go to the next Cell. | 375 * go to the next Cell. |
363 * Explanation by Mathieu Lavage <mathieu_lacage@realmagic.fr> | 376 * Explanation by Mathieu Lacage <mathieu_lacage@realmagic.fr> |
364 * Code added by jcdutton. | 377 * Code added by jcdutton. |
365 */ | 378 */ |
366 if (this->position_current.still != 0) { | 379 if (this->position_current.still != 0) { |
367 /* In still, but no buttons. */ | 380 /* In still, but no buttons. */ |
368 vm_get_next_cell(this->vm); | 381 vm_get_next_cell(this->vm); |
424 | 437 |
425 if(!this) { | 438 if(!this) { |
426 printerr("Passed a NULL pointer."); | 439 printerr("Passed a NULL pointer."); |
427 return S_ERR; | 440 return S_ERR; |
428 } | 441 } |
442 if(!pci->hli.hl_gi.hli_ss) { | |
443 printerr("Not in a menu."); | |
444 return S_ERR; | |
445 } | |
429 | 446 |
430 #ifdef BUTTON_TESTING | 447 #ifdef BUTTON_TESTING |
431 fprintf(MSG_OUT, "libdvdnav: Button select %i\n", button); | 448 fprintf(MSG_OUT, "libdvdnav: Button select %i\n", button); |
432 #endif | 449 #endif |
433 | 450 |
450 return S_ERR; | 467 return S_ERR; |
451 } | 468 } |
452 | 469 |
453 dvdnav_status_t dvdnav_mouse_select(dvdnav_t *this, pci_t *pci, int x, int y) { | 470 dvdnav_status_t dvdnav_mouse_select(dvdnav_t *this, pci_t *pci, int x, int y) { |
454 int button, cur_button; | 471 int button, cur_button; |
455 uint32_t best,dist; | 472 int best,dist,d; |
456 int mx,my,dx,dy,d; | 473 int mx,my,dx,dy; |
457 | 474 |
458 if(!this) { | 475 if(!this) { |
459 printerr("Passed a NULL pointer."); | 476 printerr("Passed a NULL pointer."); |
477 return S_ERR; | |
478 } | |
479 if(!pci->hli.hl_gi.hli_ss) { | |
480 printerr("Not in a menu."); | |
460 return S_ERR; | 481 return S_ERR; |
461 } | 482 } |
462 | 483 |
463 cur_button = this->vm->state.HL_BTNN_REG >> 10; | 484 cur_button = this->vm->state.HL_BTNN_REG >> 10; |
464 | 485 |