From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: (set-frame-position ... 0 0) renders a few pixels right of left edge Date: Fri, 23 Feb 2024 09:47:27 +0200 Message-ID: <86jzmv1v1s.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3433"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 23 08:48:05 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rdQHt-0000fy-5W for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 23 Feb 2024 08:48:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdQHL-0007RZ-R9; Fri, 23 Feb 2024 02:47:32 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdQHK-0007Nv-Jm for help-gnu-emacs@gnu.org; Fri, 23 Feb 2024 02:47:30 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdQHK-0005T2-9L for help-gnu-emacs@gnu.org; Fri, 23 Feb 2024 02:47:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=l+/d+x0ymiKG6HaGoXIxVDAxSxHOVRz6DkC5QKCn7nE=; b=FFjB8bADmLI3 +eVM150XIYThoOVE7ikdf9Bjb7RtVfFAlmsybyc1cbLHlnZvfdG49xnEWpskW3JR2+D/apYk/YTJG 4E3TwQFm6w49Oh4IdwfW1CctY5HXOr/nuDTiZuBRJaoRZi/NobZMVUrX0IbUkZLnqBqKtZjgCFVFr Uom49pYkEdHTUdUiiN9rK9G1UqMhKbhE/XkcEfa+aWF1IOgVeS3Ly3GB8pSeRdsaZ50qOX2cBHNTz pgSNcrrJiSTqJRpCl0wEu+p+f0W0A93kEIpZbcM/YHP/16VdqcD5rQtxN4JtiwHwMDVZPPasif3Me loX4kkXazle9kJx08dLR0w==; In-Reply-To: (message from David Karr on Thu, 22 Feb 2024 14:07:47 -0800) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:145968 Archived-At: > From: David Karr > 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.