aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1995-03-15 01:54:19 +0000
committerKarl Heuer1995-03-15 01:54:19 +0000
commit29b38361ea18507b7f381d8f79b9f0348e25f720 (patch)
treecd2be3c8ba3f5eb51792128867ea3b73e4387350 /src
parent73410c7662eebd9ad1473de4d34768f103f29f50 (diff)
downloademacs-29b38361ea18507b7f381d8f79b9f0348e25f720.tar.gz
emacs-29b38361ea18507b7f381d8f79b9f0348e25f720.zip
(get_perdisplay): Deleted.
(same_x_server): New function. (x_term_init): If this display shares a keyboard with one we've already opened, then share the structure. (x_delete_display): Don't delete the kboard until the reference count becomes zero.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c81
1 files changed, 54 insertions, 27 deletions
diff --git a/src/xterm.c b/src/xterm.c
index a7b5940f651..ca0f3eed2d4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -264,19 +264,6 @@ x_display_info_for_display (dpy)
264 264
265 return 0; 265 return 0;
266} 266}
267
268#ifdef MULTI_PERDISPLAY
269/* Return the perdisplay struct corresponding to FRAME. */
270#undef get_perdisplay
271
272PERDISPLAY *
273get_perdisplay(frame)
274 FRAME_PTR frame;
275{
276 return get_perdisplay_macro (frame);
277}
278#define get_perdisplay(frame) get_perdisplay_macro (frame)
279#endif
280 267
281/* Starting and ending updates. 268/* Starting and ending updates.
282 269
@@ -5540,6 +5527,27 @@ static XrmOptionDescRec emacs_options[] = {
5540 5527
5541static int x_initialized; 5528static int x_initialized;
5542 5529
5530#ifdef MULTI_KBOARD
5531/* Test whether two display-name strings agree up to the dot that separates
5532 the screen number from the server number. */
5533static int
5534same_x_server (name1, name2)
5535 char *name1, *name2;
5536{
5537 int seen_colon = 0;
5538 for (; *name1 != '\0' && *name1 == *name2; name1++, name2++)
5539 {
5540 if (*name1 == ':')
5541 seen_colon++;
5542 if (seen_colon && *name1 == '.')
5543 return 1;
5544 }
5545 return (seen_colon
5546 && (*name1 == '.' || *name1 == '\0')
5547 && (*name2 == '.' || *name2 == '\0'));
5548}
5549#endif
5550
5543struct x_display_info * 5551struct x_display_info *
5544x_term_init (display_name, xrm_option, resource_name) 5552x_term_init (display_name, xrm_option, resource_name)
5545 Lisp_Object display_name; 5553 Lisp_Object display_name;
@@ -5596,10 +5604,27 @@ x_term_init (display_name, xrm_option, resource_name)
5596 5604
5597 dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info)); 5605 dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info));
5598 5606
5599#ifdef MULTI_PERDISPLAY 5607#ifdef MULTI_KBOARD
5600 init_perdisplay (&dpyinfo->perdisplay); 5608 {
5601 dpyinfo->perdisplay.next_perdisplay = all_perdisplays; 5609 struct x_display_info *share;
5602 all_perdisplays = &dpyinfo->perdisplay; 5610 Lisp_Object tail;
5611
5612 for (share = x_display_list, tail = x_display_name_list; share;
5613 share = share->next, tail = XCONS (tail)->cdr)
5614 if (same_x_server (XSTRING (XCONS (XCONS (tail)->car)->car)->data,
5615 XSTRING (display_name)->data))
5616 break;
5617 if (share)
5618 dpyinfo->kboard = share->kboard;
5619 else
5620 {
5621 dpyinfo->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
5622 init_kboard (dpyinfo->kboard);
5623 dpyinfo->kboard->next_kboard = all_kboards;
5624 all_kboards = dpyinfo->kboard;
5625 }
5626 dpyinfo->kboard->reference_count++;
5627 }
5603#endif 5628#endif
5604 5629
5605 /* Put this display on the chain. */ 5630 /* Put this display on the chain. */
@@ -5777,16 +5802,18 @@ x_delete_display (dpyinfo)
5777 /* I'm told Xt does this itself. */ 5802 /* I'm told Xt does this itself. */
5778 XrmDestroyDatabase (dpyinfo->xrdb); 5803 XrmDestroyDatabase (dpyinfo->xrdb);
5779#endif 5804#endif
5780#ifdef MULTI_PERDISPLAY 5805#ifdef MULTI_KBOARD
5781 { 5806 if (--dpyinfo->kboard->reference_count == 0)
5782 PERDISPLAY **perdp; 5807 {
5783 for (perdp = &all_perdisplays; *perdp != &dpyinfo->perdisplay; 5808 KBOARD **kbp;
5784 perdp = &(*perdp)->next_perdisplay) 5809 for (kbp = &all_kboards; *kbp != dpyinfo->kboard;
5785 if (*perdp == NULL) 5810 kbp = &(*kbp)->next_kboard)
5786 abort (); 5811 if (*kbp == NULL)
5787 *perdp = dpyinfo->perdisplay.next_perdisplay; 5812 abort ();
5788 } 5813 *kbp = dpyinfo->kboard->next_kboard;
5789 wipe_perdisplay (&dpyinfo->perdisplay); 5814 wipe_kboard (dpyinfo->kboard);
5815 xfree (dpyinfo->kboard);
5816 }
5790#endif 5817#endif
5791 xfree (dpyinfo->font_table); 5818 xfree (dpyinfo->font_table);
5792 xfree (dpyinfo->x_id_name); 5819 xfree (dpyinfo->x_id_name);