commit 8f2a81510548d9ccce691c908eb9ca13414ea45c (HEAD, refs/remotes/origin/master) Author: Michael Hendricks Date: Sat May 5 12:41:43 2018 +0300 Include narrowing indication in describe-mode * lisp/help.el (describe-mode): Include "Narrow", if narrowing is active. (Bug#31139) Copyright-paperwork-exempt: yes diff --git a/lisp/help.el b/lisp/help.el index 8e6604d2db..844087a72f 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -908,6 +908,10 @@ documentation for the major and minor modes of that buffer." (push (list fmode pretty-minor-mode (format-mode-line (assq mode minor-mode-alist))) minor-modes))))) + ;; Narrowing is not a minor mode, but its indicator is part of + ;; mode-line-modes. + (when (buffer-narrowed-p) + (push '(narrow-to-region "Narrow" " Narrow") minor-modes)) (setq minor-modes (sort minor-modes (lambda (a b) (string-lessp (cadr a) (cadr b))))) commit 2d0eff42b8f1122e00f948759ed01a3be1a8c3fc Author: Ari Roponen Date: Fri Apr 27 15:13:12 2018 +0300 Fix some problems in the Cairo build * src/xterm.c (x_begin_cr_clip): Create image surface. (x_update_end) [USE_CAIRO]: Remove GTK3-specific code. (x_scroll_run) [USE_CAIRO]: Implement scrolling. * src/image.c (lookup_rgb_color) [USE_CAIRO]: Support Cairo. (jpeg_load_body) [USE_CAIRO]: Support Cairo. Use USE_CAIRO instead of CAIRO for #ifdef's. (imagemagick_load_image) [USE_CAIRO]: Support Cairo. (Bug#31288) diff --git a/src/image.c b/src/image.c index 37416c1616..4d5a1bf5e6 100644 --- a/src/image.c +++ b/src/image.c @@ -4629,6 +4629,8 @@ lookup_rgb_color (struct frame *f, int r, int g, int b) return PALETTERGB (r >> 8, g >> 8, b >> 8); #elif defined HAVE_NS return RGB_TO_ULONG (r >> 8, g >> 8, b >> 8); +#elif defined USE_CAIRO + return (0xffu << 24) | (r << 16) | (g << 8) | b; #else xsignal1 (Qfile_error, build_string ("This Emacs mishandles this image file type")); @@ -6702,10 +6704,10 @@ jpeg_load_body (struct frame *f, struct image *img, FILE *volatile fp = NULL; JSAMPARRAY buffer; int row_stride, x, y; - unsigned long *colors; int width, height; int i, ir, ig, ib; #ifndef USE_CAIRO + unsigned long *colors; XImagePtr ximg = NULL; #endif @@ -6823,7 +6825,7 @@ jpeg_load_body (struct frame *f, struct image *img, else ir = 0, ig = 0, ib = 0; -#ifndef CAIRO +#ifndef USE_CAIRO /* Use the color table mechanism because it handles colors that cannot be allocated nicely. Such colors will be replaced with a default color, and we don't have to care about which colors @@ -8537,7 +8539,9 @@ imagemagick_load_image (struct frame *f, struct image *img, int width, height; size_t image_width, image_height; MagickBooleanType status; +#ifndef USE_CAIRO XImagePtr ximg; +#endif int x, y; MagickWand *image_wand; PixelIterator *iterator; @@ -8551,6 +8555,9 @@ imagemagick_load_image (struct frame *f, struct image *img, double rotation; char hint_buffer[MaxTextExtent]; char *filename_hint = NULL; +#ifdef USE_CAIRO + void *data = NULL; +#endif /* Initialize the ImageMagick environment. */ static bool imagemagick_initialized; @@ -8759,6 +8766,12 @@ imagemagick_load_image (struct frame *f, struct image *img, /* Magicexportimage is normally faster than pixelpushing. This method is also well tested. Some aspects of this method are ad-hoc and needs to be more researched. */ + void *dataptr; +#ifdef USE_CAIRO + data = xmalloc (width * height * 4); + const char *exportdepth = "BGRA"; + dataptr = data; +#else int imagedepth = 24; /*MagickGetImageDepth(image_wand);*/ const char *exportdepth = imagedepth <= 8 ? "I" : "BGRP"; /*"RGBP";*/ /* Try to create a x pixmap to hold the imagemagick pixmap. */ @@ -8771,6 +8784,8 @@ imagemagick_load_image (struct frame *f, struct image *img, image_error ("Imagemagick X bitmap allocation failure"); goto imagemagick_error; } + dataptr = ximg->data; +#endif /* not USE_CAIRO */ /* Oddly, the below code doesn't seem to work:*/ /* switch(ximg->bitmap_unit){ */ @@ -8793,14 +8808,17 @@ imagemagick_load_image (struct frame *f, struct image *img, */ int pixelwidth = CharPixel; /*??? TODO figure out*/ MagickExportImagePixels (image_wand, 0, 0, width, height, - exportdepth, pixelwidth, ximg->data); + exportdepth, pixelwidth, dataptr); } else #endif /* HAVE_MAGICKEXPORTIMAGEPIXELS */ { size_t image_height; MagickRealType color_scale = 65535.0 / QuantumRange; - +#ifdef USE_CAIRO + data = xmalloc (width * height * 4); + color_scale /= 256; +#else /* Try to create a x pixmap to hold the imagemagick pixmap. */ if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0)) @@ -8811,6 +8829,7 @@ imagemagick_load_image (struct frame *f, struct image *img, image_error ("Imagemagick X bitmap allocation failure"); goto imagemagick_error; } +#endif /* Copy imagemagick image to x with primitive yet robust pixel pusher loop. This has been tested a lot with many different @@ -8823,7 +8842,9 @@ imagemagick_load_image (struct frame *f, struct image *img, #ifdef COLOR_TABLE_SUPPORT free_color_table (); #endif +#ifndef USE_CAIRO x_destroy_x_image (ximg); +#endif image_error ("Imagemagick pixel iterator creation failed"); goto imagemagick_error; } @@ -8839,16 +8860,27 @@ imagemagick_load_image (struct frame *f, struct image *img, for (x = 0; x < xlim; x++) { PixelGetMagickColor (pixels[x], &pixel); +#ifdef USE_CAIRO + ((uint32_t *)data)[width * y + x] = + lookup_rgb_color (f, + color_scale * pixel.red, + color_scale * pixel.green, + color_scale * pixel.blue); +#else XPutPixel (ximg, x, y, lookup_rgb_color (f, color_scale * pixel.red, color_scale * pixel.green, color_scale * pixel.blue)); +#endif } } DestroyPixelIterator (iterator); } +#ifdef USE_CAIRO + create_cairo_image_surface (img, data, width, height); +#else #ifdef COLOR_TABLE_SUPPORT /* Remember colors allocated for this image. */ img->colors = colors_in_color_table (&img->ncolors); @@ -8860,6 +8892,7 @@ imagemagick_load_image (struct frame *f, struct image *img, /* Put ximg into the image. */ image_put_x_image (f, img, ximg, 0); +#endif /* Final cleanup. image_wand should be the only resource left. */ DestroyMagickWand (image_wand); diff --git a/src/xterm.c b/src/xterm.c index 6ab4a03002..35e10568fa 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -360,17 +360,12 @@ x_begin_cr_clip (struct frame *f, GC gc) if (! FRAME_CR_SURFACE (f)) { - cairo_surface_t *surface; - surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f), - FRAME_X_DRAWABLE (f), - FRAME_DISPLAY_INFO (f)->visual, - FRAME_PIXEL_WIDTH (f), - FRAME_PIXEL_HEIGHT (f)); - cr = cairo_create (surface); - cairo_surface_destroy (surface); - } - else - cr = cairo_create (FRAME_CR_SURFACE (f)); + FRAME_CR_SURFACE (f) = + cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + FRAME_PIXEL_WIDTH (f), + FRAME_PIXEL_HEIGHT (f)); + } + cr = cairo_create (FRAME_CR_SURFACE (f)); FRAME_CR_CONTEXT (f) = cr; } cairo_save (cr); @@ -1234,32 +1229,24 @@ x_update_end (struct frame *f) #ifdef USE_CAIRO if (FRAME_CR_SURFACE (f)) { - cairo_t *cr = 0; - block_input(); -#if defined (USE_GTK) && defined (HAVE_GTK3) - if (FRAME_GTK_WIDGET (f)) - { - GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); - cr = gdk_cairo_create (w); - } - else -#endif - { - cairo_surface_t *surface; - int width = FRAME_PIXEL_WIDTH (f); - int height = FRAME_PIXEL_HEIGHT (f); - if (! FRAME_EXTERNAL_TOOL_BAR (f)) - height += FRAME_TOOL_BAR_HEIGHT (f); - if (! FRAME_EXTERNAL_MENU_BAR (f)) - height += FRAME_MENU_BAR_HEIGHT (f); - surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f), - FRAME_X_DRAWABLE (f), - FRAME_DISPLAY_INFO (f)->visual, - width, - height); - cr = cairo_create (surface); - cairo_surface_destroy (surface); - } + cairo_t *cr; + cairo_surface_t *surface; + int width, height; + + block_input (); + width = FRAME_PIXEL_WIDTH (f); + height = FRAME_PIXEL_HEIGHT (f); + if (! FRAME_EXTERNAL_TOOL_BAR (f)) + height += FRAME_TOOL_BAR_HEIGHT (f); + if (! FRAME_EXTERNAL_MENU_BAR (f)) + height += FRAME_MENU_BAR_HEIGHT (f); + surface = cairo_xlib_surface_create (FRAME_X_DISPLAY (f), + FRAME_X_DRAWABLE (f), + FRAME_DISPLAY_INFO (f)->visual, + width, + height); + cr = cairo_create (surface); + cairo_surface_destroy (surface); cairo_set_source_surface (cr, FRAME_CR_SURFACE (f), 0, 0); cairo_paint (cr); @@ -4271,7 +4258,28 @@ x_scroll_run (struct window *w, struct run *run) x_clear_cursor (w); #ifdef USE_CAIRO - SET_FRAME_GARBAGED (f); + if (FRAME_CR_CONTEXT (f)) + { + cairo_surface_t *s = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + width, height); + cairo_t *cr = cairo_create (s); + cairo_set_source_surface (cr, cairo_get_target (FRAME_CR_CONTEXT (f)), + -x, -from_y); + cairo_paint (cr); + cairo_destroy (cr); + + cr = FRAME_CR_CONTEXT (f); + cairo_save (cr); + cairo_set_source_surface (cr, s, 0, to_y); + cairo_rectangle (cr, x, to_y, width, height); + cairo_fill (cr); + cairo_restore (cr); + cairo_surface_destroy (s); + } + else + { + SET_FRAME_GARBAGED (f); + } #else XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_DRAWABLE (f), FRAME_X_DRAWABLE (f), commit e2879c1f837059335af89022b2a9ac9bc861e96d Author: Eli Zaretskii Date: Sat May 5 11:52:29 2018 +0300 Avoid infloops in font_open_entity * src/font.c (font_open_entity): Fail after 15 iterations through the loop that looks for a font whose average_width and height are both positive. This avoids infinite loops for fonts that, e.g., report average_width of zero for any possible size we try. (Bug#31316) diff --git a/src/font.c b/src/font.c index ef3f92b594..305bb14576 100644 --- a/src/font.c +++ b/src/font.c @@ -2906,6 +2906,9 @@ font_open_entity (struct frame *f, Lisp_Object entity, int pixel_size) font = XFONT_OBJECT (font_object); if (font->average_width > 0 && font->height > 0) break; + /* Avoid an infinite loop. */ + if (psize > pixel_size + 15) + return Qnil; } ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size)); FONT_ADD_LOG ("open", entity, font_object); commit bbe2cadc544e63e9378350621887f8fb9bbcc236 Author: Eli Zaretskii Date: Sat May 5 11:45:37 2018 +0300 Fix encoding of characters when using GB18030 fonts * lisp/international/fontset.el (font-encoding-alist): Fix the GB18030 entry to encode characters correctly when passing them to the xfont back-end. (Bug#31315) See also http://lists.gnu.org/archive/html/emacs-devel/2008-01/msg00754.html. diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index 4a7b754791..0b6dfcabd8 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -53,7 +53,10 @@ ("ascii-0$" . ascii) ("gb2312.1980" . chinese-gb2312) ("gbk" . chinese-gbk) - ("gb18030" . (unicode . nil)) + ;; GB18030 needs the characters encoded by gb18030, but a + ;; gb18030 font doesn't necessarily support all of the GB18030 + ;; characters. + ("gb18030" . (gb18030 . unicode)) ("jisx0208.1978" . japanese-jisx0208-1978) ("jisx0208" . japanese-jisx0208) ("jisx0201" . jisx0201)