aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2022-03-04 01:01:07 +0000
committerPo Lu2022-03-04 01:01:07 +0000
commit77483ac8819f982289fa0b448802291b4d83ae95 (patch)
tree7051e2dc4719ae4143ec7450397a6bb48e8ca367
parent18868de46340ce8a1b2c2a1d9d81364530509e98 (diff)
downloademacs-77483ac8819f982289fa0b448802291b4d83ae95.tar.gz
emacs-77483ac8819f982289fa0b448802291b4d83ae95.zip
Synchronize Haiku fringe bitmap code with X
* haikuterm.c (haiku_draw_fringe_bitmap): (haiku_define_fringe_bitmap): (haiku_destroy_fringe_bitmap): Synchronize logic with X.
-rw-r--r--src/haikuterm.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/haikuterm.c b/src/haikuterm.c
index bdba6403aca..833b3bee2a1 100644
--- a/src/haikuterm.c
+++ b/src/haikuterm.c
@@ -44,7 +44,7 @@ struct haiku_display_info *x_display_list = NULL;
44extern frame_parm_handler haiku_frame_parm_handlers[]; 44extern frame_parm_handler haiku_frame_parm_handlers[];
45 45
46static void **fringe_bmps; 46static void **fringe_bmps;
47static int fringe_bitmap_fillptr = 0; 47static int max_fringe_bmp = 0;
48 48
49static Lisp_Object rdb; 49static Lisp_Object rdb;
50 50
@@ -2326,10 +2326,24 @@ haiku_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
2326 BView_FillRectangle (view, p->bx, p->by, p->nx, p->ny); 2326 BView_FillRectangle (view, p->bx, p->by, p->nx, p->ny);
2327 } 2327 }
2328 2328
2329 if (p->which && p->which < fringe_bitmap_fillptr) 2329 if (p->which
2330 && p->which < max_fringe_bmp
2331 && p->which < max_used_fringe_bitmap)
2330 { 2332 {
2331 void *bitmap = fringe_bmps[p->which]; 2333 void *bitmap = fringe_bmps[p->which];
2332 2334
2335 if (!bitmap)
2336 {
2337 /* This fringe bitmap is known to fringe.c, but lacks the
2338 BBitmap which shadows that bitmap. This is typical to
2339 define-fringe-bitmap being called when the selected frame
2340 was not a GUI frame, for example, when packages that
2341 define fringe bitmaps are loaded by a daemon Emacs.
2342 Create the missing pattern now. */
2343 gui_define_fringe_bitmap (WINDOW_XFRAME (w), p->which);
2344 bitmap = fringe_bmps[p->which];
2345 }
2346
2333 uint32_t col; 2347 uint32_t col;
2334 2348
2335 if (!p->cursor_p) 2349 if (!p->cursor_p)
@@ -2357,14 +2371,14 @@ static void
2357haiku_define_fringe_bitmap (int which, unsigned short *bits, 2371haiku_define_fringe_bitmap (int which, unsigned short *bits,
2358 int h, int wd) 2372 int h, int wd)
2359{ 2373{
2360 if (which >= fringe_bitmap_fillptr) 2374 if (which >= max_fringe_bmp)
2361 { 2375 {
2362 int i = fringe_bitmap_fillptr; 2376 int i = max_fringe_bmp;
2363 fringe_bitmap_fillptr = which + 20; 2377 max_fringe_bmp = which + 20;
2364 fringe_bmps = !i ? xmalloc (fringe_bitmap_fillptr * sizeof (void *)) : 2378 fringe_bmps = !i ? xmalloc (max_fringe_bmp * sizeof (void *)) :
2365 xrealloc (fringe_bmps, fringe_bitmap_fillptr * sizeof (void *)); 2379 xrealloc (fringe_bmps, max_fringe_bmp * sizeof (void *));
2366 2380
2367 while (i < fringe_bitmap_fillptr) 2381 while (i < max_fringe_bmp)
2368 fringe_bmps[i++] = NULL; 2382 fringe_bmps[i++] = NULL;
2369 } 2383 }
2370 2384
@@ -2379,7 +2393,7 @@ haiku_define_fringe_bitmap (int which, unsigned short *bits,
2379static void 2393static void
2380haiku_destroy_fringe_bitmap (int which) 2394haiku_destroy_fringe_bitmap (int which)
2381{ 2395{
2382 if (which >= fringe_bitmap_fillptr) 2396 if (which >= max_fringe_bmp)
2383 return; 2397 return;
2384 2398
2385 if (fringe_bmps[which]) 2399 if (fringe_bmps[which])