unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#74435: Scrollbar width is not respected on Windows
@ 2024-11-19 12:01 Johann Höchtl
  2024-11-21 10:48 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Johann Höchtl @ 2024-11-19 12:01 UTC (permalink / raw)
  To: 74435

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

On Emacs Windows


It seems like the observation of
https://lists.libreplanet.org/archive/html/help-gnu-emacs/2023-11/msg00109.html
has never been reported as a bug.

This issue is real. When I spilt a Windows with C-x 3 and save the desktop
and re-open the desktop, the scrollbar separating the two windows is
broader than it used to be before saving.

When I manually open the .emacs.desktop file and delete the setq
scroll-bar-width and reload the desktop, the width is back to normal.

[-- Attachment #2: Type: text/html, Size: 760 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#74435: Scrollbar width is not respected on Windows
  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
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-11-21 10:48 UTC (permalink / raw)
  To: Johann Höchtl, Cecilio Pardo; +Cc: 74435

> From: Johann Höchtl <johann.hoechtl@gmail.com>
> Date: Tue, 19 Nov 2024 13:01:44 +0100
> 
> On Emacs Windows
> 
> It seems like the observation of
> https://lists.libreplanet.org/archive/html/help-gnu-emacs/2023-11/msg00109.html
> has never been reported as a bug.

Because, as I responded there, I couldn't reproduce the problem.

> This issue is real. When I spilt a Windows with C-x 3 and save the desktop and re-open the desktop, the
> scrollbar separating the two windows is broader than it used to be before saving.

I still cannot reproduce this.  maybe this has something to do with
the display settings?  Like HiDPI, perhaps?

> When I manually open the .emacs.desktop file and delete the setq scroll-bar-width and reload the
> desktop, the width is back to normal.

What is the value of scroll-bar-width recorded in the desktop file,
and what does the below yield if you type it after "C-x 3" before
saving desktop?

  M-: (frame-parameter nil 'scroll-bar-width) RET

Adding Cecilio, in case he has an idea why this could happen, or can
suggest a way to debug this.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#74435: Scrollbar width is not respected on Windows
  2024-11-21 10:48 ` Eli Zaretskii
@ 2024-11-21 14:57   ` Cecilio Pardo
  2024-11-21 15:49     ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Cecilio Pardo @ 2024-11-21 14:57 UTC (permalink / raw)
  To: Eli Zaretskii, Johann Höchtl; +Cc: 74435

On 21/11/2024 11:48, Eli Zaretskii wrote:
>> From: Johann Höchtl <johann.hoechtl@gmail.com>
>> Date: Tue, 19 Nov 2024 13:01:44 +0100
>>
>> On Emacs Windows
>>
>> It seems like the observation of
>> https://lists.libreplanet.org/archive/html/help-gnu-emacs/2023-11/msg00109.html
>> has never been reported as a bug.
> 
> Because, as I responded there, I couldn't reproduce the problem.
> 
>> This issue is real. When I spilt a Windows with C-x 3 and save the desktop and re-open the desktop, the
>> scrollbar separating the two windows is broader than it used to be before saving.
> 
> I still cannot reproduce this.  maybe this has something to do with
> the display settings?  Like HiDPI, perhaps?

I can reproduce this on Windows 11. I'm looking into it.






^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#74435: Scrollbar width is not respected on Windows
  2024-11-21 14:57   ` Cecilio Pardo
@ 2024-11-21 15:49     ` Eli Zaretskii
  2024-11-21 22:21       ` Cecilio Pardo
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-11-21 15:49 UTC (permalink / raw)
  To: Cecilio Pardo; +Cc: johann.hoechtl, 74435

> Date: Thu, 21 Nov 2024 15:57:14 +0100
> Cc: 74435@debbugs.gnu.org
> From: Cecilio Pardo <cpardo@imayhem.com>
> 
> On 21/11/2024 11:48, Eli Zaretskii wrote:
> >> From: Johann Höchtl <johann.hoechtl@gmail.com>
> >> Date: Tue, 19 Nov 2024 13:01:44 +0100
> >>
> >> On Emacs Windows
> >>
> >> It seems like the observation of
> >> https://lists.libreplanet.org/archive/html/help-gnu-emacs/2023-11/msg00109.html
> >> has never been reported as a bug.
> > 
> > Because, as I responded there, I couldn't reproduce the problem.
> > 
> >> This issue is real. When I spilt a Windows with C-x 3 and save the desktop and re-open the desktop, the
> >> scrollbar separating the two windows is broader than it used to be before saving.
> > 
> > I still cannot reproduce this.  maybe this has something to do with
> > the display settings?  Like HiDPI, perhaps?
> 
> I can reproduce this on Windows 11. I'm looking into it.

Thanks, that's good news.  It would be interesting to know why I
couldn't reproduce that here (also Windows 11).





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#74435: Scrollbar width is not respected on Windows
  2024-11-21 15:49     ` Eli Zaretskii
@ 2024-11-21 22:21       ` Cecilio Pardo
  2024-11-22  6:53         ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Cecilio Pardo @ 2024-11-21 22:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: johann.hoechtl, 74435

I have tracked (I think) this problem to the function 
frame.c:gui_set_scroll_bar_width

If the new value for the scrollbars width is equal to the current one, 
then it resets width to the default size.

The 'if' tests for arg != FRAME_CONFIG_SCROLL_BAR_WIDTH(f).
That is, if arg is equal to current width, the 'else' path is taken, 
which resets to default.

I suppose this should test for arg != "DEFAULT_WIDTH", but I don't know 
where to find that.

Maybe you could not reproduce it because your scrollbars are on the 
default size?







^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#74435: Scrollbar width is not respected on Windows
  2024-11-21 22:21       ` Cecilio Pardo
@ 2024-11-22  6:53         ` Eli Zaretskii
  2024-11-22  7:45           ` Cecilio Pardo
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2024-11-22  6:53 UTC (permalink / raw)
  To: Cecilio Pardo; +Cc: johann.hoechtl, 74435

> Date: Thu, 21 Nov 2024 23:21:05 +0100
> Cc: johann.hoechtl@gmail.com, 74435@debbugs.gnu.org
> From: Cecilio Pardo <cpardo@imayhem.com>
> 
> I have tracked (I think) this problem to the function 
> frame.c:gui_set_scroll_bar_width
> 
> If the new value for the scrollbars width is equal to the current one, 
> then it resets width to the default size.
> 
> The 'if' tests for arg != FRAME_CONFIG_SCROLL_BAR_WIDTH(f).
> That is, if arg is equal to current width, the 'else' path is taken, 
> which resets to default.
> 
> I suppose this should test for arg != "DEFAULT_WIDTH", but I don't know 
> where to find that.

Thanks.  I'd like to look into this, but it would help if I could
reproduce the issue.

> Maybe you could not reproduce it because your scrollbars are on the 
> default size?

Maybe.  The OP didn't seem to say it was necessary to specify
non-default scroll-bar width.

So what is the minimum recipe for reproducing the issue?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#74435: Scrollbar width is not respected on Windows
  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
  0 siblings, 1 reply; 9+ messages in thread
From: Cecilio Pardo @ 2024-11-22  7:45 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: johann.hoechtl, 74435



On 22/11/2024 7:53, Eli Zaretskii wrote:
>> Date: Thu, 21 Nov 2024 23:21:05 +0100
>> Cc: johann.hoechtl@gmail.com, 74435@debbugs.gnu.org
>> From: Cecilio Pardo <cpardo@imayhem.com>
>>
>> I have tracked (I think) this problem to the function
>> frame.c:gui_set_scroll_bar_width
>>
>> If the new value for the scrollbars width is equal to the current one,
>> then it resets width to the default size.
>>
>> The 'if' tests for arg != FRAME_CONFIG_SCROLL_BAR_WIDTH(f).
>> That is, if arg is equal to current width, the 'else' path is taken,
>> which resets to default.
>>
>> I suppose this should test for arg != "DEFAULT_WIDTH", but I don't know
>> where to find that.
> 
> Thanks.  I'd like to look into this, but it would help if I could
> reproduce the issue.
> 
>> Maybe you could not reproduce it because your scrollbars are on the
>> default size?
> 
> Maybe.  The OP didn't seem to say it was necessary to specify
> non-default scroll-bar width.
> 
> So what is the minimum recipe for reproducing the issue?

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.








^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#74435: Scrollbar width is not respected on Windows
  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
  2024-11-22 12:39               ` Cecilio Pardo
  0 siblings, 1 reply; 9+ messages in thread
From: martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-11-22 10:13 UTC (permalink / raw)
  To: Cecilio Pardo, Eli Zaretskii; +Cc: johann.hoechtl, 74435

[-- 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
     {

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#74435: Scrollbar width is not respected on Windows
  2024-11-22 10:13             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-11-22 12:39               ` Cecilio Pardo
  0 siblings, 0 replies; 9+ messages in thread
From: Cecilio Pardo @ 2024-11-22 12:39 UTC (permalink / raw)
  To: 74435

On 22/11/2024 11:13, martin rudalics wrote:
>  > 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

Works for me, thanks.





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-11-22 12:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-11-22 12:39               ` Cecilio Pardo

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).