From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jesper Harder Newsgroups: gmane.emacs.help Subject: Re: New frame position (FSF Emacs on Windows) Date: Sun, 09 Feb 2003 05:31:42 +0100 Organization: http://purl.org/harder/ Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1044765214 17250 80.91.224.249 (9 Feb 2003 04:33:34 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 9 Feb 2003 04:33:34 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18hj9p-0004U6-00 for ; Sun, 09 Feb 2003 05:33:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18hjBj-0004ab-03 for gnu-help-gnu-emacs@m.gmane.org; Sat, 08 Feb 2003 23:35:31 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: ^RrvqCr7c,P$zTR:QED"@h9+BTm-"fjZJJ-3=OU7.)i/K]<.J88}s>'Z_$r; List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:6473 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:6473 Paul Moore writes: > Jesper Harder writes: > >> This doesn't help you, but on X this usually something you adjust in you >> window manager. > > Yes, I have seen this in X. As usual in Windows, there aren't any > options - you get what Bill things is best for you. Unfortunately, in > this instance, I actually like the Windows behaviour :-) I think Emacs ought to follow the standard behaviour on ms-windows. Submit a bug report :-) > Phew. That's not something I'd have worked out for myself! It's a good > start, but there's a bit more to the "Windows behaviour" - if the > calculated position is "too far" (off the screen, or overlapping the > taskbar) the window is put back up at the top left. Also, rather than > a fixed 15 pixels (or whatever) the Windows behaviour is to go down by > the width of the title bar (user configurable) and right by the size > of the "system menu" icon. OK, here's an improved version: (require 'assoc) (defvar my-frame-position-x-offset 20) (defvar my-frame-position-y-offset 20) (defvar my-frame-position-taskbar-height 30) (defun my-frame-position () (let ((left (+ my-frame-position-x-offset (or (frame-parameter nil 'left) 0))) (top (+ my-frame-position-y-offset (or (frame-parameter nil 'top) 0)))) (when (or (> (+ (frame-pixel-width) left) (display-pixel-width)) (> (+ (frame-pixel-height) top my-frame-position-taskbar-height) (display-pixel-height))) (setq left 0 top 0)) (aput 'default-frame-alist 'left left) (aput 'default-frame-alist 'top top))) (aput 'default-frame-alist 'user-position t) (add-hook 'before-make-frame-hook 'my-frame-position)