diff options
author | chengyemao <chengyemao> | 2004-12-20 15:30:43 (GMT) |
---|---|---|
committer | chengyemao <chengyemao> | 2004-12-20 15:30:43 (GMT) |
commit | e8ba043300dd51973c731d1f13a6ba2b63765073 (patch) | |
tree | 4b4a7c0351384006b47bbb3fbad4b3edd6afcc31 | |
parent | d45d4dfcce52bdb65e7c890c472147fda503e94d (diff) | |
download | tk-e8ba043300dd51973c731d1f13a6ba2b63765073.zip tk-e8ba043300dd51973c731d1f13a6ba2b63765073.tar.gz tk-e8ba043300dd51973c731d1f13a6ba2b63765073.tar.bz2 |
implemented overrideredirect for an embedded; corrected incorrect frame upper left x and y of an embedded toplevel
-rw-r--r-- | win/tkWin.h | 24 | ||||
-rw-r--r-- | win/tkWinEmbed.c | 40 | ||||
-rw-r--r-- | win/tkWinInt.h | 3 | ||||
-rw-r--r-- | win/tkWinWm.c | 82 | ||||
-rw-r--r-- | win/tkWinX.c | 3 |
5 files changed, 124 insertions, 28 deletions
diff --git a/win/tkWin.h b/win/tkWin.h index a95779d..ce4cbc1 100644 --- a/win/tkWin.h +++ b/win/tkWin.h @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWin.h,v 1.9 2004/12/20 01:13:12 chengyemao Exp $ + * RCS: @(#) $Id: tkWin.h,v 1.10 2004/12/20 15:30:43 chengyemao Exp $ */ #ifndef _TKWIN @@ -37,17 +37,17 @@ * external Tk container application. */ -#define TK_CLAIMFOCUS (WM_USER) /* an embedded window requests to focus */ -#define TK_GEOMETRYREQ (WM_USER+1) /* an embedded window requests to change size */ -#define TK_ATTACHWINDOW (WM_USER+2) /* an embedded window requests to attach */ -#define TK_DETACHWINDOW (WM_USER+3) /* an embedded window requests to detach */ -#define TK_MOVEWINDOW (WM_USER+4) /* an embedded window requests to move */ -#define TK_RAISEWINDOW (WM_USER+5) /* an embedded window requests to raise */ -#define TK_ICONIFY (WM_USER+6) /* an embedded window requests to iconify */ -#define TK_DEICONIFY (WM_USER+7) /* an embedded window requests to deiconify */ -#define TK_WITHDRAW (WM_USER+8) /* an embedded window requests to withdraw */ -#define TK_GETFRAMEWID (WM_USER+9) /* an embedded window requests a frame window id */ - +#define TK_CLAIMFOCUS (WM_USER) /* an embedded window requests to focus */ +#define TK_GEOMETRYREQ (WM_USER+1) /* an embedded window requests to change size */ +#define TK_ATTACHWINDOW (WM_USER+2) /* an embedded window requests to attach */ +#define TK_DETACHWINDOW (WM_USER+3) /* an embedded window requests to detach */ +#define TK_MOVEWINDOW (WM_USER+4) /* an embedded window requests to move */ +#define TK_RAISEWINDOW (WM_USER+5) /* an embedded window requests to raise */ +#define TK_ICONIFY (WM_USER+6) /* an embedded window requests to iconify */ +#define TK_DEICONIFY (WM_USER+7) /* an embedded window requests to deiconify */ +#define TK_WITHDRAW (WM_USER+8) /* an embedded window requests to withdraw */ +#define TK_GETFRAMEWID (WM_USER+9) /* an embedded window requests a frame window id */ +#define TK_OVERRIDEREDIRECT (WM_USER+10) /* an embedded window requests to overrideredirect */ /* *-------------------------------------------------------------- diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c index a9f987e..1aca63f 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.14 2004/12/20 01:13:12 chengyemao Exp $ + * RCS: @(#) $Id: tkWinEmbed.c,v 1.15 2004/12/20 15:30:43 chengyemao Exp $ */ #include "tkWinInt.h" @@ -471,6 +471,10 @@ TkWinEmbeddedEventProc(hwnd, message, wParam, lParam) result = TkpWinToplevelMove(containerPtr->parentPtr, wParam, lParam); break; + case TK_OVERRIDEREDIRECT: + result = TkpWinToplevelOverrideRedirect(containerPtr->parentPtr, wParam); + break; + /* * Return 0 since the current Tk container implementation * is unable to provide following services. @@ -619,6 +623,40 @@ TkpGetOtherWindow(winPtr) /* *---------------------------------------------------------------------- * + * Tk_GetEmbeddedHWnd -- + * + * This function returns the embedded window id. + * + * Results: + * If winPtr is a container, the return value is the HWND for the + * embedded window. Otherwise it returns NULL. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +HWND +Tk_GetEmbeddedHWnd(winPtr) + TkWindow *winPtr; +{ + Container *containerPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + + for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL; + containerPtr = containerPtr->nextPtr) { + if (containerPtr->parentPtr == winPtr) { + return containerPtr->embeddedHWnd; + } + } + return NULL; +} + +/* + *---------------------------------------------------------------------- + * * TkpClaimFocus -- * * This procedure is invoked when someone asks or the input focus diff --git a/win/tkWinInt.h b/win/tkWinInt.h index a8ac9bd..ed3b324 100644 --- a/win/tkWinInt.h +++ b/win/tkWinInt.h @@ -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: tkWinInt.h,v 1.20 2004/12/20 01:13:12 chengyemao Exp $ + * RCS: @(#) $Id: tkWinInt.h,v 1.21 2004/12/20 15:30:43 chengyemao Exp $ */ #ifndef _TKWININT @@ -229,6 +229,7 @@ void TkpWinToplevelIconify _ANSI_ARGS_((TkWindow *winPtr)); void TkpWinToplevelDeiconify _ANSI_ARGS_((TkWindow *winPtr)); long TkpWinToplevelIsControlledByWm _ANSI_ARGS_((TkWindow *winPtr)); long TkpWinToplevelMove _ANSI_ARGS_((TkWindow *winPtr, int x, int y)); +long TkpWinToplevelOverrideRedirect _ANSI_ARGS_((TkWindow *winPtr, int reqValue)); #endif /* _TKWININT */ diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 8182ce5..3b226ba 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.82 2004/12/20 01:13:12 chengyemao Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.83 2004/12/20 15:30:43 chengyemao Exp $ */ #include "tkWinInt.h" @@ -4303,7 +4303,15 @@ WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv) Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); return TCL_ERROR; } - curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect; + if(winPtr->flags & TK_EMBEDDED) { + curValue = SendMessage(wmPtr->wrapper, TK_OVERRIDEREDIRECT, -1, -1); + if(curValue < 0) { + Tcl_AppendResult(interp, "Container does not support overrideredirect", NULL); + return TCL_ERROR; + } + } else { + curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect; + } if (objc == 3) { Tcl_SetBooleanObj(Tcl_GetObjResult(interp), curValue); return TCL_OK; @@ -4312,16 +4320,20 @@ WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv) return TCL_ERROR; } if (curValue != boolean) { - /* - * Only do this if we are really changing value, because it - * causes some funky stuff to occur - */ - atts.override_redirect = (boolean) ? True : False; - Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, + if(winPtr->flags & TK_EMBEDDED) { + SendMessage(wmPtr->wrapper, TK_OVERRIDEREDIRECT, boolean, 0); + } else { + /* + * Only do this if we are really changing value, because it + * causes some funky stuff to occur + */ + atts.override_redirect = (boolean) ? True : False; + Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); - if (!(wmPtr->flags & (WM_NEVER_MAPPED)) + if (!(wmPtr->flags & (WM_NEVER_MAPPED)) && !(winPtr->flags & TK_EMBEDDED)) { - UpdateWrapper(winPtr); + UpdateWrapper(winPtr); + } } } return TCL_OK; @@ -7217,7 +7229,7 @@ TopLevelProc(hwnd, message, wParam, lParam) WPARAM wParam; LPARAM lParam; { - if (message == WM_WINDOWPOSCHANGED) { + if (message == WM_WINDOWPOSCHANGED || message == WM_WINDOWPOSCHANGING) { WINDOWPOS *pos = (WINDOWPOS *) lParam; TkWindow *winPtr = (TkWindow *) Tk_HWNDToWindow(pos->hwnd); @@ -7234,8 +7246,9 @@ TopLevelProc(hwnd, message, wParam, lParam) winPtr->changes.height = pos->cy; } if (!(pos->flags & SWP_NOMOVE)) { - winPtr->changes.x = pos->x; - winPtr->changes.y = pos->y; + long result = SendMessage(winPtr->wmInfoPtr->wrapper, TK_MOVEWINDOW, -1, -1); + winPtr->wmInfoPtr->x = winPtr->changes.x = result >> 16; + winPtr->wmInfoPtr->y = winPtr->changes.y = result & 0xffff; } GenerateConfigureNotify(winPtr); @@ -7813,3 +7826,46 @@ long TkpWinToplevelMove(winPtr, x, y) } return ((wmPtr->x << 16) & 0xffff0000) | (wmPtr->y & 0x0000ffff); } + +/* + *---------------------------------------------------------------------- + * + * TkpWinToplevelOverrideRedirect -- + * + * This function is to be used by a container to overrideredirect + * the contaner's frame window. + * + * Results: + * The current overrideredirect value + * + * Side effects: + * May change the overrideredirect value of the container window + * + *---------------------------------------------------------------------- + */ +long TkpWinToplevelOverrideRedirect(winPtr, reqValue) + TkWindow *winPtr; + int reqValue; +{ + int curValue; + register WmInfo *wmPtr = winPtr->wmInfoPtr; + + curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect; + if(reqValue < 0) return curValue; + + if (curValue != reqValue) { + XSetWindowAttributes atts; + /* + * Only do this if we are really changing value, because it + * causes some funky stuff to occur + */ + atts.override_redirect = reqValue ? True : False; + Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, + &atts); + if (!(wmPtr->flags & (WM_NEVER_MAPPED)) + && !(winPtr->flags & TK_EMBEDDED)) { + UpdateWrapper(winPtr); + } + } + return reqValue; +}
\ No newline at end of file diff --git a/win/tkWinX.c b/win/tkWinX.c index 0b2f8b1..3285ec4 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinX.c,v 1.38 2004/12/20 01:13:14 chengyemao Exp $ + * RCS: @(#) $Id: tkWinX.c,v 1.39 2004/12/20 15:30:44 chengyemao Exp $ */ #include "tkWinInt.h" @@ -820,6 +820,7 @@ TkWinChildProc(hwnd, message, wParam, lParam) case TK_WITHDRAW: case TK_RAISEWINDOW: case TK_GETFRAMEWID: + case TK_OVERRIDEREDIRECT: result = TkWinEmbeddedEventProc(hwnd, message, wParam, lParam); break; |