aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlenn Morris2021-10-18 07:50:26 -0700
committerGlenn Morris2021-10-18 07:50:26 -0700
commit7d12c06725d733f1ea223f5fe55d506c71e44370 (patch)
tree288d4ccd12fb19a2ae65210e6f5db621288db157 /src
parenta6f156a7b03e410c044ad96f1ba16645d451c083 (diff)
parentc163fd9260317adbb85a2274dab795a6a7f3061f (diff)
downloademacs-7d12c06725d733f1ea223f5fe55d506c71e44370.tar.gz
emacs-7d12c06725d733f1ea223f5fe55d506c71e44370.zip
Merge from origin/emacs-28
c163fd9260 (origin/emacs-28) Minor fixes for recent changes in ELisp ... fefada4816 Fix example in calc manual e74e17c1f0 Rewrites of Elisp manual including tab-bar and tab-line ch... 3b138917b7 ; * INSTALL: Fix typo. ce71446585 * lisp/tab-bar.el: Improve docstrings (bug#51247) ace4ce16a3 * lisp/tab-bar.el (tab-bar-mouse-move-tab): Don't drag tab... 04716ca48f Add tab-bar-drag-maybe for indication of tab dragging (bug... 81e3697600 * lisp/tab-bar.el: Add a new tab on [mouse-1] instead of [... a191d3c725 Add new and fix existing docstrings in tab-bar.el and tab-... 77dbaedadc Add tab bar support to the nextstep port 7b6fb486c2 Fix potential buffer overflow (bug#50767) ed9f5546aa Improve doc strings in tab-line.el 686a03ee22 More documentation fixes in tab-bar.el 35920791df Improve doc strings of tab-bar commands 2d15db6e89 Fix a semantic test on some macOS machines ac6ac76e3a Update to Org 9.5-57-g9bc3a2
Diffstat (limited to 'src')
-rw-r--r--src/image.c23
-rw-r--r--src/nsfns.m63
-rw-r--r--src/nsterm.h1
-rw-r--r--src/nsterm.m42
-rw-r--r--src/window.c25
-rw-r--r--src/xdisp.c12
6 files changed, 131 insertions, 35 deletions
diff --git a/src/image.c b/src/image.c
index 470409c6483..ff05741b2cd 100644
--- a/src/image.c
+++ b/src/image.c
@@ -9995,10 +9995,16 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
9995 if (!STRINGP (lcss)) 9995 if (!STRINGP (lcss))
9996 { 9996 {
9997 /* Generate the CSS for the SVG image. */ 9997 /* Generate the CSS for the SVG image. */
9998 const char *css_spec = "svg{font-family:\"%s\";font-size:%4dpx}"; 9998 /* FIXME: The below calculations leave enough space for a font
9999 int css_len = strlen (css_spec) + strlen (img->face_font_family); 9999 size up to 9999, if it overflows we just throw an error but
10000 should probably increase the buffer size. */
10001 const char *css_spec = "svg{font-family:\"%s\";font-size:%dpx}";
10002 int css_len = strlen (css_spec) + strlen (img->face_font_family) + 1;
10000 css = xmalloc (css_len); 10003 css = xmalloc (css_len);
10001 snprintf (css, css_len, css_spec, img->face_font_family, img->face_font_size); 10004 if (css_len <= snprintf (css, css_len, css_spec,
10005 img->face_font_family, img->face_font_size))
10006 goto rsvg_error;
10007
10002 rsvg_handle_set_stylesheet (rsvg_handle, (guint8 *)css, strlen (css), NULL); 10008 rsvg_handle_set_stylesheet (rsvg_handle, (guint8 *)css, strlen (css), NULL);
10003 } 10009 }
10004 else 10010 else
@@ -10156,12 +10162,11 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
10156 10162
10157 wrapped_contents = xmalloc (buffer_size); 10163 wrapped_contents = xmalloc (buffer_size);
10158 10164
10159 if (!wrapped_contents 10165 if (buffer_size <= snprintf (wrapped_contents, buffer_size, wrapper,
10160 || buffer_size <= snprintf (wrapped_contents, buffer_size, wrapper, 10166 foreground & 0xFFFFFF, width, height,
10161 foreground & 0xFFFFFF, width, height, 10167 viewbox_width, viewbox_height,
10162 viewbox_width, viewbox_height, 10168 background & 0xFFFFFF,
10163 background & 0xFFFFFF, 10169 SSDATA (encoded_contents)))
10164 SSDATA (encoded_contents)))
10165 goto rsvg_error; 10170 goto rsvg_error;
10166 10171
10167 wrapped_size = strlen (wrapped_contents); 10172 wrapped_size = strlen (wrapped_contents);
diff --git a/src/nsfns.m b/src/nsfns.m
index 906c5c934f5..797d0ce7820 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -609,13 +609,72 @@ ns_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
609 } 609 }
610} 610}
611 611
612void
613ns_change_tab_bar_height (struct frame *f, int height)
614{
615 int unit = FRAME_LINE_HEIGHT (f);
616 int old_height = FRAME_TAB_BAR_HEIGHT (f);
617 int lines = (height + unit - 1) / unit;
618 Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
619
620 /* Make sure we redisplay all windows in this frame. */
621 fset_redisplay (f);
622
623 /* Recalculate tab bar and frame text sizes. */
624 FRAME_TAB_BAR_HEIGHT (f) = height;
625 FRAME_TAB_BAR_LINES (f) = lines;
626 store_frame_param (f, Qtab_bar_lines, make_fixnum (lines));
627
628 if (FRAME_NS_WINDOW (f) && FRAME_TAB_BAR_HEIGHT (f) == 0)
629 {
630 clear_frame (f);
631 clear_current_matrices (f);
632 }
633
634 if ((height < old_height) && WINDOWP (f->tab_bar_window))
635 clear_glyph_matrix (XWINDOW (f->tab_bar_window)->current_matrix);
636
637 if (!f->tab_bar_resized)
638 {
639 /* As long as tab_bar_resized is false, effectively try to change
640 F's native height. */
641 if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
642 adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f),
643 1, false, Qtab_bar_lines);
644 else
645 adjust_frame_size (f, -1, -1, 4, false, Qtab_bar_lines);
646
647 f->tab_bar_resized = f->tab_bar_redisplayed;
648 }
649 else
650 /* Any other change may leave the native size of F alone. */
651 adjust_frame_size (f, -1, -1, 3, false, Qtab_bar_lines);
652
653 /* adjust_frame_size might not have done anything, garbage frame
654 here. */
655 adjust_frame_glyphs (f);
656 SET_FRAME_GARBAGED (f);
657}
612 658
613/* tabbar support */ 659/* tabbar support */
614static void 660static void
615ns_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) 661ns_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
616{ 662{
617 /* Currently unimplemented. */ 663 int olines = FRAME_TAB_BAR_LINES (f);
618 NSTRACE ("ns_set_tab_bar_lines"); 664 int nlines;
665
666 /* Treat tab bars like menu bars. */
667 if (FRAME_MINIBUF_ONLY_P (f))
668 return;
669
670 /* Use VALUE only if an int >= 0. */
671 if (RANGED_FIXNUMP (0, value, INT_MAX))
672 nlines = XFIXNAT (value);
673 else
674 nlines = 0;
675
676 if (nlines != olines && (olines == 0 || nlines == 0))
677 ns_change_tab_bar_height (f, nlines * FRAME_LINE_HEIGHT (f));
619} 678}
620 679
621 680
diff --git a/src/nsterm.h b/src/nsterm.h
index 46733e6949f..4bbcf43973a 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1136,6 +1136,7 @@ extern void ns_implicitly_set_name (struct frame *f, Lisp_Object arg,
1136 Lisp_Object oldval); 1136 Lisp_Object oldval);
1137extern void ns_set_scroll_bar_default_width (struct frame *f); 1137extern void ns_set_scroll_bar_default_width (struct frame *f);
1138extern void ns_set_scroll_bar_default_height (struct frame *f); 1138extern void ns_set_scroll_bar_default_height (struct frame *f);
1139extern void ns_change_tab_bar_height (struct frame *f, int height);
1139extern const char *ns_get_string_resource (void *_rdb, 1140extern const char *ns_get_string_resource (void *_rdb,
1140 const char *name, 1141 const char *name,
1141 const char *class); 1142 const char *class);
diff --git a/src/nsterm.m b/src/nsterm.m
index a6c2e7505b5..c6f80f80350 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2721,11 +2721,10 @@ ns_clear_under_internal_border (struct frame *f)
2721 2721
2722 if (FRAME_LIVE_P (f) && FRAME_INTERNAL_BORDER_WIDTH (f) > 0) 2722 if (FRAME_LIVE_P (f) && FRAME_INTERNAL_BORDER_WIDTH (f) > 0)
2723 { 2723 {
2724 int border_width = FRAME_INTERNAL_BORDER_WIDTH (f); 2724 int border = FRAME_INTERNAL_BORDER_WIDTH (f);
2725 NSView *view = FRAME_NS_VIEW (f); 2725 int width = FRAME_PIXEL_WIDTH (f);
2726 NSRect edge_rect, frame_rect = [view bounds]; 2726 int height = FRAME_PIXEL_HEIGHT (f);
2727 NSRectEdge edge[] = {NSMinXEdge, NSMinYEdge, NSMaxXEdge, NSMaxYEdge}; 2727 int margin = FRAME_TOP_MARGIN_HEIGHT (f);
2728
2729 int face_id = 2728 int face_id =
2730 (FRAME_PARENT_FRAME (f) 2729 (FRAME_PARENT_FRAME (f)
2731 ? (!NILP (Vface_remapping_alist) 2730 ? (!NILP (Vface_remapping_alist)
@@ -2747,12 +2746,12 @@ ns_clear_under_internal_border (struct frame *f)
2747 2746
2748 ns_focus (f, NULL, 1); 2747 ns_focus (f, NULL, 1);
2749 [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set]; 2748 [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set];
2750 for (int i = 0; i < 4 ; i++)
2751 {
2752 NSDivideRect (frame_rect, &edge_rect, &frame_rect, border_width, edge[i]);
2753 2749
2754 NSRectFill (edge_rect); 2750 NSRectFill (NSMakeRect (0, margin, width, border));
2755 } 2751 NSRectFill (NSMakeRect (0, 0, border, height));
2752 NSRectFill (NSMakeRect (0, margin, width, border));
2753 NSRectFill (NSMakeRect (width - border, 0, border, height));
2754 NSRectFill (NSMakeRect (0, height - border, width, border));
2756 ns_unfocus (f); 2755 ns_unfocus (f);
2757 } 2756 }
2758} 2757}
@@ -5066,6 +5065,7 @@ ns_create_terminal (struct ns_display_info *dpyinfo)
5066 terminal->free_pixmap = ns_free_pixmap; 5065 terminal->free_pixmap = ns_free_pixmap;
5067 terminal->delete_frame_hook = ns_destroy_window; 5066 terminal->delete_frame_hook = ns_destroy_window;
5068 terminal->delete_terminal_hook = ns_delete_terminal; 5067 terminal->delete_terminal_hook = ns_delete_terminal;
5068 terminal->change_tab_bar_height_hook = ns_change_tab_bar_height;
5069 /* Other hooks are NULL by default. */ 5069 /* Other hooks are NULL by default. */
5070 5070
5071 return terminal; 5071 return terminal;
@@ -6675,7 +6675,27 @@ not_in_argv (NSString *arg)
6675 } 6675 }
6676 else 6676 else
6677 { 6677 {
6678 emacs_event->kind = MOUSE_CLICK_EVENT; 6678 Lisp_Object tab_bar_arg = Qnil;
6679 bool tab_bar_p = false;
6680
6681 if (WINDOWP (emacsframe->tab_bar_window)
6682 && WINDOW_TOTAL_LINES (XWINDOW (emacsframe->tab_bar_window)))
6683 {
6684 Lisp_Object window;
6685 int x = lrint (p.x);
6686 int y = lrint (p.y);
6687
6688 window = window_from_coordinates (emacsframe, x, y, 0, true, true);
6689 tab_bar_p = EQ (window, emacsframe->tab_bar_window);
6690
6691 if (tab_bar_p)
6692 tab_bar_arg = handle_tab_bar_click (emacsframe, x, y, EV_UDMODIFIERS (theEvent) & down_modifier,
6693 EV_MODIFIERS (theEvent) | EV_UDMODIFIERS (theEvent));
6694 }
6695
6696 if (!(tab_bar_p && NILP (tab_bar_arg)))
6697 emacs_event->kind = MOUSE_CLICK_EVENT;
6698 emacs_event->arg = tab_bar_arg;
6679 emacs_event->code = EV_BUTTON (theEvent); 6699 emacs_event->code = EV_BUTTON (theEvent);
6680 emacs_event->modifiers = EV_MODIFIERS (theEvent) 6700 emacs_event->modifiers = EV_MODIFIERS (theEvent)
6681 | EV_UDMODIFIERS (theEvent); 6701 | EV_UDMODIFIERS (theEvent);
diff --git a/src/window.c b/src/window.c
index 9845fbb876b..e801ff821f1 100644
--- a/src/window.c
+++ b/src/window.c
@@ -765,6 +765,19 @@ selected one. */)
765{ 765{
766 return make_fixnum (decode_live_window (window)->use_time); 766 return make_fixnum (decode_live_window (window)->use_time);
767} 767}
768
769DEFUN ("window-bump-use-time", Fwindow_bump_use_time,
770 Swindow_bump_use_time, 0, 1, 0,
771 doc: /* Mark WINDOW as having been most recently used.
772WINDOW must be a live window and defaults to the selected one. */)
773 (Lisp_Object window)
774{
775 struct window *w = decode_live_window (window);
776
777 w->use_time = ++window_select_count;
778
779 return Qnil;
780}
768 781
769DEFUN ("window-pixel-width", Fwindow_pixel_width, Swindow_pixel_width, 0, 1, 0, 782DEFUN ("window-pixel-width", Fwindow_pixel_width, Swindow_pixel_width, 0, 1, 0,
770 doc: /* Return the width of window WINDOW in pixels. 783 doc: /* Return the width of window WINDOW in pixels.
@@ -8122,18 +8135,6 @@ and scrolling positions. */)
8122 return Qt; 8135 return Qt;
8123 return Qnil; 8136 return Qnil;
8124} 8137}
8125
8126DEFUN ("window-bump-use-time", Fwindow_bump_use_time,
8127 Swindow_bump_use_time, 1, 1, 0,
8128 doc: /* Mark WINDOW as having been recently used. */)
8129 (Lisp_Object window)
8130{
8131 struct window *w = decode_valid_window (window);
8132
8133 w->use_time = ++window_select_count;
8134 return Qnil;
8135}
8136
8137 8138
8138 8139
8139static void init_window_once_for_pdumper (void); 8140static void init_window_once_for_pdumper (void);
diff --git a/src/xdisp.c b/src/xdisp.c
index 783ef396a3e..578458bd248 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -33780,7 +33780,13 @@ note_mouse_highlight (struct frame *f, int x, int y)
33780 if (EQ (window, f->tab_bar_window)) 33780 if (EQ (window, f->tab_bar_window))
33781 { 33781 {
33782 note_tab_bar_highlight (f, x, y); 33782 note_tab_bar_highlight (f, x, y);
33783 return; 33783 if (tab_bar_drag_maybe)
33784 {
33785 cursor = FRAME_OUTPUT_DATA (f)->hand_cursor;
33786 goto set_cursor;
33787 }
33788 else
33789 return;
33784 } 33790 }
33785#endif 33791#endif
33786 33792
@@ -35910,6 +35916,10 @@ When nil, mouse-movement events will not be generated as long as the
35910mouse stays within the extent of a single glyph (except for images). */); 35916mouse stays within the extent of a single glyph (except for images). */);
35911 mouse_fine_grained_tracking = false; 35917 mouse_fine_grained_tracking = false;
35912 35918
35919 DEFVAR_BOOL ("tab-bar-drag-maybe", tab_bar_drag_maybe,
35920 doc: /* Non-nil when maybe dragging tab bar item. */);
35921 tab_bar_drag_maybe = false;
35922
35913 DEFVAR_BOOL ("redisplay-skip-initial-frame", redisplay_skip_initial_frame, 35923 DEFVAR_BOOL ("redisplay-skip-initial-frame", redisplay_skip_initial_frame,
35914 doc: /* Non-nil to skip redisplay in initial frame. 35924 doc: /* Non-nil to skip redisplay in initial frame.
35915The initial frame is not displayed anywhere, so skipping it is 35925The initial frame is not displayed anywhere, so skipping it is