diff options
| author | Eli Zaretskii | 2013-09-05 14:00:55 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-09-05 14:00:55 +0300 |
| commit | e7873136dd8dbacbbebf534500355d29a07fed8e (patch) | |
| tree | e84dbf7101c2a271a12da76d6f17a3c7767ad874 /src/term.c | |
| parent | 50a5f95ec5e610e8edbe09b03388c83684d87fd7 (diff) | |
| download | emacs-e7873136dd8dbacbbebf534500355d29a07fed8e.tar.gz emacs-e7873136dd8dbacbbebf534500355d29a07fed8e.zip | |
Fixed C compilation problems.
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 117 |
1 files changed, 100 insertions, 17 deletions
diff --git a/src/term.c b/src/term.c index 806e038da9a..f3a750c70b6 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2935,8 +2935,8 @@ tty_menu_display (tty_menu *menu, int y, int x, int pn, int *faces, | |||
| 2935 | menu_help_message = NULL; | 2935 | menu_help_message = NULL; |
| 2936 | 2936 | ||
| 2937 | width = menu->width; | 2937 | width = menu->width; |
| 2938 | col = curX (tty); | 2938 | col = cursorX (tty); |
| 2939 | row = curY (tty); | 2939 | row = cursorY (tty); |
| 2940 | #if 0 | 2940 | #if 0 |
| 2941 | IT_update_begin (sf); /* FIXME: do we need an update_begin_hook? */ | 2941 | IT_update_begin (sf); /* FIXME: do we need an update_begin_hook? */ |
| 2942 | #endif | 2942 | #endif |
| @@ -2974,8 +2974,8 @@ have_menus_p (void) { return 1; } | |||
| 2974 | 2974 | ||
| 2975 | /* Create a new pane and place it on the outer-most level. */ | 2975 | /* Create a new pane and place it on the outer-most level. */ |
| 2976 | 2976 | ||
| 2977 | int | 2977 | static int |
| 2978 | tty_menu_add_pane (Display *foo, tty_menu *menu, const char *txt) | 2978 | tty_menu_add_pane (tty_menu *menu, const char *txt) |
| 2979 | { | 2979 | { |
| 2980 | int len; | 2980 | int len; |
| 2981 | const char *p; | 2981 | const char *p; |
| @@ -3112,6 +3112,7 @@ free_saved_screen (struct glyph_matrix *saved) | |||
| 3112 | for (i = 0; i < saved->nrows; ++i) | 3112 | for (i = 0; i < saved->nrows; ++i) |
| 3113 | { | 3113 | { |
| 3114 | struct glyph_row *from = saved->rows + i; | 3114 | struct glyph_row *from = saved->rows + i; |
| 3115 | short nbytes; | ||
| 3115 | 3116 | ||
| 3116 | xfree (from->glyphs[TEXT_AREA]); | 3117 | xfree (from->glyphs[TEXT_AREA]); |
| 3117 | nbytes = from->used[LEFT_MARGIN_AREA]; | 3118 | nbytes = from->used[LEFT_MARGIN_AREA]; |
| @@ -3145,7 +3146,7 @@ read_menu_input (int *x, int *y) | |||
| 3145 | while (1) | 3146 | while (1) |
| 3146 | { | 3147 | { |
| 3147 | do { | 3148 | do { |
| 3148 | c = read_char (-2, 0, NULL, Qnil, NULL, NULL); | 3149 | c = read_char (-2, Qnil, Qnil, NULL, NULL); |
| 3149 | } while (BUFFERP (c) || (INTEGERP (c) && XINT (c) == -2)); | 3150 | } while (BUFFERP (c) || (INTEGERP (c) && XINT (c) == -2)); |
| 3150 | 3151 | ||
| 3151 | if (INTEGERP (c)) | 3152 | if (INTEGERP (c)) |
| @@ -3188,6 +3189,38 @@ read_menu_input (int *x, int *y) | |||
| 3188 | } | 3189 | } |
| 3189 | } | 3190 | } |
| 3190 | 3191 | ||
| 3192 | /* FIXME */ | ||
| 3193 | static bool mouse_visible; | ||
| 3194 | static void | ||
| 3195 | mouse_off (void) | ||
| 3196 | { | ||
| 3197 | mouse_visible = false; | ||
| 3198 | } | ||
| 3199 | |||
| 3200 | static void | ||
| 3201 | mouse_on (void) | ||
| 3202 | { | ||
| 3203 | mouse_visible = true; | ||
| 3204 | } | ||
| 3205 | |||
| 3206 | static bool | ||
| 3207 | mouse_pressed (int b, int *x, int *y) | ||
| 3208 | { | ||
| 3209 | return false; | ||
| 3210 | } | ||
| 3211 | |||
| 3212 | static bool | ||
| 3213 | mouse_button_depressed (int b, int *x, int *y) | ||
| 3214 | { | ||
| 3215 | return false; | ||
| 3216 | } | ||
| 3217 | |||
| 3218 | static bool | ||
| 3219 | mouse_released (int b, int *x, int *y) | ||
| 3220 | { | ||
| 3221 | return true; | ||
| 3222 | } | ||
| 3223 | |||
| 3191 | /* Display menu, wait for user's response, and return that response. */ | 3224 | /* Display menu, wait for user's response, and return that response. */ |
| 3192 | int | 3225 | int |
| 3193 | tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | 3226 | tty_menu_activate (tty_menu *menu, int *pane, int *selidx, |
| @@ -3195,7 +3228,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3195 | void (*help_callback)(char const *, int, int)) | 3228 | void (*help_callback)(char const *, int, int)) |
| 3196 | { | 3229 | { |
| 3197 | struct tty_menu_state *state; | 3230 | struct tty_menu_state *state; |
| 3198 | int statecount, x, y, i, b, screensize, leave, result, onepane; | 3231 | int statecount, x, y, i, b, leave, result, onepane; |
| 3199 | int title_faces[4]; /* face to display the menu title */ | 3232 | int title_faces[4]; /* face to display the menu title */ |
| 3200 | int faces[4], buffers_num_deleted = 0; | 3233 | int faces[4], buffers_num_deleted = 0; |
| 3201 | struct frame *sf = SELECTED_FRAME (); | 3234 | struct frame *sf = SELECTED_FRAME (); |
| @@ -3208,12 +3241,13 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3208 | if (y0 <= 0) | 3241 | if (y0 <= 0) |
| 3209 | y0 = 1; | 3242 | y0 = 1; |
| 3210 | 3243 | ||
| 3244 | #if 0 | ||
| 3211 | /* We will process all the mouse events directly. */ | 3245 | /* We will process all the mouse events directly. */ |
| 3212 | mouse_preempted++; | 3246 | mouse_preempted++; |
| 3247 | #endif | ||
| 3213 | 3248 | ||
| 3214 | state = alloca (menu->panecount * sizeof (struct tty_menu_state)); | 3249 | state = alloca (menu->panecount * sizeof (struct tty_menu_state)); |
| 3215 | memset (state, 0, sizeof (*state)); | 3250 | memset (state, 0, sizeof (*state)); |
| 3216 | screensize = screen_size * 2; | ||
| 3217 | faces[0] | 3251 | faces[0] |
| 3218 | = lookup_derived_face (sf, intern ("tty-menu-disabled-face"), | 3252 | = lookup_derived_face (sf, intern ("tty-menu-disabled-face"), |
| 3219 | DEFAULT_FACE_ID, 1); | 3253 | DEFAULT_FACE_ID, 1); |
| @@ -3287,6 +3321,8 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3287 | leave = 0; | 3321 | leave = 0; |
| 3288 | while (!leave) | 3322 | while (!leave) |
| 3289 | { | 3323 | { |
| 3324 | int mouse_button_count = 3; /* FIXME */ | ||
| 3325 | |||
| 3290 | if (!mouse_visible) mouse_on (); | 3326 | if (!mouse_visible) mouse_on (); |
| 3291 | read_menu_input (&x, &y); | 3327 | read_menu_input (&x, &y); |
| 3292 | if (sf->mouse_moved) | 3328 | if (sf->mouse_moved) |
| @@ -3317,7 +3353,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3317 | { | 3353 | { |
| 3318 | statecount--; | 3354 | statecount--; |
| 3319 | mouse_off (); /* FIXME */ | 3355 | mouse_off (); /* FIXME */ |
| 3320 | screen_update (state[statecount].screen_behind); | 3356 | screen_update (sf, state[statecount].screen_behind); |
| 3321 | state[statecount].screen_behind = NULL; | 3357 | state[statecount].screen_behind = NULL; |
| 3322 | } | 3358 | } |
| 3323 | if (i == statecount - 1 && state[i].menu->submenu[dy]) | 3359 | if (i == statecount - 1 && state[i].menu->submenu[dy]) |
| @@ -3412,11 +3448,15 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3412 | (which invoked the menu) too quickly. If we don't remove these events, | 3448 | (which invoked the menu) too quickly. If we don't remove these events, |
| 3413 | Emacs will process them after we return and surprise the user. */ | 3449 | Emacs will process them after we return and surprise the user. */ |
| 3414 | discard_mouse_events (); | 3450 | discard_mouse_events (); |
| 3451 | #if 0 | ||
| 3415 | mouse_clear_clicks (); | 3452 | mouse_clear_clicks (); |
| 3416 | if (!kbd_buffer_events_waiting (1)) | 3453 | #endif |
| 3454 | if (!kbd_buffer_events_waiting ()) | ||
| 3417 | clear_input_pending (); | 3455 | clear_input_pending (); |
| 3456 | #if 0 | ||
| 3418 | /* Allow mouse events generation by dos_rawgetc. */ | 3457 | /* Allow mouse events generation by dos_rawgetc. */ |
| 3419 | mouse_preempted--; | 3458 | mouse_preempted--; |
| 3459 | #endif | ||
| 3420 | return result; | 3460 | return result; |
| 3421 | } | 3461 | } |
| 3422 | 3462 | ||
| @@ -3440,8 +3480,53 @@ tty_menu_destroy (tty_menu *menu) | |||
| 3440 | menu_help_message = prev_menu_help_message = NULL; | 3480 | menu_help_message = prev_menu_help_message = NULL; |
| 3441 | } | 3481 | } |
| 3442 | 3482 | ||
| 3483 | static struct frame *tty_menu_help_frame; | ||
| 3484 | |||
| 3485 | /* Show help HELP_STRING, or clear help if HELP_STRING is null. | ||
| 3486 | |||
| 3487 | PANE is the pane number, and ITEM is the menu item number in | ||
| 3488 | the menu (currently not used). | ||
| 3489 | |||
| 3490 | This cannot be done with generating a HELP_EVENT because | ||
| 3491 | XMenuActivate contains a loop that doesn't let Emacs process | ||
| 3492 | keyboard events. | ||
| 3493 | |||
| 3494 | FIXME: Do we need this in TTY menus? */ | ||
| 3495 | |||
| 3496 | static void | ||
| 3497 | tty_menu_help_callback (char const *help_string, int pane, int item) | ||
| 3498 | { | ||
| 3499 | Lisp_Object *first_item; | ||
| 3500 | Lisp_Object pane_name; | ||
| 3501 | Lisp_Object menu_object; | ||
| 3502 | |||
| 3503 | first_item = XVECTOR (menu_items)->contents; | ||
| 3504 | if (EQ (first_item[0], Qt)) | ||
| 3505 | pane_name = first_item[MENU_ITEMS_PANE_NAME]; | ||
| 3506 | else if (EQ (first_item[0], Qquote)) | ||
| 3507 | /* This shouldn't happen, see xmenu_show. */ | ||
| 3508 | pane_name = empty_unibyte_string; | ||
| 3509 | else | ||
| 3510 | pane_name = first_item[MENU_ITEMS_ITEM_NAME]; | ||
| 3511 | |||
| 3512 | /* (menu-item MENU-NAME PANE-NUMBER) */ | ||
| 3513 | menu_object = list3 (Qmenu_item, pane_name, make_number (pane)); | ||
| 3514 | show_help_echo (help_string ? build_string (help_string) : Qnil, | ||
| 3515 | Qnil, menu_object, make_number (item)); | ||
| 3516 | } | ||
| 3517 | |||
| 3518 | static void | ||
| 3519 | tty_pop_down_menu (Lisp_Object arg) | ||
| 3520 | { | ||
| 3521 | tty_menu *menu = XSAVE_POINTER (arg, 0); | ||
| 3522 | |||
| 3523 | block_input (); | ||
| 3524 | tty_menu_destroy (menu); | ||
| 3525 | unblock_input (); | ||
| 3526 | } | ||
| 3527 | |||
| 3443 | Lisp_Object | 3528 | Lisp_Object |
| 3444 | tty_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | 3529 | tty_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, |
| 3445 | Lisp_Object title, const char **error_name) | 3530 | Lisp_Object title, const char **error_name) |
| 3446 | { | 3531 | { |
| 3447 | tty_menu *menu; | 3532 | tty_menu *menu; |
| @@ -3457,7 +3542,7 @@ tty_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 3457 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); | 3542 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); |
| 3458 | 3543 | ||
| 3459 | if (! FRAME_TERMCAP_P (f)) | 3544 | if (! FRAME_TERMCAP_P (f)) |
| 3460 | abort (); | 3545 | emacs_abort (); |
| 3461 | 3546 | ||
| 3462 | *error_name = 0; | 3547 | *error_name = 0; |
| 3463 | if (menu_items_n_panes == 0) | 3548 | if (menu_items_n_panes == 0) |
| @@ -3631,15 +3716,13 @@ tty_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 3631 | 3716 | ||
| 3632 | pane = selidx = 0; | 3717 | pane = selidx = 0; |
| 3633 | 3718 | ||
| 3634 | record_unwind_protect (pop_down_menu, | 3719 | record_unwind_protect (tty_pop_down_menu, make_save_ptr (menu)); |
| 3635 | Fcons (make_save_value (f, 0), | ||
| 3636 | make_save_value (menu, 0))); | ||
| 3637 | 3720 | ||
| 3638 | /* Help display under X won't work because XMenuActivate contains | 3721 | /* Help display under X won't work because XMenuActivate contains |
| 3639 | a loop that doesn't give Emacs a chance to process it. */ | 3722 | a loop that doesn't give Emacs a chance to process it. FIXME. */ |
| 3640 | menu_help_frame = f; | 3723 | tty_menu_help_frame = f; |
| 3641 | status = tty_menu_activate (menu, &pane, &selidx, x, y, &datap, | 3724 | status = tty_menu_activate (menu, &pane, &selidx, x, y, &datap, |
| 3642 | menu_help_callback); | 3725 | tty_menu_help_callback); |
| 3643 | entry = pane_prefix = Qnil; | 3726 | entry = pane_prefix = Qnil; |
| 3644 | 3727 | ||
| 3645 | switch (status) | 3728 | switch (status) |