static struct glyph *x_y_to_hpos_vpos P_ ((struct window *, int, int,
int *, int *, int *));
static void note_mode_line_highlight P_ ((struct window *, int, int));
-static void x_check_font P_ ((struct frame *, XFontStruct *));
static void note_mouse_highlight P_ ((struct frame *, int, int));
static void note_tool_bar_highlight P_ ((struct frame *f, int, int));
static void x_handle_tool_bar_click P_ ((struct frame *, XButtonEvent *));
}
return ((pcm == NULL
- || pcm->width == 0 && (pcm->rbearing - pcm->lbearing) == 0)
+ || (pcm->width == 0 && (pcm->rbearing - pcm->lbearing) == 0))
? NULL : pcm);
}
struct it *it;
{
/* (space :width WIDTH :height HEIGHT. */
- extern Lisp_Object QCwidth, QCheight, QCascent, Qspace;
+#if GLYPH_DEBUG
+ extern Lisp_Object Qspace;
+#endif
+ extern Lisp_Object QCwidth, QCheight, QCascent;
extern Lisp_Object QCrelative_width, QCrelative_height;
extern Lisp_Object QCalign_to;
Lisp_Object prop, plist;
else if (it->what == IT_STRETCH)
x_produce_stretch_glyph (it);
- /* Accumulate dimensions. */
- xassert (it->ascent >= 0 && it->descent > 0);
+ /* Accumulate dimensions. Note: can't assume that it->descent > 0
+ because this isn't true for images with `:ascent 100'. */
+ xassert (it->ascent >= 0 && it->descent >= 0);
if (it->area == TEXT_AREA)
it->current_x += it->pixel_width;
static void x_fix_overlapping_area P_ ((struct window *, struct glyph_row *,
enum glyph_row_area));
+#if GLYPH_DEBUG
+static void x_check_font P_ ((struct frame *, XFontStruct *));
+#endif
+
/* Append the list of glyph strings with head H and tail T to the list
with head *HEAD and tail *TAIL. Set *HEAD and *TAIL to the result. */
struct frame *f;
int *left, *right;
{
- int c;
-
*left = *right = 0;
if (glyph->type == CHAR_GLYPH)
#ifdef USE_X_TOOLKIT
-/* Allocate the color COLOR->pixel on the screen and display of
- widget WIDGET in colormap CMAP. If an exact match cannot be
- allocated, try the nearest color available. Value is non-zero
- if successful. This is called from lwlib. */
+static struct frame *x_frame_of_widget P_ ((Widget));
-int
-x_alloc_nearest_color_for_widget (widget, cmap, color)
+
+/* Return the frame on which widget WIDGET is used.. Abort if frame
+ cannot be determined. */
+
+struct frame *
+x_frame_of_widget (widget)
Widget widget;
- Colormap cmap;
- XColor *color;
{
- struct frame *f;
struct x_display_info *dpyinfo;
Lisp_Object tail;
-
+ struct frame *f;
+
dpyinfo = x_display_info_for_display (XtDisplay (widget));
/* Find the top-level shell of the widget. Note that this function
(f->output_data.nothing != 1
&& FRAME_X_DISPLAY_INFO (f) == dpyinfo))
&& f->output_data.x->widget == widget)
- return x_alloc_nearest_color (f, cmap, color);
+ return f;
abort ();
}
+
+/* Allocate the color COLOR->pixel on the screen and display of
+ widget WIDGET in colormap CMAP. If an exact match cannot be
+ allocated, try the nearest color available. Value is non-zero
+ if successful. This is called from lwlib. */
+
+int
+x_alloc_nearest_color_for_widget (widget, cmap, color)
+ Widget widget;
+ Colormap cmap;
+ XColor *color;
+{
+ struct frame *f = x_frame_of_widget (widget);
+ return x_alloc_nearest_color (f, cmap, color);
+}
+
+
#endif /* USE_X_TOOLKIT */
}
+/* Allocate color PIXEL on display DPY. PIXEL must already be allocated.
+ It's necessary to do this instead of just using PIXEL directly to
+ get color reference counts right. */
+
+unsigned long
+x_copy_dpy_color (dpy, cmap, pixel)
+ Display *dpy;
+ Colormap cmap;
+ unsigned long pixel;
+{
+ XColor color;
+
+ color.pixel = pixel;
+ BLOCK_INPUT;
+ XQueryColor (dpy, cmap, &color);
+ XAllocColor (dpy, cmap, &color);
+ UNBLOCK_INPUT;
+#ifdef DEBUG_X_COLORS
+ register_color (pixel);
+#endif
+ return color.pixel;
+}
+
+
/* Allocate a color which is lighter or darker than *PIXEL by FACTOR
or DELTA. Try a color with RGB values multiplied by FACTOR first.
If this produces the same color as PIXEL, try a color where all RGB
if (relief->gc
&& relief->allocated_p)
{
- /* If display has an immutable color map, freeing colors is not
- necessary and some servers don't allow it. So don't do it. */
x_free_colors (f, &relief->pixel, 1);
relief->allocated_p = 0;
}
#define BUILD_CHAR_GLYPH_STRINGS(W, ROW, AREA, START, END, HEAD, TAIL, HL, X, LAST_X, OVERLAPS_P) \
do \
{ \
- int c, charset, face_id; \
+ int c, face_id; \
XChar2b *char2b; \
\
c = (ROW)->glyphs[AREA][START].u.ch; \
int *hpos, *vpos, *area;
{
struct glyph *glyph, *end;
- struct glyph_row *row;
+ struct glyph_row *row = NULL;
int x0, i, left_area_width;
/* Find row containing Y. Give up if some row is not enabled. */
ev->display = FRAME_X_DISPLAY (f);
ev->window = FRAME_X_WINDOW (f);
ev->format = 32;
- ev->data.l[0] = (long) window;
+ ev->data.l[0] = (long) XFASTINT (window);
ev->data.l[1] = (long) part;
ev->data.l[2] = (long) 0;
ev->data.l[3] = (long) portion;
struct input_event *ievent;
{
XClientMessageEvent *ev = (XClientMessageEvent *) event;
- Lisp_Object window = (Lisp_Object) ev->data.l[0];
- struct frame *f = XFRAME (XWINDOW (window)->frame);
+ Lisp_Object window;
+ struct frame *f;
+
+ XSETFASTINT (window, ev->data.l[0]);
+ f = XFRAME (XWINDOW (window)->frame);
ievent->kind = scroll_bar_click;
ievent->frame_or_window = window;
{
#ifdef HAVE_XAW3D
ScrollbarWidget sb = (ScrollbarWidget) widget;
- int scroll_mode;
+ int scroll_mode = 0;
/* `scroll_mode' only exists with Xaw3d + ARROW_SCROLLBAR. */
if (xaw3d_arrow_scroll)
if (status_return == XLookupNone)
break;
else if (status_return == XLookupChars)
- keysym = NoSymbol;
+ {
+ keysym = NoSymbol;
+ modifiers = 0;
+ }
else if (status_return != XLookupKeySym
&& status_return != XLookupBoth)
abort ();
if (event.xfocus.detail != NotifyPointer)
dpyinfo->x_focus_event_frame = f;
if (f)
- x_new_focus_frame (dpyinfo, f);
+ {
+ x_new_focus_frame (dpyinfo, f);
+
+ /* Don't stop displaying the initial startup message
+ for a switch-frame event we don't need. */
+ if (GC_NILP (Vterminal_frame)
+ && GC_CONSP (Vframe_list)
+ && !GC_NILP (XCDR (Vframe_list)))
+ {
+ bufp->kind = FOCUS_IN_EVENT;
+ XSETFRAME (bufp->frame_or_window, f);
+ ++bufp, ++count, --numchars;
+ }
+ }
#ifdef HAVE_X_I18N
if (f && FRAME_XIC (f))
#endif
#endif
- dpyinfo->display = 0;
+ if (dpyinfo)
+ dpyinfo->display = 0;
/* First delete frames whose mini-buffers are on frames
that are on the dead display. */
{
int fontset = fs_query_fontset (build_string (fontsetname), 0);
Lisp_Object result;
- char *fontname;
if (fontset < 0)
return Qnil;
/* It could be confusing if a real alarm arrives while
processing the fake one. Turn it off and let the
handler reset it. */
+ extern void poll_for_input_1 P_ ((void));
int old_poll_suppress_count = poll_suppress_count;
poll_suppress_count = 1;
poll_for_input_1 ();
free_frame_menubar (f);
#endif /* USE_X_TOOLKIT */
+ unload_color (f, f->output_data.x->foreground_pixel);
+ unload_color (f, f->output_data.x->background_pixel);
+ unload_color (f, f->output_data.x->cursor_pixel);
+ 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->scroll_bar_foreground_pixel);
+ if (f->output_data.x->white_relief.allocated_p)
+ 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);
+
free_frame_faces (f);
XFlush (FRAME_X_DISPLAY (f));
}
for (; CONSP (patterns); patterns = XCDR (patterns))
{
int num_fonts;
- char **names;
+ char **names = NULL;
pattern = XCAR (patterns);
/* See if we cached the result for this particular query.