From: Jan Djärv Date: Mon, 17 Sep 2007 08:07:28 +0000 (+0000) Subject: (gdpy_def): New variable. X-Git-Tag: emacs-pretest-23.0.90~10858 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=879ffad91329a32d64bcbf00eb98eb23173d1199;p=emacs.git (gdpy_def): New variable. (xg_initialize): Initialize gdpy_def. (xg_display_close): If no other display exists, set gdpy_def to a new connection. --- diff --git a/src/ChangeLog b/src/ChangeLog index d77539d151c..4ad6b4b7264 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2007-09-17 Jan Dj,Ad(Brv + + * gtkutil.c (gdpy_def): New variable. + (xg_initialize): Initialize gdpy_def. + (xg_display_close): If no other display exists, set gdpy_def to a + new connection. + 2007-09-16 Jan Dj,Ad(Brv * gtkutil.c (xg_get_image_for_pixmap): Always create a GdkPixbuf diff --git a/src/gtkutil.c b/src/gtkutil.c index b37620caa9c..81ef09b7ec4 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -51,6 +51,13 @@ Boston, MA 02110-1301, USA. */ #ifdef HAVE_GTK_MULTIDISPLAY +/* Gtk does not work well without any display open. Emacs may close + all its displays. In that case, keep a display around just for + the purpose of having one. */ + +static GdkDisplay *gdpy_def; + + /* Return the GdkDisplay that corresponds to the X display DPY. */ static GdkDisplay * @@ -147,9 +154,15 @@ xg_display_close (Display *dpy) break; } - if (! new_dpy) return; /* Emacs will exit anyway. */ + if (new_dpy) + gdpy_new = gdk_x11_lookup_xdisplay (new_dpy); + else + { + if (!gdpy_def) + gdpy_def = gdk_display_open (gdk_display_get_name (gdpy)); + gdpy_new = gdpy_def; + } - gdpy_new = gdk_x11_lookup_xdisplay (new_dpy); gdk_display_manager_set_default_display (gdk_display_manager_get (), gdpy_new); } @@ -4091,6 +4104,8 @@ xg_initialize () we keep it permanently linked in. */ XftInit (0); #endif + + gdpy_def = NULL; xg_ignore_gtk_scrollbar = 0; xg_detached_menus = 0; xg_menu_cb_list.prev = xg_menu_cb_list.next =