On Tue, May 07, 2002, Alexandre Julliard wrote:
I've been working on this too, and I found that the locally active model seems to work better with most window managers, even though it's not 100% correct per the spec. Here's the patch I have, please give it a try and let me know how it works for you.
If your patch is used in globally active mode (Wine config file has "UseTakeFocus" = "Y"), focus loop problem is fixed. However, if I try locally active mode, Wine still enters focus loop.
Some comments about the patch and Wine focus handling:
- Timestamp used in X11DRV_SetFocus is wrong when focus has been gained either due to WM_TAKE_FOCUS or due to FocusIn.
- Routine X11DRV_SetFocus may fail to set focus because focus might have already been passed to another X11 window. In unmanaged mode this is fatal: override_redirect windows receive neither WM_TAKE_FOCUS nor FocusIn and if Wine believes that a window already has focus it won't call X11DRV_SetFocus even when the window receives mouse clicks.
- If X11DRV_SetFocus fails, Wine routine that triggered this call (SetForegroundWindow, SetActiveWindow, SetFocus, etc) should also fail. This is what NT5.0 does according to docs, by the way. This would make it easy to see which window really has focus.
- It is likely that last_focus will be wrong if routine X11DRV_SetFocus fails as described above.
- All Wine windows using override_redirect break ICCCM. This includes all windows in unmanaged mode. In general, it is not possible for override_redirect windows to gain input focus without confusing focus handling of window managers. There are two exceptions to this generalization which likely apply to full-screen applications and menus.
- In locally active model, transferring focus from top-level window to active dialog window requires timestamp CurrentTime which breaks ICCCM compliance. This can break window manager focus handling in some cases. This is likely not very big an issue, but I believe that everything that breaks standards should be properly commented.
- One not directly focus relared problem is that some window managers always put override_redirect windows on top of managed windows. And when you run some applications in managed mode, Wine creates a full screen override_redirect window which has managed dialog window...
Looking at this list makes me believe that fixing Wine focus handling should be assigned much higher priority than it has been so far.
On Sun, May 12, 2002 at 01:13:50PM +0300, Jukka Heinonen wrote:
On Tue, May 07, 2002, Alexandre Julliard wrote:
I've been working on this too, and I found that the locally active model seems to work better with most window managers, even though it's not 100% correct per the spec. Here's the patch I have, please give it a try and let me know how it works for you.
If your patch is used in globally active mode (Wine config file has "UseTakeFocus" = "Y"), focus loop problem is fixed. However, if I try locally active mode, Wine still enters focus loop.
Some comments about the patch and Wine focus handling:
[...]
Looking at this list makes me believe that fixing Wine focus handling should be assigned much higher priority than it has been so far.
Well, feel free to enter a BugZilla bug for that ;-)
Jukka Heinonen jhei@iki.fi writes:
Looking at this list makes me believe that fixing Wine focus handling should be assigned much higher priority than it has been so far.
Actually all the problems you list apply only to unmanaged mode. Fixing that mode to be ICCCM compliant is fairly low priority, and probably quite hopeless. In fact the whole concept of unmanaged mode is flawed, and it will probably be replaced by a managed-with-no-decorations mode (with a few exceptions for menus etc.) once we have the proper support for doing actions like min/maximize through the window manager.
On May 12, 2002 02:51 pm, Alexandre Julliard wrote: [snip]
and probably quite hopeless. In fact the whole concept of unmanaged mode is flawed, and it will probably be replaced by a managed-with-no-decorations mode (with a few exceptions for menus etc.) once we have the proper support for doing actions like min/maximize through the window manager.
Yay!!! I really don't like this unmanaged mode, why have it as default anyway. We should make managed default, with unmanaged (for now) an option. Care for a patch?
"Dimitrie O. Paun" dpaun@rogers.com writes:
Yay!!! I really don't like this unmanaged mode, why have it as default anyway. We should make managed default, with unmanaged (for now) an option. Care for a patch?
Sure; actually you might as well remove the command-line option, it will have to go away for dll separation anyway.
On Sun, May 12, Alexandre Julliard wrote:
Actually all the problems you list apply only to unmanaged mode. Fixing that mode to be ICCCM compliant is fairly low priority, and probably quite hopeless. In fact the whole concept of unmanaged mode is flawed, and it will probably be replaced by a managed-with-no-decorations mode (with a few exceptions for menus etc.) once we have the proper support for doing actions like min/maximize through the window manager.
I'm sorry to sound disrespectful, but I believe that many of those problems I have listed do apply to managed mode, at least if decorations are drawn by Wine. Think about the following scenario:
- User has set window manager into mode where focus is not automatically given to new windows (can be done at least with WindowMaker). - User starts Wine program from xterm command line. - New Wine window is opened, Wine activates window, calls X11DRV_SetFocus and draws active caption bar. However, this is wrong since window manager has kept focus on xterm window and Wine should have drawn passive caption bar.
You are partially correct in the fact that this kind of problems are unlikely to cause serious problems in managed mode. However, they still are bugs, potentially quite visible bugs, too, depending on what (ICCCM compliant) window manager is being used and how that window manager has been configured.
Jukka Heinonen jhei@iki.fi writes:
I'm sorry to sound disrespectful, but I believe that many of those problems I have listed do apply to managed mode, at least if decorations are drawn by Wine.
But Wine doesn't draw the decorations in managed mode. It may do it once we do the managed-with-no-decorations mode I mentioned, but there are much larger problems with that to be solved first.