comparison src/uicmd.cc @ 2032:1a32d5ed2cd7

Made KEYS_LEFT_TAB and KEYS_RIGHT_TAB no longer handled as a special case * Made TAB-key focus the main area from location input. * Made KEYS_LEFT_TAB and KEYS_RIGHT_TAB cycle..
author Jorge Arellano Cid <jcid@dillo.org>
date Tue, 17 May 2011 18:57:29 -0400
parents ae8f0d070aea
children 45541ab7b1cc
comparison
equal deleted inserted replaced
2031:ae8f0d070aea 2032:1a32d5ed2cd7
147 // Hide findbar if present 147 // Hide findbar if present
148 ui->findbar_toggle(0); 148 ui->findbar_toggle(0);
149 ret = 1; 149 ret = 1;
150 } else if (cmd == KEYS_NOP) { 150 } else if (cmd == KEYS_NOP) {
151 // Do nothing 151 // Do nothing
152 _MSG("CustTabs::handle KEYS_NOP\n");
152 } else if (cmd == KEYS_NEW_TAB) { 153 } else if (cmd == KEYS_NEW_TAB) {
153 a_UIcmd_open_url_nt(bw, NULL, 1); 154 a_UIcmd_open_url_nt(bw, NULL, 1);
154 ret = 1; 155 ret = 1;
155 } else if (cmd == KEYS_CLOSE_TAB) { 156 } else if (cmd == KEYS_CLOSE_TAB) {
156 a_UIcmd_close_bw(bw); 157 a_UIcmd_close_bw(bw);
157 ret = 1; 158 ret = 1;
158 } else if (cmd == KEYS_LEFT_TAB) { 159 } else if (cmd == KEYS_LEFT_TAB) {
159 MSG("CustTabs::handle KEYS_LEFT_TAB\n"); 160 prev_tab();
160 ret = 1; 161 ret = 1;
161 } else if (cmd == KEYS_RIGHT_TAB) { 162 } else if (cmd == KEYS_RIGHT_TAB) {
162 MSG("CustTabs::handle KEYS_RIGHT_TAB\n"); 163 next_tab();
163 ret = 1; 164 ret = 1;
164 } else if (cmd == KEYS_NEW_WINDOW) { 165 } else if (cmd == KEYS_NEW_WINDOW) {
165 a_UIcmd_open_url_nw(bw, NULL); 166 a_UIcmd_open_url_nw(bw, NULL);
166 ret = 1; 167 ret = 1;
167 } else if (cmd == KEYS_FULLSCREEN) { 168 } else if (cmd == KEYS_FULLSCREEN) {
169 ret = 1; 170 ret = 1;
170 } else if (cmd == KEYS_CLOSE_ALL) { 171 } else if (cmd == KEYS_CLOSE_ALL) {
171 a_Timeout_add(0.0, a_UIcmd_close_all_bw, NULL); 172 a_Timeout_add(0.0, a_UIcmd_close_all_bw, NULL);
172 ret = 1; 173 ret = 1;
173 } 174 }
174
175 } else if (e == FL_KEYUP) {
176 int k = Fl::event_key();
177 // We're only interested in some flags
178 unsigned modifier = Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT);
179 if (k == FL_Up || k == FL_Down || k == FL_Tab) {
180 ;
181 } else if (k == FL_Left || k == FL_Right) {
182 if (modifier == FL_SHIFT) {
183 (k == FL_Left) ? prev_tab() : next_tab();
184 ret = 1;
185 }
186 }
187 } 175 }
188 176
189 return (ret) ? ret : CustGroup::handle(e); 177 return (ret) ? ret : CustGroup::handle(e);
190 } 178 }
191 179
283 271
284 void CustTabs::prev_tab() 272 void CustTabs::prev_tab()
285 { 273 {
286 int idx; 274 int idx;
287 275
288 if ((idx = get_btn_idx((UI*)Wizard->value())) > 1) 276 if ((idx = get_btn_idx((UI*)Wizard->value())) != -1)
289 switch_tab( (CustTabButton*)child(idx-1) ); 277 switch_tab( (CustTabButton*)child(idx > 1 ? idx-1 : num_tabs()) );
290 } 278 }
291 279
292 void CustTabs::next_tab() 280 void CustTabs::next_tab()
293 { 281 {
294 int idx; 282 int idx;
295 283
296 if ((idx = get_btn_idx((UI*)Wizard->value())) > 0 && idx < num_tabs()) 284 if ((idx = get_btn_idx((UI*)Wizard->value())) != -1)
297 switch_tab( (CustTabButton*)child(idx+1) ); 285 switch_tab( (CustTabButton*)child(idx < num_tabs() ? idx+1 : 1) );
298 } 286 }
299 287
300 /* 288 /*
301 * Set this UI's tab button label 289 * Set this UI's tab button label
302 */ 290 */