aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/dispextern.h1
-rw-r--r--src/dispnew.c18
-rw-r--r--src/fns.c6
-rw-r--r--src/term.c10
-rw-r--r--src/xmenu.c49
5 files changed, 68 insertions, 16 deletions
diff --git a/src/dispextern.h b/src/dispextern.h
index 1c802e9e33..a7ce3a8e75 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2930,6 +2930,7 @@ extern void calculate_costs P_ ((struct frame *));
extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object));
extern void tty_setup_colors P_ ((struct tty_display_info *, int));
extern struct device *get_device P_ ((Lisp_Object display, int));
+extern struct device *get_tty_device P_ ((Lisp_Object terminal));
extern struct device *get_named_tty P_ ((char *));
EXFUN (Fdisplay_tty_type, 1);
extern struct device *init_initial_device P_ ((void));
diff --git a/src/dispnew.c b/src/dispnew.c
index 1ee951b0be..2a4c759975 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6285,21 +6285,27 @@ FILE = nil means just close any termscript file currently open. */)
DEFUN ("send-string-to-terminal", Fsend_string_to_terminal,
- Ssend_string_to_terminal, 1, 1, 0,
+ Ssend_string_to_terminal, 1, 2, 0,
doc: /* Send STRING to the terminal without alteration.
-Control characters in STRING will have terminal-dependent effects. */)
- (string)
+Control characters in STRING will have terminal-dependent effects.
+
+Optional parameter TERMINAL specifies the tty display device to use.
+It may be a terminal id, a frame, or nil for the terminal used by the
+currently selected frame. */)
+ (string, display)
Lisp_Object string;
+ Lisp_Object display;
{
+ struct device *d = get_tty_device (display);
struct tty_display_info *tty;
/* ??? Perhaps we should do something special for multibyte strings here. */
CHECK_STRING (string);
- if (! FRAME_TERMCAP_P (SELECTED_FRAME ()))
- error ("Current frame is not on a tty device");
+ if (!d)
+ error ("Unknown display device");
- tty = CURTTY ();
+ tty = d->display_info.tty;
if (tty->termscript)
{
diff --git a/src/fns.c b/src/fns.c
index 3c23aef282..987762a1f4 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3267,7 +3267,8 @@ is nil and `use-dialog-box' is non-nil. */)
{
#ifdef HAVE_MENUS
- if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
+ if (FRAME_WINDOW_P (SELECTED_FRAME ())
+ && (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
&& use_dialog_box
&& have_menus_p ())
{
@@ -3398,7 +3399,8 @@ is nil, and `use-dialog-box' is non-nil. */)
CHECK_STRING (prompt);
#ifdef HAVE_MENUS
- if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
+ if (FRAME_WINDOW_P (SELECTED_FRAME ())
+ && (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
&& use_dialog_box
&& have_menus_p ())
{
diff --git a/src/term.c b/src/term.c
index 77720779ba..3b3f0ad213 100644
--- a/src/term.c
+++ b/src/term.c
@@ -85,8 +85,6 @@ static void turn_off_face P_ ((struct frame *, int face_id));
static void tty_show_cursor P_ ((struct tty_display_info *));
static void tty_hide_cursor P_ ((struct tty_display_info *));
-static struct device *get_tty_device (Lisp_Object device);
-
void delete_initial_device P_ ((struct device *));
void create_tty_output P_ ((struct frame *));
void delete_tty_output P_ ((struct frame *));
@@ -2164,11 +2162,11 @@ get_device (Lisp_Object device, int throw)
/* Return the tty display object specified by DEVICE. */
-static struct device *
-get_tty_device (Lisp_Object device)
+struct device *
+get_tty_device (Lisp_Object terminal)
{
- struct device *d = get_device (device, 0);
-
+ struct device *d = get_device (terminal, 0);
+
if (d && d->type == output_initial)
d = NULL;
diff --git a/src/xmenu.c b/src/xmenu.c
index 4abf89655d..5aae977ac9 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -705,6 +705,9 @@ mouse_position_for_popup (f, x, y)
Window root, dummy_window;
int dummy;
+ if (! FRAME_X_P (f))
+ abort ();
+
BLOCK_INPUT;
XQueryPointer (FRAME_X_DISPLAY (f),
@@ -899,6 +902,9 @@ no quit occurs and `x-popup-menu' returns nil. */)
xpos += XINT (x);
ypos += XINT (y);
+
+ if (! FRAME_X_P (f))
+ error ("Can not put X menu on non-X terminal");
}
Vmenu_updating_frame = Qnil;
#endif /* HAVE_MENUS */
@@ -1085,6 +1091,9 @@ for instance using the window manager, then this produces a quit and
but I don't want to make one now. */
CHECK_WINDOW (window);
+ if (! FRAME_X_P (f))
+ error ("Can not put X dialog on non-X terminal");
+
#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
/* Display a menu with these alternatives
in the middle of frame F. */
@@ -1302,6 +1311,9 @@ void
x_activate_menubar (f)
FRAME_PTR f;
{
+ if (! FRAME_X_P (f))
+ abort ();
+
if (!f->output_data.x->saved_menu_event->type)
return;
@@ -1922,9 +1934,14 @@ update_frame_menubar (f)
#ifdef USE_GTK
return xg_update_frame_menubar (f);
#else
- struct x_output *x = f->output_data.x;
+ struct x_output *x;
int columns, rows;
+ if (! FRAME_X_P (f))
+ abort ();
+
+ x = f->output_data.x;
+
if (!x->menubar_widget || XtIsManaged (x->menubar_widget))
return 0;
@@ -1970,7 +1987,7 @@ set_frame_menubar (f, first_time, deep_p)
int first_time;
int deep_p;
{
- xt_or_gtk_widget menubar_widget = f->output_data.x->menubar_widget;
+ xt_or_gtk_widget menubar_widget;
#ifdef USE_X_TOOLKIT
LWLIB_ID id;
#endif
@@ -1980,6 +1997,10 @@ set_frame_menubar (f, first_time, deep_p)
int *submenu_start, *submenu_end;
int *submenu_top_level_items, *submenu_n_panes;
+ if (! FRAME_X_P (f))
+ abort ();
+
+ menubar_widget = f->output_data.x->menubar_widget;
XSETFRAME (Vmenu_updating_frame, f);
@@ -2324,6 +2345,9 @@ free_frame_menubar (f)
{
Widget menubar_widget;
+ if (! FRAME_X_P (f))
+ abort ();
+
menubar_widget = f->output_data.x->menubar_widget;
f->output_data.x->menubar_height = 0;
@@ -2476,6 +2500,9 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click)
struct next_popup_x_y popup_x_y;
int specpdl_count = SPECPDL_INDEX ();
+ if (! FRAME_X_P (f))
+ abort ();
+
xg_crazy_callback_abort = 1;
menu = xg_create_widget ("popup", first_wv->name, f, first_wv,
G_CALLBACK (popup_selection_callback),
@@ -2584,6 +2611,9 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click)
LWLIB_ID menu_id;
Widget menu;
+ if (! FRAME_X_P (f))
+ abort ();
+
menu_id = widget_id_tick++;
menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv,
f->output_data.x->widget, 1, 0,
@@ -2659,6 +2689,9 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
int first_pane;
+ if (! FRAME_X_P (f))
+ abort ();
+
*error = NULL;
if (menu_items_used <= MENU_ITEMS_PANE_LENGTH)
@@ -2941,6 +2974,9 @@ create_and_show_dialog (f, first_wv)
{
GtkWidget *menu;
+ if (! FRAME_X_P (f))
+ abort ();
+
menu = xg_create_widget ("dialog", first_wv->name, f, first_wv,
G_CALLBACK (dialog_selection_callback),
G_CALLBACK (popup_deactivate_callback),
@@ -2990,6 +3026,9 @@ create_and_show_dialog (f, first_wv)
{
LWLIB_ID dialog_id;
+ if (!FRAME_X_P (f))
+ abort();
+
dialog_id = widget_id_tick++;
lw_create_widget (first_wv->name, "dialog", dialog_id, first_wv,
f->output_data.x->widget, 1, 0,
@@ -3041,6 +3080,9 @@ xdialog_show (f, keymaps, title, header, error_name)
/* 1 means we've seen the boundary between left-hand elts and right-hand. */
int boundary_seen = 0;
+ if (! FRAME_X_P (f))
+ abort ();
+
*error_name = NULL;
if (menu_items_n_panes > 1)
@@ -3308,6 +3350,9 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
unsigned int dummy_uint;
int specpdl_count = SPECPDL_INDEX ();
+ if (! FRAME_X_P (f))
+ abort ();
+
*error = 0;
if (menu_items_n_panes == 0)
return Qnil;