static void x_produce_image_glyph P_ ((struct it *it));
-/* Return a pointer to per-char metric information in FONT of a
- character pointed by B which is a pointer to an XChar2b. */
-
-#define PER_CHAR_METRIC(font, b) \
- ((font)->per_char \
- ? ((font)->per_char + (b)->byte2 - (font)->min_char_or_byte2 \
- + (((font)->min_byte1 || (font)->max_byte1) \
- ? (((b)->byte1 - (font)->min_byte1) \
- * ((font)->max_char_or_byte2 - (font)->min_char_or_byte2 + 1)) \
- : 0)) \
- : &((font)->max_bounds))
-
-
/* Get metrics of character CHAR2B in FONT. Value is null if CHAR2B
is not contained in the font. */
cmp->font = (void *) font;
/* Initialize the bounding box. */
- pcm = x_per_char_metric (font, &char2b);
- if (pcm)
+ if (font_info
+ && (pcm = x_per_char_metric (font, &char2b)))
{
width = pcm->width;
ascent = pcm->ascent;
boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
}
- pcm = x_per_char_metric (font, &char2b);
- if (pcm)
+ if (font_info
+ && (pcm = x_per_char_metric (font, &char2b)))
{
width = pcm->width;
ascent = pcm->ascent;
else
{
width = FONT_WIDTH (font);
- ascent = font->ascent;
- descent = font->descent;
+ ascent = 1;
+ descent = 0;
}
if (cmp->method != COMPOSITION_WITH_RULE_ALTCHARS)
XRectangle *r;
enum glyph_row_area area;
{
- int x;
struct glyph *first = row->glyphs[area];
struct glyph *end = row->glyphs[area] + row->used[area];
struct glyph *last;
- int first_x;
-
- /* Set x to the window-relative start position for drawing glyphs of
- AREA. The first glyph of the text area can be partially visible.
- The first glyphs of other areas cannot. */
- if (area == LEFT_MARGIN_AREA)
- x = 0;
- else if (area == TEXT_AREA)
- x = row->x + window_box_width (w, LEFT_MARGIN_AREA);
- else
- x = (window_box_width (w, LEFT_MARGIN_AREA)
- + window_box_width (w, TEXT_AREA));
+ int first_x, start_x, x;
if (area == TEXT_AREA && row->fill_line_p)
/* If row extends face to end of line write the whole line. */
- x_draw_glyphs (w, x, row, area,
+ x_draw_glyphs (w, 0, row, area,
0, row->used[area],
row->inverse_p ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT,
NULL, NULL, 0);
else
{
+ /* Set START_X to the window-relative start position for drawing glyphs of
+ AREA. The first glyph of the text area can be partially visible.
+ The first glyphs of other areas cannot. */
+ if (area == LEFT_MARGIN_AREA)
+ start_x = 0;
+ else if (area == TEXT_AREA)
+ start_x = row->x + window_box_width (w, LEFT_MARGIN_AREA);
+ else
+ start_x = (window_box_width (w, LEFT_MARGIN_AREA)
+ + window_box_width (w, TEXT_AREA));
+ x = start_x;
+
/* Find the first glyph that must be redrawn. */
while (first < end
&& x + first->pixel_width < r->x)
/* Repaint. */
if (last > first)
- x_draw_glyphs (w, first_x, row, area,
+ x_draw_glyphs (w, first_x - start_x, row, area,
first - row->glyphs[area],
last - row->glyphs[area],
row->inverse_p ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT,
happen when toolkit scroll bars are used and a window is split.
Reconfiguring the scroll bar will generate an expose for a newly
created window. */
- if (w->current_matrix == NULL)
+ if (w->current_matrix == NULL || w == updated_window)
return;
TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n",
clear_mouse_face (dpyinfo)
struct x_display_info *dpyinfo;
{
- if (tip_frame)
+ if (!NILP (tip_frame))
return;
if (! NILP (dpyinfo->mouse_face_window))
struct x_display_info *dpyinfo = x_display_info_for_display (display);
Lisp_Object frame, tail;
- /* Indicate that this display is dead. */
+ /* We have to close the display to inform Xt that it doesn't
+ exist anymore. If we don't, Xt will continue to wait for
+ events from the display. As a consequence, a sequence of
+
+ M-x make-frame-on-display RET :1 RET
+ ...kill the new frame, so that we get an IO error...
+ M-x make-frame-on-display RET :1 RET
-#if 0 /* Closing the display caused a bus error on OpenWindows. */
+ will indefinitely wait in Xt for events for display `:1', opened
+ in the first class to make-frame-on-display.
+
+ Closing the display is reported to lead to a bus error on
+ OpenWindows in certain situations. I suspect that is a bug
+ in OpenWindows. I don't know how to cicumvent it here. */
+
#ifdef USE_X_TOOLKIT
XtCloseDisplay (display);
-#endif
#endif
+ /* Indicate that this display is dead. */
if (dpyinfo)
dpyinfo->display = 0;
{
#ifdef USE_XIM
#ifdef HAVE_X11R6_XIM
- XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
- NULL, EMACS_CLASS,
- xim_instantiate_callback, NULL);
+ if (dpyinfo->display)
+ XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
+ NULL, EMACS_CLASS,
+ xim_instantiate_callback, NULL);
#endif /* not HAVE_X11R6_XIM */
- XCloseIM (dpyinfo->xim);
+ if (dpyinfo->display)
+ XCloseIM (dpyinfo->xim);
dpyinfo->xim = NULL;
XFree (dpyinfo->xim_styles);
#endif /* USE_XIM */
- PIXEL_WIDTH (f)
+ f->output_data.x->left_pos);
- if (flags & YNegative)
- {
- int menubar_height = 0;
+ {
+ int height = PIXEL_HEIGHT (f);
-#ifdef USE_X_TOOLKIT
- if (f->output_data.x->menubar_widget)
- menubar_height
- = (f->output_data.x->menubar_widget->core.height
- + f->output_data.x->menubar_widget->core.border_width);
+#if defined USE_X_TOOLKIT && defined USE_MOTIF
+ /* Something is fishy here. When using Motif, starting Emacs with
+ `-g -0-0', the frame appears too low by a few pixels.
+
+ This seems to be so because initially, while Emacs is starting,
+ the column widget's height and the frame's pixel height are
+ different. The column widget's height is the right one. In
+ later invocations, when Emacs is up, the frame's pixel height
+ is right, though.
+
+ It's not obvious where the initial small difference comes from.
+ 2000-12-01, gerd. */
+
+ XtVaGetValues (f->output_data.x->column_widget, XtNheight, &height, NULL);
#endif
-
- f->output_data.x->top_pos = (FRAME_X_DISPLAY_INFO (f)->height
- - 2 * f->output_data.x->border_width
- - win_y
- - PIXEL_HEIGHT (f)
- - menubar_height
- + f->output_data.x->top_pos);
- }
+ if (flags & YNegative)
+ f->output_data.x->top_pos = (FRAME_X_DISPLAY_INFO (f)->height
+ - 2 * f->output_data.x->border_width
+ - win_y
+ - height
+ + f->output_data.x->top_pos);
+ }
+
/* The left_pos and top_pos
are now relative to the top and left screen edges,
so the flags should correspond. */
UNBLOCK_INPUT;
#endif /* not USE_X_TOOLKIT */
}
+
\f
-/* Destroy the X window of frame F. */
+/* Free X resources of frame F. */
void
-x_destroy_window (f)
+x_free_frame_resources (f)
struct frame *f;
{
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
/* If a display connection is dead, don't try sending more
commands to the X server. */
- if (dpyinfo->display != 0)
+ if (dpyinfo->display)
{
- if (f->output_data.x->icon_desc != 0)
+ if (f->output_data.x->icon_desc)
XDestroyWindow (FRAME_X_DISPLAY (f), f->output_data.x->icon_desc);
+
#ifdef HAVE_X_I18N
if (FRAME_XIC (f))
free_frame_xic (f);
#endif
- XDestroyWindow (FRAME_X_DISPLAY (f), f->output_data.x->window_desc);
+
+ if (FRAME_X_WINDOW (f))
+ XDestroyWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
+
#ifdef USE_X_TOOLKIT
if (f->output_data.x->widget)
XtDestroyWidget (f->output_data.x->widget);
unload_color (f, f->output_data.x->cursor_foreground_pixel);
unload_color (f, f->output_data.x->border_pixel);
unload_color (f, f->output_data.x->mouse_pixel);
+
if (f->output_data.x->scroll_bar_background_pixel != -1)
unload_color (f, f->output_data.x->scroll_bar_background_pixel);
if (f->output_data.x->scroll_bar_foreground_pixel != -1)
unload_color (f, f->output_data.x->white_relief.pixel);
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);
- free_frame_faces (f);
+ x_free_gcs (f);
XFlush (FRAME_X_DISPLAY (f));
}
xfree (f->output_data.x->saved_menu_event);
xfree (f->output_data.x);
- f->output_data.x = 0;
+ f->output_data.x = NULL;
+
if (f == dpyinfo->x_focus_frame)
dpyinfo->x_focus_frame = 0;
if (f == dpyinfo->x_focus_event_frame)
if (f == dpyinfo->x_highlight_frame)
dpyinfo->x_highlight_frame = 0;
- dpyinfo->reference_count--;
-
if (f == dpyinfo->mouse_face_mouse_frame)
{
dpyinfo->mouse_face_beg_row
UNBLOCK_INPUT;
}
+
+
+/* Destroy the X window of frame F. */
+
+void
+x_destroy_window (f)
+ struct frame *f;
+{
+ struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+
+ /* If a display connection is dead, don't try sending more
+ commands to the X server. */
+ if (dpyinfo->display != 0)
+ x_free_frame_resources (f);
+
+ dpyinfo->reference_count--;
+}
+
\f
/* Setting window manager hints. */
fontp->size = font->max_bounds.width;
fontp->height = FONT_HEIGHT (font);
- {
- /* For some font, ascent and descent in max_bounds field is
- larger than the above value. */
- int max_height = font->max_bounds.ascent + font->max_bounds.descent;
- if (max_height > fontp->height)
- fontp->height = max_height;
- }
if (NILP (font_names))
{
{
extern int gray_bitmap_width, gray_bitmap_height;
- extern unsigned char *gray_bitmap_bits;
+ extern char *gray_bitmap_bits;
dpyinfo->gray
= XCreatePixmapFromBitmapData (dpyinfo->display, dpyinfo->root_window,
gray_bitmap_bits,