Tk Source Code

Artifact [dc205c55]
Login

Artifact dc205c5591d2d08193e004ecc8940e52081c3b6a:

Attachment "deiconify_history" to ticket [233150ff] added by mdejong 2002-06-14 02:35:51.
History of "wm deiconify" command in win/tkWinWm.c

Version 1.1

Code:

         TkpWmSetState(winPtr, NormalState);


------------
Version 1.10

1999-08-10  Jeff Hobbs  <[email protected]>

        * win/tkWinWm.c: changed "wm deiconify" on Windows to raise and
        force the focus on the deiconified window (behavioral change from
        8.1 to comply better with Windows style) [Bug: 1609]

Code:

        TkpWmSetState(winPtr, NormalState);
        /*
         * Follow Windows-like style here:
         * raise the window to the top and force the focus on it
         */
        Tk_RestackWindow(tkwin, Above, NULL);
        TkSetFocusWin(winPtr, 1);

------------
Version 1.11

1999-09-16  Jeff Hobbs  <[email protected]>

        * win/tkWinWm.c: fixed bug in 'wm deiconify' that raised the
        wrong toplevel, and changed it to not set focus on overridden
        toplevels

Code:

        TkpWmSetState(winPtr, NormalState);
        /*
         * Follow Windows-like style here:
         * raise the window to the top, and if it isn't overridden,
         * then force the focus on it
         */
        TkWmRestackToplevel(winPtr, Above, NULL);
        if (!(Tk_Attributes((Tk_Window) winPtr)->override_redirect)) {
            TkSetFocusWin(winPtr, 1);
        }

------------
Version 1.12

        Hobbs:

        * win/tkWinWm.c: fixed 'wm deiconify' to update position of the
        toplevel if event is waiting before mapping. (Mao) [Bug: 3687]
        This removes the need for 'update idle' before 'wm deiconify' on
        Windows.

Code:
        /*
         * If WM_UPDATE_PENDING is true, a pending UpdateGeometryInfo may
         * need to be called first to update a withdrew toplevel's geometry
         * before it is deiconified by TkpWmSetState.
         * UpdateGeometryInfo has no effect on an iconified toplevel.
         */
        if (wmPtr->flags & WM_UPDATE_PENDING) {
            Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
            UpdateGeometryInfo((ClientData) winPtr);
        }

        TkpWmSetState(winPtr, NormalState);
        /*
         * Follow Windows-like style here:
         * raise the window to the top, and if it isn't overridden,
         * then force the focus on it
         */
        TkWmRestackToplevel(winPtr, Above, NULL);
        if (!(Tk_Attributes((Tk_Window) winPtr)->override_redirect)) {
            TkSetFocusWin(winPtr, 1);
        }

------------
Version 1.13

        Hobbs:

        * win/tkWinWm.c: wm deiconify in zoom state [Bug: 2077],
        fixed possible flashing of unmapped toplevel in deiconify [Bug: 3338]
        and fixed mapping of transient window [Bug: 572]
        Also, for all wm's, extended 'wm state' command to allow setting
        of the state, and added official support of 'zoomed' state on Win.

Code:

        /*
         * If WM_UPDATE_PENDING is true, a pending UpdateGeometryInfo may
         * need to be called first to update a withdrew toplevel's geometry
         * before it is deiconified by TkpWmSetState.
         * Don't bother if we've never been mapped.
         */
        if ((wmPtr->flags & WM_UPDATE_PENDING) &&
                !(wmPtr->flags & WM_NEVER_MAPPED)) {
            Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
            UpdateGeometryInfo((ClientData) winPtr);
        }

        /*
         * If we were in the ZoomState (maximized), 'wm deiconify'
         * should not cause the window to shrink
         */
        if (wmPtr->hints.initial_state == ZoomState) {
            TkpWmSetState(winPtr, ZoomState);
        } else {
            TkpWmSetState(winPtr, NormalState);
        }

        /*
         * Follow Windows-like style here, raising the window to the top.
         * Do this when idle, to not cause an unrefreshable window to
         * get mapped.
         */
        Tcl_DoWhenIdle(RaiseWinWhenIdle, (ClientData) winPtr);


Moved the TkWmRestackToplevel and TkSetFocusWin into RaiseWinWhenIdle:

static void
RaiseWinWhenIdle(clientData)
    ClientData clientData;              /* Pointer to the window's record. */
{
    register TkWindow *winPtr = (TkWindow *) clientData;

    TkWmRestackToplevel(winPtr, Above, NULL);
    if (!(Tk_Attributes((Tk_Window) winPtr)->override_redirect)) {
        TkSetFocusWin(winPtr, 1);
    }
}


------------
Version 1.21

        Hobbs:

        * win/tkWinWm.c (RaiseWinWhenIdle): Checked for the possibility
        that the window could be destroyed (can occur with
        wm deiconify .toplevel; destroy .toplevel).

Code for RaiseWinWhenIdle:

    register TkWindow *winPtr = (TkWindow *) clientData;

    if ((winPtr == NULL) || (winPtr->flags & TK_ALREADY_DEAD)) {
        return;
    }
    if (winPtr->wmInfoPtr->flags & WM_UPDATE_PENDING) {
        Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
        UpdateGeometryInfo((ClientData) winPtr);
    }
    TkWmRestackToplevel(winPtr, Above, NULL);
    if (!(Tk_Attributes((Tk_Window) winPtr)->override_redirect)) {
        TkSetFocusWin(winPtr, 1);
    }


------------
Version 1.24:

       Hobbs:

       * win/tkWinWm.c (RaiseWinWhenIdle): added TK_DONT_DESTROY_WINDOW
        to flag check to prevent timing related core dump. [Bug: 5438]

Code for RaiseWinWhenIdle:

    register TkWindow *winPtr = (TkWindow *) clientData;

    if ((winPtr == NULL)
            || (winPtr->flags & (TK_ALREADY_DEAD|TK_DONT_DESTROY_WINDOW))) {
        return;
    }
    if (winPtr->wmInfoPtr->flags & WM_UPDATE_PENDING) {
        Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
        UpdateGeometryInfo((ClientData) winPtr);
    }
    TkWmRestackToplevel(winPtr, Above, NULL);
    if (!(Tk_Attributes((Tk_Window) winPtr)->override_redirect)) {
        TkSetFocusWin(winPtr, 1);
    }


------------
Version 1.25:

       Hobbs:

        * win/tkWinWm.c (Tk_WmCmd): changed wm deiconify from using idle
        callback to calling restack and focus code immediately.

Code:

        /*
         * If WM_UPDATE_PENDING is true, a pending UpdateGeometryInfo may
         * need to be called first to update a withdrew toplevel's geometry
         * before it is deiconified by TkpWmSetState.
         * Don't bother if we've never been mapped.
         */
        if ((wmPtr->flags & WM_UPDATE_PENDING)) {
            Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr);
            UpdateGeometryInfo((ClientData) winPtr);
        }

        /*
         * If we were in the ZoomState (maximized), 'wm deiconify'
         * should not cause the window to shrink
         */
        if (wmPtr->hints.initial_state == ZoomState) {
            TkpWmSetState(winPtr, ZoomState);
        } else {
            TkpWmSetState(winPtr, NormalState);
        }

        /*
         * Follow Windows-like style here, raising the window to the top.
         */
        TkWmRestackToplevel(winPtr, Above, NULL);
        if (!(Tk_Attributes((Tk_Window) winPtr)->override_redirect)) {
            TkSetFocusWin(winPtr, 1);
        }