unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Helmut Eller <eller.helmut@gmail.com>
Cc: 745@emacsbugs.donarmstrong.com
Subject: bug#745: pop-to-buffer, frames, and input focus
Date: Sat, 30 Aug 2008 15:42:00 +0200	[thread overview]
Message-ID: <48B94E28.9040707@gmx.at> (raw)
In-Reply-To: <m2ljyelq2r.fsf@gmail.com>

 >> (1) do a `display-buffer' making a new frame without that frame getting
 >> raised and/or input focus, and
 >
 > If I call gtk_window_set_focus_on_map (GTK_WINDOW (wtop), FALSE) in
 > gtkutil.c:xg_create_frame_widgets, then Metacity dosn't give the focus
 > to new frames.  The initial Emacs frame is also not focused.
 > gtk_window_set_focus_on_map sets _NET_WM_USER_TIME to 0.  I know that
 > because I read the GTK source.  It can be verified by calling xprop on
 > the resulting Emacs frame.

In this case we'd have to make `pop-to-buffer' give focus to the frame,
look out for applications that ("wrongly") expect `display-buffer' to
focus the frame, focus the initial frame, and decide what to do about
`select-window/frame'.  After the release we could implement this for
all ewmh-compliant window-managers.

 >> (2) give input focus to/raise a frame that hasn't input focus/is not
 >> raised.
 >>
 >> entirely using _NET_WM_USER_TIME?
 >
 > I don't know how to that with _NET_WM_USER_TIME.

For _NET_WM_USER_TIME I read

    This property allows a Window Manager to alter the focus, stacking,
    and/or placement behavior of windows when they are mapped depending
    on whether the new window was created by a user action or is a
    "pop-up" window activated by a timer or some other event.

but I fail to understand what "new window" means here.

 > But the EWMH-spec says this:
 >
 >    _NET_ACTIVE_WINDOW, WINDOW/32
 >
 >    The window ID of the currently active window or None if no window has
 >    the focus. This is a read-only property set by the Window Manager. If
 >    a Client wants to activate another window, it MUST send a
 >    _NET_ACTIVE_WINDOW client message to the root window:
 >
 >    _NET_ACTIVE_WINDOW
 >      window  = window to activate
 >      message_type = _NET_ACTIVE_WINDOW
 >      format = 32
 >      data.l[0] = source indication
 >      data.l[1] = timestamp
 >      data.l[2] = requestor's currently active window, 0 if none
 >      other data.l[] elements = 0
 >
 >    Source indication should be 1 when the request comes from an
 >    application, and 2 when it comes from a pager. Clients using older
 >    version of this spec use 0 as source indication, see the section called
 >    "Source indication in request" for details. The timestamp is Client's
 >    last user activity timestamp (see _NET_WM_USER_TIME) at the time of the
 >    request, and the currently active window is the Client's active toplevel
 >    window, if any (the Window Manager may be e.g. more likely to obey the
 >    request if it will mean transferring focus from one active window to
 >    another).
 >
 >    Depending on the information provided with the message, the Window
 >    Manager may decide to refuse the request (either completely ignore it,
 >    or e.g. use _NET_WM_STATE_DEMANDS_ATTENTION).
 >
 > The current implementation of x_ewmh_activate_frame seems to work fine.

OK.

 >> I faintly recall a discussion about a
 >> misinterpretation of timestamps sent to the window-manager (Metacity?)
 >> by Emacs.
 >
 > I've seen Metacity spit out warnings along the lines that XSetInputFocus
 > was called with a wrong timestamp.  But I can't reproduce that right now.

Ahh, I recall that discussion.  Yet another reason why XSetInputFocus
should be avoided for ewmh-compliant window managers.  We should avoid
calling XSetInputFocus for these in the present release.

So I think we can distinguish three types of window managers according
to our needs and what _NET_SUPPORTS tells us:

- _NET_WM_USER_TIME capable ones, where we can have `display-buffer' not
   set the input focus for new frames (and thus not implicitly select the
   new window thus contradicting the doc-string of `display-buffer').  I
   suppose Metacity falls into this group.

- _NET_ACTIVE_WINDOW capable ones, where `display-buffer' will behave as
   now but x_ewmh_activate_frame works.  Sawfish seems to belong here.

- Non-ewmh-compliant ones where we have to use XSetInputFocus.

martin







  reply	other threads:[~2008-08-30 13:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <48C8C046.50203@gmx.at>
2008-08-20  7:35 ` bug#745: pop-to-buffer, frames, and input focus Helmut Eller
2008-08-20 14:50   ` martin rudalics
2008-08-20 18:42     ` Helmut Eller
2008-08-20 20:42       ` David Reitter
2008-08-20 20:56       ` martin rudalics
2008-08-21  8:07         ` Helmut Eller
2008-08-21  9:04           ` martin rudalics
2008-08-21 13:20             ` Helmut Eller
2008-08-21 20:31               ` martin rudalics
2008-08-22 14:27                 ` Helmut Eller
2008-08-22 16:39                   ` martin rudalics
2008-08-23  8:55                     ` Helmut Eller
2008-08-23 12:05                       ` martin rudalics
2008-08-24 13:14                         ` Helmut Eller
2008-08-25 13:45                           ` martin rudalics
2008-08-26 21:45                             ` Helmut Eller
2008-08-27  8:12                               ` martin rudalics
2008-08-27 12:54                                 ` Helmut Eller
2008-08-28 11:46                                   ` martin rudalics
2008-08-28 16:47                                     ` Helmut Eller
2008-08-28 21:26                                       ` martin rudalics
2008-08-29  7:39                                         ` Helmut Eller
2008-08-29  9:26                                           ` martin rudalics
2008-08-29 15:02                                             ` Helmut Eller
2008-08-30  8:15                                               ` martin rudalics
2008-08-30 11:06                                                 ` Helmut Eller
2008-08-30 13:42                                                   ` martin rudalics [this message]
2008-08-31  8:55                                                     ` Helmut Eller
2008-09-06 11:56                                                       ` martin rudalics
2008-09-09  6:24                                                         ` Helmut Eller
2008-09-11  7:05   ` bug#745: marked as done (pop-to-buffer, frames, and input focus) Emacs bug Tracking System

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=48B94E28.9040707@gmx.at \
    --to=rudalics@gmx.at \
    --cc=745@emacsbugs.donarmstrong.com \
    --cc=eller.helmut@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).