unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17408: 24.4.50; tooltips make ms-window go top
@ 2014-05-05 13:40 Jarek Czekalski
  2014-05-05 13:56 ` Eli Zaretskii
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Jarek Czekalski @ 2014-05-05 13:40 UTC (permalink / raw)
  To: 17408

I reproduce it on Windows 7, with today's trunk. But this is not new, I
just found a way to reproduce it, when the bucket of irritation overfilled.

1. Start "cmd"
2. From cmd do "runemacs -Q"
3. Arrange the windows so that cmd window is on top, but below is the
emacs window with toolbar visible.
4. Hover with mouse over toolbar button until tooltip appears.
5. Emacs windows goes top, covering cmd window. Cmd remains the active
app, you can type some letters to confirm that.

Expected behaviour: At 5 cmd window should stay on top, being fully
visible, not covered by Emacs window.

It's annoying when you accidentaly provoke the tooltip and bury your
application. Forgive me having Emacs always open and full screen :) It
happens with other tooltips too, for example tooltips in Occur buffer.

Fix suggestion: maybe tooltips should be supressed when Emacs is not the
active application.



In GNU Emacs 24.4.50.6 (i686-pc-mingw32)
  of 2014-05-05 on BONSOFTW7
Repository revision: 117061 rgm@gnu.org-20140505010854-t7blwdpa40ejp0xh
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
  `configure --prefix=d:/program_files/emacs-master'

Configured features:
PNG NOTIFY ACL GNUTLS LIBXML2 ZLIB

Important settings:
   value of $LANG: pl
   locale-coding-system: cp1250

Major mode: Lisp Interaction

Minor modes in effect:
   tooltip-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Recent input:
<down-mouse-1> <mouse-1> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <down-mouse-1> <mouse-1> <help-echo> M-x
r e p o r <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message dired format-spec
rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util help-fns mail-prsvr mail-utils time-date tooltip
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32
ls-lisp w32-common-fns disp-table w32-win w32-vars tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode
register page menu-bar rfn-eshadow timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
w32notify w32 multi-tty emacs)

Memory information:
((conses 8 78003 7556)
  (symbols 24 17728 0)
  (miscs 20 40 148)
  (strings 16 11985 4710)
  (string-bytes 1 307839)
  (vectors 8 9308)
  (vector-slots 4 372219 4670)
  (floats 8 59 178)
  (intervals 28 228 0)
  (buffers 508 12))





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

* bug#17408: 24.4.50; tooltips make ms-window go top
  2014-05-05 13:40 bug#17408: 24.4.50; tooltips make ms-window go top Jarek Czekalski
@ 2014-05-05 13:56 ` Eli Zaretskii
  2014-05-05 14:19 ` Jarek Czekalski
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2014-05-05 13:56 UTC (permalink / raw)
  To: Jarek Czekalski; +Cc: 17408

> Date: Mon, 05 May 2014 15:40:41 +0200
> From: Jarek Czekalski <jarekczek@poczta.onet.pl>
> 
> I reproduce it on Windows 7, with today's trunk. But this is not new, I
> just found a way to reproduce it, when the bucket of irritation overfilled.
> 
> 1. Start "cmd"
> 2. From cmd do "runemacs -Q"
> 3. Arrange the windows so that cmd window is on top, but below is the
> emacs window with toolbar visible.
> 4. Hover with mouse over toolbar button until tooltip appears.
> 5. Emacs windows goes top, covering cmd window. Cmd remains the active
> app, you can type some letters to confirm that.
> 
> Expected behaviour: At 5 cmd window should stay on top, being fully
> visible, not covered by Emacs window.

I remember this behavior since I don't know when.  If someone knows
how to avoid it, explanations and/or patches are welcome.

> Fix suggestion: maybe tooltips should be supressed when Emacs is not the
> active application.

Thanks, but that's not a good suggestion, IMO.  For example, I
frequently work with Emacs windows that are in the background, and
have "focus follows mouse" set so that I could type into such windows.

In any case, when the mouse is inside an Emacs frame, Emacs gets a
Windows message about that, and it should process that message; it
cannot just disregard it.  So I don't see how your suggestion could
be implemented in practice.





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

