extern FONT_TYPE *XOpenFont ();
static void flashback ();
+static void redraw_previous_char ();
#ifndef HAVE_X11
static void dumpqueue ();
of the frame being updated, so that the XT... functions do not
need to take a frame as argument. Most of the XT... functions
should never be called except during an update, the only exceptions
- being XTcursor_to, XTwrite_char and XTreassert_line_highlight. */
+ being XTcursor_to, XTwrite_glyphs and XTreassert_line_highlight. */
extern int mouse_track_top, mouse_track_left, mouse_track_width;
CHAR_TO_PIXEL_ROW (f, curs_y),
FONT_WIDTH (f->display.x->font) * (first_unused - curs_x),
FONT_HEIGHT (f->display.x->font), False);
-
+#if 0
+ redraw_previous_char (f, curs_x, curs_y);
+#endif
#else /* ! defined (HAVE_X11) */
XPixSet (FRAME_X_WINDOW (f),
CHAR_TO_PIXEL_COL (f, curs_x),
UNBLOCK_INPUT;
}
+/* Erase the character (if any) at the position just before X, Y in frame F,
+ then redraw it and the character before it.
+ This is necessary when we erase starting at X,
+ in case the character after X overlaps into the one before X. */
+
+static void
+redraw_previous_char (f, x, y)
+ FRAME_PTR f;
+ int x, y;
+{
+ /* Erase the character before the new ones, in case
+ what was here before overlaps it.
+ Reoutput that character, and the previous character
+ (in case the previous character overlaps it). */
+ if (x > 0)
+ {
+ int start_x = x - 2;
+ if (start_x < 0)
+ start_x = 0;
+ XClearArea (x_current_display, FRAME_X_WINDOW (f),
+ CHAR_TO_PIXEL_COL (f, x - 1),
+ CHAR_TO_PIXEL_ROW (f, y),
+ FONT_WIDTH (f->display.x->font),
+ FONT_HEIGHT (f->display.x->font), False);
+
+ dumpglyphs (f, CHAR_TO_PIXEL_COL (f, start_x),
+ CHAR_TO_PIXEL_ROW (f, y),
+ &FRAME_CURRENT_GLYPHS (f)->glyphs[y][start_x],
+ x - start_x, highlight);
+ }
+}
+
static
XTclear_frame ()
{
/* The window manager never makes a window invisible
("withdrawn"); all it does is switch between visible
and iconified. Frames get into the invisible state
- only through x_make_frame_invisible.
+ only through x_make_frame_invisible. */
if (FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f))
f->async_iconified = 1;
}
|| IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe */
|| IsFunctionKey (keysym) /* 0xffbe <= x < 0xffe1 */
|| x_is_vendor_fkey (orig_keysym))
- && ! IsModifierKey (orig_keysym)) /* wherever */
+ && ! (IsModifierKey (orig_keysym)
+#ifndef HAVE_X11R5
+#ifdef XK_Mode_switch
+ || ((unsigned)(orig_keysym) == XK_Mode_switch)
+#endif
+#ifdef XK_Num_Lock
+ || ((unsigned)(orig_keysym) == XK_Num_Lock)
+#endif
+#endif /* not HAVE_X11R5 */
+ ))
{
if (temp_index == sizeof temp_buffer / sizeof (short))
temp_index = 0;
#ifdef HAVE_X11
+struct font_info
+{
+ XFontStruct *font;
+ char *name;
+};
+
/* A table of all the fonts we have already loaded. */
-static XFontStruct **x_font_table;
+static struct font_info *x_font_table;
/* The current capacity of x_font_table. */
static int x_font_table_size;
/* Get a list of all the fonts that match this name. Once we
have a list of matching fonts, we compare them against the fonts
we already have by comparing font ids. */
- font_names = (char **) XListFontsWithInfo (x_current_display, fontname,
- 1024, &n_matching_fonts,
- &font_info);
+ font_names = (char **) XListFonts (x_current_display, fontname,
+ 1024, &n_matching_fonts);
/* Apparently it doesn't set n_matching_fonts to zero when it can't
find any matches; font_names == 0 is the only clue. */
if (! font_names)
for (i = 0; i < n_fonts; i++)
for (j = 0; j < n_matching_fonts; j++)
- if (x_font_table[i]->fid == font_info[j].fid)
+ if (!strcmp (x_font_table[i].name, font_names[j]))
{
already_loaded = i;
fontname = font_names[j];
found_font:
/* If we have, just return it from the table. */
- if (already_loaded > 0)
- f->display.x->font = x_font_table[already_loaded];
+ if (already_loaded >= 0)
+ f->display.x->font = x_font_table[already_loaded].font;
/* Otherwise, load the font and add it to the table. */
else
font = (XFontStruct *) XLoadQueryFont (x_current_display, fontname);
if (! font)
{
- /* Free the information from XListFontsWithInfo. */
+ /* Free the information from XListFonts. */
if (n_matching_fonts)
- XFreeFontInfo (font_names, font_info, n_matching_fonts);
+ XFreeFontNames (font_names);
return Qnil;
}
{
x_font_table_size = 16;
x_font_table
- = (XFontStruct **) xmalloc (x_font_table_size
- * sizeof (x_font_table[0]));
+ = (struct font_info *) xmalloc (x_font_table_size
+ * sizeof (x_font_table[0]));
}
/* Do we need to grow the table? */
else if (n_fonts >= x_font_table_size)
{
x_font_table_size *= 2;
x_font_table
- = (XFontStruct **) xrealloc (x_font_table,
- (x_font_table_size
- * sizeof (x_font_table[0])));
+ = (struct font_info *) xrealloc (x_font_table,
+ (x_font_table_size
+ * sizeof (x_font_table[0])));
}
- f->display.x->font = x_font_table[n_fonts++] = font;
+ x_font_table[n_fonts].name = (char *) xmalloc (strlen (fontname));
+ bcopy (fontname, x_font_table[n_fonts].name, strlen (fontname) + 1);
+ f->display.x->font = x_font_table[n_fonts++].font = font;
}
-
+
/* Now make the frame display the given font. */
if (FRAME_X_WINDOW (f) != 0)
{
Lisp_Object lispy_name = build_string (fontname);
- /* Free the information from XListFontsWithInfo. The data
+ /* Free the information from XListFonts. The data
we actually retain comes from XLoadQueryFont. */
- XFreeFontInfo (font_names, font_info, n_matching_fonts);
+ XFreeFontNames (font_names);
return lispy_name;
}
IconicState. */
x_wm_set_window_state (f, IconicState);
+ if (!FRAME_VISIBLE_P (f))
+ {
+ /* If the frame was withdrawn, before, we must map it. */
+ XMapWindow (XDISPLAY FRAME_X_WINDOW (f));
+ if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
+ XMapSubwindows (x_current_display, FRAME_X_WINDOW (f));
+ }
+
f->async_iconified = 1;
#else /* ! defined (HAVE_X11) */
XUnmapWindow (XDISPLAY FRAME_X_WINDOW (f));
{
Lisp_Object frame;
char *defaultvalue;
+#ifndef F_SETOWN_BUG
#ifdef F_SETOWN
extern int old_fcntl_owner;
#endif /* ! defined (F_SETOWN) */
+#endif /* F_SETOWN_BUG */
x_focus_frame = x_highlight_frame = 0;
x_current_display = XOpenDisplay (display_name);
if (x_current_display == 0)
- fatal ("X server %s not responding; check the DISPLAY environment variable or use \"-d\"\n",
+ fatal ("X server %s not responding.\n\
+Check the DISPLAY environment variable or use \"-d\"\n",
display_name);
#ifdef HAVE_X11
#endif /* ! defined (HAVE_X11) */
+#ifndef F_SETOWN_BUG
#ifdef F_SETOWN
old_fcntl_owner = fcntl (0, F_GETOWN, 0);
#ifdef F_SETOWN_SOCK_NEG
fcntl (0, F_SETOWN, getpid ());
#endif /* ! defined (F_SETOWN_SOCK_NEG) */
#endif /* ! defined (F_SETOWN) */
+#endif /* F_SETOWN_BUG */
#ifdef SIGIO
init_sigio ();
#endif /* ! defined (SIGIO) */
- /* Must use interrupt input because we cannot otherwise
- arrange for C-g to be noticed immediately.
- We cannot connect it to SIGINT. */
- Fset_input_mode (Qt, Qnil, Qt, Qnil);
-
expose_all_windows = 0;
clear_frame_hook = XTclear_frame;
off the bottom */
baud_rate = 19200;
+ /* Try to use interrupt input; if we can't, then start polling. */
+ Fset_input_mode (Qt, Qnil, Qt, Qnil);
+
/* Note that there is no real way portable across R3/R4 to get the
original error handler. */
XHandleError (x_error_quitter);