void
record_event (char *locus, int type)
{
- if (event_record_index == sizeof (event_record) / sizeof (struct record))
+ if (event_record_index == ARRAYELTS (event_record))
event_record_index = 0;
event_record[event_record_index].locus = locus;
s->stippled_p = s->face->stipple != 0;
}
else
- {
- s->gc = s->face->gc;
- s->stippled_p = s->face->stipple != 0;
- }
+ emacs_abort ();
/* GC must have been set. */
eassert (s->gc != 0);
static short temp_buffer[100];
#define STORE_KEYSYM_FOR_DEBUG(keysym) \
- if (temp_index == sizeof temp_buffer / sizeof (short)) \
+ if (temp_index == ARRAYELTS (temp_buffer)) \
temp_index = 0; \
temp_buffer[temp_index++] = (keysym)
#ifdef USE_GTK
- if (xg_set_icon (f, xg_default_icon_file)
- || xg_set_icon_from_xpm_data (f, gnu_xpm_bits))
- return 0;
+ if (FRAME_DISPLAY_INFO (f)->icon_bitmap_id == -2
+ || xg_set_icon (f, xg_default_icon_file)
+ || xg_set_icon_from_xpm_data (f, gnu_xpm_bits))
+ {
+ FRAME_DISPLAY_INFO (f)->icon_bitmap_id = -2;
+ return 0;
+ }
#elif defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
compute_fringe_widths (f, 1);
+ /* Compute character columns occupied by scrollbar.
+
+ Don't do things differently for non-toolkit scrollbars
+ (Bug#17163). */
unit = FRAME_COLUMN_WIDTH (f);
-#ifdef USE_TOOLKIT_SCROLL_BARS
- /* The width of a toolkit scrollbar does not change with the new
- font but we have to calculate the number of columns it occupies
- anew. */
- FRAME_CONFIG_SCROLL_BAR_COLS (f)
- = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + unit - 1) / unit;
-#else
- /* The width of a non-toolkit scrollbar is at least 14 pixels and a
- multiple of the frame's character width. */
- FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit;
- FRAME_CONFIG_SCROLL_BAR_WIDTH (f)
- = FRAME_CONFIG_SCROLL_BAR_COLS (f) * unit;
-#endif
+ if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0)
+ FRAME_CONFIG_SCROLL_BAR_COLS (f)
+ = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + unit - 1) / unit;
+ else
+ FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit;
if (FRAME_X_WINDOW (f) != 0)
{
{
#ifdef HAVE_X11R6_XIM
struct xim_inst_t *xim_inst = dpyinfo->xim_callback_data;
-
+
if (dpyinfo->display)
{
Bool ret = XUnregisterIMInstantiateCallback
x_make_frame_visible (struct frame *f)
{
int original_top, original_left;
+ int tries = 0;
block_input ();
/* Force processing of queued events. */
x_sync (f);
- /* This hack is still in use at least for Cygwin. See
+ /* If on another desktop, the deiconify/map may be ignored and the
+ frame never becomes visible. XMonad does this.
+ Prevent an endless loop. */
+ if (FRAME_ICONIFIED_P (f) && ++tries > 100)
+ break;
+
+ /* This hack is still in use at least for Cygwin. See
http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00351.html.
Machines that do polling rather than SIGIO have been
};
int i;
- const int atom_count = sizeof (atom_refs) / sizeof (atom_refs[0]);
+ const int atom_count = ARRAYELTS (atom_refs);
/* 1 for _XSETTINGS_SN */
const int total_atom_count = 1 + atom_count;
Atom *atoms_return = xmalloc (total_atom_count * sizeof *atoms_return);
#ifdef USE_LUCID
{
+ XFontStruct *xfont = NULL;
XrmValue d, fr, to;
Font font;
x_catch_errors (dpy);
if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL))
emacs_abort ();
- if (x_had_errors_p (dpy) || !XQueryFont (dpy, font))
+ if (x_had_errors_p (dpy) || !((xfont = XQueryFont (dpy, font))))
XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15");
+ if (xfont)
+ XFreeFont (dpy, xfont);
x_uncatch_errors ();
}
#endif