* bug#17408: 24.4.50; tooltips make ms-window go top
  2014-05-05 13:40 bug#17408: 24.4.50; tooltips make ms-window go top Jarek Czekalski
  2014-05-05 13:56 ` Eli Zaretskii
@ 2014-05-05 14:19 ` Jarek Czekalski
  2014-05-05 14:47   ` Eli Zaretskii
  2014-05-06 14:46 ` Jarek Czekalski
  2014-05-06 16:06 ` Jarek Czekalski
  3 siblings, 1 reply; 10+ messages in thread
From: Jarek Czekalski @ 2014-05-05 14:19 UTC (permalink / raw)
  To: 17408

> I
> frequently work with Emacs windows that are in the background, and
> have "focus follows mouse" set so that I could type into such windows.

And you would miss the tooltip so much? :)

> So I don't see how your suggestion could
> be implemented in practice.

My suggestion was to check whether the window is active right before 
displaying the tooltip. If the window is not active, the tooltip gets 
not displayed. Maybe the tooltip should still be displayed if "focus 
follows mouse" is set.

I don't see how this messes with your Emacs usage. Also don't know yet 
if it's feasible. But that's just a preliminary suggestion. If it gets 
accepted, it may be the simplest way to help the issue.

However Mozilla Thunderbird tooltips do not have this side effect. And 
sometimes Mozilla is even capable of supressing the incorrect Emacs 
behaviour. And I don't see its Mozilla's "create message" window be 
affected by Emacs. Yeah, this is not quite straighforward.

Jarek






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

* bug#17408: 24.4.50; tooltips make ms-window go top
  2014-05-05 14:19 ` Jarek Czekalski
@ 2014-05-05 14:47   ` Eli Zaretskii
  2014-05-05 15:18     ` Jarek Czekalski
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2014-05-05 14:47 UTC (permalink / raw)
  To: Jarek Czekalski; +Cc: 17408

> Date: Mon, 05 May 2014 16:19:42 +0200
> From: Jarek Czekalski <jarekczek@poczta.onet.pl>
> 
> > I
> > frequently work with Emacs windows that are in the background, and
> > have "focus follows mouse" set so that I could type into such windows.
> 
> And you would miss the tooltip so much? :)

Tooltips are a legitimate part of working with a frame.  I don't think
my personal preferences count in this matter.

> > So I don't see how your suggestion could
> > be implemented in practice.
> 
> My suggestion was to check whether the window is active right before 
> displaying the tooltip. If the window is not active, the tooltip gets 
> not displayed. Maybe the tooltip should still be displayed if "focus 
> follows mouse" is set.

What does that mean in practice?  How to determine whether a window
"is active" when it accepts Windows messages?

> I don't see how this messes with your Emacs usage. Also don't know yet 
> if it's feasible. But that's just a preliminary suggestion. If it gets 
> accepted, it may be the simplest way to help the issue.

I'd have to see the details to make up my mind.





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

* bug#17408: 24.4.50; tooltips make ms-window go top
  2014-05-05 14:47   ` Eli Zaretskii
@ 2014-05-05 15:18     ` Jarek Czekalski
  2014-05-05 15:42       ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Jarek Czekalski @ 2014-05-05 15:18 UTC (permalink / raw)
  To: 17408

W dniu 2014-05-05 16:47, Eli Zaretskii pisze:
> What does that mean in practice? How to determine whether a window "is 
> active" when it accepts Windows messages? 

Active in sense of WM_ACTIVATEAPP message:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms632614%28v=vs.85%29.aspx

Emacs could maintain app_is_active flag using this message.

Jarek






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

