Mercurial > emacs
comparison src/xterm.c @ 11015:3a2547424010
(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.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Wed, 15 Mar 1995 01:54:19 +0000 |
parents | bf33c9179a6b |
children | ce63fb361ae9 |
comparison
equal
deleted
inserted
replaced
11014:634a98104921 | 11015:3a2547424010 |
---|---|
262 if (dpyinfo->display == dpy) | 262 if (dpyinfo->display == dpy) |
263 return dpyinfo; | 263 return dpyinfo; |
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 | |
272 PERDISPLAY * | |
273 get_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 |
283 These hooks are called by update_frame at the beginning and end | 270 These hooks are called by update_frame at the beginning and end |
284 of a frame update. We record in `updating_frame' the identity | 271 of a frame update. We record in `updating_frame' the identity |
5538 }; | 5525 }; |
5539 #endif /* USE_X_TOOLKIT */ | 5526 #endif /* USE_X_TOOLKIT */ |
5540 | 5527 |
5541 static int x_initialized; | 5528 static 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. */ | |
5533 static int | |
5534 same_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 | |
5543 struct x_display_info * | 5551 struct x_display_info * |
5544 x_term_init (display_name, xrm_option, resource_name) | 5552 x_term_init (display_name, xrm_option, resource_name) |
5545 Lisp_Object display_name; | 5553 Lisp_Object display_name; |
5546 char *xrm_option; | 5554 char *xrm_option; |
5547 char *resource_name; | 5555 char *resource_name; |
5594 | 5602 |
5595 /* We have definitely succeeded. Record the new connection. */ | 5603 /* We have definitely succeeded. Record the new connection. */ |
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. */ |
5606 dpyinfo->next = x_display_list; | 5631 dpyinfo->next = x_display_list; |
5607 x_display_list = dpyinfo; | 5632 x_display_list = dpyinfo; |
5775 | 5800 |
5776 #ifndef USE_X_TOOLKIT | 5801 #ifndef USE_X_TOOLKIT |
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); |
5793 xfree (dpyinfo); | 5820 xfree (dpyinfo); |
5794 } | 5821 } |