Re: Keyboard focus lost in Swing applications (ex: Netbeans) after changing to window

2009-01-20 Thread Tuomo Valkonen
On 2009-01-21, Daniel Clemente  wrote:

>   So the focus problem seems to be a regression introduced in version 1.6
>   of Java and still not corrected... Or maybe it is indeed a bug in ion3;
>   since other window managers (ex: icewm) do work with Java 1.6.

It seems that at most it could be related to different interpretations
of the ICCCM that's a bit vague at this point, race conditions, etc.

One possible problem is the handling of the WM_TAKE_FOCUS call, 
although most "modern" toolkits just seem to ignore X focus
for any widgets, and do their own complicated buggy focus tracking,
(cause of the legendary firefox/gtk focus bug that took years to fix,
and only by an Ion user, not the gtk lamers) so WM_TAKE_FOCUS should
pretty much be ignored.

Try moving the region_finalise_focusing call to the beginning of
clientwin_do_set_focus. This could help -- and seems to be the more
logical order of the calls -- but it will probably break some other
applications. The ICCCM doesn't seem to specify in which order the
WM should set the focus to the application top level window, and
send the WM_TAKE_FOCUS message that tells the client to give the
focus to a more specific widget. Also, since there's no (simple) 
way to coordinate the timestamp of the actual focus change call
with Xlib, and the timestamp for the client message has to be 
obtained by a hack, this could cause problems. 

Probably it won't help, and will break other things, but it
seems worth a try.

-- 
Be an early adopter! Beat the herd! Choose Windows today!



Re: Keyboard focus lost in Swing applications (ex: Netbeans) after changing to window

2009-01-20 Thread Daniel Clemente
Daniel Clemente  writes:

>
>   I will check it again in other systems. 


Hi,
  I tried it with Sun's Java 1.6.0_10 on Debian (another machine). The bug is 
still present.
  However, on the same machine, Sun's Java 1.5.0_16-b02 makes my example work 
as expected (focus is not lost).

  And with libgcj... well, the example didn't work correctly and I didn't see 
the text field. My version:
java version "1.5.0"
gij (GNU libgcj) version 4.3.3 20090110 (prerelease)

  With OpenJDK 1.6.0_0-b11, the bug shows up.
  With the unreleased Java 1.7.0-ea-b43, the same (bug present).

  So the focus problem seems to be a regression introduced in version 1.6 of 
Java and still not corrected...
  Or maybe it is indeed a bug in ion3; since other window managers (ex: icewm) 
do work with Java 1.6.

  In any case, I sent this bug to Java (sorry, it's not public yet). I will 
report progress here.

-- Daniel