From: Karoly Lorentey Date: Sat, 19 Mar 2005 20:38:03 +0000 (+0000) Subject: Close the X connection when the last frame is deleted. X-Git-Tag: emacs-pretest-23.0.90~11236^2~141^2~288 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3dde89595b858eb67d926d80ac7c63dae398c8ae;p=emacs.git Close the X connection when the last frame is deleted. * src/xfns.c (Fx_close_connection): Move code to x_delete_frame_display. (x_delete_frame_display): Actually close the X connection. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-312 --- diff --git a/src/xfns.c b/src/xfns.c index 72547e2010f..2487e67be9c 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4051,25 +4051,7 @@ If DISPLAY is nil, that stands for the selected frame's display. */) if (dpyinfo->reference_count > 0) error ("Display still has frames on it"); - BLOCK_INPUT; - /* Free the fonts in the font table. */ - for (i = 0; i < dpyinfo->n_fonts; i++) - if (dpyinfo->font_table[i].name) - { - XFreeFont (dpyinfo->display, dpyinfo->font_table[i].font); - } - - x_destroy_all_bitmaps (dpyinfo); - XSetCloseDownMode (dpyinfo->display, DestroyAll); - -#ifdef USE_X_TOOLKIT - XtCloseDisplay (dpyinfo->display); -#else - XCloseDisplay (dpyinfo->display); -#endif - - x_delete_display (dpyinfo); - UNBLOCK_INPUT; + x_delete_frame_display (dpyinfo->frame_display); return Qnil; } diff --git a/src/xterm.c b/src/xterm.c index 2fd9e6b99e6..36f1630e6c1 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10767,8 +10767,27 @@ static struct redisplay_interface x_redisplay_interface = void x_delete_frame_display (struct display *display) { - /* We don't do anything, the connection to the X server must remain - open. */ + struct x_display_info *dpyinfo = display->display_info; + + BLOCK_INPUT; + /* Free the fonts in the font table. */ + for (i = 0; i < dpyinfo->n_fonts; i++) + if (dpyinfo->font_table[i].name) + { + XFreeFont (dpyinfo->display, dpyinfo->font_table[i].font); + } + + x_destroy_all_bitmaps (dpyinfo); + XSetCloseDownMode (dpyinfo->display, DestroyAll); + +#ifdef USE_X_TOOLKIT + XtCloseDisplay (dpyinfo->display); +#else + XCloseDisplay (dpyinfo->display); +#endif + + x_delete_display (dpyinfo); + UNBLOCK_INPUT; }