all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Can someone explain this code in xterm.c?
@ 2003-04-25  1:56 Kim F. Storm
  2003-04-28  4:38 ` Richard Stallman
  0 siblings, 1 reply; 5+ messages in thread
From: Kim F. Storm @ 2003-04-25  1:56 UTC (permalink / raw)



In x_set_window_size_1, the vertical_scroll_bar_extra setting may be
set to a non-integral fraction of the canonical column width of the
frame:

(rms      25-Jul-95):   f->output_data.x->vertical_scroll_bar_extra
(kwzh     28-Sep-94):     = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
(kwzh     28-Sep-94):        ? 0
(kwzh     28-Sep-94):        : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0
(kwzh     20-Sep-94):        ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f)
(rms      25-Jul-95):        : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font)));


Anywhere else (including the normal X widget case, GTK, W32, and MAC
ports), the vertical_scroll_bar_extra is set to an multiple of the
canonical column width.

This setting is used in the calculation of the total width of the
frame window (in macro CHAR_TO_PIXEL_WIDTH), but in other parts of the
code, the width of the scroll bar _area_ is always calculated as the
number of scroll bar colums multiplied by the font width (canonical x
unit).

According to the comments on x_set_window_size_1, it is only used if F
doesn't have a widget, but I'm not sure how to interpret that ...
can the frame not have a widget, but still have scroll bars under X 
or GTK?

I really wonder whether that code really works (or is used at all).

So can someone please tell me under what circumstances that code is
used, and how it is intended to work if the rest of the code expects
the frame window to be a multiple of the canonical column width.

Thanks!

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

* Re: Can someone explain this code in xterm.c?
  2003-04-25  1:56 Can someone explain this code in xterm.c? Kim F. Storm
@ 2003-04-28  4:38 ` Richard Stallman
  2003-04-28 19:16   ` Alex Schroeder
  2003-04-28 22:16   ` Kim F. Storm
  0 siblings, 2 replies; 5+ messages in thread
From: Richard Stallman @ 2003-04-28  4:38 UTC (permalink / raw)
  Cc: emacs-devel

    In x_set_window_size_1, the vertical_scroll_bar_extra setting may be
    set to a non-integral fraction of the canonical column width of the
    frame:

It appears to me that vertical_scroll_bar_extra holds the 
width in pixels of the scroll bar, in all cases.  Its name is
misleading.

You would think that FRAME_SCROLL_BAR_PIXEL_WIDTH has that value,
but it is different.  It records the specified pixel width of the
scroll bar, or 0 if it has not been specified.

Perhaps both names should be changed.

    Anywhere else (including the normal X widget case, GTK, W32, and MAC
    ports), the vertical_scroll_bar_extra is set to an multiple of the
    canonical column width.

I think there are some other places where it uses
FRAME_SCROLL_BAR_PIXEL_WIDTH for this.

    This setting is used in the calculation of the total width of the
    frame window (in macro CHAR_TO_PIXEL_WIDTH), but in other parts of the
    code, the width of the scroll bar _area_ is always calculated as the
    number of scroll bar colums multiplied by the font width (canonical x
    unit).

I think that in some cases the actual display of the scroll bar is
determined by the number of columns.  You can specify a non-integral
width, but it leaves the excess blank.

I don't remember the reason it is done this way, but I do remember 
there was one.

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

