/* X Communication module for terminals which understand the X protocol.
Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GNU Emacs.
else if (INTEGERP (Vframe_alpha_lower_limit))
alpha_min = (XINT (Vframe_alpha_lower_limit)) / 100.0;
- if (alpha < 0.0 || 1.0 < alpha)
+ if (alpha < 0.0)
+ return;
+ else if (alpha > 1.0)
alpha = 1.0;
else if (0.0 <= alpha && alpha < alpha_min && alpha_min <= 1.0)
alpha = alpha_min;
int width;
struct glyph_string *next;
- for (width = 0, next = s->next; next;
+ for (width = 0, next = s->next;
+ next && width < s->right_overhang;
width += next->width, next = next->next)
if (next->first_glyph->type != IMAGE_GLYPH)
{
x_set_glyph_string_gc (next);
x_set_glyph_string_clipping (next);
- x_draw_glyph_string_background (next, 1);
+ if (next->first_glyph->type == STRETCH_GLYPH)
+ x_draw_stretch_glyph_string (next);
+ else
+ x_draw_glyph_string_background (next, 1);
next->num_clips = 0;
}
}
position = s->font->underline_position;
else if (s->font)
position = (s->font->descent + 1) / 2;
+ else
+ position = underline_minimum_offset;
}
position = max (position, underline_minimum_offset);
}
if (! FRAME_X_P (XFRAME (frame)))
continue;
-
+
/* Scan this frame's scroll bar list for a scroll bar with the
right window ID. */
condemned = FRAME_CONDEMNED_SCROLL_BARS (XFRAME (frame));
inev.ie.code = XFASTINT (c);
goto done_keysym;
}
-
+
/* Random non-modifier sorts of keysyms. */
if (((keysym >= XK_BackSpace && keysym <= XK_Escape)
|| keysym == XK_Delete
if (interrupt_input_blocked)
{
interrupt_input_pending = 1;
+#ifdef SYNC_INPUT
+ pending_signals = 1;
+#endif
return -1;
}
interrupt_input_pending = 0;
+#ifdef SYNC_INPUT
+ pending_signals = pending_atimers;
+#endif
BLOCK_INPUT;
/* So people can tell when we have read the available input. */
XTread_socket_fake_io_error = 0;
x_io_error_quitter (terminal->display_info.x->display);
}
-
+
#if 0 /* This loop is a noop now. */
/* Find the display we are supposed to read input for.
It's the one communicating on descriptor SD. */
dpyinfo->reference_count++;
dpyinfo->terminal->reference_count++;
}
-
+
/* First delete frames whose mini-buffers are on frames
that are on the dead display. */
FOR_EACH_FRAME (tail, frame)
&& FRAME_X_P (XFRAME (minibuf_frame))
&& ! EQ (frame, minibuf_frame)
&& FRAME_X_DISPLAY_INFO (XFRAME (minibuf_frame)) == dpyinfo)
- Fdelete_frame (frame, Qnoelisp);
+ delete_frame (frame, Qnoelisp);
}
/* Now delete all remaining frames on the dead display.
if (FRAME_X_P (XFRAME (frame))
&& FRAME_X_DISPLAY_INFO (XFRAME (frame)) == dpyinfo)
{
- /* Set this to t so that Fdelete_frame won't get confused
+ /* Set this to t so that delete_frame won't get confused
trying to find a replacement. */
FRAME_KBOARD (XFRAME (frame))->Vdefault_minibuffer_frame = Qt;
- Fdelete_frame (frame, Qnoelisp);
+ delete_frame (frame, Qnoelisp);
}
/* We have to close the display to inform Xt that it doesn't
#ifdef HAVE_XIM
if (use_xim)
{
+ if (dpyinfo->xim)
+ XCloseIM (dpyinfo->xim);
xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name,
EMACS_CLASS);
dpyinfo->xim = xim;
#ifdef HAVE_X11R6_XIM
-struct xim_inst_t
-{
- struct x_display_info *dpyinfo;
- char *resource_name;
-};
-
/* XIM instantiate callback function, which is called whenever an XIM
server is available. DISPLAY is the display of the XIM.
CLIENT_DATA contains a pointer to an xim_inst_t structure created
struct x_display_info *dpyinfo;
char *resource_name;
{
+ dpyinfo->xim = NULL;
#ifdef HAVE_XIM
if (use_xim)
{
struct xim_inst_t *xim_inst;
int len;
- dpyinfo->xim = NULL;
xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t));
+ dpyinfo->xim_callback_data = xim_inst;
xim_inst->dpyinfo = dpyinfo;
len = strlen (resource_name);
xim_inst->resource_name = (char *) xmalloc (len + 1);
least, hence the configure test. */
(XRegisterIMInstantiateCallback_arg6) xim_inst);
#else /* not HAVE_X11R6_XIM */
- dpyinfo->xim = NULL;
xim_open_dpy (dpyinfo, resource_name);
#endif /* not HAVE_X11R6_XIM */
-
}
- else
#endif /* HAVE_XIM */
- dpyinfo->xim = NULL;
}
XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
NULL, EMACS_CLASS,
xim_instantiate_callback, NULL);
-#else /* not HAVE_X11R6_XIM */
- /* If we have X11R6 xim, this causes a double-free. */
+ xfree (dpyinfo->xim_callback_data->resource_name);
+ xfree (dpyinfo->xim_callback_data);
+#endif /* HAVE_X11R6_XIM */
if (dpyinfo->display)
XCloseIM (dpyinfo->xim);
-#endif /* HAVE_X11R6_XIM */
dpyinfo->xim = NULL;
XFree (dpyinfo->xim_styles);
}
if (f->output_data.x->black_relief.allocated_p)
unload_color (f, f->output_data.x->black_relief.pixel);
- if (FRAME_FACE_CACHE (f))
- free_frame_faces (f);
-
x_free_gcs (f);
XFlush (FRAME_X_DISPLAY (f));
}
terminal->name = (char *) xmalloc (SBYTES (display_name) + 1);
strncpy (terminal->name, SDATA (display_name), SBYTES (display_name));
terminal->name[SBYTES (display_name)] = 0;
-
+
#if 0
XSetAfterFunction (x_current_display, x_trace_wire);
#endif /* ! 0 */
dpyinfo->x_focus_frame = 0;
dpyinfo->x_focus_event_frame = 0;
dpyinfo->x_highlight_frame = 0;
- dpyinfo->terminal->image_cache = make_image_cache ();
dpyinfo->wm_type = X_WMTYPE_UNKNOWN;
/* See if we can construct pixel values from RGB values. */
connection = ConnectionNumber (dpyinfo->display);
dpyinfo->connection = connection;
- {
- char null_bits[1];
-
- null_bits[0] = 0x00;
-
- dpyinfo->null_pixel
- = XCreatePixmapFromBitmapData (dpyinfo->display, dpyinfo->root_window,
- null_bits, 1, 1, (long) 0, (long) 0,
- 1);
- }
-
{
extern int gray_bitmap_width, gray_bitmap_height;
extern char *gray_bitmap_bits;
#ifndef AIX /* On AIX, XCloseDisplay calls this. */
XrmDestroyDatabase (dpyinfo->xrdb);
#endif
-#endif
-#ifdef HAVE_X_I18N
- if (dpyinfo->xim)
- xim_close_dpy (dpyinfo);
#endif
xfree (dpyinfo->x_id_name);
+ xfree (dpyinfo->x_dnd_atoms);
xfree (dpyinfo->color_cells);
xfree (dpyinfo);
}
struct x_display_info *dpyinfo = terminal->display_info.x;
int i;
- /* Protect against recursive calls. Fdelete_frame in
+ /* Protect against recursive calls. delete_frame in
delete_terminal calls us back when it deletes our last frame. */
if (!terminal->name)
return;
BLOCK_INPUT;
+#ifdef HAVE_X_I18N
+ /* We must close our connection to the XIM server before closing the
+ X display. */
+ if (dpyinfo->xim)
+ xim_close_dpy (dpyinfo);
+#endif
+
/* If called from x_connection_closed, the display may already be closed
and dpyinfo->display was set to 0 to indicate that. */
if (dpyinfo->display)
x_create_terminal (struct x_display_info *dpyinfo)
{
struct terminal *terminal;
-
+
terminal = create_terminal ();
terminal->type = output_x_window;
dpyinfo->terminal = terminal;
/* kboard is initialized in x_term_init. */
-
+
terminal->clear_frame_hook = x_clear_frame;
terminal->ins_del_lines_hook = x_ins_del_lines;
terminal->delete_glyphs_hook = x_delete_glyphs;
terminal->delete_frame_hook = x_destroy_window;
terminal->delete_terminal_hook = x_delete_terminal;
-
+
terminal->rif = &x_redisplay_interface;
terminal->scroll_region_ok = 1; /* We'll scroll partial frames. */
terminal->char_ins_del_ok = 1;