Mercurial > emacs
changeset 83323:61487e73bbc2
Cleanup: Move kboard fields from struct frame and device-specific descriptors to struct display.
* 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
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Mon, 27 Jun 2005 00:56:21 +0000 |
parents | cb3cae14fe7e |
children | eed3bdcacf4d |
files | src/dispnew.c src/frame.c src/frame.h src/term.c src/termchar.h src/termhooks.h src/xfns.c src/xselect.c src/xterm.c src/xterm.h |
diffstat | 10 files changed, 78 insertions(+), 117 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dispnew.c Mon Jun 27 00:39:58 2005 +0000 +++ b/src/dispnew.c Mon Jun 27 00:56:21 2005 +0000 @@ -6734,9 +6734,6 @@ 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;
--- a/src/frame.c Mon Jun 27 00:39:58 2005 +0000 +++ b/src/frame.c Mon Jun 27 00:56:21 2005 +0000 @@ -303,9 +303,6 @@ 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; @@ -425,7 +422,7 @@ #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 @@ -552,10 +549,6 @@ 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; } @@ -622,10 +615,6 @@ 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))) @@ -1358,6 +1347,8 @@ { struct frame *f; struct frame *sf = SELECTED_FRAME (); + struct kboard *kb; + int minibuffer_selected; if (EQ (frame, Qnil)) @@ -1513,23 +1504,25 @@ 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 @@ -1555,38 +1548,39 @@ /* 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; - - frame_on_same_kboard = Qnil; - - 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); - - if (FRAME_KBOARD (f) == FRAME_KBOARD (f1)) - frame_on_same_kboard = this; - } - - if (NILP (frame_on_same_kboard)) - not_single_kboard_state (FRAME_KBOARD (f)); - } + 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; + + 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); + + if (kb == FRAME_KBOARD (f1)) + frame_on_same_kboard = this; + } + + 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; @@ -1612,7 +1606,7 @@ /* 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; @@ -1620,7 +1614,7 @@ break; } - if (FRAME_KBOARD (f) == FRAME_KBOARD (f1)) + if (kb == FRAME_KBOARD (f1)) frame_on_same_kboard = this; } @@ -1635,11 +1629,11 @@ 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. */
--- a/src/frame.h Mon Jun 27 00:39:58 2005 +0000 +++ b/src/frame.h Mon Jun 27 00:56:21 2005 +0000 @@ -292,16 +292,6 @@ /* 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; @@ -456,7 +446,7 @@ }; #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
--- a/src/term.c Mon Jun 27 00:39:58 2005 +0000 +++ b/src/term.c Mon Jun 27 00:56:21 2005 +0000 @@ -2285,10 +2285,11 @@ 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; } @@ -2682,19 +2683,19 @@ 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. */ { @@ -3051,13 +3052,6 @@ 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; @@ -3170,6 +3164,11 @@ 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); }
--- a/src/termchar.h Mon Jun 27 00:39:58 2005 +0000 +++ b/src/termchar.h Mon Jun 27 00:56:21 2005 +0000 @@ -70,11 +70,6 @@ /* 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" */
--- a/src/termhooks.h Mon Jun 27 00:39:58 2005 +0000 +++ b/src/termhooks.h Mon Jun 27 00:56:21 2005 +0000 @@ -295,6 +295,11 @@ /* 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 {
--- a/src/xfns.c Mon Jun 27 00:39:58 2005 +0000 +++ b/src/xfns.c Mon Jun 27 00:56:21 2005 +0000 @@ -3014,7 +3014,7 @@ 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 @@ -3086,9 +3086,6 @@ 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! */ @@ -4598,20 +4595,12 @@ 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) @@ -4662,9 +4651,6 @@ 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;
--- a/src/xselect.c Mon Jun 27 00:39:58 2005 +0000 +++ b/src/xselect.c Mon Jun 27 00:56:21 2005 +0000 @@ -1010,7 +1010,7 @@ 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);
--- a/src/xterm.c Mon Jun 27 00:39:58 2005 +0000 +++ b/src/xterm.c Mon Jun 27 00:56:21 2005 +0000 @@ -10277,30 +10277,30 @@ 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 @@ -10677,10 +10677,6 @@ 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); @@ -10811,6 +10807,8 @@ 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;
--- a/src/xterm.h Mon Jun 27 00:39:58 2005 +0000 +++ b/src/xterm.h Mon Jun 27 00:56:21 2005 +0000 @@ -327,9 +327,6 @@ /* 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.