help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (set-frame-position ... 0 0) renders a few pixels right of left edge


From: Eli Zaretskii
Subject: Re: (set-frame-position ... 0 0) renders a few pixels right of left edge
Date: Fri, 23 Feb 2024 09:47:27 +0200

> From: David Karr <davidmichaelkarr@gmail.com>
> Date: Thu, 22 Feb 2024 14:07:47 -0800
> 
> On Windows 11, using Cygwin Emacs, I have the following at the top of my
> .emacs file:
> 
> (set-frame-position (selected-frame) 0 0)
> (set-frame-height (selected-frame) 57)
> 
> When the window appears, the left edge is a few pixels to the right of the
> left edge. If I throw the mouse cursor to the edge of the screen, the emacs
> window is not in focus.

This is a "feature" of Windows 10 and later: each window has a hidden
part a few pixels wide around its visible portion, which is considered
part of the window by the window manager.  If you slowly move the
mouse towards an Emacs frame, you should see that the mouse pointer
takes up the "resizing" shape of double-edged arrow a few pixels
before you hit the window's visible portion.  That's why you see what
you see; there's no bug in Emacs here, and the resulting frame
position is correctly reported as zero by the frame-geometry function.

However, on my Windows system, when the mouse pointer is at the screen
edge, the Emacs frame put at (0,0) does get focus, although the mouse
pointer seems to be slightly outside of the frame.  So if in your case
the Emacs frame doesn't get focus, there's some other factor at work
here, perhaps related to how the X server you use works on Windows 11.
(I tested the above with the native w32 build of Emacs.)  Or maybe you
somehow disabled those invisible portions of the window?

> Each time emacs starts up, I have to manually drag the window a few pixels
> to the left so it aligns to the left edge.

Doing this basically puts the real Emacs frame slightly off-screen.
Evaluate (frame-geometry) and look at the outer-position member of the
returned alist, both when the frame is positioned by your init file,
and after you drag it, and you will see it.

> I thought perhaps that giving the X value a negative value would help, but
> the doc says that would result in a completely different behavior, making
> the right edge relative to the right edge of the screen. I suppose I could
> drill down until I figured out the exact negative value from the right
> edge, but that is a little annoying, and it would break if I connected to a
> larger monitor.

I think you should instead try to figure out why the frame doesn't get
focus when the mouse is at (0,0) -- this seems to be the actual
problem in your case.  But other than that, yes, your only way to
position the frame to the left of zero is by using a suitable negative
value.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]