After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 162353 - Wrapping of XSetInputFocus is buggy w.r.t. CurrentTime
Wrapping of XSetInputFocus is buggy w.r.t. CurrentTime
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: general
trunk
Other Linux
: High normal
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
Depends on:
Blocks:
 
 
Reported: 2004-12-27 23:31 UTC by Elijah Newren
Modified: 2004-12-28 05:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix wrapping of XSetInputFocus to handle CurrentTime (1.58 KB, patch)
2004-12-27 23:32 UTC, Elijah Newren
accepted-commit_now Details | Review

Description Elijah Newren 2004-12-27 23:31:18 UTC
The recent patch in bug 154598 introduced a simple bug.  If CurrentTime (i.e. 0)
is passed as a timestamp to either meta_display_set_input_focus_window or
meta_display_focus_the_no_focus_window, then a simple timestamp comparision will
treat the timestamp as being too old and reject the focus request.  I will
attach a patch in a minute that instead lets the request through but emits a
warning.  

Note that this will result in display->last_focus_time becoming garbage (it's
set to 0 in this case).  However, (a) we emit a warning, (b) just allowing
display->last_focus_time to not be updated wouldn't be correct either, and (c)
obtaining a timestamp from the xserver isn't quite the expected behavior either.
 I guess it's a trade-off between covering up bugs as much as possible, or just
subjecting people to them with warnings so that they can point them out for us.
 I wasn't sure which was better of the two, so I just went for the one that was
less work (i.e. blindly updated last_focus_time).

Finally, note that this was the exact cause of all the focus issues that I
reported while trying to generate a patch in bug 90290; with this fix, the patch
for bug 90290 becomes a one-liner.  ;-)
Comment 1 Elijah Newren 2004-12-27 23:32:11 UTC
Created attachment 35241 [details] [review]
Fix wrapping of XSetInputFocus to handle CurrentTime
Comment 2 Havoc Pennington 2004-12-28 05:17:36 UTC
Comment on attachment 35241 [details] [review]
Fix wrapping of XSetInputFocus to handle CurrentTime

I don't know if the output would be useful but you could try adding
meta_print_backtrace() to the warning.
Comment 3 Elijah Newren 2004-12-28 05:56:34 UTC
committed, with the addition of also calling meta_print_backtrace()