aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2004-02-08 23:20:23 +0000
committerKim F. Storm2004-02-08 23:20:23 +0000
commit4fa0780f7039b2cceafe69867df2a9f36fc824f8 (patch)
tree1f1a7030cf5f56e04e9b3142ba453e0cd057d2f0 /src
parent288670f579e5caad6d49fcaec76f97da90adf4f4 (diff)
downloademacs-4fa0780f7039b2cceafe69867df2a9f36fc824f8.tar.gz
emacs-4fa0780f7039b2cceafe69867df2a9f36fc824f8.zip
(w32_draw_fringe_bitmap): Copy unadapted code from
xterm.c to handle overlayed fringe bitmaps and to use cursor color for displaying cursor in fringe. (w32_define_fringe_bitmap, w32_destroy_fringe_bitmap): New W32 specific functions to define and destroy fringe bitmaps in fringe_bmp. (w32_redisplay_interface): Add them to redisplay_interface. (w32_term_init): Call w32_init_fringe instead of explicitly defining fringe bitmaps in fringe_bmp array. (x_delete_display): Call w32_reset_fringes instead of explicitly destroying fringe bitmaps in fringe_bmp array.
Diffstat (limited to 'src')
-rw-r--r--src/w32term.c95
1 files changed, 60 insertions, 35 deletions
diff --git a/src/w32term.c b/src/w32term.c
index 13da811c819..239bc659f0b 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -698,13 +698,13 @@ w32_draw_fringe_bitmap (w, row, p)
698 else 698 else
699 w32_clip_to_row (w, row, hdc); 699 w32_clip_to_row (w, row, hdc);
700 700
701 if (p->bx >= 0) 701 if (p->bx >= 0 !p->overlay_p)
702 { 702 {
703 w32_fill_area (f, hdc, face->background, 703 w32_fill_area (f, hdc, face->background,
704 p->bx, p->by, p->nx, p->ny); 704 p->bx, p->by, p->nx, p->ny);
705 } 705 }
706 706
707 if (p->which != NO_FRINGE_BITMAP) 707 if (p->which)
708 { 708 {
709 HBITMAP pixmap = fringe_bmp[p->which]; 709 HBITMAP pixmap = fringe_bmp[p->which];
710 HDC compat_hdc; 710 HDC compat_hdc;
@@ -717,10 +717,38 @@ w32_draw_fringe_bitmap (w, row, p)
717 SetTextColor (hdc, face->background); 717 SetTextColor (hdc, face->background);
718 SetBkColor (hdc, face->foreground); 718 SetBkColor (hdc, face->foreground);
719 719
720#if 0 /* TODO: fringe overlay_p and cursor_p */
721 SetBkColor (hdc, (p->cursor_p
722 ? (p->overlay_p ? face->background
723 : f->output_data.w32->cursor_pixel)
724 : face->foreground));
725
726 if (p->overlay_p)
727 {
728 clipmask = XCreatePixmapFromBitmapData (display,
729 FRAME_X_DISPLAY_INFO (f)->root_window,
730 bits, p->wd, p->h,
731 1, 0, 1);
732 gcv.clip_mask = clipmask;
733 gcv.clip_x_origin = p->x;
734 gcv.clip_y_origin = p->y;
735 XChangeGC (display, gc, GCClipMask | GCClipXOrigin | GCClipYOrigin, &gcv);
736 }
737#endif
738
720 BitBlt (hdc, p->x, p->y, p->wd, p->h, 739 BitBlt (hdc, p->x, p->y, p->wd, p->h,
721 compat_hdc, 0, p->dh, 740 compat_hdc, 0, p->dh,
722 SRCCOPY); 741 SRCCOPY);
723 742
743#if 0 /* TODO: fringe overlay_p and cursor_p */
744 if (p->overlay_p)
745 {
746 gcv.clip_mask = (Pixmap) 0;
747 XChangeGC (display, gc, GCClipMask, &gcv);
748 XFreePixmap (display, clipmask);
749 }
750#endif
751
724 SelectObject (compat_hdc, horig_obj); 752 SelectObject (compat_hdc, horig_obj);
725 DeleteDC (compat_hdc); 753 DeleteDC (compat_hdc);
726 RestoreDC (hdc, -1); 754 RestoreDC (hdc, -1);
@@ -731,6 +759,32 @@ w32_draw_fringe_bitmap (w, row, p)
731 release_frame_dc (f, hdc); 759 release_frame_dc (f, hdc);
732} 760}
733 761
762static void
763w32_define_fringe_bitmap (which, bits, h, wd)
764 int which;
765 unsigned char *bits;
766 int h, wd;
767{
768 unsigned short *w32bits
769 = (unsigned short *)alloca (h * sizeof (unsigned short));
770 unsigned short *wb = w32bits;
771 int j;
772
773 for (j = 0; j < h; j++)
774 *wb++ = (unsigned short)*bits++;
775 fringe_bmp[which] = CreateBitmap (wd, h, 1, 1, w32bits);
776}
777
778static void
779w32_destroy_fringe_bitmap (which)
780 int which;
781{
782 if (fringe_bmp[which])
783 DeleteObject (fringe_bmp[which]);
784 fringe_bmp[which] = 0;
785}
786
787
734 788
735/* This is called when starting Emacs and when restarting after 789/* This is called when starting Emacs and when restarting after
736 suspend. When starting Emacs, no window is mapped. And nothing 790 suspend. When starting Emacs, no window is mapped. And nothing
@@ -6221,32 +6275,7 @@ w32_term_init (display_name, xrm_option, resource_name)
6221 horizontally reflected compared to how they appear on X, so we 6275 horizontally reflected compared to how they appear on X, so we
6222 need to bitswap and convert to unsigned shorts before creating 6276 need to bitswap and convert to unsigned shorts before creating
6223 the bitmaps. */ 6277 the bitmaps. */
6224 { 6278 w32_init_fringe ();
6225 int i, j;
6226
6227 for (i = NO_FRINGE_BITMAP + 1; i < MAX_FRINGE_BITMAPS; i++)
6228 {
6229 int h = fringe_bitmaps[i].height;
6230 int wd = fringe_bitmaps[i].width;
6231 unsigned short *w32bits
6232 = (unsigned short *)alloca (h * sizeof (unsigned short));
6233 unsigned short *wb = w32bits;
6234 unsigned char *bits = fringe_bitmaps[i].bits;
6235 for (j = 0; j < h; j++)
6236 {
6237 static unsigned char swap_nibble[16]
6238 = { 0x0, 0x8, 0x4, 0xc, /* 0000 1000 0100 1100 */
6239 0x2, 0xa, 0x6, 0xe, /* 0010 1010 0110 1110 */
6240 0x1, 0x9, 0x5, 0xd, /* 0001 1001 0101 1101 */
6241 0x3, 0xb, 0x7, 0xf }; /* 0011 1011 0111 1111 */
6242
6243 unsigned char b = *bits++;
6244 *wb++ = (unsigned short)((swap_nibble[b & 0xf]<<4)
6245 | (swap_nibble[(b>>4) & 0xf]));
6246 }
6247 fringe_bmp[i] = CreateBitmap (wd, h, 1, 1, w32bits);
6248 }
6249 }
6250 6279
6251#ifndef F_SETOWN_BUG 6280#ifndef F_SETOWN_BUG
6252#ifdef F_SETOWN 6281#ifdef F_SETOWN
@@ -6314,13 +6343,7 @@ x_delete_display (dpyinfo)
6314 xfree (dpyinfo->font_table); 6343 xfree (dpyinfo->font_table);
6315 xfree (dpyinfo->w32_id_name); 6344 xfree (dpyinfo->w32_id_name);
6316 6345
6317 /* Destroy row bitmaps. */ 6346 w32_reset_fringes ();
6318 {
6319 int i;
6320
6321 for (i = NO_FRINGE_BITMAP + 1; i < MAX_FRINGE_BITMAPS; i++)
6322 DeleteObject (fringe_bmp[i]);
6323 }
6324} 6347}
6325 6348
6326/* Set up use of W32. */ 6349/* Set up use of W32. */
@@ -6351,6 +6374,8 @@ static struct redisplay_interface w32_redisplay_interface =
6351 w32_get_glyph_overhangs, 6374 w32_get_glyph_overhangs,
6352 x_fix_overlapping_area, 6375 x_fix_overlapping_area,
6353 w32_draw_fringe_bitmap, 6376 w32_draw_fringe_bitmap,
6377 w32_define_fringe_bitmap,
6378 w32_destroy_fringe_bitmap,
6354 w32_per_char_metric, 6379 w32_per_char_metric,
6355 w32_encode_char, 6380 w32_encode_char,
6356 NULL, /* w32_compute_glyph_string_overhangs */ 6381 NULL, /* w32_compute_glyph_string_overhangs */