emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Could x-show-tip be reimplemented in Elisp? How does one create bord


From: Clément Pit--Claudel
Subject: Re: Could x-show-tip be reimplemented in Elisp? How does one create borderless frames from Elisp?
Date: Tue, 16 Feb 2016 15:05:21 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

On 02/15/2016 05:57 AM, martin rudalics wrote:
>> TL;DR: How do I create a frame without a border, in the style of
>> x_create_tip_frame (called by x-show-tip in the C sources), from
>> Elisp?
> 
> What is a border?  ‘x_create_tip_frame’ creates a frame with up to two
> types of borders, the one specified via the ‘internal-border-width’ and
> the other one specified via the ‘border-width’ frame parameter (where
> the latter is AFAICT used for tooltips only).  At the same time,
> ‘x_create_tip_frame’ tries to suppress decorations of the window manager
> which is probably what you want.

Sorry for being unclear. I mean the frame chrome, that is the title bar and 
minimize, maximize and close buttons.

>> I'm looking at ways in which we could use real tooptip popups instead
>> of overlays to display company-mode completion lists. This would have
>> many advantages, including better interaction with font sizes, no
>> issues with recursive display specs, good support for variable-width
>> fonts, and so on. I believe Stefan has spoken in favour of that
>> approach in the past, too.
> 
> Is there any reason you cannot use menus for this purpose?

I guess it depends on what you mean by menu. Right now, menus don't have the 
features that I listed above AFAICT (for example, can they display faces? Can 
they use the same font fallback mechanisms as Emacs?).

>> The natural candidate for this task is x-show-tip, and it probably
>> meets most of the requirements; but not all. In particular, there can
>> be at most one tooltip displayed at any time; this means that we'd
>> break other packages that display tooltips while completion is
>> ongoing. Examples include company-quickhelp, which displays
>> documentation for the currently selected entry next to completion
>> candidates.
>>
>> `x-show-tip` is currently implemented in C; as far as I can see,
>> however, it essentially creates a frame and displays it at a given
>> location; given this, I thought it would be possible to reimplement it
>> in ELisp. Unfortunately, I've been hitting a wall when it comes to
>> displaying a borderless frame. I asked on
>> https://emacs.stackexchange.com/questions/20167/how-do-i-create-a-borderless-frame,
>> to no avail.
> 
> ‘x-show-tip’ is highly tailored to emulating "conventional" tooltips and
> strongly tied to ‘x-hide-tip’.  Parts of its implementation (in
> particular the Lucid menubar issue) are highly fragile, so better don't
> tinker with it.  

I see, thanks.

> Also a reimplementation in ELisp hardly makes sense
> because the API calls are used to hide the implementation details wrt
> X11 and Windows.

I'm focusing on the case where x-gtk-use-system-tooltips is nil, so that 
tooltips are implemented using  

> You can't use the ‘border-width’ parameter with the
> latter so we have to emulate the X11 behavior somehow with the
> "thin-line" border approach provided by the Windows API.  And the
> GTK/OSX tooltips will behave specially anyway.
> 
>> My original guess was that the relevant part of the C code was this call:
>>
>>    x_default_parameter (f, parms, Qborder_width, make_number (0), 
>> "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
>>
>> Unfortunately, neither (set-frame-param (selected-frame) 'border-width
>> 0) nor (make-frame '((border-width . 0))) (both inspired from the call
>> above) yield a borderless frame.
> 
> These are overridden by the window manager.  ‘border-width’ is the most
> obscure of our frame parameters, it's implementation is beyond our
> control.  You can set it via ‘tooltip-frame-parameters’ and then it is
> usually honored for X11 tooltips (but not on Windows).

Does this apply to system tooltips, or tooltips implemented using a full Emacs 
frame?

>> Is there a way to create a borderless frame from Elisp?
> 
> If a truly borderless frame is what you want, we can do that for X11 and
> Windows.  GTK has ‘gtk_window_set_decorated’ and we could try using that
> as well.  I have no idea how to do that on OSX, maybe Anders has.

Indeed, that's what I'd like. x-show-tip works perfectly for me (it supports 
fonts, faces, etc. properly), expect for the fact that updating the tooltip 
text causes it to be closed and reopened.
> 
> You would, however, have to say how a borderless frame should look like.
> At least the Windows tooltip frame is _not_ borderless.  And on X11 I
> wouldn't know how to remove caption and borders separately.  IIUC you
> can only remove them both or neither.

Thanks for clarifying. I'm mostly trying to get something that looks like an 
Emacs frame with a single window, but without window manager chrome around the 
frame; only the buffer's text.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]