* Re: Can someone explain this code in xterm.c?
  2003-04-28  4:38 ` Richard Stallman
@ 2003-04-28 19:16   ` Alex Schroeder
  2003-04-28 22:16   ` Kim F. Storm
  1 sibling, 0 replies; 5+ messages in thread
From: Alex Schroeder @ 2003-04-28 19:16 UTC (permalink / raw)
  Cc: Kim F. Storm

Richard Stallman <rms@gnu.org> writes:

>     This setting is used in the calculation of the total width of the
>     frame window (in macro CHAR_TO_PIXEL_WIDTH), but in other parts of the
>     code, the width of the scroll bar _area_ is always calculated as the
>     number of scroll bar colums multiplied by the font width (canonical x
>     unit).
>
> I think that in some cases the actual display of the scroll bar is
> determined by the number of columns.  You can specify a non-integral
> width, but it leaves the excess blank.
>
> I don't remember the reason it is done this way, but I do remember 
> there was one.

Perhaps because we want scroll-bars to always look the same even if
the frame-width is not a multiple of of the column-width.  This
happens in window managers that have only one maximized window such
as ratpoison.  You cannot change the width of frames under such a
window manager, therefore you can either shrink or expand the
scroll-bars, or you can leave some space.

This is just a guess in the dark because I happen to use the
ratpoison window manager.

Alex.
-- 
http://www.emacswiki.org/cgi-bin/alex.pl

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

* Re: Can someone explain this code in xterm.c?
  2003-04-28  4:38 ` Richard Stallman
  2003-04-28 19:16   ` Alex Schroeder
@ 2003-04-28 22:16   ` Kim F. Storm
  2003-04-29 19:29     ` Richard Stallman
  1 sibling, 1 reply; 5+ messages in thread
From: Kim F. Storm @ 2003-04-28 22:16 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     In x_set_window_size_1, the vertical_scroll_bar_extra setting may be
>     set to a non-integral fraction of the canonical column width of the
>     frame:
> 
> It appears to me that vertical_scroll_bar_extra holds the 
> width in pixels of the scroll bar, in all cases.  Its name is
> misleading.

But AFAICS it is not used for that purpose -- in the cases where it is
used (notably in CHAR_TO_PIXEL_WIDTH), it is supposed to be the width
of the scroll bar _area_, not the actual width of the scroll bar.

> 
> You would think that FRAME_SCROLL_BAR_PIXEL_WIDTH has that value,
> but it is different.  It records the specified pixel width of the
> scroll bar, or 0 if it has not been specified.
> 
> Perhaps both names should be changed.

This is messy, so yes.  

But I would rather go over each use (there are only a few) of
vertical_scroll_bar_extra and change them to use the proper value of
either FRAME_SCROLL_BAR_PIXEL_WIDTH or "scroll_bar_columns *
canonical_x_unit".

> 
>     Anywhere else (including the normal X widget case, GTK, W32, and MAC
>     ports), the vertical_scroll_bar_extra is set to an multiple of the
>     canonical column width.
> 
> I think there are some other places where it uses
> FRAME_SCROLL_BAR_PIXEL_WIDTH for this.

Yes, that setting is used to specify a non-canonical scroll bar width
(which is then shown in a canonical width scroll bar area).

> 
>     This setting is used in the calculation of the total width of the
>     frame window (in macro CHAR_TO_PIXEL_WIDTH), but in other parts of the
>     code, the width of the scroll bar _area_ is always calculated as the
>     number of scroll bar colums multiplied by the font width (canonical x
>     unit).
> 
> I think that in some cases the actual display of the scroll bar is
> determined by the number of columns.  You can specify a non-integral
> width, but it leaves the excess blank.

Precisely, but in those cases, FRAME_SCROLL_BAR_PIXEL_WIDTH is used
explicitly, not vertical_scroll_bar_extra.

> 
> I don't remember the reason it is done this way, but I do remember 
> there was one.

Maybe vertical_scroll_bar_extra is a left-over from before the new
display engine, but I have no way to verify that.

I have tried to set a breakpoint on x_set_window_size_1 with emacs
running under X on GNU/Linux, but it is not activated...

So when is x_set_window_size_1 activated -- e.g. as the comment on
x_set_window_size_1 suggests, when doe emacs run under X without a
widget?  And in those cases, does it still have scroll bars?

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: Can someone explain this code in xterm.c?
  2003-04-28 22:16   ` Kim F. Storm
@ 2003-04-29 19:29     ` Richard Stallman
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2003-04-29 19:29 UTC (permalink / raw)
  Cc: emacs-devel

    > It appears to me that vertical_scroll_bar_extra holds the 
    > width in pixels of the scroll bar, in all cases.  Its name is
    > misleading.

    But AFAICS it is not used for that purpose -- in the cases where it is
    used (notably in CHAR_TO_PIXEL_WIDTH), it is supposed to be the width
    of the scroll bar _area_, not the actual width of the scroll bar.

We are describing the same thing in different words.

    But I would rather go over each use (there are only a few) of
    vertical_scroll_bar_extra and change them to use the proper value of
    either FRAME_SCROLL_BAR_PIXEL_WIDTH or "scroll_bar_columns *
    canonical_x_unit".

If that works, it is ok with me.

    So when is x_set_window_size_1 activated -- e.g. as the comment on
    x_set_window_size_1 suggests, when doe emacs run under X without a
    widget?

I don't know when there's no widget if using Xt or GTK,
but x_set_window_size always calls x_set_window_size_1
when not using Xt and GTK.

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

end of thread, other threads:[~2003-04-29 19:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-25  1:56 Can someone explain this code in xterm.c? Kim F. Storm
2003-04-28  4:38 ` Richard Stallman
2003-04-28 19:16   ` Alex Schroeder
2003-04-28 22:16   ` Kim F. Storm
2003-04-29 19:29     ` Richard Stallman

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.