From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chris Feng Newsgroups: gmane.emacs.devel 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 Message-ID: References: <56BDF3DE.2050704@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1455329762 566 80.91.229.3 (13 Feb 2016 02:16:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 13 Feb 2016 02:16:02 +0000 (UTC) Cc: Emacs developers To: =?UTF-8?B?Q2zDqW1lbnQgUGl0LS1DbGF1ZGVs?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 13 03:16:01 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aUPkf-0000MY-FY for ged-emacs-devel@m.gmane.org; Sat, 13 Feb 2016 03:16:01 +0100 Original-Received: from localhost ([::1]:38238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUPkb-0005qq-K2 for ged-emacs-devel@m.gmane.org; Fri, 12 Feb 2016 21:15:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUPkY-0005qb-Eb for emacs-devel@gnu.org; Fri, 12 Feb 2016 21:15:55 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aUPkX-0005ua-At for emacs-devel@gnu.org; Fri, 12 Feb 2016 21:15:54 -0500 Original-Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:38509) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUPkX-0005uW-3G for emacs-devel@gnu.org; Fri, 12 Feb 2016 21:15:53 -0500 Original-Received: by mail-wm0-x235.google.com with SMTP id p63so41392390wmp.1 for ; Fri, 12 Feb 2016 18:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=F/MX7LmeYPy0Ipm6o0k4W60025llWRNs+KcVHpQnVkY=; b=Yz9vb2UCfKZzSy8O1nQhkSuVExToGHnDA5UvLhk30JQR+PlYsAvxFyT8PPvjoqIyQI CxeplgRfPHDH79QPvwamylUIq0xdWJWKNoFk64VrRalreJ4Tc4bBKSIgylNQHkvYV1sP 8HkdEYDXQb/+Y50T7mGWPRMkcqT0DetJyLIBYykyAxpcdIVC4feV975UqxwDd5ve2TIR RtO/kmGBQnjiO059Xq+GFSLrXgrEAv8f/WNH7y8CBT9GTZXgPWpJDMHTygQQYWu1tVpe l1gg6yvhjYqJBXErTMNfWpqt5kgoH9Ea7QI6V/GsN1zL7eM7Q+CB5PDkG0B1WWT/IRNN jg7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=F/MX7LmeYPy0Ipm6o0k4W60025llWRNs+KcVHpQnVkY=; b=Uy2xeHkNwvn8VQCRAIzRHbU9GEXj9sjxWbBinf8a81684cg9jpzmzWbLlt9qsAW5ij SJ4lI31H5bBvcJxTy2wC6SMK/XItU3NNEo8+n2Z0gKPapzet0TAfNmA3Nw8OGmawD/tB GG0f0YB1c6KadG3QkEYwnWbb0RcAsexuW6uMMoqVmfsGWKQfSSc7Rfekx9iyMhnh1evW Pkye8RRLttkfixadC04npOZrXV+9nli2HvW3xcw1NNYkL7kt/aVnoqVNWXhBFE5PUR9v JrBQEYkuyjrkGk4EiH8ggiQCQnuPOTnlkoI3b+TLmIZ/e0ftqwan5oFKxUASHm/9gYjw 7n5w== X-Gm-Message-State: AG10YOR+8+xkz/Hns8/47YgPHWDY+o0ryn4VnMTnG/zQcWz7/S6xi2fd8h6tVI49BI+FhxdUk3EMt/yYXRqdMw== X-Received: by 10.28.99.136 with SMTP id x130mr953590wmb.12.1455329752560; Fri, 12 Feb 2016 18:15:52 -0800 (PST) Original-Received: by 10.194.190.104 with HTTP; Fri, 12 Feb 2016 18:15:52 -0800 (PST) In-Reply-To: <56BDF3DE.2050704@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::235 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:199847 Archived-At: > 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 adv= antages, including better interaction with font sizes, no issues with recur= sive display specs, good support for variable-width fonts, and so on. I bel= ieve 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 package= s that display tooltips while completion is ongoing. Examples include compa= ny-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. Unfortunat= ely, I've been hitting a wall when it comes to displaying a borderless fram= e. I asked on https://emacs.stackexchange.com/questions/20167/how-do-i-crea= te-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), "borderW= idth", "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 =3D 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)