aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2021-02-06 18:22:29 +0100
committerMartin Rudalics2021-02-06 18:22:29 +0100
commit29e9cf291eb35a77ad782e56effddf2fa00ee96c (patch)
tree24af9288415937b1ef1cfef2fa40de7cb8a800ef
parentc0d504eb7e0922be9f9ec6d9b7f1a27c5fc31b33 (diff)
downloademacs-29e9cf291eb35a77ad782e56effddf2fa00ee96c.tar.gz
emacs-29e9cf291eb35a77ad782e56effddf2fa00ee96c.zip
Permit zero value for 'child-frame-border-width' parameter (Bug#46184)
* doc/lispref/frames.texi (Layout Parameters): Update entry on 'child-frame-border-width' parameter. * src/frame.c (make_frame): Init child_frame_border_width to -1. (Fframe_child_frame_border_width): Return internal border width if child frame border width parameter is nil. (gui_report_frame_params): Report nil as child frame border width parameter if the frame value is negative. * src/frame.h (FRAME_INTERNAL_BORDER_WIDTH): Return value of child frame border width only if it is not negative. * src/xfns.c (Fx_create_frame): Default child frame border to -1 when recording it in its frame slot via gui_default_parameter. * src/nsfns.m (ns_set_child_frame_border_width): Handle nil ARG. (Fx_create_frame): Default child frame border width parameter to nil. * src/w32fns.c (w32_set_child_frame_border_width): Handle nil ARG. (Fx_create_frame): Default child frame border width parameter to nil. * src/xfns.c (x_set_child_frame_border_width): Handle nil ARG. (Fx_create_frame): Default child frame border width parameter to nil.
-rw-r--r--doc/lispref/frames.texi2
-rw-r--r--src/frame.c16
-rw-r--r--src/frame.h10
-rw-r--r--src/nsfns.m25
-rw-r--r--src/w32fns.c30
-rw-r--r--src/xfns.c36
6 files changed, 71 insertions, 48 deletions
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index a15511dc9f5..f4316b753d8 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1802,6 +1802,8 @@ Geometry}).
1802@item child-frame-border-width 1802@item child-frame-border-width
1803The width in pixels of the frame's internal border (@pxref{Frame 1803The width in pixels of the frame's internal border (@pxref{Frame
1804Geometry}) if the given frame is a child frame (@pxref{Child Frames}). 1804Geometry}) if the given frame is a child frame (@pxref{Child Frames}).
1805If this is @code{nil}, the value specified by the
1806@code{internal-border-width} parameter is used instead.
1805 1807
1806@vindex vertical-scroll-bars@r{, a frame parameter} 1808@vindex vertical-scroll-bars@r{, a frame parameter}
1807@item vertical-scroll-bars 1809@item vertical-scroll-bars
diff --git a/src/frame.c b/src/frame.c
index a2167ce1e49..635fc945604 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -898,6 +898,7 @@ make_frame (bool mini_p)
898 f->no_accept_focus = false; 898 f->no_accept_focus = false;
899 f->z_group = z_group_none; 899 f->z_group = z_group_none;
900 f->tooltip = false; 900 f->tooltip = false;
901 f->child_frame_border_width = -1;
901 f->last_tab_bar_item = -1; 902 f->last_tab_bar_item = -1;
902#ifndef HAVE_EXT_TOOL_BAR 903#ifndef HAVE_EXT_TOOL_BAR
903 f->last_tool_bar_item = -1; 904 f->last_tool_bar_item = -1;
@@ -3544,10 +3545,17 @@ DEFUN ("frame-fringe-width", Ffringe_width, Sfringe_width, 0, 1, 0,
3544} 3545}
3545 3546
3546DEFUN ("frame-child-frame-border-width", Fframe_child_frame_border_width, Sframe_child_frame_border_width, 0, 1, 0, 3547DEFUN ("frame-child-frame-border-width", Fframe_child_frame_border_width, Sframe_child_frame_border_width, 0, 1, 0,
3547 doc: /* Return width of FRAME's child-frame border in pixels. */) 3548 doc: /* Return width of FRAME's child-frame border in pixels.
3549 If FRAME's 'child-frame-border-width' parameter is nil, return FRAME's
3550 internal border width instead. */)
3548 (Lisp_Object frame) 3551 (Lisp_Object frame)
3549{ 3552{
3550 return make_fixnum (FRAME_CHILD_FRAME_BORDER_WIDTH (decode_any_frame (frame))); 3553 int width = FRAME_CHILD_FRAME_BORDER_WIDTH (decode_any_frame (frame));
3554
3555 if (width < 0)
3556 return make_fixnum (FRAME_INTERNAL_BORDER_WIDTH (decode_any_frame (frame)));
3557 else
3558 return make_fixnum (FRAME_CHILD_FRAME_BORDER_WIDTH (decode_any_frame (frame)));
3551} 3559}
3552 3560
3553DEFUN ("frame-internal-border-width", Fframe_internal_border_width, Sframe_internal_border_width, 0, 1, 0, 3561DEFUN ("frame-internal-border-width", Fframe_internal_border_width, Sframe_internal_border_width, 0, 1, 0,
@@ -4311,7 +4319,9 @@ gui_report_frame_params (struct frame *f, Lisp_Object *alistptr)
4311 store_in_alist (alistptr, Qborder_width, 4319 store_in_alist (alistptr, Qborder_width,
4312 make_fixnum (f->border_width)); 4320 make_fixnum (f->border_width));
4313 store_in_alist (alistptr, Qchild_frame_border_width, 4321 store_in_alist (alistptr, Qchild_frame_border_width,
4314 make_fixnum (FRAME_CHILD_FRAME_BORDER_WIDTH (f))); 4322 FRAME_CHILD_FRAME_BORDER_WIDTH (f) >= 0
4323 ? make_fixnum (FRAME_CHILD_FRAME_BORDER_WIDTH (f))
4324 : Qnil);
4315 store_in_alist (alistptr, Qinternal_border_width, 4325 store_in_alist (alistptr, Qinternal_border_width,
4316 make_fixnum (FRAME_INTERNAL_BORDER_WIDTH (f))); 4326 make_fixnum (FRAME_INTERNAL_BORDER_WIDTH (f)));
4317 store_in_alist (alistptr, Qright_divider_width, 4327 store_in_alist (alistptr, Qright_divider_width,
diff --git a/src/frame.h b/src/frame.h
index 21148fe94c9..9ddcb4c6810 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1449,11 +1449,11 @@ INLINE int
1449FRAME_INTERNAL_BORDER_WIDTH (struct frame *f) 1449FRAME_INTERNAL_BORDER_WIDTH (struct frame *f)
1450{ 1450{
1451#ifdef HAVE_WINDOW_SYSTEM 1451#ifdef HAVE_WINDOW_SYSTEM
1452 return FRAME_PARENT_FRAME(f) 1452 return (FRAME_PARENT_FRAME(f)
1453 ? (f->child_frame_border_width 1453 ? (FRAME_CHILD_FRAME_BORDER_WIDTH(f) >= 0
1454 ? FRAME_CHILD_FRAME_BORDER_WIDTH(f) 1454 ? FRAME_CHILD_FRAME_BORDER_WIDTH(f)
1455 : frame_dimension (f->internal_border_width)) 1455 : frame_dimension (f->internal_border_width))
1456 : frame_dimension (f->internal_border_width); 1456 : frame_dimension (f->internal_border_width));
1457#else 1457#else
1458 return frame_dimension (f->internal_border_width); 1458 return frame_dimension (f->internal_border_width);
1459#endif 1459#endif
diff --git a/src/nsfns.m b/src/nsfns.m
index c7857eac731..5c4cc915e7c 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -690,17 +690,24 @@ ns_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
690static void 690static void
691ns_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 691ns_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
692{ 692{
693 int old_width = FRAME_CHILD_FRAME_BORDER_WIDTH (f); 693 int border;
694 int new_width = check_int_nonnegative (arg);
695 694
696 if (new_width == old_width) 695 if (NILP (arg))
697 return; 696 border = -1;
698 f->child_frame_border_width = new_width; 697 else if (RANGED_FIXNUMP (0, arg, INT_MAX))
698 border = XFIXNAT (arg);
699 else
700 signal_error ("Invalid child frame border width", arg);
699 701
700 if (FRAME_NATIVE_WINDOW (f) != 0) 702 if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f))
701 adjust_frame_size (f, -1, -1, 3, 0, Qchild_frame_border_width); 703 {
704 f->child_frame_border_width = border;
702 705
703 SET_FRAME_GARBAGED (f); 706 if (FRAME_NATIVE_WINDOW (f) != 0)
707 adjust_frame_size (f, -1, -1, 3, 0, Qchild_frame_border_width);
708
709 SET_FRAME_GARBAGED (f);
710 }
704} 711}
705 712
706static void 713static void
@@ -1213,7 +1220,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
1213 gui_default_parameter (f, parms, Qinternal_border_width, make_fixnum (2), 1220 gui_default_parameter (f, parms, Qinternal_border_width, make_fixnum (2),
1214 "internalBorderWidth", "InternalBorderWidth", 1221 "internalBorderWidth", "InternalBorderWidth",
1215 RES_TYPE_NUMBER); 1222 RES_TYPE_NUMBER);
1216 gui_default_parameter (f, parms, Qchild_frame_border_width, make_fixnum (2), 1223 gui_default_parameter (f, parms, Qchild_frame_border_width, Qnil,
1217 "childFrameBorderWidth", "childFrameBorderWidth", 1224 "childFrameBorderWidth", "childFrameBorderWidth",
1218 RES_TYPE_NUMBER); 1225 RES_TYPE_NUMBER);
1219 gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0), 1226 gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0),
diff --git a/src/w32fns.c b/src/w32fns.c
index 5704f1d3c33..86c3db64e7b 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1561,8 +1561,14 @@ w32_clear_under_internal_border (struct frame *f)
1561static void 1561static void
1562w32_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 1562w32_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1563{ 1563{
1564 int argval = check_integer_range (arg, INT_MIN, INT_MAX); 1564 int border;
1565 int border = max (argval, 0); 1565
1566 if (NILP (arg))
1567 border = -1;
1568 else if (RANGED_FIXNUMP (0, arg, INT_MAX))
1569 border = XFIXNAT (arg);
1570 else
1571 signal_error ("Invalid child frame border width", arg);
1566 1572
1567 if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f)) 1573 if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f))
1568 { 1574 {
@@ -5896,37 +5902,33 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
5896 Lisp_Object value; 5902 Lisp_Object value;
5897 5903
5898 value = gui_display_get_arg (dpyinfo, parameters, Qinternal_border_width, 5904 value = gui_display_get_arg (dpyinfo, parameters, Qinternal_border_width,
5899 "internalBorder", "InternalBorder", 5905 "internalBorder", "internalBorder",
5900 RES_TYPE_NUMBER); 5906 RES_TYPE_NUMBER);
5901 if (! EQ (value, Qunbound)) 5907 if (! EQ (value, Qunbound))
5902 parameters = Fcons (Fcons (Qinternal_border_width, value), 5908 parameters = Fcons (Fcons (Qinternal_border_width, value),
5903 parameters); 5909 parameters);
5904 } 5910 }
5905 5911
5912 gui_default_parameter (f, parameters, Qinternal_border_width, make_fixnum (0),
5913 "internalBorderWidth", "internalBorderWidth",
5914 RES_TYPE_NUMBER);
5915
5906 /* Same for child frames. */ 5916 /* Same for child frames. */
5907 if (NILP (Fassq (Qchild_frame_border_width, parameters))) 5917 if (NILP (Fassq (Qchild_frame_border_width, parameters)))
5908 { 5918 {
5909 Lisp_Object value; 5919 Lisp_Object value;
5910 5920
5911 value = gui_display_get_arg (dpyinfo, parameters, Qchild_frame_border_width, 5921 value = gui_display_get_arg (dpyinfo, parameters, Qchild_frame_border_width,
5912 "childFrameBorderWidth", "childFrameBorderWidth", 5922 "childFrameBorder", "childFrameBorder",
5913 RES_TYPE_NUMBER); 5923 RES_TYPE_NUMBER);
5914 if (! EQ (value, Qunbound)) 5924 if (!EQ (value, Qunbound))
5915 parameters = Fcons (Fcons (Qchild_frame_border_width, value), 5925 parameters = Fcons (Fcons (Qchild_frame_border_width, value),
5916 parameters); 5926 parameters);
5917
5918 } 5927 }
5919 5928
5920 gui_default_parameter (f, parameters, Qchild_frame_border_width, 5929 gui_default_parameter (f, parameters, Qchild_frame_border_width, Qnil,
5921#ifdef USE_GTK /* We used to impose 0 in xg_create_frame_widgets. */
5922 make_fixnum (0),
5923#else
5924 make_fixnum (1),
5925#endif
5926 "childFrameBorderWidth", "childFrameBorderWidth", 5930 "childFrameBorderWidth", "childFrameBorderWidth",
5927 RES_TYPE_NUMBER); 5931 RES_TYPE_NUMBER);
5928 gui_default_parameter (f, parameters, Qinternal_border_width, make_fixnum (0),
5929 "internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER);
5930 gui_default_parameter (f, parameters, Qright_divider_width, make_fixnum (0), 5932 gui_default_parameter (f, parameters, Qright_divider_width, make_fixnum (0),
5931 NULL, NULL, RES_TYPE_NUMBER); 5933 NULL, NULL, RES_TYPE_NUMBER);
5932 gui_default_parameter (f, parameters, Qbottom_divider_width, make_fixnum (0), 5934 gui_default_parameter (f, parameters, Qbottom_divider_width, make_fixnum (0),
diff --git a/src/xfns.c b/src/xfns.c
index cac41ee4856..481ee0e2255 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1803,7 +1803,14 @@ x_change_tool_bar_height (struct frame *f, int height)
1803static void 1803static void
1804x_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 1804x_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1805{ 1805{
1806 int border = check_int_nonnegative (arg); 1806 int border;
1807
1808 if (NILP (arg))
1809 border = -1;
1810 else if (RANGED_FIXNUMP (0, arg, INT_MAX))
1811 border = XFIXNAT (arg);
1812 else
1813 signal_error ("Invalid child frame border width", arg);
1807 1814
1808 if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f)) 1815 if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f))
1809 { 1816 {
@@ -3920,36 +3927,31 @@ This function is an internal primitive--use `make-frame' instead. */)
3920 parms); 3927 parms);
3921 } 3928 }
3922 3929
3930 gui_default_parameter (f, parms, Qinternal_border_width,
3931#ifdef USE_GTK /* We used to impose 0 in xg_create_frame_widgets. */
3932 make_fixnum (0),
3933#else
3934 make_fixnum (1),
3935#endif
3936 "internalBorderWidth", "internalBorderWidth",
3937 RES_TYPE_NUMBER);
3938
3923 /* Same for child frames. */ 3939 /* Same for child frames. */
3924 if (NILP (Fassq (Qchild_frame_border_width, parms))) 3940 if (NILP (Fassq (Qchild_frame_border_width, parms)))
3925 { 3941 {
3926 Lisp_Object value; 3942 Lisp_Object value;
3927 3943
3928 value = gui_display_get_arg (dpyinfo, parms, Qchild_frame_border_width, 3944 value = gui_display_get_arg (dpyinfo, parms, Qchild_frame_border_width,
3929 "childFrameBorderWidth", "childFrameBorderWidth", 3945 "childFrameBorder", "childFrameBorder",
3930 RES_TYPE_NUMBER); 3946 RES_TYPE_NUMBER);
3931 if (! EQ (value, Qunbound)) 3947 if (! EQ (value, Qunbound))
3932 parms = Fcons (Fcons (Qchild_frame_border_width, value), 3948 parms = Fcons (Fcons (Qchild_frame_border_width, value),
3933 parms); 3949 parms);
3934
3935 } 3950 }
3936 3951
3937 gui_default_parameter (f, parms, Qchild_frame_border_width, 3952 gui_default_parameter (f, parms, Qchild_frame_border_width, Qnil,
3938#ifdef USE_GTK /* We used to impose 0 in xg_create_frame_widgets. */
3939 make_fixnum (0),
3940#else
3941 make_fixnum (1),
3942#endif
3943 "childFrameBorderWidth", "childFrameBorderWidth", 3953 "childFrameBorderWidth", "childFrameBorderWidth",
3944 RES_TYPE_NUMBER); 3954 RES_TYPE_NUMBER);
3945 gui_default_parameter (f, parms, Qinternal_border_width,
3946#ifdef USE_GTK /* We used to impose 0 in xg_create_frame_widgets. */
3947 make_fixnum (0),
3948#else
3949 make_fixnum (1),
3950#endif
3951 "internalBorderWidth", "internalBorderWidth",
3952 RES_TYPE_NUMBER);
3953 gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0), 3955 gui_default_parameter (f, parms, Qright_divider_width, make_fixnum (0),
3954 NULL, NULL, RES_TYPE_NUMBER); 3956 NULL, NULL, RES_TYPE_NUMBER);
3955 gui_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0), 3957 gui_default_parameter (f, parms, Qbottom_divider_width, make_fixnum (0),