unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How to get information of a tip created by x-show-tip
@ 2019-01-19  4:29 Feng Shu
  2019-01-19  7:22 ` Eli Zaretskii
  2019-01-19  8:12 ` martin rudalics
  0 siblings, 2 replies; 13+ messages in thread
From: Feng Shu @ 2019-01-19  4:29 UTC (permalink / raw)
  To: Emacs-Devel devel


Hi

I want to get a tip's information created by x-show-tip,  for example: width, height, x and y

but I fail to find the way, anyone can help me?

by the way, is a tip a window or a frame?


thanks very much :-)



-- 




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How to get information of a tip created by x-show-tip
  2019-01-19  4:29 How to get information of a tip created by x-show-tip Feng Shu
@ 2019-01-19  7:22 ` Eli Zaretskii
  2019-01-19  8:12 ` martin rudalics
  1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2019-01-19  7:22 UTC (permalink / raw)
  To: Feng Shu; +Cc: emacs-devel

> From: "Feng Shu" <tumashu@163.com>
> Date: Sat, 19 Jan 2019 12:29:33 +0800
> 
> I want to get a tip's information created by x-show-tip,  for example: width, height, x and y
> 
> but I fail to find the way, anyone can help me?
> 
> by the way, is a tip a window or a frame?

A tooltip is a frame, when Emacs creates it itself; in that case, you
should be able to find the values in tooltip-frame-parameters.  But
with some toolkits, notably with GTK, the tooltip is by default
produced by the toolkit, and in that case I think the settings are in
the toolkit configuration files, out of Emacs control.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How to get information of a tip created by x-show-tip
  2019-01-19  4:29 How to get information of a tip created by x-show-tip Feng Shu
  2019-01-19  7:22 ` Eli Zaretskii
@ 2019-01-19  8:12 ` martin rudalics
  2019-01-19  9:06   ` Feng Shu
  1 sibling, 1 reply; 13+ messages in thread
From: martin rudalics @ 2019-01-19  8:12 UTC (permalink / raw)
  To: Feng Shu, Emacs-Devel devel

 > I want to get a tip's information created by x-show-tip,  for example: width, height, x and y
 >
 > but I fail to find the way, anyone can help me?

We have invested some efforts to hide information about the tooltip
implementation.  The major reason was to protect our own routines from
operating on tooltip frames and windows.  Compare, for example,

http://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00694.html

 From there you can see that the return value of 'visible-frame-list'
and the 'tooltip' frame paramter can give you the current tooltip
frame if it is visible and native (that is created by Emacs itself).
The size and position paramters of that frame should give you the
values you cited above.

 > by the way, is a tip a window or a frame?

'tooltip' (or 'tip') usually refer to the text only.  Emacs can put
that text into a window, that window into a frame and ask the window
system to display that frame in a window-system window.  But Emacs can
drop that text directly to GTK in which case no frame will be made.
For GTK tooltips no information can be retrieved.

martin



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How to get information of a tip created by x-show-tip
  2019-01-19  8:12 ` martin rudalics
@ 2019-01-19  9:06   ` Feng Shu
  2019-01-19  9:32     ` martin rudalics
  2019-01-19  9:36     ` martin rudalics
  0 siblings, 2 replies; 13+ messages in thread
From: Feng Shu @ 2019-01-19  9:06 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs-Devel devel

martin rudalics <rudalics@gmx.at> writes:

>> I want to get a tip's information created by x-show-tip, for
>> example: width, height, x and y
>>
>> but I fail to find the way, anyone can help me?
>
> We have invested some efforts to hide information about the tooltip
> implementation.  The major reason was to protect our own routines from
> operating on tooltip frames and windows.  Compare, for example,
>
> http://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00694.html
>
> From there you can see that the return value of 'visible-frame-list'
> and the 'tooltip' frame paramter can give you the current tooltip
> frame if it is visible and native (that is created by Emacs itself).
> The size and position paramters of that frame should give you the
> values you cited above.
>

I use the following code to test, but failure
1. width and height parameter do not work
2. I can find any frame with 'tooltip parameter

```
(setq tooltip-reuse-hidden-frame t)
(setq x-gtk-use-system-tooltips nil)

