aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2008-12-13 05:44:38 +0000
committerChong Yidong2008-12-13 05:44:38 +0000
commit09fce22308c6666c7cfe51b5bcc2d856df56aced (patch)
treee8b90d98776909e897617ed7734d38f56824b670 /src
parent9b011d3b30926b050f4b4464ac0556972b303e2b (diff)
downloademacs-09fce22308c6666c7cfe51b5bcc2d856df56aced.tar.gz
emacs-09fce22308c6666c7cfe51b5bcc2d856df56aced.zip
(struct xim_inst_t): Definition moved to xterm.h.
(xim_initialize): Save pointer to callback function data. (xim_close_dpy): Free callback function data. Call XCloseIM, reverting 2008-11-04 change by David Smith. (x_term_init): Don't initialize the image cache here; it will be done in init_frame_faces. Remove ancient "null_pixel" cruft. (x_delete_display): Free x_dnd_atoms member.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 54833eef366..ffc03bc10e9 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -8184,6 +8184,8 @@ xim_open_dpy (dpyinfo, resource_name)
8184#ifdef HAVE_XIM 8184#ifdef HAVE_XIM
8185 if (use_xim) 8185 if (use_xim)
8186 { 8186 {
8187 if (dpyinfo->xim)
8188 XCloseIM (dpyinfo->xim);
8187 xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name, 8189 xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name,
8188 EMACS_CLASS); 8190 EMACS_CLASS);
8189 dpyinfo->xim = xim; 8191 dpyinfo->xim = xim;
@@ -8213,12 +8215,6 @@ xim_open_dpy (dpyinfo, resource_name)
8213 8215
8214#ifdef HAVE_X11R6_XIM 8216#ifdef HAVE_X11R6_XIM
8215 8217
8216struct xim_inst_t
8217{
8218 struct x_display_info *dpyinfo;
8219 char *resource_name;
8220};
8221
8222/* XIM instantiate callback function, which is called whenever an XIM 8218/* XIM instantiate callback function, which is called whenever an XIM
8223 server is available. DISPLAY is the display of the XIM. 8219 server is available. DISPLAY is the display of the XIM.
8224 CLIENT_DATA contains a pointer to an xim_inst_t structure created 8220 CLIENT_DATA contains a pointer to an xim_inst_t structure created
@@ -8282,6 +8278,7 @@ xim_initialize (dpyinfo, resource_name)
8282 struct x_display_info *dpyinfo; 8278 struct x_display_info *dpyinfo;
8283 char *resource_name; 8279 char *resource_name;
8284{ 8280{
8281 dpyinfo->xim = NULL;
8285#ifdef HAVE_XIM 8282#ifdef HAVE_XIM
8286 if (use_xim) 8283 if (use_xim)
8287 { 8284 {
@@ -8289,8 +8286,8 @@ xim_initialize (dpyinfo, resource_name)
8289 struct xim_inst_t *xim_inst; 8286 struct xim_inst_t *xim_inst;
8290 int len; 8287 int len;
8291 8288
8292 dpyinfo->xim = NULL;
8293 xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t)); 8289 xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t));
8290 dpyinfo->xim_callback_data = xim_inst;
8294 xim_inst->dpyinfo = dpyinfo; 8291 xim_inst->dpyinfo = dpyinfo;
8295 len = strlen (resource_name); 8292 len = strlen (resource_name);
8296 xim_inst->resource_name = (char *) xmalloc (len + 1); 8293 xim_inst->resource_name = (char *) xmalloc (len + 1);
@@ -8303,14 +8300,10 @@ xim_initialize (dpyinfo, resource_name)
8303 least, hence the configure test. */ 8300 least, hence the configure test. */
8304 (XRegisterIMInstantiateCallback_arg6) xim_inst); 8301 (XRegisterIMInstantiateCallback_arg6) xim_inst);
8305#else /* not HAVE_X11R6_XIM */ 8302#else /* not HAVE_X11R6_XIM */
8306 dpyinfo->xim = NULL;
8307 xim_open_dpy (dpyinfo, resource_name); 8303 xim_open_dpy (dpyinfo, resource_name);
8308#endif /* not HAVE_X11R6_XIM */ 8304#endif /* not HAVE_X11R6_XIM */
8309
8310 } 8305 }
8311 else
8312#endif /* HAVE_XIM */ 8306#endif /* HAVE_XIM */
8313 dpyinfo->xim = NULL;
8314} 8307}
8315 8308
8316 8309
@@ -8328,11 +8321,11 @@ xim_close_dpy (dpyinfo)
8328 XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, 8321 XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
8329 NULL, EMACS_CLASS, 8322 NULL, EMACS_CLASS,
8330 xim_instantiate_callback, NULL); 8323 xim_instantiate_callback, NULL);
8331#else /* not HAVE_X11R6_XIM */ 8324 xfree (dpyinfo->xim_callback_data->resource_name);
8332 /* If we have X11R6 xim, this causes a double-free. */ 8325 xfree (dpyinfo->xim_callback_data);
8326#endif /* HAVE_X11R6_XIM */
8333 if (dpyinfo->display) 8327 if (dpyinfo->display)
8334 XCloseIM (dpyinfo->xim); 8328 XCloseIM (dpyinfo->xim);
8335#endif /* HAVE_X11R6_XIM */
8336 dpyinfo->xim = NULL; 8329 dpyinfo->xim = NULL;
8337 XFree (dpyinfo->xim_styles); 8330 XFree (dpyinfo->xim_styles);
8338 } 8331 }
@@ -10242,7 +10235,6 @@ x_term_init (display_name, xrm_option, resource_name)
10242 dpyinfo->x_focus_frame = 0; 10235 dpyinfo->x_focus_frame = 0;
10243 dpyinfo->x_focus_event_frame = 0; 10236 dpyinfo->x_focus_event_frame = 0;
10244 dpyinfo->x_highlight_frame = 0; 10237 dpyinfo->x_highlight_frame = 0;
10245 dpyinfo->terminal->image_cache = make_image_cache ();
10246 dpyinfo->wm_type = X_WMTYPE_UNKNOWN; 10238 dpyinfo->wm_type = X_WMTYPE_UNKNOWN;
10247 10239
10248 /* See if we can construct pixel values from RGB values. */ 10240 /* See if we can construct pixel values from RGB values. */
@@ -10370,17 +10362,6 @@ x_term_init (display_name, xrm_option, resource_name)
10370 dpyinfo->connection = connection; 10362 dpyinfo->connection = connection;
10371 10363
10372 { 10364 {
10373 char null_bits[1];
10374
10375 null_bits[0] = 0x00;
10376
10377 dpyinfo->null_pixel
10378 = XCreatePixmapFromBitmapData (dpyinfo->display, dpyinfo->root_window,
10379 null_bits, 1, 1, (long) 0, (long) 0,
10380 1);
10381 }
10382
10383 {
10384 extern int gray_bitmap_width, gray_bitmap_height; 10365 extern int gray_bitmap_width, gray_bitmap_height;
10385 extern char *gray_bitmap_bits; 10366 extern char *gray_bitmap_bits;
10386 dpyinfo->gray 10367 dpyinfo->gray
@@ -10549,6 +10530,7 @@ x_delete_display (dpyinfo)
10549#endif 10530#endif
10550 10531
10551 xfree (dpyinfo->x_id_name); 10532 xfree (dpyinfo->x_id_name);
10533 xfree (dpyinfo->x_dnd_atoms);
10552 xfree (dpyinfo->color_cells); 10534 xfree (dpyinfo->color_cells);
10553 xfree (dpyinfo); 10535 xfree (dpyinfo);
10554} 10536}