Subject: bug#17163: 24.3.50; default-frame-alist: scroll-bar-width not used

From: martin rudalics <[email-masked]>
Date: Wed, 02 Apr 2014 16:38:17 +0200

> The value of scroll-bar-width is used only in the first frame.
 >
 > 1.) Create file /tmp/init.el:
 >
 > --8<---------------cut here---------------start------------->8---
 > (set-face-attribute 'default nil :height 150)
 > (setq default-frame-alist '((scroll-bar-width . 10)))
 > (make-frame-command)
 > (print default-frame-alist)
 > --8<---------------cut here---------------end--------------->8---
 >
 > 2.) Start emacs:
 >
 > emacs -Q -l /tmp/init.el
 >
 > 3.) Compare the widths of the scroll-bars.

Should be fixed with revision 116894 on the Emacs-24 release branch.

If you are on trunk you will either have to wait until the fix
propagates or try the attached diffs.

Thanks for the report, martin
=== modified file 'src/xterm.c'
*** src/xterm.c	2014-03-11 06:50:01 +0000
--- src/xterm.c	2014-04-02 13:13:56 +0000
***************
*** 7766,7785 ****
  
    compute_fringe_widths (f, 1);
  
    unit = FRAME_COLUMN_WIDTH (f);
! #ifdef USE_TOOLKIT_SCROLL_BARS
!   /* The width of a toolkit scrollbar does not change with the new
!      font but we have to calculate the number of columns it occupies
!      anew.  */
!   FRAME_CONFIG_SCROLL_BAR_COLS (f)
!     = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + unit - 1) / unit;
! #else
!   /* The width of a non-toolkit scrollbar is at least 14 pixels and a
!      multiple of the frame's character width.  */
!   FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit;
!   FRAME_CONFIG_SCROLL_BAR_WIDTH (f)
!     = FRAME_CONFIG_SCROLL_BAR_COLS (f) * unit;
! #endif  
  
    if (FRAME_X_WINDOW (f) != 0)
      {
--- 7766,7781 ----
  
    compute_fringe_widths (f, 1);
  
+   /* Compute character columns occupied by scrollbar.
+ 
+      Don't do things differently for non-toolkit scrollbars
+      (Bug#17163).  */
    unit = FRAME_COLUMN_WIDTH (f);
!   if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0)
!     FRAME_CONFIG_SCROLL_BAR_COLS (f)
!       = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + unit - 1) / unit;
!   else
!     FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit;
  
    if (FRAME_X_WINDOW (f) != 0)
      {
***************
*** 7985,7991 ****
      {
  #ifdef HAVE_X11R6_XIM
        struct xim_inst_t *xim_inst = dpyinfo->xim_callback_data;
!       
        if (dpyinfo->display)
  	{
  	  Bool ret = XUnregisterIMInstantiateCallback
--- 7981,7987 ----
      {
  #ifdef HAVE_X11R6_XIM
        struct xim_inst_t *xim_inst = dpyinfo->xim_callback_data;
! 
        if (dpyinfo->display)
  	{
  	  Bool ret = XUnregisterIMInstantiateCallback