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: Chris Feng
Subject: Re: Could x-show-tip be reimplemented in Elisp? How does one create borderless frames from Elisp?
Date: Sat, 13 Feb 2016 10:15:52 +0800

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

I think the relevant part in 'x_create_tip_frame' is actually:

  attrs.override_redirect = True;

What you want to do is to remove the decoration added by the window
manager.  So you need to set the override-redirect flag on that X
window.

> Is there a way to create a borderless frame from Elisp?

You may have a look at XELB (available on ELPA).  The following code
should create a frame without decoration.

  (require 'xcb)

  (setq frame (make-frame '((visibility . nil))))

  (let ((window (string-to-number (frame-parameter frame 'outer-window-id)))
        (connection (xcb:connect-to-socket)))
    (xcb:+request connection
        (make-instance 'xcb:ChangeWindowAttributes
                       :window window
                       :value-mask xcb:CW:OverrideRedirect
                       :override-redirect 1))
    (xcb:flush connection)
    (xcb:disconnect connection))

  (make-frame-visible frame)



reply via email to

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