Re: Patch: re-enable XSetInputFocus() timestamps
- From: Havoc Pennington <hp redhat com>
- To: Federico Mena Quintero <federico ximian com>
- Cc: michael ximian com, gnome-components-list gnome org
- Subject: Re: Patch: re-enable XSetInputFocus() timestamps
- Date: 10 Dec 2001 17:08:37 -0500
Federico Mena Quintero <federico ximian com> writes:
> + /*
> + * Focus events do not come with a timestamp, so we fetch a good-enough
> + * timestamp by hand.
> + */
> + last_x_time_stamp = get_server_time (GTK_WIDGET (socket)->window);
> +
> if (priv->gave_focus && priv->plug_window) {
> gdk_error_trap_push ();
> XSetInputFocus (GDK_DISPLAY (),
> GDK_WINDOW_XWINDOW (priv->plug_window),
> - RevertToParent, CurrentTime);
> + RevertToParent, last_x_time_stamp);
Owen and I can't think of a reason why get_server_time() would be
better than CurrentTime here. CurrentTime means "the time when this
request arrives at the X server." get_current_time() gets the time
when your SetProperty request arrives at the X server. So in both
cases you are using an essentially arbitrary time which has no
relation to when the focus in was triggered. The race condition still
exists.
Given that you're broken either way, you may as well be efficient,
avoid the round trip, and use CurrentTime.
Owen says you might want to hack an event filter to use the
WM_TAKE_FOCUS protocol for focus, as GTK 2 does. (and you'd need a
hack to add that to WM_PROTOCOLS for the toplevel.)
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]