unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* (set-frame-position ... 0 0) renders a few pixels right of left edge
@ 2024-02-22 22:07 David Karr
  2024-02-23  7:47 ` Eli Zaretskii
  2024-02-26 19:20 ` David Karr
  0 siblings, 2 replies; 4+ messages in thread
From: David Karr @ 2024-02-22 22:07 UTC (permalink / raw)
  To: help-gnu-emacs

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.

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.

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.


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

* Re: (set-frame-position ... 0 0) renders a few pixels right of left edge
  2024-02-22 22:07 (set-frame-position ... 0 0) renders a few pixels right of left edge David Karr
@ 2024-02-23  7:47 ` Eli Zaretskii
  2024-02-26 19:20 ` David Karr
  1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-02-23  7:47 UTC (permalink / raw)
  To: help-gnu-emacs

> 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.



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

* Re: (set-frame-position ... 0 0) renders a few pixels right of left edge
  2024-02-22 22:07 (set-frame-position ... 0 0) renders a few pixels right of left edge David Karr
  2024-02-23  7:47 ` Eli Zaretskii
@ 2024-02-26 19:20 ` David Karr
  2024-02-26 19:27   ` Eli Zaretskii
  1 sibling, 1 reply; 4+ messages in thread
From: David Karr @ 2024-02-26 19:20 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu, Feb 22, 2024 at 2:07 PM David Karr <davidmichaelkarr@gmail.com>
wrote:

> 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.
>
> 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.
>
> 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 saw in the archives that Eli Zaretskii had replied to this, but I never
saw it in my inbox.  I'll try to address what he said.

This is what I saw both before and after moving the window:

Before moving it:

((outer-position 0 . 0) (outer-size 689 . 1007) (external-border-size 8 .
8) (title-bar-size 651 . 23) (menu-bar-external . t) (menu-bar-size 673 .
20) (tab-bar-size 0 . 0) (tool-bar-external) (tool-bar-position . top)
(tool-bar-size 673 . 36) (internal-border-width . 0))

After moving it:

((outer-position -8 . 0) (outer-size 689 . 1007) (external-border-size 8 .
8) (title-bar-size 651 . 23) (menu-bar-external . t) (menu-bar-size 673 .
20) (tab-bar-size 0 . 0) (tool-bar-external) (tool-bar-position . top)
(tool-bar-size 673 . 36) (internal-border-width . 0))

I assume this agrees with what you said, but I don't know how to solve the
problem. I have no idea why my Windows 11 laptop is doing this. Note that
in the last couple of days, I proceeded to set up a new work laptop (HP).
Both the old (also HP) and new laptop behave exactly the same in this
respect.


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

* Re: (set-frame-position ... 0 0) renders a few pixels right of left edge
  2024-02-26 19:20 ` David Karr
@ 2024-02-26 19:27   ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-02-26 19:27 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: David Karr

> From: David Karr <davidmichaelkarr@gmail.com>
> Date: Mon, 26 Feb 2024 11:20:17 -0800
> 
> I saw in the archives that Eli Zaretskii had replied to this, but I never
> saw it in my inbox.

That's because I replied only to the list, as I normally do here.

> This is what I saw both before and after moving the window:
> 
> Before moving it:
> 
> ((outer-position 0 . 0) (outer-size 689 . 1007) (external-border-size 8 .
> 8) (title-bar-size 651 . 23) (menu-bar-external . t) (menu-bar-size 673 .
> 20) (tab-bar-size 0 . 0) (tool-bar-external) (tool-bar-position . top)
> (tool-bar-size 673 . 36) (internal-border-width . 0))
> 
> After moving it:
> 
> ((outer-position -8 . 0) (outer-size 689 . 1007) (external-border-size 8 .
> 8) (title-bar-size 651 . 23) (menu-bar-external . t) (menu-bar-size 673 .
> 20) (tab-bar-size 0 . 0) (tool-bar-external) (tool-bar-position . top)
> (tool-bar-size 673 . 36) (internal-border-width . 0))
> 
> I assume this agrees with what you said, but I don't know how to solve the
> problem. I have no idea why my Windows 11 laptop is doing this. Note that
> in the last couple of days, I proceeded to set up a new work laptop (HP).
> Both the old (also HP) and new laptop behave exactly the same in this
> respect.

As I wrote, this is the expected behavior on Windows 10/11.

The somewhat unexpected part is not how Windows positions the frame,
but the fact that the frame doesn't get focus when the mouse is at
(0,0).  It does on my system, so I presume something on your system
prevents it from doing that.  I suggest to investigate why the frame
doesn't get focus, because that's the only problem I see in your
description.



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

end of thread, other threads:[~2024-02-26 19:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-22 22:07 (set-frame-position ... 0 0) renders a few pixels right of left edge David Karr
2024-02-23  7:47 ` Eli Zaretskii
2024-02-26 19:20 ` David Karr
2024-02-26 19:27   ` Eli Zaretskii

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).