aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrea Corallo2020-11-14 22:07:54 +0100
committerAndrea Corallo2020-11-14 22:07:54 +0100
commit2a8bf2222dd5d786375c131aa13dd1ea6f0cf104 (patch)
tree4f69d049302a8144783ff697f6a73d7e3e585539 /src
parentf702426780475309bdd33ef896d28dd33484246b (diff)
parentad29bc74ca9d4e1768698d4002b49c234624e359 (diff)
downloademacs-2a8bf2222dd5d786375c131aa13dd1ea6f0cf104.tar.gz
emacs-2a8bf2222dd5d786375c131aa13dd1ea6f0cf104.zip
Merge remote-tracking branch 'savannah/master' into dev
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c17
-rw-r--r--src/bidi.c12
-rw-r--r--src/dispextern.h1
-rw-r--r--src/dispnew.c52
-rw-r--r--src/doc.c40
-rw-r--r--src/doprnt.c8
-rw-r--r--src/editfns.c13
-rw-r--r--src/image.c121
-rw-r--r--src/keymap.c2
-rw-r--r--src/lisp.h12
-rw-r--r--src/minibuf.c7
-rw-r--r--src/nsterm.m23
-rw-r--r--src/pdumper.c2
-rw-r--r--src/process.c26
-rw-r--r--src/term.c52
-rw-r--r--src/w32fns.c27
-rw-r--r--src/xdisp.c17
-rw-r--r--src/xwidget.c10
18 files changed, 308 insertions, 134 deletions
diff --git a/src/alloc.c b/src/alloc.c
index fbfa814bcd8..ff6681cc760 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -7225,6 +7225,20 @@ Frames, windows, buffers, and subprocesses count as vectors
7225 make_int (strings_consed)); 7225 make_int (strings_consed));
7226} 7226}
7227 7227
7228#ifdef GNU_LINUX
7229DEFUN ("malloc-info", Fmalloc_info, Smalloc_info, 0, 0, "",
7230 doc: /* Report malloc information to stderr.
7231This function outputs to stderr an XML-formatted
7232description of the current state of the memory-allocation
7233arenas. */)
7234 (void)
7235{
7236 if (malloc_info (0, stderr))
7237 error ("malloc_info failed: %s", emacs_strerror (errno));
7238 return Qnil;
7239}
7240#endif
7241
7228static bool 7242static bool
7229symbol_uses_obj (Lisp_Object symbol, Lisp_Object obj) 7243symbol_uses_obj (Lisp_Object symbol, Lisp_Object obj)
7230{ 7244{
@@ -7569,6 +7583,9 @@ N should be nonnegative. */);
7569 defsubr (&Sgarbage_collect); 7583 defsubr (&Sgarbage_collect);
7570 defsubr (&Smemory_info); 7584 defsubr (&Smemory_info);
7571 defsubr (&Smemory_use_counts); 7585 defsubr (&Smemory_use_counts);
7586#ifdef GNU_LINUX
7587 defsubr (&Smalloc_info);
7588#endif
7572 defsubr (&Ssuspicious_object); 7589 defsubr (&Ssuspicious_object);
7573 7590
7574 Lisp_Object watcher; 7591 Lisp_Object watcher;
diff --git a/src/bidi.c b/src/bidi.c
index 225b27b18cd..ef062addd16 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1460,6 +1460,11 @@ bidi_at_paragraph_end (ptrdiff_t charpos, ptrdiff_t bytepos)
1460 else 1460 else
1461 start_re = paragraph_start_re; 1461 start_re = paragraph_start_re;
1462 1462
1463 /* Prevent quitting inside re_match_2, as redisplay_window could
1464 have temporarily moved point. */
1465 ptrdiff_t count = SPECPDL_INDEX ();
1466 specbind (Qinhibit_quit, Qt);
1467
1463 val = fast_looking_at (sep_re, charpos, bytepos, ZV, ZV_BYTE, Qnil); 1468 val = fast_looking_at (sep_re, charpos, bytepos, ZV, ZV_BYTE, Qnil);
1464 if (val < 0) 1469 if (val < 0)
1465 { 1470 {
@@ -1469,6 +1474,7 @@ bidi_at_paragraph_end (ptrdiff_t charpos, ptrdiff_t bytepos)
1469 val = -2; 1474 val = -2;
1470 } 1475 }
1471 1476
1477 unbind_to (count, Qnil);
1472 return val; 1478 return val;
1473} 1479}
1474 1480
@@ -1544,6 +1550,11 @@ bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte)
1544 if (cache_buffer->base_buffer) 1550 if (cache_buffer->base_buffer)
1545 cache_buffer = cache_buffer->base_buffer; 1551 cache_buffer = cache_buffer->base_buffer;
1546 1552
1553 /* Prevent quitting inside re_match_2, as redisplay_window could
1554 have temporarily moved point. */
1555 ptrdiff_t count = SPECPDL_INDEX ();
1556 specbind (Qinhibit_quit, Qt);
1557
1547 while (pos_byte > BEGV_BYTE 1558 while (pos_byte > BEGV_BYTE
1548 && n++ < MAX_PARAGRAPH_SEARCH 1559 && n++ < MAX_PARAGRAPH_SEARCH
1549 && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0) 1560 && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0)
@@ -1561,6 +1572,7 @@ bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte)
1561 else 1572 else
1562 pos = find_newline_no_quit (pos, pos_byte, -1, &pos_byte); 1573 pos = find_newline_no_quit (pos, pos_byte, -1, &pos_byte);
1563 } 1574 }
1575 unbind_to (count, Qnil);
1564 if (n >= MAX_PARAGRAPH_SEARCH) 1576 if (n >= MAX_PARAGRAPH_SEARCH)
1565 pos = BEGV, pos_byte = BEGV_BYTE; 1577 pos = BEGV, pos_byte = BEGV_BYTE;
1566 if (bpc) 1578 if (bpc)
diff --git a/src/dispextern.h b/src/dispextern.h
index 848d3bcd20e..da51772b37a 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3606,6 +3606,7 @@ extern Lisp_Object marginal_area_string (struct window *, enum window_part,
3606extern void redraw_frame (struct frame *); 3606extern void redraw_frame (struct frame *);
3607extern bool update_frame (struct frame *, bool, bool); 3607extern bool update_frame (struct frame *, bool, bool);
3608extern void update_frame_with_menu (struct frame *, int, int); 3608extern void update_frame_with_menu (struct frame *, int, int);
3609extern int update_mouse_position (struct frame *, int, int);
3609extern void bitch_at_user (void); 3610extern void bitch_at_user (void);
3610extern void adjust_frame_glyphs (struct frame *); 3611extern void adjust_frame_glyphs (struct frame *);
3611void free_glyphs (struct frame *); 3612void free_glyphs (struct frame *);
diff --git a/src/dispnew.c b/src/dispnew.c
index 3f2ae3e6ad1..479fccb45e0 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -3323,6 +3323,53 @@ update_frame_with_menu (struct frame *f, int row, int col)
3323 display_completed = !paused_p; 3323 display_completed = !paused_p;
3324} 3324}
3325 3325
3326/* Update the mouse position for a frame F. This handles both
3327 updating the display for mouse-face propreties and updating the
3328 help echo text.
3329
3330 Returns the number of events generated. */
3331int
3332update_mouse_position (struct frame *f, int x, int y)
3333{
3334 previous_help_echo_string = help_echo_string;
3335 help_echo_string = Qnil;
3336
3337 note_mouse_highlight (f, x, y);
3338
3339 /* If the contents of the global variable help_echo_string
3340 has changed, generate a HELP_EVENT. */
3341 if (!NILP (help_echo_string)
3342 || !NILP (previous_help_echo_string))
3343 {
3344 Lisp_Object frame;
3345 XSETFRAME (frame, f);
3346
3347 gen_help_event (help_echo_string, frame, help_echo_window,
3348 help_echo_object, help_echo_pos);
3349 return 1;
3350 }
3351
3352 return 0;
3353}
3354
3355DEFUN ("display--update-for-mouse-movement", Fdisplay__update_for_mouse_movement,
3356 Sdisplay__update_for_mouse_movement, 2, 2, 0,
3357 doc: /* Handle mouse movement detected by Lisp code.
3358
3359This function should be called when Lisp code detects the mouse has
3360moved, even if `track-mouse' is nil. This handles updates that do not
3361rely on input events such as updating display for mouse-face
3362properties or updating the help echo text. */)
3363 (Lisp_Object mouse_x, Lisp_Object mouse_y)
3364{
3365 CHECK_FIXNUM (mouse_x);
3366 CHECK_FIXNUM (mouse_y);
3367
3368 update_mouse_position (SELECTED_FRAME (), XFIXNUM (mouse_x),
3369 XFIXNUM (mouse_y));
3370 return Qnil;
3371}
3372
3326 3373
3327/************************************************************************ 3374/************************************************************************
3328 Window-based updates 3375 Window-based updates
@@ -5904,8 +5951,12 @@ when TERMINAL is nil. */)
5904 } 5951 }
5905 out = tty->output; 5952 out = tty->output;
5906 } 5953 }
5954 /* STRING might be very long, in which case fwrite could be
5955 interrupted by SIGIO. So we temporarily block SIGIO. */
5956 unrequest_sigio ();
5907 fwrite (SDATA (string), 1, SBYTES (string), out); 5957 fwrite (SDATA (string), 1, SBYTES (string), out);
5908 fflush (out); 5958 fflush (out);
5959 request_sigio ();
5909 unblock_input (); 5960 unblock_input ();
5910 return Qnil; 5961 return Qnil;
5911} 5962}
@@ -6490,6 +6541,7 @@ syms_of_display (void)
6490{ 6541{
6491 defsubr (&Sredraw_frame); 6542 defsubr (&Sredraw_frame);
6492 defsubr (&Sredraw_display); 6543 defsubr (&Sredraw_display);
6544 defsubr (&Sdisplay__update_for_mouse_movement);
6493 defsubr (&Sframe_or_buffer_changed_p); 6545 defsubr (&Sframe_or_buffer_changed_p);
6494 defsubr (&Sopen_termscript); 6546 defsubr (&Sopen_termscript);
6495 defsubr (&Sding); 6547 defsubr (&Sding);
diff --git a/src/doc.c b/src/doc.c
index d4e3ce2afea..de904b42e2a 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -688,37 +688,25 @@ default_to_grave_quoting_style (void)
688 && EQ (AREF (dv, 0), make_fixnum ('`'))); 688 && EQ (AREF (dv, 0), make_fixnum ('`')));
689} 689}
690 690
691/* Return the current effective text quoting style. */ 691DEFUN ("text-quoting-style", Ftext_quoting_style,
692enum text_quoting_style 692 Stext_quoting_style, 0, 0, 0,
693text_quoting_style (void) 693 doc: /* Return the current effective text quoting style.
694See variable `text-quoting-style'. */)
695 (void)
694{ 696{
697 /* Use grave accent and apostrophe `like this'. */
695 if (NILP (Vtext_quoting_style) 698 if (NILP (Vtext_quoting_style)
696 ? default_to_grave_quoting_style () 699 ? default_to_grave_quoting_style ()
697 : EQ (Vtext_quoting_style, Qgrave)) 700 : EQ (Vtext_quoting_style, Qgrave))
698 return GRAVE_QUOTING_STYLE; 701 return Qgrave;
702
703 /* Use apostrophes 'like this'. */
699 else if (EQ (Vtext_quoting_style, Qstraight)) 704 else if (EQ (Vtext_quoting_style, Qstraight))
700 return STRAIGHT_QUOTING_STYLE; 705 return Qstraight;
701 else
702 return CURVE_QUOTING_STYLE;
703}
704 706
705/* This is just a Lisp wrapper for text_quoting_style above. */ 707 /* Use curved single quotes ‘like this’. */
706DEFUN ("get-quoting-style", Fget_quoting_style, 708 else
707 Sget_quoting_style, 0, 0, 0, 709 return Qcurve;
708 doc: /* Return the current effective text quoting style.
709See variable `text-quoting-style'. */)
710 (void)
711{
712 switch (text_quoting_style ())
713 {
714 case STRAIGHT_QUOTING_STYLE:
715 return Qstraight;
716 case CURVE_QUOTING_STYLE:
717 return Qcurve;
718 case GRAVE_QUOTING_STYLE:
719 default:
720 return Qgrave;
721 }
722} 710}
723 711
724 712
@@ -761,5 +749,5 @@ otherwise. */);
761 defsubr (&Sdocumentation); 749 defsubr (&Sdocumentation);
762 defsubr (&Sdocumentation_property); 750 defsubr (&Sdocumentation_property);
763 defsubr (&Ssnarf_documentation); 751 defsubr (&Ssnarf_documentation);
764 defsubr (&Sget_quoting_style); 752 defsubr (&Stext_quoting_style);
765} 753}
diff --git a/src/doprnt.c b/src/doprnt.c
index ce259d07cfe..93164977206 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -199,7 +199,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
199 /* Buffer we have got with malloc. */ 199 /* Buffer we have got with malloc. */
200 char *big_buffer = NULL; 200 char *big_buffer = NULL;
201 201
202 enum text_quoting_style quoting_style = text_quoting_style (); 202 Lisp_Object quoting_style = Ftext_quoting_style ();
203 203
204 bufsize--; 204 bufsize--;
205 205
@@ -482,13 +482,13 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
482 482
483 char const *src; 483 char const *src;
484 ptrdiff_t srclen; 484 ptrdiff_t srclen;
485 if (quoting_style == CURVE_QUOTING_STYLE && fmtchar == '`') 485 if (EQ (quoting_style, Qcurve) && fmtchar == '`')
486 src = uLSQM, srclen = sizeof uLSQM - 1; 486 src = uLSQM, srclen = sizeof uLSQM - 1;
487 else if (quoting_style == CURVE_QUOTING_STYLE && fmtchar == '\'') 487 else if (EQ (quoting_style, Qcurve) && fmtchar == '\'')
488 src = uRSQM, srclen = sizeof uRSQM - 1; 488 src = uRSQM, srclen = sizeof uRSQM - 1;
489 else 489 else
490 { 490 {
491 if (quoting_style == STRAIGHT_QUOTING_STYLE && fmtchar == '`') 491 if (EQ (quoting_style, Qstraight) && fmtchar == '`')
492 fmtchar = '\''; 492 fmtchar = '\'';
493 eassert (ASCII_CHAR_P (fmtchar)); 493 eassert (ASCII_CHAR_P (fmtchar));
494 *bufptr++ = fmtchar; 494 *bufptr++ = fmtchar;
diff --git a/src/editfns.c b/src/editfns.c
index ca6b8981ebf..4104edd77fd 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2117,6 +2117,13 @@ nil. */)
2117 { 2117 {
2118 signal_after_change (BEGV, size_a, ZV - BEGV); 2118 signal_after_change (BEGV, size_a, ZV - BEGV);
2119 update_compositions (BEGV, ZV, CHECK_INSIDE); 2119 update_compositions (BEGV, ZV, CHECK_INSIDE);
2120 /* We've locked the buffer's file above in
2121 prepare_to_modify_buffer; if the buffer is unchanged at this
2122 point, i.e. no insertions or deletions have been made, unlock
2123 the file now. */
2124 if (SAVE_MODIFF == MODIFF
2125 && STRINGP (BVAR (a, file_truename)))
2126 unlock_file (BVAR (a, file_truename));
2120 } 2127 }
2121 2128
2122 return Qt; 2129 return Qt;
@@ -3147,7 +3154,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
3147 if (STRINGP (args[i]) && STRING_MULTIBYTE (args[i])) 3154 if (STRINGP (args[i]) && STRING_MULTIBYTE (args[i]))
3148 multibyte = true; 3155 multibyte = true;
3149 3156
3150 int quoting_style = message ? text_quoting_style () : -1; 3157 Lisp_Object quoting_style = message ? Ftext_quoting_style () : Qnil;
3151 3158
3152 ptrdiff_t ispec; 3159 ptrdiff_t ispec;
3153 ptrdiff_t nspec = 0; 3160 ptrdiff_t nspec = 0;
@@ -3767,7 +3774,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
3767 unsigned char str[MAX_MULTIBYTE_LENGTH]; 3774 unsigned char str[MAX_MULTIBYTE_LENGTH];
3768 3775
3769 if ((format_char == '`' || format_char == '\'') 3776 if ((format_char == '`' || format_char == '\'')
3770 && quoting_style == CURVE_QUOTING_STYLE) 3777 && EQ (quoting_style, Qcurve))
3771 { 3778 {
3772 if (! multibyte) 3779 if (! multibyte)
3773 { 3780 {
@@ -3778,7 +3785,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
3778 convbytes = 3; 3785 convbytes = 3;
3779 new_result = true; 3786 new_result = true;
3780 } 3787 }
3781 else if (format_char == '`' && quoting_style == STRAIGHT_QUOTING_STYLE) 3788 else if (format_char == '`' && EQ (quoting_style, Qstraight))
3782 { 3789 {
3783 convsrc = "'"; 3790 convsrc = "'";
3784 new_result = true; 3791 new_result = true;
diff --git a/src/image.c b/src/image.c
index c857b8e62a4..3858f3c41f3 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9542,16 +9542,19 @@ DEF_DLL_FN (void, rsvg_handle_set_base_uri, (RsvgHandle *, const char *));
9542DEF_DLL_FN (gboolean, rsvg_handle_write, 9542DEF_DLL_FN (gboolean, rsvg_handle_write,
9543 (RsvgHandle *, const guchar *, gsize, GError **)); 9543 (RsvgHandle *, const guchar *, gsize, GError **));
9544DEF_DLL_FN (gboolean, rsvg_handle_close, (RsvgHandle *, GError **)); 9544DEF_DLL_FN (gboolean, rsvg_handle_close, (RsvgHandle *, GError **));
9545#endif 9545# endif
9546 9546
9547#if LIBRSVG_CHECK_VERSION (2, 46, 0) 9547# if LIBRSVG_CHECK_VERSION (2, 46, 0)
9548DEF_DLL_FN (void, rsvg_handle_get_intrinsic_dimensions,
9549 (RsvgHandle *, gboolean *, RsvgLength *, gboolean *,
9550 RsvgLength *, gboolean *, RsvgRectangle *));
9548DEF_DLL_FN (gboolean, rsvg_handle_get_geometry_for_layer, 9551DEF_DLL_FN (gboolean, rsvg_handle_get_geometry_for_layer,
9549 (RsvgHandle *, const char *, const RsvgRectangle *, 9552 (RsvgHandle *, const char *, const RsvgRectangle *,
9550 RsvgRectangle *, RsvgRectangle *, GError **)); 9553 RsvgRectangle *, RsvgRectangle *, GError **));
9551#else 9554# else
9552DEF_DLL_FN (void, rsvg_handle_get_dimensions, 9555DEF_DLL_FN (void, rsvg_handle_get_dimensions,
9553 (RsvgHandle *, RsvgDimensionData *)); 9556 (RsvgHandle *, RsvgDimensionData *));
9554#endif 9557# endif
9555DEF_DLL_FN (GdkPixbuf *, rsvg_handle_get_pixbuf, (RsvgHandle *)); 9558DEF_DLL_FN (GdkPixbuf *, rsvg_handle_get_pixbuf, (RsvgHandle *));
9556DEF_DLL_FN (int, gdk_pixbuf_get_width, (const GdkPixbuf *)); 9559DEF_DLL_FN (int, gdk_pixbuf_get_width, (const GdkPixbuf *));
9557DEF_DLL_FN (int, gdk_pixbuf_get_height, (const GdkPixbuf *)); 9560DEF_DLL_FN (int, gdk_pixbuf_get_height, (const GdkPixbuf *));
@@ -9599,6 +9602,7 @@ init_svg_functions (void)
9599 LOAD_DLL_FN (library, rsvg_handle_close); 9602 LOAD_DLL_FN (library, rsvg_handle_close);
9600#endif 9603#endif
9601#if LIBRSVG_CHECK_VERSION (2, 46, 0) 9604#if LIBRSVG_CHECK_VERSION (2, 46, 0)
9605 LOAD_DLL_FN (library, rsvg_handle_get_intrinsic_dimensions);
9602 LOAD_DLL_FN (library, rsvg_handle_get_geometry_for_layer); 9606 LOAD_DLL_FN (library, rsvg_handle_get_geometry_for_layer);
9603#else 9607#else
9604 LOAD_DLL_FN (library, rsvg_handle_get_dimensions); 9608 LOAD_DLL_FN (library, rsvg_handle_get_dimensions);
@@ -9638,6 +9642,7 @@ init_svg_functions (void)
9638# undef g_object_unref 9642# undef g_object_unref
9639# undef g_type_init 9643# undef g_type_init
9640# if LIBRSVG_CHECK_VERSION (2, 46, 0) 9644# if LIBRSVG_CHECK_VERSION (2, 46, 0)
9645# undef rsvg_handle_get_intrinsic_dimensions
9641# undef rsvg_handle_get_geometry_for_layer 9646# undef rsvg_handle_get_geometry_for_layer
9642# else 9647# else
9643# undef rsvg_handle_get_dimensions 9648# undef rsvg_handle_get_dimensions
@@ -9668,7 +9673,10 @@ init_svg_functions (void)
9668# define g_type_init fn_g_type_init 9673# define g_type_init fn_g_type_init
9669# endif 9674# endif
9670# if LIBRSVG_CHECK_VERSION (2, 46, 0) 9675# if LIBRSVG_CHECK_VERSION (2, 46, 0)
9671# define rsvg_handle_get_geometry_for_layer fn_rsvg_handle_get_geometry_for_layer 9676# define rsvg_handle_get_intrinsic_dimensions \
9677 fn_rsvg_handle_get_intrinsic_dimensions
9678# define rsvg_handle_get_geometry_for_layer \
9679 fn_rsvg_handle_get_geometry_for_layer
9672# else 9680# else
9673# define rsvg_handle_get_dimensions fn_rsvg_handle_get_dimensions 9681# define rsvg_handle_get_dimensions fn_rsvg_handle_get_dimensions
9674# endif 9682# endif
@@ -9742,6 +9750,49 @@ svg_load (struct frame *f, struct image *img)
9742 return success_p; 9750 return success_p;
9743} 9751}
9744 9752
9753#if LIBRSVG_CHECK_VERSION (2, 46, 0)
9754static double
9755svg_css_length_to_pixels (RsvgLength length)
9756{
9757 /* FIXME: 96 appears to be a pretty standard DPI but we should
9758 probably use the real DPI if we can get it. */
9759 double dpi = 96;
9760 double value = length.length;
9761
9762 switch (length.unit)
9763 {
9764 case RSVG_UNIT_PX:
9765 /* Already a pixel value. */
9766 break;
9767 case RSVG_UNIT_CM:
9768 /* 2.54 cm in an inch. */
9769 value = dpi * value / 2.54;
9770 break;
9771 case RSVG_UNIT_MM:
9772 /* 25.4 mm in an inch. */
9773 value = dpi * value / 25.4;
9774 break;
9775 case RSVG_UNIT_PT:
9776 /* 72 points in an inch. */
9777 value = dpi * value / 72;
9778 break;
9779 case RSVG_UNIT_PC:
9780 /* 6 picas in an inch. */
9781 value = dpi * value / 6;
9782 break;
9783 case RSVG_UNIT_IN:
9784 value *= dpi;
9785 break;
9786 default:
9787 /* Probably one of em, ex, or %. We can't know what the pixel
9788 value is without more information. */
9789 value = 0;
9790 }
9791
9792 return value;
9793}
9794#endif
9795
9745/* Load frame F and image IMG. CONTENTS contains the SVG XML data to 9796/* Load frame F and image IMG. CONTENTS contains the SVG XML data to
9746 be parsed, SIZE is its size, and FILENAME is the name of the SVG 9797 be parsed, SIZE is its size, and FILENAME is the name of the SVG
9747 file being loaded. 9798 file being loaded.
@@ -9810,11 +9861,48 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
9810#if LIBRSVG_CHECK_VERSION (2, 46, 0) 9861#if LIBRSVG_CHECK_VERSION (2, 46, 0)
9811 RsvgRectangle zero_rect, viewbox, out_logical_rect; 9862 RsvgRectangle zero_rect, viewbox, out_logical_rect;
9812 9863
9813 rsvg_handle_get_geometry_for_layer (rsvg_handle, NULL, 9864 /* Try the instrinsic dimensions first. */
9814 &zero_rect, &viewbox, 9865 gboolean has_width, has_height, has_viewbox;
9815 &out_logical_rect, NULL); 9866 RsvgLength iwidth, iheight;
9816 viewbox_width = viewbox.x + viewbox.width; 9867
9817 viewbox_height = viewbox.y + viewbox.height; 9868 rsvg_handle_get_intrinsic_dimensions (rsvg_handle,
9869 &has_width, &iwidth,
9870 &has_height, &iheight,
9871 &has_viewbox, &viewbox);
9872
9873 if (has_width && has_height)
9874 {
9875 /* Success! We can use these values directly. */
9876 viewbox_width = svg_css_length_to_pixels (iwidth);
9877 viewbox_height = svg_css_length_to_pixels (iheight);
9878 }
9879 else if (has_width && has_viewbox)
9880 {
9881 viewbox_width = svg_css_length_to_pixels (iwidth);
9882 viewbox_height = svg_css_length_to_pixels (iwidth)
9883 * viewbox.width / viewbox.height;
9884 }
9885 else if (has_height && has_viewbox)
9886 {
9887 viewbox_height = svg_css_length_to_pixels (iheight);
9888 viewbox_width = svg_css_length_to_pixels (iheight)
9889 * viewbox.height / viewbox.width;
9890 }
9891 else if (has_viewbox)
9892 {
9893 viewbox_width = viewbox.width;
9894 viewbox_height = viewbox.height;
9895 }
9896 else
9897 {
9898 /* We haven't found a useable set of sizes, so try working out
9899 the visible area. */
9900 rsvg_handle_get_geometry_for_layer (rsvg_handle, NULL,
9901 &zero_rect, &viewbox,
9902 &out_logical_rect, NULL);
9903 viewbox_width = viewbox.x + viewbox.width;
9904 viewbox_height = viewbox.y + viewbox.height;
9905 }
9818#else 9906#else
9819 /* The function used above to get the geometry of the visible area 9907 /* The function used above to get the geometry of the visible area
9820 of the SVG are only available in librsvg 2.46 and above, so in 9908 of the SVG are only available in librsvg 2.46 and above, so in
@@ -9827,6 +9915,19 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
9827 viewbox_width = dimension_data.width; 9915 viewbox_width = dimension_data.width;
9828 viewbox_height = dimension_data.height; 9916 viewbox_height = dimension_data.height;
9829#endif 9917#endif
9918
9919 if (viewbox_width == 0 || viewbox_height == 0)
9920 {
9921 /* We do not have any usable dimensions, so make some up. The
9922 values below are supposedly the default values most web
9923 browsers use for SVGs with no set size. */
9924 /* FIXME: At this stage we should perhaps consider rendering the
9925 image out to a bitmap and getting the dimensions from
9926 that. */
9927 viewbox_width = 300;
9928 viewbox_height = 150;
9929 }
9930
9830 compute_image_size (viewbox_width, viewbox_height, img->spec, 9931 compute_image_size (viewbox_width, viewbox_height, img->spec,
9831 &width, &height); 9932 &width, &height);
9832 9933
diff --git a/src/keymap.c b/src/keymap.c
index e5b4781076f..181dcdad3ad 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2926,7 +2926,7 @@ You type Translation\n\
2926 CALLN (Ffuncall, 2926 CALLN (Ffuncall,
2927 Qdescribe_map_tree, 2927 Qdescribe_map_tree,
2928 KVAR (current_kboard, Vlocal_function_key_map), Qnil, Qnil, prefix, 2928 KVAR (current_kboard, Vlocal_function_key_map), Qnil, Qnil, prefix,
2929 msg, nomenu, Qt, Qt, Qt); 2929 msg, nomenu, Qt, Qnil, Qnil);
2930 } 2930 }
2931 2931
2932 /* Print the input-decode-map translations under this prefix. */ 2932 /* Print the input-decode-map translations under this prefix. */
diff --git a/src/lisp.h b/src/lisp.h
index 31d2b5f4182..b956f39d787 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4518,18 +4518,6 @@ extern void set_initial_environment (void);
4518extern void syms_of_callproc (void); 4518extern void syms_of_callproc (void);
4519 4519
4520/* Defined in doc.c. */ 4520/* Defined in doc.c. */
4521enum text_quoting_style
4522 {
4523 /* Use curved single quotes ‘like this’. */
4524 CURVE_QUOTING_STYLE,
4525
4526 /* Use grave accent and apostrophe `like this'. */
4527 GRAVE_QUOTING_STYLE,
4528
4529 /* Use apostrophes 'like this'. */
4530 STRAIGHT_QUOTING_STYLE
4531 };
4532extern enum text_quoting_style text_quoting_style (void);
4533extern Lisp_Object read_doc_string (Lisp_Object); 4521extern Lisp_Object read_doc_string (Lisp_Object);
4534extern Lisp_Object get_doc_string (Lisp_Object, bool, bool); 4522extern Lisp_Object get_doc_string (Lisp_Object, bool, bool);
4535extern void syms_of_doc (void); 4523extern void syms_of_doc (void);
diff --git a/src/minibuf.c b/src/minibuf.c
index 068086ead82..c4adca15365 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -142,10 +142,6 @@ void move_minibuffer_onto_frame (void)
142 142
143 set_window_buffer (sf->minibuffer_window, buffer, 0, 0); 143 set_window_buffer (sf->minibuffer_window, buffer, 0, 0);
144 minibuf_window = sf->minibuffer_window; 144 minibuf_window = sf->minibuffer_window;
145 if (EQ (XWINDOW (minibuf_window)->frame, selected_frame))
146 /* The minibuffer might be on another frame. */
147 Fset_frame_selected_window (selected_frame, sf->minibuffer_window,
148 Qnil);
149 set_window_buffer (of->minibuffer_window, get_minibuffer (0), 0, 0); 145 set_window_buffer (of->minibuffer_window, get_minibuffer (0), 0, 0);
150 } 146 }
151} 147}
@@ -732,7 +728,8 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
732 /* If cursor is on the minibuffer line, 728 /* If cursor is on the minibuffer line,
733 show the user we have exited by putting it in column 0. */ 729 show the user we have exited by putting it in column 0. */
734 if (XWINDOW (minibuf_window)->cursor.vpos >= 0 730 if (XWINDOW (minibuf_window)->cursor.vpos >= 0
735 && !noninteractive) 731 && !noninteractive
732 && !FRAME_INITIAL_P (SELECTED_FRAME ()))
736 { 733 {
737 XWINDOW (minibuf_window)->cursor.hpos = 0; 734 XWINDOW (minibuf_window)->cursor.hpos = 0;
738 XWINDOW (minibuf_window)->cursor.x = 0; 735 XWINDOW (minibuf_window)->cursor.x = 0;
diff --git a/src/nsterm.m b/src/nsterm.m
index fa38350a2f6..a9280eb4af9 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1782,6 +1782,8 @@ ns_destroy_window (struct frame *f)
1782{ 1782{
1783 NSTRACE ("ns_destroy_window"); 1783 NSTRACE ("ns_destroy_window");
1784 1784
1785 check_window_system (f);
1786
1785 /* If this frame has a parent window, detach it as not doing so can 1787 /* If this frame has a parent window, detach it as not doing so can
1786 cause a crash in GNUStep. */ 1788 cause a crash in GNUStep. */
1787 if (FRAME_PARENT_FRAME (f) != NULL) 1789 if (FRAME_PARENT_FRAME (f) != NULL)
@@ -1792,7 +1794,7 @@ ns_destroy_window (struct frame *f)
1792 [parent removeChildWindow: child]; 1794 [parent removeChildWindow: child];
1793 } 1795 }
1794 1796
1795 check_window_system (f); 1797 [[FRAME_NS_VIEW (f) window] close];
1796 ns_free_frame_resources (f); 1798 ns_free_frame_resources (f);
1797 ns_window_num--; 1799 ns_window_num--;
1798} 1800}
@@ -6529,6 +6531,14 @@ not_in_argv (NSString *arg)
6529 code = 0xFF08; /* backspace */ 6531 code = 0xFF08; /* backspace */
6530 else 6532 else
6531 code = fnKeysym; 6533 code = fnKeysym;
6534
6535 /* Function keys (such as the F-keys, arrow keys, etc.) set
6536 modifiers as though the fn key has been pressed when it
6537 hasn't. Also some combinations of fn and a function key
6538 return a different key than was pressed (e.g. fn-<left>
6539 gives <home>). We need to unset the fn key flag in these
6540 cases. */
6541 flags &= ~NS_FUNCTION_KEY_MASK;
6532 } 6542 }
6533 6543
6534 /* The ⌘ and ⌥ modifiers can be either shift-like (for alternate 6544 /* The ⌘ and ⌥ modifiers can be either shift-like (for alternate
@@ -6550,17 +6560,6 @@ not_in_argv (NSString *arg)
6550 Lisp_Object kind = fnKeysym ? QCfunction : QCordinary; 6560 Lisp_Object kind = fnKeysym ? QCfunction : QCordinary;
6551 emacs_event->modifiers = EV_MODIFIERS2 (flags, kind); 6561 emacs_event->modifiers = EV_MODIFIERS2 (flags, kind);
6552 6562
6553 /* Function keys (such as the F-keys, arrow keys, etc.) set
6554 modifiers as though the fn key has been pressed when it
6555 hasn't. Also some combinations of fn and a function key
6556 return a different key than was pressed (e.g. fn-<left> gives
6557 <home>). We need to unset the fn modifier in these cases.
6558 FIXME: Can we avoid setting it in the first place? */
6559 if (fnKeysym && (flags & NS_FUNCTION_KEY_MASK))
6560 emacs_event->modifiers
6561 ^= parse_solitary_modifier (mod_of_kind (ns_function_modifier,
6562 QCfunction));
6563
6564 if (NS_KEYLOG) 6563 if (NS_KEYLOG)
6565 fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n", 6564 fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n",
6566 code, fnKeysym, flags, emacs_event->modifiers); 6565 code, fnKeysym, flags, emacs_event->modifiers);
diff --git a/src/pdumper.c b/src/pdumper.c
index 0528219139c..c253fc53c47 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -4123,7 +4123,7 @@ types. */)
4123 ctx->header.fingerprint[i] = fingerprint[i]; 4123 ctx->header.fingerprint[i] = fingerprint[i];
4124 4124
4125 const dump_off header_start = ctx->offset; 4125 const dump_off header_start = ctx->offset;
4126 dump_fingerprint ("dumping fingerprint", ctx->header.fingerprint); 4126 dump_fingerprint ("Dumping fingerprint", ctx->header.fingerprint);
4127 dump_write (ctx, &ctx->header, sizeof (ctx->header)); 4127 dump_write (ctx, &ctx->header, sizeof (ctx->header));
4128 const dump_off header_end = ctx->offset; 4128 const dump_off header_end = ctx->offset;
4129 4129
diff --git a/src/process.c b/src/process.c
index 50c425077a9..bf64ead24e5 100644
--- a/src/process.c
+++ b/src/process.c
@@ -8217,13 +8217,29 @@ init_process_emacs (int sockfd)
8217 if (!will_dump_with_unexec_p ()) 8217 if (!will_dump_with_unexec_p ())
8218 { 8218 {
8219#if defined HAVE_GLIB && !defined WINDOWSNT 8219#if defined HAVE_GLIB && !defined WINDOWSNT
8220 /* Tickle glib's child-handling code. Ask glib to wait for Emacs itself; 8220 /* Tickle glib's child-handling code. Ask glib to install a
8221 this should always fail, but is enough to initialize glib's 8221 watch source for Emacs itself which will initialize glib's
8222 private SIGCHLD handler, allowing catch_child_signal to copy 8222 private SIGCHLD handler, allowing catch_child_signal to copy
8223 it into lib_child_handler. */ 8223 it into lib_child_handler.
8224 g_source_unref (g_child_watch_source_new (getpid ())); 8224
8225#endif 8225 Unfortunatly in glib commit 2e471acf, the behavior changed to
8226 always install a signal handler when g_child_watch_source_new
8227 is called and not just the first time it's called. Glib also
8228 now resets signal handlers to SIG_DFL when it no longer has a
8229 watcher on that signal. This is a hackey work around to get
8230 glib's g_unix_signal_handler into lib_child_handler. */
8231 GSource *source = g_child_watch_source_new (getpid ());
8232 catch_child_signal ();
8233 g_source_unref (source);
8234
8235 eassert (lib_child_handler != dummy_handler);
8236 signal_handler_t lib_child_handler_glib = lib_child_handler;
8226 catch_child_signal (); 8237 catch_child_signal ();
8238 eassert (lib_child_handler == dummy_handler);
8239 lib_child_handler = lib_child_handler_glib;
8240#else
8241 catch_child_signal ();
8242#endif
8227 } 8243 }
8228 8244
8229#ifdef HAVE_SETRLIMIT 8245#ifdef HAVE_SETRLIMIT
diff --git a/src/term.c b/src/term.c
index 3a13da165e5..a0738594bfc 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2430,22 +2430,6 @@ tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row,
2430 cursor_to (f, save_y, save_x); 2430 cursor_to (f, save_y, save_x);
2431} 2431}
2432 2432
2433static bool
2434term_mouse_movement (struct frame *frame, Gpm_Event *event)
2435{
2436 /* Has the mouse moved off the glyph it was on at the last sighting? */
2437 if (event->x != last_mouse_x || event->y != last_mouse_y)
2438 {
2439 frame->mouse_moved = 1;
2440 note_mouse_highlight (frame, event->x, event->y);
2441 /* Remember which glyph we're now on. */
2442 last_mouse_x = event->x;
2443 last_mouse_y = event->y;
2444 return 1;
2445 }
2446 return 0;
2447}
2448
2449/* Return the current time, as a Time value. Wrap around on overflow. */ 2433/* Return the current time, as a Time value. Wrap around on overflow. */
2450static Time 2434static Time
2451current_Time (void) 2435current_Time (void)
@@ -2562,30 +2546,22 @@ handle_one_term_event (struct tty_display_info *tty, Gpm_Event *event)
2562 2546
2563 if (event->type & (GPM_MOVE | GPM_DRAG)) 2547 if (event->type & (GPM_MOVE | GPM_DRAG))
2564 { 2548 {
2565 previous_help_echo_string = help_echo_string;
2566 help_echo_string = Qnil;
2567
2568 Gpm_DrawPointer (event->x, event->y, fileno (tty->output)); 2549 Gpm_DrawPointer (event->x, event->y, fileno (tty->output));
2569 2550
2570 if (!term_mouse_movement (f, event)) 2551 /* Has the mouse moved off the glyph it was on at the last
2571 help_echo_string = previous_help_echo_string; 2552 sighting? */
2572 2553 if (event->x != last_mouse_x || event->y != last_mouse_y)
2573 /* If the contents of the global variable help_echo_string 2554 {
2574 has changed, generate a HELP_EVENT. */ 2555 /* FIXME: These three lines can not be moved into
2575 if (!NILP (help_echo_string) 2556 update_mouse_position unless xterm-mouse gets updated to
2576 || !NILP (previous_help_echo_string)) 2557 generate mouse events via C code. See
2577 { 2558 https://lists.gnu.org/archive/html/emacs-devel/2020-11/msg00163.html */
2578 Lisp_Object frame; 2559 last_mouse_x = event->x;
2579 2560 last_mouse_y = event->y;
2580 if (f) 2561 f->mouse_moved = 1;
2581 XSETFRAME (frame, f); 2562
2582 else 2563 count += update_mouse_position (f, event->x, event->y);
2583 frame = Qnil; 2564 }
2584
2585 gen_help_event (help_echo_string, frame, help_echo_window,
2586 help_echo_object, help_echo_pos);
2587 count++;
2588 }
2589 } 2565 }
2590 else 2566 else
2591 { 2567 {
diff --git a/src/w32fns.c b/src/w32fns.c
index ef69f40611e..7bb96891d05 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -8498,8 +8498,8 @@ DEFUN ("w32-register-hot-key", Fw32_register_hot_key,
8498 doc: /* Register KEY as a hot-key combination. 8498 doc: /* Register KEY as a hot-key combination.
8499Certain key combinations like Alt-Tab and Win-R are reserved for 8499Certain key combinations like Alt-Tab and Win-R are reserved for
8500system use on Windows, and therefore are normally intercepted by the 8500system use on Windows, and therefore are normally intercepted by the
8501system. These key combinations can be received by registering them 8501system. These key combinations can be used in Emacs by registering
8502as hot-keys, except for Win-L which always locks the computer. 8502them as hot-keys, except for Win-L which always locks the computer.
8503 8503
8504On Windows 98 and ME, KEY must be a one element key definition in 8504On Windows 98 and ME, KEY must be a one element key definition in
8505vector form that would be acceptable to `define-key' (e.g. [A-tab] for 8505vector form that would be acceptable to `define-key' (e.g. [A-tab] for
@@ -8508,16 +8508,19 @@ Alt-Tab). The meta modifier is interpreted as Alt if
8508modifier keys. The return value is the hotkey-id if registered, 8508modifier keys. The return value is the hotkey-id if registered,
8509otherwise nil. 8509otherwise nil.
8510 8510
8511On Windows versions since NT, KEY can also be specified as [M-], [s-] or 8511On Windows versions since NT, KEY can also be specified as just a
8512[h-] to indicate that all combinations of that key should be processed 8512modifier key, [M-], [s-] or [H-], to indicate that all combinations
8513by Emacs instead of the operating system. The super and hyper 8513of the respective modifier key should be processed by Emacs instead
8514modifiers are interpreted according to the current values of 8514of the operating system. The super and hyper modifiers are
8515`w32-lwindow-modifier' and `w32-rwindow-modifier'. For instance, 8515interpreted according to the current values of `w32-lwindow-modifier'
8516setting `w32-lwindow-modifier' to `super' and then calling 8516and `w32-rwindow-modifier'. For instance, setting `w32-lwindow-modifier'
8517`(w32-register-hot-key [s-])' grabs all combinations of the left Windows 8517to `super' and then calling `(w32-register-hot-key [s-])' grabs all
8518key to Emacs, but leaves the right Windows key free for the operating 8518combinations of the left Windows key to Emacs as keys with the Super
8519system keyboard shortcuts. The return value is t if the call affected 8519modifier, but leaves the right Windows key free for the operating
8520any key combinations, otherwise nil. */) 8520system keyboard shortcuts.
8521
8522The return value is t if the call affected any key combinations,
8523otherwise nil. */)
8521 (Lisp_Object key) 8524 (Lisp_Object key)
8522{ 8525{
8523 key = w32_parse_and_hook_hot_key (key, 1); 8526 key = w32_parse_and_hook_hot_key (key, 1);
diff --git a/src/xdisp.c b/src/xdisp.c
index 0001bcd98d2..2344fe70601 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7323,14 +7323,21 @@ static next_element_function const get_next_element[NUM_IT_METHODS] =
7323 7323
7324 7324
7325/* Return true iff a character at CHARPOS (and BYTEPOS) is composed 7325/* Return true iff a character at CHARPOS (and BYTEPOS) is composed
7326 (possibly with the following characters). */ 7326 (possibly with the following characters).
7327
7328 Note: we pass -1 as the "resolved bidi level" when the iterator
7329 doesn't have the bidi_p flag set, because in that case we really
7330 don't know what is the directionality of the text, so we leave it to
7331 the shaping engine to figure that out. */
7327 7332
7328#define CHAR_COMPOSED_P(IT,CHARPOS,BYTEPOS,END_CHARPOS) \ 7333#define CHAR_COMPOSED_P(IT,CHARPOS,BYTEPOS,END_CHARPOS) \
7329 ((IT)->cmp_it.id >= 0 \ 7334 ((IT)->cmp_it.id >= 0 \
7330 || ((IT)->cmp_it.stop_pos == (CHARPOS) \ 7335 || ((IT)->cmp_it.stop_pos == (CHARPOS) \
7331 && composition_reseat_it (&(IT)->cmp_it, CHARPOS, BYTEPOS, \ 7336 && composition_reseat_it (&(IT)->cmp_it, CHARPOS, BYTEPOS, \
7332 END_CHARPOS, (IT)->w, \ 7337 END_CHARPOS, (IT)->w, \
7333 (IT)->bidi_it.resolved_level, \ 7338 (IT)->bidi_p \
7339 ? (IT)->bidi_it.resolved_level \
7340 : -1, \
7334 FACE_FROM_ID_OR_NULL ((IT)->f, \ 7341 FACE_FROM_ID_OR_NULL ((IT)->f, \
7335 (IT)->face_id), \ 7342 (IT)->face_id), \
7336 (IT)->string))) 7343 (IT)->string)))
@@ -8317,10 +8324,10 @@ next_element_from_display_vector (struct it *it)
8317 next_face_id = it->dpvec_face_id; 8324 next_face_id = it->dpvec_face_id;
8318 else 8325 else
8319 { 8326 {
8320 int lface_id = 8327 Lisp_Object gc = it->dpvec[it->current.dpvec_index + 1];
8321 GLYPH_CODE_FACE (it->dpvec[it->current.dpvec_index + 1]); 8328 int lface_id = GLYPH_CODE_P (gc) ? GLYPH_CODE_FACE (gc) : 0;
8322 8329
8323 if (lface_id > 0) 8330 if (lface_id > 0)
8324 next_face_id = merge_faces (it->w, Qt, lface_id, 8331 next_face_id = merge_faces (it->w, Qt, lface_id,
8325 it->saved_face_id); 8332 it->saved_face_id);
8326 } 8333 }
diff --git a/src/xwidget.c b/src/xwidget.c
index 031975fafb9..e078a28a35b 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -128,6 +128,16 @@ Returns the newly constructed xwidget, or nil if construction fails. */)
128 if (EQ (xw->type, Qwebkit)) 128 if (EQ (xw->type, Qwebkit))
129 { 129 {
130 xw->widget_osr = webkit_web_view_new (); 130 xw->widget_osr = webkit_web_view_new ();
131
132 /* webkitgtk uses GSubprocess which sets sigaction causing
133 Emacs to not catch SIGCHLD with its usual handle setup in
134 catch_child_signal(). This resets the SIGCHLD
135 sigaction. */
136 struct sigaction old_action;
137 sigaction (SIGCHLD, NULL, &old_action);
138 webkit_web_view_load_uri(WEBKIT_WEB_VIEW (xw->widget_osr),
139 "about:blank");
140 sigaction (SIGCHLD, &old_action, NULL);
131 } 141 }
132 142
133 gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width, 143 gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr), xw->width,