aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2023-01-02 17:02:05 +0200
committerEli Zaretskii2023-01-02 17:02:05 +0200
commitd26b523886ee52548648ca660fc2933eadf49a55 (patch)
treee0cfdf398692587094e50e04bcb98b5f02ebd581 /src
parent3f7ea621b9008bc507048ee23466f3259b6b620d (diff)
downloademacs-d26b523886ee52548648ca660fc2933eadf49a55.tar.gz
emacs-d26b523886ee52548648ca660fc2933eadf49a55.zip
Fix shrinking of the tab-bar
* src/haikufns.c (haiku_change_tab_bar_height): * src/pgtkfns.c (pgtk_change_tab_bar_height): * src/nsfns.m (ns_change_tab_bar_height): * src/w32fns.c (w32_change_tab_bar_height): * src/xfns.c (x_change_tab_bar_height): Don't let the number of tab-bar lines degenerate to zero due to integer division. (Bug#60210)
Diffstat (limited to 'src')
-rw-r--r--src/haikufns.c14
-rw-r--r--src/nsfns.m14
-rw-r--r--src/pgtkfns.c14
-rw-r--r--src/w32fns.c14
-rw-r--r--src/xfns.c14
5 files changed, 35 insertions, 35 deletions
diff --git a/src/haikufns.c b/src/haikufns.c
index 59332346dab..b591c143900 100644
--- a/src/haikufns.c
+++ b/src/haikufns.c
@@ -175,19 +175,17 @@ haiku_change_tool_bar_height (struct frame *f, int height)
175void 175void
176haiku_change_tab_bar_height (struct frame *f, int height) 176haiku_change_tab_bar_height (struct frame *f, int height)
177{ 177{
178 int unit, old_height, lines; 178 int unit = FRAME_LINE_HEIGHT (f);
179 Lisp_Object fullscreen; 179 int old_height = FRAME_TAB_BAR_HEIGHT (f);
180
181 unit = FRAME_LINE_HEIGHT (f);
182 old_height = FRAME_TAB_BAR_HEIGHT (f);
183 fullscreen = get_frame_param (f, Qfullscreen);
184 180
185 /* This differs from the tool bar code in that the tab bar height is 181 /* This differs from the tool bar code in that the tab bar height is
186 not rounded up. Otherwise, if redisplay_tab_bar decides to grow 182 not rounded up. Otherwise, if redisplay_tab_bar decides to grow
187 the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed, 183 the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
188 leading to the tab bar height being incorrectly set upon the next 184 leading to the tab bar height being incorrectly set upon the next
189 call to x_set_font. (bug#59285) */ 185 call to x_set_font. (bug#59285) */
190 lines = height / unit; 186 int lines = height / unit;
187 if (lines == 0 && height != 0)
188 lines = 1;
191 189
192 /* Make sure we redisplay all windows in this frame. */ 190 /* Make sure we redisplay all windows in this frame. */
193 fset_redisplay (f); 191 fset_redisplay (f);
@@ -208,6 +206,8 @@ haiku_change_tab_bar_height (struct frame *f, int height)
208 206
209 if (!f->tab_bar_resized) 207 if (!f->tab_bar_resized)
210 { 208 {
209 Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
210
211 /* As long as tab_bar_resized is false, effectively try to change 211 /* As long as tab_bar_resized is false, effectively try to change
212 F's native height. */ 212 F's native height. */
213 if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth)) 213 if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
diff --git a/src/nsfns.m b/src/nsfns.m
index 8c78657db50..8804a7df7cf 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -632,19 +632,17 @@ ns_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
632void 632void
633ns_change_tab_bar_height (struct frame *f, int height) 633ns_change_tab_bar_height (struct frame *f, int height)
634{ 634{
635 int unit, old_height, lines; 635 int unit = FRAME_LINE_HEIGHT (f);
636 Lisp_Object fullscreen; 636 int old_height = FRAME_TAB_BAR_HEIGHT (f);
637
638 unit = FRAME_LINE_HEIGHT (f);
639 old_height = FRAME_TAB_BAR_HEIGHT (f);
640 fullscreen = get_frame_param (f, Qfullscreen);
641 637
642 /* This differs from the tool bar code in that the tab bar height is 638 /* This differs from the tool bar code in that the tab bar height is
643 not rounded up. Otherwise, if redisplay_tab_bar decides to grow 639 not rounded up. Otherwise, if redisplay_tab_bar decides to grow
644 the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed, 640 the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
645 leading to the tab bar height being incorrectly set upon the next 641 leading to the tab bar height being incorrectly set upon the next
646 call to x_set_font. (bug#59285) */ 642 call to x_set_font. (bug#59285) */
647 lines = height / unit; 643 int lines = height / unit;
644 if (lines == 0 && height != 0)
645 lines = 1;
648 646
649 /* Make sure we redisplay all windows in this frame. */ 647 /* Make sure we redisplay all windows in this frame. */
650 fset_redisplay (f); 648 fset_redisplay (f);
@@ -665,6 +663,8 @@ ns_change_tab_bar_height (struct frame *f, int height)
665 663
666 if (!f->tab_bar_resized) 664 if (!f->tab_bar_resized)
667 { 665 {
666 Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
667
668 /* As long as tab_bar_resized is false, effectively try to change 668 /* As long as tab_bar_resized is false, effectively try to change
669 F's native height. */ 669 F's native height. */
670 if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth)) 670 if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index 57591d2693c..6b3a0459d36 100644
--- a/src/pgtkfns.c
+++ b/src/pgtkfns.c
@@ -473,19 +473,17 @@ pgtk_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
473void 473void
474pgtk_change_tab_bar_height (struct frame *f, int height) 474pgtk_change_tab_bar_height (struct frame *f, int height)
475{ 475{
476 int unit, old_height, lines; 476 int unit = FRAME_LINE_HEIGHT (f);
477 Lisp_Object fullscreen; 477 int old_height = FRAME_TAB_BAR_HEIGHT (f);
478
479 unit = FRAME_LINE_HEIGHT (f);
480 old_height = FRAME_TAB_BAR_HEIGHT (f);
481 fullscreen = get_frame_param (f, Qfullscreen);
482 478
483 /* This differs from the tool bar code in that the tab bar height is 479 /* This differs from the tool bar code in that the tab bar height is
484 not rounded up. Otherwise, if redisplay_tab_bar decides to grow 480 not rounded up. Otherwise, if redisplay_tab_bar decides to grow
485 the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed, 481 the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
486 leading to the tab bar height being incorrectly set upon the next 482 leading to the tab bar height being incorrectly set upon the next
487 call to x_set_font. (bug#59285) */ 483 call to x_set_font. (bug#59285) */
488 lines = height / unit; 484 int lines = height / unit;
485 if (lines == 0 && height != 0)
486 lines = 1;
489 487
490 /* Make sure we redisplay all windows in this frame. */ 488 /* Make sure we redisplay all windows in this frame. */
491 fset_redisplay (f); 489 fset_redisplay (f);
@@ -506,6 +504,8 @@ pgtk_change_tab_bar_height (struct frame *f, int height)
506 504
507 if (!f->tab_bar_resized) 505 if (!f->tab_bar_resized)
508 { 506 {
507 Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
508
509 /* As long as tab_bar_resized is false, effectively try to change 509 /* As long as tab_bar_resized is false, effectively try to change
510 F's native height. */ 510 F's native height. */
511 if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth)) 511 if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
diff --git a/src/w32fns.c b/src/w32fns.c
index 9d02e680fe8..192d3ddf27a 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1717,19 +1717,17 @@ w32_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1717void 1717void
1718w32_change_tab_bar_height (struct frame *f, int height) 1718w32_change_tab_bar_height (struct frame *f, int height)
1719{ 1719{
1720 int unit, old_height, lines; 1720 int unit = FRAME_LINE_HEIGHT (f);
1721 Lisp_Object fullscreen; 1721 int old_height = FRAME_TAB_BAR_HEIGHT (f);
1722
1723 unit = FRAME_LINE_HEIGHT (f);
1724 old_height = FRAME_TAB_BAR_HEIGHT (f);
1725 fullscreen = get_frame_param (f, Qfullscreen);
1726 1722
1727 /* This differs from the tool bar code in that the tab bar height is 1723 /* This differs from the tool bar code in that the tab bar height is
1728 not rounded up. Otherwise, if redisplay_tab_bar decides to grow 1724 not rounded up. Otherwise, if redisplay_tab_bar decides to grow
1729 the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed, 1725 the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
1730 leading to the tab bar height being incorrectly set upon the next 1726 leading to the tab bar height being incorrectly set upon the next
1731 call to x_set_font. (bug#59285) */ 1727 call to x_set_font. (bug#59285) */
1732 lines = height / unit; 1728 int lines = height / unit;
1729 if (lines == 0 && height != 0)
1730 lines = 1;
1733 1731
1734 /* Make sure we redisplay all windows in this frame. */ 1732 /* Make sure we redisplay all windows in this frame. */
1735 fset_redisplay (f); 1733 fset_redisplay (f);
@@ -1758,6 +1756,8 @@ w32_change_tab_bar_height (struct frame *f, int height)
1758 1756
1759 if (!f->tab_bar_resized) 1757 if (!f->tab_bar_resized)
1760 { 1758 {
1759 Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
1760
1761 /* As long as tab_bar_resized is false, effectively try to change 1761 /* As long as tab_bar_resized is false, effectively try to change
1762 F's native height. */ 1762 F's native height. */
1763 if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth)) 1763 if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
diff --git a/src/xfns.c b/src/xfns.c
index a1984f9e8f8..528ae61ca32 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1758,19 +1758,17 @@ x_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1758void 1758void
1759x_change_tab_bar_height (struct frame *f, int height) 1759x_change_tab_bar_height (struct frame *f, int height)
1760{ 1760{
1761 int unit, old_height, lines; 1761 int unit = FRAME_LINE_HEIGHT (f);
1762 Lisp_Object fullscreen; 1762 int old_height = FRAME_TAB_BAR_HEIGHT (f);
1763
1764 unit = FRAME_LINE_HEIGHT (f);
1765 old_height = FRAME_TAB_BAR_HEIGHT (f);
1766 fullscreen = get_frame_param (f, Qfullscreen);
1767 1763
1768 /* This differs from the tool bar code in that the tab bar height is 1764 /* This differs from the tool bar code in that the tab bar height is
1769 not rounded up. Otherwise, if redisplay_tab_bar decides to grow 1765 not rounded up. Otherwise, if redisplay_tab_bar decides to grow
1770 the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed, 1766 the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
1771 leading to the tab bar height being incorrectly set upon the next 1767 leading to the tab bar height being incorrectly set upon the next
1772 call to x_set_font. (bug#59285) */ 1768 call to x_set_font. (bug#59285) */
1773 lines = height / unit; 1769 int lines = height / unit;
1770 if (lines == 0 && height != 0)
1771 lines = 1;
1774 1772
1775 /* Make sure we redisplay all windows in this frame. */ 1773 /* Make sure we redisplay all windows in this frame. */
1776 fset_redisplay (f); 1774 fset_redisplay (f);
@@ -1791,6 +1789,8 @@ x_change_tab_bar_height (struct frame *f, int height)
1791 1789
1792 if (!f->tab_bar_resized) 1790 if (!f->tab_bar_resized)
1793 { 1791 {
1792 Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
1793
1794 /* As long as tab_bar_resized is false, effectively try to change 1794 /* As long as tab_bar_resized is false, effectively try to change
1795 F's native height. */ 1795 F's native height. */
1796 if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth)) 1796 if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))