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)
This commit is contained in:
parent
3f7ea621b9
commit
d26b523886
5 changed files with 35 additions and 35 deletions
|
@ -175,19 +175,17 @@ haiku_change_tool_bar_height (struct frame *f, int height)
|
||||||
void
|
void
|
||||||
haiku_change_tab_bar_height (struct frame *f, int height)
|
haiku_change_tab_bar_height (struct frame *f, int height)
|
||||||
{
|
{
|
||||||
int unit, old_height, lines;
|
int unit = FRAME_LINE_HEIGHT (f);
|
||||||
Lisp_Object fullscreen;
|
int old_height = FRAME_TAB_BAR_HEIGHT (f);
|
||||||
|
|
||||||
unit = FRAME_LINE_HEIGHT (f);
|
|
||||||
old_height = FRAME_TAB_BAR_HEIGHT (f);
|
|
||||||
fullscreen = get_frame_param (f, Qfullscreen);
|
|
||||||
|
|
||||||
/* This differs from the tool bar code in that the tab bar height is
|
/* This differs from the tool bar code in that the tab bar height is
|
||||||
not rounded up. Otherwise, if redisplay_tab_bar decides to grow
|
not rounded up. Otherwise, if redisplay_tab_bar decides to grow
|
||||||
the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
|
the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
|
||||||
leading to the tab bar height being incorrectly set upon the next
|
leading to the tab bar height being incorrectly set upon the next
|
||||||
call to x_set_font. (bug#59285) */
|
call to x_set_font. (bug#59285) */
|
||||||
lines = height / unit;
|
int lines = height / unit;
|
||||||
|
if (lines == 0 && height != 0)
|
||||||
|
lines = 1;
|
||||||
|
|
||||||
/* Make sure we redisplay all windows in this frame. */
|
/* Make sure we redisplay all windows in this frame. */
|
||||||
fset_redisplay (f);
|
fset_redisplay (f);
|
||||||
|
@ -208,6 +206,8 @@ haiku_change_tab_bar_height (struct frame *f, int height)
|
||||||
|
|
||||||
if (!f->tab_bar_resized)
|
if (!f->tab_bar_resized)
|
||||||
{
|
{
|
||||||
|
Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
|
||||||
|
|
||||||
/* As long as tab_bar_resized is false, effectively try to change
|
/* As long as tab_bar_resized is false, effectively try to change
|
||||||
F's native height. */
|
F's native height. */
|
||||||
if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
|
if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
|
||||||
|
|
14
src/nsfns.m
14
src/nsfns.m
|
@ -632,19 +632,17 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side.
|
||||||
void
|
void
|
||||||
ns_change_tab_bar_height (struct frame *f, int height)
|
ns_change_tab_bar_height (struct frame *f, int height)
|
||||||
{
|
{
|
||||||
int unit, old_height, lines;
|
int unit = FRAME_LINE_HEIGHT (f);
|
||||||
Lisp_Object fullscreen;
|
int old_height = FRAME_TAB_BAR_HEIGHT (f);
|
||||||
|
|
||||||
unit = FRAME_LINE_HEIGHT (f);
|
|
||||||
old_height = FRAME_TAB_BAR_HEIGHT (f);
|
|
||||||
fullscreen = get_frame_param (f, Qfullscreen);
|
|
||||||
|
|
||||||
/* This differs from the tool bar code in that the tab bar height is
|
/* This differs from the tool bar code in that the tab bar height is
|
||||||
not rounded up. Otherwise, if redisplay_tab_bar decides to grow
|
not rounded up. Otherwise, if redisplay_tab_bar decides to grow
|
||||||
the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
|
the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
|
||||||
leading to the tab bar height being incorrectly set upon the next
|
leading to the tab bar height being incorrectly set upon the next
|
||||||
call to x_set_font. (bug#59285) */
|
call to x_set_font. (bug#59285) */
|
||||||
lines = height / unit;
|
int lines = height / unit;
|
||||||
|
if (lines == 0 && height != 0)
|
||||||
|
lines = 1;
|
||||||
|
|
||||||
/* Make sure we redisplay all windows in this frame. */
|
/* Make sure we redisplay all windows in this frame. */
|
||||||
fset_redisplay (f);
|
fset_redisplay (f);
|
||||||
|
@ -665,6 +663,8 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side.
|
||||||
|
|
||||||
if (!f->tab_bar_resized)
|
if (!f->tab_bar_resized)
|
||||||
{
|
{
|
||||||
|
Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
|
||||||
|
|
||||||
/* As long as tab_bar_resized is false, effectively try to change
|
/* As long as tab_bar_resized is false, effectively try to change
|
||||||
F's native height. */
|
F's native height. */
|
||||||
if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
|
if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
|
||||||
|
|
|
@ -473,19 +473,17 @@ pgtk_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
|
||||||
void
|
void
|
||||||
pgtk_change_tab_bar_height (struct frame *f, int height)
|
pgtk_change_tab_bar_height (struct frame *f, int height)
|
||||||
{
|
{
|
||||||
int unit, old_height, lines;
|
int unit = FRAME_LINE_HEIGHT (f);
|
||||||
Lisp_Object fullscreen;
|
int old_height = FRAME_TAB_BAR_HEIGHT (f);
|
||||||
|
|
||||||
unit = FRAME_LINE_HEIGHT (f);
|
|
||||||
old_height = FRAME_TAB_BAR_HEIGHT (f);
|
|
||||||
fullscreen = get_frame_param (f, Qfullscreen);
|
|
||||||
|
|
||||||
/* This differs from the tool bar code in that the tab bar height is
|
/* This differs from the tool bar code in that the tab bar height is
|
||||||
not rounded up. Otherwise, if redisplay_tab_bar decides to grow
|
not rounded up. Otherwise, if redisplay_tab_bar decides to grow
|
||||||
the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
|
the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
|
||||||
leading to the tab bar height being incorrectly set upon the next
|
leading to the tab bar height being incorrectly set upon the next
|
||||||
call to x_set_font. (bug#59285) */
|
call to x_set_font. (bug#59285) */
|
||||||
lines = height / unit;
|
int lines = height / unit;
|
||||||
|
if (lines == 0 && height != 0)
|
||||||
|
lines = 1;
|
||||||
|
|
||||||
/* Make sure we redisplay all windows in this frame. */
|
/* Make sure we redisplay all windows in this frame. */
|
||||||
fset_redisplay (f);
|
fset_redisplay (f);
|
||||||
|
@ -506,6 +504,8 @@ pgtk_change_tab_bar_height (struct frame *f, int height)
|
||||||
|
|
||||||
if (!f->tab_bar_resized)
|
if (!f->tab_bar_resized)
|
||||||
{
|
{
|
||||||
|
Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
|
||||||
|
|
||||||
/* As long as tab_bar_resized is false, effectively try to change
|
/* As long as tab_bar_resized is false, effectively try to change
|
||||||
F's native height. */
|
F's native height. */
|
||||||
if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
|
if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
|
||||||
|
|
14
src/w32fns.c
14
src/w32fns.c
|
@ -1717,19 +1717,17 @@ w32_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
|
||||||
void
|
void
|
||||||
w32_change_tab_bar_height (struct frame *f, int height)
|
w32_change_tab_bar_height (struct frame *f, int height)
|
||||||
{
|
{
|
||||||
int unit, old_height, lines;
|
int unit = FRAME_LINE_HEIGHT (f);
|
||||||
Lisp_Object fullscreen;
|
int old_height = FRAME_TAB_BAR_HEIGHT (f);
|
||||||
|
|
||||||
unit = FRAME_LINE_HEIGHT (f);
|
|
||||||
old_height = FRAME_TAB_BAR_HEIGHT (f);
|
|
||||||
fullscreen = get_frame_param (f, Qfullscreen);
|
|
||||||
|
|
||||||
/* This differs from the tool bar code in that the tab bar height is
|
/* This differs from the tool bar code in that the tab bar height is
|
||||||
not rounded up. Otherwise, if redisplay_tab_bar decides to grow
|
not rounded up. Otherwise, if redisplay_tab_bar decides to grow
|
||||||
the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
|
the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
|
||||||
leading to the tab bar height being incorrectly set upon the next
|
leading to the tab bar height being incorrectly set upon the next
|
||||||
call to x_set_font. (bug#59285) */
|
call to x_set_font. (bug#59285) */
|
||||||
lines = height / unit;
|
int lines = height / unit;
|
||||||
|
if (lines == 0 && height != 0)
|
||||||
|
lines = 1;
|
||||||
|
|
||||||
/* Make sure we redisplay all windows in this frame. */
|
/* Make sure we redisplay all windows in this frame. */
|
||||||
fset_redisplay (f);
|
fset_redisplay (f);
|
||||||
|
@ -1758,6 +1756,8 @@ w32_change_tab_bar_height (struct frame *f, int height)
|
||||||
|
|
||||||
if (!f->tab_bar_resized)
|
if (!f->tab_bar_resized)
|
||||||
{
|
{
|
||||||
|
Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
|
||||||
|
|
||||||
/* As long as tab_bar_resized is false, effectively try to change
|
/* As long as tab_bar_resized is false, effectively try to change
|
||||||
F's native height. */
|
F's native height. */
|
||||||
if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
|
if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
|
||||||
|
|
14
src/xfns.c
14
src/xfns.c
|
@ -1758,19 +1758,17 @@ x_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
|
||||||
void
|
void
|
||||||
x_change_tab_bar_height (struct frame *f, int height)
|
x_change_tab_bar_height (struct frame *f, int height)
|
||||||
{
|
{
|
||||||
int unit, old_height, lines;
|
int unit = FRAME_LINE_HEIGHT (f);
|
||||||
Lisp_Object fullscreen;
|
int old_height = FRAME_TAB_BAR_HEIGHT (f);
|
||||||
|
|
||||||
unit = FRAME_LINE_HEIGHT (f);
|
|
||||||
old_height = FRAME_TAB_BAR_HEIGHT (f);
|
|
||||||
fullscreen = get_frame_param (f, Qfullscreen);
|
|
||||||
|
|
||||||
/* This differs from the tool bar code in that the tab bar height is
|
/* This differs from the tool bar code in that the tab bar height is
|
||||||
not rounded up. Otherwise, if redisplay_tab_bar decides to grow
|
not rounded up. Otherwise, if redisplay_tab_bar decides to grow
|
||||||
the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
|
the tab bar by even 1 pixel, FRAME_TAB_BAR_LINES will be changed,
|
||||||
leading to the tab bar height being incorrectly set upon the next
|
leading to the tab bar height being incorrectly set upon the next
|
||||||
call to x_set_font. (bug#59285) */
|
call to x_set_font. (bug#59285) */
|
||||||
lines = height / unit;
|
int lines = height / unit;
|
||||||
|
if (lines == 0 && height != 0)
|
||||||
|
lines = 1;
|
||||||
|
|
||||||
/* Make sure we redisplay all windows in this frame. */
|
/* Make sure we redisplay all windows in this frame. */
|
||||||
fset_redisplay (f);
|
fset_redisplay (f);
|
||||||
|
@ -1791,6 +1789,8 @@ x_change_tab_bar_height (struct frame *f, int height)
|
||||||
|
|
||||||
if (!f->tab_bar_resized)
|
if (!f->tab_bar_resized)
|
||||||
{
|
{
|
||||||
|
Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
|
||||||
|
|
||||||
/* As long as tab_bar_resized is false, effectively try to change
|
/* As long as tab_bar_resized is false, effectively try to change
|
||||||
F's native height. */
|
F's native height. */
|
||||||
if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
|
if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue