diff options
| author | Karoly Lorentey | 2005-09-11 03:15:42 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-09-11 03:15:42 +0000 |
| commit | 62af879c72eb791a0e0096ae2c739e8c2649d2fc (patch) | |
| tree | a9693d099cfd030230b0ab688c2f6ad7114775ef /src | |
| parent | 6bac16160743017637d0a77399cd4530f454e74b (diff) | |
| download | emacs-62af879c72eb791a0e0096ae2c739e8c2649d2fc.tar.gz emacs-62af879c72eb791a0e0096ae2c739e8c2649d2fc.zip | |
Fix crashes in xdialog_show (and other places) with xterm-mouse-mode.
* src/dispextern.h (get_tty_device): Declare.
* src/dispnew.c (Fsend_string_to_terminal): Add optional TERMINAL parameter.
* src/fns.c (Fy_or_n_p, Fyes_or_no_p): Don't try to open an X dialog on
tty terminals.
* src/term.c (get_tty_device): Remove static qualifier.
* src/xmenu.c (create_and_show_dialog, create_and_show_popup_menu)
(free_frame_menubar, mouse_position_for_popup, set_frame_menubar)
(update_frame_menubar, x_activate_menubar, xdialog_show, xmenu_show):
Abort when given a non-X frame.
* src/xmenu.c (Fx_popup_menu, Fx_popup_dialog): Throw an error when run
on a non-X frame.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-410
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispextern.h | 1 | ||||
| -rw-r--r-- | src/dispnew.c | 18 | ||||
| -rw-r--r-- | src/fns.c | 6 | ||||
| -rw-r--r-- | src/term.c | 10 | ||||
| -rw-r--r-- | src/xmenu.c | 49 |
5 files changed, 68 insertions, 16 deletions
diff --git a/src/dispextern.h b/src/dispextern.h index 1c802e9e332..a7ce3a8e75b 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2930,6 +2930,7 @@ extern void calculate_costs P_ ((struct frame *)); | |||
| 2930 | extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object)); | 2930 | extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object)); |
| 2931 | extern void tty_setup_colors P_ ((struct tty_display_info *, int)); | 2931 | extern void tty_setup_colors P_ ((struct tty_display_info *, int)); |
| 2932 | extern struct device *get_device P_ ((Lisp_Object display, int)); | 2932 | extern struct device *get_device P_ ((Lisp_Object display, int)); |
| 2933 | extern struct device *get_tty_device P_ ((Lisp_Object terminal)); | ||
| 2933 | extern struct device *get_named_tty P_ ((char *)); | 2934 | extern struct device *get_named_tty P_ ((char *)); |
| 2934 | EXFUN (Fdisplay_tty_type, 1); | 2935 | EXFUN (Fdisplay_tty_type, 1); |
| 2935 | extern struct device *init_initial_device P_ ((void)); | 2936 | extern struct device *init_initial_device P_ ((void)); |
diff --git a/src/dispnew.c b/src/dispnew.c index 1ee951b0be0..2a4c7599757 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -6285,21 +6285,27 @@ FILE = nil means just close any termscript file currently open. */) | |||
| 6285 | 6285 | ||
| 6286 | 6286 | ||
| 6287 | DEFUN ("send-string-to-terminal", Fsend_string_to_terminal, | 6287 | DEFUN ("send-string-to-terminal", Fsend_string_to_terminal, |
| 6288 | Ssend_string_to_terminal, 1, 1, 0, | 6288 | Ssend_string_to_terminal, 1, 2, 0, |
| 6289 | doc: /* Send STRING to the terminal without alteration. | 6289 | doc: /* Send STRING to the terminal without alteration. |
| 6290 | Control characters in STRING will have terminal-dependent effects. */) | 6290 | Control characters in STRING will have terminal-dependent effects. |
| 6291 | (string) | 6291 | |
| 6292 | Optional parameter TERMINAL specifies the tty display device to use. | ||
| 6293 | It may be a terminal id, a frame, or nil for the terminal used by the | ||
| 6294 | currently selected frame. */) | ||
| 6295 | (string, display) | ||
| 6292 | Lisp_Object string; | 6296 | Lisp_Object string; |
| 6297 | Lisp_Object display; | ||
| 6293 | { | 6298 | { |
| 6299 | struct device *d = get_tty_device (display); | ||
| 6294 | struct tty_display_info *tty; | 6300 | struct tty_display_info *tty; |
| 6295 | 6301 | ||
| 6296 | /* ??? Perhaps we should do something special for multibyte strings here. */ | 6302 | /* ??? Perhaps we should do something special for multibyte strings here. */ |
| 6297 | CHECK_STRING (string); | 6303 | CHECK_STRING (string); |
| 6298 | 6304 | ||
| 6299 | if (! FRAME_TERMCAP_P (SELECTED_FRAME ())) | 6305 | if (!d) |
| 6300 | error ("Current frame is not on a tty device"); | 6306 | error ("Unknown display device"); |
| 6301 | 6307 | ||
| 6302 | tty = CURTTY (); | 6308 | tty = d->display_info.tty; |
| 6303 | 6309 | ||
| 6304 | if (tty->termscript) | 6310 | if (tty->termscript) |
| 6305 | { | 6311 | { |
| @@ -3267,7 +3267,8 @@ is nil and `use-dialog-box' is non-nil. */) | |||
| 3267 | { | 3267 | { |
| 3268 | 3268 | ||
| 3269 | #ifdef HAVE_MENUS | 3269 | #ifdef HAVE_MENUS |
| 3270 | if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) | 3270 | if (FRAME_WINDOW_P (SELECTED_FRAME ()) |
| 3271 | && (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) | ||
| 3271 | && use_dialog_box | 3272 | && use_dialog_box |
| 3272 | && have_menus_p ()) | 3273 | && have_menus_p ()) |
| 3273 | { | 3274 | { |
| @@ -3398,7 +3399,8 @@ is nil, and `use-dialog-box' is non-nil. */) | |||
| 3398 | CHECK_STRING (prompt); | 3399 | CHECK_STRING (prompt); |
| 3399 | 3400 | ||
| 3400 | #ifdef HAVE_MENUS | 3401 | #ifdef HAVE_MENUS |
| 3401 | if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) | 3402 | if (FRAME_WINDOW_P (SELECTED_FRAME ()) |
| 3403 | && (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) | ||
| 3402 | && use_dialog_box | 3404 | && use_dialog_box |
| 3403 | && have_menus_p ()) | 3405 | && have_menus_p ()) |
| 3404 | { | 3406 | { |
diff --git a/src/term.c b/src/term.c index 77720779baf..3b3f0ad2132 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -85,8 +85,6 @@ static void turn_off_face P_ ((struct frame *, int face_id)); | |||
| 85 | static void tty_show_cursor P_ ((struct tty_display_info *)); | 85 | static void tty_show_cursor P_ ((struct tty_display_info *)); |
| 86 | static void tty_hide_cursor P_ ((struct tty_display_info *)); | 86 | static void tty_hide_cursor P_ ((struct tty_display_info *)); |
| 87 | 87 | ||
| 88 | static struct device *get_tty_device (Lisp_Object device); | ||
| 89 | |||
| 90 | void delete_initial_device P_ ((struct device *)); | 88 | void delete_initial_device P_ ((struct device *)); |
| 91 | void create_tty_output P_ ((struct frame *)); | 89 | void create_tty_output P_ ((struct frame *)); |
| 92 | void delete_tty_output P_ ((struct frame *)); | 90 | void delete_tty_output P_ ((struct frame *)); |
| @@ -2164,11 +2162,11 @@ get_device (Lisp_Object device, int throw) | |||
| 2164 | 2162 | ||
| 2165 | /* Return the tty display object specified by DEVICE. */ | 2163 | /* Return the tty display object specified by DEVICE. */ |
| 2166 | 2164 | ||
| 2167 | static struct device * | 2165 | struct device * |
| 2168 | get_tty_device (Lisp_Object device) | 2166 | get_tty_device (Lisp_Object terminal) |
| 2169 | { | 2167 | { |
| 2170 | struct device *d = get_device (device, 0); | 2168 | struct device *d = get_device (terminal, 0); |
| 2171 | 2169 | ||
| 2172 | if (d && d->type == output_initial) | 2170 | if (d && d->type == output_initial) |
| 2173 | d = NULL; | 2171 | d = NULL; |
| 2174 | 2172 | ||
diff --git a/src/xmenu.c b/src/xmenu.c index 4abf89655df..5aae977ac9a 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -705,6 +705,9 @@ mouse_position_for_popup (f, x, y) | |||
| 705 | Window root, dummy_window; | 705 | Window root, dummy_window; |
| 706 | int dummy; | 706 | int dummy; |
| 707 | 707 | ||
| 708 | if (! FRAME_X_P (f)) | ||
| 709 | abort (); | ||
| 710 | |||
| 708 | BLOCK_INPUT; | 711 | BLOCK_INPUT; |
| 709 | 712 | ||
| 710 | XQueryPointer (FRAME_X_DISPLAY (f), | 713 | XQueryPointer (FRAME_X_DISPLAY (f), |
| @@ -899,6 +902,9 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 899 | 902 | ||
| 900 | xpos += XINT (x); | 903 | xpos += XINT (x); |
| 901 | ypos += XINT (y); | 904 | ypos += XINT (y); |
| 905 | |||
| 906 | if (! FRAME_X_P (f)) | ||
| 907 | error ("Can not put X menu on non-X terminal"); | ||
| 902 | } | 908 | } |
| 903 | Vmenu_updating_frame = Qnil; | 909 | Vmenu_updating_frame = Qnil; |
| 904 | #endif /* HAVE_MENUS */ | 910 | #endif /* HAVE_MENUS */ |
| @@ -1085,6 +1091,9 @@ for instance using the window manager, then this produces a quit and | |||
| 1085 | but I don't want to make one now. */ | 1091 | but I don't want to make one now. */ |
| 1086 | CHECK_WINDOW (window); | 1092 | CHECK_WINDOW (window); |
| 1087 | 1093 | ||
| 1094 | if (! FRAME_X_P (f)) | ||
| 1095 | error ("Can not put X dialog on non-X terminal"); | ||
| 1096 | |||
| 1088 | #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) | 1097 | #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) |
| 1089 | /* Display a menu with these alternatives | 1098 | /* Display a menu with these alternatives |
| 1090 | in the middle of frame F. */ | 1099 | in the middle of frame F. */ |
| @@ -1302,6 +1311,9 @@ void | |||
| 1302 | x_activate_menubar (f) | 1311 | x_activate_menubar (f) |
| 1303 | FRAME_PTR f; | 1312 | FRAME_PTR f; |
| 1304 | { | 1313 | { |
| 1314 | if (! FRAME_X_P (f)) | ||
| 1315 | abort (); | ||
| 1316 | |||
| 1305 | if (!f->output_data.x->saved_menu_event->type) | 1317 | if (!f->output_data.x->saved_menu_event->type) |
| 1306 | return; | 1318 | return; |
| 1307 | 1319 | ||
| @@ -1922,9 +1934,14 @@ update_frame_menubar (f) | |||
| 1922 | #ifdef USE_GTK | 1934 | #ifdef USE_GTK |
| 1923 | return xg_update_frame_menubar (f); | 1935 | return xg_update_frame_menubar (f); |
| 1924 | #else | 1936 | #else |
| 1925 | struct x_output *x = f->output_data.x; | 1937 | struct x_output *x; |
| 1926 | int columns, rows; | 1938 | int columns, rows; |
| 1927 | 1939 | ||
| 1940 | if (! FRAME_X_P (f)) | ||
| 1941 | abort (); | ||
| 1942 | |||
| 1943 | x = f->output_data.x; | ||
| 1944 | |||
| 1928 | if (!x->menubar_widget || XtIsManaged (x->menubar_widget)) | 1945 | if (!x->menubar_widget || XtIsManaged (x->menubar_widget)) |
| 1929 | return 0; | 1946 | return 0; |
| 1930 | 1947 | ||
| @@ -1970,7 +1987,7 @@ set_frame_menubar (f, first_time, deep_p) | |||
| 1970 | int first_time; | 1987 | int first_time; |
| 1971 | int deep_p; | 1988 | int deep_p; |
| 1972 | { | 1989 | { |
| 1973 | xt_or_gtk_widget menubar_widget = f->output_data.x->menubar_widget; | 1990 | xt_or_gtk_widget menubar_widget; |
| 1974 | #ifdef USE_X_TOOLKIT | 1991 | #ifdef USE_X_TOOLKIT |
| 1975 | LWLIB_ID id; | 1992 | LWLIB_ID id; |
| 1976 | #endif | 1993 | #endif |
| @@ -1980,6 +1997,10 @@ set_frame_menubar (f, first_time, deep_p) | |||
| 1980 | int *submenu_start, *submenu_end; | 1997 | int *submenu_start, *submenu_end; |
| 1981 | int *submenu_top_level_items, *submenu_n_panes; | 1998 | int *submenu_top_level_items, *submenu_n_panes; |
| 1982 | 1999 | ||
| 2000 | if (! FRAME_X_P (f)) | ||
| 2001 | abort (); | ||
| 2002 | |||
| 2003 | menubar_widget = f->output_data.x->menubar_widget; | ||
| 1983 | 2004 | ||
| 1984 | XSETFRAME (Vmenu_updating_frame, f); | 2005 | XSETFRAME (Vmenu_updating_frame, f); |
| 1985 | 2006 | ||
| @@ -2324,6 +2345,9 @@ free_frame_menubar (f) | |||
| 2324 | { | 2345 | { |
| 2325 | Widget menubar_widget; | 2346 | Widget menubar_widget; |
| 2326 | 2347 | ||
| 2348 | if (! FRAME_X_P (f)) | ||
| 2349 | abort (); | ||
| 2350 | |||
| 2327 | menubar_widget = f->output_data.x->menubar_widget; | 2351 | menubar_widget = f->output_data.x->menubar_widget; |
| 2328 | 2352 | ||
| 2329 | f->output_data.x->menubar_height = 0; | 2353 | f->output_data.x->menubar_height = 0; |
| @@ -2476,6 +2500,9 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click) | |||
| 2476 | struct next_popup_x_y popup_x_y; | 2500 | struct next_popup_x_y popup_x_y; |
| 2477 | int specpdl_count = SPECPDL_INDEX (); | 2501 | int specpdl_count = SPECPDL_INDEX (); |
| 2478 | 2502 | ||
| 2503 | if (! FRAME_X_P (f)) | ||
| 2504 | abort (); | ||
| 2505 | |||
| 2479 | xg_crazy_callback_abort = 1; | 2506 | xg_crazy_callback_abort = 1; |
| 2480 | menu = xg_create_widget ("popup", first_wv->name, f, first_wv, | 2507 | menu = xg_create_widget ("popup", first_wv->name, f, first_wv, |
| 2481 | G_CALLBACK (popup_selection_callback), | 2508 | G_CALLBACK (popup_selection_callback), |
| @@ -2584,6 +2611,9 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click) | |||
| 2584 | LWLIB_ID menu_id; | 2611 | LWLIB_ID menu_id; |
| 2585 | Widget menu; | 2612 | Widget menu; |
| 2586 | 2613 | ||
| 2614 | if (! FRAME_X_P (f)) | ||
| 2615 | abort (); | ||
| 2616 | |||
| 2587 | menu_id = widget_id_tick++; | 2617 | menu_id = widget_id_tick++; |
| 2588 | menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv, | 2618 | menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv, |
| 2589 | f->output_data.x->widget, 1, 0, | 2619 | f->output_data.x->widget, 1, 0, |
| @@ -2659,6 +2689,9 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2659 | 2689 | ||
| 2660 | int first_pane; | 2690 | int first_pane; |
| 2661 | 2691 | ||
| 2692 | if (! FRAME_X_P (f)) | ||
| 2693 | abort (); | ||
| 2694 | |||
| 2662 | *error = NULL; | 2695 | *error = NULL; |
| 2663 | 2696 | ||
| 2664 | if (menu_items_used <= MENU_ITEMS_PANE_LENGTH) | 2697 | if (menu_items_used <= MENU_ITEMS_PANE_LENGTH) |
| @@ -2941,6 +2974,9 @@ create_and_show_dialog (f, first_wv) | |||
| 2941 | { | 2974 | { |
| 2942 | GtkWidget *menu; | 2975 | GtkWidget *menu; |
| 2943 | 2976 | ||
| 2977 | if (! FRAME_X_P (f)) | ||
| 2978 | abort (); | ||
| 2979 | |||
| 2944 | menu = xg_create_widget ("dialog", first_wv->name, f, first_wv, | 2980 | menu = xg_create_widget ("dialog", first_wv->name, f, first_wv, |
| 2945 | G_CALLBACK (dialog_selection_callback), | 2981 | G_CALLBACK (dialog_selection_callback), |
| 2946 | G_CALLBACK (popup_deactivate_callback), | 2982 | G_CALLBACK (popup_deactivate_callback), |
| @@ -2990,6 +3026,9 @@ create_and_show_dialog (f, first_wv) | |||
| 2990 | { | 3026 | { |
| 2991 | LWLIB_ID dialog_id; | 3027 | LWLIB_ID dialog_id; |
| 2992 | 3028 | ||
| 3029 | if (!FRAME_X_P (f)) | ||
| 3030 | abort(); | ||
| 3031 | |||
| 2993 | dialog_id = widget_id_tick++; | 3032 | dialog_id = widget_id_tick++; |
| 2994 | lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv, | 3033 | lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv, |
| 2995 | f->output_data.x->widget, 1, 0, | 3034 | f->output_data.x->widget, 1, 0, |
| @@ -3041,6 +3080,9 @@ xdialog_show (f, keymaps, title, header, error_name) | |||
| 3041 | /* 1 means we've seen the boundary between left-hand elts and right-hand. */ | 3080 | /* 1 means we've seen the boundary between left-hand elts and right-hand. */ |
| 3042 | int boundary_seen = 0; | 3081 | int boundary_seen = 0; |
| 3043 | 3082 | ||
| 3083 | if (! FRAME_X_P (f)) | ||
| 3084 | abort (); | ||
| 3085 | |||
| 3044 | *error_name = NULL; | 3086 | *error_name = NULL; |
| 3045 | 3087 | ||
| 3046 | if (menu_items_n_panes > 1) | 3088 | if (menu_items_n_panes > 1) |
| @@ -3308,6 +3350,9 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 3308 | unsigned int dummy_uint; | 3350 | unsigned int dummy_uint; |
| 3309 | int specpdl_count = SPECPDL_INDEX (); | 3351 | int specpdl_count = SPECPDL_INDEX (); |
| 3310 | 3352 | ||
| 3353 | if (! FRAME_X_P (f)) | ||
| 3354 | abort (); | ||
| 3355 | |||
| 3311 | *error = 0; | 3356 | *error = 0; |
| 3312 | if (menu_items_n_panes == 0) | 3357 | if (menu_items_n_panes == 0) |
| 3313 | return Qnil; | 3358 | return Qnil; |