diff options
| author | Eli Zaretskii | 2013-09-26 11:10:53 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-09-26 11:10:53 +0300 |
| commit | 5cbcc455937df18b3c85d56cca20cf0e0b791ad6 (patch) | |
| tree | 186736e8450be6ba227b2e21a99f784e85e5fd33 /src | |
| parent | f573ac33a3299ae83d88f5c3a04cc1bc6f5c205a (diff) | |
| download | emacs-5cbcc455937df18b3c85d56cca20cf0e0b791ad6.tar.gz emacs-5cbcc455937df18b3c85d56cca20cf0e0b791ad6.zip | |
Some cleanups: remove unused code.
Diffstat (limited to 'src')
| -rw-r--r-- | src/term.c | 117 |
1 files changed, 5 insertions, 112 deletions
diff --git a/src/term.c b/src/term.c index 775df1e9bc0..9d93416a4c8 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2807,7 +2807,7 @@ typedef struct tty_menu_struct | |||
| 2807 | int count; | 2807 | int count; |
| 2808 | char **text; | 2808 | char **text; |
| 2809 | struct tty_menu_struct **submenu; | 2809 | struct tty_menu_struct **submenu; |
| 2810 | int *panenumber; /* Also used as enable. */ | 2810 | int *panenumber; /* Also used as enabled flag. */ |
| 2811 | int allocated; | 2811 | int allocated; |
| 2812 | int panecount; | 2812 | int panecount; |
| 2813 | int width; | 2813 | int width; |
| @@ -2899,7 +2899,7 @@ static void | |||
| 2899 | mouse_get_xy (int *x, int *y) | 2899 | mouse_get_xy (int *x, int *y) |
| 2900 | { | 2900 | { |
| 2901 | struct frame *sf = SELECTED_FRAME (); | 2901 | struct frame *sf = SELECTED_FRAME (); |
| 2902 | Lisp_Object lmx, lmy, lisp_dummy; | 2902 | Lisp_Object lmx = Qnil, lmy = Qnil, lisp_dummy; |
| 2903 | enum scroll_bar_part part_dummy; | 2903 | enum scroll_bar_part part_dummy; |
| 2904 | Time time_dummy; | 2904 | Time time_dummy; |
| 2905 | 2905 | ||
| @@ -2930,9 +2930,6 @@ tty_menu_display (tty_menu *menu, int x, int y, int pn, int *faces, | |||
| 2930 | width = menu->width; | 2930 | width = menu->width; |
| 2931 | col = cursorX (tty); | 2931 | col = cursorX (tty); |
| 2932 | row = cursorY (tty); | 2932 | row = cursorY (tty); |
| 2933 | #if 0 | ||
| 2934 | IT_update_begin (sf); /* FIXME: do we need an update_begin_hook? */ | ||
| 2935 | #endif | ||
| 2936 | for (i = 0; i < menu->count; i++) | 2933 | for (i = 0; i < menu->count; i++) |
| 2937 | { | 2934 | { |
| 2938 | int max_width = width + 2; /* +2 for padding blanks on each side */ | 2935 | int max_width = width + 2; /* +2 for padding blanks on each side */ |
| @@ -3257,38 +3254,6 @@ read_menu_input (struct frame *sf, int *x, int *y, int min_y, int max_y, | |||
| 3257 | return 0; | 3254 | return 0; |
| 3258 | } | 3255 | } |
| 3259 | 3256 | ||
| 3260 | /* FIXME */ | ||
| 3261 | static bool mouse_visible; | ||
| 3262 | static void | ||
| 3263 | mouse_off (void) | ||
| 3264 | { | ||
| 3265 | mouse_visible = false; | ||
| 3266 | } | ||
| 3267 | |||
| 3268 | static void | ||
| 3269 | mouse_on (void) | ||
| 3270 | { | ||
| 3271 | mouse_visible = true; | ||
| 3272 | } | ||
| 3273 | |||
| 3274 | static bool | ||
| 3275 | mouse_pressed (int b, int *x, int *y) | ||
| 3276 | { | ||
| 3277 | return false; | ||
| 3278 | } | ||
| 3279 | |||
| 3280 | static bool | ||
| 3281 | mouse_button_depressed (int b, int *x, int *y) | ||
| 3282 | { | ||
| 3283 | return false; | ||
| 3284 | } | ||
| 3285 | |||
| 3286 | static bool | ||
| 3287 | mouse_released (int b, int *x, int *y) | ||
| 3288 | { | ||
| 3289 | return true; | ||
| 3290 | } | ||
| 3291 | |||
| 3292 | /* Display menu, wait for user's response, and return that response. */ | 3257 | /* Display menu, wait for user's response, and return that response. */ |
| 3293 | int | 3258 | int |
| 3294 | tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | 3259 | tty_menu_activate (tty_menu *menu, int *pane, int *selidx, |
| @@ -3311,11 +3276,6 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3311 | if (y0 <= 0) | 3276 | if (y0 <= 0) |
| 3312 | y0 = 1; | 3277 | y0 = 1; |
| 3313 | 3278 | ||
| 3314 | #if 0 | ||
| 3315 | /* We will process all the mouse events directly. */ | ||
| 3316 | mouse_preempted++; | ||
| 3317 | #endif | ||
| 3318 | |||
| 3319 | state = alloca (menu->panecount * sizeof (struct tty_menu_state)); | 3279 | state = alloca (menu->panecount * sizeof (struct tty_menu_state)); |
| 3320 | memset (state, 0, sizeof (*state)); | 3280 | memset (state, 0, sizeof (*state)); |
| 3321 | faces[0] | 3281 | faces[0] |
| @@ -3349,17 +3309,10 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3349 | buffers_num_deleted = 1; | 3309 | buffers_num_deleted = 1; |
| 3350 | } | 3310 | } |
| 3351 | 3311 | ||
| 3352 | #if 0 | ||
| 3353 | /* We need to save the current echo area message, so that we could | ||
| 3354 | restore it below, before we exit. See the commentary below, | ||
| 3355 | before the call to message_with_string. */ | ||
| 3356 | saved_echo_area_message = Fcurrent_message (); | ||
| 3357 | #endif | ||
| 3358 | /* Force update of the current frame, so that the desired and the | 3312 | /* Force update of the current frame, so that the desired and the |
| 3359 | current matrices are identical. */ | 3313 | current matrices are identical. */ |
| 3360 | update_frame_with_menu (sf); | 3314 | update_frame_with_menu (sf); |
| 3361 | state[0].menu = menu; | 3315 | state[0].menu = menu; |
| 3362 | mouse_off (); /* FIXME */ | ||
| 3363 | state[0].screen_behind = save_and_enable_current_matrix (sf); | 3316 | state[0].screen_behind = save_and_enable_current_matrix (sf); |
| 3364 | 3317 | ||
| 3365 | /* Turn off the cursor. Otherwise it shows through the menu | 3318 | /* Turn off the cursor. Otherwise it shows through the menu |
| @@ -3397,7 +3350,6 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3397 | int input_status; | 3350 | int input_status; |
| 3398 | int min_y = state[0].y, max_y = min_y + state[0].menu->count - 1; | 3351 | int min_y = state[0].y, max_y = min_y + state[0].menu->count - 1; |
| 3399 | 3352 | ||
| 3400 | if (!mouse_visible) mouse_on (); | ||
| 3401 | input_status = read_menu_input (sf, &x, &y, min_y, max_y, &first_time); | 3353 | input_status = read_menu_input (sf, &x, &y, min_y, max_y, &first_time); |
| 3402 | if (input_status) | 3354 | if (input_status) |
| 3403 | { | 3355 | { |
| @@ -3437,7 +3389,6 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3437 | while (i != statecount - 1) | 3389 | while (i != statecount - 1) |
| 3438 | { | 3390 | { |
| 3439 | statecount--; | 3391 | statecount--; |
| 3440 | mouse_off (); /* FIXME */ | ||
| 3441 | screen_update (sf, state[statecount].screen_behind); | 3392 | screen_update (sf, state[statecount].screen_behind); |
| 3442 | state[statecount].screen_behind = NULL; | 3393 | state[statecount].screen_behind = NULL; |
| 3443 | } | 3394 | } |
| @@ -3450,7 +3401,6 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3450 | faces, x, y, 1); | 3401 | faces, x, y, 1); |
| 3451 | state[statecount].menu = state[i].menu->submenu[dy]; | 3402 | state[statecount].menu = state[i].menu->submenu[dy]; |
| 3452 | state[statecount].pane = state[i].menu->panenumber[dy]; | 3403 | state[statecount].pane = state[i].menu->panenumber[dy]; |
| 3453 | mouse_off (); /* FIXME */ | ||
| 3454 | state[statecount].screen_behind | 3404 | state[statecount].screen_behind |
| 3455 | = save_and_enable_current_matrix (sf); | 3405 | = save_and_enable_current_matrix (sf); |
| 3456 | state[statecount].x | 3406 | state[statecount].x |
| @@ -3477,54 +3427,12 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3477 | tty_hide_cursor (tty); | 3427 | tty_hide_cursor (tty); |
| 3478 | prev_menu_help_message = menu_help_message; | 3428 | prev_menu_help_message = menu_help_message; |
| 3479 | } | 3429 | } |
| 3480 | #if 0 | ||
| 3481 | /* We are busy-waiting for the mouse to move, so let's be nice | ||
| 3482 | to other Windows applications by releasing our time slice. */ | ||
| 3483 | Sleep (20); /* FIXME */ | ||
| 3484 | |||
| 3485 | for (b = 0; b < mouse_button_count && !leave; b++) | ||
| 3486 | { | ||
| 3487 | /* Only leave if user both pressed and released the mouse, and in | ||
| 3488 | that order. This avoids popping down the menu pane unless | ||
| 3489 | the user is really done with it. */ | ||
| 3490 | if (mouse_pressed (b, &x, &y)) | ||
| 3491 | { | ||
| 3492 | while (mouse_button_depressed (b, &x, &y)) | ||
| 3493 | Sleep (20); /* FIXME */ | ||
| 3494 | leave = 1; | ||
| 3495 | } | ||
| 3496 | (void) mouse_released (b, &x, &y); | ||
| 3497 | } | ||
| 3498 | #endif | ||
| 3499 | } | 3430 | } |
| 3500 | 3431 | ||
| 3501 | mouse_off (); /* FIXME */ | ||
| 3502 | sf->mouse_moved = 0; | 3432 | sf->mouse_moved = 0; |
| 3503 | /* FIXME: Since we set the fram's garbaged flag, do we need this | 3433 | /* FIXME: Since we set the fram's garbaged flag, do we need this |
| 3504 | call to screen_update? */ | 3434 | call to screen_update? */ |
| 3505 | screen_update (sf, state[0].screen_behind); | 3435 | screen_update (sf, state[0].screen_behind); |
| 3506 | #if 0 | ||
| 3507 | /* We have a situation here. ScreenUpdate has just restored the | ||
| 3508 | screen contents as it was before we started drawing this menu. | ||
| 3509 | That includes any echo area message that could have been | ||
| 3510 | displayed back then. (In reality, that echo area message will | ||
| 3511 | almost always be the ``keystroke echo'' that echoes the sequence | ||
| 3512 | of menu items chosen by the user.) However, if the menu had some | ||
| 3513 | help messages, then displaying those messages caused Emacs to | ||
| 3514 | forget about the original echo area message. So when | ||
| 3515 | ScreenUpdate restored it, it created a discrepancy between the | ||
| 3516 | actual screen contents and what Emacs internal data structures | ||
| 3517 | know about it. | ||
| 3518 | |||
| 3519 | To avoid this conflict, we force Emacs to restore the original | ||
| 3520 | echo area message as we found it when we entered this function. | ||
| 3521 | The irony of this is that we then erase the restored message | ||
| 3522 | right away, so the only purpose of restoring it is so that | ||
| 3523 | erasing it works correctly... */ | ||
| 3524 | if (! NILP (saved_echo_area_message)) | ||
| 3525 | message_with_string ("%s", saved_echo_area_message, 0); | ||
| 3526 | message (0); | ||
| 3527 | #endif | ||
| 3528 | while (statecount--) | 3436 | while (statecount--) |
| 3529 | free_saved_screen (state[statecount].screen_behind); | 3437 | free_saved_screen (state[statecount].screen_behind); |
| 3530 | tty_show_cursor (tty); /* turn cursor back on */ | 3438 | tty_show_cursor (tty); /* turn cursor back on */ |
| @@ -3535,15 +3443,8 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3535 | (which invoked the menu) too quickly. If we don't remove these events, | 3443 | (which invoked the menu) too quickly. If we don't remove these events, |
| 3536 | Emacs will process them after we return and surprise the user. */ | 3444 | Emacs will process them after we return and surprise the user. */ |
| 3537 | discard_mouse_events (); | 3445 | discard_mouse_events (); |
| 3538 | #if 0 | ||
| 3539 | mouse_clear_clicks (); | ||
| 3540 | #endif | ||
| 3541 | if (!kbd_buffer_events_waiting ()) | 3446 | if (!kbd_buffer_events_waiting ()) |
| 3542 | clear_input_pending (); | 3447 | clear_input_pending (); |
| 3543 | #if 0 | ||
| 3544 | /* Allow mouse events generation by dos_rawgetc. */ | ||
| 3545 | mouse_preempted--; | ||
| 3546 | #endif | ||
| 3547 | SET_FRAME_GARBAGED (sf); | 3448 | SET_FRAME_GARBAGED (sf); |
| 3548 | return result; | 3449 | return result; |
| 3549 | } | 3450 | } |
| @@ -3568,18 +3469,10 @@ tty_menu_destroy (tty_menu *menu) | |||
| 3568 | menu_help_message = prev_menu_help_message = NULL; | 3469 | menu_help_message = prev_menu_help_message = NULL; |
| 3569 | } | 3470 | } |
| 3570 | 3471 | ||
| 3571 | static struct frame *tty_menu_help_frame; | ||
| 3572 | |||
| 3573 | /* Show help HELP_STRING, or clear help if HELP_STRING is null. | 3472 | /* Show help HELP_STRING, or clear help if HELP_STRING is null. |
| 3574 | 3473 | ||
| 3575 | PANE is the pane number, and ITEM is the menu item number in | 3474 | PANE is the pane number, and ITEM is the menu item number in |
| 3576 | the menu (currently not used). | 3475 | the menu (currently not used). */ |
| 3577 | |||
| 3578 | This cannot be done with generating a HELP_EVENT because | ||
| 3579 | XMenuActivate contains a loop that doesn't let Emacs process | ||
| 3580 | keyboard events. | ||
| 3581 | |||
| 3582 | FIXME: Do we need this in TTY menus? */ | ||
| 3583 | 3476 | ||
| 3584 | static void | 3477 | static void |
| 3585 | tty_menu_help_callback (char const *help_string, int pane, int item) | 3478 | tty_menu_help_callback (char const *help_string, int pane, int item) |
| @@ -3795,7 +3688,8 @@ tty_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, | |||
| 3795 | #if 0 | 3688 | #if 0 |
| 3796 | /* This code doesn't make sense on a TTY, since it can easily annul | 3689 | /* This code doesn't make sense on a TTY, since it can easily annul |
| 3797 | the adjustments above that carefully avoid truncation of the menu | 3690 | the adjustments above that carefully avoid truncation of the menu |
| 3798 | items. */ | 3691 | items. I think it was written to fix some problem that only |
| 3692 | happens on X11. */ | ||
| 3799 | if (! for_click) | 3693 | if (! for_click) |
| 3800 | { | 3694 | { |
| 3801 | /* If position was not given by a mouse click, adjust so upper left | 3695 | /* If position was not given by a mouse click, adjust so upper left |
| @@ -3810,7 +3704,6 @@ tty_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, | |||
| 3810 | 3704 | ||
| 3811 | record_unwind_protect (tty_pop_down_menu, make_save_ptr (menu)); | 3705 | record_unwind_protect (tty_pop_down_menu, make_save_ptr (menu)); |
| 3812 | 3706 | ||
| 3813 | tty_menu_help_frame = f; /* FIXME: This seems unused. */ | ||
| 3814 | specbind (Qoverriding_terminal_local_map, | 3707 | specbind (Qoverriding_terminal_local_map, |
| 3815 | Fsymbol_value (Qtty_menu_navigation_map)); | 3708 | Fsymbol_value (Qtty_menu_navigation_map)); |
| 3816 | status = tty_menu_activate (menu, &pane, &selidx, x, y, &datap, | 3709 | status = tty_menu_activate (menu, &pane, &selidx, x, y, &datap, |