Commit c90975f9 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

Fix initialization of user-defined fringe bitmaps in daemon mode

* src/fringe.c (gui_init_fringe): Rename from w32_init_fringe
or x_cr_init_fringe, and make unconditionally compiled; all
callers changed.  Do nothing if the frame's
redisplay_interface doesn't implement the define_fringe_bitmap
method.  Set up any user-defined fringe bitmaps in addition to
the standard bitmaps.
Suggested by Liam Quinlan <liamkquinlan@gmail.com> in
https://lists.gnu.org/archive/html/emacs-devel/2019-08/msg00259.html.

(w32_reset_fringes) [HAVE_NTGUI]: Do nothing if the frame's
redisplay_interface doesn't implement the
destroy_fringe_bitmap method.

* src/w32fns.c (Fx_create_frame): Call gui_init_fringe when
the first GUI frame is created for this session.
* src/dispextern.h (w32_init_fringe): Rename to
gui_init_fringe and make unconditional.
(x_cr_init_fringe): Remove prototype.
parent 2b329ed4
Pipeline #2821 failed with stage
in 57 minutes and 4 seconds
......@@ -3360,13 +3360,11 @@ void draw_row_fringe_bitmaps (struct window *, struct glyph_row *);
bool draw_window_fringes (struct window *, bool);
bool update_window_fringes (struct window *, bool);
void gui_init_fringe (struct redisplay_interface *);
#ifdef HAVE_NTGUI
void w32_init_fringe (struct redisplay_interface *);
void w32_reset_fringes (void);
#endif
#ifdef USE_CAIRO
void x_cr_init_fringe (struct redisplay_interface *);
#endif
extern unsigned row_hash (struct glyph_row *);
......
......@@ -1765,27 +1765,32 @@ init_fringe (void)
fringe_faces = xzalloc (max_fringe_bitmaps * sizeof *fringe_faces);
}
#if defined (HAVE_NTGUI) || defined (USE_CAIRO)
void
#ifdef HAVE_NTGUI
w32_init_fringe (struct redisplay_interface *rif)
#else
x_cr_init_fringe (struct redisplay_interface *rif)
#endif
gui_init_fringe (struct redisplay_interface *rif)
{
int bt;
if (!rif)
if (!rif || !rif->define_fringe_bitmap)
return;
/* Set up the standard fringe bitmaps. */
for (bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++)
{
struct fringe_bitmap *fb = &standard_bitmaps[bt];
rif->define_fringe_bitmap (bt, fb->bits, fb->height, fb->width);
}
/* Set up user-defined fringe bitmaps that might have been defined
before the frame of this kind was initialized. This can happen
if Emacs is started as a daemon and the init files define fringe
bitmaps. */
for ( ; bt < max_used_fringe_bitmap; bt++)
{
struct fringe_bitmap *fb = fringe_bitmaps[bt];
if (fb)
rif->define_fringe_bitmap (bt, fb->bits, fb->height, fb->width);
}
}
#endif
#ifdef HAVE_NTGUI
void
......@@ -1795,7 +1800,7 @@ w32_reset_fringes (void)
int bt;
struct redisplay_interface *rif = FRAME_RIF (SELECTED_FRAME ());
if (!rif)
if (!rif || !rif->destroy_fringe_bitmap)
return;
for (bt = NO_FRINGE_BITMAP + 1; bt < max_used_fringe_bitmap; bt++)
......
......@@ -5798,6 +5798,12 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
f->output_data.w32 = xzalloc (sizeof (struct w32_output));
FRAME_FONTSET (f) = -1;
/* Need to finish setting up of user-defined fringe bitmaps that
were defined before the first GUI frame was created (e.g., while
in daemon mode). */
if (!f->terminal->reference_count)
gui_init_fringe (f->terminal->rif);
fset_icon_name (f, gui_display_get_arg (dpyinfo,
parameters,
Qicon_name,
......
......@@ -7299,7 +7299,7 @@ w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
horizontally reflected compared to how they appear on X, so we
need to bitswap and convert to unsigned shorts before creating
the bitmaps. */
w32_init_fringe (terminal->rif);
gui_init_fringe (terminal->rif);
unblock_input ();
......
......@@ -13531,7 +13531,7 @@ x_initialize (void)
#endif
#ifdef USE_CAIRO
x_cr_init_fringe (&x_redisplay_interface);
gui_init_fringe (&x_redisplay_interface);
#endif
/* Note that there is no real way portable across R3/R4 to get the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment