Issue 97494

Summary: XTopWindow.toFront does not always move the window to the front
Product: App Dev Reporter: odd_bloke <daniel.watkins>
Component: apiAssignee: AOO issues mailing list <issues>
Status: UNCONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues, Mathias_Bauer
Version: 3.3.0 or older (OOo)   
Target Milestone: ---   
Hardware: Unknown   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description odd_bloke 2008-12-22 13:47:19 UTC
If the XTopWindow doesn't have focus when the toFront() call is made, then it
won't move at all.  I would expect the toFront() call to send the window to the
front whenever it is called.

When calling XTopWindow.toFront, the API code calls Window::ToTop[0] which calls
Window::ImplStartToTop[1] which in turn calls Window::ImplToTop[2].

Window::ImplToTop includes the following check:
  if ( !mpWindowImpl->mpFrameData->mbHasFocus &&
       !mpWindowImpl->mpFrameData->mbSysObjFocus &&
       !mpWindowImpl->mpFrameData->mbInSysObjFocusHdl &&
       !mpWindowImpl->mpFrameData->mbInSysObjToTopHdl )

If this check is false, then the call is just ignored.  Commenting out the first
line of this check causes the issue to go away (and is what we've had to do, as
we need this API call to work).

There should probably be something like a TOTOP_IREALLYMEANIT flag (or perhaps
TOTOP_IGNOREFOCUS would be more appropriate) which the API call could pass
through which would bypass the above check.


[Footnote 0:
http://svn.services.openoffice.org/opengrok/xref/Current/vcl/source/window/window.cxx#6958]
[Footnote 1:
http://svn.services.openoffice.org/opengrok/xref/Current/vcl/source/window/window.cxx#ImplStartToTop]
[Footnote 2:
http://svn.services.openoffice.org/opengrok/xref/Current/vcl/source/window/window.cxx#ImplToTop]
Comment 1 jsc 2009-01-05 09:25:07 UTC
jsc -> cd: a toolkit issue. I am not sure but i assume it's more a VCL issue.   
Comment 2 Mathias_Bauer 2009-06-08 10:57:54 UTC
I assume that the reason is that we don't allow to "steal" the focus here. So
only when an OOo window already has the focus, toFront() will work. It is indeed
questionable whether this is an exaggeration. If we change it we have to test
how this influences the focus behavior of OOo wrt. opening new top level windows.