This is not necessarily the current version of this TIP.
|Title:||Fix the 2-second "raise delay" in Tk|
|Version:||$Revision: 1.4 $|
|Author:||Joe English <jenglish at flightlab dot com>|
|Created:||Wednesday, 28 August 2002|
This TIP explains the genesis of the long delays often associated with the [raise] and [lower] commands under Unix/X with some window managers, as well as describing the solution.
Currently, Tk's [raise] and [lower] commands do not return to the caller until the operation has completed. Under Unix, the window manager is responsible for changing the stacking order of toplevel windows, so [raise] and [lower] must wait for a notification from the WM before returning. Not all window managers are ICCCM-compliant in this regard, however, so the operation may time out instead.
This two-second "raise delay" has been a longstanding, persistent problem in Tk. It has supposedly been fixed several times, but the problem keeps reoccurring under new window managers and new environments. At present, the problem is most noticeable under KDE 2 and KDE 3.
Change Tk so that [raise] and [lower] return immediately, without waiting for a notification that may not be forthcoming.
This should not be be a controversial change. This behaviour is not documented anywhere, and is not observable by Tk programs except via [wm stackorder] (see TIP #74).
Moreover, the guarantee is largely meaningless. After [raise] returns, the window contents may still not be visible (there may be pending <Expose> events, for example), and the actual position in the stacking order is still subject to window manager intervention.
The only Tk programs that would break with this change are ones which expect the return value of [wm stackorder] to reflect the results of any immediately-preceding [raise] and [lower] commands. (The Tk test suite is one such program, and would need to be modified).
Unfortunately there is no reliable way to fix such programs - [update] will not work, and the ICCCM does not, to the author's knowledge, provide a way to synchronize with the window manager to make sure it has processed all outstanding client requests. Even if it did, this wouldn't help - the raise delay problem only occurs under non-compliant window managers to begin