Mercurial > emacs
comparison src/gtkutil.c @ 84621:5d074ea0e4a2
(gdpy_def): New variable.
(xg_initialize): Initialize gdpy_def.
(xg_display_close): If no other display exists, set gdpy_def to a
new connection.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Mon, 17 Sep 2007 08:07:19 +0000 |
parents | 6aa198cbc91e |
children | d7e05ac913d8 bdb3fe0ba9fa |
comparison
equal
deleted
inserted
replaced
84620:71ee9cbb96e8 | 84621:5d074ea0e4a2 |
---|---|
49 Display handling functions | 49 Display handling functions |
50 ***********************************************************************/ | 50 ***********************************************************************/ |
51 | 51 |
52 #ifdef HAVE_GTK_MULTIDISPLAY | 52 #ifdef HAVE_GTK_MULTIDISPLAY |
53 | 53 |
54 /* Gtk does not work well without any display open. Emacs may close | |
55 all its displays. In that case, keep a display around just for | |
56 the purpose of having one. */ | |
57 | |
58 static GdkDisplay *gdpy_def; | |
59 | |
60 | |
54 /* Return the GdkDisplay that corresponds to the X display DPY. */ | 61 /* Return the GdkDisplay that corresponds to the X display DPY. */ |
55 | 62 |
56 static GdkDisplay * | 63 static GdkDisplay * |
57 xg_get_gdk_display (dpy) | 64 xg_get_gdk_display (dpy) |
58 Display *dpy; | 65 Display *dpy; |
145 { | 152 { |
146 new_dpy = dpyinfo->display; | 153 new_dpy = dpyinfo->display; |
147 break; | 154 break; |
148 } | 155 } |
149 | 156 |
150 if (! new_dpy) return; /* Emacs will exit anyway. */ | 157 if (new_dpy) |
151 | 158 gdpy_new = gdk_x11_lookup_xdisplay (new_dpy); |
152 gdpy_new = gdk_x11_lookup_xdisplay (new_dpy); | 159 else |
160 { | |
161 if (!gdpy_def) | |
162 gdpy_def = gdk_display_open (gdk_display_get_name (gdpy)); | |
163 gdpy_new = gdpy_def; | |
164 } | |
165 | |
153 gdk_display_manager_set_default_display (gdk_display_manager_get (), | 166 gdk_display_manager_set_default_display (gdk_display_manager_get (), |
154 gdpy_new); | 167 gdpy_new); |
155 } | 168 } |
156 | 169 |
157 /* GTK 2.2-2.8 has a bug that makes gdk_display_close crash (bug | 170 /* GTK 2.2-2.8 has a bug that makes gdk_display_close crash (bug |
4089 #if HAVE_XFT | 4102 #if HAVE_XFT |
4090 /* Work around a bug with corrupted data if libXft gets unloaded. This way | 4103 /* Work around a bug with corrupted data if libXft gets unloaded. This way |
4091 we keep it permanently linked in. */ | 4104 we keep it permanently linked in. */ |
4092 XftInit (0); | 4105 XftInit (0); |
4093 #endif | 4106 #endif |
4107 | |
4108 gdpy_def = NULL; | |
4094 xg_ignore_gtk_scrollbar = 0; | 4109 xg_ignore_gtk_scrollbar = 0; |
4095 xg_detached_menus = 0; | 4110 xg_detached_menus = 0; |
4096 xg_menu_cb_list.prev = xg_menu_cb_list.next = | 4111 xg_menu_cb_list.prev = xg_menu_cb_list.next = |
4097 xg_menu_item_cb_list.prev = xg_menu_item_cb_list.next = 0; | 4112 xg_menu_item_cb_list.prev = xg_menu_item_cb_list.next = 0; |
4098 | 4113 |