Tk Source Code

Check-in [52e0c8cb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:
* macosx/tkMacOSXInt.h: Implemented 'zoomed' window state * macosx/tkMacOSXWindowEvent.c: handling for TkAqua, via titlebar * macosx/tkMacOSXWm.c: widget clicks as well as [wm state]. * doc/wm.n: [Bug 1073456]
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | core-8-4-branch
Files: files | file ages | folders
SHA1: 52e0c8cba697c657842c1e3fdfb39a43d1d121b5
User & Date: das 2006-04-11 07:36:40.000
Context
2006-04-11
10:20
* macosx/tkMacOSXDraw.c (TkMacOSXInitCGDrawing): prevent multiple init.
check-in: fcd02512 user: das tags: core-8-4-branch
07:36
* macosx/tkMacOSXInt.h: Implemented 'zoomed' window state * macosx/tkMacOSXWindowEvent.c: handling for TkAqua, via titlebar * macosx/tkMacOSXWm.c: widget clicks as well as [wm state]. * doc/wm.n: [Bug 1073456]
check-in: 52e0c8cb user: das tags: core-8-4-branch
05:42
typo check-in: 72d52fb3 user: das tags: core-8-4-branch
Changes
Unified Diff Ignore Whitespace Patch
Changes to ChangeLog.







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15







2006-04-10  Don Porter  <[email protected]>

	*** 8.4.13 TAGGED FOR RELEASE ***

	* changes:	Updates for next RC.

2006-04-09  Daniel Steffen  <[email protected]>


	* macosx/tkMacOSXWm.c (WmResizableCmd): propagate window attribute
	changes to Carbon window manager. [FR 1467004]
	(TkSetWMName, TkMacOSXMakeRealWindowExist): allow empty name for
	toplevels, remove bogus initial window name. [Bug 1450800]

2006-04-07  Daniel Steffen  <[email protected]>
>
>
>
>
>
>
>







<







1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
2006-04-11  Daniel Steffen  <[email protected]>

	* macosx/tkMacOSXInt.h:         Implemented 'zoomed' window state
	* macosx/tkMacOSXWindowEvent.c: handling for TkAqua, via titlebar
	* macosx/tkMacOSXWm.c:          widget clicks as well as [wm state].
	* doc/wm.n:                     [Bug 1073456]

2006-04-10  Don Porter  <[email protected]>

	*** 8.4.13 TAGGED FOR RELEASE ***

	* changes:	Updates for next RC.

2006-04-09  Daniel Steffen  <[email protected]>


	* macosx/tkMacOSXWm.c (WmResizableCmd): propagate window attribute
	changes to Carbon window manager. [FR 1467004]
	(TkSetWMName, TkMacOSXMakeRealWindowExist): allow empty name for
	toplevels, remove bogus initial window name. [Bug 1450800]

2006-04-07  Daniel Steffen  <[email protected]>
Changes to doc/wm.n.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'\"
'\" Copyright (c) 1991-1994 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\" 
'\" RCS: @(#) $Id: wm.n,v 1.11.2.3 2004/11/11 01:26:42 das Exp $
'\" 
.so man.macros
.TH wm n 8.4 Tk "Tk Built-In Commands"
.BS
'\" Note:  do not modify the .SH NAME line immediately below!
.SH NAME
wm \- Communicate with window manager







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'\"
'\" Copyright (c) 1991-1994 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\" 
'\" RCS: @(#) $Id: wm.n,v 1.11.2.4 2006/04/11 07:36:40 das Exp $
'\" 
.so man.macros
.TH wm n 8.4 Tk "Tk Built-In Commands"
.BS
'\" Note:  do not modify the .SH NAME line immediately below!
.SH NAME
wm \- Communicate with window manager
66
67
68
69
70
71
72

73
74
75
76
77
78
79
80
a value from \fB0.0\fR (fully transparent) to \fB1.0\fR (opaque).  Values
outside that range will be constrained.  This is supported on Windows
2000/XP+.  Where not supported, the \fB\-alpha\fR value remains at
\fB1.0\fR.
.PP
On Mac OS X, \fB\-modified\fR gets or sets the modification state of the
window (determines whether the window close widget contains the modification

indicator). \fB\-titlepath\fR gets or sets the path of the file referenced as
the window proxy icon (which can be dragged and dropped in lieu of the file's
finder icon). \fB\-alpha\fR sets the alpha transparency level of the window,
it accepts a value from \fB0.0\fR (fully transparent) to \fB1.0\fR (opaque),
values outside that range will be constrained.
.PP
On Unix, there are currently no special attribute values.
.RE







>
|







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
a value from \fB0.0\fR (fully transparent) to \fB1.0\fR (opaque).  Values
outside that range will be constrained.  This is supported on Windows
2000/XP+.  Where not supported, the \fB\-alpha\fR value remains at
\fB1.0\fR.
.PP
On Mac OS X, \fB\-modified\fR gets or sets the modification state of the
window (determines whether the window close widget contains the modification
indicator and whether the proxy icon is draggable).
\fB\-titlepath\fR gets or sets the path of the file referenced as
the window proxy icon (which can be dragged and dropped in lieu of the file's
finder icon). \fB\-alpha\fR sets the alpha transparency level of the window,
it accepts a value from \fB0.0\fR (fully transparent) to \fB1.0\fR (opaque),
values outside that range will be constrained.
.PP
On Unix, there are currently no special attribute values.
.RE
446
447
448
449
450
451
452
453

454
455
456
457
458
459
460
461
\fIisbelow\fR are passed, a boolean result indicates whether
or not the first window is currently above or below the second
window in the stacking order.
.TP
\fBwm state \fIwindow\fR ?newstate?
If \fInewstate\fR is specified, the window will be set to the new state,
otherwise it returns the current state of \fIwindow\fR: either
\fBnormal\fR, \fBiconic\fR, \fBwithdrawn\fR, \fBicon\fR, or (Windows only)

\fBzoomed\fR.  The difference between \fBiconic\fR and \fBicon\fR is that
\fBiconic\fR refers to a window that has been iconified (e.g., with the
\fBwm iconify\fR command) while \fBicon\fR refers to a window whose only
purpose is to serve as the icon for some other window (via the \fBwm
iconwindow\fR command).  The \fBicon\fR state cannot be set.
.TP
\fBwm title \fIwindow\fR ?\fIstring\fR?
If \fIstring\fR is specified, then it will be passed to the window







|
>
|







447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
\fIisbelow\fR are passed, a boolean result indicates whether
or not the first window is currently above or below the second
window in the stacking order.
.TP
\fBwm state \fIwindow\fR ?newstate?
If \fInewstate\fR is specified, the window will be set to the new state,
otherwise it returns the current state of \fIwindow\fR: either
\fBnormal\fR, \fBiconic\fR, \fBwithdrawn\fR, \fBicon\fR, or (Windows and Mac
OS X only) \fBzoomed\fR.
The difference between \fBiconic\fR and \fBicon\fR is that
\fBiconic\fR refers to a window that has been iconified (e.g., with the
\fBwm iconify\fR command) while \fBicon\fR refers to a window whose only
purpose is to serve as the icon for some other window (via the \fBwm
iconwindow\fR command).  The \fBicon\fR state cannot be set.
.TP
\fBwm title \fIwindow\fR ?\fIstring\fR?
If \fIstring\fR is specified, then it will be passed to the window
Changes to macosx/tkMacOSXInt.h.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * tkMacOSXInt.h --
 *
 *	Declarations of Macintosh specific shared variables and procedures.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 * Copyright 2001, Apple Computer, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkMacOSXInt.h,v 1.3.2.9 2006/03/28 02:44:13 das Exp $
 */

#ifndef _TKMACINT
#define _TKMACINT

#ifndef _TKINT
#include "tkInt.h"











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * tkMacOSXInt.h --
 *
 *	Declarations of Macintosh specific shared variables and procedures.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 * Copyright 2001, Apple Computer, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkMacOSXInt.h,v 1.3.2.10 2006/04/11 07:36:40 das Exp $
 */

#ifndef _TKMACINT
#define _TKMACINT

#ifndef _TKINT
#include "tkInt.h"
155
156
157
158
159
160
161
162
163

164
165
166
167
168
169
170
171
172
173
extern void TkMacOSXDisplayChanged(Display *display);
extern int TkMacOSXUseAntialiasedText(Tcl_Interp *interp, int enable);
extern void TkMacOSXInitCarbonEvents(Tcl_Interp *interp);
extern int TkMacOSXInitCGDrawing(Tcl_Interp *interp, int enable, int antiAlias);
extern void TkMacOSXDefaultStartupScript(void);
extern int TkMacOSXGenerateFocusEvent( Window window, int activeFlag);
extern WindowClass TkMacOSXWindowClass(TkWindow *winPtr);
extern void* TkMacOSXGetNamedSymbol(const char* module, const char* symbol);


/* Macro to abstract common use of TkMacOSXGetNamedSymbol to initialize named symbols */
#define TkMacOSXInitNamedSymbol(module, ret, symbol, ...) \
    static ret (* symbol)(__VA_ARGS__) = (void*)(-1L); \
    if (symbol == (void*)(-1L)) { \
        symbol = TkMacOSXGetNamedSymbol(STRINGIFY(module), STRINGIFY(_##symbol));\
    }

#include "tkIntPlatDecls.h"

#endif /* _TKMACINT */







|

>










155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
extern void TkMacOSXDisplayChanged(Display *display);
extern int TkMacOSXUseAntialiasedText(Tcl_Interp *interp, int enable);
extern void TkMacOSXInitCarbonEvents(Tcl_Interp *interp);
extern int TkMacOSXInitCGDrawing(Tcl_Interp *interp, int enable, int antiAlias);
extern void TkMacOSXDefaultStartupScript(void);
extern int TkMacOSXGenerateFocusEvent( Window window, int activeFlag);
extern WindowClass TkMacOSXWindowClass(TkWindow *winPtr);
extern int TkMacOSXIsWindowZoomed(TkWindow *winPtr);

extern void* TkMacOSXGetNamedSymbol(const char* module, const char* symbol);
/* Macro to abstract common use of TkMacOSXGetNamedSymbol to initialize named symbols */
#define TkMacOSXInitNamedSymbol(module, ret, symbol, ...) \
    static ret (* symbol)(__VA_ARGS__) = (void*)(-1L); \
    if (symbol == (void*)(-1L)) { \
        symbol = TkMacOSXGetNamedSymbol(STRINGIFY(module), STRINGIFY(_##symbol));\
    }

#include "tkIntPlatDecls.h"

#endif /* _TKMACINT */
Changes to macosx/tkMacOSXWindowEvent.c.
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
 *      Government shall have only "Restricted Rights" as defined in
 *      Clause 252.227-7013 (c) (1) of DFARs.  Notwithstanding the
 *      foregoing, the authors grant the U.S. Government and others
 *      acting in its behalf permission to use and distribute the
 *      software in accordance with the terms specified in this
 *      license.
 *
 * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.3.2.9 2006/03/28 02:44:14 das Exp $
 */

#include "tkMacOSXInt.h"
#include "tkMacOSXWm.h"
#include "tkMacOSXEvent.h"
#include "tkMacOSXDebug.h"








|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
 *      Government shall have only "Restricted Rights" as defined in
 *      Clause 252.227-7013 (c) (1) of DFARs.  Notwithstanding the
 *      foregoing, the authors grant the U.S. Government and others
 *      acting in its behalf permission to use and distribute the
 *      software in accordance with the terms specified in this
 *      license.
 *
 * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.3.2.10 2006/04/11 07:36:40 das Exp $
 */

#include "tkMacOSXInt.h"
#include "tkMacOSXWm.h"
#include "tkMacOSXEvent.h"
#include "tkMacOSXDebug.h"

234
235
236
237
238
239
240
241

242
243
244
245
246
247
248
            break;
        case kEventWindowExpanded: {
            TkDisplay *dispPtr;
            TkWindow  *winPtr;
            dispPtr = TkGetDisplayList();
            winPtr = (TkWindow *)Tk_IdToWindow(dispPtr->display, window);
            if (winPtr) {
                TkpWmSetState(winPtr, NormalState);

            }
            break;
        }
    }
    return 0;
}








|
>







234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
            break;
        case kEventWindowExpanded: {
            TkDisplay *dispPtr;
            TkWindow  *winPtr;
            dispPtr = TkGetDisplayList();
            winPtr = (TkWindow *)Tk_IdToWindow(dispPtr->display, window);
            if (winPtr) {
		TkpWmSetState(winPtr, TkMacOSXIsWindowZoomed(winPtr) ?
			ZoomState : NormalState);
            }
            break;
        }
    }
    return 0;
}

Changes to macosx/tkMacOSXWm.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 *
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright 2001, Apple Computer, Inc.
 *
 * 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.7.2.22 2006/04/10 09:25:42 das Exp $
 */

#include "tkMacOSXInt.h"
#include "tkScrollbar.h"
#include "tkMacOSXWm.h"
#include "tkMacOSXEvent.h"








|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 *
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright 2001, Apple Computer, Inc.
 *
 * 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.7.2.23 2006/04/11 07:36:40 das Exp $
 */

#include "tkMacOSXInt.h"
#include "tkScrollbar.h"
#include "tkMacOSXWm.h"
#include "tkMacOSXEvent.h"

787
788
789
790
791
792
793






794
795
796
797
798
799
800
    /* Must have objc >= 3 at this point. */
    if (objc < 3) {
	Tcl_WrongNumArgs(interp, 1, objv,
	    "attributes window ?-modified ?bool?? ?-titlepath ?path?? ?-alpha ?double??");
	return TCL_ERROR;
    }







    macWindow = GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window));

    if (objc == 3) {
	result = Tcl_NewObj();
	Tcl_AppendToObj(result, "-modified ", -1);
	WmAttrGetModifiedStatus(macWindow, result);
	Tcl_AppendToObj(result, " -titlepath ", -1);







>
>
>
>
>
>







787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
    /* Must have objc >= 3 at this point. */
    if (objc < 3) {
	Tcl_WrongNumArgs(interp, 1, objv,
	    "attributes window ?-modified ?bool?? ?-titlepath ?path?? ?-alpha ?double??");
	return TCL_ERROR;
    }

    if (winPtr->window == None) {
	Tk_MakeWindowExist((Tk_Window) winPtr);
    }
    if (!TkMacOSXHostToplevelExists(winPtr)) {
	TkMacOSXMakeRealWindowExist(winPtr);
    }
    macWindow = GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window));

    if (objc == 3) {
	result = Tcl_NewObj();
	Tcl_AppendToObj(result, "-modified ", -1);
	WmAttrGetModifiedStatus(macWindow, result);
	Tcl_AppendToObj(result, " -titlepath ", -1);
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
Tk_Window tkwin;		/* Main window of the application. */
TkWindow *winPtr;           /* Toplevel to work with */
Tcl_Interp *interp;		/* Current interpreter. */
int objc;			/* Number of arguments. */
Tcl_Obj *CONST objv[];	/* Argument objects. */
{
    register WmInfo *wmPtr = winPtr->wmInfoPtr;

    if (objc != 3) {
        Tcl_WrongNumArgs(interp, 2, objv, "window");
        return TCL_ERROR;
    }
    if (wmPtr->iconFor != NULL) {
        Tcl_AppendResult(interp, "can't deiconify ", Tcl_GetString(objv[2]),
                         ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
                         (char *) NULL);
        return TCL_ERROR;
    }
    if (winPtr->flags & TK_EMBEDDED) {
        Tcl_AppendResult(interp, "can't deiconify ", winPtr->pathName,
                         ": it is an embedded window", (char *) NULL);
        return TCL_ERROR;
    }

    /*
     * TODO: may not want to call this function - look at Map events gened.
     */

    TkpWmSetState(winPtr, NormalState);
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * WmFocusmodelCmd --







<















|
<
<
<
<
|







1230
1231
1232
1233
1234
1235
1236

1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252




1253
1254
1255
1256
1257
1258
1259
1260
Tk_Window tkwin;		/* Main window of the application. */
TkWindow *winPtr;           /* Toplevel to work with */
Tcl_Interp *interp;		/* Current interpreter. */
int objc;			/* Number of arguments. */
Tcl_Obj *CONST objv[];	/* Argument objects. */
{
    register WmInfo *wmPtr = winPtr->wmInfoPtr;

    if (objc != 3) {
        Tcl_WrongNumArgs(interp, 2, objv, "window");
        return TCL_ERROR;
    }
    if (wmPtr->iconFor != NULL) {
        Tcl_AppendResult(interp, "can't deiconify ", Tcl_GetString(objv[2]),
                         ": it is an icon for ", Tk_PathName(wmPtr->iconFor),
                         (char *) NULL);
        return TCL_ERROR;
    }
    if (winPtr->flags & TK_EMBEDDED) {
        Tcl_AppendResult(interp, "can't deiconify ", winPtr->pathName,
                         ": it is an embedded window", (char *) NULL);
        return TCL_ERROR;
    }
    TkpWmSetState(winPtr, TkMacOSXIsWindowZoomed(winPtr) ?




	    ZoomState : NormalState);
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * WmFocusmodelCmd --
2692
2693
2694
2695
2696
2697
2698





2699
2700
2701
2702
2703
2704
2705
        } else { /* OPT_ZOOMED */
            TkpWmSetState(winPtr, ZoomState);
        }
    } else {
        if (wmPtr->iconFor != NULL) {
            Tcl_SetResult(interp, "icon", TCL_STATIC);
        } else {





            switch (wmPtr->hints.initial_state) {
                case NormalState:
                    Tcl_SetResult(interp, "normal", TCL_STATIC);
                    break;
                case IconicState:
                    Tcl_SetResult(interp, "iconic", TCL_STATIC);
                    break;







>
>
>
>
>







2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
        } else { /* OPT_ZOOMED */
            TkpWmSetState(winPtr, ZoomState);
        }
    } else {
        if (wmPtr->iconFor != NULL) {
            Tcl_SetResult(interp, "icon", TCL_STATIC);
        } else {
	    if (wmPtr->hints.initial_state == NormalState ||
		    wmPtr->hints.initial_state == ZoomState) {
		wmPtr->hints.initial_state = (TkMacOSXIsWindowZoomed(winPtr) ?
			ZoomState : NormalState);
	    }
            switch (wmPtr->hints.initial_state) {
                case NormalState:
                    Tcl_SetResult(interp, "normal", TCL_STATIC);
                    break;
                case IconicState:
                    Tcl_SetResult(interp, "iconic", TCL_STATIC);
                    break;
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
{
    Point where = start;
    TkDisplay *dispPtr;
    Rect       portRect;

    SetPort(GetWindowPort(whichWindow));
    GlobalToLocal(&where);
    GetPortBounds(GetWindowPort(whichWindow), &portRect );
    if (where.h > (portRect.right - 16) &&
	    where.v > (portRect.bottom - 16)) {
	Window window;
	TkWindow *winPtr;
	WmInfo *wmPtr;
	Rect bounds;
	long growResult;







|







4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
{
    Point where = start;
    TkDisplay *dispPtr;
    Rect       portRect;

    SetPort(GetWindowPort(whichWindow));
    GlobalToLocal(&where);
    GetPortBounds(GetWindowPort(whichWindow), &portRect);
    if (where.h > (portRect.right - 16) &&
	    where.v > (portRect.bottom - 16)) {
	Window window;
	TkWindow *winPtr;
	WmInfo *wmPtr;
	Rect bounds;
	long growResult;
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
	}

	growResult = GrowWindow(whichWindow, start, &bounds);

	if (growResult != 0) {
	    SizeWindow(whichWindow,
		    LoWord(growResult), HiWord(growResult), true);
	    InvalWindowRect(whichWindow,&portRect); /* TODO: may not be needed */
	    TkMacOSXInvalClipRgns((Tk_Window) winPtr);
	    TkGenWMConfigureEvent((Tk_Window) winPtr, -1, -1, 
		    (int) LoWord(growResult), (int) HiWord(growResult),
		    TK_SIZE_CHANGED);
	    return true;
	}
	return false;







|







4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
	}

	growResult = GrowWindow(whichWindow, start, &bounds);

	if (growResult != 0) {
	    SizeWindow(whichWindow,
		    LoWord(growResult), HiWord(growResult), true);
	    InvalWindowRect(whichWindow, &portRect); /* TODO: may not be needed */
	    TkMacOSXInvalClipRgns((Tk_Window) winPtr);
	    TkGenWMConfigureEvent((Tk_Window) winPtr, -1, -1, 
		    (int) LoWord(growResult), (int) HiWord(growResult),
		    TK_SIZE_CHANGED);
	    return true;
	}
	return false;
4554
4555
4556
4557
4558
4559
4560














































4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583

4584

4585

4586

4587

4588


4589



4590
4591




4592
4593
4594
4595

4596



4597

4598



4599
4600


4601














4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
    }
    return (Window) Tcl_GetHashValue(hPtr);
}

/*
 *----------------------------------------------------------------------
 *














































 * TkMacOSXZoomToplevel --
 *
 *	The function is invoked when the user clicks in the zoom region
 *	of a Tk window.  The function will handle the mouse tracking
 *	for the interaction.  If the window is to be zoomed the window
 *	size is changed and events are generated to let Tk know what
 *	happened.
 *
 * Results:
 *	True if events were placed on event queue, false otherwise.
 *
 * Side effects:
 *	The window may be resized & events placed on Tk's queue.
 *
 *----------------------------------------------------------------------
 */

int
TkMacOSXZoomToplevel(
    WindowRef whichWindow,	/* The Macintosh window to zoom. */
    short zoomPart)		/* Either inZoomIn or inZoomOut */
{
    Window window;

    Tk_Window tkwin;

    Point location = {0, 0};

    int xOffset, yOffset;

    WmInfo *wmPtr;

    TkDisplay *dispPtr;


    Rect       portRect;




    SetPort(GetWindowPort(whichWindow));





    /*
     * We should now zoom the window (as long as it's one of ours).  We 
     * also need to generate an event to let Tk know that the window size 

     * has changed.



     */

    window = TkMacOSXGetXWindow(whichWindow);



    dispPtr = TkGetDisplayList();
    tkwin = Tk_IdToWindow(dispPtr->display, window);


    if (tkwin == NULL) {














	return false;
    }

    /*
     * The following block of code works around a bug in the window
     * definition for Apple's floating windows.  The zoom behavior is
     * broken - we must manually set the standard state (by default
     * it's something like 1x1) and we must swap the zoomPart manually
     * otherwise we always get the same zoomPart and nothing happens.
     */
    wmPtr = ((TkWindow *) tkwin)->wmInfoPtr;
    if (wmPtr->style >= floatProc && wmPtr->style <= floatSideZoomGrowProc) {
	if (zoomPart == inZoomIn) {
            BitMap screenBits;
            Rect   zoomRect;
            GetQDGlobalsScreenBits(&screenBits);
	    zoomRect = screenBits.bounds;
	    InsetRect(&zoomRect, 60, 60);
	    SetWindowStandardState(whichWindow, &zoomRect);
	    zoomPart = inZoomOut;
	} else {
	    zoomPart = inZoomIn;
	}
    } else {
        zoomPart = inZoomIn;
    }
    
    ZoomWindow(whichWindow, zoomPart, false);
    InvalWindowRect(whichWindow,&portRect);
    TkMacOSXInvalClipRgns(tkwin);

    LocalToGlobal(&location);
    TkMacOSXWindowOffset(whichWindow, &xOffset, &yOffset);
    location.h -= xOffset;
    location.v -= yOffset;
    GetPortBounds ( GetWindowPort(whichWindow), &portRect );
    TkGenWMConfigureEvent(tkwin, location.h, location.v, 
	    portRect.right - portRect.left,
	    portRect.bottom - portRect.top,
	    TK_BOTH_CHANGED);
    return true;
}

/*
 *----------------------------------------------------------------------
 *
 * TkUnsupported1Cmd --
 *







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



|
|


















>
|
>
|
>

>
|
>
|
>
>
|
>
>
>
|
<
>
>
>
>
|
<
<
<
>
|
>
>
>
|
>
|
>
>
>
|
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652

4653
4654
4655
4656
4657



4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689







































4690
4691
4692
4693
4694
4695
4696
    }
    return (Window) Tcl_GetHashValue(hPtr);
}

/*
 *----------------------------------------------------------------------
 *
 * TkMacOSXIsWindowZoomed --
 *
 *	Ask Carbon if the given window is in the zoomed out state.
 *	Because dragging & growing a window can change the Carbon
 *	zoom state, we cannot rely on wmInfoPtr->hints.initial_state
 *	for this information.
 *
 * Results:
 *	True if window is zoomed out, false otherwise.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

int
TkMacOSXIsWindowZoomed(
    TkWindow *winPtr)
{
    WmInfo *wmPtr = winPtr->wmInfoPtr;
    Point idealSize;
    
    if ((wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) &&
	    (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE)) {
	return false;
    }
    if (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) {
	idealSize.h = winPtr->changes.width;
    } else {
	idealSize.h = wmPtr->maxWidth;
    }
    if (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) {
	idealSize.v = winPtr->changes.height;
    } else {
	idealSize.v = wmPtr->maxHeight;
    }

    return IsWindowInStandardState(
	    GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window)),
	    &idealSize, NULL);
}

/*
 *----------------------------------------------------------------------
 *
 * TkMacOSXZoomToplevel --
 *
 *	The function is invoked when the user clicks in the zoom region
 *	of a Tk window or when the window state is set/unset to "zoomed"
 *	manually. If the window is to be zoomed (in or out), the window
 *	size is changed and events are generated to let Tk know what
 *	happened.
 *
 * Results:
 *	True if events were placed on event queue, false otherwise.
 *
 * Side effects:
 *	The window may be resized & events placed on Tk's queue.
 *
 *----------------------------------------------------------------------
 */

int
TkMacOSXZoomToplevel(
    WindowRef whichWindow,	/* The Macintosh window to zoom. */
    short zoomPart)		/* Either inZoomIn or inZoomOut */
{
    Window window;
    TkDisplay *dispPtr;
    TkWindow *winPtr;
    WmInfo *wmPtr;
    Point location = {0, 0}, idealSize;
    Rect portRect;
    int xOffset, yOffset;
    OSStatus status;

    window = TkMacOSXGetXWindow(whichWindow);
    dispPtr = TkGetDisplayList();
    winPtr = (TkWindow *) Tk_IdToWindow(dispPtr->display, window);
    wmPtr = winPtr->wmInfoPtr;
    
    if ((wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) &&
	    (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE)) {
	return false;
    }

    if (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) {
	idealSize.h = winPtr->changes.width;
    } else {
	idealSize.h = wmPtr->maxWidth;
    }



    if (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) {
	idealSize.v = winPtr->changes.height;
    } else {
	idealSize.v = wmPtr->maxHeight;
    }

    /* Do nothing if already in desired zoom state */
    if (!IsWindowInStandardState(whichWindow, &idealSize, NULL) == 
	    (zoomPart == inZoomIn)) {
	return false;
    }

    SetPort(GetWindowPort(whichWindow));
    GetPortBounds(GetWindowPort(whichWindow), &portRect);
    status = ZoomWindowIdeal(whichWindow, zoomPart, &idealSize);
    if (status == noErr) {
	wmPtr->hints.initial_state =
		(zoomPart == inZoomIn ? NormalState : ZoomState);
	InvalWindowRect(whichWindow, &portRect);
	TkMacOSXInvalClipRgns((Tk_Window) winPtr);
	LocalToGlobal(&location);
	TkMacOSXWindowOffset(whichWindow, &xOffset, &yOffset);
	location.h -= xOffset;
	location.v -= yOffset;
	GetPortBounds(GetWindowPort(whichWindow), &portRect);
	TkGenWMConfigureEvent((Tk_Window) winPtr, location.h, location.v, 
		portRect.right - portRect.left, portRect.bottom - portRect.top,
		TK_BOTH_CHANGED);
	return true;
    } else {
	return false;
    }







































}

/*
 *----------------------------------------------------------------------
 *
 * TkUnsupported1Cmd --
 *
5052
5053
5054
5055
5056
5057
5058

5059
5060
5061
5062
5063
5064
5065
	 * to ensure we are topmost (for dropdowns).
	 */
	WindowGroupRef group = GetWindowGroupOfClass(kUtilityWindowClass);
	if (group != NULL) {
	    SetWindowGroup(newWindow, group);
	}
    }


    if (!windowHashInit) {
	Tcl_InitHashTable(&windowTable, TCL_ONE_WORD_KEYS);
	windowHashInit = true;
    }
    valueHashPtr = Tcl_CreateHashEntry(&windowTable,
	    (char *) newWindow, &new);







>







5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
	 * to ensure we are topmost (for dropdowns).
	 */
	WindowGroupRef group = GetWindowGroupOfClass(kUtilityWindowClass);
	if (group != NULL) {
	    SetWindowGroup(newWindow, group);
	}
    }
    SetWindowModified(newWindow, false);

    if (!windowHashInit) {
	Tcl_InitHashTable(&windowTable, TCL_ONE_WORD_KEYS);
	windowHashInit = true;
    }
    valueHashPtr = Tcl_CreateHashEntry(&windowTable,
	    (char *) newWindow, &new);
5290
5291
5292
5293
5294
5295
5296
5297
5298

5299


5300


5301
5302
5303
5304
5305
5306
5307
	if (IsWindowCollapsable(macWin) && !IsWindowCollapsed(macWin)) {
	    CollapseWindow(macWin, true);
	}
	Tk_UnmapWindow((Tk_Window) winPtr);
    } else if (state == NormalState) {
	Tk_MapWindow((Tk_Window) winPtr);
	if (IsWindowCollapsable(macWin) && IsWindowCollapsed(macWin)) {
            CollapseWindow((WindowPtr) macWin, false);
        }

    } else if (state == ZoomState) {


	/* TODO: need to support zoomed windows */


    }
}

/*
 *----------------------------------------------------------------------
 *
 * TkpIsWindowFloating --







|
|
>

>
>
|
>
>







5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
	if (IsWindowCollapsable(macWin) && !IsWindowCollapsed(macWin)) {
	    CollapseWindow(macWin, true);
	}
	Tk_UnmapWindow((Tk_Window) winPtr);
    } else if (state == NormalState) {
	Tk_MapWindow((Tk_Window) winPtr);
	if (IsWindowCollapsable(macWin) && IsWindowCollapsed(macWin)) {
	    CollapseWindow(macWin, false);
	}
	TkMacOSXZoomToplevel(macWin, inZoomIn);
    } else if (state == ZoomState) {
	Tk_MapWindow((Tk_Window) winPtr);
	if (IsWindowCollapsable(macWin) && IsWindowCollapsed(macWin)) {
	    CollapseWindow(macWin, false);
	}
	TkMacOSXZoomToplevel(macWin, inZoomOut);
    }
}

/*
 *----------------------------------------------------------------------
 *
 * TkpIsWindowFloating --
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
            Tcl_Panic("num matched toplevel windows does not equal num children");
    }

    done:
    Tcl_DeleteHashTable(&table);
    return windows;
}












<
<
<
<
<
5701
5702
5703
5704
5705
5706
5707





            Tcl_Panic("num matched toplevel windows does not equal num children");
    }

    done:
    Tcl_DeleteHashTable(&table);
    return windows;
}