unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Weiner <rsw@gnu.org>
To: Alan Third <alan@idiocy.org>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: select-frame-set-input-focus fails to raise the frame
Date: Fri, 15 Dec 2017 10:53:59 -0500	[thread overview]
Message-ID: <CA+OMD9j=Kde1OuA_4Zyz2jX9zXo5VihibjYa3hkGxwrr9nub6Q@mail.gmail.com> (raw)
In-Reply-To: <CA+OMD9jySwm=-PFBZwO13eHEQi5_-UurBEGaY-9UVxQ7EszGMw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1937 bytes --]

On Thu, Dec 14, 2017 at 4:03 PM, Robert Weiner <rsw@gnu.org> wrote:

> On Wed, Dec 13, 2017 at 7:33 PM, Robert Weiner <rsw@gnu.org> wrote:
>
>> The combination of (sit-for 0) to cause
>> redisplay followed by a (sleep-for <n>) solved the problem
>> completely​ for me.
>>
>
> ​Well, one more problem remains here.  If the new frame is created with
> its window showing buffer1 and then set-window-buffer is used to
> change it to buffer2 (or even if switch-to-buffer is used), buffer2 is
> not displayed ​when the new frame is temporarily displayed (buffer1 is).
> Not until after Emacs becomes idle agai
> ​n​
> is buffer2 displayed in this new
> frame.
>

Although from the function doc strings, it seems a force-window-update
followed by a (sit-for 0) should force redisplay of the chosen window, it
did
not (see the test2 function in the prior message).  Is that a bug?

An explicit call to redisplay with a 'force' argument does the trick,
however.  So the following works as expected, showing the result of the
'set-window-buffer' while temporarily displaying the new frame.

(defun select-window-set-input-focus (window)
  "Select WINDOW, give input focus to its frame and force display of any
window changes."
  (select-window window)
  (select-frame-set-input-focus (window-frame window))
  ;; Force immediate redisplay of any changes to window, e.g. if its
  ;; buffer has changed
  (redisplay t))

(defun test3 ()
  (let* ((depress-frame (selected-frame))
(depress-window (frame-selected-window depress-frame))
         (release-frame (make-frame))
(release-window (frame-selected-window release-frame)))
    (set-window-buffer release-window "*scratch*")
    (select-window-set-input-focus release-window)
    (sleep-for 2)
    (select-window-set-input-focus depress-window)
    (sleep-for 2)
    (select-window-set-input-focus release-window)))

(test3)

;; Bob

[-- Attachment #2: Type: text/html, Size: 6078 bytes --]

  reply	other threads:[~2017-12-15 15:53 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12 23:02 select-frame-set-input-focus fails to raise the frame Bob Weiner
2017-12-12 23:26 ` Robert Weiner
2017-12-13 20:47   ` Alan Third
2017-12-13 22:00     ` Robert Weiner
2017-12-13 22:26       ` Alan Third
2017-12-14  0:33         ` Robert Weiner
2017-12-14 21:03           ` Robert Weiner
2017-12-15 15:53             ` Robert Weiner [this message]
2017-12-15 16:10               ` Eli Zaretskii
2017-12-15 17:38                 ` Robert Weiner
2017-12-15 20:44                   ` Eli Zaretskii
2017-12-16 13:41                     ` Robert Weiner
2017-12-16 14:39                       ` Eli Zaretskii
2017-12-16 15:06                         ` Robert Weiner
2017-12-16 16:15                           ` Eli Zaretskii
2017-12-16 18:57                             ` Robert Weiner
2017-12-16 19:45                               ` Eli Zaretskii
2017-12-16 20:07                                 ` Robert Weiner
2017-12-16 19:06                             ` martin rudalics
2017-12-16 19:24                               ` Robert Weiner
2017-12-13  8:50 ` martin rudalics
2017-12-13 15:00   ` Robert Weiner
2017-12-13 16:07     ` Stefan Monnier
2017-12-13 16:33       ` Robert Weiner
2017-12-13 19:39         ` Eli Zaretskii
2017-12-13 19:30     ` martin rudalics
2017-12-13 22:14       ` Robert Weiner
2017-12-13 20:49 ` Alan Third
2017-12-13 21:53   ` Robert Weiner

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='CA+OMD9j=Kde1OuA_4Zyz2jX9zXo5VihibjYa3hkGxwrr9nub6Q@mail.gmail.com' \
    --to=rsw@gnu.org \
    --cc=alan@idiocy.org \
    --cc=emacs-devel@gnu.org \
    --cc=rswgnu@gmail.com \
    /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).