unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lennart Borgman <lennart.borgman@gmail.com>
To: David De La Harpe Golden <david@harpegolden.net>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
	Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Re: Add function to make frame topmost?
Date: Sat, 1 May 2010 01:22:28 +0200	[thread overview]
Message-ID: <h2te01d8a51004301622j43064af6h9250af977bc2148b@mail.gmail.com> (raw)
In-Reply-To: <4BDB5A6E.5060803@harpegolden.net>

On Sat, May 1, 2010 at 12:32 AM, David De La Harpe Golden
<david@harpegolden.net> wrote:
> Stefan:
>>
>> I see, thanks.  I don't know if there's a word for such things
>> under X11 (I guess we should ask the freedesktop guys).
>
> Not affiliated with freedesktop as such, just familiar with specs:
>
> ITYM "Always on top" or "above other windows", or technically asking that
> _NET_WM_STATE include _NET_WM_STATE_ABOVE


Thanks.


> N.B. For "normal" windows (such as ordinary emacs frames), this is something
>  usually configured by the user via the window manager's menu, setting it
> within emacs for normal frames would not be something I would particularly
> want or need to do, though possible (*** below), and setting it for special
> framey things is not AFAIK a good idea (following):
>
> http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#STACKINGORDER
>
> [lennart]
>> My use case for something like this is reminders that pops up at a
>> certain times.
>
> Note that X11 apps (or more usually the gui toolkit the app uses) specify
> the purpose of the window in higher-level terms _NET_WM_WINDOW_TYPE, like
> "this is a tooltip", "this is a notification" _NET_WM_WINDOW_TYPE_TOOLTIP,
> _NET_WM_WINDOW_TYPE_NOTIFICATION
> etc.


Then maybe the appropriate abstraction level would be this.

As I understand it the tooltip frame we have in Emacs today is quite
specialized and not easy to extend. I guess the purpose of making it
that way has been ease of the specialized use and low resource
consumption.

The problem is that it is not powerful enough for things like menus of
the type used by for company-mode or completion-ui (see EmacsWiki). So
I am trying to make a quick implementation on w32 of the necessary
frame parts (leaving the other parts to those doing the completion
user interfaces). What is needed is

1) a frame which is topmost.
2) looks like a tooltip frame
3) can show different things
4) can be hidden
5) can be shown without becoming active
6) never becomes the active window
7) looses it topmost property when switching to another app.
8) regains it when switching back
9) has to be recognized as such a frame by Emacs

I am not sure about this list, please comment. What about having a
function make-tooltip-type-frame?

As I understand what you write here much of this is easily available
on X with _NET_WM_WINDOW_TYPE_TOOLTIP. How about point 2 above? 4 and
5? 6? 7 and 8?

w32:
- For 4 and 5 on w32 I have just added the bug report
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6068
- And I just sent the function w32-set-frame-topmost here. This is
needed, of course.
- The w32 window style has to be modified for 2. (Just wrote this.)
- Same for 6.
- 7 and 8 are a bit more difficult (need to check WM_APPACTIVATE).
- 9 is not specific to w32. A bit has to be added to the frame struct.



> The window manager then places it in the appropriate stacking group, among
> other things:
>
> """
> This property SHOULD be used by the window manager in determining the
> decoration, stacking position and other behavior of the window.
> """
>
> The greater diversity in window management on X11 than windoze
> makes observing such things pretty important -  "this is a notification" may
> make a whole lot more sense to a tiling wm than "above plz k thx".
>
> Please note that abusing _NET_WM_STATE for attention purposes is
> specifically highlighted as a What Not To Do in the spec:
>
> """
> _NET_WM_STATE_ABOVE and _NET_WM_STATE_BELOW are mainly meant for user
> preferences and should not be used by applications e.g. for drawing
> attention to their dialogs (the Urgency hint should be used in that case,
> see the section called “Urgency”).'
> """


How does "Urgency" work? Is that appropriate for reminders? I would
prefer that to be a frame that pops up but does not get focus until
the user choosen it.


