* Q4 - the bottom edge of Emacs doesn't stick to the taskbar
@ 2024-12-15 0:22 Tatsu Takamaro
2024-12-15 2:30 ` [External] : " Drew Adams
0 siblings, 1 reply; 4+ messages in thread
From: Tatsu Takamaro @ 2024-12-15 0:22 UTC (permalink / raw)
To: help-gnu-emacs
And the last question.
When I use this
*(add-to-list 'default-frame-alist '(height . 1.0))*
to tell Emacs be of all height, it takes it too literaly, and its bottom
edge is shown hidden behind the taskbar line. What should I do to make
it stick to the taskbar's up border?
Tony.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [External] : Q4 - the bottom edge of Emacs doesn't stick to the taskbar
2024-12-15 0:22 Q4 - the bottom edge of Emacs doesn't stick to the taskbar Tatsu Takamaro
@ 2024-12-15 2:30 ` Drew Adams
2024-12-15 7:47 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2024-12-15 2:30 UTC (permalink / raw)
To: Tatsu Takamaro, help-gnu-emacs@gnu.org
> When I use this
>
> *(add-to-list 'default-frame-alist '(height . 1.0))*
>
> to tell Emacs be of all height, it takes it too literaly, and its bottom
> edge is shown hidden behind the taskbar line. What should I do to make
> it stick to the taskbar's up border?
1. Emacs knows nothing about the MS Windows task bar. (And the task
bar can be displayed in different places; it's not necessarily at
the bottom of the screen.)
2. See (elisp) `Size Parameters', for `width' (height is analogous):
a floating-point value
A floating-point number between 0.0 and 1.0 can be used to
specify the width of a frame via its “width ratio”—the ratio
of its outer width (*note Frame Geometry::) to the width of
the frame’s workarea (*note Multiple Terminals::) or its
parent frame’s (*note Child Frames::) native frame. Thus, a
value of 0.5 makes the frame occupy half of the width of its
workarea or parent frame, a value of 1.0 the full width.
Similarly, the “height ratio” of a frame is the ratio of its
outer height to the height of its workarea or its parent’s
native frame.
Emacs will try to keep the width and height ratio of a child
frame unaltered if that frame has a non-‘nil’ ‘keep-ratio’
parameter (*note Frame Interaction Parameters::) and its
parent frame is resized.
Since the outer size of a frame is usually unavailable before
a frame has been made visible, it is generally not advisable
to use floating-point values when creating decorated frames.
Floating-point values are more suited to ensure that a child
frame always fits within the area of its parent frame as, for
example, when customizing ‘display-buffer-alist’ (*note
Choosing Window::) via ‘display-buffer-in-child-frame’.
So you will likely want to use an integer value, not a decimal
value (what the doc calls a floating-point value), e.g., 35
(characters), instead of 1.0.
To avoid the task bar, specify also a value for frame parameter
`top'.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Q4 - the bottom edge of Emacs doesn't stick to the taskbar
2024-12-15 2:30 ` [External] : " Drew Adams
@ 2024-12-15 7:47 ` Eli Zaretskii
2024-12-15 17:55 ` [External] : " Drew Adams
0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2024-12-15 7:47 UTC (permalink / raw)
To: help-gnu-emacs
> From: Drew Adams <drew.adams@oracle.com>
> Date: Sun, 15 Dec 2024 02:30:26 +0000
>
> > When I use this
> >
> > *(add-to-list 'default-frame-alist '(height . 1.0))*
> >
> > to tell Emacs be of all height, it takes it too literaly, and its bottom
> > edge is shown hidden behind the taskbar line. What should I do to make
> > it stick to the taskbar's up border?
>
> 1. Emacs knows nothing about the MS Windows task bar.
That's not true: see display-monitor-attributes-list.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [External] : Re: Q4 - the bottom edge of Emacs doesn't stick to the taskbar
2024-12-15 7:47 ` Eli Zaretskii
@ 2024-12-15 17:55 ` Drew Adams
0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2024-12-15 17:55 UTC (permalink / raw)
To: Eli Zaretskii, help-gnu-emacs@gnu.org
> > > When I use this
> > >
> > > *(add-to-list 'default-frame-alist '(height . 1.0))*
> > >
> > > to tell Emacs be of all height, it takes it too literaly, and its
> > > bottom edge is shown hidden behind the taskbar line. What should
> > > I do to make it stick to the taskbar's up border?
> >
> > 1. Emacs knows nothing about the MS Windows task bar.
>
> That's not true: see display-monitor-attributes-list.
Yes (starting with Emacs 24.4).
I tried to keep things simple in my answer. To take
advantage of `display-monitor-attributes-list' in this
context, I do this kind of thing (in `frame-cmds.el'):
___
`Non-nil option `available-screen-pixel-bounds' lets you
set the upper left and lower right coordinates of the
available screen space:
(defcustom available-screen-pixel-bounds nil
"Upper left and lower right of available screen space for tiling frames.
Integer list: (x0 y0 x1 y1), where (x0, y0) is the upper left position
and (x1, y1) is the lower right position. Coordinates are in pixels,
measured from the screen absolute origin, (0, 0), at the upper left.
If this is nil, then the available space is calculated. That should
give good results in most cases."
:type '(choice
(const :tag "Calculate automatically" nil)
(list :tag "List of (x0 y0 x1 y1)"
(integer :tag "X0 (upper left) - pixels from screen left")
(integer :tag "Y0 (upper left) - pixels from screen top")
(integer :tag "X1 (lower right) - pixels from screen left" )
(integer :tag "Y1 (lower right) - pixels from screen top")))
:group 'Frame-Commands)
With the default value nil, the screen space is calculated
using `display-monitor-attributes-list', like this:
(defun frcmds-available-screen-pixel-bounds ()
"Returns a value of the same form as option `available-screen-pixel-bounds'.
This represents the currently available screen area."
(or available-screen-pixel-bounds ; Use the option value, if available.
(if (fboundp 'mac-display-available-pixel-bounds) ; macOS-specific.
(mac-display-available-pixel-bounds)
(if (fboundp 'display-monitor-attributes-list) ; Emacs 24.4+
(let ((attss (display-monitor-attributes-list))
(x0 most-positive-fixnum)
(y0 most-positive-fixnum)
(x1 0)
(y1 0)
geom)
(dolist (atts attss)
(setq geom (cdr (assq 'geometry atts))
x0 (min x0 (nth 0 geom))
y0 (min y0 (nth 1 geom))
x1 (max x1 (nth 2 geom))
;; Use `max' for the height too, but it does
;; not account for taskbar etc.
y1 (max y1 (nth 3 geom))))
(list x0 y0 x1 y1))
;; Punt. Assume only one monitor.
(list 0 0 (x-display-pixel-width) (x-display-pixel-height))))))
But AFAIK, Emacs still knows nothing about the task bar
_per se_. (Please correct me if I'm wrong, Eli, with
some specifics.)
You would need to get the actual size and position info
from your Windows Settings. You can set the size using
a new name, "TaskbarSi", under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced.
But perhaps, for a given Windows version you can rely on
the default values.
Then there's the title bar of a Windows frame. For that
I just use 27 as the default value for MS Windows, in
this option `window-mgr-title-bar-pixel-height'. But you
can consult registry (key WindowMetrics, CaptionHeight =
-15 * pixel-height) for the exact value you have.
(defcustom window-mgr-title-bar-pixel-height
(cond ((eq window-system 'mac) 22)
;; For older versions of macOS, 40 might be better.
((eq window-system 'ns) 50)
(t 27))
"Height of frame title bar provided by the window manager, in pixels.
You might alternatively call this constant the title-bar \"width\" or
\"thickness\"."
:type 'integer :group 'Frame-Commands)
This is what I use for the pixel height of a frame:
(defun frcmds-frame-pixel-height (frame)
"Pixel height of FRAME, including the window-manager title bar and menu-bar.
For the title bar, `window-mgr-title-bar-pixel-height' is used.
For the menu-bar, the frame char size is multiplied by frame parameter
`menu-bar-lines'. But that parameter does not take into account
menu-bar wrapping."
(+ window-mgr-title-bar-pixel-height
(frame-pixel-height frame)
(if (not (eq window-system 'x))
0
(+ (* (frame-char-height frame)
(cdr (assq 'menu-bar-lines
(frame-parameters frame))))))))
HTH.
___
https://www.emacswiki.org/emacs/download/frame-cmds.el
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-15 17:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-15 0:22 Q4 - the bottom edge of Emacs doesn't stick to the taskbar Tatsu Takamaro
2024-12-15 2:30 ` [External] : " Drew Adams
2024-12-15 7:47 ` Eli Zaretskii
2024-12-15 17:55 ` [External] : " Drew Adams
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).