From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Feng Shu" Newsgroups: gmane.emacs.devel Subject: Re: How to create a small child-frame which only show two lines Date: Sat, 06 Jan 2018 18:42:28 +0800 Message-ID: <878tdbe0a3.fsf@163.com> References: <32764281.548.1602e496fa6.Coremail.tumashu@163.com> <5A290998.6030900@gmx.at> <5A2A6572.4060700@gmx.at> <65440769.c307.16036041a32.Coremail.tumashu@163.com> <5A2BBC7E.9020400@gmx.at> <65b6adf3.bf1.16042f29094.Coremail.tumashu@163.com> <5A2E28CF.6010405@gmx.at> <17dd098a.99e0.16044b145db.Coremail.tumashu@163.com> <5A2F99B3.6000800@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1515235301 11026 195.159.176.226 (6 Jan 2018 10:41:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 6 Jan 2018 10:41:41 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) Cc: Feng Shu , emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 06 11:41:37 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eXluv-0002Io-SB for ged-emacs-devel@m.gmane.org; Sat, 06 Jan 2018 11:41:33 +0100 Original-Received: from localhost ([::1]:58543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXlwv-0000Tt-65 for ged-emacs-devel@m.gmane.org; Sat, 06 Jan 2018 05:43:37 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXlw1-0000SV-9D for emacs-devel@gnu.org; Sat, 06 Jan 2018 05:42:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eXlvy-0005b5-5K for emacs-devel@gnu.org; Sat, 06 Jan 2018 05:42:41 -0500 Original-Received: from m12-14.163.com ([220.181.12.14]:51891) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXlvx-0005YS-G4 for emacs-devel@gnu.org; Sat, 06 Jan 2018 05:42:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=OaH15 x53evSz28nfjqNuAWH9gPF8skdrYLSWUg43HOw=; b=DnouRDVw6S2maxPxk9TcD IIUAzZL0Kab9r5mZ2Niiarc1TFa+qU4+fnNMOriPveTfqIixJKk4aZzrFoRsYJWX svhNEMf5oFB+ccZqXsRHD3zAxfkf6zRz6ZSWvJ0GmF7rjOIF84fY1Vt5HQxjgXir 1y2L86sE70oGsuzPLWao0o= Original-Received: from tumashu (unknown [36.149.40.16]) by smtp10 (Coremail) with SMTP id DsCowAB3HmcUqFBakBrPBQ--.14632S2; Sat, 06 Jan 2018 18:42:29 +0800 (CST) In-Reply-To: <5A2F99B3.6000800@gmx.at> (martin rudalics's message of "Tue, 12 Dec 2017 09:56:19 +0100") X-CM-TRANSID: DsCowAB3HmcUqFBakBrPBQ--.14632S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7tF1Utr48CryDGFW3Ww1kGrg_yoW8XFyrpw 13tr17Ar17KF48Xr18tr1xCF15u3s5tr4jyrykGrW8Cr15Ar18tFy5Kr9Yy3s8G3yDCw1U JF4UGrW8A3WUA37anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zRcB_UUUUUU= X-Originating-IP: [36.149.40.16] X-CM-SenderInfo: 5wxpt2lkx6il2tof0z/1tbiLxXF1FUMEyItZQAAsL X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 220.181.12.14 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:221639 Archived-At: martin rudalics writes: The below is a simple version, and it works well for pyim and is easy understand. --------------------------------------------------------------------------- (defun pyim-tooltip-compute-pixel-position (pos pixel-width pixel-height) "Return pixel position of POS in WINDOW, which indicates relative coordinates of bottom left corner of the object, its returned value is like (X . Y) If PIXEL-WIDTH and PIXEL-HEIGHT are given, this function regard these values as the size of a small window located around the POS, for example: tooltip. These values are used to adjust the small window's location and let it not disappear by sticking out of the display. This function is shameless steal from pos-tip." (let* ((window (selected-window)) (frame (window-frame window)) (xmax (frame-pixel-width frame)) (ymax (frame-pixel-height frame)) (posn (posn-at-point pos window)) (line (cdr (posn-actual-col-row posn))) (line-height (or (window-line-height line window) (and (redisplay t) (window-line-height line window)))) (x-y (or (posn-x-y posn) '(0 . 0))) (x (+ (car (window-inside-pixel-edges window)) (car x-y))) (y0 (+ (cadr (window-pixel-edges window)) (or (nth 2 line-height) (cdr x-y)))) (y (+ y0 (car line-height)))) (cons (max 0 (min x (- xmax (or pixel-width 0)))) (max 0 (if (> (+ y (or pixel-height 0)) ymax) (- y0 (or pixel-height 0)) y))))) ------------------------------------------------------------------- --