diff options
author | chengyemao <chengyemao> | 2005-01-12 02:58:29 (GMT) |
---|---|---|
committer | chengyemao <chengyemao> | 2005-01-12 02:58:29 (GMT) |
commit | 4caa27530c1ea45527b8e4dc77242763908cc4f4 (patch) | |
tree | cbf0ec63197f03e7d5763ccf1de4c39a1dd8e535 | |
parent | d85af204a9d1f218bd5e67862a9b14031760dfb3 (diff) | |
download | tk-4caa27530c1ea45527b8e4dc77242763908cc4f4.zip tk-4caa27530c1ea45527b8e4dc77242763908cc4f4.tar.gz tk-4caa27530c1ea45527b8e4dc77242763908cc4f4.tar.bz2 |
Minor bug fix to support embedding/embedded
-rw-r--r-- | win/tkWinEmbed.c | 11 | ||||
-rw-r--r-- | win/tkWinWm.c | 19 |
2 files changed, 18 insertions, 12 deletions
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c index 538e357..920d479 100644 --- a/win/tkWinEmbed.c +++ b/win/tkWinEmbed.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinEmbed.c,v 1.22 2005/01/10 15:35:30 chengyemao Exp $ + * RCS: @(#) $Id: tkWinEmbed.c,v 1.23 2005/01/12 02:58:29 chengyemao Exp $ */ #include "tkWinInt.h" @@ -171,7 +171,8 @@ TkpUseWindow(interp, tkwin, string) if(strcmp(string, "") == 0) { if(winPtr->flags & TK_EMBEDDED) { TkpWinToplevelDetachWindow(winPtr); - TkpWinToplevelOverrideRedirect(winPtr, 0); + if(winPtr->flags & TK_TOP_LEVEL) + TkpWinToplevelOverrideRedirect(winPtr, 0); } return TCL_OK; } @@ -277,7 +278,11 @@ TkpUseWindow(interp, tkwin, string) winPtr->flags |= TK_EMBEDDED; winPtr->flags &= (~(TK_MAPPED)); - Tcl_DoWhenIdle(TkWmMapWindow, (ClientData)winPtr); + if(winPtr->flags & TK_TOP_LEVEL) { + // call this function in idle may crash because the window + // may be destroyed in script + TkWmMapWindow(winPtr); + } return TCL_OK; } diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 1d2f3fc..4a2738b 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinWm.c,v 1.91 2005/01/10 15:32:28 chengyemao Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.92 2005/01/12 02:58:29 chengyemao Exp $ */ #include "tkWinInt.h" @@ -3800,6 +3800,13 @@ WmIconifyCmd(tkwin, winPtr, interp, objc, objv) Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } + if (winPtr->flags & TK_EMBEDDED) { + if(!SendMessage(wmPtr->wrapper, TK_ICONIFY, 0, 0)) { + Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName, + ": the container does not support the request", (char *) NULL); + return TCL_ERROR; + } + } if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) { Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName, "\": override-redirect flag is set", (char *) NULL); @@ -3816,13 +3823,6 @@ WmIconifyCmd(tkwin, winPtr, interp, objc, objv) (char *) NULL); return TCL_ERROR; } - if (winPtr->flags & TK_EMBEDDED) { - if(!SendMessage(wmPtr->wrapper, TK_ICONIFY, 0, 0)) { - Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName, - ": the container does not support the request", (char *) NULL); - return TCL_ERROR; - } - } TkpWmSetState(winPtr, IconicState); return TCL_OK; } @@ -7985,5 +7985,6 @@ void TkpWinToplevelDetachWindow(winPtr) wmPtr->wrapper = None; if(state >= 0 && state <= 3) wmPtr->hints.initial_state = state; } - TkpWinToplevelOverrideRedirect(winPtr, 1); + if(winPtr->flags & TK_TOP_LEVEL) + TkpWinToplevelOverrideRedirect(winPtr, 1); } |