(progn
  (x-show-tip "this is a test"
		      (selected-frame)
              '((name . "tooltip1")
                (internal-border-width . 2)
                (left . 200)
                (top . 300)
                (width . 200)
                (height . 600)
                (border-width . 1)
                (no-special-glyphs . t))
              100 0 0)
  (dolist (frame (visible-frame-list))
    (princ (frame-parameter frame 'tooltip))))

```






>> by the way, is a tip a window or a frame?
>
> 'tooltip' (or 'tip') usually refer to the text only.  Emacs can put
> that text into a window, that window into a frame and ask the window
> system to display that frame in a window-system window.  But Emacs can
> drop that text directly to GTK in which case no frame will be made.
> For GTK tooltips no information can be retrieved.
>
> martin
>

-- 




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How to get information of a tip created by x-show-tip
  2019-01-19  9:06   ` Feng Shu
@ 2019-01-19  9:32     ` martin rudalics
  2019-01-19  9:37       ` Feng Shu
  2019-01-19  9:54       ` Feng Shu
  2019-01-19  9:36     ` martin rudalics
  1 sibling, 2 replies; 13+ messages in thread
From: martin rudalics @ 2019-01-19  9:32 UTC (permalink / raw)
  To: Feng Shu; +Cc: Emacs-Devel devel

 > I use the following code to test, but failure
 > 1. width and height parameter do not work
 > 2. I can find any frame with 'tooltip parameter
 >
 > ```
 > (setq tooltip-reuse-hidden-frame t)

This may hide the frame from 'visible-frame-list'.

 > (setq x-gtk-use-system-tooltips nil)
 >
 > (progn
 >    (x-show-tip "this is a test"
 > 		      (selected-frame)
 >                '((name . "tooltip1")
 >                  (internal-border-width . 2)
 >                  (left . 200)
 >                  (top . 300)
 >                  (width . 200)
 >                  (height . 600)
 >                  (border-width . 1)
 >                  (no-special-glyphs . t))
 >                100 0 0)
 >    (dolist (frame (visible-frame-list))
 >      (princ (frame-parameter frame 'tooltip))))

Evaluating the following here on Windows

(progn
   (x-show-tip "this is a test"
		      (selected-frame)
               '((name . "tooltip1")
                 (internal-border-width . 2)
                 (left . 200)
                 (top . 300)
                 (width . 200)
                 (height . 600)
                 (border-width . 1)
                 (no-special-glyphs . t))
               100 0 0)
   (dolist (frame (visible-frame-list))
     (when (frame-parameter frame 'tooltip)
       (princ (frame-parameters frame)))))

gets me

((tool-bar-position . top) (parent-id) (explicit-name . t)
(display . w32) (visibility . t) (icon-name) (window-id . 1180020)
(scroll-bar-height . 0) (scroll-bar-width . 0) (right-fringe . 0)
(left-fringe . 0) (bottom-divider-width . 0) (right-divider-width . 0)
(top . 300) (left . 200) (buried-buffer-list) (buffer-list *scratch*)
(unsplittable . t) (modeline) (width . 80) (height . 36) (name
. tooltip1) (tooltip . t) (alpha) (cursor-type . box) (auto-lower)
(auto-raise) (no-special-glyphs . t) (border-color . lightyellow)
(cursor-color . black) (mouse-color . black) (background-color
. lightyellow) (foreground-color . black) (internal-border-width . 2)
(border-width . 1) (font . -outline-Courier
New-normal-normal-normal-mono-13-*-*-*-c-*-iso8859-1) (font-backend
uniscribe gdi))

martin



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How to get information of a tip created by x-show-tip
  2019-01-19  9:06   ` Feng Shu
  2019-01-19  9:32     ` martin rudalics
@ 2019-01-19  9:36     ` martin rudalics
  1 sibling, 0 replies; 13+ messages in thread
From: martin rudalics @ 2019-01-19  9:36 UTC (permalink / raw)
  To: Feng Shu; +Cc: Emacs-Devel devel

 > 1. width and height parameter do not work

I forgot to answer that: Emacs adjusts the tooltip window size
according to the contents of the tooltip.  So width and height are
calculated internally and your parameters are not respected.

martin



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How to get information of a tip created by x-show-tip
  2019-01-19  9:32     ` martin rudalics
@ 2019-01-19  9:37       ` Feng Shu
  2019-01-19  9:55         ` Eli Zaretskii
  2019-01-19  9:54       ` Feng Shu
  1 sibling, 1 reply; 13+ messages in thread
From: Feng Shu @ 2019-01-19  9:37 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs-Devel devel

martin rudalics <rudalics@gmx.at> writes:

>> I use the following code to test, but failure
>> 1. width and height parameter do not work
>> 2. I can find any frame with 'tooltip parameter
>>
>> ```
>> (setq tooltip-reuse-hidden-frame t)
>
> This may hide the frame from 'visible-frame-list'.
>
>> (setq x-gtk-use-system-tooltips nil)
>>
>> (progn
>>    (x-show-tip "this is a test"
>> 		      (selected-frame)
>>                '((name . "tooltip1")
>>                  (internal-border-width . 2)
>>                  (left . 200)
>>                  (top . 300)
>>                  (width . 200)
>>                  (height . 600)
>>                  (border-width . 1)
>>                  (no-special-glyphs . t))
>>                100 0 0)
>>    (dolist (frame (visible-frame-list))
>>      (princ (frame-parameter frame 'tooltip))))
>
> Evaluating the following here on Windows
>
> (progn
>   (x-show-tip "this is a test"
> 		      (selected-frame)
>               '((name . "tooltip1")
>                 (internal-border-width . 2)
>                 (left . 200)
>                 (top . 300)
>                 (width . 200)
>                 (height . 600)
>                 (border-width . 1)
>                 (no-special-glyphs . t))
>               100 0 0)
>   (dolist (frame (visible-frame-list))
>     (when (frame-parameter frame 'tooltip)
>       (princ (frame-parameters frame)))))
>
> gets me
>
> ((tool-bar-position . top) (parent-id) (explicit-name . t)
> (display . w32) (visibility . t) (icon-name) (window-id . 1180020)
> (scroll-bar-height . 0) (scroll-bar-width . 0) (right-fringe . 0)
> (left-fringe . 0) (bottom-divider-width . 0) (right-divider-width . 0)
> (top . 300) (left . 200) (buried-buffer-list) (buffer-list *scratch*)
> (unsplittable . t) (modeline) (width . 80) (height . 36) (name
> . tooltip1) (tooltip . t) (alpha) (cursor-type . box) (auto-lower)
> (auto-raise) (no-special-glyphs . t) (border-color . lightyellow)
> (cursor-color . black) (mouse-color . black) (background-color
> . lightyellow) (foreground-color . black) (internal-border-width . 2)
> (border-width . 1) (font . -outline-Courier
> New-normal-normal-normal-mono-13-*-*-*-c-*-iso8859-1) (font-backend
> uniscribe gdi))
>
> martin
>

On linux (guixsd), emacs master, I can see the tooltip but print nil


(setq tooltip-reuse-hidden-frame nil)
(progn
  (x-show-tip "this is a test"
		      (selected-frame)
              '((name . "tooltip1")
                (internal-border-width . 2)
                (left . 200)
                (top . 300)
                (width . 200)
                (height . 600)
                (border-width . 1)
                (no-special-glyphs . t))
              100 0 0)
  (dolist (frame (visible-frame-list))
    (when (frame-parameter frame 'tooltip)
      (princ (frame-parameters frame)))))


-- 




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How to get information of a tip created by x-show-tip
  2019-01-19  9:32     ` martin rudalics
  2019-01-19  9:37       ` Feng Shu
@ 2019-01-19  9:54       ` Feng Shu
  2019-01-19 12:20         ` martin rudalics
  1 sibling, 1 reply; 13+ messages in thread
From: Feng Shu @ 2019-01-19  9:54 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs-Devel devel

martin rudalics <rudalics@gmx.at> writes:

>> I use the following code to test, but failure
>> 1. width and height parameter do not work
>> 2. I can find any frame with 'tooltip parameter
>>
>> ```
>> (setq tooltip-reuse-hidden-frame t)
>
> This may hide the frame from 'visible-frame-list'.
>

Does this mean: when tooltip-reuse-hiden-frame is t, the return of visible-frame-list
will always do not show tooltip frame, no matter tooltip actuly show or
hide?


>> (setq x-gtk-use-system-tooltips nil)
>>
>> (progn
>>    (x-show-tip "this is a test"
>> 		      (selected-frame)
>>                '((name . "tooltip1")
>>                  (internal-border-width . 2)
>>                  (left . 200)
>>                  (top . 300)
>>                  (width . 200)
>>                  (height . 600)
>>                  (border-width . 1)
>>                  (no-special-glyphs . t))
>>                100 0 0)
>>    (dolist (frame (visible-frame-list))
>>      (princ (frame-parameter frame 'tooltip))))
>
> Evaluating the following here on Windows
>
> (progn
>   (x-show-tip "this is a test"
> 		      (selected-frame)
>               '((name . "tooltip1")
>                 (internal-border-width . 2)
>                 (left . 200)
>                 (top . 300)
>                 (width . 200)
>                 (height . 600)
>                 (border-width . 1)
>                 (no-special-glyphs . t))
>               100 0 0)
>   (dolist (frame (visible-frame-list))
>     (when (frame-parameter frame 'tooltip)
>       (princ (frame-parameters frame)))))
>
> gets me
>
> ((tool-bar-position . top) (parent-id) (explicit-name . t)
> (display . w32) (visibility . t) (icon-name) (window-id . 1180020)
> (scroll-bar-height . 0) (scroll-bar-width . 0) (right-fringe . 0)
> (left-fringe . 0) (bottom-divider-width . 0) (right-divider-width . 0)
> (top . 300) (left . 200) (buried-buffer-list) (buffer-list *scratch*)
> (unsplittable . t) (modeline) (width . 80) (height . 36) (name
> . tooltip1) (tooltip . t) (alpha) (cursor-type . box) (auto-lower)
> (auto-raise) (no-special-glyphs . t) (border-color . lightyellow)
> (cursor-color . black) (mouse-color . black) (background-color
> . lightyellow) (foreground-color . black) (internal-border-width . 2)
> (border-width . 1) (font . -outline-Courier
> New-normal-normal-normal-mono-13-*-*-*-c-*-iso8859-1) (font-backend
> uniscribe gdi))
>
> martin
>

-- 




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How to get information of a tip created by x-show-tip
  2019-01-19  9:37       ` Feng Shu
@ 2019-01-19  9:55         ` Eli Zaretskii
  2019-01-19 10:02           ` Feng Shu
  0 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2019-01-19  9:55 UTC (permalink / raw)
  To: Feng Shu; +Cc: rudalics, emacs-devel

> From: "Feng Shu" <tumashu@163.com>
> Date: Sat, 19 Jan 2019 17:37:41 +0800
> Cc: Emacs-Devel devel <emacs-devel@gnu.org>
> 
> On linux (guixsd), emacs master, I can see the tooltip but print nil
> 
> 
> (setq tooltip-reuse-hidden-frame nil)
> (progn
>   (x-show-tip "this is a test"
> 		      (selected-frame)
>               '((name . "tooltip1")
>                 (internal-border-width . 2)
>                 (left . 200)
>                 (top . 300)
>                 (width . 200)
>                 (height . 600)
>                 (border-width . 1)
>                 (no-special-glyphs . t))
>               100 0 0)
>   (dolist (frame (visible-frame-list))
>     (when (frame-parameter frame 'tooltip)
>       (princ (frame-parameters frame)))))

What happens if you set x-gtk-use-system-tooltips to nil?



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How to get information of a tip created by x-show-tip
  2019-01-19  9:55         ` Eli Zaretskii
@ 2019-01-19 10:02           ` Feng Shu
  0 siblings, 0 replies; 13+ messages in thread
From: Feng Shu @ 2019-01-19 10:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rudalics, emacs-devel



>
> What happens if you set x-gtk-use-system-tooltips to nil?

princ nil too

-- 




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How to get information of a tip created by x-show-tip
  2019-01-19  9:54       ` Feng Shu
@ 2019-01-19 12:20         ` martin rudalics
  2019-01-20  1:21           ` Feng Shu
  0 siblings, 1 reply; 13+ messages in thread
From: martin rudalics @ 2019-01-19 12:20 UTC (permalink / raw)
  To: Feng Shu; +Cc: Emacs-Devel devel

 >>> (setq tooltip-reuse-hidden-frame t)
 >>
 >> This may hide the frame from 'visible-frame-list'.
 >>
 >
 > Does this mean: when tooltip-reuse-hiden-frame is t, the return of visible-frame-list
 > will always do not show tooltip frame, no matter tooltip actuly show or
 > hide?

No.  While the tooltip is shown the tooltip frame is on
‘visible-frame-list’.

martin




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: How to get information of a tip created by x-show-tip
  2019-01-19 12:20         ` martin rudalics
@ 2019-01-20  1:21           ` Feng Shu
  2019-01-20  2:09             ` Drew Adams
  0 siblings, 1 reply; 13+ messages in thread
From: Feng Shu @ 2019-01-20  1:21 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs-Devel devel

martin rudalics <rudalics@gmx.at> writes:

>>>> (setq tooltip-reuse-hidden-frame t)
>>>
>>> This may hide the frame from 'visible-frame-list'.
>>>
>>
>> Does this mean: when tooltip-reuse-hiden-frame is t, the return of
>> visible-frame-list
>> will always do not show tooltip frame, no matter tooltip actuly show
>> or
>> hide?
>
> No.  While the tooltip is shown the tooltip frame is on
> ‘visible-frame-list’.
>
> martin
>

Thanks for the information :-)

x-show-tip's background-color works well, but
can not change foreground-color, does it do not support foreground-color?

```
(progn
  (x-show-tip
   (substring-no-properties
    "
this is a test
this is a test
this is a test
this is a test")
   (selected-frame)
   '((name . "tooltip")
     (internal-border-width . 2)
     (background-color . "white")
     (foreground-color . "red")
     (left . 200)
     (top . 300)
     (border-width . 1)
     (no-special-glyphs . t))
   10 0 0)
  (dolist (frame (visible-frame-list))
    (when (frame-parameter frame 'tooltip)
      (princ (frame-parameters frame)))))
```


-- 




^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: How to get information of a tip created by x-show-tip
  2019-01-20  1:21           ` Feng Shu
@ 2019-01-20  2:09             ` Drew Adams
  0 siblings, 0 replies; 13+ messages in thread
From: Drew Adams @ 2019-01-20  2:09 UTC (permalink / raw)
  To: Feng Shu, martin rudalics; +Cc: Emacs-Devel devel

> x-show-tip's background-color works well, but
> can not change foreground-color, does it do not support foreground-
> color?

Haven't been following this thread.  But yes,
you can change the foreground color.  E.g.:

(x-show-tip
  (propertize "cuckoo" 'face `(:foreground "red"))
  (selected-frame)
  nil
  5)

Perhaps you can't do it using an alist, though.
I don't recall - but that's probably why I do
it as shown above.



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-01-20  2:09 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-19  4:29 How to get information of a tip created by x-show-tip Feng Shu
2019-01-19  7:22 ` Eli Zaretskii
2019-01-19  8:12 ` martin rudalics
2019-01-19  9:06   ` Feng Shu
2019-01-19  9:32     ` martin rudalics
2019-01-19  9:37       ` Feng Shu
2019-01-19  9:55         ` Eli Zaretskii
2019-01-19 10:02           ` Feng Shu
2019-01-19  9:54       ` Feng Shu
2019-01-19 12:20         ` martin rudalics
2019-01-20  1:21           ` Feng Shu
2019-01-20  2:09             ` Drew Adams
2019-01-19  9:36     ` martin rudalics

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