fd = openp (Vx_bitmap_file_path, file, "", &found, 0);
if (fd < 0)
return -1;
- /* XReadBitmapFile won't handle magic file names. */
- if (fd == 0)
- return -1;
emacs_close (fd);
filename = (char *) XSTRING (found)->data;
void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object));
};
+static void x_change_window_heights P_ ((Lisp_Object, int));
static void x_disable_image P_ ((struct frame *, struct image *));
static void x_create_im P_ ((struct frame *));
void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
if (x_defined_color (f, XSTRING (color_name)->data, &cdef, 1))
return cdef.pixel;
- return Fsignal (Qerror, Fcons (build_string ("Undefined color"),
- Fcons (color_name, Qnil)));
+ Fsignal (Qerror, Fcons (build_string ("Undefined color"),
+ Fcons (color_name, Qnil)));
+ return 0;
}
XColor fore_color, back_color;
fore_color.pixel = f->output_data.x->mouse_pixel;
+ x_query_color (f, &fore_color);
back_color.pixel = mask_color;
- XQueryColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f),
- &fore_color);
- XQueryColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f),
- &back_color);
+ x_query_color (f, &back_color);
+
XRecolorCursor (FRAME_X_DISPLAY (f), cursor,
&fore_color, &back_color);
XRecolorCursor (FRAME_X_DISPLAY (f), nontext_cursor,
XRecolorCursor (FRAME_X_DISPLAY (f), mode_cursor,
&fore_color, &back_color);
XRecolorCursor (FRAME_X_DISPLAY (f), cross_cursor,
- &fore_color, &back_color);
+ &fore_color, &back_color);
XRecolorCursor (FRAME_X_DISPLAY (f), busy_cursor,
&fore_color, &back_color);
}
else
Fmake_frame_visible (frame);
}
+
\f
+/* Change window heights in windows rooted in WINDOW by N lines. */
+
static void
-x_set_menu_bar_lines_1 (window, n)
+x_change_window_heights (window, n)
Lisp_Object window;
int n;
{
/* Handle just the top child in a vertical split. */
if (!NILP (w->vchild))
- x_set_menu_bar_lines_1 (w->vchild, n);
+ x_change_window_heights (w->vchild, n);
/* Adjust all children in a horizontal split. */
for (window = w->hchild; !NILP (window); window = w->next)
{
w = XWINDOW (window);
- x_set_menu_bar_lines_1 (window, n);
+ x_change_window_heights (window, n);
}
}
}
#else /* not USE_X_TOOLKIT */
FRAME_MENU_BAR_LINES (f) = nlines;
- x_set_menu_bar_lines_1 (f->root_window, nlines - olines);
+ x_change_window_heights (f->root_window, nlines - olines);
#endif /* not USE_X_TOOLKIT */
adjust_glyphs (f);
}
struct frame *f;
Lisp_Object value, oldval;
{
- int delta, nlines;
+ int delta, nlines, root_height;
+ Lisp_Object root_window;
/* Use VALUE only if an integer >= 0. */
if (INTEGERP (value) && XINT (value) >= 0)
++windows_or_buffers_changed;
delta = nlines - FRAME_TOOL_BAR_LINES (f);
+
+ /* Don't resize the tool-bar to more than we have room for. */
+ root_window = FRAME_ROOT_WINDOW (f);
+ root_height = XINT (XWINDOW (root_window)->height);
+ if (root_height - delta < 1)
+ {
+ delta = root_height - 1;
+ nlines = FRAME_TOOL_BAR_LINES (f) + delta;
+ }
+
FRAME_TOOL_BAR_LINES (f) = nlines;
- x_set_menu_bar_lines_1 (FRAME_ROOT_WINDOW (f), delta);
+ x_change_window_heights (root_window, delta);
adjust_glyphs (f);
+
+ /* We also have to make sure that the internal border at the top of
+ the frame, below the menu bar or tool bar, is redrawn when the
+ tool bar disappears. This is so because the internal border is
+ below the tool bar if one is displayed, but is below the menu bar
+ if there isn't a tool bar. The tool bar draws into the area
+ below the menu bar. */
+ if (FRAME_X_WINDOW (f) && FRAME_TOOL_BAR_LINES (f) == 0)
+ {
+ updating_frame = f;
+ clear_frame ();
+ clear_current_matrices (f);
+ updating_frame = NULL;
+ }
}
coding.mode |= CODING_MODE_LAST_BLOCK;
if (coding.type == coding_type_iso2022)
coding.flags |= CODING_FLAG_ISO_SAFE;
+ /* We suppress producing escape sequences for composition. */
+ coding.composing = COMPOSITION_DISABLED;
bufsize = encoding_buffer_size (&coding, bytes);
buf = (unsigned char *) xmalloc (bufsize);
encode_coding (&coding, str, buf, bytes, bufsize);
SET_FRAME_WIDTH (f, 0);
change_frame_size (f, height, width, 1, 0, 0);
- /* Set up faces after all frame parameters are known. */
- call1 (Qface_set_after_frame_default, frame);
-
#ifdef USE_X_TOOLKIT
/* Create the menu bar. */
if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
if (img->ascent == CENTERED_IMAGE_ASCENT)
{
if (face->font)
- ascent = height / 2 - (face->font->descent - face->font->ascent) / 2;
+ /* This expression is arranged so that if the image can't be
+ exactly centered, it will be moved slightly up. This is
+ because a typical font is `top-heavy' (due to the presence
+ uppercase letters), so the image placement should err towards
+ being top-heavy too. It also just generally looks better. */
+ ascent = (height + face->font->ascent - face->font->descent + 1) / 2;
else
ascent = height / 2;
}
/* Try to find FILE in data-directory, then x-bitmap-file-path. */
fd = openp (search_path, file, "", &file_found, 0);
- if (fd < 0)
+ if (fd == -1)
file_found = Qnil;
else
close (fd);
cmap = FRAME_X_COLORMAP (f);
color.pixel = pixel;
- XQueryColor (FRAME_X_DISPLAY (f), cmap, &color);
+ x_query_color (f, &color);
rc = x_alloc_nearest_color (f, cmap, &color);
if (rc)
p->pixel = XGetPixel (ximg, x, y);
if (rgb_p)
- XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f),
- row, img->width);
+ x_query_colors (f, row, img->width);
}
XDestroyImage (ximg);
PBM_ALGORITHM,
PBM_HEURISTIC_MASK,
PBM_MASK,
+ PBM_FOREGROUND,
+ PBM_BACKGROUND,
PBM_LAST
};
{":relief", IMAGE_INTEGER_VALUE, 0},
{":algorithm", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
{":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
- {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
+ {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ {":foreground", IMAGE_STRING_VALUE, 0},
+ {":background", IMAGE_STRING_VALUE, 0}
};
/* Structure describing the image type `pbm'. */
if (type == PBM_MONO)
{
int c = 0, g;
+ struct image_keyword fmt[PBM_LAST];
+ unsigned long fg = FRAME_FOREGROUND_PIXEL (f);
+ unsigned long bg = FRAME_BACKGROUND_PIXEL (f);
+
+ /* Parse the image specification. */
+ bcopy (pbm_format, fmt, sizeof fmt);
+ parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm);
+
+ /* Get foreground and background colors, maybe allocate colors. */
+ if (fmt[PBM_FOREGROUND].count)
+ fg = x_alloc_image_color (f, img, fmt[PBM_FOREGROUND].value, fg);
+ if (fmt[PBM_BACKGROUND].count)
+ bg = x_alloc_image_color (f, img, fmt[PBM_BACKGROUND].value, bg);
for (y = 0; y < height; ++y)
for (x = 0; x < width; ++x)
else
g = pbm_scan_number (&p, end);
- XPutPixel (ximg, x, y, (g
- ? FRAME_FOREGROUND_PIXEL (f)
- : FRAME_BACKGROUND_PIXEL (f)));
+ XPutPixel (ximg, x, y, g ? fg : bg);
}
}
else
cmap = FRAME_X_COLORMAP (f);
color.pixel = FRAME_BACKGROUND_PIXEL (f);
- XQueryColor (FRAME_X_DISPLAY (f), cmap, &color);
+ x_query_color (f, &color);
bzero (&frame_background, sizeof frame_background);
frame_background.red = color.red;
unsigned long mask;
BLOCK_INPUT;
- mask = CWBackPixel | CWOverrideRedirect | CWSaveUnder | CWEventMask;
+ mask = CWBackPixel | CWOverrideRedirect | CWEventMask;
+ if (DoesSaveUnders (dpyinfo->screen))
+ mask |= CWSaveUnder;
+
/* Window managers look at the override-redirect flag to determine
whether or net to give windows a decoration (Xlib spec, chapter
3.2.8). */
DX isn't specified). Likewise for the y-position; if a `top' frame\n\
parameter is specified, it determines the y-position of the tooltip\n\
window, otherwise it is displayed at the mouse position, with offset\n\
-DY added (default is -5).")
+DY added (default is -10).")
(string, frame, parms, timeout, dx, dy)
Lisp_Object string, frame, parms, timeout, dx, dy;
{
CHECK_NUMBER (dx, 5);
if (NILP (dy))
- dy = make_number (-5);
+ dy = make_number (-10);
else
CHECK_NUMBER (dy, 6);