* src/termhooks.h (display): New field: kboard.
* src/xterm.h (x_display_info): Remove kboard field.
* src/termchar.h (tty_display_info): Ditto.
* src/frame.h (frame): Ditto.
(FRAME_KBOARD): Update.
* src/dispnew.c (init_display): Don't initialize kboard.
* src/frame.c (make_frame, make_initial_frame, make_terminal_frame): Ditto.
* src/frame.c (make_frame_without_minibuffer, Fdelete_frame): Update kboard access.
* src/keyboard.c (delete_kboard): Ditto.
* src/term.c (term_init): Ditto.
* src/xfns.c (Fx_create_frame, x_create_tip_frame): Ditto.
* src/xselect.c (x_handle_selection_clear): Ditto.
* src/xterm.c (x_term_init): Ditto.
* src/term.c (init_initial_display): Initialize kboard.
* src/xterm.c (x_term_init): Ditto.
* src/term.c (delete_tty): Remove kboard deletion.
(delete_display): Delete kboard as well.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-363
abort ();
f->output_method = d->type;
f->display = d;
-#ifdef MULTI_KBOARD
- f->kboard = d->display_info.tty->kboard;
-#endif
d->reference_count++;
d->display_info.tty->top_frame = selected_frame;
f->menu_bar_items_used = 0;
f->buffer_predicate = Qnil;
f->buffer_list = Qnil;
-#ifdef MULTI_KBOARD
- f->kboard = initial_kboard;
-#endif
f->namebuf = 0;
f->title = Qnil;
f->menu_bar_window = Qnil;
#ifdef MULTI_KBOARD
if (!NILP (mini_window)
- && XFRAME (XWINDOW (mini_window)->frame)->kboard != kb)
+ && XFRAME (XWINDOW (mini_window)->frame)->display->kboard != kb)
error ("Frame and minibuffer must be on the same display");
#endif
FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
-#ifdef MULTI_KBOARD
- f->kboard = initial_kboard;
-#endif
-
return f;
}
FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none;
-#ifdef MULTI_KBOARD
- f->kboard = FRAME_TTY (f)->kboard;
-#endif
-
/* Set the top frame to the newly created frame. */
if (FRAME_TTY (f)->top_frame
&& FRAME_LIVE_P (XFRAME (FRAME_TTY (f)->top_frame)))
{
struct frame *f;
struct frame *sf = SELECTED_FRAME ();
+ struct kboard *kb;
+
int minibuffer_selected;
if (EQ (frame, Qnil))
if (FRAME_DISPLAY (f)->delete_frame_hook)
(*FRAME_DISPLAY (f)->delete_frame_hook) (f);
-
+
{
struct display *display = FRAME_DISPLAY (f);
-
f->output_data.nothing = 0;
f->display = 0; /* Now the frame is dead. */
/* If needed, delete the device that this frame was on.
- (This must be done after the frame is killed.) */
+ (This must be done after the frame is killed.) */
display->reference_count--;
if (display->reference_count == 0)
- {
- if (display->delete_display_hook)
- (*display->delete_display_hook) (display);
- else
- delete_display (display);
- }
+ {
+ kb = NULL;
+ if (display->delete_display_hook)
+ (*display->delete_display_hook) (display);
+ else
+ delete_display (display);
+ }
+ else
+ kb = display->kboard;
}
/* If we've deleted the last_nonminibuf_frame, then try to find
/* If there's no other frame on the same kboard, get out of
single-kboard state if we're in it for this kboard. */
- {
- Lisp_Object frames;
- /* Some frame we found on the same kboard, or nil if there are none. */
- Lisp_Object frame_on_same_kboard;
+ if (kb != NULL)
+ {
+ Lisp_Object frames;
+ /* Some frame we found on the same kboard, or nil if there are none. */
+ Lisp_Object frame_on_same_kboard;
- frame_on_same_kboard = Qnil;
+ frame_on_same_kboard = Qnil;
- for (frames = Vframe_list;
- CONSP (frames);
- frames = XCDR (frames))
- {
- Lisp_Object this;
- struct frame *f1;
+ for (frames = Vframe_list;
+ CONSP (frames);
+ frames = XCDR (frames))
+ {
+ Lisp_Object this;
+ struct frame *f1;
- this = XCAR (frames);
- if (!FRAMEP (this))
- abort ();
- f1 = XFRAME (this);
+ this = XCAR (frames);
+ if (!FRAMEP (this))
+ abort ();
+ f1 = XFRAME (this);
- if (FRAME_KBOARD (f) == FRAME_KBOARD (f1))
- frame_on_same_kboard = this;
- }
+ if (kb == FRAME_KBOARD (f1))
+ frame_on_same_kboard = this;
+ }
- if (NILP (frame_on_same_kboard))
- not_single_kboard_state (FRAME_KBOARD (f));
- }
+ if (NILP (frame_on_same_kboard))
+ not_single_kboard_state (kb);
+ }
/* If we've deleted this keyboard's default_minibuffer_frame, try to
find another one. Prefer minibuffer-only frames, but also notice
frames with other windows. */
- if (EQ (frame, FRAME_KBOARD (f)->Vdefault_minibuffer_frame))
+ if (kb != NULL && EQ (frame, kb->Vdefault_minibuffer_frame))
{
Lisp_Object frames;
/* Consider only frames on the same kboard
and only those with minibuffers. */
- if (FRAME_KBOARD (f) == FRAME_KBOARD (f1)
+ if (kb == FRAME_KBOARD (f1)
&& FRAME_HAS_MINIBUF_P (f1))
{
frame_with_minibuf = this;
break;
}
- if (FRAME_KBOARD (f) == FRAME_KBOARD (f1))
+ if (kb == FRAME_KBOARD (f1))
frame_on_same_kboard = this;
}
if (NILP (frame_with_minibuf))
abort ();
- FRAME_KBOARD (f)->Vdefault_minibuffer_frame = frame_with_minibuf;
+ kb->Vdefault_minibuffer_frame = frame_with_minibuf;
}
else
/* No frames left on this kboard--say no minibuffer either. */
- FRAME_KBOARD (f)->Vdefault_minibuffer_frame = Qnil;
+ kb->Vdefault_minibuffer_frame = Qnil;
}
/* Cause frame titles to update--necessary if we now have just one frame. */
/* The extra width (in pixels) currently allotted for fringes. */
int left_fringe_width, right_fringe_width;
-#ifdef MULTI_KBOARD
- /* XXX Maybe this should be moved to struct display, too. */
- /* A pointer to the kboard structure associated with this frame.
- For termcap frames, it will be the same as
- display->display_info.tty->kboard.
- For X frames, it will be the same as
- display->display_info.x->kboard. */
- struct kboard *kboard;
-#endif
-
/* See FULLSCREEN_ enum below */
int want_fullscreen;
};
#ifdef MULTI_KBOARD
-#define FRAME_KBOARD(f) ((f)->kboard)
+#define FRAME_KBOARD(f) ((f)->display->kboard)
#else
#define FRAME_KBOARD(f) (&the_only_kboard)
#endif
initial_display = create_display ();
initial_display->type = output_initial;
initial_display->name = xstrdup ("initial_display");
+ initial_display->kboard = initial_kboard;
initial_display->delete_display_hook = &delete_initial_display;
/* All other hooks are NULL. */
-
+
return initial_display;
}
tty->TF_teleray = tgetflag ("xt");
#ifdef MULTI_KBOARD
- tty->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
- init_kboard (tty->kboard);
- tty->kboard->next_kboard = all_kboards;
- all_kboards = tty->kboard;
+ display->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
+ init_kboard (display->kboard);
+ display->kboard->next_kboard = all_kboards;
+ all_kboards = display->kboard;
+ display->kboard->reference_count++;
/* Don't let the initial kboard remain current longer than necessary.
That would cause problems if a file loaded on startup tries to
prompt in the mini-buffer. */
if (current_kboard == initial_kboard)
- current_kboard = tty->kboard;
- tty->kboard->reference_count++;
+ current_kboard = display->kboard;
#endif
- term_get_fkeys (address, tty->kboard);
+ term_get_fkeys (address, display->kboard);
/* Get frame size from system, or else from termcap. */
{
if (tty->Wcm)
xfree (tty->Wcm);
-#ifdef MULTI_KBOARD
- if (tty->kboard && --tty->kboard->reference_count > 0)
- abort ();
- if (tty->kboard)
- delete_kboard (tty->kboard);
-#endif
-
bzero (tty, sizeof (struct tty_display_info));
xfree (tty);
deleting_tty = 0;
if (display->name)
xfree (display->name);
+#ifdef MULTI_KBOARD
+ if (display->kboard && --display->kboard->reference_count == 0)
+ delete_kboard (display->kboard);
+#endif
+
bzero (display, sizeof (struct display));
xfree (display);
}
/* The previous terminal frame we displayed on this tty. */
struct frame *previous_terminal_frame;
-#ifdef MULTI_KBOARD
- /* The terminal's keyboard object. */
- struct kboard *kboard;
-#endif
-
/* Strings, numbers and flags taken from the termcap entry. */
char *TS_ins_line; /* "al" */
/* The name of the display device. Do not use this to identify the display. */
char *name;
+#ifdef MULTI_KBOARD
+ /* The device's keyboard object. */
+ struct kboard *kboard;
+#endif
+
/* Display-type dependent data shared amongst all frames on this display. */
union display_info
{
display = Qnil;
dpyinfo = check_x_display_info (display);
#ifdef MULTI_KBOARD
- kb = dpyinfo->kboard;
+ kb = dpyinfo->frame_display->kboard;
#else
kb = &the_only_kboard;
#endif
image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount;
dpyinfo_refcount = dpyinfo->reference_count;
#endif /* GLYPH_DEBUG */
-#ifdef MULTI_KBOARD
- FRAME_KBOARD (f) = kb;
-#endif
/* These colors will be set anyway later, but it's important
to get the color reference counts right, so initialize them! */
int width, height;
int count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3;
- struct kboard *kb;
int face_change_count_before = face_change_count;
Lisp_Object buffer;
struct buffer *old_buffer;
check_x ();
-
-#ifdef MULTI_KBOARD
- kb = dpyinfo->kboard;
-#else
- kb = &the_only_kboard;
-#endif
-
/* Get the name of the frame to use for resource lookup. */
name = x_get_arg (dpyinfo, parms, Qname, "name", "Name", RES_TYPE_STRING);
if (!STRINGP (name)
image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount;
dpyinfo_refcount = dpyinfo->reference_count;
#endif /* GLYPH_DEBUG */
-#ifdef MULTI_KBOARD
- FRAME_KBOARD (f) = kb;
-#endif
f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window;
f->output_data.x->explicit_parent = 0;
to see if this Emacs job now owns the selection
through that display. */
for (t_dpyinfo = x_display_list; t_dpyinfo; t_dpyinfo = t_dpyinfo->next)
- if (t_dpyinfo->kboard == dpyinfo->kboard)
+ if (t_dpyinfo->frame_display->kboard == dpyinfo->frame_display->kboard)
{
Window owner_window
= XGetSelectionOwner (t_dpyinfo->display, selection);
SDATA (display_name)))
break;
if (share)
- dpyinfo->kboard = share->kboard;
+ display->kboard = share->frame_display->kboard;
else
{
- dpyinfo->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
- init_kboard (dpyinfo->kboard);
+ display->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
+ init_kboard (display->kboard);
if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound))
{
char *vendor = ServerVendor (dpy);
UNBLOCK_INPUT;
- dpyinfo->kboard->Vsystem_key_alist
+ display->kboard->Vsystem_key_alist
= call1 (Qvendor_specific_keysyms,
build_string (vendor ? vendor : ""));
BLOCK_INPUT;
}
- dpyinfo->kboard->next_kboard = all_kboards;
- all_kboards = dpyinfo->kboard;
+ display->kboard->next_kboard = all_kboards;
+ all_kboards = display->kboard;
/* Don't let the initial kboard remain current longer than necessary.
That would cause problems if a file loaded on startup tries to
prompt in the mini-buffer. */
if (current_kboard == initial_kboard)
- current_kboard = dpyinfo->kboard;
+ current_kboard = display->kboard;
}
- dpyinfo->kboard->reference_count++;
+ display->kboard->reference_count++;
}
#endif
XrmDestroyDatabase (dpyinfo->xrdb);
#endif
#endif
-#ifdef MULTI_KBOARD
- if (--dpyinfo->kboard->reference_count == 0)
- delete_kboard (dpyinfo->kboard);
-#endif
#ifdef HAVE_X_I18N
if (dpyinfo->xim)
xim_close_dpy (dpyinfo);
display->type = output_x_window;
display->display_info.x = dpyinfo;
dpyinfo->frame_display = display;
+
+ /* kboard is initialized in x_term_init. */
display->clear_frame_hook = x_clear_frame;
display->ins_del_lines_hook = x_ins_del_lines;
/* Atom used in toolkit scroll bar client messages. */
Atom Xatom_Scrollbar;
-#ifdef MULTI_KBOARD
- struct kboard *kboard;
-#endif
int cut_buffers_initialized; /* Whether we're sure they all exist */
/* The frame (if any) which has the X window that has keyboard focus.