diff options
Diffstat (limited to 'macosx/tkMacOSXWm.c')
-rw-r--r-- | macosx/tkMacOSXWm.c | 95 |
1 files changed, 61 insertions, 34 deletions
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index dc0e9bc..65e7833 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXWm.c,v 1.41 2006/09/10 17:02:19 das Exp $ + * RCS: @(#) $Id: tkMacOSXWm.c,v 1.42 2006/09/11 14:41:04 das Exp $ */ #include "tkMacOSXInt.h" @@ -86,7 +86,7 @@ static int ParseGeometry _ANSI_ARGS_((Tcl_Interp *interp, char *string, TkWindow *winPtr)); static void TopLevelEventProc _ANSI_ARGS_((ClientData clientData, XEvent *eventPtr)); -static void TkWmStackorderToplevelWrapperMap _ANSI_ARGS_(( +static void WmStackorderToplevelWrapperMap _ANSI_ARGS_(( TkWindow *winPtr, Display *display, Tcl_HashTable *table)); @@ -193,9 +193,12 @@ static int WmWithdrawCmd _ANSI_ARGS_((Tk_Window tkwin, Tcl_Obj *CONST objv[])); static void WmUpdateGeom _ANSI_ARGS_((WmInfo *wmPtr, TkWindow *winPtr)); -static int TkMacOSXWinStyle _ANSI_ARGS_((Tcl_Interp *interp, +static int WmWinStyle _ANSI_ARGS_((Tcl_Interp *interp, TkWindow *winPtr, int objc, Tcl_Obj * CONST objv[])); +static void ApplyWindowAttributeChanges _ANSI_ARGS_(( + TkWindow *winPtr, int newAttributes, + int oldAttributes, int create)); /* *-------------------------------------------------------------- @@ -2254,6 +2257,7 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */ register WmInfo *wmPtr = winPtr->wmInfoPtr; int boolean; XSetWindowAttributes atts; + int oldAttributes = wmPtr->attributes; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); @@ -2292,6 +2296,7 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */ } } } + ApplyWindowAttributeChanges(winPtr, wmPtr->attributes, oldAttributes, 0); return TCL_OK; } @@ -2477,7 +2482,8 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv) Tcl_Obj *CONST objv[]; /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - int width, height, oldAttributes; + int width, height; + int oldAttributes = wmPtr->attributes; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -2496,7 +2502,6 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv) || (Tcl_GetBooleanFromObj(interp, objv[4], &height) != TCL_OK)) { return TCL_ERROR; } - oldAttributes = wmPtr->attributes; if (width) { wmPtr->flags &= ~WM_WIDTH_NOT_RESIZABLE; wmPtr->attributes |= kWindowHorizontalZoomAttribute; @@ -2522,18 +2527,7 @@ WmResizableCmd(tkwin, winPtr, interp, objc, objv) wmPtr->scrollWinPtr->instanceData); } WmUpdateGeom(wmPtr, winPtr); - if (wmPtr->attributes != oldAttributes) { - if (winPtr->window == None) { - Tk_MakeWindowExist((Tk_Window) winPtr); - } - if (!TkMacOSXHostToplevelExists(winPtr)) { - TkMacOSXMakeRealWindowExist(winPtr); - } - ChangeWindowAttributes( - GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window)), - wmPtr->attributes & (wmPtr->attributes ^ oldAttributes), - oldAttributes & (wmPtr->attributes ^ oldAttributes)); - } + ApplyWindowAttributeChanges(winPtr, wmPtr->attributes, oldAttributes, 1); return TCL_OK; } @@ -2907,6 +2901,7 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv) WmInfo *wmPtr2; char *argv3; int length; + int oldAttributes = wmPtr->attributes; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?master?"); @@ -2978,6 +2973,7 @@ WmTransientCmd(tkwin, winPtr, interp, objc, objv) wmPtr->attributes = kWindowStandardFloatingAttributes; } } + ApplyWindowAttributeChanges(winPtr, wmPtr->attributes, oldAttributes, 0); return TCL_OK; } @@ -4933,7 +4929,7 @@ TkUnsupported1ObjCmd( Tcl_WrongNumArgs(interp, 2, objv, "window ?class attributes?"); return TCL_ERROR; } - return TkMacOSXWinStyle(interp, winPtr, objc, objv); + return WmWinStyle(interp, winPtr, objc, objv); } /* won't be reached */ return TCL_ERROR; @@ -4942,7 +4938,7 @@ TkUnsupported1ObjCmd( /* *---------------------------------------------------------------------- * - * TkMacOSXWinStyle -- + * WmWinStyle -- * * This procedure is invoked to process the * "::tk::unsupported::MacWindowStyle style" subcommand. @@ -4957,8 +4953,8 @@ TkUnsupported1ObjCmd( * *---------------------------------------------------------------------- */ -int -TkMacOSXWinStyle( +static int +WmWinStyle( Tcl_Interp *interp, /* Current interpreter. */ TkWindow *winPtr, /* Window to be manipulated. */ int objc, /* Number of arguments. */ @@ -5127,6 +5123,8 @@ TkMacOSXWinStyle( return TCL_ERROR; } } + ApplyWindowAttributeChanges(winPtr, wmPtr->attributes, + oldAttributes, 0); wmPtr->style = -1; } @@ -5281,15 +5279,6 @@ TkMacOSXMakeRealWindowExist( MoveWindowStructure(newWindow, geometry.left, geometry.top); SetPort(GetWindowPort(newWindow)); - /* - * overrideredirect windows are not activated by the window server and - * don't receive activate events. - */ - if (winPtr->atts.override_redirect) { - SetWindowActivationScope(newWindow, kWindowActivationScopeNone); - ChangeWindowAttributes(newWindow, kWindowNoActivatesAttribute, 0); - } - if ((wmPtr->master != None) && winPtr->atts.override_redirect) { /* * If we are transient and overrideredirect, use the utility class @@ -5761,7 +5750,7 @@ TkpChangeFocus(winPtr, force) /* *---------------------------------------------------------------------- * - * TkWmStackorderToplevelWrapperMap -- + * WmStackorderToplevelWrapperMap -- * * This procedure will create a table that maps the reparent wrapper * X id for a toplevel to the TkWindow structure that is wraps. @@ -5780,7 +5769,7 @@ TkpChangeFocus(winPtr, force) *---------------------------------------------------------------------- */ static void -TkWmStackorderToplevelWrapperMap(winPtr, display, table) +WmStackorderToplevelWrapperMap(winPtr, display, table) TkWindow *winPtr; /* TkWindow to recurse on */ Display *display; /* X display of parent window */ Tcl_HashTable *table; /* Maps mac window to TkWindow */ @@ -5800,7 +5789,7 @@ TkWmStackorderToplevelWrapperMap(winPtr, display, table) for (childPtr = winPtr->childList; childPtr != NULL; childPtr = childPtr->nextPtr) { - TkWmStackorderToplevelWrapperMap(childPtr, display, table); + WmStackorderToplevelWrapperMap(childPtr, display, table); } } @@ -5836,7 +5825,7 @@ TkWmStackorderToplevel(parentPtr) */ Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS); - TkWmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); + WmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); windows = (TkWindow **) ckalloc((table.numEntries+1) * sizeof(TkWindow *)); @@ -5881,3 +5870,41 @@ TkWmStackorderToplevel(parentPtr) Tcl_DeleteHashTable(&table); return windows; } + +/* + *---------------------------------------------------------------------- + * + * ApplyWindowAttributeChanges -- + * + * This procedure applies carbon window attribute changes. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +ApplyWindowAttributeChanges(TkWindow *winPtr, int newAttributes, + int oldAttributes, int create) +{ + if (newAttributes != oldAttributes) { + if (winPtr->window == None && create) { + Tk_MakeWindowExist((Tk_Window) winPtr); + } else { + return; + } + if (!TkMacOSXHostToplevelExists(winPtr) && create) { + TkMacOSXMakeRealWindowExist(winPtr); + } else { + return; + } + ChangeWindowAttributes( + GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window)), + newAttributes & (newAttributes ^ oldAttributes), + oldAttributes & (newAttributes ^ oldAttributes)); + } +} |