all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Cecilio Pardo <cpardo@imayhem.com>, Eli Zaretskii <eliz@gnu.org>
Cc: johann.hoechtl@gmail.com, 74435@debbugs.gnu.org
Subject: bug#74435: Scrollbar width is not respected on Windows
Date: Fri, 22 Nov 2024 11:13:24 +0100	[thread overview]
Message-ID: <2db1ba3e-cac2-4633-90f4-fdcb4022e5be@gmx.at> (raw)
In-Reply-To: <3366fba9-741b-46ef-8aab-d0570db7a76b@imayhem.com>

[-- Attachment #1: Type: text/plain, Size: 232 bytes --]

 > emacs -q
 >
 > and eval this twice:
 >
 > (set-frame-parameter nil 'scroll-bar-width 50)
 >
 >
 > The bar will change to 50 on first evaluation, and got back to default on second.

My bad.  Can you try the attached patch?

martin

[-- Attachment #2: frame.c.diff --]
[-- Type: text/x-patch, Size: 2002 bytes --]

diff --git a/src/frame.c b/src/frame.c
index 7f4bf274ad9..f6053fca3ef 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -5102,15 +5102,19 @@ gui_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
   int unit = FRAME_COLUMN_WIDTH (f);
 
-  if (RANGED_FIXNUMP (1, arg, INT_MAX)
-      && XFIXNAT (arg) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f))
+  if (RANGED_FIXNUMP (1, arg, INT_MAX))
     {
-      FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFIXNAT (arg);
-      FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFIXNAT (arg) + unit - 1) / unit;
-      if (FRAME_NATIVE_WINDOW (f))
-	adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width);
+      if (XFIXNAT (arg) == FRAME_CONFIG_SCROLL_BAR_WIDTH (f))
+	return;
+      else
+	{
+	  FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFIXNAT (arg);
+	  FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFIXNAT (arg) + unit - 1) / unit;
+	  if (FRAME_NATIVE_WINDOW (f))
+	    adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width);
 
-      SET_FRAME_GARBAGED (f);
+	  SET_FRAME_GARBAGED (f);
+	}
     }
   else
     {
@@ -5133,15 +5137,19 @@ gui_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 #if USE_HORIZONTAL_SCROLL_BARS
   int unit = FRAME_LINE_HEIGHT (f);
 
-  if (RANGED_FIXNUMP (1, arg, INT_MAX)
-      && XFIXNAT (arg) != FRAME_CONFIG_SCROLL_BAR_HEIGHT (f))
+  if (RANGED_FIXNUMP (1, arg, INT_MAX))
     {
-      FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) = XFIXNAT (arg);
-      FRAME_CONFIG_SCROLL_BAR_LINES (f) = (XFIXNAT (arg) + unit - 1) / unit;
-      if (FRAME_NATIVE_WINDOW (f))
-	adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height);
+      if (XFIXNAT (arg) == FRAME_CONFIG_SCROLL_BAR_HEIGHT (f))
+	return;
+      else
+	{
+	  FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) = XFIXNAT (arg);
+	  FRAME_CONFIG_SCROLL_BAR_LINES (f) = (XFIXNAT (arg) + unit - 1) / unit;
+	  if (FRAME_NATIVE_WINDOW (f))
+	    adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height);
 
-      SET_FRAME_GARBAGED (f);
+	  SET_FRAME_GARBAGED (f);
+	}
     }
   else
     {

  reply	other threads:[~2024-11-22 10:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19 12:01 bug#74435: Scrollbar width is not respected on Windows Johann Höchtl
2024-11-21 10:48 ` Eli Zaretskii
2024-11-21 14:57   ` Cecilio Pardo
2024-11-21 15:49     ` Eli Zaretskii
2024-11-21 22:21       ` Cecilio Pardo
2024-11-22  6:53         ` Eli Zaretskii
2024-11-22  7:45           ` Cecilio Pardo
2024-11-22 10:13             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-11-22 12:39               ` Cecilio Pardo
2024-11-28 11:01               ` Cecilio Pardo
2024-11-28 15:20                 ` Eli Zaretskii
2024-11-28 17:58                   ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-06  8:44                     ` Johann Höchtl
2024-12-06  9:08                       ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2db1ba3e-cac2-4633-90f4-fdcb4022e5be@gmx.at \
    --to=bug-gnu-emacs@gnu.org \
    --cc=74435@debbugs.gnu.org \
    --cc=cpardo@imayhem.com \
    --cc=eliz@gnu.org \
    --cc=johann.hoechtl@gmail.com \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.