Mercurial > libdvdnav.hg
annotate highlight.c @ 31:8b08ee66cbff src
Quiet please!!!
| author | jcdutton |
|---|---|
| date | Wed, 24 Apr 2002 21:15:25 +0000 |
| parents | 630b6733e492 |
| children | 131ad65a2398 |
| rev | line source |
|---|---|
| 0 | 1 /* |
| 2 * Copyright (C) 2000 Rich Wareham <richwareham@users.sourceforge.net> | |
| 3 * | |
| 4 * This file is part of libdvdnav, a DVD navigation library. | |
| 5 * | |
| 6 * libdvdnav is free software; you can redistribute it and/or modify | |
| 7 * it under the terms of the GNU General Public License as published by | |
| 8 * the Free Software Foundation; either version 2 of the License, or | |
| 9 * (at your option) any later version. | |
| 10 * | |
| 11 * libdvdnav is distributed in the hope that it will be useful, | |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 * GNU General Public License for more details. | |
| 15 * | |
| 16 * You should have received a copy of the GNU General Public License | |
| 17 * along with this program; if not, write to the Free Software | |
| 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | |
| 19 * | |
| 20 * $Id$ | |
| 21 * | |
| 22 */ | |
| 23 | |
| 24 #ifdef HAVE_CONFIG_H | |
| 25 #include "config.h" | |
| 26 #endif | |
| 27 | |
| 28 /* | |
| 29 #define BUTTON_TESTING | |
| 30 */ | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
31 #include <assert.h> |
| 0 | 32 |
| 33 #include <dvdnav.h> | |
| 34 #include "dvdnav_internal.h" | |
| 35 | |
| 36 #include "vm.h" | |
| 37 # | |
| 38 #include <dvdread/nav_types.h> | |
| 39 | |
| 40 #ifdef BUTTON_TESTING | |
| 41 #include <dvdread/nav_print.h> | |
| 42 #endif | |
| 43 | |
| 44 /* Highlighting API calls */ | |
| 45 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
46 dvdnav_status_t dvdnav_get_current_highlight(dvdnav_t *this, int* button) { |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
47 if(!this) |
| 0 | 48 return S_ERR; |
| 49 | |
| 50 /* Simply return the appropriate value based on the SPRM */ | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
51 (*button) = (this->vm->state.HL_BTNN_REG) >> 10; |
| 0 | 52 |
| 53 return S_OK; | |
| 54 } | |
| 55 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
56 pci_t* dvdnav_get_current_nav_pci(dvdnav_t *this) { |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
57 if (!this ) assert(0); |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
58 return &this->pci; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
59 } |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
60 |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
61 btni_t *__get_current_button(dvdnav_t *this) { |
| 0 | 62 int button = 0; |
| 63 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
64 if(dvdnav_get_current_highlight(this, &button) != S_OK) { |
| 0 | 65 printerrf("Unable to get information on current highlight."); |
| 66 return NULL; | |
| 67 } | |
| 68 #ifdef BUTTON_TESTING | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
69 navPrint_PCI(&(this->pci)); |
| 0 | 70 #endif |
| 71 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
72 return &(this->pci.hli.btnit[button-1]); |
| 0 | 73 } |
| 74 | |
| 29 | 75 dvdnav_status_t dvdnav_button_auto_action(dvdnav_t *this) { |
| 76 btni_t *button_ptr; | |
| 77 | |
| 78 if(!this) | |
| 79 return S_ERR; | |
| 80 | |
| 81 if((button_ptr = __get_current_button(this)) == NULL) { | |
| 82 return S_ERR; | |
| 83 } | |
| 84 if (button_ptr->auto_action_mode == 1) { | |
| 85 return S_OK; | |
| 86 } | |
| 87 return S_ERR; | |
| 88 } | |
| 89 | |
| 90 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
91 dvdnav_status_t dvdnav_upper_button_select(dvdnav_t *this) { |
| 0 | 92 btni_t *button_ptr; |
| 93 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
94 if(!this) |
| 0 | 95 return S_ERR; |
| 96 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
97 if((button_ptr = __get_current_button(this)) == NULL) { |
| 0 | 98 return S_ERR; |
| 99 } | |
| 100 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
101 dvdnav_button_select(this, button_ptr->up); |
| 29 | 102 if (dvdnav_button_auto_action(this) ) { |
| 103 dvdnav_button_activate(this); | |
| 104 } | |
| 105 | |
| 0 | 106 return S_OK; |
| 107 } | |
| 108 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
109 dvdnav_status_t dvdnav_lower_button_select(dvdnav_t *this) { |
| 0 | 110 btni_t *button_ptr; |
| 111 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
112 if(!this) |
| 0 | 113 return S_ERR; |
| 114 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
115 if((button_ptr = __get_current_button(this)) == NULL) { |
| 0 | 116 return S_ERR; |
| 117 } | |
| 118 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
119 dvdnav_button_select(this, button_ptr->down); |
| 29 | 120 if (dvdnav_button_auto_action(this) ) { |
| 121 dvdnav_button_activate(this); | |
| 122 } | |
| 0 | 123 |
| 124 return S_OK; | |
| 125 } | |
| 126 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
127 dvdnav_status_t dvdnav_right_button_select(dvdnav_t *this) { |
| 0 | 128 btni_t *button_ptr; |
| 129 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
130 if(!this) |
| 0 | 131 return S_ERR; |
| 132 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
133 if((button_ptr = __get_current_button(this)) == NULL) { |
| 0 | 134 printerr("Error fetching information on current button."); |
| 135 return S_ERR; | |
| 136 } | |
| 137 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
138 dvdnav_button_select(this, button_ptr->right); |
| 29 | 139 if (dvdnav_button_auto_action(this) ) { |
| 140 dvdnav_button_activate(this); | |
| 141 } | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
142 |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
143 return S_OK; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
144 } |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
145 |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
146 dvdnav_status_t dvdnav_left_button_select(dvdnav_t *this) { |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
147 btni_t *button_ptr; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
148 |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
149 if(!this) |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
150 return S_ERR; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
151 |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
152 if((button_ptr = __get_current_button(this)) == NULL) { |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
153 return S_ERR; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
154 } |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
155 |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
156 dvdnav_button_select(this, button_ptr->left); |
| 29 | 157 if (dvdnav_button_auto_action(this) ) { |
| 158 dvdnav_button_activate(this); | |
| 159 } | |
| 0 | 160 |
| 161 return S_OK; | |
| 162 } | |
| 163 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
164 dvdnav_status_t dvdnav_get_highlight_area(pci_t* nav_pci , int32_t button, int32_t mode, |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
165 dvdnav_highlight_area_t* highlight) { |
| 0 | 166 btni_t *button_ptr; |
| 31 | 167 #ifdef BUTTON_TESTING |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
168 fprintf(stderr,"Button get_highlight_area %i\n", button); |
| 31 | 169 #endif |
| 0 | 170 |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
171 /* Set the highlight SPRM if the passed button was valid*/ |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
172 if((button <= 0) || (button > nav_pci->hli.hl_gi.btn_ns)) { |
| 30 | 173 fprintf(stderr,"Unable to select button number %i as it doesn't exist\n", |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
174 button); |
| 0 | 175 return S_ERR; |
| 176 } | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
177 button_ptr = &nav_pci->hli.btnit[button-1]; |
| 0 | 178 |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
179 highlight->sx = button_ptr->x_start; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
180 highlight->sy = button_ptr->y_start; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
181 highlight->ex = button_ptr->x_end; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
182 highlight->ey = button_ptr->y_end; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
183 if(button_ptr->btn_coln != 0) { |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
184 highlight->palette = nav_pci->hli.btn_colit.btn_coli[button_ptr->btn_coln-1][mode]; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
185 } else { |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
186 highlight->palette = 0; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
187 } |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
188 highlight->pts = nav_pci->hli.hl_gi.hli_s_ptm; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
189 highlight->buttonN = button; |
| 31 | 190 #ifdef BUTTON_TESTING |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
191 fprintf(stderr,"highlight.c:Highlight area is (%u,%u)-(%u,%u), display = %i, button = %u\n", |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
192 button_ptr->x_start, button_ptr->y_start, |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
193 button_ptr->x_end, button_ptr->y_end, |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
194 1, |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
195 button); |
| 31 | 196 #endif |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
197 |
| 0 | 198 return S_OK; |
| 199 } | |
| 200 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
201 dvdnav_status_t dvdnav_button_activate(dvdnav_t *this) { |
| 0 | 202 int button; |
| 26 | 203 btni_t *button_ptr = NULL; |
| 0 | 204 |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
205 if(!this) |
| 0 | 206 return S_ERR; |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
207 pthread_mutex_lock(&this->vm_lock); |
| 0 | 208 |
| 209 /* Precisely the same as selecting a button except we want | |
| 210 * a different palette */ | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
211 if(dvdnav_get_current_highlight(this, &button) != S_OK) { |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
212 pthread_mutex_unlock(&this->vm_lock); |
| 0 | 213 return S_ERR; |
| 214 } | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
215 if(dvdnav_button_select(this, button) != S_OK) { |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
216 pthread_mutex_unlock(&this->vm_lock); |
| 0 | 217 return S_ERR; |
| 218 } | |
| 26 | 219 /* FIXME: The button command should really be passed in the API instead. */ |
| 220 button_ptr = __get_current_button(this); | |
| 0 | 221 /* Finally, make the VM execute the appropriate code and |
| 222 * scedule a jump */ | |
| 31 | 223 #ifdef BUTTON_TESTING |
|
10
6f0fb88d1463
Added some debug info, to hopefully help in tracking bugs in libdvdnav.
jcdutton
parents:
3
diff
changeset
|
224 fprintf(stderr, "libdvdnav: Evaluating Button Activation commands.\n"); |
| 31 | 225 #endif |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
226 if(vm_eval_cmd(this->vm, &(button_ptr->cmd)) == 1) { |
| 26 | 227 /* Command caused a jump */ |
| 228 this->vm->hop_channel++; | |
| 229 this->position_current.still = 0; | |
| 0 | 230 } |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
231 pthread_mutex_unlock(&this->vm_lock); |
| 0 | 232 return S_OK; |
| 233 } | |
| 234 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
235 dvdnav_status_t dvdnav_button_select(dvdnav_t *this, int button) { |
| 0 | 236 |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
237 if(!this) { |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
238 printerrf("Unable to select button number %i as this state bad", |
| 0 | 239 button); |
| 240 return S_ERR; | |
| 241 } | |
| 242 | |
| 31 | 243 #ifdef BUTTON_TESTING |
| 244 fprintf(stderr,"libdvdnav: Button select %i\n", button); | |
| 245 #endif | |
| 0 | 246 |
| 247 /* Set the highlight SPRM if the passed button was valid*/ | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
248 if((button <= 0) || (button > this->pci.hli.hl_gi.btn_ns)) { |
| 0 | 249 printerrf("Unable to select button number %i as it doesn't exist", |
| 250 button); | |
| 251 return S_ERR; | |
| 252 } | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
253 this->vm->state.HL_BTNN_REG = (button << 10); |
| 0 | 254 |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
255 this->hli_state = 1; /* Selected */ |
| 0 | 256 |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
257 // this->position_current.button = -1; /* Force Highligh change */ |
| 0 | 258 |
| 259 return S_OK; | |
| 260 } | |
| 261 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
262 dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *this, |
| 0 | 263 int button) { |
| 264 /* A trivial function */ | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
265 if(dvdnav_button_select(this, button) != S_ERR) { |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
266 return dvdnav_button_activate(this); |
| 0 | 267 } |
| 268 | |
| 269 /* Should never get here without an error */ | |
| 270 return S_ERR; | |
| 271 } | |
| 272 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
273 dvdnav_status_t dvdnav_mouse_select(dvdnav_t *this, int x, int y) { |
| 0 | 274 int button, cur_button; |
| 275 | |
| 276 /* FIXME: At the moment, the case of no button matchin (x,y) is | |
| 277 * silently ignored, is this OK? */ | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
278 if(!this) |
| 0 | 279 return S_ERR; |
| 280 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
281 if(dvdnav_get_current_highlight(this, &cur_button) != S_OK) { |
| 0 | 282 return S_ERR; |
| 283 } | |
| 284 | |
| 285 /* Loop through each button */ | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
286 for(button=1; button <= this->pci.hli.hl_gi.btn_ns; button++) { |
| 0 | 287 btni_t *button_ptr = NULL; |
| 288 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
289 button_ptr = &(this->pci.hli.btnit[button-1]); |
| 0 | 290 if((x >= button_ptr->x_start) && (x <= button_ptr->x_end) && |
| 291 (y >= button_ptr->y_start) && (y <= button_ptr->y_end)) { | |
| 292 /* As an efficiency measure, only re-select the button | |
| 293 * if it is different to the previously selected one. */ | |
| 294 if(button != cur_button) { | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
295 dvdnav_button_select(this, button); |
| 0 | 296 } |
| 297 } | |
| 298 } | |
| 299 | |
| 300 return S_OK; | |
| 301 } | |
| 302 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
303 dvdnav_status_t dvdnav_mouse_activate(dvdnav_t *this, int x, int y) { |
| 0 | 304 /* A trivial function */ |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
305 if(dvdnav_mouse_select(this, x,y) != S_ERR) { |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
306 return dvdnav_button_activate(this); |
| 0 | 307 } |
| 308 | |
| 309 /* Should never get here without an error */ | |
| 310 return S_ERR; | |
| 311 } | |
| 312 |
