unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: david@ngdr.net
Cc: 25943@debbugs.gnu.org
Subject: bug#25943: 21.5  Frame Display Difficulties
Date: Thu, 09 Mar 2017 09:56:42 +0100	[thread overview]
Message-ID: <58C118CA.8020908@gmx.at> (raw)
In-Reply-To: <142b4d1d519a6bf87a5fe320d9eeb419@127.0.0.1>

 > It appears that you and I use our operating systems and emacs very
 > differently!  You use one workspace and never change.  I use nine
 > workspaces, run each application in its own workspace, often fullscreen,

The latter seems to indicate that popping up an additional frame on the
same workspace is the exception, not the rule.

 > and flip between them according to need.

I generally use one workspace, maximized frames and all sorts of key
combinations to switch between frames and windows.

 > It sounds as though you use
 > mouse activated menus, scroll bars, and a mouse.

In general only when testing or trying to reproduce scenarios described
in bug reports.

 > Yes.  It seems to me that problems one and two both are initialization
 > faults in some code or other.

So let's concentrate on these "initialization faults" first.  The basic
motivation for your code is that "Starting with a visible frame is tacky
because of the flashing that results".  Hence you want to start with an
invisible frame and show it only after you're done with positioning and
sizing it.  In a nutshell, you do

   (let ((invoking-frame  (selected-frame))
	(simple-frame (make-frame '((visibility . nil)))))
     (set-frame-size simple-frame 60 6)
     (set-frame-position
      simple-frame  -41 (frame-parameter invoking-frame 'top))
     (select-frame-set-input-focus simple-frame))

This will first create a frame with some default size and position, then
resize the frame and finally reposition it.  While this might work some
of the time with some window managers I wouldn't rely on it.

As a rule, users should not specify frame positions manually.  Window
managers dislike it.  Not because they think they are better at it but
because it disturbs their usual flow of control.  If you really need to
position and size a new frame, please stick to the following rules:

(1) Use frame parameters for specifying the position.  First they give
     you more freedom.  For example, you can't use ‘set-frame-position’
     to put a frame at the right edge of your display.  More importantly,
     they allow Emacs to do its work _before_ the frame becomes visible.

(2) Use frame parameters for specifying the size.  Again this allows
     Emacs to do the associated calculations before the frame becomes
     visible.

     When specifying the frame position via a negative offset (your "-41"
     above), rule (2) becomes even more important because Emacs has to
     calculate the prospective size of your frame before it can calculate
     its prospective position.

(3) Add a ‘user-position’ entry to your frame parameters.  It might not
     help with all but it might help with some window managers to clarify
     your intentions.

A sub-rule of (2): Use negative offsets with care.  The original sin of
the API of all window managing programs is that an application has to
specify the size of the inner (aka "client") rectangle and the position
of the outer (aka "display") rectangle.  Extracting the size differences
between these rectangles is difficult and sometimes virtually impossible
(just think of wrapping tool or menu bars resulting from changing the
major mode of a buffer shown in the selected window).  Everything Emacs
can provide here is just some approximative behavior.

Consequently, I would suggest to rewrite the above form as follows:

   (let ((simple-frame
	 (make-frame
	  `((visibility . nil)
	    (left . -41)
	    (top . ,(frame-parameter nil 'top))
	    (width . 60)
	    (height . 6)))))
     (select-frame-set-input-focus simple-frame))

Please try it and tell me whether it gives better results.

Thanks, martin






  reply	other threads:[~2017-03-09  8:56 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03  3:51 bug#25943: 21.5 Frame Display Difficulties david
2017-03-03  8:13 ` martin rudalics
     [not found]   ` <af552a322a8a630796cbddf1133b6dbe@127.0.0.1>
2017-03-04  9:59     ` martin rudalics
2017-03-07  1:51       ` david
2017-03-07  9:45         ` martin rudalics
2017-03-08 22:58           ` david
2017-03-09  8:56             ` martin rudalics [this message]
2017-03-10 18:44               ` david
2017-03-11 10:21                 ` martin rudalics
2017-03-23  7:59                   ` martin rudalics
2017-03-28 22:43                     ` david
2017-03-29  7:36                       ` martin rudalics
2017-03-29 19:53                         ` david
2017-03-30  7:29                           ` martin rudalics
2017-04-01  4:35                             ` david
2017-04-01  7:36                               ` martin rudalics
     [not found]                                 ` <7ee8200b866d8067514fb8b0bb9e814b@127.0.0.1>
2017-04-02  7:55                                   ` martin rudalics
2017-04-04  0:35                                     ` david
2017-04-04  7:25                                       ` martin rudalics
2017-04-07  0:12                                         ` david
2017-04-07  5:56                                           ` martin rudalics
2017-04-07 21:16                                             ` david
2022-04-25 14:48                                               ` Lars Ingebrigtsen
2022-05-24 12:50                                                 ` Lars Ingebrigtsen
2017-04-07 21:19                                             ` david
2017-04-08  9:00                                               ` martin rudalics
2017-04-11  6:49                     ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58C118CA.8020908@gmx.at \
    --to=rudalics@gmx.at \
    --cc=25943@debbugs.gnu.org \
    --cc=david@ngdr.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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