>
> ***
> One can certainly do this from within emacs as per the spec (note you
> do this for mapped windows by sending a client message to the root window).
>  Note however, that window managers may refuse an app's request to be always
> on top.
>
> (defun x-toggle-frame-always-on-top (&optional frame)
>    (x-send-client-message
>     frame 0 frame "_NET_WM_STATE" 32
>     ;; _NET_WM_STATE_REMOVE = 0
>     ;; _NET_WM_STATE_ADD = 1
>     ;; _NET_WM_STATE_TOGGLE = 2
>     '(2 "_NET_WM_STATE_ABOVE" 0 1)))


Does this work already?




  reply	other threads:[~2010-04-30 23:22 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-30  1:48 Add function to make frame topmost? Lennart Borgman
2010-04-30 13:06 ` Stefan Monnier
2010-04-30 13:26   ` Lennart Borgman
2010-04-30 20:54     ` Stefan Monnier
2010-04-30 22:02       ` Jan Djärv
2010-04-30 22:13         ` Lennart Borgman
2010-05-01  8:00           ` Jan Djärv
2010-04-30 22:32       ` David De La Harpe Golden
2010-04-30 23:22         ` Lennart Borgman [this message]
2010-05-01  1:48           ` David De La Harpe Golden
2010-05-01  2:06             ` Lennart Borgman
2010-05-01 13:05               ` Stefan Monnier
2010-05-01 18:03                 ` David De La Harpe Golden
2010-05-01 20:20                   ` Drew Adams
2010-05-01 22:02                     ` David De La Harpe Golden
2010-05-01 22:09                       ` David De La Harpe Golden
2010-05-02 14:07                       ` Drew Adams
2010-05-02 15:27                         ` David De La Harpe Golden
2010-05-02 15:58                           ` stack-order (z-order) parameter for frames [was: Add function to make frame topmost?] Drew Adams
2010-05-01 22:44                   ` Add function to make frame topmost? Lennart Borgman
2010-05-02  1:18                     ` David De La Harpe Golden
2010-05-02  7:47                       ` Jan Djärv
2010-05-02 12:52                         ` David De La Harpe Golden
2010-05-02  7:27                     ` Jan Djärv
2010-05-02 12:27                       ` Stephen J. Turnbull
2010-05-02 12:53                         ` Jan Djärv
2010-05-02 13:44                           ` David De La Harpe Golden
2010-05-03  3:16                             ` Stephen J. Turnbull
2010-05-02 14:43                         ` David De La Harpe Golden
2010-05-02 14:48                           ` Lennart Borgman
2010-05-02 14:55                             ` David De La Harpe Golden
2010-05-02 16:48                           ` David De La Harpe Golden
2010-05-02 18:58                           ` Jan Djärv
2010-05-02 21:32                             ` Desktop bubble notifications [Was: Re: Add function to make frame topmost?] David De La Harpe Golden
2010-05-03  0:19                               ` Lennart Borgman
2010-05-03  2:29                                 ` David De La Harpe Golden
2010-05-03 19:46                                   ` Stephen Eilert
2010-05-03 19:58                                     ` Lennart Borgman
2010-05-04 11:48                               ` Desktop bubble notifications Bastien
2010-05-02 19:17                         ` Add function to make frame topmost? chad
2010-05-03  3:33                           ` Stephen J. Turnbull
2010-05-02 14:01                       ` Drew Adams
2010-05-02 15:06                         ` Lennart Borgman
2010-05-03  3:43                           ` Stephen J. Turnbull
2010-05-03  9:59                             ` Lennart Borgman
2010-05-03 17:21                               ` Stefan Monnier
2010-05-03 19:50                                 ` Lennart Borgman
2010-05-03 21:31                               ` David De La Harpe Golden
2010-05-02  0:36                   ` Stefan Monnier
2010-05-02  1:17                     ` David De La Harpe Golden
2010-05-01  2:10           ` David De La Harpe Golden
2010-05-01  2:32             ` Lennart Borgman
2010-05-01  3:49               ` Lennart Borgman
2010-05-03 16:39             ` Tom Tromey
2010-05-03 19:33               ` systray support [was: Re: Add function to make frame topmost?] Dan Nicolaescu
2010-05-01  3:19           ` Add function to make frame topmost? David De La Harpe Golden
2010-05-01  8:28           ` Jan Djärv
2010-05-01 19:46             ` David De La Harpe Golden
2010-05-01 22:46               ` Lennart Borgman
2010-05-01  5:25     ` Eli Zaretskii
2010-05-03 12:47 ` Lennart Borgman

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=h2te01d8a51004301622j43064af6h9250af977bc2148b@mail.gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=david@harpegolden.net \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).