Bug 2827 - seamlessrdp: tooltips in word restack windows
Summary: seamlessrdp: tooltips in word restack windows
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: | rdesktop (deprecated) (show other bugs)
Version: pre-1.0
Hardware: PC Windows
: P2 Normal
Target Milestone: 4.4.0
Assignee: Henrik Andersson
URL:
Keywords: ossman_tester, prosaic
Depends on:
Blocks:
 
Reported: 2008-06-27 08:57 CEST by Pierre Ossman
Modified: 2015-04-21 14:57 CEST (History)
1 user (show)

See Also:
Acceptance Criteria:


Attachments
seamless_tooltip_issue.log (5.66 KB, text/x-log)
2014-11-05 09:00 CET, Henrik Andersson
Details

Description Pierre Ossman cendio 2008-06-27 08:57:43 CEST
We got a really weird bug report in issue 6324 where multiple Word windows kept restacking when the user moved the mouse over certain areas.

I was able to reproduce it here on our version of office (XP) using the following method:

1. Start Word

2. Type something in the document, then press "New" to get a second window

3. Make sure the second window is on top of the window stack

4. Move the mouse pointer over one of the toolbar buttons so that a tooltip pops up

5. Move the mouse pointer away so that the tooltip disappears

At this point it restacks the windows so that the first window is on top. You can see the problem appearing already when the tooltip is created. I suspect some improper parenting.
Comment 3 Peter Åstrand cendio 2014-09-15 11:23:17 CEST
(In reply to comment #0)

> At this point it restacks the windows so that the first window is on top. You
> can see the problem appearing already when the tooltip is created. 

Tried to reproduce on eudemo. When the tooltip appears, the first window is indeed raise. You can see it in the task bar; it's highlighted. However, when the mouse is moved away from the tooltip, the second window is again activated. So slightly different result but probably the same underlying bug.
Comment 5 Henrik Andersson cendio 2014-11-05 09:00:01 CET
Created attachment 588 [details]
seamless_tooltip_issue.log

Enabled seamless debug and reproduced the issue. Cleaned the log file so it contains relevant information and added some comments.

One potential source to the problem was identified, a FOCUS is performed on the window for the first empty document.
Comment 6 Henrik Andersson cendio 2014-11-05 09:05:03 CET
(In reply to comment #5)

> One potential source to the problem was identified, a FOCUS is performed on the
> window for the first empty document.

Looking at the code path for the DESTROY message of the tooltip I could not find any obvious reasons for the send of FOCUS message. However, FOCUS is only sent in one place in rdesktop and that is when XEvent FocusIn is raised for a window.
Comment 7 Henrik Andersson cendio 2014-11-05 12:06:09 CET
The attached logfile shows that When the tooltip window is created the parent window is 0x0003002a which actually should be the second document window 0x00020076.
Comment 8 Henrik Andersson cendio 2014-11-05 12:09:35 CET
(In reply to comment #7)
> The attached logfile shows that When the tooltip window is created the parent
> window is 0x0003002a which actually should be the second document window
> 0x00020076.

Looking at the code for SeamlessRDP (hookdll.c) the parent window is fetched using getWindow(this, GW_OWNER); which obviously is wrong. This might be a bug in winword, need to find a testcase without winword to prove the case.
Comment 9 Henrik Andersson cendio 2014-11-05 12:36:32 CET
(In reply to comment #8)
> (In reply to comment #7)
> > The attached logfile shows that When the tooltip window is created the parent
> > window is 0x0003002a which actually should be the second document window
> > 0x00020076.
> 
> Looking at the code for SeamlessRDP (hookdll.c) the parent window is fetched
> using getWindow(this, GW_OWNER); which obviously is wrong. This might be a bug
> in winword, need to find a testcase without winword to prove the case.
>

Information about owned windows:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms632599(v=vs.85).aspx#owned_windows
Comment 10 Henrik Andersson cendio 2014-11-05 13:55:17 CET
(In reply to comment #8)
> (In reply to comment #7)
> > The attached logfile shows that When the tooltip window is created the parent
> > window is 0x0003002a which actually should be the second document window
> > 0x00020076.
> 
> Looking at the code for SeamlessRDP (hookdll.c) the parent window is fetched
> using getWindow(this, GW_OWNER); which obviously is wrong. This might be a bug
> in winword, need to find a testcase without winword to prove the case.

Another variable to this play;

The problem is only reproducible once, sub-sequential tooltips does not provoke the issue following the protocol:

1. Start word
2. Open a new word instance from toolbarbutton
3. Hoover over a toolbutton for a tooltip
4. Leave tooltip and the first instance of word will be focused

5. Bring focus back to second window by clicking titlebar
6. All sub-sequential tooltips works as expected.
Comment 11 Henrik Andersson cendio 2014-11-05 14:07:06 CET
(In reply to comment #10)

> 
> 1. Start word
> 2. Open a new word instance from toolbarbutton
> 3. Hoover over a toolbutton for a tooltip
> 4. Leave tooltip and the first instance of word will be focused
> 
> 5. Bring focus back to second window by clicking titlebar
> 6. All sub-sequential tooltips works as expected.

The reason seems to be that there are broken logic in rdesktop to track focused window, g_seamless_focused. At point 4, the logic will send a FOCUS message to wrong window (OWNER).

At point 6, there there will be 2 FocusIn XEvents from the window manager one for the owner and one for the correct window. This case will be handled ok with the focus logic.

We need to iron out why there are two FocusIn XEvent for both windows when tooltip window is destroyed.
Comment 13 Henrik Andersson cendio 2014-11-10 11:34:43 CET
After further testing the conclusions are that there are bad behaviors in the winword regarding how windows are handled. Winword tries to handle all its own windows overriding the window manager and that's probably why we see that the OWNER window is another than expected using SeamlessRDP.

To show the bad behavior following these steps on a desktop with winword:

1. Start instance A of winword
2. From toolbar start instance B
3. From instance B toolbar choose open for open dialog
4. Any try to put instance A on top either by titlebar or from
   taskbar will fail.

One will see that winword tries to handle which window has focus and prevent to change the order.

Testing the above with OpenOffice shows the correct behavior.
Comment 14 Henrik Andersson cendio 2014-11-10 12:14:55 CET
(In reply to comment #13)
> 
> Testing the above with OpenOffice shows the correct behavior.

Also verified that using OpenOffice there is not problem with tooltips when trying reproduce the origin issue with SeamlessRDP.
Comment 15 Henrik Andersson cendio 2014-11-10 15:07:05 CET
(In reply to comment #8)
> (In reply to comment #7)
> > The attached logfile shows that When the tooltip window is created the parent
> > window is 0x0003002a which actually should be the second document window
> > 0x00020076.
> 
> Looking at the code for SeamlessRDP (hookdll.c) the parent window is fetched
> using getWindow(this, GW_OWNER); which obviously is wrong. This might be a bug
> in winword, need to find a testcase without winword to prove the case.

winword sets the owner for the the tooltip to the wrong window, probably because it tries to be a window manager for windows spawned from same winword.exe process.

A workaround has been added to SeamlessRDP in upstream commit r1841, which ignores the OWNER window if window is of class "OfficeTooltip"
Comment 16 Henrik Andersson cendio 2014-11-10 16:28:46 CET
(In reply to comment #15)
> (In reply to comment #8)
> > (In reply to comment #7)
> > > The attached logfile shows that When the tooltip window is created the parent
> > > window is 0x0003002a which actually should be the second document window
> > > 0x00020076.
> > 
> > Looking at the code for SeamlessRDP (hookdll.c) the parent window is fetched
> > using getWindow(this, GW_OWNER); which obviously is wrong. This might be a bug
> > in winword, need to find a testcase without winword to prove the case.
> 
> winword sets the owner for the the tooltip to the wrong window, probably
> because it tries to be a window manager for windows spawned from same
> winword.exe process.
> 
> A workaround has been added to SeamlessRDP in upstream commit r1841, which
> ignores the OWNER window if window is of class "OfficeTooltip"

Brought to ctc with vendor drop commit 29580.
Comment 17 Henrik Andersson cendio 2015-01-29 08:26:24 CET
There is no workaround for the issue described in comment #13.

Closing this bug.
Comment 18 Pierre Ossman cendio 2015-04-21 14:57:05 CEST
Tested this with Office 2013 on Windows 2008R2, which is unfortunately not the sambe combination used whilst fixing this bug. Most of the tooltips in the new Office behave just fine in 4.3.0. However those on the status bar entries still exhibit problems.

With the new version in place even those tooltips work just fine though. So I consider this bug properly implemented and tested.

Note You need to log in before you can comment on or make changes to this bug.