Re: Sawfish focus issues [was: Re: gnome-libs patch]
- From: John Harper <john dcs warwick ac uk>
- To: Michael Meeks <michael helixcode com>
- Cc: Federico Mena Quintero <federico helixcode com>, Dan Winship <danw helixcode com>, gnome-hackers gnome org
- Subject: Re: Sawfish focus issues [was: Re: gnome-libs patch]
- Date: Sat, 23 Dec 2000 10:11:57 -0800
Michael Meeks writes:
| I know little / nothing of X's ways with timestamping events,
|however when I last investigated it it seemed to me that the best we could
|do here was to use CurrentTime to stamp the XSetInputFocus.
I'll try to explain in more detail what I think is happening in the
evolution / xterm bug:
1. switch viewport in sawfish: since the windows in the new viewport
appear one by one, more than one of the windows under the pointer may
get pointer-in events
2. the evolution window gets the first pointer-in (even though it will
end up beneath the maximized xterm). Sawfish receives this and
generates a SetInputFocus event with the timestamp of the current event
3. the xterm window gets the next pointer-in, in response to this
sawfish will focus the window, passing the timestamp of the pointer-in
event to SetInputFocus
4. evolution receives the focus-in event on its window, since it
briefly had the input focus. In response to this it generates a
SetInputFocus request with CurrentTime as the timestamp
5. of the focus requests generated in (4) and (5) evolution's (with
CurrentTime) will `win', since the X server considers it to have
originated later than sawfish's attempt to focus the xterm window
But in fact, the action that originated request (4) (the original
pointer-in) occurred before (3)
So actually I'm not 100% sure that passing the most recently received
timestamp in (4) would solve the problem, it could still be possible
for the race condition to occur, just less likely
A brute-force solution may be to do something like:
XGrabServer (dpy)
XSync (dpy, False);
XGetInputFocus (dpy, &focus, &revert_to);
if (focus == THE-WINDOW-I-THINK-IT-IS)
XSetInputFocus (dpy, THE-WINDOW-I-WANT-IT-TO-BE, CurrentTime);
XSync (dpy, False);
XUngrabServer (dpy)
|
| The function is called in bonobo-socket's implementations of
|GtkWidget's focus_in and focus_out methods. These both get a
|GdkEventFocus, which as it appears to me passes no time stamp. Hence
|gtk_event_get_time will only return CurrentTime.
The way sawfish handles this problem is to remember the last timestamp
it saw (with some logic to handle timestamps arriving out of order
which seems to happen sometimes)
|
| So; all in all, I don't know how you propose to pass the most
|recent timestamp received from the server; perhaps this can be done via
|the serial number, or some API that I am not aware of.
Ideally there would be support in GDK for retrieving the most recent
timestamp. It may also be possible to add this functionality to bobono
using an event filter that saves recent timestamps
|
| Either way, I would greatly value your assistance in resolving
|this since I am not an X expert.
I don't consider myself an Xpert, but I'll help in anyway I can (though
I won't be reading my mail very frequently for the next week)
John
_______________________________________________
gnome-hackers mailing list
gnome-hackers gnome org
http://mail.gnome.org/mailman/listinfo/gnome-hackers
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]