* bug#17408: 24.4.50; tooltips make ms-window go top
  2014-05-05 15:18     ` Jarek Czekalski
@ 2014-05-05 15:42       ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2014-05-05 15:42 UTC (permalink / raw)
  To: Jarek Czekalski; +Cc: 17408

> Date: Mon, 05 May 2014 17:18:49 +0200
> From: Jarek Czekalski <jarek@jarek.katowice.pl>
> 
> W dniu 2014-05-05 16:47, Eli Zaretskii pisze:
> > What does that mean in practice? How to determine whether a window "is 
> > active" when it accepts Windows messages? 
> 
> Active in sense of WM_ACTIVATEAPP message:
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms632614%28v=vs.85%29.aspx
> 
> Emacs could maintain app_is_active flag using this message.

Patches are welcome, of course.





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

* bug#17408: 24.4.50; tooltips make ms-window go top
  2014-05-05 13:40 bug#17408: 24.4.50; tooltips make ms-window go top Jarek Czekalski
  2014-05-05 13:56 ` Eli Zaretskii
  2014-05-05 14:19 ` Jarek Czekalski
@ 2014-05-06 14:46 ` Jarek Czekalski
  2014-05-06 15:08   ` Eli Zaretskii
  2014-05-06 15:26   ` Jarek Czekalski
  2014-05-06 16:06 ` Jarek Czekalski
  3 siblings, 2 replies; 10+ messages in thread
From: Jarek Czekalski @ 2014-05-06 14:46 UTC (permalink / raw)
  To: 17408

[-- Attachment #1: Type: text/plain, Size: 793 bytes --]

Actually a complete solution was even easier. First I noticed that a 
Java app I use (muCommander) also retreats from displaying tooltips when 
the app is inactive. Then a Google search gave me this JDK bug report 
[1]. And once the SWP_NOOWNERZORDER flag was mentioned, the rest was a 
walk in a park.

Double checking what flags others use for their tooltips revealed 
nothing more, see this for example [3].

Attaching a patch that applies this flag to our tooltip SetWindowPos [2] 
invocations, in w32fns.c. Works for me. Tested on trunk and emacs24.

If you agree, I might commit this to emacs24.

Jarek

[1] http://bugs.java.com/view_bug.do?bug_id=6770457
[2] 
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545%28v=vs.85%29.aspx
[3] http://www.vtdev.com/net/tooltip.html


[-- Attachment #2: tooltips_1_00.patch --]
[-- Type: text/plain, Size: 1989 bytes --]

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2014-05-05 17:37:43 +0000
+++ src/ChangeLog	2014-05-06 13:59:45 +0000
@@ -1,3 +1,9 @@
+2014-05-06  Jarek Czekalski  <jarekczek@poczta.onet.pl>
+
+	Stop tooltips pulling Emacs window to front (Bug#17408).
+	* w32fns.c (Fx_show_tip): Add SWP_NOOWNERZORDER flag to
+	SetWindowPos invocations.
+
 2014-05-05  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* nsselect.m (Fx_selection_exists_p): Just return Qnil if window system

=== modified file 'src/w32fns.c'
--- src/w32fns.c	2014-03-21 09:23:22 +0000
+++ src/w32fns.c	2014-05-06 13:50:02 +0000
@@ -5984,6 +5984,7 @@
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   int old_windows_or_buffers_changed = windows_or_buffers_changed;
   ptrdiff_t count = SPECPDL_INDEX ();
+  #define SWP_EMACS_TOOLTIP (SWP_NOACTIVATE | SWP_NOOWNERZORDER)
 
   specbind (Qinhibit_redisplay, Qt);
 
@@ -6036,12 +6037,12 @@
 	  /* Put tooltip in topmost group and in position.  */
 	  SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOPMOST,
 			root_x, root_y, 0, 0,
-			SWP_NOSIZE | SWP_NOACTIVATE);
+			SWP_NOSIZE | SWP_EMACS_TOOLTIP);
 
 	  /* Ensure tooltip is on top of other topmost windows (eg menus).  */
 	  SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOP,
 			0, 0, 0, 0,
-			SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+			SWP_NOMOVE | SWP_NOSIZE | SWP_EMACS_TOOLTIP);
 
 	  unblock_input ();
 	  goto start_timer;
@@ -6239,12 +6240,12 @@
     SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOPMOST,
 		  root_x, root_y,
 		  rect.right - rect.left + FRAME_COLUMN_WIDTH (f),
-		  rect.bottom - rect.top, SWP_NOACTIVATE);
+		  rect.bottom - rect.top, SWP_EMACS_TOOLTIP);
 
     /* Ensure tooltip is on top of other topmost windows (eg menus).  */
     SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOP,
 		  0, 0, 0, 0,
-		  SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+		  SWP_NOMOVE | SWP_NOSIZE | SWP_EMACS_TOOLTIP);
 
     /* Let redisplay know that we have made the frame visible already.  */
     SET_FRAME_VISIBLE (f, 1);


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

* bug#17408: 24.4.50; tooltips make ms-window go top
  2014-05-06 14:46 ` Jarek Czekalski
