aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2013-09-05 14:00:55 +0300
committerEli Zaretskii2013-09-05 14:00:55 +0300
commite7873136dd8dbacbbebf534500355d29a07fed8e (patch)
treee84dbf7101c2a271a12da76d6f17a3c7767ad874
parent50a5f95ec5e610e8edbe09b03388c83684d87fd7 (diff)
downloademacs-e7873136dd8dbacbbebf534500355d29a07fed8e.tar.gz
emacs-e7873136dd8dbacbbebf534500355d29a07fed8e.zip
Fixed C compilation problems.
-rw-r--r--src/alloc.c2
-rw-r--r--src/cm.h2
-rw-r--r--src/dispextern.h1
-rw-r--r--src/dispnew.c3
-rw-r--r--src/keyboard.c2
-rw-r--r--src/keyboard.h2
-rw-r--r--src/menu.h2
-rw-r--r--src/term.c117
-rw-r--r--src/termhooks.h7
-rw-r--r--src/w32console.c8
-rw-r--r--src/xdisp.c3
11 files changed, 118 insertions, 31 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 0989e63664f..a8cbee1cf36 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3378,7 +3378,6 @@ make_save_obj_obj_obj_obj (Lisp_Object a, Lisp_Object b, Lisp_Object c,
3378 return val; 3378 return val;
3379} 3379}
3380 3380
3381#if defined HAVE_NS || defined HAVE_NTGUI
3382Lisp_Object 3381Lisp_Object
3383make_save_ptr (void *a) 3382make_save_ptr (void *a)
3384{ 3383{
@@ -3388,7 +3387,6 @@ make_save_ptr (void *a)
3388 p->data[0].pointer = a; 3387 p->data[0].pointer = a;
3389 return val; 3388 return val;
3390} 3389}
3391#endif
3392 3390
3393Lisp_Object 3391Lisp_Object
3394make_save_ptr_int (void *a, ptrdiff_t b) 3392make_save_ptr_int (void *a, ptrdiff_t b)
diff --git a/src/cm.h b/src/cm.h
index 6d49dda9419..f3455b79569 100644
--- a/src/cm.h
+++ b/src/cm.h
@@ -139,7 +139,7 @@ struct cm
139#define MultiDownCost(tty) (tty)->Wcm->cc_multidown 139#define MultiDownCost(tty) (tty)->Wcm->cc_multidown
140#define MultiLeftCost(tty) (tty)->Wcm->cc_multileft 140#define MultiLeftCost(tty) (tty)->Wcm->cc_multileft
141#define MultiRightCost(tty) (tty)->Wcm->cc_multiright 141#define MultiRightCost(tty) (tty)->Wcm->cc_multiright
142#endif 142#endif /* NoCMShortHand */
143 143
144#define cmat(tty,row,col) (curY(tty) = (row), curX(tty) = (col)) 144#define cmat(tty,row,col) (curY(tty) = (row), curX(tty) = (col))
145#define cmplus(tty,n) \ 145#define cmplus(tty,n) \
diff --git a/src/dispextern.h b/src/dispextern.h
index f86059e9889..0e6d934991a 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3460,6 +3460,7 @@ extern bool update_frame (struct frame *, bool, bool);
3460extern void update_frame_with_menu (struct frame *); 3460extern void update_frame_with_menu (struct frame *);
3461extern void bitch_at_user (void); 3461extern void bitch_at_user (void);
3462void adjust_glyphs (struct frame *); 3462void adjust_glyphs (struct frame *);
3463struct glyph_matrix *save_current_matrix (struct frame *);
3463void free_glyphs (struct frame *); 3464void free_glyphs (struct frame *);
3464void free_window_matrices (struct window *); 3465void free_window_matrices (struct window *);
3465void check_glyph_memory (void); 3466void check_glyph_memory (void);
diff --git a/src/dispnew.c b/src/dispnew.c
index 824c62bcf33..2378e72091e 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -3185,8 +3185,9 @@ void
3185update_frame_with_menu (struct frame *f) 3185update_frame_with_menu (struct frame *f)
3186{ 3186{
3187 struct window *root_window = XWINDOW (f->root_window); 3187 struct window *root_window = XWINDOW (f->root_window);
3188 bool paused_p;
3188 3189
3189 xassert (FRAME_TERMCAP_P (f)); 3190 eassert (FRAME_TERMCAP_P (f));
3190 3191
3191 /* We are working on frame matrix basis. Set the frame on whose 3192 /* We are working on frame matrix basis. Set the frame on whose
3192 frame matrix we operate. */ 3193 frame matrix we operate. */
diff --git a/src/keyboard.c b/src/keyboard.c
index c90ddba81c7..1150064a10f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -292,7 +292,7 @@ static struct input_event * volatile kbd_store_ptr;
292 at inopportune times. */ 292 at inopportune times. */
293 293
294/* Symbols to head events. */ 294/* Symbols to head events. */
295static Lisp_Object Qmouse_movement; 295Lisp_Object Qmouse_movement;
296static Lisp_Object Qscroll_bar_movement; 296static Lisp_Object Qscroll_bar_movement;
297Lisp_Object Qswitch_frame; 297Lisp_Object Qswitch_frame;
298static Lisp_Object Qfocus_in, Qfocus_out; 298static Lisp_Object Qfocus_in, Qfocus_out;
diff --git a/src/keyboard.h b/src/keyboard.h
index 1ee4a97c5c5..b015f3fe4d3 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -453,7 +453,7 @@ extern Lisp_Object Qswitch_frame;
453extern Lisp_Object Qevent_kind; 453extern Lisp_Object Qevent_kind;
454 454
455/* The values of Qevent_kind properties. */ 455/* The values of Qevent_kind properties. */
456extern Lisp_Object Qmouse_click; 456extern Lisp_Object Qmouse_click, Qmouse_movement;
457 457
458extern Lisp_Object Qhelp_echo; 458extern Lisp_Object Qhelp_echo;
459 459
diff --git a/src/menu.h b/src/menu.h
index c2dd376fcbb..cdc1838ff9f 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -51,6 +51,6 @@ extern Lisp_Object ns_menu_show (struct frame *, int, int, bool, bool,
51 Lisp_Object, const char **); 51 Lisp_Object, const char **);
52extern Lisp_Object xmenu_show (struct frame *, int, int, bool, bool, 52extern Lisp_Object xmenu_show (struct frame *, int, int, bool, bool,
53 Lisp_Object, const char **, Time); 53 Lisp_Object, const char **, Time);
54extern Lisp_Object tty_menu_show (FRAME_PTR, int, int, int, int, 54extern Lisp_Object tty_menu_show (struct frame *, int, int, int, int,
55 Lisp_Object, const char **); 55 Lisp_Object, const char **);
56#endif /* MENU_H */ 56#endif /* MENU_H */
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
2977int 2977static int
2978tty_menu_add_pane (Display *foo, tty_menu *menu, const char *txt) 2978tty_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 */
3193static bool mouse_visible;
3194static void
3195mouse_off (void)
3196{
3197 mouse_visible = false;
3198}
3199
3200static void
3201mouse_on (void)
3202{
3203 mouse_visible = true;
3204}
3205
3206static bool
3207mouse_pressed (int b, int *x, int *y)
3208{
3209 return false;
3210}
3211
3212static bool
3213mouse_button_depressed (int b, int *x, int *y)
3214{
3215 return false;
3216}
3217
3218static bool
3219mouse_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. */
3192int 3225int
3193tty_menu_activate (tty_menu *menu, int *pane, int *selidx, 3226tty_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
3483static 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
3496static void
3497tty_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
3518static void
3519tty_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
3443Lisp_Object 3528Lisp_Object
3444tty_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, 3529tty_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)
diff --git a/src/termhooks.h b/src/termhooks.h
index 437089ebf7a..3e4ec1d7e6d 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -664,8 +664,11 @@ extern void close_gpm (int gpm_fd);
664#endif 664#endif
665 665
666#ifdef WINDOWSNT 666#ifdef WINDOWSNT
667extern int curX (struct tty_display_info *); 667extern int cursorX (struct tty_display_info *);
668extern int curY (struct tty_display_info *); 668extern int cursorY (struct tty_display_info *);
669#else
670#define cursorX(t) curX(t)
671#define cursorY(t) curY(t)
669#endif 672#endif
670 673
671INLINE_HEADER_END 674INLINE_HEADER_END
diff --git a/src/w32console.c b/src/w32console.c
index a85469cb382..cb42bae1421 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -553,16 +553,16 @@ Wcm_clear (struct tty_display_info *tty)
553 553
554 554
555/* Report the current cursor position. The following two functions 555/* Report the current cursor position. The following two functions
556 mirror cm.h macros and are used in term.c's tty menu code, so they 556 are used in term.c's tty menu code, so they are not really
557 are not really "stubs". */ 557 "stubs". */
558int 558int
559curX (struct tty_display_info *tty) 559cursorX (struct tty_display_info *tty)
560{ 560{
561 return cursor_coords.X; 561 return cursor_coords.X;
562} 562}
563 563
564int 564int
565curY (struct tty_display_info *tty) 565cursorY (struct tty_display_info *tty)
566{ 566{
567 return cursor_coords.Y; 567 return cursor_coords.Y;
568} 568}
diff --git a/src/xdisp.c b/src/xdisp.c
index 27ce653952f..2d015fca887 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -20602,10 +20602,11 @@ display_tty_menu_item (const char *item_text, int face_id, int x, int y,
20602{ 20602{
20603 struct it it; 20603 struct it it;
20604 struct frame *f = SELECTED_FRAME (); 20604 struct frame *f = SELECTED_FRAME ();
20605 struct window *w = XWINDOW (f->selected_window);
20605 int saved_used, saved_truncated, saved_width; 20606 int saved_used, saved_truncated, saved_width;
20606 struct glyph_row *row; 20607 struct glyph_row *row;
20607 20608
20608 xassert (FRAME_TERMCAP_P (f)); 20609 eassert (FRAME_TERMCAP_P (f));
20609 20610
20610 init_iterator (&it, w, -1, -1, f->desired_matrix->rows + y, MENU_FACE_ID); 20611 init_iterator (&it, w, -1, -1, f->desired_matrix->rows + y, MENU_FACE_ID);
20611 it.first_visible_x = 0; 20612 it.first_visible_x = 0;