@ 2014-05-06 15:08   ` Eli Zaretskii
  2014-05-06 15:26   ` Jarek Czekalski
  1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2014-05-06 15:08 UTC (permalink / raw)
  To: Jarek Czekalski; +Cc: 17408

> Date: Tue, 06 May 2014 16:46:37 +0200
> From: Jarek Czekalski <jarekczek@poczta.onet.pl>
> 
> Actually a complete solution was even easier. First I noticed that a 
> Java app I use (muCommander) also retreats from displaying tooltips when 
> the app is inactive. Then a Google search gave me this JDK bug report 
> [1]. And once the SWP_NOOWNERZORDER flag was mentioned, the rest was a 
> walk in a park.
> 
> Double checking what flags others use for their tooltips revealed 
> nothing more, see this for example [3].
> 
> Attaching a patch that applies this flag to our tooltip SetWindowPos [2] 
> invocations, in w32fns.c. Works for me. Tested on trunk and emacs24.
> 
> If you agree, I might commit this to emacs24.

Looks good, thanks.  But please use the SWP_* flags explicitly, I see
no reason to define a special macro for 2 of them when all the rest
are spelled out.

Other than that, please go ahead and commit to emacs-24.





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

* bug#17408: 24.4.50; tooltips make ms-window go top
  2014-05-06 14:46 ` Jarek Czekalski
  2014-05-06 15:08   ` Eli Zaretskii
@ 2014-05-06 15:26   ` Jarek Czekalski
  1 sibling, 0 replies; 10+ messages in thread
From: Jarek Czekalski @ 2014-05-06 15:26 UTC (permalink / raw)
  To: 17408

Eli,

Thanks for the quick review.

> But please use the SWP_* flags explicitly, I see
> no reason to define a special macro for 2 of them when all the rest
> are spelled out.

There are 2 reasons:
1. 78 chars limit is exceeded and code looks worse without the macro. 
It's less readable and it's more difficult to say which flags change 
between invocations.
2. These 2 flags wrapped in a def are of constant nature, they must be 
used with every call to SetWindowPos. Those out of def are not used in 
all invocations and their presence depends on other parameters (size, 
origin).

I'm preparing to commit the version without macros, but if you're quick 
you can change your mind :)

Jarek






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

* bug#17408: 24.4.50; tooltips make ms-window go top
  2014-05-05 13:40 bug#17408: 24.4.50; tooltips make ms-window go top Jarek Czekalski
                   ` (2 preceding siblings ...)
  2014-05-06 14:46 ` Jarek Czekalski
@ 2014-05-06 16:06 ` Jarek Czekalski
  3 siblings, 0 replies; 10+ messages in thread
From: Jarek Czekalski @ 2014-05-06 16:06 UTC (permalink / raw)
  To: 17408-done

Applied as r117073 to emacs-24 branch [1]. Will be included in version 24.4.

http://bzr.savannah.gnu.org/lh/emacs/emacs-24/revision/117073






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

end of thread, other threads:[~2014-05-06 16:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-05 13:40 bug#17408: 24.4.50; tooltips make ms-window go top Jarek Czekalski
2014-05-05 13:56 ` Eli Zaretskii
2014-05-05 14:19 ` Jarek Czekalski
2014-05-05 14:47   ` Eli Zaretskii
2014-05-05 15:18     ` Jarek Czekalski
2014-05-05 15:42       ` Eli Zaretskii
2014-05-06 14:46 ` Jarek Czekalski
2014-05-06 15:08   ` Eli Zaretskii
2014-05-06 15:26   ` Jarek Czekalski
2014-05-06 16:06 ` Jarek Czekalski

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