summaryrefslogtreecommitdiffstats
path: root/changes
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-10-16 15:22:04 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-10-16 15:22:04 (GMT)
commit2f2ca20a1089b632493c1d3bf0b67c96d898627b (patch)
tree6389b824c5843bdc0f6ec3d75bad8fc980a6f81c /changes
parentb47aca32b8e6db041e5d1ae02f9fe2f98149c98c (diff)
downloadtcl-2f2ca20a1089b632493c1d3bf0b67c96d898627b.zip
tcl-2f2ca20a1089b632493c1d3bf0b67c96d898627b.tar.gz
tcl-2f2ca20a1089b632493c1d3bf0b67c96d898627b.tar.bz2
* library/tcltest/tcltest.tcl: Revise tcltest bump to 2.3a1.
* library/tcltest/pkgIndex.tcl: This permits more features to be * unix/Makefile.in: added to tcltest before we reach version 2.3.0, * win/Makefile.in: best timed to match the release of Tcl 8.5.0. * win/makefile.vc: This also serves as a demo of TIP 268 features.
Diffstat (limited to 'changes')
-rw-r--r--changes4
1 files changed, 2 insertions, 2 deletions
diff --git a/changes b/changes
index b0df572..7bea005 100644
--- a/changes
+++ b/changes
@@ -1,6 +1,6 @@
Recent user-visible changes to Tcl:
-RCS: @(#) $Id: changes,v 1.107 2006/10/11 03:47:14 dgp Exp $
+RCS: @(#) $Id: changes,v 1.108 2006/10/16 15:22:05 dgp Exp $
1. No more [command1] [command2] construct for grouping multiple
commands on a single command line.
@@ -6801,7 +6801,7 @@ For any code relying on exact error messages.
=> msgcat 1.4.2
2006-09-10 (new feature) tcltest option: -verbose line (steffen)
-=> tcltest 2.3.0
+=> tcltest 2.3a1
2006-09-19 (bug fix)[1555271,1561260] Several ** operator bugs (porter)
da887fc2b6f0c7e19b48fbb6b464b35d31aad24'>carbon/tkMacOSXMenus.c406
-rw-r--r--carbon/tkMacOSXMouseEvent.c1190
-rw-r--r--carbon/tkMacOSXNotify.c196
-rw-r--r--carbon/tkMacOSXPort.h187
-rw-r--r--carbon/tkMacOSXPrivate.h352
-rw-r--r--carbon/tkMacOSXRegion.c644
-rw-r--r--carbon/tkMacOSXScale.c482
-rw-r--r--carbon/tkMacOSXScrlbr.c1017
-rw-r--r--carbon/tkMacOSXSend.c506
-rw-r--r--carbon/tkMacOSXSubwindows.c1469
-rw-r--r--carbon/tkMacOSXTest.c80
-rw-r--r--carbon/tkMacOSXWindowEvent.c985
-rw-r--r--carbon/tkMacOSXWm.c6495
-rw-r--r--carbon/tkMacOSXWm.h304
-rw-r--r--carbon/tkMacOSXXCursors.r (renamed from macosx/tkMacOSXXCursors.r)0
-rw-r--r--carbon/tkMacOSXXStubs.c1283
-rw-r--r--carbon/ttkMacOSXTheme.c1132
-rw-r--r--changes251
-rw-r--r--compat/stdlib.h53
-rw-r--r--compat/unistd.h110
-rw-r--r--doc/3DBorder.35
-rw-r--r--doc/AddOption.32
-rw-r--r--doc/BindTable.316
-rw-r--r--doc/CanvPsY.331
-rw-r--r--doc/CanvTkwin.313
-rw-r--r--doc/CanvTxtInfo.34
-rw-r--r--doc/Clipboard.315
-rw-r--r--doc/ClrSelect.34
-rw-r--r--doc/ConfigWidg.374
-rw-r--r--doc/CoordToWin.32
-rw-r--r--doc/CrtCmHdlr.39
-rw-r--r--doc/CrtErrHdlr.37
-rw-r--r--doc/CrtGenHdlr.37
-rw-r--r--doc/CrtImgType.392
-rw-r--r--doc/CrtItemType.3417
-rw-r--r--doc/CrtPhImgFmt.3118
-rw-r--r--doc/CrtSelHdlr.311
-rw-r--r--doc/CrtWindow.37
-rw-r--r--doc/DeleteImg.32
-rw-r--r--doc/DrawFocHlt.32
-rw-r--r--doc/EventHndlr.38
-rw-r--r--doc/FindPhoto.322
-rw-r--r--doc/FontId.33
-rw-r--r--doc/GeomReq.32
-rw-r--r--doc/GetAnchor.323
-rw-r--r--doc/GetBitmap.310
-rw-r--r--doc/GetCapStyl.313
-rw-r--r--doc/GetColor.31
-rw-r--r--doc/GetCursor.36
-rw-r--r--doc/GetDash.340
-rw-r--r--doc/GetFont.32
-rw-r--r--doc/GetGC.32
-rw-r--r--doc/GetHWND.31
-rw-r--r--doc/GetImage.321
-rw-r--r--doc/GetJoinStl.313
-rw-r--r--doc/GetJustify.310
-rw-r--r--doc/GetOption.32
-rw-r--r--doc/GetPixels.34
-rw-r--r--doc/GetPixmap.32
-rw-r--r--doc/GetRelief.313
-rw-r--r--doc/GetScroll.351
-rw-r--r--doc/GetSelect.323
-rw-r--r--doc/GetUid.32
-rw-r--r--doc/GetVRoot.32
-rw-r--r--doc/GetVisual.32
-rw-r--r--doc/Grab.37
-rw-r--r--doc/HWNDToWindow.32
-rw-r--r--doc/HandleEvent.34
-rw-r--r--doc/IdToWindow.32
-rw-r--r--doc/ImgChanged.33
-rw-r--r--doc/Inactive.32
-rw-r--r--doc/InternAtom.32
-rw-r--r--doc/MainLoop.32
-rw-r--r--doc/MainWin.310
-rw-r--r--doc/MaintGeom.31
-rw-r--r--doc/ManageGeom.315
-rw-r--r--doc/MapWindow.32
-rw-r--r--doc/MoveToplev.32
-rw-r--r--doc/Name.38
-rw-r--r--doc/NameOfImg.32
-rw-r--r--doc/OwnSelect.35
-rw-r--r--doc/ParseArgv.320
-rw-r--r--doc/QWinEvent.32
-rw-r--r--doc/Restack.32
-rw-r--r--doc/RestrictEv.319
-rw-r--r--doc/SetAppName.32
-rw-r--r--doc/SetCaret.32
-rw-r--r--doc/SetClass.32
-rw-r--r--doc/SetClassProcs.324
-rw-r--r--doc/SetGrid.32
-rw-r--r--doc/SetOptions.358
-rw-r--r--doc/SetVisual.32
-rw-r--r--doc/StrictMotif.32
-rw-r--r--doc/TextLayout.315
-rw-r--r--doc/TkInitStubs.320
-rw-r--r--doc/Tk_Init.34
-rw-r--r--doc/Tk_Main.318
-rw-r--r--doc/WindowId.32
-rw-r--r--doc/bell.n5
-rw-r--r--doc/bind.n13
-rw-r--r--doc/bindtags.n7
-rw-r--r--doc/bitmap.n24
-rw-r--r--doc/busy.n267
-rw-r--r--doc/button.n52
-rw-r--r--doc/canvas.n805
-rw-r--r--doc/checkbutton.n63
-rw-r--r--doc/chooseColor.n8
-rw-r--r--doc/chooseDirectory.n5
-rw-r--r--doc/clipboard.n43
-rw-r--r--doc/colors.n5
-rw-r--r--doc/console.n6
-rw-r--r--doc/cursors.n26
-rw-r--r--doc/destroy.n5
-rw-r--r--doc/dialog.n10
-rw-r--r--doc/entry.n79
-rw-r--r--doc/event.n118
-rw-r--r--doc/focus.n6
-rw-r--r--doc/focusNext.n5
-rw-r--r--doc/font.n27
-rw-r--r--doc/fontchooser.n181
-rw-r--r--doc/frame.n13
-rw-r--r--doc/getOpenFile.n17
-rw-r--r--doc/grab.n9
-rw-r--r--doc/grid.n88
-rw-r--r--doc/image.n6
-rw-r--r--doc/keysyms.n15
-rw-r--r--doc/label.n16
-rw-r--r--doc/labelframe.n12
-rw-r--r--doc/listbox.n64
-rw-r--r--doc/loadTk.n82
-rw-r--r--doc/lower.n10
-rw-r--r--doc/menu.n387
-rw-r--r--doc/menubar.n6
-rw-r--r--doc/menubutton.n19
-rw-r--r--doc/message.n27
-rw-r--r--doc/messageBox.n33
-rw-r--r--doc/option.n12
-rw-r--r--doc/optionMenu.n4
-rw-r--r--doc/options.n45
-rw-r--r--doc/pack-old.n5
-rw-r--r--doc/pack.n7
-rw-r--r--doc/palette.n5
-rw-r--r--doc/panedwindow.n55
-rw-r--r--doc/photo.n122
-rw-r--r--doc/place.n15
-rw-r--r--doc/popup.n7
-rw-r--r--doc/radiobutton.n55
-rw-r--r--doc/raise.n11
-rw-r--r--doc/scale.n41
-rw-r--r--doc/scrollbar.n33
-rw-r--r--doc/selection.n62
-rw-r--r--doc/send.n10
-rw-r--r--doc/spinbox.n85
-rw-r--r--doc/text.n3168
-rw-r--r--doc/tk.n61
-rw-r--r--doc/tk_mac.n237
-rw-r--r--doc/tkerror.n5
-rw-r--r--doc/tkvars.n70
-rw-r--r--doc/tkwait.n7
-rw-r--r--doc/toplevel.n16
-rw-r--r--doc/ttk_Geometry.36
-rw-r--r--doc/ttk_entry.n8
-rw-r--r--doc/ttk_notebook.n24
-rw-r--r--doc/ttk_panedwindow.n20
-rw-r--r--doc/ttk_progressbar.n4
-rw-r--r--doc/ttk_radiobutton.n2
-rw-r--r--doc/ttk_scale.n4
-rw-r--r--doc/ttk_scrollbar.n6
-rw-r--r--doc/ttk_spinbox.n16
-rw-r--r--doc/ttk_treeview.n10
-rw-r--r--doc/ttk_vsapi.n40
-rw-r--r--doc/ttk_widget.n35
-rw-r--r--doc/winfo.n10
-rw-r--r--doc/wish.19
-rw-r--r--doc/wm.n184
-rw-r--r--generic/tk.decls72
-rw-r--r--generic/tk.h515
-rw-r--r--generic/tk3d.c122
-rw-r--r--generic/tk3d.h15
-rw-r--r--generic/tkArgv.c32
-rw-r--r--generic/tkAtom.c31
-rw-r--r--generic/tkBind.c837
-rw-r--r--generic/tkBitmap.c133
-rw-r--r--generic/tkBusy.c926
-rw-r--r--generic/tkBusy.h41
-rw-r--r--generic/tkButton.c181
-rw-r--r--generic/tkButton.h21
-rw-r--r--generic/tkCanvArc.c129
-rw-r--r--generic/tkCanvBmap.c70
-rw-r--r--generic/tkCanvImg.c64
-rw-r--r--generic/tkCanvLine.c497
-rw-r--r--generic/tkCanvPoly.c512
-rw-r--r--generic/tkCanvPs.c329
-rw-r--r--generic/tkCanvText.c422
-rw-r--r--generic/tkCanvUtil.c284
-rw-r--r--generic/tkCanvWind.c101
-rw-r--r--generic/tkCanvas.c1465
-rw-r--r--generic/tkCanvas.h8
-rw-r--r--generic/tkClipboard.c74
-rw-r--r--generic/tkCmds.c876
-rw-r--r--generic/tkColor.c68
-rw-r--r--generic/tkColor.h10
-rw-r--r--generic/tkConfig.c136
-rw-r--r--generic/tkConsole.c205
-rw-r--r--generic/tkCursor.c88
-rw-r--r--generic/tkDecls.h1685
-rw-r--r--generic/tkEntry.c444
-rw-r--r--generic/tkEntry.h14
-rw-r--r--generic/tkError.c13
-rw-r--r--generic/tkEvent.c110
-rw-r--r--generic/tkFileFilter.c194
-rw-r--r--generic/tkFileFilter.h9
-rw-r--r--generic/tkFocus.c158
-rw-r--r--generic/tkFont.c810
-rw-r--r--generic/tkFont.h32
-rw-r--r--generic/tkFrame.c234
-rw-r--r--generic/tkGC.c12
-rw-r--r--generic/tkGeometry.c115
-rw-r--r--generic/tkGet.c34
-rw-r--r--generic/tkGrab.c60
-rw-r--r--generic/tkGrid.c228
-rw-r--r--generic/tkImage.c160
-rw-r--r--generic/tkImgBmap.c132
-rw-r--r--generic/tkImgGIF.c1131
-rw-r--r--generic/tkImgPNG.c3485
-rw-r--r--generic/tkImgPPM.c29
-rw-r--r--generic/tkImgPhInstance.c1967
-rw-r--r--generic/tkImgPhoto.c2671
-rw-r--r--generic/tkImgPhoto.h260
-rw-r--r--generic/tkImgUtil.c2
-rw-r--r--generic/tkInt.decls188
-rw-r--r--generic/tkInt.h212
-rw-r--r--generic/tkIntDecls.h1207
-rw-r--r--generic/tkIntPlatDecls.h606
-rw-r--r--generic/tkIntXlibDecls.h1020
-rw-r--r--generic/tkListbox.c224
-rw-r--r--generic/tkMacWinMenu.c8
-rw-r--r--generic/tkMain.c368
-rw-r--r--generic/tkMenu.c428
-rw-r--r--generic/tkMenu.h14
-rw-r--r--generic/tkMenuDraw.c28
-rw-r--r--generic/tkMenubutton.c114
-rw-r--r--generic/tkMenubutton.h14
-rw-r--r--generic/tkMessage.c86
-rw-r--r--generic/tkObj.c178
-rw-r--r--generic/tkOldConfig.c110
-rw-r--r--generic/tkOldTest.c46
-rw-r--r--generic/tkOption.c123
-rw-r--r--generic/tkPack.c218
-rw-r--r--generic/tkPanedWindow.c201
-rw-r--r--generic/tkPlace.c112
-rw-r--r--generic/tkPlatDecls.h187
-rw-r--r--generic/tkPointer.c20
-rw-r--r--generic/tkPort.h13
-rw-r--r--generic/tkRectOval.c121
-rw-r--r--generic/tkScale.c96
-rw-r--r--generic/tkScale.h8
-rw-r--r--generic/tkScrollbar.c134
-rw-r--r--generic/tkScrollbar.h20
-rw-r--r--generic/tkSelect.c179
-rw-r--r--generic/tkSelect.h6
-rw-r--r--generic/tkSquare.c83
-rw-r--r--generic/tkStubInit.c175
-rw-r--r--generic/tkStubLib.c59
-rw-r--r--generic/tkStyle.c140
-rw-r--r--generic/tkTest.c365
-rw-r--r--generic/tkText.c454
-rw-r--r--generic/tkText.h62
-rw-r--r--generic/tkTextBTree.c205
-rw-r--r--generic/tkTextDisp.c599
-rw-r--r--generic/tkTextImage.c33
-rw-r--r--generic/tkTextIndex.c136
-rw-r--r--generic/tkTextMark.c75
-rw-r--r--generic/tkTextTag.c84
-rw-r--r--generic/tkTextWind.c81
-rw-r--r--generic/tkTrig.c6
-rw-r--r--generic/tkUndo.c31
-rw-r--r--generic/tkUndo.h10
-rw-r--r--generic/tkUtil.c250
-rw-r--r--generic/tkVisual.c19
-rw-r--r--generic/tkWindow.c261
-rw-r--r--generic/ttk/ttk.decls124
-rw-r--r--generic/ttk/ttkBlink.c4
-rw-r--r--generic/ttk/ttkCache.c4
-rw-r--r--generic/ttk/ttkDecls.h34
-rw-r--r--generic/ttk/ttkGenStubs.tcl168
-rw-r--r--generic/ttk/ttkImage.c14
-rw-r--r--generic/ttk/ttkLabel.c6
-rw-r--r--generic/ttk/ttkLayout.c12
-rw-r--r--generic/ttk/ttkManager.c13
-rw-r--r--generic/ttk/ttkScroll.c4
-rw-r--r--generic/ttk/ttkTagSet.c20
-rw-r--r--generic/ttk/ttkTheme.c30
-rw-r--r--generic/ttk/ttkTrace.c6
-rw-r--r--generic/ttk/ttkTrack.c2
-rw-r--r--generic/ttk/ttkTreeview.c35
-rw-r--r--library/bgerror.tcl100
-rw-r--r--library/button.tcl7
-rw-r--r--library/choosedir.tcl9
-rw-r--r--library/console.tcl75
-rw-r--r--library/demos/combo.tcl1
-rw-r--r--library/demos/ctext.tcl61
-rw-r--r--library/demos/en.msg2
-rw-r--r--library/demos/filebox.tcl15
-rw-r--r--library/demos/fontchoose.tcl69
-rw-r--r--library/demos/image2.tcl2
-rw-r--r--library/demos/images/face.xbm173
-rw-r--r--library/demos/images/ouster.pngbin0 -> 54257 bytes-rw-r--r--library/demos/items.tcl25
-rw-r--r--library/demos/knightstour.tcl29
-rw-r--r--library/demos/label.tcl11
-rw-r--r--library/demos/mclist.tcl47
-rw-r--r--library/demos/msgbox.tcl1
-rw-r--r--library/demos/nl.msg2
-rw-r--r--library/demos/pendulum.tcl6
-rw-r--r--library/demos/text.tcl27
-rw-r--r--library/demos/toolbar.tcl7
-rw-r--r--library/demos/tree.tcl10
-rw-r--r--library/demos/ttkbut.tcl1
-rw-r--r--library/demos/ttkmenu.tcl1
-rw-r--r--library/demos/ttknote.tcl7
-rw-r--r--library/demos/ttkpane.tcl11
-rw-r--r--library/demos/ttkprogress.tcl1
-rw-r--r--library/demos/twind.tcl2
-rw-r--r--library/demos/unicodeout.tcl103
-rw-r--r--library/demos/widget25
-rw-r--r--library/dialog.tcl2
-rw-r--r--library/entry.tcl29
-rw-r--r--library/fontchooser.tcl442
-rw-r--r--library/iconlist.tcl694
-rw-r--r--library/icons.tcl153
-rw-r--r--library/images/lamp.pngbin0 -> 8203 bytes-rw-r--r--library/images/lamp.svg114
-rw-r--r--library/listbox.tcl13
-rw-r--r--library/megawidget.tcl140
-rw-r--r--library/mkpsenc.tcl2782
-rw-r--r--library/msgbox.tcl60
-rw-r--r--library/msgs/cs.msg67
-rw-r--r--library/msgs/da.msg5
-rw-r--r--library/msgs/de.msg15
-rw-r--r--library/msgs/el.msg8
-rw-r--r--library/msgs/en.msg15
-rw-r--r--library/msgs/eo.msg4
-rw-r--r--library/msgs/es.msg14
-rw-r--r--library/msgs/fr.msg16
-rw-r--r--library/msgs/hu.msg7
-rw-r--r--library/msgs/it.msg21
-rw-r--r--library/msgs/nl.msg82
-rw-r--r--library/msgs/pl.msg22
-rw-r--r--library/msgs/pt.msg140
-rw-r--r--library/msgs/ru.msg24
-rw-r--r--library/msgs/sv.msg4
-rw-r--r--library/safetk.tcl4
-rw-r--r--library/scrlbar.tcl36
-rw-r--r--library/spinbox.tcl26
-rw-r--r--library/tclIndex31
-rw-r--r--library/text.tcl64
-rw-r--r--library/tk.tcl257
-rw-r--r--library/tkfbox.tcl1069
-rw-r--r--library/ttk/entry.tcl28
-rw-r--r--library/unsupported.tcl28
-rw-r--r--library/xmfbox.tcl2
-rw-r--r--license.terms7
-rw-r--r--macosx/README394
-rw-r--r--macosx/Tk-Common.xcconfig46
-rw-r--r--macosx/Tk-Debug.xcconfig19
-rw-r--r--macosx/Tk-Info.plist.in5
-rw-r--r--macosx/Tk-Release.xcconfig19
-rw-r--r--macosx/Tk.icnsbin0 -> 154497 bytes-rw-r--r--macosx/Tk.tiffbin0 -> 53684 bytes-rw-r--r--macosx/Tk.xcode/default.pbxuser384
-rw-r--r--macosx/Tk.xcode/project.pbxproj5785
-rw-r--r--macosx/Tk.xcodeproj/default.pbxuser399
-rw-r--r--macosx/Tk.xcodeproj/project.pbxproj5929
-rw-r--r--macosx/Wish-Info.plist.in9
-rw-r--r--macosx/Wish.pbproj/default.pbxuser178
-rw-r--r--macosx/Wish.pbproj/jingham.pbxuser178
-rw-r--r--macosx/Wish.pbproj/project.pbxproj2312
-rw-r--r--macosx/Wish.sdef37
-rw-r--r--macosx/tkMacOSX.h14
-rw-r--r--macosx/tkMacOSXBitmap.c487
-rw-r--r--macosx/tkMacOSXButton.c2212
-rw-r--r--macosx/tkMacOSXClipboard.c361
-rw-r--r--macosx/tkMacOSXColor.c461
-rw-r--r--macosx/tkMacOSXConfig.c6
-rw-r--r--macosx/tkMacOSXCursor.c509
-rw-r--r--macosx/tkMacOSXCursors.h89
-rw-r--r--macosx/tkMacOSXDebug.c525
-rw-r--r--macosx/tkMacOSXDebug.h70
-rw-r--r--macosx/tkMacOSXDefault.h111
-rw-r--r--macosx/tkMacOSXDialog.c2482
-rw-r--r--macosx/tkMacOSXDraw.c1483
-rw-r--r--macosx/tkMacOSXEmbed.c118
-rw-r--r--macosx/tkMacOSXEntry.c273
-rw-r--r--macosx/tkMacOSXEvent.c331
-rw-r--r--macosx/tkMacOSXEvent.h90
-rw-r--r--macosx/tkMacOSXFont.c2388
-rw-r--r--macosx/tkMacOSXFont.h8
-rw-r--r--macosx/tkMacOSXHLEvents.c111
-rw-r--r--macosx/tkMacOSXInit.c494
-rw-r--r--macosx/tkMacOSXInt.h126
-rw-r--r--macosx/tkMacOSXKeyEvent.c1488
-rw-r--r--macosx/tkMacOSXKeyboard.c405
-rw-r--r--macosx/tkMacOSXMenu.c4896
-rw-r--r--macosx/tkMacOSXMenubutton.c1105
-rw-r--r--macosx/tkMacOSXMenus.c690
-rw-r--r--macosx/tkMacOSXMouseEvent.c1132
-rw-r--r--macosx/tkMacOSXNotify.c282
-rw-r--r--macosx/tkMacOSXPort.h22
-rw-r--r--macosx/tkMacOSXPrivate.h422
-rw-r--r--macosx/tkMacOSXRegion.c153
-rw-r--r--macosx/tkMacOSXScale.c19
-rw-r--r--macosx/tkMacOSXScrlbr.c1140
-rw-r--r--macosx/tkMacOSXSend.c41
-rw-r--r--macosx/tkMacOSXSubwindows.c756
-rw-r--r--macosx/tkMacOSXTest.c16
-rw-r--r--macosx/tkMacOSXWindowEvent.c1258
-rw-r--r--macosx/tkMacOSXWm.c2266
-rw-r--r--macosx/tkMacOSXWm.h58
-rw-r--r--macosx/tkMacOSXXCursors.h711
-rw-r--r--macosx/tkMacOSXXStubs.c465
-rw-r--r--macosx/ttkMacOSXTheme.c544
-rw-r--r--tests/bell.test57
-rw-r--r--tests/bgerror.test45
-rw-r--r--tests/bind.test7992
-rw-r--r--tests/bitmap.test82
-rw-r--r--tests/border.test158
-rw-r--r--tests/busy.test477
-rw-r--r--tests/button.test4401
-rw-r--r--tests/canvImg.test809
-rw-r--r--tests/canvMoveto.test56
-rw-r--r--tests/canvPs.test45
-rw-r--r--tests/canvRect.test599
-rw-r--r--tests/canvText.test914
-rw-r--r--tests/canvWind.test43
-rw-r--r--tests/canvas.test746
-rw-r--r--tests/choosedir.test82
-rw-r--r--tests/clipboard.test361
-rw-r--r--tests/clrpick.test191
-rw-r--r--tests/cmds.test50
-rw-r--r--tests/config.test2135
-rw-r--r--tests/constraints.tcl39
-rw-r--r--tests/cursor.test900
-rw-r--r--tests/dialog.test75
-rw-r--r--tests/embed.test96
-rw-r--r--tests/entry.test3701
-rw-r--r--tests/event.test211
-rw-r--r--tests/focus.test556
-rw-r--r--tests/focusTcl.test483
-rw-r--r--tests/font.test2806
-rw-r--r--tests/fontchooser.test201
-rw-r--r--tests/frame.test1483
-rw-r--r--tests/geometry.test168
-rw-r--r--tests/get.test132
-rw-r--r--tests/grab.test218
-rw-r--r--tests/grid.test1542
-rw-r--r--tests/id.test91
-rw-r--r--tests/image.test639
-rw-r--r--tests/imgBmap.test490
-rw-r--r--tests/imgPNG.test1116
-rw-r--r--tests/imgPPM.test212
-rw-r--r--tests/imgPhoto.test1553
-rw-r--r--tests/listbox.test2862
-rw-r--r--tests/main.test136
-rw-r--r--tests/menu.test4664
-rw-r--r--tests/menuDraw.test778
-rw-r--r--tests/menubut.test817
-rw-r--r--tests/message.test534
-rw-r--r--tests/msgbox.test466
-rw-r--r--tests/obj.test22
-rw-r--r--tests/oldpack.test577
-rw-r--r--tests/option.test503
-rw-r--r--tests/pack.test1797
-rw-r--r--tests/packgrid.test250
-rw-r--r--tests/panedwindow.test5619
-rw-r--r--tests/place.test435
-rw-r--r--tests/raise.test201
-rw-r--r--tests/safe.test179
-rw-r--r--tests/scale.test1494
-rw-r--r--tests/scrollbar.test8
-rw-r--r--tests/select.test681
-rw-r--r--tests/send.test4
-rw-r--r--tests/spinbox.test4031
-rw-r--r--tests/text.test8327
-rw-r--r--tests/textBTree.test1087
-rw-r--r--tests/textImage.test692
-rw-r--r--tests/textIndex.test2
-rw-r--r--tests/textMark.test236
-rw-r--r--tests/textTag.test1664
-rw-r--r--tests/textWind.test1188
-rw-r--r--tests/tk.test204
-rw-r--r--tests/unixButton.test199
-rw-r--r--tests/unixEmbed.test596
-rw-r--r--tests/unixMenu.test1179
-rw-r--r--tests/unixSelect.test420
-rw-r--r--tests/util.test66
-rw-r--r--tests/visual.test562
-rw-r--r--tests/visual_bb.test54
-rw-r--r--tests/winButton.test172
-rw-r--r--tests/winClipboard.test116
-rw-r--r--tests/winDialog.test555
-rw-r--r--tests/winFont.test454
-rw-r--r--tests/winMenu.test1257
-rw-r--r--tests/winMsgbox.test45
-rw-r--r--tests/winSend.test2
-rw-r--r--tests/winWm.test317
-rw-r--r--tests/window.test201
-rw-r--r--tests/winfo.test599
-rw-r--r--tests/wm.test14
-rw-r--r--tests/xmfbox.test107
-rw-r--r--unix/Makefile.in359
-rwxr-xr-xunix/configure749
-rw-r--r--unix/configure.in106
-rw-r--r--[-rwxr-xr-x]unix/install-sh580
-rwxr-xr-xunix/installManPage7
-rw-r--r--unix/tcl.m4151
-rw-r--r--unix/tk.pc.in15
-rw-r--r--unix/tk.spec6
-rw-r--r--unix/tkAppInit.c70
-rw-r--r--unix/tkConfig.h.in26
-rw-r--r--unix/tkUnix.c4
-rw-r--r--unix/tkUnix3d.c15
-rw-r--r--unix/tkUnixButton.c15
-rw-r--r--unix/tkUnixColor.c16
-rw-r--r--unix/tkUnixConfig.c4
-rw-r--r--unix/tkUnixCursor.c50
-rw-r--r--unix/tkUnixDefault.h65
-rw-r--r--unix/tkUnixDialog.c18
-rw-r--r--unix/tkUnixDraw.c11
-rw-r--r--unix/tkUnixEmbed.c199
-rw-r--r--unix/tkUnixEvent.c37
-rw-r--r--unix/tkUnixFont.c498
-rw-r--r--unix/tkUnixInit.c7
-rw-r--r--unix/tkUnixKey.c94
-rw-r--r--unix/tkUnixMenu.c133
-rw-r--r--unix/tkUnixMenubu.c13
-rw-r--r--unix/tkUnixPort.h28
-rw-r--r--unix/tkUnixRFont.c406
-rw-r--r--unix/tkUnixScale.c16
-rw-r--r--unix/tkUnixScrlbr.c29
-rw-r--r--unix/tkUnixSelect.c117
-rw-r--r--unix/tkUnixSend.c152
-rw-r--r--unix/tkUnixWm.c687
-rw-r--r--unix/tkUnixXId.c473
-rw-r--r--win/Makefile.in80
-rw-r--r--win/README2
-rwxr-xr-xwin/buildall.vc.bat2
-rwxr-xr-xwin/configure233
-rw-r--r--win/configure.in47
-rw-r--r--win/makefile.bc3
-rw-r--r--win/makefile.vc81
-rw-r--r--win/nmakehlp.c8
-rw-r--r--win/rc/tk.icobin1398 -> 57022 bytes-rw-r--r--win/rc/wish.icobin3630 -> 46878 bytes-rw-r--r--win/rules.vc51
-rw-r--r--win/stubs.c2
-rw-r--r--win/tcl.m498
-rw-r--r--win/tkWin.h16
-rw-r--r--win/tkWin32Dll.c6
-rw-r--r--win/tkWin3d.c2
-rw-r--r--win/tkWinButton.c33
-rw-r--r--win/tkWinClipboard.c14
-rw-r--r--win/tkWinColor.c73
-rw-r--r--win/tkWinConfig.c4
-rw-r--r--win/tkWinCursor.c37
-rw-r--r--win/tkWinDefault.h65
-rw-r--r--win/tkWinDialog.c1416
-rw-r--r--win/tkWinDraw.c29
-rw-r--r--win/tkWinEmbed.c18
-rw-r--r--win/tkWinFont.c617
-rw-r--r--win/tkWinImage.c70
-rw-r--r--win/tkWinInit.c37
-rw-r--r--win/tkWinInt.h71
-rw-r--r--win/tkWinKey.c27
-rw-r--r--win/tkWinMenu.c141
-rw-r--r--win/tkWinPixmap.c12
-rw-r--r--win/tkWinPointer.c14
-rw-r--r--win/tkWinPort.h48
-rw-r--r--win/tkWinScrlbr.c121
-rw-r--r--win/tkWinSend.c28
-rw-r--r--win/tkWinSendCom.c8
-rw-r--r--win/tkWinTest.c205
-rw-r--r--win/tkWinWindow.c192
-rw-r--r--win/tkWinWm.c804
-rw-r--r--win/tkWinX.c189
-rw-r--r--win/ttkWinMonitor.c2
-rw-r--r--win/ttkWinTheme.c2
-rw-r--r--win/ttkWinXPTheme.c27
-rw-r--r--win/winMain.c224
-rw-r--r--xlib/xgc.c45
-rw-r--r--xlib/xutil.c5
636 files changed, 164112 insertions, 78561 deletions
diff --git a/ChangeLog b/ChangeLog
index f2059ce..6c97514 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,7 +15,7 @@
* library/menu.tcl: [Bug 2768586]: Menu posting problem on dual monitors
-2012-05-02 Jan Nijtmans <nijtmans@users.sf.net>
+2012-04-29 Jan Nijtmans <nijtmans@users.sf.net>
* library/tk.tcl: [Bug 533519]: Window placement with multiple screens
* generic/tkBind.c:
@@ -35,7 +35,6 @@
* generic/tkPlatDecls.h:
* generic/tkintDecls.h:
* generic/tkStubInit.c:
- * unix/Makefile.in: [Bug 3519917]: Snow Leopard unix/Makefile `make test` fail
2012-04-22 Donal K. Fellows <dkf@users.sf.net>
@@ -46,26 +45,30 @@
memory) to Tkinter/Python because of the way they map events between
languages.
+2012-04-20 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkWindow.c (commands): Ensure that all descriptions of
+ commands created by Tk are correct.
+
2012-04-20 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tk.tcl: Use vroot size in stead of screen size for
- clipping window coordinates in ::tk::PlaceWindow.
- * generic/dialog.tcl: Use ::tk::PlaceWindow in dialog.tcl, in
- stead of dumplicating the code there.
- (harmless part of [Bug 533519])
+ * generic/tk.tcl: Use vroot size in stead of screen size for clipping
+ window coordinates in ::tk::PlaceWindow.
+ * generic/dialog.tcl: Use ::tk::PlaceWindow in dialog.tcl, instead of
+ dumplicating the code there. (harmless part of [Bug 533519])
2012-04-13 Jan Nijtmans <nijtmans@users.sf.net>
- * win/rules.vc: [Bug 3517448] TclKit build fails (unresolved
+ * win/rules.vc: [Bug 3517448]: TclKit build fails (unresolved
__strtoi64)
2012-04-07 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkBind.c: [Bug 3176239] control-MouseWheel causes segv
+ * generic/tkBind.c: [Bug 3176239]: control-MouseWheel causes segv
2012-03-30 Jan Nijtmans <nijtmans@users.sf.net>
- * unix/tcl.m4: [Bug 3511806] Compiler checks too early
+ * unix/tcl.m4: [Bug 3511806]: Compiler checks too early
* unix/configure.in: This change allows to build the cygwin
* unix/configure and mingw32 ports of Tcl/Tk to build
* win/tcl.m4: out-of-the-box using a native or cross-
@@ -74,7 +77,7 @@
2012-03-21 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkColor.c: [Bug 2809525] Abort on overlong color name.
+ * generic/tkColor.c: [Bug 2809525]: Abort on overlong color name.
* unix/tkUnixColor.c:
2012-03-18 Jan Nijtmans <nijtmans@users.sf.net>
@@ -83,6 +86,10 @@
* xlib/rgb.txt: List of all colors accepted by Tk in Xorg format
* tests/color.test: Added test case for all colors in rgb.txt
+2012-03-13 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/*.3, doc/*.n: Minor spelling fixes.
+
2012-03-07 Donal K. Fellows <dkf@users.sf.net>
* generic/tkObj.c (GetPixelsFromObjEx): [Bug 3497848]: Better rounding
@@ -112,6 +119,11 @@
* win/configure.in: Detect whether _strtoi64 is available
* win/configure: (regenerated)
+2012-02-25 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinDialog.c: [Bug 1913750]: tk_chooseDirectory -initialdir
+ internationalization problem.
+
2012-02-15 Jan Nijtmans <nijtmans@users.sf.net>
* xlib/xcolors.c: [Bug 3486474]: Inconsistent color scaling
@@ -121,7 +133,7 @@
2012-02-10 Donal K. Fellows <dkf@users.sf.net>
- * win/tkWinDialog.c (GetFileNameW): Ensure that we do not convert a
+ * win/tkWinDialog.c (GetFileName): Ensure that we do not convert a
result list to a string inadvertently, as this causes problems with
Tkinter's handling of multiple filename results. Issue was reported
via StackOverflow: http://stackoverflow.com/q/9227859/301832
@@ -169,19 +181,27 @@
* generic/tkText.c: [Bug-3021557]: Moving the cursor in
* tests/text.test: elided text freezes Tk
+2011-12-13 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/getOpenFile.n: Make example follow best practices. Issue spotted
+ by Emiliano Gavilan.
+
+2011-11-29 Donal K. Fellows <dkf@users.sf.net>
+
+ * tests/safe.test: [Bug 1847925]: Update list of hidden commands.
+
2011-11-22 Jan Nijtmans <nijtmans@users.sf.net>
- * doc/wish.1: Use the same shebang comment everywhere.
- * library/demos/hello
- * library/demos/rmt
- * library/demos/square
- * library/demos/tcolor
- * library/demos/timer
- * library/demos/widget
* unix/Makefile.in: [Bug 1945073]: Demo square.tcl
* win/Makefile.in: cannot run; need package tktest
-2011-11-17 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
+2011-11-17 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * doc/menu.n: Fix the escaping of leading dots in lines that start with
+ a widget name, so that nroff doesn't mistake it as a non-existing macro
+ and skips the entire line.
+
+2011-11-14 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
* generic/tkCanvas.c: [Bug 3437816]: Missing TCL_ERROR return
in [canvas lower].
@@ -196,35 +216,15 @@
* doc/ttk_notebook.n: doesn't mistake it as a non-existing macro
* doc/pack.n: and skips the entire line.
-2011-11-04 Don Porter <dgp@users.sourceforge.net>
-
- *** 8.5.11 TAGGED FOR RELEASE ***
-
- * generic/tk.h: Bump to 8.5.11 for release.
- * library/tk.tcl:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in:
- * README:
-
- * unix/configure: autoconf-2.59
- * win/configure:
-
- * changes: Updated for 8.5.11 release.
-
2011-11-01 Donal K. Fellows <dkf@users.sf.net>
* generic/tkObj.c (GetPixelsFromObjEx): [Bug 3431491]: Use a bit of
type hackery to allow numbers to be interpreted as coordinates (most
notably on a canvas) without reinterpreting via a string.
-2011-10-26 Don Porter <dgp@users.sourceforge.net>
-
- * changes: Updates for 8.5.11.
+2011-10-27 Kevin B. Kenny <kennykb@acm.org>
-2011-10-01 Kevin B. Kenny <kennykb@acm.org>
-
- * generic/tkInt.h: [Bug 3410609] Change the event mechanism
+ * generic/tkInt.h: [Bug 3410609]: Change the event mechanism
* unix/tkUnixEvent.c: for <KeyPress> events to use the keysym
* unix/tkUnixKey.c: returned by XLookupString in preference to
the one that appears in the raw X event at any level. This change
@@ -232,6 +232,32 @@
and similar beasts. KeyRelease events still work as they did before,
as does Tk with input methods disabled.
+2011-10-13 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinDialog.c: Internationalization of all Windows font
+ * win/tkWinFont.c: handling.
+
+2011-10-10 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinDialog.c: [Bug 3163893]: -initialdir option bug for
+ tk_chooseDirectory under XP
+
+2011-10-05 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinInt.h: Remove tkWinProcs, as it is no longer
+ * win/tkWinX.c: being used.
+ * win/tkWinTest.c:
+
+2011-09-27 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkImgPNG.c (WriteExtraChunks): [Bug 3405839]: Write the sDAT
+ chunk with the correct length.
+
+2011-09-08 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkDecls.h: Don't let tkDecls.h depend on <tchar.h> on
+ windows, not even in UNICODE mode.
+
2011-09-01 Donal K. Fellows <dkf@users.sf.net>
* doc/photo.n: Correctly documented what the [$ph data] command
@@ -239,59 +265,78 @@
2011-08-16 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tkWinDialog.c: [Bug 3388350] mingw64 compiler warnings
- * win/tkWinDraw.c
- * win/tkWinSend.c
- * win/tkWinSendCom.c
- * win/tkWinColor.c
- * win/tkWinDialog.c
+ * win/tkWinDialog.c: [Bug 3388350]: mingw64 compiler warnings
* win/tkWinEmbed.c
* win/tkWinMenu.c
- * win/tkWinPixmap.c
* win/tkWinTest.c
- * win/tkWinWindow.c
* win/tkWinWm.c
* win/tkWinX.c
- * win/stubs.c
- * generic/tkAtom.c
- * generic/tkSelect.c
2011-08-13 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkBitmap.c: [Bug 3388350] mingw64 compiler warnings
+ * generic/tkBitmap.c: [Bug 3388350]: mingw64 compiler warnings
* generic/tkConsole.c
- * unix/tkUnixMenubu.c
- * win/tkWinButton.c
+ * win/tkWinDialog.c
* win/tkWinEmbed.c
- * win/tkWinFont.c
- * win/tkWinImage.c
- * win/tkWinKey.c
- * win/tkWinTest.c
- * win/tkWinWm.c
+ * win/tkWinSend.c
+ * win/tkWinSendCom.c
+
+2011-08-05 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.6b2 TAGGED FOR RELEASE ***
+
+ * changes: Updates for 8.6b2 release.
+
+2011-08-03 Don Porter <dgp@users.sourceforge.net>
+
+ * win/tkWinWm.c: [Bug 2891541]: Merge of 8.5.8 fix from Pat Thoyts.
+ Permit normal behaviour on Windows for a grabbed toplevel when it
+ is the main window.
2011-08-03 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tkWinDialog.c: [Bug 3314770] regression - Windows file
+ * win/tkWinDialog.c: [Bug 3314770]: regression - Windows file
dialogs not resizable
+2011-07-28 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updates for 8.6b2 release.
+
2011-07-28 Jan Nijtmans <nijtmans@users.sf.net>
- * xlib/X11/Xutil.h: [Bug 3380684] XEmptyRegion prototype doesn't
+ * xlib/X11/Xutil.h: [Bug 3380684]: XEmptyRegion prototype doesn't
match usage
+2011-07-19 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/*.3, doc/*.n: Many small fixes to documentation as part of
+ project to improve quality of generated HTML docs.
+
+2011-07-18 Don Porter <dgp@users.sourceforge.net>
+
+ * README: Bump version number to 8.6b2
+ * generic/tk.h:
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
+
2011-06-29 Don Porter <dgp@users.sourceforge.net>
- * generic/ttk/ttkTrace.c: [Bug 3341056] Correct segfault due to flaw
+ * generic/ttk/ttkTrace.c: [Bug 3341056]: Correct segfault due to flaw
* tests/ttk/ttk.test: in the 2011-06-17 commit.
-2011-06-23 Don Porter <dgp@users.sourceforge.net>
+2011-06-19 Donal K. Fellows <dkf@users.sf.net>
- * changes: Updated for 8.5.10 release.
+ * doc/wm.n: Added documentation of the -type attribute that was
+ introduced in TIP#359, and moved documentation of -alpha to common
+ section as it is supported on all platforms now.
2011-06-17 Don Porter <dgp@users.sourceforge.net>
- *** 8.5.10 TAGGED FOR RELEASE ***
-
* generic/ttk/ttkTrace.c: Workaround Bug 3062331.
* tests/ttk/ttk.test:
* changes: Updated
@@ -303,31 +348,26 @@
2011-06-10 Don Porter <dgp@users.sourceforge.net>
- * README: Correct some README bitrot.
- * macosx/README:
-
- * generic/tkCanvLine.c: [Bug 3175610] Incomplete refresh of line item.
- Backport of 2011-03-03 trunk commit from Alexandre Ferrieux.
+ * generic/tkEntry.c: [Bug 3315731]: Fix [$entry -invcmd].
-2011-06-08 Don Porter <dgp@users.sourceforge.net>
+2011-06-10 Don Porter <dgp@users.sourceforge.net>
- * changes: Updated for 8.5.10 release.
+ * README: Correct some README bitrot.
+ * macosx/README:
2011-06-07 Don Porter <dgp@users.sourceforge.net>
- * win/tkWinDialog.c: Backport [Bug 2484771] fix.
-
- * generic/tkEntry.c: Restore support for values "08" and "09"
- in a [spinbox] configured to use -from and -to values. [Bug 2358545].
+ * generic/tkEntry.c: [Bug 2358545]: Restore support for values "08"
+ and "09" in a [spinbox] configured to use -from and -to values.
2011-06-06 Don Porter <dgp@users.sourceforge.net>
- * generic/tkConsole.c: Restore proper NUL output to the [console].
- [Bug 2546087]
+ * generic/tkConsole.c: [Bug 2546087]: Restore proper NUL output to
+ * library/console.tcl: the [console].
2011-04-22 Peter Spjuth <peter.spjuth@gmail.com>
- * generic/tkCanvPoly.c: [Bug 3291543] There was a crash if dchars
+ * generic/tkCanvPoly.c: [Bug 3291543]: There was a crash if dchars
* tests/canvas.test: removed all coordinates of a polygon.
2011-04-21 Peter Spjuth <peter.spjuth@gmail.com>
@@ -342,12 +382,26 @@
* doc/ttk_progressbar.n:
* doc/ttk_widget.n:
+2011-04-06 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/tkAppInit.c: Make symbols "main" and "Tcl_AppInit"
+ MODULE_SCOPE: there is absolutely no reason for exporting them.
+ * unix/tcl.m4: Don't use -fvisibility=hidden with static
+ * unix/configure libraries (--disable-shared)
+
2011-04-04 Peter Spjuth <peter.spjuth@gmail.com>
* tests/grid.test:
* generic/tkGrid.c: [Bug 723765]: When a slave was removed from grid,
the -in option was not remembered.
+2011-04-04 Joe Mistachkin <joe@mistachkin.com>
+
+ * win/tkWinDialog.c (FontchooserShowCmd): Change the CHOOSEFONT and
+ LOGFONT used with sizeof to CHOOSEFONTA and LOGFONTA to match their
+ local variable declarations (i.e. mismatch with -DUNICODE). This code
+ is not present in 8.4 or 8.5.
+
2011-04-04 Peter Spjuth <peter.spjuth@gmail.com>
* doc/labelframe.n:
@@ -357,15 +411,21 @@
sense as a container. Added note to frame about restrictions when used
as a container.
+2011-03-28 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/tk.tcl (::tk::FindAltKeyTarget): Make this handle the
+ traversal of the logical window manager hierarchy correctly. Based on
+ comments by Emiliano Gavilan.
+
2011-03-28 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkTextBTree.c: [Bug 3129527]: Fix buffer overflow
- w/ GCC 4.5 and -D_FORTIFY_SOURCE=2. One more place where this problem
- could appear.
+ * generic/tkTextBTree.c: [Bug 3129527]: Fix buffer overflow w/ GCC 4.5
+ and -D_FORTIFY_SOURCE=2. One more place where this problem could
+ appear.
2011-03-24 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tkWinMenu.c: [Bug #3239768] tk8.4.19 (and later) WIN32
+ * win/tkWinMenu.c: [Bug #3239768]: tk8.4.19 (and later) WIN32
menu font support.
2011-03-16 Jan Nijtmans <nijtmans@users.sf.net>
@@ -375,6 +435,17 @@
Backported from TEA, but kept all original platform code which was
removed from TEA.
+2011-03-14 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkBind.c: Eliminate some more unneeded write-only
+ * generic/tkCanvUtil.c: variables (discovered by gcc-4.6)
+ * generic/tkFocus.c:
+
+2011-03-12 Donal K. Fellows <dkf@users.sf.net>
+
+ Remove casts from uses of ckalloc/ckfree/... now that Tcl declares
+ them to be using useful casts internally.
+
2011-03-12 Jan Nijtmans <nijtmans@users.sf.net>
* win/tkWin32Dll.c: Eliminate unneeded _TkFinalize wrapper.
@@ -391,33 +462,47 @@
test rather than one from libfreetype, because the latter doesn't
work when the linker is called with --as-needed.
-2011-01-25 Jan Nijtmans <nijtmans@users.sf.net>
+2011-03-03 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
+
+ * generic/tkCanvLine.c: [Bug 3175610]: Incomplete refresh of line items.
+
+2011-03-02 Donal K. Fellows <dkf@users.sf.net>
- * generic/tkSelect.c: [Patch #3129527]: Fix buffer overflow
- * win/tkWinWm.c: w/ GCC 4.5 and -D_FORTIFY_SOURCE=2. Just the
- * unix/tkUnixWm.c: strcpy->memcpy part, to prevent anything
- like [Bug #3164879]
+ * doc/tk_mac.n (new file): Description of OSX-specific functionality
+ in Tk, contributed by Kevin Walzer.
+ * doc/button.n, doc/font.n, doc/menu.n: Noted which parts of these
+ commands are intentionally not fully supported on OSX.
+
+2011-01-24 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tkSelect.c: Fix for [Bug #3164879]: (memory allocation
+ bug introduced by [Patch #3129527])
2011-01-22 Joe English <jenglish@users.sourceforge.net>
* generic/ttk/ttkEntry.c(ttk::combobox): Add missing
'validate' command (reported by schelte).
-2011-01-19 Jan Nijtmans <nijtmans@users.sf.net>
+2011-01-13 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/ttk/ttkGenStubs.tcl: Make sure to use CONST/VOID in stead of
- * generic/ttk/ttkDecls.h: const/void when appropriate. This allows to
- use const/void in the *.decls file always, genStubs will do the right
- thing.
+ * library/msgbox.tcl: [Patch #3154705]: Close button has no effect
-2011-01-17 Jan Nijtmans <nijtmans@users.sf.net>
+2011-01-12 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tcl.m4: handle --enable-64bit=ia64 for gcc. BACKPORT.
+ * win/tcl.m4: handle --enable-64bit=ia64 for gcc
+ * win/configure.in typo
* win/configure: (autoconf-2.59)
-2011-01-13 Jan Nijtmans <nijtmans@users.sf.net>
+2011-01-06 Kevin Walzer <wordtech@users.sourceforge.net>
- * library/msgbox.tcl: [Patch #3154705] Close button has no effect
+ * macosx/README: Added info on textured background windows.
+ * macosx/tkMacOSXFont.c: Fix for 2857300, improves rounding up on text
+ width [submitted by treectrl]
+ * macosx/tkMacOSXMenu.c: Fix for radiobuttons and checkbuttons not
+ displaying in popup menus, and disabled menu entries.
+ * macosx/tkMacOSXWindowEvent.c: Fix for 3086887, speeds up scrolling;
+ also textured background windows
+ * macosx/tkMacOSXWm.c: Textured background windows.
2011-01-06 Stuart Cassoff <stwo@users.sourceforge.net>
@@ -428,245 +513,490 @@
2010-12-17 Stuart Cassoff <stwo@users.sourceforge.net>
+ * unix/Makefile.in: Clean up '.PHONY:' targets: Arrange those
+ common to Tcl and Tk as in Tcl's Makefile.in,
+ add any missing ones and remove duplicates.
+
+2010-12-17 Stuart Cassoff <stwo@users.sourceforge.net>
+
* unix/Makefile.in: [Bug 2446711]: Remove 'allpatch' target.
2010-12-17 Stuart Cassoff <stwo@users.sourceforge.net>
- * unix/Makefile.in: Use 'rpmbuild', not 'rpm' [Bug 2537626].
+ * unix/Makefile.in: [Bug 2537626]: Use 'rpmbuild', not 'rpm'.
+
+2010-12-17 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkMain.c: refactor isatty() function for Windows.
+ * win/tkWinImage.c: better warning message.
+ * win/tkWinInit.c: Let TkpDisplayWarning() send the message
+ directly to the debugger, if available, otherwise do as before.
+
+2010-12-16 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tk.h: [Patch 3124554]: Move WishPanic from Tk to Tcl
+ * win/winMain.c: Remove special MessageBox'es here, since every
+ panic-related thing is now handled correctly by Tcl.
+
+2010-12-15 Stuart Cassoff <stwo@users.sourceforge.net>
+
+ * unix/Makefile.in: Installer Improvements.
+ * unix/install-sh: Similar to Tcl [Patch 3101127].
+
+2010-12-15 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkMain.c: [Patch #3124683]: platform specific stuff
+ in (tcl|tk)Main.c
2010-12-13 Jan Nijtmans <nijtmans@users.sf.net>
- * unix/tcl.m4: Cross-compile support for Win and UNIX (backported)
- * unix/configure: (autoconf-2.59)
- * win/tcl.m4:
- * win/configure.in:
- * win/configure: (autoconf-2.59)
- * win/tkWin32Dll.c: SEH-emulation for AMD64
- * win/tkWinX.c: mingw-w64 does not accept _WIN32_IE < 0x0501
+ * unix/tcl.m4: [Bug 3135271]: Link error due to hidden
+ * unix/configure: symbols (CentOS 4.2) (autoconf-2.59)
+ * generic/tkMain.c: Change "Application initialization failed" to
+ * tests/main.test: "application-specific initialization failed",
+ for consistency with Tcl.
+ * win/tkWin32Dll.c: See also: [Patch 1910041] and [Patch 3059922].
+ SEH emulation on Win64 was not correct here: it sometimes results in
+ a crash. Contrary to the other places, the code here is not meant to
+ protect from OS bugs, but to protect Finalizing Tk when the application
+ went in an invalid state.
2010-12-12 Stuart Cassoff <stwo@users.sourceforge.net>
* unix/tcl.m4: Better building on OpenBSD.
* unix/configure: (autoconf-2.59)
+2010-12-10 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tcl.m4: Fix manifest-generation for 64-bit gcc (mingw-w64)
+ * win/configure: (autoconf-2.59)
+
+2010-12-06 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkSelect.c: [Bug 3129527]: Fix buffer overflow w/ GCC 4.5
+ * generic/tkTextDisp.c: and -D_FORTIFY_SOURCE=2
+ * unix/tkUnixWm.c:
+ * win/tkWinWm.c:
+
+2010-12-05 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/tcl.m4: [Patch 3116490]: cross-compile support for unix
+ * unix/configure (autoconf-2.59)
+
+2010-12-03 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tcl.m4: [Patch 3116490]: cross-compile Tcl mingw32 on unix
+ * win/configure: This makes it possible to cross-compile Tcl/Tk for
+ Windows (either 32-bit or 64-bit) out-of-the-box on UNIX, using
+ mingw-w64 build tools.
+
+2010-12-02 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkInt.decls (TkDrawAngledTextLayout,TkDrawAngledChars,...):
+ Expose angled text API for Emiliano Gavilan. Still only in internal
+ stub table.
+
+2010-11-29 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkAtom.c: Fix various 64-bit gcc(-4.5.2) warnings: cast
+ * generic/tkSelect.c: from pointer to integer of different size.
+ * win/stubs.c:
+ * win/tkWinButton.c:
+ * win/tkWinColor.c:
+ * win/tkWinPixmap.c:
+ * win/tkWinScrlbr.c:
+ * win/tkWinWindow.c:
+ * win/tkWinWm.c:
+ * win/ttkWinMonitor.c:
+ * win/tkWin32Dll.c: Make assembler code compile in Win64 with gcc.
+
2010-11-24 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tkWinDialog.c: [Bug #3071836]: Crash/Tcl_Panic on WinXP saving
- * win/tkWinInit.c: file to C:\ re-wrote TkpDisplayWarning such
- that it does not use an Tcl API calls any more, so it works even with
- an ill-initialized Tcl.
- * win/winMain.c: Teach WishPanic how to thread UTF-8 in it's
- messagebox. Backports from Tcl 8.6. No change in functionality.
+ * win/tkWinDialog.c: [Bug 3071836]: Crash/Tcl_Panic on WinXP saving
+ * win/tkWinInit.c: file to C:\, and rewrite TkpDisplayWarning not
+ to use any Tcl functions any more. This allows TkpDisplayWarning to be
+ used as panic proc.
+ * win/winMain.c: Use TkpDisplayWarning as panic proc on Windows.
+ * generic/tkMain.c: Remove unused strrchr, combine outChannel and
+ errChannel variables to a single variable.
2010-11-19 Jan Nijtmans <nijtmans@users.sf.net>
- * win/configure.in: Allow cross-compilation by default. (backported)
- * win/tcl.m4: Use -pipe for gcc on win32 (backported)
- * win/configure: (regenerated)
+ * generic/tkCanv*.c: Revise Tcl_Panic() calls ending with a
+ * generic/tkGeomerty.c: newline removing the newline, because
+ * generic/tkImgPhInstance.c: Tcl_Panic() outputs a final newline
+ * generic/tkMenu.c: already.
+ * generic/tkRectOval.c:
+ * generic/tkTextBTree.c:
+ * generic/tkWindow.c:
+ * unix/tkUnixRFont.c:
+ * win/tkWinColor.c:
+ * win/tkWinDraw.c:
+ * win/tkWinMenu.c:
+
+2010-11-18 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/winMain.c: [FRQ 491789]: "setargv() doesn't support a unicode
+ cmdline" now implemented for cygwin and mingw32 too.
+ * win/configure.in: Allow cross-compilation by default.
+ * win/configure (regenerated)
+
+2010-11-17 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tcl.m4: [FRQ 491789]: "setargv() doesn't support a unicode
+ cmdline" now implemented for mingw-w64
+ * win/configure (regenerated)
+ * win/winMain.c Workaround for bug in some versions of mingw-w64
2010-11-16 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tkWinPort.h [Bug #3110161]: Extensions using TCHAR don't compile
+ * win/winMain.c Bring compilation under mingw-w64 a bit closer
+ * win/tcl.m4 to reality. See for what's missing:
+ https://sourceforge.net/apps/trac/mingw-w64/wiki/Unicode%20apps
+ * win/configure: (re-generated)
+ * win/tkWinPort.h: [Bug 3110161]: Extensions using TCHAR don't compile
on VS2005 SP1
-2010-11-04 Jan Nijtmans <nijtmans@users.sf.net>
+2010-11-10 Andreas Kupries <andreask@activestate.com>
+
+ * changes: Updates for 8.6b2 release.
- * library/msgs/de.msg: Updated German messages. Thanks to Ruediger
- Haertel. [Patch 2442309] [Bug 3102739].
+2010-11-06 Jan Nijtmans <nijtmans@users.sf.net>
-2010-10-23 Jan Nijtmans <nijtmans@users.sf.net>
+ * library/msgs/*.msg: Update NL catalog. For other languages,
+ sorting and fix some locations of "&".
- * win/rules.vc Update for VS10
+2010-11-05 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * library/demos/widget: Use unicode copyright sign, instead of
+ * library/demos/en.msg: depending on translation.
+ * library/demos/nl.msg:
+ * generic/tkMain.c: Sync TK_ASCII_MAIN usage with tclMain.c
+
+2010-11-04 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updates for 8.6b2 release.
+
+2010-11-03 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinClipboard.c: [FRQ 2965056]: Windows build with
+ * win/tkWinDialog.c: -DUNICODE
+ * win/tkWinMenu.c:
+
+2010-10-11 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkDecls.h: [FRQ 491789]: "setargv() doesn't support a
+ * doc/Tk_Main.3: unicode cmdline" implemented for Tk on MSVC++
+ * win/Makefile.in:
+ * win/makefile.vc:
+ * win/winMain.c:
+ * win/rules.vc: Update for VS10
2010-10-11 Joe English <jenglish@users.sourceforge.net>
- * generic/ttk/ttkTreeview.c: Fix crash in 'tag add' / 'tag remove'
- commands when no -tags specified [Bug 3085489].
+ * generic/ttk/ttkTreeview.c: [Bug 3085489]: Fix crash in 'tag add' /
+ 'tag remove' commands when no -tags specified.
+
+2010-10-11 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinMenu.c: [FRQ 2965056]: Windows build with -DUNICODE
+ * win/tkWinWm.c:
+ * win/tcl.m4: Add netapi32 to the link line, so we no longer
+ * win/makefile.vc: have to use LoadLibrary to access those
+ * win/configure: functions.
+
+2010-10-06 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinClipboard.c: [FRQ 2965056]: Windows build with
+ * win/tkWinColor.c: -DUNICODE
+ * win/tkWinCursor.c:
+ * win/tkWinFont.c:
+ * win/tkWinTest.c:
+ * win/tkWinMenu.c:
+ * win/tkWinPixmap.c:
+ * win/tkWinX.c: Eliminate isWinNT variable
+ * win/Makefile.in (genstubs): Generate ttk files as well.
2010-10-06 Donal K. Fellows <dkf@users.sf.net>
* win/Makefile.in (genstubs): [Tcl Bug 3082049]: Typo.
-2010-09-08 Joe English <jenglish@users.sourceforge.net>
+2010-10-05 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/ttk/ttkTreeview.c (TreeviewSeeCommand): [Bug 2829363]:
- Schedule redisplay if [$tv see] opens any items.
+ * generic/tkWinX.c: [Bug 3080953]: Malformed Unicode characters in %A
+ substitution Problem was in the static function GetTranslatedKey().
-2010-09-02 Joe English <jenglish@users.sourceforge.net>
+2010-10-01 Donal K. Fellows <dkf@users.sf.net>
- * library/ttk/winTheme.tcl, library/ttk/xpTheme.tcl,
- * library/ttk/vistaTheme.tcl: [Bug 3057573]: Specify disabled combobox
- text foreground color.
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock):
+ [Bug 3078902]: Ensure that zero-dimensioned data blocks cause no
+ changes at all instead of causing a hang.
+
+2010-09-29 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/tcl.m4: Sync with Tcl version
+ * unix/configure: Re-generate with autoconf-2.59
+ * win/configure:
+ * generic/tkMain.c Make compilable with -DUNICODE as well
+
+2010-09-28 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinSend.c: [Bug 3076671]: CVS HEAD Tk build fails on win32
+ with msys/mingw. Make it compile on older mingw as well.
+ * generic/tk.decls: Add explicit scspec "EXTERN", as in Tcl
+ * generic/tkInt.decls:
+ * generic/tkStubInit.c: Don't let Tk_MainEx macro disturb compilation
+
+2010-09-23 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tcl.m4: Add -Wdeclaration-after-statement
+ * win/configure: (regenerated)
+ * win/tkWinX.c: Make compilable with -DUNICODE.
+ * win/winMain.c:
+ * unix/tkAppInit.c: Many clean-ups in comments, so all
+ (tcl|tk)AppInit.c variants use the same style.
+ * generic/ttk/ttkGenStubs.tcl: Dummy genStubs::export (from
+ genStubs.tcl)
+
+2010-09-20 Jan Nijtmans <nijtmans@users.sf.net>
-2010-09-01 Don Porter <dgp@users.sourceforge.net>
+ * generic/ttk/ttkGenStubs.tcl: Clean-up, port all genStubs.tcl changes
+ * generic/ttk/ttk.decls: from Tcl to ttkGenStubs.tcl as well (no
+ * generic/tk.decls: change in any output files). This brings
+ * generic/tkInt.decls: all *.decls in the same form as tcl.decls
- *** 8.5.9 TAGGED FOR RELEASE ***
+2010-09-16 Jeff Hobbs <jeffh@ActiveState.com>
- * changes: Updated for 8.5.9 release.
+ * win/tkWinX.c (_WIN32_IE): update to IE5.5 base expectation
- * doc/menu.n: Formatting error.
+2010-09-14 Jan Nijtmans <nijtmans@users.sf.net>
-2010-09-01 Joe English <jenglish@users.sourceforge.net>
+ * win/rules.vc [FRQ 2965056]: Windows build with -DUNICODE
+ * win/Makefile.in
- * library/ttk/entry.tcl: Revert keyboard navigation bindings
- to use real events instead of virtual events.
+2010-09-13 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWin.h Move definitions of WINVER/_WIN32_WINNT
+ * win/tkWinDialog.h to one place, now that we only support
+ * win/tkWinMenu.c Win2000+
+ * win/tkWinX.c
+
+2010-09-10 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinEmbed.c: Make compilable with -DUNICODE
+ * win/tkWinClipboard.c: Mark those files as not compilable with
+ * win/tkWinColor.c: -DUNICODE, so add a TODO.
+ * win/tkWinCursor.c:
+ * win/tkWinDialog.c:
+ * win/tkWinFont.c:
+ * win/tkWinMenu.c:
+ * win/tkWinPixmap.c:
+ * win/tkWinTest.c:
+ * win/tkWinWm.c:
+ * win/tkWinX.c:
+ * win/winMain.c:
+ * win/tkWinPort.h: mingw/cygwin fixes: <tchar.h> should always
+ be included here.
+
+2010-09-09 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/rules.vc: (sync with tcl version)
+ * win/makefile.vc: mingw should always link with -ladvapi32
+ * win/tcl.m4:
+ * win/configure: (regenerated)
+ * win/tkWinInt.h: Remove ascii variant of tkWinPocs table,
+ * win/tkWinX.c: it is no longer necessary.
+ * win/tkWinTest.c:
+
+2010-09-08 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTreeview.c (TreeviewSeeCommand): [Bug 2829363]:
+ Schedule redisplay if [$tv see] opens any items.
+
+2010-09-05 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/bgerror.tcl: [Bugs 3046742,3046750]: Improve keybindings for
+ the background error dialog, and allow the use of the window manager
+ controls for closing it (where supported). The Escape key now causes
+ all remaining background error messages in the queue to be dropped.
+
+2010-09-02 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/winTheme.tcl, library/ttk/xpTheme.tcl,
+ * library/ttk/vistaTheme.tcl: [Bug 3057573]: Specify disabled combobox
+ text foreground color.
2010-08-31 Andreas Kupries <andreask@activestate.com>
- * win/tcl.m4: Applied patch by Jeff fixing issues with the
- manifest handling on Win64.
+ * win/tcl.m4: Applied patch by Jeff fixing issues with the manifest
+ handling on Win64.
* win/configure: Regenerated.
2010-08-26 Jeff Hobbs <jeffh@ActiveState.com>
- * generic/tkText.c (DumpLine): [Bug 3053347]:
- s/segPtr->size/currentSize/ throughout, but particularly in if
- lineChanged block where segPtr may no longer be valid.
-
- * unix/Makefile.in: add valgrind target
+ * unix/Makefile.in: Add valgrind target
* unix/configure, unix/tcl.m4: [Bug 1230554]: SHLIB_LD_LIBS='${LIBS}'
for OSF1-V*. Add /usr/lib64 to set of auto-search dirs.
(SC_PATH_X): Correct syntax error when xincludes not found.
* win/Makefile.in (VC_MANIFEST_EMBED_DLL VC_MANIFEST_EMBED_EXE):
- * win/configure, win/configure.in, win/tcl.m4: SC_EMBED_MANIFEST
- macro and --enable-embedded-manifest configure arg added to support
- manifest embedding where we know the magic. Help prevents DLL hell
- with MSVC8+.
-
-2010-08-25 Jeff Hobbs <jeffh@ActiveState.com>
-
- * doc/ttk_spinbox.n (new), doc/ttk_*.3, doc/ttk_*.n:
- * generic/ttk/ttkGenStubs.tcl:
- * generic/ttk/ttk.decls, generic/ttk/ttkDecls.h:
- * generic/ttk/ttkButton.c, generic/ttk/ttkCache.c:
- * generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c:
- * generic/ttk/ttkDefaultTheme.c, generic/ttk/ttkElements.c:
- * generic/ttk/ttkEntry.c, generic/ttk/ttkFrame.c:
- * generic/ttk/ttkImage.c, generic/ttk/ttkInit.c:
- * generic/ttk/ttkLabel.c, generic/ttk/ttkLayout.c:
- * generic/ttk/ttkNotebook.c, generic/ttk/ttkPanedwindow.c:
- * generic/ttk/ttkProgress.c, generic/ttk/ttkScale.c:
- * generic/ttk/ttkScroll.c, generic/ttk/ttkScrollbar.c:
- * generic/ttk/ttkSeparator.c, generic/ttk/ttkSquare.c:
- * generic/ttk/ttkState.c, generic/ttk/ttkStubInit.c:
- * generic/ttk/ttkStubLib.c, generic/ttk/ttkTagSet.c:
- * generic/ttk/ttkTheme.c, generic/ttk/ttkTheme.h:
- * generic/ttk/ttkThemeInt.h, generic/ttk/ttkTrace.c:
- * generic/ttk/ttkTrack.c, generic/ttk/ttkTreeview.c:
- * generic/ttk/ttkWidget.c, generic/ttk/ttkWidget.h:
- * library/ttk/spinbox.tcl (new):
- * library/ttk/altTheme.tcl, library/ttk/aquaTheme.tcl:
- * library/ttk/button.tcl, library/ttk/clamTheme.tcl:
- * library/ttk/classicTheme.tcl, library/ttk/combobox.tcl:
- * library/ttk/cursors.tcl, library/ttk/defaults.tcl:
- * library/ttk/entry.tcl, library/ttk/notebook.tcl:
- * library/ttk/panedwindow.tcl, library/ttk/scale.tcl:
- * library/ttk/sizegrip.tcl, library/ttk/treeview.tcl:
- * library/ttk/ttk.tcl, library/ttk/utils.tcl:
- * library/ttk/vistaTheme.tcl, library/ttk/winTheme.tcl:
- * library/ttk/xpTheme.tcl:
- * macosx/ttkMacOSXTheme.c: used 8.6/carbon variant
- * tests/ttk/combobox.test, tests/ttk/treetags.test:
- * tests/ttk/treeview.test, tests/ttk/ttk.test:
- * tests/ttk/vsapi.test:
- * tests/ttk/checkbutton.test (new):
- * tests/ttk/radiobutton.test (new):
- * tests/ttk/spinbox.test (new):
- * win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c:
- Major backport of 8.6 Ttk for 8.5.9. Most changes were only being
- committed to head (8.6), although they could apply for 8.5 as well.
- This re-sync makes future work easier to maintain and adds some
- useful work for 8.5 users. [Bug 3053320]: Notable changes:
- - Lots of code cleanup
- - Some bug fixes never backported
- - Addition of ttk::spinbox
- - minor color changes
- - Improved Vista/7 styling
- - Move to tile version 0.8.6 (pseudo-package)
- - ABI and API compatible (even $w identify)
- - minor new features (extended $w identify)
-
-2010-08-03 Don Porter <dgp@users.sourceforge.net>
-
- * changes: Updated for 8.5.9 release.
-
-2010-08-20 Donal K. Fellows <dkf@users.sf.net>
-
- * doc/listbox.n (SEE ALSO): [Bug 3048809]: Corrected what other page
- was referred to (ttk::treeview can work as a listbox).
-
-2010-08-12 Donal K. Fellows <dkf@users.sf.net>
-
- * library/text.tcl (TextCursorInSelection): [Patch 2585265]: Backport
- of factoring-out of decision logic for whether to delete the selected
- text.
+ * win/configure, win/configure.in, win/tcl.m4: SC_EMBED_MANIFEST macro
+ and --enable-embedded-manifest configure arg added to support manifest
+ embedding where we know the magic. Help prevents DLL hell with MSVC8+.
+
+ * generic/tkText.c (DumpLine): [Bug 3053347]: Replace segPtr->size
+ with currentSize throughout, but particularly in if lineChanged block
+ where segPtr may no longer be valid.
+
+2010-08-21 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tk*Decls.h: (regenerated with modified genStubs.tcl)
+ * generic/tk*StubInit.c
+
+2010-08-18 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/ttk/ttkGenStubs.tcl: [Patch 3034251]: partly: remove some
+ more unneeded ifdeffery, as in tcl/tools/genStubs.tcl.
+ * generic/tk.h: Move USE_OLD_IMAGE support after tkDecls.h
+ * generic/*Decls.h (regenerated)
+ * generic/ttk/ttkDecls.h
2010-08-11 Jeff Hobbs <jeffh@ActiveState.com>
- * win/Makefile.in (%.${OBJEXT}): better implicit rules support
+ * win/Makefile.in (%.${OBJEXT}): Better implicit rules support
* unix/configure: regen with ac-2.59
* unix/configure.in, unix/Makefile.in:
- * unix/tcl.m4 (AIX): remove the need for ldAIX, replace with
+ * unix/tcl.m4 (AIX): Remove the need for ldAIX, replace with
-bexpall/-brtl. Remove TK_EXP_FILE (export file) and other baggage
that went with it. Remove pre-4 AIX build support.
-2010-08-11 Donal K. Fellows <dkf@users.sf.net>
-
- * generic/tkCanvLine.c (LineDeleteCoords): [Bug 2900121]: Backport of
- fix to sense of test.
-
-2010-08-10 Don Porter <dgp@users.sourceforge.net>
+2010-08-11 Don Porter <dgp@users.sourceforge.net>
- * library/msgs/pl.msg: Backport updates to pl.msg from HEAD
+ * changes: Updates for 8.6b2 release.
2010-08-04 Jeff Hobbs <jeffh@ActiveState.com>
- * license.terms: Fix DFARs note for number-adjusted rights clause
-
-2010-08-04 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tk.h: Bump to 8.5.9 for release.
- * library/tk.tcl:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in:
- * README:
-
- * unix/configure: autoconf-2.59
- * win/configure:
-
- * changes: Updated for 8.5.9 release.
+ * license.terms: fix DFARs note for number-adjusted rights clause
2010-08-03 Jeff Hobbs <jeffh@ActiveState.com>
* library/button.tcl (::tk::CheckEnter): [AS Bug#87409]: Use uplevel
set instead of set :: to work with other var resolvers (itcl).
-2010-08-03 Don Porter <dgp@users.sourceforge.net>
+2010-07-19 Donal K. Fellows <dkf@users.sf.net>
- * changes: Updated for 8.5.9 release.
+ * generic/tkImgGIF.c (StringWriteGIF): Added ability to write a GIF to
+ a string (as a byte array, of course) following comments on c.l.t by
+ Aric Bills. Also improved readability of some of the function and
+ field names in this file.
+
+2010-07-16 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkDecls.h: [Tcl Bug 3029891]: Functions that don't belong in
+ the stub table (Tk part, not really removed from the stub table, just
+ disabled)
+ * generic/tkMain.c: [Bug 3027438]: Tk_Main calls Tcl_CreateInterp
+ * generic/tk.h: before Tcl_FindExecutable
2010-07-06 Andreas Kupries <andreask@activestate.com>
* doc/text.n: Fixed minor typo in the description of 'text delete', as
reported by <eee@users.sf.net> on the chat.
-2010-05-31 Joe English <jenglish@users.sourceforge.net>
+2010-07-01 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/rules.vc: [Bug 3020677]: wish can't link reg1.2
+
+2010-06-22 Anton Kovalenko <a_kovalenko@users.sf.net>
+
+ * generic/tkPlace.c: [Patch 3019624]: modify "place" command, making
+ it get main window through ClientData (like grid or pack do), instead
+ of calling Tk_MainWindow(interp).
+ * generic/tkWindow.c: modify "place" entry in commands[], turn on
+ passMainWindow flag.
+
+2010-06-22 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/ttk/ttkGenStubs.tcl: [Bug 3019363]: "make genstubs" failure
+ * generic/ttk/ttkDecls.h: (regenerated)
+ * generic/ttk/ttkTheme.c: Unnecessary type cast
+
+2010-06-21 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkInt.decls: [Patch 2999889]: TkCopyAndGlobalEval obsolete
+ * generic/tkIntDecls.h
+ * generic/tkBind.c
+ * generic/tkStubInit.c
+
+2010-06-19 Joe English <jenglish@users.sourceforge.net>
+
+ * win/tkWinScrlbr.c, carbon/tkMacOSXScrlbr.c: Replace binding
+ procedures with ordinary event handlers [Patch 3009998].
+ * generic/tkBind.c, generic/tk.h, generic/tkInt.h,
+ * generic/tkInt.decls: Simplifications enabled by previous change:
+ TkCreateBindingProcedure() and associated machinery no longer needed;
+ TkBindDeadWindow() no longer needed; TK_DEFER_MODAL_LOOP and
+ associated machinery no longer needed.
+ * generic/tkTest.c, tests/bind.test: Tests related to C binding
+ procedures no longer needed.
+ * generic/tkWindow.c: TkBindDeadWindow() no longer needed.
+ * generic/tkIntDecls.h, generic/tkStubInit.c: Regenerated.
+
+2010-06-15 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/ttk.tcl: Bump dummy [package ifneeded tile] version to
+ 0.8.6; see [Bug 3016598].
+
+2010-06-15 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/text.tcl (TextCursorInSelection): [Patch 2585265]: Make it
+ so that pressing delete or backspace when the primary selection does
+ not include the insertion cursor does not cause the deletion of the
+ inserted text.
+
+2010-06-15 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkCanvArc.c: Eliminate many unnecessary (ClientData) type
+ * generic/tkCanvas.c: casts.
+ * generic/tkCanvBmap.c:
+ * generic/tkCanvImg.c:
+ * generic/tkCanvLine.c:
+ * generic/tkCanvPoly.c:
+ * generic/tkCanvTest.c:
+ * generic/tkCanvWind.c:
+ * generic/tkRectOval.c:
+ * generic/tkScrollbar.c:
+ * generic/tkStyle.c:
+ * generic/tkTest.c:
+ * unix/tkUnixEmbed.c:
+ * unix/tkUnixEvent.c:
+ * unix/tkUnixScale.c:
+ * unix/tkUnixScrlbr.c:
+ * unix/tkUnixSelect.c:
+ * unix/tkUnixWm.c:
+ * carbon/tkMacOSXDialog.c: Terminate TkEnsemble definition with NULL
+ * macosx/tkMacOSXDialog.c:
+
+2010-05-31 Joe English <jenglish@users.sourceforge.net>
* generic/tkBind.c (Tk_CreateBinding): [Bug 3006842]: Silently ignore
- empty binding scripts.
- * generic/ttk/ttkTreeview.c: [$tv tag bind $tag <...> {}] now removes
- binding.
+ empty scripts.
+
+2010-05-27 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTreeview.c, tests/ttk/treeview.test:
+ [$tv tag bind $tag <...> {}] now removes binding completely.
+ Fixes [Bug 3006842] (although there's still a problem somewhere
+ in Tk_CreateBinding()).
-2010-05-31 Jan Nijtmans <nijtmans@users.sf.net>
+2010-05-26 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkMain.c: Fix CYGWIN warning: "fd_set and assiciated.macros
- have been defined in sys/types. This may cause runtime problems with
- W32"
- * win/winMain.c: Add command line processing for CYGWIN, backported
- from trunk.
+ * tests/wm.test: Fix 3 tests on Ubuntu 10.4, two of them timing
+ dependent, one wm-dependent.
+ * generic/tkText.c: Fix some gcc strict-aliasing warnings,
+ * unix/tkUnixFont.c: discovered with "-Wstrict-aliasing=2"
+ * unix/tkUnixSelect.c:
2010-05-20 Donal K. Fellows <dkf@users.sf.net>
@@ -674,15 +1004,54 @@
places that generate key events zero them out first; Tk relies on that
being true for the generic parts of the fix for Bug 1924761.
-2010-05-19 Jan Nijtmans <nijtmans@users.sf.net>
+2010-05-17 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinDialog.c: Fix [Bug 3002230]: tk_chooseDirectory returns
+ garbage on cancel
- * win/tkWinDialog.c: [Bug 3002230]: tk_chooseDirectory returns garbage
- on cancel.
+2010-05-17 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tkBind.c: Revert [Patch 2999920], as it entails an
+ incompatible change to the C API is and is the cause of [Bug 3002768].
2010-05-17 Jan Nijtmans <nijtmans@users.sf.net>
+ * generic/tkBind.c: [Patch 2999920]: Optimize Internal Virtual event
+ string operations.
* win/tkWinDialog.c: [Bug 2987995]: Tk_getOpenFile returns garbage
- under described circumstances. Backported some formatting from trunk.
+ under described circumstances
+
+2010-05-11 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * doc/RestrictEv.3: Consistent use of variable names in RestrictEvent
+ * generic/tkGrab.c: API documentation and implementation: Use 'prev'
+ * unix/tkUnixDraw.c: instead of 'old', and 'arg' instead of
+ * unix/tkUnixSend.c: 'clientData' everywhere, just as in tkEvent.c.
+ * unix/tkUnixWm.c
+
+2010-05-10 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * doc/BindTable.3: Bring in line with actual implementation.
+ * generic/tk.decls: Change Tk_CreateBinding param name, as in doc
+ * generic/tkInt.decls: CONSTify TkCopyAndGlobalEval,
+ * generic/tkBind.c: TkpSetMainMenubar, TkpMenuNotifyToplevelCreate,
+ * generic/tkMenu.c: and TkSetWindowMenuBar
+ * generic/tkDecls.h: (regenerated)
+ * generic/tkIntDecls.h: (regenerated)
+ * carbon/tkMacOSXMenu.c:
+ * macosx/tkMacOSXMenu.c:
+ * unix/tkUnixMenu.c:
+ * win/tkWinMenu.c:
+
+2010-05-03 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk.h: Bump patchlevel to 8.6b1.2 to distinguish
+ * library/tk.tcl: CVS snapshots from earlier snapshots as well
+ * unix/configure.in: as the 8.6b1 and 8.6b2 releases.
+ * win/configure.in:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
2010-05-03 Donal K. Fellows <dkf@users.sf.net>
@@ -690,49 +1059,214 @@
Apply a bit more care to ensure that things continue to work correctly
even when there is no -selectcolor defined.
+2010-04-29 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWin.h: Unnecessary TCL_STORAGE_CLASS re-definition
+ * win/tkWinInt.h: Make various functions MODULE_SCOPE
+ * win/tkWinButton.c: TCHAR-related fixes, making al those
+ * win/tkWinFont.c: files compile fine when TCHAR != char.
+ * win/tkWinScrlbr.c:
+ * win/tkWinWindow.c:
+ * win/tkWinWm.c:
+ * win/tkWinX.c:
+ * win/ttkWinMonitor.c:
+ * win/ttkWinXPTheme.c:
+
+2010-04-25 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkImgPNG.c (ReadIDAT, DecodePNG): Move the check for overall
+ termination of the compressed stream until after the final IDAT has
+ been read, so that multi-segment images will work right. Reported by
+ Andy Goth on the Wiki.
+
+2010-04-23 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkImgGIF.c: Formatting
+ * generic/tkListbox.c: fix typo;
+ * generic/tkTrig.c: fix typo;
+ * generic/tkInt.h: fix typo; remove not existing tkDisplayList;
+ * generic/*.h: Useless re-definitions of TCL_STORAGE_CLASS
+
+2010-04-20 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkPort.h: Make sure that tkWinPort.h is always
+ * generic/tkIntXlibDecls.h: included before tcl.h, otherwise the
+ * win/tkWinPort.h: fallback for TCHAR might go off before the
+ inclusion of <tchar.h>
+ * win/tkWinDialog.c: Define OPENFILENAME_SIZE_VERSION_400 if
+ needed.
+ * compat/stdlib.h: Include <tcl.h> only when not already
+ * compat/unistd.h: done.
+ * generic/tkInt.h: tkPort.h already includes tk.h, which
+ includes tcl.h.
+ * generic/tk3d.h: Always use #include "tkInt.h", not
+ * generic/tkColor.h: <tkInt.h>
+ * xlib/xcolors.c:
+ * xlib/xgc.c:
+
2010-04-19 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tkWinPort.h: Fix [Patch 2986105]: conditionally defining
- strcasecmp/strncasecmp
* win/tkWinDialog.c: Fix [Bug 2987995]: Tk_GetOpenFile returns garbage
- under described circumstances, minor formatting.
+ under described circumstances.
* win/tkWinDialog.c: [Patch 2898255]: Filenames limit with
Tk_GetFileName().
Assure modern style dialogs where available
+2010-04-13 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinPort.h Fix [Patch 2986105]: conditionally defining
+ strcasecmp/strncasecmp
+
+2010-04-12 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkImgPNG.c (WriteIDAT): [Bug 2984787]: Use the correct
+ flushing semantics when handling the last data from the image. Without
+ this, many PNG readers (notably including Firefox) refuse to show the
+ image and instead complain about errors.
+ (ReadIDAT): Added sanity checks to ensure that when we've got bad data
+ of the sorts of forms we were previously generating, we detect it and
+ error out rather than silently failing.
+ (WriteExtraChunks): New function to write in some basic metadata.
+
+2010-04-09 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * doc/photo.n: Follow-up to [Bug 2983824]: update doc.
+
+2010-04-09 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkImgPhoto.c (ImgPhotoCmd): [Bug 2983824]: Use the file
+ extension to guess the output format to use if one isn't specified.
+
+2010-04-08 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinPort.h: Add <wchar.h> to tkWinPort.h, and
+ * win/tkWinSend.c: remove some earlier CYGWIN-related
+ * win/tkWinSendCom.c: hacks which are no longer necessary.
+
+2010-04-06 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tcl.m4: Sync with Tcl version
+ * unix/tcl.m4:
+ * win/configure: (regenerate with autoconf-2.59)
+ * unix/configure: [Bug 2982540]: configure and install* script
+ files should always have LF
+
+2010-03-29 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/tcl.m4: Only test for -visibility=hidden with gcc
+ (Second remark in [Bug 2976508])
+ * unix/configure: regen
+
+2010-03-29 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tkUnixRFont.c (GetFont): [Bug 2978410]: Do not use non-constant
+ initializers for structures, since HP-UX cc doesn't like it.
+
+2010-03-28 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTagSet.c, generic/ttk/ttkTheme.c,
+ * generic/ttk/ttkTheme.h, generic/ttk/ttkTreeview.c,
+ * generic/ttk/ttkWidget.h, doc/ttk_treeview.n,
+ * tests/ttk/treetags.test: ttk::treeview widget: add 'tag names',
+ 'tag add', and 'tag remove' methods.
+
+2010-03-23 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/configure.in, unix/Makefile.in: [Bug 2965133]: Get rid of the
+ spurious NONE and some pointless quotes that were causing problems
+ with building Tk on OSX. Overall bug might not yet be solved.
+
+2010-03-17 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/entry.tcl: [Bug 2971663]: Make the <Up> and <Down> keys
+ * library/ttk/entry.tcl: explicitly do nothing, since Tk-on-Cocoa will
+ generate (invisible zero-width) characters for them otherwise. The
+ explicitly empty bindings are harmless on other platforms.
+
+2010-03-16 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/.cvsignore: Ignore .a and .so
+
2010-03-12 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkButton.h: [Bug 2956548]: TkpButtonSetDefaults only
- * generic/tkButton.c: initializes one button type
- * win/tkWinButton.c:
- * win/tkWinEmbed.c: Fix various gcc warnings, all
- * win/tkWinMenu.c: backported from Tk 8.6
- * win/tkWinPixmap.c:
- * win/tkWinSend.c:
- * win/tkWinTest.c:
- * win/tkWinWm.c:
- * win/tkWinX.c:
- * win/tkWinInt.h: VC6++ does not have SPI_SETKEYBOARDCUES
+ * win/rules.vc: Fix [Tcl Bug 2967340]: Static build failure
+ * win/makefile.vc:
* win/.cvsignore:
+2010-03-12 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/iconlist.tcl: Factor out some of the machinery for
+ * library/megawidget.tcl: making a megawidget framework. Not a
+ public API at the moment.
+
2010-03-11 Donal K. Fellows <dkf@users.sf.net>
* generic/tkText.c (DumpLine): [Bug 2968379]: When peers are about,
there can be unnamed marks present during a dump. Ignore them as they
will just be for the peers' insert and current marks, which aren't
very important.
+ (DumpLine): Removed lame reliance on the leading letters of the names
+ of segment types. Entailed expanding the scope of the declarations of
+ the types of embedded images and windows.
+
+2010-03-08 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkPlatDecls.h: [Bug 2965600]: Correct broken 2886635 fix.
+
+2010-03-06 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/menu.tcl: [Bug 2949774]: When using the non-ClickToFocus
+ menu mode cascade menus should popdown once the pointer moves to
+ another entry to be compatible with current X desktop usage.
+
+2010-03-04 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/configure.in: Don't use -fvisibility=hidden
+ * unix/tcl.m4: for cygwin.
+ * win/tkWinTest.c: Make tkTestWinProcs const
2010-03-04 Donal K. Fellows <dkf@users.sf.net>
* doc/clipboard.n: Added note about STRING vs. UTF8_STRING types.
+2010-03-02 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/tcl.m4: [Tcl FRQ 2959069]: Support for -fvisibility=hidden
+ * unix/configure: (regenerated with autoconf-2.59)
+
+2010-02-23 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/configure.in: Use @EXEEXT@ in stead of @EXT_SUFFIX@
+ * unix/tcl.m4:
+ * unix/Makefile.in: Use -DBUILD_tk
+ * unix/configure: (regenerated)
+ * generic/tkConfig.c: Make internal Tk_ObjCustomOption const
+ * generic/tkPanedWindow.c:
+ * generic/tkTest.c:
+ * generic/tkText.c:
+
2010-02-21 Donal K. Fellows <dkf@users.sf.net>
* generic/tkText.c (TextEditCmd): [Bug 1799782]: Refix this, so that
- <<Modified>> events are issued when things change.
+ <<Modified>> events are issued when things change.
+
+2010-02-20 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTreeview.c: Cache the result of the last call to
+ EndPosition() to avoid quadratic-time behavior in the common cases
+ where the treeview is populated in depth-first or breadth-first
+ order.
+
+2010-02-19 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinColor.c: remove unused "dataKey" variable
2010-02-19 Donal K. Fellows <dkf@users.sf.net>
+ * unix/configure.in, unix/Makefile.in: [Bug 2415437]: Corrections to
+ allow installation of Tcl and Tk to different directories, especially
+ when neither is a system standard location. Also [Tcl Bug 2307398].
+
* unix/installManPage: [Tcl Bug 2954638]: Correct behaviour of manual
page installer. Also added armouring to check that assumptions about
the initial state are actually valid (e.g., look for existing input
@@ -744,32 +1278,176 @@
OpenBSD.
* configure: (regenerated).
+2010-02-18 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkButton.h: Put all Tk_OptionSpec for buttons and labels
+ * generic/tkButton.c: in const memory. With some changes to win32
+ * win/tkWinButton.c: and macosx, preventing direct writes to
+ * unix/tkUnixPort.h: read-only memory.
+ * carbon/tkMacOSXPort.h:
+ * macosx/tkMacOSXButton.c:
+
2010-02-17 Joe English <jenglish@users.sourceforge.net>
* generic/tkMenu.c: [Bug 2952745]: Defer TkMenuOptionTables cleanup to
CallWhenDeleted() time, to ensure that the record doesn't get freed
until after all widget instance commands have been deleted.
+2010-02-17 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tk.decls: CONSTify everything related to Tk_ConfigSpec
+ * generic/tk.h:
+ * generic/tkCanvArc.c: Many tables can now be put in const memory
+ * generic/tkCanvas.c:
+ * generic/tkCanvBmap.c:
+ * generic/tkCanvImg.c:
+ * generic/tkCanvLine.c:
+ * generic/tkCanvPoly.c:
+ * generic/tkCanvPs.c:
+ * generic/tkCanvText.c:
+ * generic/tkCanvWind.c:
+ * generic/tkImgBmap.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkOldConfig.c:
+ * generic/tkRectOval.c:
+ * generic/tkScrollbar.c:
+ * generic/tkScrollbar.h:
+ * generic/tkDecls.h: (regenerated)
+ * doc/CanvTkwin.3:
+ * doc/ConfigWidg.3:
+ * doc/CrtItemType.3:
+ * win/tkWinScrlbr.c:
+ * carbon/tkMacOSXScrlbr.c:
+ * macosx/tkMacOSXScrlbr.c:
+
2010-02-16 Jan Nijtmans <nijtmans@users.sf.net>
- * unix/tkUnixWm.c: Make TkSetTransientFor static
+ * generic/tkWindow.c: Reverted rename from tkStubs to tkConstStubs
+ * generic/tkStubInit.c: (regenerated)
+ * generic/tkArgv.c: make defaultTable const
+ * generic/tkScrollbar.c:Store default for "-with" in static non-const
+ space
+ * win/tkWinInt.h: Make tkWinProcs const, and 5 procs
+ * win/tkWinX.c: MODULE_SCOPE.
+ * win/tkWinColor.c: Make sysColors const.
+ * win/tkWinKey.c: Make keymap const.
+ * win/tkWinScrlbr.c: Simplify copying of "-with" default value.
+ * unix/tkUnixWm.c: Make TkSetTransientFor static.
+ * tests/textImage.test: textImage-1.13 depends on hash-order
+
+2010-02-12 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tcl.m4: Use -pipe for gcc on win32
+ * win/configure: (mingw/cygwin) (regenerated)
+ * unix/tkUnixColor.c: Make sure that TkpCmapStressed is exported
+ * generic/tkImgPhoto.c: Clean up unused Tk_CreatePhotoOption
+ * generic/tkBind.c: Make more internal arrays "const"
+ * generic/tkBusy.c:
+ * generic/tkButton.c:
+ * generic/tkEvent.c:
+ * generic/tkGrab.c:
+ * generic/tkImgBmap.c:
+ * generic/tkObj.c:
+ * generic/tkOption.c:
+ * generic/tkPanedWindow.c:
+ * generic/tkPointer.c:
+ * generic/tkWindow.c:
+ * generic/tkImgPhoto.c: Eliminate never used Tk_CreatePhotoOption()
-2010-02-07 Jan Nijtmans <nijtmans@users.sf.net>
+2010-02-05 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/ttk/ttkGenStubs.tcl: Backport various formatting (spacing)
- * generic/ttk/ttk.decls: changes from HEAD, so diffing
- * generic/ttk/ttkDecls.h: between 8.5.x and 8.6 shows the
- * generic/tk*.decls: real structural differences again.
- * generic/tk*Decls.h: (any signature change not backported!)
+ * carbon/tkMacOSXDialog.c: Make more internal tables "const"
+ * macosx/tkMacOSXDialog.c:
+ * unix/tkUnixButton.c:
+ * unix/tkUnixWm.c:
+ * win/tkWinDialog.c:
+ * generic/tkWindow.c:
+ * generic/tk*Decls.h: (regenerated with new
+ * generic/tkStubInit.c: genStubs.tcl from Tcl)
+
+2010-02-05 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/*.[ch]: Revert contravariant const qualifiers added by
+ the previous commit to keep codebase in sync with the Tile extension,
+ which must remain 8.4 compatible.
+
+2010-02-05 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/ttk/ttkGenStubs.tcl: Follow-up to [2010-01-29] commit:
+ prevent space within stub table function parameters if the
+ parameter type is a pointer. Make the various stub tables and
+ hook pointers const, just as Tcl and Tk.
+ * generic/ttk/ttkDecls.h: (regenerated)
+ * generic/ttk/ttkStubInit.c: (regenerated)
+ * generic/ttk/ttk.decls: Minor formatting
+ * generic/ttk/ttkButton.c: Make more internal tables "const"
+ * generic/ttk/ttkDefaultTheme.c:
+ * generic/ttk/ttkEntry.c:
+ * generic/ttk/ttkImage.c:
+ * generic/ttk/ttkInit.c:
+ * generic/ttk/ttkLayout.c:
+ * generic/ttk/ttkNotebook.c:
+ * generic/ttk/ttkPanedWindow.c:
+ * generic/ttk/ttkProgress.c:
+ * generic/ttk/ttkStubLib.c:
+ * generic/ttk/ttkTheme.c:
+ * generic/ttk/ttkTreeview.c:
+ * generic/ttk/ttkWidget.c:
+ * generic/ttk/ttkWidget.h:
+
+2010-01-31 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTheme.h, generic/ttk/ttkWidget.h, generic/ttk/*.c:
+ Change signature of widget subcommand procedures to match
+ Tcl_ObjCmdProc. Merge now-redundant ensemble dispatch code.
2010-01-29 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkBind.c: Fix various gcc-4.4 warnings, all
- * generic/tkListbox.c: backported from HEAD.
- * generic/tkText.c:
+ * generic/ttk/ttkGenStubs.tcl: No longer generate a space after "*"
+ and immediately after a function name, so the
+ format of function definitions in *Decls.h
+ match all other *.h header files.
+ * generic/ttk/ttkDecls.h: (re-generated)
+ * generic/tk.decls: Formatting
+ * generic/tkDecls.h: (re-generated)
+ * generic/tkIntDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkIntXlibDecls.h:
+ * generic/tkPlatDecls.h:
+ * generic/tkBind.c: Little simplification
+
+2010-01-19 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkInt.h: Don't depend on <stdio.h> from tcl.h any
+ * generic/tkOldConfig.c: more.
+ * generic/ttk/ttkClamTheme.c: Fix more gcc warnings: missing
+ * generic/ttk/ttkClassicTheme.c: initializer.
+ * generic/ttk/ttkDefaultTheme.c:
+ * generic/ttk/ttkElements.c:
+ * generic/ttk/ttkEntry.c:
* generic/ttk/ttkInit.c:
+ * generic/ttk/ttkLabel.c:
+ * generic/ttk/ttkNotebook.c:
+ * generic/ttk/ttkPanedwindow.c:
+ * generic/ttk/ttkSquare.c:
+ * generic/ttk/ttkTreeview.c:
+ * win/ttkWinTheme.c:
+ * win/tkWinMenu.c: Add missing #include <string.h>
+ * win/tkWinPort.h: Fix include files for CYGWIN
+ * win/tkWinSend.c:
+ * win/tkWinSendCom.c:
+ * win/tkWinTest.c: Fix gcc warning
+ * win/winMain.c: Eliminate use of __argc and __argv for CYGWIN
+ * win/tcl.m4: Make cygwin configuration error into
+ * win/configure.in: a warning: CYGWIN compilation works
+ * win/configure: although there still are test failures.
+
+2010-01-19 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkCanvas.c (TagSearchScanExpr): [Bug 2931374]: Stop overflow
+ of working buffer during construction of long tag expressions.
-2010-01-20 Pat Thoyts <patthoyts@users.sourceforge.net>
+2010-01-19 Pat Thoyts <patthoyts@users.sourceforge.net>
* library/bgerror.tcl: [TIP 359]: Extended Window Manager Hints
* library/clrpick.tcl: following the freedesktop.org specification
@@ -782,15 +1460,85 @@
* tests/wm.test:
* unix/tkUnixWm.c:
-2010-01-19 Donal K. Fellows <dkf@users.sf.net>
+2010-01-18 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkCanvas.c (TagSearchScanExpr): [Bug 2931374]: Stop overflow
- of working buffer during construction of long tag expressions.
+ * generic/tkCanvArc.c: Fix more gcc warnings: missing initializer
+ * generic/tkCanvBmap.c:
+ * generic/tkCanvImg.c:
+ * generic/tkCanvLine.c:
+ * generic/tkCanvPoly.c:
+ * generic/tkCanvPs.c:
+ * generic/tkCanvText.c:
+ * generic/tkCanvWind.c:
+ * generic/tkCmds.c:
+ * generic/tkImgBmap.c:
+ * generic/tkImgGIF.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkImgPNG.c:
+ * generic/tkImgPPM.c:
+ * generic/tkMenu.c:
+ * generic/tkMenubutton.c:
+ * generic/tkMessage.c:
+ * generic/tkOldTest.c:
+ * generic/tkPanedWindow.c:
+ * generic/tkRectOval.c:
+ * generic/tkScrollbar.c:
+ * generic/tkSquare.c:
+ * generic/tkTest.c:
+ * generic/tkText.c:
+ * generic/tkTextImage.c:
+ * generic/tkTextTag.c:
+ * generic/tkTextWind.c:
+ * generic/tkTrig.c:
+ * generic/tkCanvas.c: [Patch 2932808]: Canvas items not updating
+ on widget state change.
+
+2010-01-13 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkMenubutton.h: Eliminate tkpMenubuttonClass
+ * generic/tkButton.h make tkpButtonProcs CONST
+ * generic/tkBusy.c: fix gcc warning: missing initializer
+ * generic/tkButton.c
+ * generic/tkCanvas.c
+ * generic/tkConsole.c
+ * generic/tkEntry.c
+ * generic/tkFrame.c
+ * generic/tkListbox.c
+ * generic/tkMenu.c
+ * generic/tkMenubutton.c
+ * generic/tkMessage.c
+ * generic/tkScale.c
+ * generic/tkScrollbar.h
+ * generic/tkText.c
+ * generic/ttk/ttkWidget.c
+ * carbon/tkMacOSXButton.c
+ * carbon/tkMacOSXMenubutton.c
+ * carbon/tkMacOSXScrlbr.c
+ * macosx/tkMacOSXButton.c
+ * macosx/tkMacOSXMenubutton.c
+ * macosx/tkMacOSXScrlbr.c
+ * unix/tkUnixButton.c
+ * unix/tkUnixMenubu.c
+ * unix/tkUnixScrolbr.c
+ * win/tkWinButton.c
+ * win/tkWinDialog.c
+ * win/tkWinEmbed.c
+ * win/tkWinFont.c
+ * win/tkWinInit.c
+ * win/tkWinKey.c
+ * win/tkWinScrlbr.c
+ * win/tkWinInt.h Add SPI_SETKEYBOARDCUES definition, needed for
+ original VC++ 6.0.
-2010-01-18 Jan Nijtmans <nijtmans@users.sf.net>
+2010-01-10 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkCanvas.c: [Patch 2932808]: Canvas items not
- updating on widget state change.
+ * doc/SetClassProcs.3: CONSTify Tk_SetClassProcs
+ * generic/tk.decls
+ * generic/tkInt.h
+ * generic/tkWindow.c
+ * generic/tkDecls.h: (regenerated)
+ * unix/tcl.m4 Sync with Tcl version
+ * unix/configure (regenerated)
2010-01-09 Pat Thoyts <patthoyts@users.sourceforge.net>
@@ -798,8 +1546,8 @@
* library/obsolete.tcl: the .help menu on X11.
* unix/tkUnixMenu.c:
- * library/menu.tcl: [TIP 360]: Make Tk menu activation
- * library/obsolete.tcl: follow mouse movements.
+ * library/menu.tcl: [TIP 360]: Make Tk menu activation
+ * library/obsolete.tcl: follow mouse movements.
2010-01-08 Pat Thoyts <patthoyts@users.sourceforge.net>
@@ -813,26 +1561,32 @@
odd text widget update problem that had scrollbars being unable to
cover the whole widget. Fix is to reify the range to update sooner.
-2010-01-06 Jan Nijtmans <nijtmans@users.sf.net>
-
- * unix/tcl.m4: Sync with Tcl version
- * unix/configure: (regenerated)
- * unix/Makefile.in:
- * unix/.cvsignore:
- * generic/default.h: Trivial CYGWIN fixes
- * generic/tkWindow.c:
- * doc/.cvsignore:
-
2010-01-06 Donal K. Fellows <dkf@users.sf.net>
+ * library/tk.tcl: Centralize the definition of keys that
+ * library/entry.tcl: do common movement in entry and text
+ * library/spinbox.tcl: widgets. This is because they are
+ * library/text.tcl: subtlely different on the different
+ * library/ttk/entry.tcl: platforms. Lets Tk code work more
+ * doc/event.n (PREDEFINED VIRTUAL EVENTS): correctly with platform
+ conventions "out of the box".
+
+ * generic/tkBind.c (HandleEventGenerate, DoWarp): [Bug 2926819]:
+ * generic/tkInt.h (TkDisplay): Factor out the pointer
+ * generic/tkWindow.c (GetScreen): warping code a bit
+ * carbon/tkMacOSXMouseEvent.c (TkpWarpPointer): better and extend it
+ * macosx/tkMacOSXMouseEvent.c (TkpWarpPointer): to work on OSX too.
+ * unix/tkUnixEvent.c (TkpWarpPointer):
+ * win/tkWinPointer.c (TkpWarpPointer):
+
* unix/tkUnixWm.c (TkWmMapWindow): [Bug 1163496]: Allow windows to be
* tests/wm.test (wm-transient-8.1): set to be transients for withdrawn
masters correctly.
2010-01-05 Pat Thoyts <patthoyts@users.sourceforge.net>
- * win/tkWinDialog.c: [Patch 2898255]: Enable unlimited multiple
- file selection from the open files dialog (pawlak,fellows,thoyts)
+ * win/tkWinDialog.c: [Patch 2898255]: Enable unlimited multiple file
+ selection from the open files dialog. (pawlak,fellows,thoyts)
2010-01-05 Donal K. Fellows <dkf@users.sf.net>
@@ -840,25 +1594,53 @@
menu entries if the first index to delete is explicitly after the last
index of existing entries.
+ * generic/tkFont.h (ROUND16): [Bug 2824916]: Use a correct rounding
+ * unix/tkUnixFont.c (TkpDrawAngledChars): macro for converting a
+ * unix/tkUnixRFont.c (TkpDrawAngledChars): double to a short. This
+ * win/tkWinFont.c (GetScreenFont): stops a number of small
+ visual artefacts from happening and reduces the effect of others. The
+ ROUND16 macro is now shared across all the font code (though some
+ platforms do not need it specially).
+
2010-01-04 Pat Thoyts <patthoyts@users.sourceforge.net>
- * library/dialog.tcl: Backported fix for tk_dialog <Return> binding
- * library/console.tcl: Backported fix for console keyboard menu
- activation and <<Cut>> handling from HEAD.
+ * doc/TkInitStubs.3: [Bug 2192104]: Mention USE_TK_STUBS macro.
+ * library/dialog.tcl: [Bug 2811266]: <Return> binding should invoke
+ the button with the focus.
+ * library/fontchooser.tcl: [Bug 2727476]: Fix default size of font
+ chooser dialog and assigned minimum sizes for the lists.
+ * library/console.tcl: [Bug 580361]: Fix console <<Cut>> binding.
+ * library/console.tcl: Fix keyboard access to console menu.
+ * library/demos/filebox.tcl: Make prettier using ttk.
+ * library/demos/fontchoose.tcl: Fix display of demo code.
* library/tk.tcl: Correctly handle quoted ampersands in AmpMenuArgs
+2010-01-03 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tcl.m4 (SC_CONFIG_CFLAGS): [Bug 1636685]: Use the configuration
+ for modern FreeBSD suggested by the FreeBSD porter.
+
2010-01-03 Pat Thoyts <patthoyts@users.sourceforge.net>
- * generic/tkMenu.h: [Patch 2848897] Support the system keyboard
+ * generic/tkMenu.h: [Patch 2848897]: Support the system keyboard
* win/tkWinMenu.c: cues option on Windows. This system parameter
hides the underlines on menu items unless the keyboard is used to
open the menu. (kovalenko, thoyts)
+2010-01-03 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkFont.c (Tk_TextLayoutToPostscript): Simplified the code to
+ * generic/tkCanvPs.c (TkCanvPostscriptCmd): generate the preamble
+ * library/mkpsenc.tcl: for PS generation and
+ also simplify the code to output text following the observation that
+ it effectively only produces ASCII anyway, even when it might have the
+ option to do otherwise in theory.
+
2010-01-03 Pat Thoyts <patthoyts@users.sourceforge.net>
- * library/tearoff.tcl: tearoff menus should be transient and use the
+ * library/tearoff.tcl: Tearoff menus should be transient and use the
toolwindow style on Windows.
- * tests/menu.test: menu tests using 'tkwait visibility' are unix only
+ * tests/menu.test: Menu tests using 'tkwait visibility' are unix only.
2010-01-02 Donal K. Fellows <dkf@users.sf.net>
@@ -873,10 +1655,11 @@
* generic/tkEvent.c (CleanUpTkEvent): that we do not need to make it
* doc/HandleEvent.3 (ARGUMENTS): fresh each time, which causes
* doc/QWinEvent.3 (ARGUMENTS): trouble with some input
- * macosx/tkMacOSXKeyEvent.c (InitKeyEvent): methods. Also includes the
- * win/tkWinX.c (GenerateXEvent): factoring out of some code and
- update of documentation to describe the slightly increased constraints
- on how Tk_HandleEvent can be used.
+ * carbon/tkMacOSXKeyEvent.c (InitKeyEvent): methods. Also includes the
+ * macosx/tkMacOSXKeyEvent.c (tkProcessKeyEvent): factoring out of some
+ * win/tkWinX.c (GenerateXEvent): code and update of
+ documentation to describe the slightly increased constraints on
+ how Tk_HandleEvent can be used.
2010-01-01 Donal K. Fellows <dkf@users.sf.net>
@@ -904,31 +1687,65 @@
* win/tkWinMenu.c: [Bug 2879927]: Highlight for cascade items in
torn-off menus is incorrect on Windows.
+2009-12-25 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/utils.tcl, library/notebook.tcl: [Bugs 2917688,2546779]:
+ Reworked ActivateTab focus selection logic.
+
2009-12-25 Donal K. Fellows <dkf@users.sf.net>
* doc/option.n: [Bug 2914943]: Correct the first example.
Also define what the format of option patterns is; that's a much less
commonly known fact than it used to be.
+2009-12-22 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/tcl.m4: Sync with current Tcl version.
+ * unix/Makefile.in: Use EXE_SUFFIX for Cygwin, and install
+ libtk8.6.dll in bin directory.
+ * unix/configure: (regenerated)
+
2009-12-22 Joe English <jenglish@users.sourceforge.net>
* library/ttk/sizegrip.tcl: [Bug 2912356]: Patch to avoid bizarro
behavior under compiz.
-2009-12-22 Donal K. Fellows <dkf@users.sf.net>
-
- * library/tkfbox.tcl (ListInvoke): [Bug 2919205]: Correct ordering of
- arguments to tk_messageBox.
-
2009-12-20 Donal K. Fellows <dkf@users.sf.net>
* unix/tkUnixSend.c (ServerSecure): [Patch 2917663]: Better support
for server-interpreted access control addreses.
-2009-12-16 Joe English <jenglish@users.sourceforge.net>
+2009-12-16 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkListbox.c: Fix gcc warning: ignoring return value of
+ "strtol", declared with attribute
+ warn_unused_result.
+ * unix/tkUnixEvent.c: Fix gcc warning: dereferencing pointer
+ "xgePtr" does break strict-aliasing rules.
+ * generic/tkInt.decls: CONSTify return values of TkKeysymToString,
+ * generic/tkBind.c TkFindStateString, TkpGetString, TkpGetChar,
+ * generic/tkIntDecls.h which are all not supposed to be modified by
+ * generic/tkUtil.c the caller. In tkUtil.c this gets rid of a
+ * carbon/tkMacOSXKeyboard.c dangerous type cast.
+ * macosx/tkMacOSXKeyboard.c
+ * unix/tkUnixKey.c
+ * win/tkWinKey.c
+
+2009-12-15 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkConfig.c: Added another dimension of refCounting to the
+ * generic/tkInt.c: "option" Tcl_ObjType to improve memory troubles
+ * generic/tkObj.c: detailed in [Bug 2492179]. Also removed
+ registration of the "option" Tcl_ObjType.
+ *** POTENTIAL INCOMPATIBILITY *** for callers of
+ Tcl_GetObjType("option") which must now handle a NULL return.
+
+2009-12-15 Donal K. Fellows <dkf@users.sf.net>
- * generic/ttk/ttkNotebook.c: Don't call Tk_DeleteOptionTable()
- [Bug 2915709], backport fix for [Bug 2496162].
+ * library/demos/unicodeout.tcl (usePresentationFormsFor): Split out
+ the code to decide whether to use presentation forms for clarity, and
+ add some more languages (though only in natural uncomposed form for
+ Devanagari script).
2009-12-14 Kevin B. Kenny <kennykb@acm.org>
@@ -941,58 +1758,73 @@
2009-12-02 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tkInt.decls: [Bugs 220600, 220690]: Comment that
- TkWinChildProc is exported through the stubs table since 8.5.9
+ * win/tkInt.decls: [Bugs 220600, 220690]: Comment that TkWinChildProc
+ is exported through the stubs table since 8.5.9
+
+2009-12-11 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/makefile.vc: Fix dependancies on ${TKSTUBLIB} when
+ TCL_USE_STATIC_PACKAGES is defined
+ * generic/tkWindow.c: Fix gcc warning, using gcc-4.3.4 on cygwin
+ warning: array subscript has type 'char'
2009-12-11 Donal K. Fellows <dkf@users.sf.net>
- * library/tk.tcl (tk::ScreenChanged): [Bug 2912473]: Stop problems
+ * library/tk.tcl (::tk::ScreenChanged): [Bug 2912473]: Stop problems
caused by display names with a double colon in.
2009-12-10 Donal K. Fellows <dkf@users.sf.net>
* library/demos/ttkscale.tcl: Added demo of [ttk::scale] widget.
-2009-12-09 Andreas Kupries <andreask@activestate.com>
-
- * library/safetk.tcl (::safe::loadTk): [Bug 2902573]: Fixed access to
- the cleanupHook of the safe base. The code used the old internal
- commands which have been removed since 2009-12-09. See Tcl's
- ChangeLog.
-
2009-12-09 Donal K. Fellows <dkf@users.sf.net>
* generic/tkColor.c (Tk_GetColorByValue): [Bug 2911570]: Ensure that
hash keys of color values are zeroed first, so that they hash properly
on 64-bit systems (where X structures are not tightly packed).
+ * unix/tkUnixWm.c (TkpMakeMenuWindow): Improve the determining of what
+ * generic/tkMenu.c (ConfigureMenu): EWMH hint to use so that we
+ distinguish between dropdown menus (children of menubars) and what are
+ presumably popup menus.
+
2009-12-08 Pat Thoyts <patthoyts@users.sourceforge.net>
- * unix/tkUnixWm.c: [Bug 2864685]: Backported window manager hinting
- update from HEAD
+ * unix/tkUnixWm.c: [Bug 2864685]: Apply suitable extended window
+ manager hints to the menus so that modern unix window managers can use
+ the correct animation modes.
-2009-12-06 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
+2009-12-02 Jan Nijtmans <nijtmans@users.sf.net>
- * macosx/tkMacOSXFont.c (GetFontFamilyName): [Bug 2548661]: Merge fix
- from HEAD (1.44).
+ * win/configure: (regenerated)
+ * win/Makefile.in: Use tktest86.dll for all tests.
+ * win/tkWinInt.h: Mark various functions MODULE_SCOPE
+ * generic/tkInt.decls: [Bugs 220600, 220690]: Make TkWinChildProc
+ available in private stub table.
+ * generic/tkIntPlatDecls.h: (regenerated)
+ * generic/tkStubInit.c: (regenerated)
-2009-12-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+2009-11-30 Jan Nijtmans <nijtmans@users.sf.net>
- * library/ttk/xpTheme.tcl: Fix selection of treeview rows on
- * library/ttk/vistaTheme.tcl: Windows XP and Vista.
+ * win/Makefile.in: Better dependancies in case of static build.
+ Generate tktest86.dll and tktest86.lib.
-2009-12-02 Jan Nijtmans <nijtmans@users.sf.net>
+2009-11-29 Jan Nijtmans <nijtmans@users.sf.net>
- * doc/GetHINSTANCE.3: Correct mentioned header file
- * win/tkWinInt.h: [Bugs 220600, 220690]: Make TkWinChildProc
- * generic/tkInt.decls: available in private stub table.
- * generic/tkIntPlatDecls.h: (regenerated)
- * generic/tkStubInit.c: (regenerated)
+ * generic/tkInt.h: Make all internal initialization
+ * generic/tkTest.c: routines MODULE_SCOPE
+ * generic/tkOldTest.c:
+ * generic/tkSquare.c:
+ * carbon/tkMaxOSXTest.c:
+ * macosx/tkMaxOSXTest.c:
+ * win/tkWinTest.c:
+ * win/tcl.m4: (copied from Tcl 8.6)
+ * win/configure: (regenerated)
-2009-11-25 Stuart Cassoff <stwo@users.sf.net>
+2009-11-25 Stuart Cassoff <stwo@users.sf.net>
* unix/tcl.m4: [Patch 2892871]: Remove unneeded
- * AC_STRUCT_TIMEZONE.
+ AC_STRUCT_TIMEZONE.
* unix/configure: Regenerated with autoconf-2.59.
2009-11-24 Donal K. Fellows <dkf@users.sf.net>
@@ -1001,40 +1833,92 @@
type for the array of data passed into X. It's wrong, but "right"
because of a mistake in the X11 specification.
+2009-11-23 Andreas Kupries <andreask@activestate.com>
+
+ * library/safetk.tcl (::safe::loadTk): [Bug 2902573]: Fixed access
+ to the cleanupHook of the safe base. The code used the old
+ internal commands which have been removed since 2009-11-05/06. See
+ Tcl's ChangeLog.
+
+2009-11-23 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/Makefile.in: Added .PHONY lines to stop make from getting
+ confused when someone makes an error in a rule.
+
2009-11-22 Pat Thoyts <patthoyts@users.sourceforge.net>
* tests/winWm.test: [Bug 2899949]: Make sure the window is still
- * win/tkWinWm.c: present when handling delayed activation
+ * win/tkWinWm.c: present when handling delayed activation.
-2009-11-13 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * win/Makefile.vc: Include tk stubs in the tktest link
- * tests/winDialog.test: [Bug 2307837]: Backported fix for running
- * win/tkWinTest.c: dialog tests on non-English locales
+2009-11-21 Donal K. Fellows <dkf@users.sf.net>
-2009-11-12 Don Porter <dgp@users.sourceforge.net>
+ * generic/tkUtil.c: Remove some anachronistic techniques (pointless
+ casts, mixed assignments and tests, etc.)
- *** 8.5.8 TAGGED FOR RELEASE ***
+ * generic/tk3d.c, generic/tkBitmap.c, generic/tkColor.c:
+ * generic/tkCursor.c, generic/tkFont.c, generic/tkTextIndex.c:
+ [Tcl Bug 2857044]: Corrections following audit of Tcl_ObjType freeing
+ practises; the typePtr field is now cleared when an object ceases to
+ be of the type.
- * changes: Updated for 8.5.8 release.
+2009-11-19 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
-2009-11-03 Don Porter <dgp@users.sourceforge.net>
+ * generic/tkCanvas.c: [Bug 2899685]: Fix the redraw logic of [imove]
- * generic/tk.h: Bump to 8.5.8 for release.
- * library/tk.tcl:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in:
- * README:
+2009-11-19 Jan Nijtmans <nijtmans@users.sf.net>
- * unix/configure: autoconf-2.59
- * win/configure:
+ * doc/GetHINSTANCE.3: Fix mentioned header file
+ * generic/tkTest.c: Compile with Stubs
+ * generic/tkOldTest.c
+ * generic/tkSquare.c
+ * win/tcl.m4: Should have been checked in together with the
+ 2009-08-09 check in of "win/configure"
+ * win/tkWinTest.c: Don't access tkWinProcs from Tk dll any more
+ * unix/tcl.m4: [Patch 2883533]: tcl.m4 support for Haiku OS
+ * unix/configure (regenerated)
+ * unix/Makefile.in: Fix library order in X11_LIB_SWITCHES
+
+2009-11-19 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkCanvLine.c (LineDeleteCoords): [Bug 2900121]: Get sense of
+ test for drawing optimization correct.
- * changes: Updated for 8.5.8 release.
+2009-11-15 Donal K. Fellows <dkf@users.sf.net>
-2009-11-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * doc/ttk_treeview.n (detach): Added note that the 'move' operation
+ restores detached nodes.
- * win/tkWinWm.c: [Bug 2891541]: Permit normal behaviour on
- Windows for a grabbed toplevel when it is the main window.
+2009-11-12 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/button.tcl, library/ttk/combobox.tcl,
+ * library/ttk/notebook.tcl, library/ttk/treeview.tcl:
+ [update] hygiene.
+
+ + Where possible, replace [a; update; b] with [a ; after 0 b].
+ + Where not possible, use [update idletasks] instead of full [update].
+ + Use [after 0] in favor of [after idle] for delayed work, to reduce
+ likelihood of reentrancy issues in [update idletasks].
+
+2009-11-11 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkPlatDecls.h: [Bug 2886635]: Restore C++
+ friendliness to the tkPlatDecls.h header file, which we insist
+ extensions #include to gain access to the Tk_*HWND*() routines.
+
+2009-11-10 Andreas Kupries <andreask@activestate.com>
+
+ * unix/Makefile.in: Partially reverted Don Porter's 2009-10-20 commit.
+ The OSX Cocoa code branch still needs tclInt.h and the internal
+ headers, thus the TCL_PLATFORM directory. See tclMacOSXNotify.c for
+ example.
+
+2009-11-09 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkFileFilter.c (TkFreeFileFilters): Simplify the code in
+ this file by consolidating the deletion code together into a single
+ function rather than scattering it over four.
2009-11-01 Joe Mistachkin <joe@mistachkin.com>
@@ -1043,10 +1927,34 @@
allocates storage for the default width from the heap and frees it
using an exit handler.
+2009-11-01 Joe Mistachkin <joe@mistachkin.com>
+
+ * doc/loadTk.n: Minor fix for htmlhelp target.
+
+2009-11-01 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkWidget.c, doc/ttk_widget.n: Uniform, extensible
+ syntax for [$w identify] methods: [$w identify $component $x $y]. All
+ ttk::* widgets support [$w identify element $x $y]; widgets with other
+ identifiable parts may have additional subcommands.
+ * generic/ttk/ttkNotebook.c, doc/ttk_notebook.n: Notebook widgets
+ support [$nb identify tab].
+ * generic/ttk/ttkPanedwindow.c, doc/ttk_panedwindow.n: Panedwindow
+ widgets support [$w identify sash]. Older 2-argument form [$w
+ identify $x $y] still supported, though it does different things
+ depending on the widget.
+
2009-10-29 Pat Thoyts <patthoyts@users.sourceforge.net>
- * win/tkWinFont.c: [Bug 1825353]: Backported patch for tiny
- fixed font on Russian Windows systems.
+ * win/tkWinFont.c: [Bug 1825353]: This patch reverts a previous
+ attempt to fix tiny fonts on Russian Windows. It fixes the issue by
+ requesting a suitable fixed font instead of decoding the system stock
+ font.
+
+2009-10-26 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/Makefile.in: Remove $(PACKAGE).* and prototype from the
+ `make distclean` target. Completes 2009-10-20 commit.
2009-10-25 Donal K. Fellows <dkf@users.sf.net>
@@ -1060,10 +1968,6 @@
2009-10-24 Donal K. Fellows <dkf@users.sf.net>
- * macosx/ttkMacOSXTheme.c (RangeToFactor, TrackElementDraw)
- (PbarElementDraw): [Bug 2883712]: Corrected scaling of progress bars
- and scales, and backported the fix for 64-bitness.
-
* library/button.tcl, unix/tkUnixButton.c (TkpDisplayButton):
[Patch 1530276]: Make -selectcolor handling work better for both
checkbuttons and radiobuttons when they don't have indicators.
@@ -1075,35 +1979,61 @@
* generic/tkText.h: [Patch 1469210]: Corrected handling of marking as
dirty when inserting after an undo from a non-dirty state.
+ * win/tkWinDialog.c (GetFileNameA): Make the handling of the filter
+ index the same as in GetFileNameW.
+
+ * library/tkfbox.tcl (::tk::dialog::file::, Done):
* library/xmfbox.tcl (MotifFDialog_FileTypes)
(MotifFDialog_ActivateSEnt):
- * library/tkfbox.tcl (Done, ::tk::dialog::file::):
* macosx/tkMacOSXDialog.c (Tk_GetOpenFileObjCmd):
* win/tkWinDialog.c (GetFileNameW, GetFileNameA):
* doc/getOpenFile.n: [Patch 2168768]: Corrected handling of the
-typevariable option to be consistently global; it's the only way it
can work even close to the same on all platforms.
-2009-10-15 Don Porter <dgp@users.sourceforge.net>
+ * macosx/ttkMacOSXTheme.c (RangeToFactor): [Bug 2883712]: Factor out
+ some common code and make sure that it is 64-bit correct.
- * generic/tkConsole.c: Relax the runtime version requirements on Tcl
- * generic/tkMain.c: so that Tk 8.5.8 can [load] into Tcl 8.6 (and
- * generic/tkWindow.c: later 8.*) interps. [Feature Request 2794032]
- * library/tk.tcl
- * unix/Makefile.in:
- * win/Makefile.in:
- * win/makefile.vc:
+2009-10-21 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/Makefile.in: [Bug 2875562]: Make sure that winMain.c and
+ * win/winMain.c: tkAppInit.c are never compiled with stubs.
+ * unix/tkAppInit.c:
+
+2009-10-20 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/Makefile.in: Compiling Tk no longer requires header files
+ * win/Makefile.in: from the TCL_PLATFORM DIR. Baby step in
+ pursuit of [Bug 1712098]. Also removed the long outdated and broken
+ targets package-* that were for building Solaris packages. Appears
+ that the pieces needed for these targets to function have never been
+ present in the current era of Tcl development and belong completely
+ to Tcl pre-history.
+
+2009-10-20 Andreas Kupries <andreask@activestate.com>
+
+ * library/msgs/pl.msg: Applied patch to Polish message catalog created
+ and submitted by Pawel Pawlak <morris@elysium.pl> (via JeffH).
+
+2009-10-18 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/menu.n: Reorganized for readability, and added a note describing
+ some subtleties of the -variable entry configuration option following
+ some discussion with Joe Mistachkin.
2009-10-10 Donal K. Fellows <dkf@users.sf.net>
- * unix/tkUnixRFont.c (InitFont,TkpGetFontFromAttributes,Tk_DrawChars):
- [Bug 1961455]: Draw underlines and overstrikes when using Xft for font
- rendering.
+ * unix/tkUnixRFont.c (InitFont, TkpGetFontFromAttributes)
+ (Tk_DrawChars, TkpDrawAngledChars): [Bug 1961455]: Draw underlines and
+ overstrikes when using Xft for font rendering.
+
+ * generic/tkFont.c (TkDrawAngledTextLayout): Optimize the zero-angle
+ case better.
2009-10-08 Donal K. Fellows <dkf@users.sf.net>
- * library/tkfbox.tcl (::tk::IconList_Create): [Patch 2870648]:
- Corrected cursor used in file/directory dialogs.
+ * library/iconlist.tcl (Create): [Patch 2870648]: Corrected cursor
+ used in file/directory dialogs.
2009-10-07 Pat Thoyts <patthoyts@users.sourceforge.net>
@@ -1115,20 +2045,29 @@
* unix/tkUnixScrlbr.c (TkpComputeScrollbarGeometry): [Patch 2088597]:
Stop scrollbars from getting too small at the end.
-2009-10-05 Don Porter <dgp@users.sourceforge.net>
+2009-10-05 Pat Thoyts <patthoyts@users.sourceforge.net>
- * changes: Updated for 8.5.8 release.
+ * win/tkWinButton.c: [Bug 2860827]: Avoid 3D effects with
+ user-specified backgrounds. The default disabled text is embossed on
+ Windows. But this looks poor when a non-default background color is in
+ use. This patch disables the embossed effect for buttons and labels
+ when the background is non- standard.
-2009-10-05 Pat Thoyts <patthoyts@users.sourceforge.net>
+2009-09-30 Pat Thoyts <patthoyts@users.sourceforge.net>
- * win/tkWinButton.c: [Bug 2860827]: Backported patch avoiding 3D
- effects with user-specified background.
+ * tests/winWm.test: [Bug 2799589]: Grab on deleted window.
2009-09-25 Donal K. Fellows <dkf@users.sf.net>
* generic/tkImgPhoto.c (ImgGetPhoto): Correct generation of grayscale
data from an image. Reported by Keith Vetter on comp.lang.tcl.
+2009-09-19 Peter Spjuth <peter.spjuth@gmail.com>
+
+ * generic/tkGrid.c: [Bug 2859912]: Bug fix in grid/pack collision
+ * generic/tkPack.c: detect. Faulty slave was not properly blocked
+ * tests/packgrid.test: from slave list.
+
2009-09-14 Jeff Hobbs <jeffh@ActiveState.com>
* generic/tkMenuDraw.c (TkPostSubmenu): [Bug 873613]: Fix reposting of
@@ -1137,7 +2076,7 @@
(DrawMenuEntryArrow): [Bug 873608]: Draw Win menu arrow after being
torn off.
-2009-09-10 Donal K. Fellows <dkf@users.sf.net>
+2009-09-09 Donal K. Fellows <dkf@users.sf.net>
* unix/tkUnixRFont.c (InitFont): Move pattern disposal in error case
to callers so they have more options when they come to recovering from
@@ -1150,6 +2089,27 @@
error beats a crash! (Issue reported on comp.lang.tcl by Denis
Berezhnoy.)
+2009-09-07 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkFocus.c: Fix potential null dereference flagged by clang
+ * generic/tkMenu.c: static analyzer.
+ * generic/tkTextBTree.c:
+ * generic/tkTextDisp.c:
+ * generic/tkTextIndex.c:
+
+ * generic/tkConsole.c: Silence false positives from clang static
+ * generic/tkTest.c: analyzer about potential null dereference.
+ * generic/tkText.c:
+ * generic/tkTextBTree.c:
+ * generic/tkTextTag.c:
+ * generic/tkVisual.c:
+
+2009-09-04 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkInt.h (TkDisplay): Remove fields that are never read from.
+ * generic/tkWindow.c (Tk_DestroyWindow): Remove code to write to
+ write-only fields of TkDisplay. This follows on from [Bug 2039720].
+
2009-08-25 Donal K. Fellows <dkf@users.sf.net>
* unix/tkUnixSend.c (ServerSecure): [Bug 1909931]: Added some support
@@ -1162,10 +2122,76 @@
2009-08-24 Daniel Steffen <das@users.sourceforge.net>
- * macosx/tkMacOSXHLEvents.c (ScriptHandler): Fix "do script" apple
- event handler issues on recent Mac OS X releases by using AE coercion
- to 'utf8' for text data and to 'fsrf' for alias data. (Reported by
- Youness Alaoui on tcl-mac)
+ * generic/tkInt.h: Annotate Tcl_Panic as noreturn for clang static
+ analyzer in PURIFY builds, replacing preprocessor/assert technique.
+
+ * generic/tkBind.c (HandleEventGenerate): Don't generate events for
+ windows that don't exist yet (fixes TkAqua testsuite crash).
+
+ * macosx/tkMacOSXWindowEvent.c: [Bug 2821084]: Allow WM_DELETE_WINDOW
+ handlers to prevent window closure by generating WM destroy event
+ earlier (from window delegate's -windowShouldClose:).
+
+ * macosx/tkMacOSXDraw.c (TkMacOSX{Setup,Restore}DrawingContext):
+ Disable window flushing during Tk drawing to avoid immediate flush of
+ NSView-based native widgets on draw. (fixes drawing performance issue
+ reported by Youness Alaoui on tcl-mac)
+
+ * macosx/tkMacOSXHLEvents.c (ScriptHandler): Fix "do script" apple
+ * carbon/tkMacOSXHLEvents.c (ScriptHandler): event handler issues
+ on recent OS X releases by using AE coercion to 'utf8' for text data
+ and to 'fsrf' for alias data. (reported by Youness Alaoui on tcl-mac)
+
+ * macosx/Wish.sdef (new file): Install and enable sdef file
+ * macosx/Wish-Info.plist.in: into Wish application bundle,
+ * macosx/Tk.xcode/project.pbxproj: describing TkAqua apple event
+ * macosx/Tk.xcodeproj/project.pbxproj: support for use by AppleScript.
+ * unix/Makefile.in: (replaces functionality of
+ * unix/configure.in: 'aete' resource removed with
+ Cocoa port & fixes AppleScript
+ issues reported on tcl-mac)
+ * unix/configure: autoconf-2.59
+
+ * carbon/Wish.xcode/project.pbxproj: Remove references to obsolete
+ * carbon/Wish.xcodeproj/project.pbxproj: prolog.ps file.
+
+2009-08-19 Peter Spjuth <peter.spjuth@gmail.com>
+
+ * generic/tk.h
+ * generic/tkGeometry.c
+ * generic/tkGrid.c
+ * generic/tkInt.h
+ * generic/tkPack.c
+ * generic/tkWindow.c
+ * tests/grid.test
+ * tests/packgrid.test
+ * tests/textIndex.test: [Patch 2475855]: Give an error if grid and
+ pack are used in the same master.
+
+2009-08-14 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXDraw.c: Avoid exception in XCopyArea() when copying
+ from toplevel that has never been mapped. (Reported by Youness Alaoui
+ on tcl-mac)
+
+ * macosx/tkMacOSXWm.c: Workaround for textured windows being draggable
+ from opaque content areas. [Bug 2824538] (walzer)
+
+2009-08-10 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinPixmap.c: Eliminate more gcc warnings
+ * win/tkWinWm.c:
+ * win/tkWinTest.c
+
+2009-08-09 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/ttk/ttkInit.c: Eliminate gcc warning
+ * generic/tkBind.c
+ * generic/tkText.c
+ * generic/tkUtil.c
+ * win/ttkWinXPTheme.c: Include <vssym32.h> only when available
+ * win/configure.in: check for vssym32.h, available in newer SDK's
+ * win/configure: (regenerated)
2009-08-08 Donal K. Fellows <dkf@users.sf.net>
@@ -1179,17 +2205,61 @@
spaces by restricting what we break on to ASCII spaces, which is good
enough for most purposes.
+2009-08-02 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * win/tkWinClipboard.c Correct check for winNT
+ * win/tkWinDialog.c Eliminate many gcc warnings
+ * win/tkWinImage.c:
+ * win/tkWinMenu.c:
+ * win/tkWinWm.c:
+ * win/tkWinX.c:
+ * win/ttkWinXPTheme.c: Eliminate msvc warnings
+ * win/tcl.m4:
+ * win/configure
+ * win/.cvsignore: Prevent files from being checked in by accident
+
2009-08-01 Donal K. Fellows <dkf@users.sf.net>
* unix/tkUnixWm.c (WmIconphotoCmd): [Bug 2830420]: Assemble the image
for the window manager in a way that doesn't assume we're on a little-
endian system.
+2009-07-27 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/GetScroll.3: Reworded and reordered so as to indicate that the
+ Tcl_Obj forms are preferred.
+
+2009-07-26 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/canvas.n: Corrected description of acceptable join styles.
+ Spotted by Emiliano Gavilan.
+
+2009-07-23 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkSelect.c (HandleTclCommand): [Bug 2441988]: Stop losing
+ reports of errors in selection handlers; that's what the background
+ error handling code is for.
+ *** POTENTIAL INCOMPATIBILITY *** if your code was relying on erroring
+ selection scripts being silent.
+ (LostSelection, Tk_SelectionObjCmd): Stop using the vastly inefficient
+ TkCopyAndGlobalEval; better to use Tcl_Obj refcount management.
+
2009-07-22 Donal K. Fellows <dkf@users.sf.net>
* generic/tkFocus.c (TkFocusDeadWindow): [Bug 2496114]: Ensure that
focus desynchronization doesn't cause a crash.
+2009-07-21 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkFont.c (TkUnderlineAngledTextLayout): [Bug 2356057]:
+ Corrected drawing of rotated underlines.
+
+2009-07-21 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
+
+ * generic/tkFont.c: [Bug 2328657]: Explicitly exclude hacky zero-char
+ chunks from intersection computation. Might deserve generalization to
+ other tests.
+
2009-07-20 Donal K. Fellows <dkf@users.sf.net>
* tests/clipboard.test (clipboard-6.2): [Bug 2824378]: Corrected
@@ -1201,6 +2271,25 @@
incremental transfer of binary selections work get deserialized
correctly. Thanks to Emiliano Gavilan for detecting.
+2009-07-18 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/Makefile.in: Define NDEBUG in optimized (non-
+ symbols) build to disable assert()s.
+
+ * macosx/tkMacOSXBitmap.c: [Bug 2821318]: Fix tk::mac::iconBitmap
+ crash due to off-by-one ckalloc error.
+
+2009-07-15 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/ttkMacOSXTheme.c: [Patch 2819620]: Update notebook tab
+ * library/ttk/aquaTheme.tcl: appearance to modern L&F; adjust tab &
+ notebook padding and tabmargins;
+ correct appearance of selected tree
+ header; add support for native tree
+ header sort arrows via user1 state.
+
+ * library/demos/mclist.tcl: Use native sort arrows with aqua theme
+
2009-07-15 Donal K. Fellows <dkf@users.sf.net>
* unix/tkUnixSelect.c (TkSelEventProc, SelRcvIncrProc, SelCvtFromX8):
@@ -1219,819 +2308,769 @@
* doc/grid.n: [Bug 2818455]: Corrected example.
-2009-06-27 Jan Nijtmans <nijtmans@users.sf.net>
-
- * generic/tkInt.decls (Tk(Orient|Smooth)(Parse|Print)Proc):
- Backport [Bug 2804935]: Expose these functions through the internal
- stub table as they are useful to existing third-party code.
-
-2009-06-23 Jan Nijtmans <nijtmans@users.sf.net>
-
- * generic/tkCanvUtil.c: [Bug 220935]: canvas dash update problem
-
-2009-06-02 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/tkWinWm.c: [Bug 2799589]: Backported fix for crash on
- * tests/winWm.test: delayed window activation.
-
-2009-05-21 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/tkWinMenu.c: [Bug 2794778]: Backported fix for keyboard
- traversal of the menus on Windows.
+2009-07-02 Pat Thoyts <patthoyts@users.sourceforge.net>
-2009-05-14 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * generic/tkButton.c: [Bug 1923684]: Backported checkbutton fix
- for confused state when -offvalue equals -tristatevalue
+ * generic/tkInt.h: Avoid using C++ reserved word in header.
-2009-05-14 Pat Thoyts <patthoyts@users.sourceforge.net>
+2009-06-30 Daniel Steffen <das@users.sourceforge.net>
- * doc/ttk_image.n: Backported support for the Vista theme.
- * doc/ttk_style.n: This requires the vsapi element engine,
- * doc/ttk_vsapi.n: the hover state and the theme script
- * doc/ttk_widget.n: definition.
- * generic/ttk/ttkState.c:
- * generic/ttk/ttkTheme.h:
- * generic/ttk/ttkWidget.c:
- * library/ttk/ttk.tcl:
- * library/ttk/vistaTheme.tcl:
- * library/ttk/xpTheme.tcl:
- * tests/ttk/vsapi.test:
- * win/ttkWinXPTheme.c:
+ * generic/tkInt.h: Add assert macros for clang static
+ analyzer and redefine Tcl_Panic to
+ assert after panic in clang PURIFY
+ builds.
-2009-05-13 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * generic/tkImgPhInstance.c: Small fixes to make clang static
+ * generic/tkTextDisp.c: analyzer happier.
- * generic/tkFont.c: [Bug 2791352]: Backported fix and tests for
- * tests/font.test: mis-parsing of certain font descriptions.
+ * generic/tkConfig.c: Add clang assert for false positives
+ * generic/tkUndo.c: from static analyzer.
-2009-05-03 Donal K. Fellows <dkf@users.sf.net>
+2009-06-29 Daniel Steffen <das@users.sourceforge.net>
- * win/tkWinWm.c (UpdateWrapper): [Bug 2785744]: Manipulate flag bit
- correctly so that menubar updates can't smash other attributes.
+ Merge of TkAqua Cocoa port <http://github.com/das/tcltk/tree/de-carbon>
+ *** POTENTIAL INCOMPATIBILITY ***
-2009-04-30 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * macosx/tkMacOSX.h: Large-scale rewrite of TkAqua migrating
+ * macosx/tkMacOSXBitmap.c: all use of deprecated Carbon API to
+ * macosx/tkMacOSXButton.c: Cocoa API; now supports 64bit
+ * macosx/tkMacOSXClipboard.c: architecture and requires Mac OS X 10.5
+ * macosx/tkMacOSXColor.c: or later; with TkAqua enabled, all Tk
+ * macosx/tkMacOSXConfig.c: sources are now built with the
+ * macosx/tkMacOSXCursor.c: Objective-C compiler and running in
+ * macosx/tkMacOSXDebug.c: Objective-C garbage collection mode as
+ * macosx/tkMacOSXDebug.h: well as in retain-release mode is
+ * macosx/tkMacOSXDefault.h: supported; detailed development history
+ * macosx/tkMacOSXDialog.c: is available in github repository.
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXEmbed.c: There should be no script-visible
+ * macosx/tkMacOSXEntry.c: changes to existing Tk functionality,
+ * macosx/tkMacOSXEvent.c: but there are a few aqua-specific
+ * macosx/tkMacOSXEvent.h: additions, see macosx/README for
+ * macosx/tkMacOSXFont.c: details; extensions using only public
+ * macosx/tkMacOSXFont.h: Tk API should continue to work
+ * macosx/tkMacOSXHLEvents.c: unchanged but extensions that rely on
+ * macosx/tkMacOSXInit.c: platform-specific internal Tk API or
+ * macosx/tkMacOSXInt.h: make assumptions about the inner
+ * macosx/tkMacOSXKeyEvent.c: workings of TkAqua (in particular
+ * macosx/tkMacOSXKeyboard.c: presence of QuickDraw) will require
+ * macosx/tkMacOSXMenu.c: porting.
+ * macosx/tkMacOSXMenubutton.c:
+ * macosx/tkMacOSXMenus.c: Configure Tk with --enable-aqua=carbon
+ * macosx/tkMacOSXMouseEvent.c: to fallback to now-deprecated previous
+ * macosx/tkMacOSXNotify.c: TkAqua implementation in tk/carbon.
+ * macosx/tkMacOSXPort.h:
+ * macosx/tkMacOSXPrivate.h:
+ * macosx/tkMacOSXRegion.c:
+ * macosx/tkMacOSXScale.c:
+ * macosx/tkMacOSXScrlbr.c:
+ * macosx/tkMacOSXSend.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXTest.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXWm.h:
+ * macosx/tkMacOSXXStubs.c:
+ * macosx/ttkMacOSXTheme.c:
+ * macosx/tkMacOSXCarbonEvents.c (removed):
- * win/tkWinWm.c: [Patch 2504402]: Backported change to create
- wm icons as device independent bitmaps. (cjmcdonald)
+ * macosx/tkMacOSXCursors.h (new): Move cursor data from resources
+ * macosx/tkMacOSXXCursors.h (new): to compiled-in const array;
+ * macosx/tkMacOSXCursors.r (removed): remove obsolete Rez source
+ * macosx/tkMacOSXXCursors.r (removed): files for resource data.
+ * macosx/tkAboutDlg.r (removed):
+ * macosx/tkMacOSXAETE.r (removed):
-2009-04-30 Donal K. Fellows <dkf@users.sf.net>
+ * macosx/Tk.tiff (new): Rename and update icon to blue feather;
+ * macosx/Tk.icns (new): add tiff version for about dialog.
+ * macosx/Wish.icns (removed):
- * win/tkWinPixmap.c (Tk_GetPixmap): [Bug 2080533]: Added patch that
- allows Tk to keep working even when the graphics card is stressed.
+ * macosx/Tk-Info.plist.in: Update copyright; adjust minimum system
+ * macosx/Wish-Info.plist.in: version requirement.
+ * generic/tkEntry.h:
-2009-04-28 Jeff Hobbs <jeffh@ActiveState.com>
+ * license.terms: Sync list of entities with those in the
+ tcl license.terms, add Apple Inc.
- * unix/tcl.m4, unix/configure (SC_CONFIG_CFLAGS): Harden the check
- to add _r to CC on AIX with threads.
+ * generic/tk.h: Update comment with list of source
+ files containing tk version numbers.
-2009-04-27 Donal K. Fellows <dkf@users.sf.net>
+ * generic/tkButton.c: On aqua, recompute button geometry on
+ secondary image change to enable cache
+ of native img format in geom compute.
- * generic/tkInt.decls: [Bug 2768945]: Expose (as "private") a set of
- functions needed for easily building canvas items that work like
- existing standard ones.
+ * generic/tkGrab.c: On aqua, make all grabs global, the
+ Mac OS X windowserver forces all grabs
+ to be application-local only anyway.
-2009-04-24 Jeff Hobbs <jeffh@ActiveState.com>
+ * generic/tkSelect.c: Enable utf8 atom on aqua.
- * win/tkWinDialog.c (ChooseDirectoryValidateProc): No need to set
- cwd on selchange. Prevents delete of selected folder in dialog.
+ * generic/tk.decls: Replace carbon types in public and
+ * generic/tkInt.decls: internal platform stubs interfaces with
+ void* resp. generic Tk types.
-2009-04-24 Stuart Cassoff <stwo@users.sf.net>
+ * xlib/xgc.c: Add support for managing a platform-
+ specific cache appended to a GC.
- * unix/Makefile.in: [Bug 2764263]: Removed stray @ from
- Makefile.in test target. [Bug 1945073]: Don't chmod+x square demo.
- [Patch 2764272]: Adjustable demo install location.
+ * tests/dialog.test: Change name of undefined bit to avoid
+ match with OSType native bitmap name.
-2009-04-24 Stuart Cassoff <stwo@users.sf.net>
+ * doc/cursors.n: Update list of cursors mapped to native
+ cursors and add new native cursors.
- * unix/Makefile.in: [Patch 2769530]: Don't chmod/exec installManPage.
+ * doc/menu.n: Add documentation of new aqua-specific
+ .window menu, document new constraints
+ on .apple menu.
-2009-04-23 Jeff Hobbs <jeffh@ActiveState.com>
+ * library/console.tcl: Add aqua window and help menus.
- * win/tkWinDialog.c (Tk_ChooseDirectoryObjCmd): [Bug 2779910]: Enable
- the new style choosedir that has a "New Folder" button, with
- ::tk::winChooseDirFlags override for new behavior.
+ * unix/Makefile.in: Add support for TkAqua-implementation-
+ specific sources determined at
+ configure-time. Update dist target for
+ new/removed files.
-2009-04-15 Don Porter <dgp@users.sourceforge.net>
+ * unix/configure.in: Add libraries & compiler flags for
+ Cocoa and Objective-C; update build
+ support for new/removed files; add
+ support for configure-time choice of
+ TkAqua implementation.
- *** 8.5.7 TAGGED FOR RELEASE ***
+ * macosx/Tk-Common.xcconfig (new): Rename Xcode projects and
+ * macosx/Tk-Debug.xcconfig (new): related files; update for Xcode
+ * macosx/Tk-Release.xcconfig (new): 3.1 and 3.2; update for Cocoa,
+ * macosx/Tk.xcode/* (new): Objective-C & GC; update with
+ * macosx/Tk.xcodeproj/* (new): new/removed source files;
+ * macosx/Wish.xcode/* (removed): standardize on gcc 4.2; remove
+ * macosx/Wish.xcodeproj/* (removed): obsolete configurations and
+ * macosx/Wish-Debug.xcconfig (removed): pre-Xcode project.
+ * macosx/Wish-Common.xcconfig (removed):
+ * macosx/Wish-Release.xcconfig (removed):
+ * macosx/Wish.pbproj/* (removed):
- * changes: Updated for 8.5.7 release.
+ * macosx/README: Document new Cocoa-port features and
+ constraints; update project docs;
+ cleanup.
-2009-04-14 Stuart Cassoff <stwo@users.sourceforge.net>
+ * carbon/tkMacOSXInt.h: Add dummy defines for empty GC cache.
- * unix/tcl.m4: Removed -Wno-implicit-int from CFLAGS_WARNING.
+ * carbon/tkMacOSXColor.c: Update for type changes in platform
+ * carbon/tkMacOSXDraw.c: stubs interfaces.
+ * carbon/tkMacOSXHLEvents.c:
+ * carbon/tkMacOSXMouseEvent.c:
+ * carbon/tkMacOSXSubwindows.c:
+ * carbon/tkMacOSXWm.c:
-2009-04-10 Don Porter <dgp@users.sourceforge.net>
+ * carbon/tkMacOSXButton.c: Fix warning.
- * changes: Updated for 8.5.7 release.
+ * generic/tkPlatDecls.h: regen.
+ * generic/tkIntPlatDecls.h:
+ * unix/configure: autoconf-2.59
- * generic/tk.h: Bump to 8.5.7 for release.
- * library/tk.tcl:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in:
- * README:
+2009-06-27 Jan Nijtmans <nijtmans@users.sf.net>
- * unix/configure: autoconf-2.59
- * win/configure:
+ * generic/tkInt.decls (added TkSmooth(Parse|Print)Proc,
+ removed TkTile(Parse|Print)Proc which don't exist):
+ Follow-up to [Bug 2804935]: Expose these functions through the
+ internal stub table as they are useful to existing third-party code.
-2009-04-10 Joe English <jenglish@users.sourceforge.net
+2009-06-26 Daniel Steffen <das@users.sourceforge.net>
- * library/palette.tcl(tk_setPalette): Don't set
- *selectColor: #b03060; this makes radio- and checkbuttons
- look wrong post-TIP#109.
+ * carbon/ (new directory): Copy of current state of 'macosx'
+ source directory, to preserve legacy TkAqua implementation based on
+ Carbon API (with support for Mac OS X releases older than 10.5).
-2009-04-10 Daniel Steffen <das@users.sourceforge.net>
+ * unix/Makefile.in: Add support for --enable-aqua=carbon
+ * unix/configure.in: configure option (legacy fallback for
+ pre-Mac OS X 10.5 releases).
- * unix/configure.in (Darwin): use Darwin SUSv3 extensions if
- available.
* unix/configure: autoconf-2.59
- * unix/tkConfig.h.in: autoheader-2.59
-
- * library/msgbox.tcl: don't set msgbox bitmap background on TkAqua.
-
- * library/demos/filebox.tcl: only show "Motif Style Dialog" checkbutton
- on X11 windowingsystem.
- * library/demos/widget: GOOBE: use ttk::cursor
-
- * library/ttk/cursors.tcl: backport ttk::cursor from HEAD
+2009-06-22 Jan Nijtmans <nijtmans@users.sf.net>
- * library/demos/knightstour.tcl: fix knightstour demo not running from
- interactive wish.
+ * generic/tkCanvUtil.c: [Bug 220935]: canvas dash update problem
- * library/console.tcl (::tk::ConsoleInit): remove redundant TkAqua
- Quit menu item.
+2009-06-12 Donal K. Fellows <dkf@users.sf.net>
- * generic/tkPointer.c (Tk_UpdatePointer): use all 5 buttons.
+ * generic/tkInt.decls (TkOrientParseProc, TkOrientPrintProc):
+ [Bug 2804935]: Expose these functions through the internal stub table
+ as they are useful to existing third-party code.
- * generic/tkMenu.c (PostProcessEntry): delay call to
- TkpConfigureMenuEntry() until all menu entry attributes are setup.
+2009-06-02 Pat Thoyts <patthoyts@users.sourceforge.net>
- * library/menu.tcl (::tk::MbPost): fix error thrown in y position
- computation with indicatoron.
+ * win/tkWinWm.c: [Bug 2799589]: Avoid setting the focus on a
+ * tests/winWm.test: deleted window during delayed activation.
- * generic/tkMenubutton.c: s/DEF_BUTTON_JUSTIFY/DEF_MENUBUTTON_JUSTIFY/
+2009-05-21 Pat Thoyts <patthoyts@users.sourceforge.net>
- * generic/tkTextBTree.c (TkBTreeDeleteIndexRange): add bounds check
- to startEnd array access (fixes testsuite crash).
+ * win/tkWinMenu.c: [Bug 2794778]: Calls to CallWindowProc can lead to
+ other functions overwriting the event strucure. Therefore preserve a
+ local copy of the XKeyEvent while looping over the key events.
- * tests/unixFont.test: only use xlsfonts with X11 windowingsystem.
+2009-05-17 Joe English <jenglish@users.sourceforge.net>
-2009-04-10 Donal K. Fellows <dkf@users.sf.net>
+ * generic/ttkNotebook.c: [Bug 1470246]: More flexible tab placement.
- * generic/tkCanvPs.c (TkPostscriptInfo): [Bug 1466509]: Eliminate old
- and misleading comments mentioning prolog.ps.
- * generic/prolog.ps, library/prolog.ps: Remove unused files.
- * unix/Makefile.in, win/Makefile.in: Stop building distributions that
- include the removed files or trying to install them.
+2009-05-14 Pat Thoyts <patthoyts@users.sourceforge.net>
- * library/tk.tcl: [Bug 2116837]: Add event definitions to handle the
- standard virtual events when Caps Lock is on.
+ * generic/tkButton.c: [Bug 1923684]: If a checkbutton offvalue is the
+ same as the tristate value we should use the off state in
+ preference. (andrey gusev)
-2009-04-03 Joe English <jenglish@users.sourceforge.net>
+2009-05-13 Pat Thoyts <patthoyts@users.sourceforge.net>
- * unix/tkUnixWm.c: [Bug 1789819]: Don't Panic.
+ * win/tkWinSend.c: FormatMessage should always use the ignore-inserts
+ * win/tkWinTest.c: flag when processing system errors.
-2009-03-25 Donal K. Fellows <dkf@users.sf.net>
+ * generic/tkFont.c: [Bug 2791352]: Handle parsing of type 5 font
+ * tests/font.test: descriptions with hyphenated family name.
- * generic/ttk/ttkTheme.c (BuildOptionMap, NewElementImpl):
- [Bug 2178820]: Ensure that zero-size allocations don't happen; some
- malloc implementations don't like it at all.
+2009-05-06 Pat Thoyts <patthoyts@users.sourceforge.net>
- * win/wish.exe.manifest.in: [Bug 1871101]: Add magic to make Tk not be
- blurred on Vista with large fonts.
+ * library/images/lamp.svg: Added an SVG version of the Tk lamp and
+ * library/images/lamp.png: a pre-rendered PNG version.
+ * win/rc/wish.ico: Wish gets a new icon using the SVG lamp and the tk
+ * win/rc/tk.ico: dll gets the tcl rendered feather. This provides
+ improved icons for Vista/Windows 7.
-2009-03-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+2009-05-05 Donal K. Fellows <dkf@users.sf.net>
- * generic/tkFileFilter.c: Backported some fixes for uninitialized
- * generic/tkFont.c: variables identified by das using clang
- * generic/tkListbox.c: analysis.
+ * doc/MainWin.3 (Tk_GetNumMainWindows): [Bug 487220]: Clarified that
+ this function works per-thread, not per-process.
-2009-02-27 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * doc/canvas.n (scale): [Bug 1832015]: Clarified that [$c scale] only
+ affects item coordinates.
- * generic/tkWindow.c: [Bug 2645457] check for dead windows after
- calling Tk_MakeWindowExist to avoid a crash when mapping dead windows.
+2009-05-04 Donal K. Fellows <dkf@users.sf.net>
-2009-02-23 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * doc/3DBorder.3, doc/BindTable.3, doc/CanvPsY.3, doc/Clipboard.3:
+ * doc/ConfigWidg.3, doc/CrtWindow.3, doc/GetBitmap.3:
+ * doc/GetCapStyl.3, doc/GetImage.3, doc/GetJoinStl.3, doc/GetScroll.3:
+ * doc/GetSelect.3, doc/GetVisual.3, doc/MainWin.3, doc/Name.3:
+ * doc/ParseArgv.3, doc/TextLayout.3, doc/Tk_Init.3: [Bug 2431507]:
+ Purge all mention of the now-obsolete 'interp->result'.
- * win/tkWinCursor.c: [Patch 2542828] use stock Win32 help arrow
- cursor when question_arrow requested (danckaert)
+2009-05-03 Donal K. Fellows <dkf@users.sf.net>
- * win/rc/*.cur: [Patch 2513104] fix cursor hotspots (cjmcdonald)
+ * win/tkWinWm.c (UpdateWrapper): [Bug 2785744]: Manipulate flag bit
+ correctly so that menubar updates can't smash other attributes.
- * win/tkWinMenu.c: Applied patch for menu image display bug
- [Bug 1329198, 456299] [Patch 2507419] (cjmcdonald)
+2009-05-01 Donal K. Fellows <dkf@users.sf.net>
-2009-02-17 Jeff Hobbs <jeffh@ActiveState.com>
+ * library/mkpsenc.tcl (DrawText): [Bug 2777019]: Corrected point of
+ application of rotation transform so rotation is about the anchor
+ point of the text.
- * win/tcl.m4, win/configure: Check if cl groks _WIN64 already to
- avoid CC manipulation that can screw up later configure checks.
- Use 'd'ebug runtime in 64-bit builds.
+ * generic/tkCanvPs.c (Tk_PostscriptPhoto):
+ * library/mkpsenc.tcl: Factor out the postscript code for converting
+ images into postscript so that the code bits are in the prolog and not
+ emitted at runtime if a non-thread-safe static says to...
-2009-02-16 Jeff Hobbs <jeffh@ActiveState.com>
+2009-04-30 Pat Thoyts <patthoyts@users.sourceforge.net>
- * win/configure.in, win/configure: align better with tcl
- version. Ensures finding correct CPP for Win64.
+ * win/tkWinWm.c: [Patch 2504402]: Create icon bitmaps as device
+ independent bitmaps. This ensures the icon can be drawn properly on
+ various colour depth surfaces - in particular it fixes a problem with
+ remote desktop and looks better in the vista task switching overlay.
+ (cjmcdonald)
-2008-02-06 Daniel Steffen <das@users.sourceforge.net>
+2009-04-30 Donal K. Fellows <dkf@users.sf.net>
- * generic/tkImgPhoto.c: fix numerous leaks discovered with the
- * generic/tkMenu.c: Mac OS X Instruments.app Leaks tool.
- * generic/tkText.c:
- * generic/tkTextImage.c:
- * generic/tkTextIndex.c:
- * generic/tkUndo.c:
- * generic/ttk/ttkFrame.c:
- * macosx/tkMacOSXWm.c:
+ * win/tkWinPixmap.c (Tk_GetPixmap): [Bug 2080533]: Added patch that
+ allows Tk to keep working even when the graphics card is stressed.
-2009-01-22 Kevin B. Kenny <kennykb@acm.org>
+2009-04-28 Jeff Hobbs <jeffh@ActiveState.com>
- * unix/tcl.m4: Corrected a typo ($(SHLIB_VERSION) should be
- ${SHLIB_VERSION}).
- * unix/configure: Autoconf 2.59
+ * unix/tcl.m4, unix/configure (SC_CONFIG_CFLAGS): Harden the check
+ to add _r to CC on AIX with threads.
-2009-01-19 Kevin B. Kenny <kennykb@acm.org>
+2009-04-27 Donal K. Fellows <dkf@users.sf.net>
- * unix/Makefile.in: Added a CONFIG_INSTALL_DIR parameter so that
- * unix/tcl.m4: distributors can control where tclConfig.sh goes.
- Made the installation of 'ldAix' conditional
- upon actually being on an AIX system. Allowed for downstream
- packagers to customize SHLIB_VERSION on BSD-derived systems.
- Thanks to Stuart Cassoff for [Patch 907924].
- * unix/configure: Autoconf 2.59
+ * generic/tkInt.decls: [Bug 2768945]: Expose (as "private") a set of
+ functions needed for easily building canvas items that work like
+ existing standard ones.
-2009-01-14 Jan Nijtmans <nijtmans@users.sf.net>
+2009-04-24 Jeff Hobbs <jeffh@ActiveState.com>
- * generic/tkImgPhoto.c: fix for aMSN compatibility [tcl-Bug 2507326]
+ * win/tkWinDialog.c (ChooseDirectoryValidateProc): No need to set cwd
+ on selchange. Prevents delete of selected folder in dialog.
-2009-01-11 George Peter Staplin <georgeps@users.sourceforge.net>
+2009-04-24 Stuart Cassoff <stwo@users.sf.net>
- * generic/tkEvent.c: Backport a fix from 8.6 for a NULL pointer
- dereference in CreateXIC.
+ * unix/Makefile.in: Assorted issues:
+ [Bug 2764263]: Removed stray @ from Makefile.in test target.
+ [Bug 1945073]: Don't chmod+x square demo.
+ [Patch 2764272]: Adjustable demo install location.
-2009-01-07 Pat Thoyts <patthoyts@users.sourceforge.net>
+2009-04-24 Stuart Cassoff <stwo@users.sf.net>
- * win/tkWinWm.c: Backported fix for [Bug 1847002] to prevent the
- bypassing of grab restrictions via the taskbar on Windows.
+ * unix/Makefile.in: [Patch 2769530]: Don't chmod/exec installManPage.
-2008-12-22 Don Porter <dgp@users.sourceforge.net>
+2009-04-23 Jeff Hobbs <jeffh@ActiveState.com>
- *** 8.5.6 TAGGED FOR RELEASE ***
+ * win/tkWinDialog.c (Tk_ChooseDirectoryObjCmd): [Bug 2779910]: Enable
+ the new style choosedir that has a "New Folder" button, with
+ ::tk::winChooseDirFlags override for new behavior.
- * tests/embed.test: Eliminate duplicate test names.
+2009-04-14 Donal K. Fellows <dkf@users.sf.net>
- * changes: Updates for 8.5.6 release.
+ * library/xmfbox.tcl (MotifFDialog_ActivateSEnt): Ensure that the
+ * library/tkfbox.tcl (Done): dialogs have the
+ correct levels for [upvar] for accessing the -typevariable var.
-2008-12-22 Joe English <jenglish@users.sourceforge.net>
+2009-04-13 Donal K. Fellows <dkf@users.sf.net>
- * generic/ttk/ttkWidget.c: Don't crash when
- application uses nondefault visual [Bug 2264732]
- (Backport from trunk change 2008-11-11)
- * Workaround for [Bug 2207435]
- (Backport from trunk change 2008-10-31).
+ * library/tk.tcl: Corrected another problem; can't determine the exact
+ type of OS - needed for figuring out how to guess the correct binding
+ in some circumstances - in a safe interpreter.
-2008-12-22 Donal K. Fellows <dkf@users.sf.net>
+ * library/tkfbox.tcl: [Bug 2759119]: Corrected level handling for the
+ * library/xmfbox.tcl: -typevariable option following updates to tk.tcl
+ [Patch 2739360]: Use more modern images from Tango set for the non-
+ Motif file dialog. Thanks to Emiliano for bring this to my attention.
- * generic/tkCanvPs.c (Tk_PostscriptFont,TkCanvPostscriptCmd): Backport
- of font size and reflection fix. [Bug 2107938]
+2008-04-10 Joe English <jenglish@users.sourceforge.net
-2008-12-22 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
+ * library/palette.tcl (tk_setPalette): Don't set *selectColor:
+ #b03060; this makes radio- and checkbuttons look wrong post-TIP#109.
- * generic/tkCanvUtil.c: Backport of the Millipeter patch [1813597,
- * generic/tkInt.h: 2218964]
- * generic/tkObj.c:
- * generic/tkText.c:
+2009-04-10 Daniel Steffen <das@users.sourceforge.net>
-2008-12-21 Don Porter <dgp@users.sourceforge.net>
+ * unix/configure.in (Darwin): Use Darwin SUSv3 extensions if
+ available.
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
- * generic/tk.h: Bump to 8.5.6 for release.
- * library/tk.tcl:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in:
- * README:
+ * library/demos/filebox.tcl: Only show "Motif Style Dialog"
+ checkbutton on X11 windowingsystem.
- * unix/configure: autoconf-2.59
- * win/configure:
+ * library/demos/widget: GOOBE: use ttk::cursor
- * changes: Updates for 8.5.6 release.
+ * library/demos/knightstour.tcl: Fix knightstour demo not running from
+ interactive wish.
-2008-11-22 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * library/console.tcl (::tk::ConsoleInit): Remove redundant TkAqua
+ Quit menu item.
- * library/ttk/combobox.tcl: [Bug 1939129,1991930] combobox dropdown
- was drawn behind topmost toplevels.
+ * generic/tkPointer.c (Tk_UpdatePointer): Use all 5 buttons.
-2008-11-19 Jan Nijtmans <nijtmans@users.sf.net>
+ * generic/tkMenu.c (PostProcessEntry): Delay call to
+ TkpConfigureMenuEntry() until all menu entry attributes are setup.
- * generic/tkImage.c Relax the constraint that every Tk_ImageType
- * generic/tkImgPhoto.c can only be passed to this function once.
- This allows tkImg to be loaded in multiple
- interpreters in a thread-enabled build of Tk.
- [Bug 2312027]
+ * library/menu.tcl (::tk::MbPost): Fix error thrown in y position
+ computation with indicatoron.
-2008-11-15 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * generic/tkMenubutton.c: s/DEF_BUTTON_JUSTIFY/DEF_MENUBUTTON_JUSTIFY/
- * generic/tk.h: The tip 125 implementation permits the
- * generic/tkFrame.c: wm manage command to manage any widget but
- * macosx/tkMacOSXWm.c: only those with Frame instance data should
- * unix/tkUnixWm.c: be permitted. We now check for the suitability
- * win/tkWinWm.c: and raise an error for non-frame widgets.
- * test/wm.test: Updated the tests and documentation.
- * doc/wm.n: See also [Bug 2239034]
+ * generic/tkUtil.c (TkBackgroundEvalObjv): Use Tcl_BackgroundException
-2008-11-12 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * generic/tkTextBTree.c (TkBTreeDeleteIndexRange): Add bounds check
+ to startEnd array access (fixes testsuite crash).
- * tests/constraints.tcl: backported listbox test fix from head
- * tests/listbox.test: the default on windows is 'underline'
- * tests/winDialog.test: backported some fixes from head
- * library/text.tcl: Backported fix for bug #1777362 to have events
- * test/text.test: work with window paths that include hyphens.
+ * tests/unixFont.test: Only use xlsfonts with X11 windowingsystem.
-2008-10-23 Don Porter <dgp@users.sourceforge.net>
+2009-04-10 Donal K. Fellows <dkf@users.sf.net>
- * generic/tk.h: Bump version number to 8.5.6b1 to distinguish
- * library/tk.tcl: CVS development snapshots from the 8.5.5 and
- * unix/configure.in: 8.5.6 releases.
- * unix/tk.spec:
- * win/configure.in:
- * README:
+ * library/tk.tcl: [Bug 2116837]: Add event definitions to handle the
+ standard virtual events when Caps Lock is on.
- * unix/configure: autoconf (2.59)
- * win/configure:
+2009-04-08 Donal K. Fellows <dkf@users.sf.net>
-2008-10-17 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * library/demos/widget (addFormattedText): Stop marking demonstrations
+ as new for 8.6; that label is for wholly new demos.
- * library/ttk/scale.tcl: Backported keyboard bindings for ttk::scale
+2009-04-04 Donal K. Fellows <dkf@users.sf.net>
-2008-10-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * doc/messageBox.n: [Bug 1881896]: Reworded to be clearer on what the
+ platform restrictions really are.
- *** 8.5.5 TAGGED FOR RELEASE ***
+2009-04-03 Joe English <jenglish@users.sourceforge.net>
- * generic/tkCanvas.c (CanvasWidgetCmd): Corrected result generation.
+ * unix/tkUnixWm.c: [Bug 1789819]: Don't panic when the window manager
+ does something unexpected with the stacking order.
-2008-10-10 Don Porter <dgp@users.sourceforge.net>
+2009-04-03 Donal K. Fellows <dkf@users.sf.net>
- * generic/tk.h: Bump to 8.5.5 for release.
- * library/tk.tcl:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in:
+ * doc/TextLayout.3: [Bug 974421]: Clarified description of how result
+ of lookup of a point after end of layout relates to the underlying
+ string's length.
- * unix/configure: autoconf-2.59
- * win/configure:
+2009-04-02 Pat Thoyts <patthoyts@users.sourceforge.net>
- * changes: Updates for 8.5.5 release.
+ * tests/textTag.test: Ensure the pointer begins outside the window for
+ all the tests checking Enter/Leave motion events.
- * unix/Makefile.in: Relax constraints in index script so that
- * win/Makefile.in: each Tk 8.5.* release may be [package require]d
- * win/makefile.vc: into any Tcl 8.5.* interp. [Bug 1890438].
+ * library/demos/pendulum.tcl: Use unicode labels
+ * library/demos/knightstour.tcl: Use polygon knight on x11.
-2008-10-09 Don Porter <dgp@users.sourceforge.net>
+2009-03-31 Donal K. Fellows <dkf@users.sf.net>
- * generic/tkListbox.c: Make literal return values consistent with
- those generated by Tcl_PrintDouble().
+ * library/demos/mclist.tcl: Added support for arrow indicators to show
+ which way a column is being sorted. Corrected determination of which
+ fonts to use for measurements.
- * tests/canvText.test: Backport test updates in light of the
- * tests/entry.test: 2008-10-05 commit.
- * tests/listbox.test:
- * tests/scrollbar.test:
- * tests/spinbox.test:
- * tests/textDisp.test:
+2009-03-25 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkEntry.c: Fix missing space constructing the scroll
- command.
+ * doc/wish.1: Bring doc and demos in line with
+ * library/demos/hello: http://wiki.tcl.tk/812
+ * library/demos/rmt
+ * library/demos/square
+ * library/demos/tcolor
+ * library/demos/timer
+ * library/demos/widget
+ * win/tkWinMenu.c: Eliminate a few compiler warnings on mingw
+ * win/ttkWinXPTheme.c: Spacing
-2008-10-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2009-03-25 Donal K. Fellows <dkf@users.sf.net>
- * win/tkWinScrlbr.c: Convert 'sprintf(..."%g"...)' to the
- * macosx/tkMacOSXScrlbr.c: locale-insensitive Tcl_PrintDouble.
- * generic/tkScrollbar.c: [Bug 2112563] NOTE: Tcl_PrintDouble
- * generic/tkListbox.c: is sensitive to the value of
- * generic/tkEntry.c: ::tcl_precision.
- * generic/tkCanvText.c: *** POTENTIAL INCOMPATIBILITY ***
- * generic/tkArgv.c:
+ * generic/ttk/ttkTheme.c (BuildOptionMap, NewElementClass):
+ [Bug 2178820]: Ensure that zero-size allocations don't happen; some
+ malloc implementations don't like it at all.
-2008-08-25 Todd M. Helfter <tmh@users.sourceforge.net>
+ * win/wish.exe.manifest.in: [Bug 1871101]: Add magic to make Tk not be
+ blurred on Vista with large fonts.
- * library/menu.tcl: additional fix for [Bug 1023955]
+2009-03-14 Donal K. Fellows <dkf@users.sf.net>
-2008-09-08 Todd M. Helfter <tmh@users.sourceforge.net>
+ * unix/tk.pc.in (new file): [Patch 2243962] (hat0)
+ * unix/configure.in, unix/Makefile.in: Added support for reporting
+ Tk's public build configuration via the pkg-config system. TEA is
+ still the official mechanism though, in part because pkg-config is not
+ universally supported across all Tk's supported platforms.
- * doc/menu.n: fix typo in docs [Bug 2098425]
+2009-03-10 Donal K. Fellows <dkf@users.sf.net>
-2008-08-28 Don Porter <dgp@users.sourceforge.net>
+ * doc/event.n: Tidy up and improve examples.
- * unix/tkConfig.sh.in: Added @XFT_LIBS@ to the definition of TK_LIBS
- to avoid link failures when a "big wish" program links against a
- --disable-shared build of libtk. (Discovered building expectTk).
+2009-03-09 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
- * generic/tk.h: Bump version number to 8.5.5b1 to distinguish
- * library/tk.tcl: CVS development snapshots from the 8.5.4 and
- * unix/configure.in: 8.5.5 releases.
- * unix/tk.spec:
- * win/configure.in:
- * README:
+ * tkMacOSXFont.c (GetFontFamilyName): [Bug 2548661]: Handle NULL
+ return from CFStringCreate.
- * unix/configure: autoconf (2.59)
- * win/configure:
+2009-02-27 Jan Nijtmans <nijtmans@users.sf.net>
-2008-08-25 Todd M. Helfter <tmh@users.sourceforge.net>
+ * doc/GetBitmap.3 [Feature Request 2636558]: Tk_DefineBitmap
+ * generic/tk.decls and Tk_GetBitmapFromData signature problem
+ * generic/tkInt.decls
+ * generic/tkBitmap.c
+ * generic/tkInt.h
+ * generic/tkStubInit.c
+ * generic/tkDecls.h: (regenerated)
+ * generic/tkIntDecls.h: (regenerated)
+ * macosx/tkMacOSXBitmap.c
- * library/menu.tcl: fix typo from [Bug 1023955]
+2009-02-27 Pat Thoyts <patthoyts@users.sourceforge.net>
-2008-08-25 Todd M. Helfter <tmh@users.sourceforge.net>
+ * generic/tkWindow.c: [Bug 2645457]: Check for dead windows after
+ calling Tk_MakeWindowExist to avoid a crash when mapping dead windows.
- * library/menu.tcl : Do not flip to the arrow cursor on menus.
- This was a Motif convention. Current behavior is maintained if
- tk_strictMotif is enabled. [Bug 1023955]
+2009-02-23 Pat Thoyts <patthoyts@users.sourceforge.net>
-2008-08-25 Todd M. Helfter <tmh@users.sourceforge.net>
+ * win/rc/*.cur: [Patch 2513104]: Fix cursor hotspots (cjmcdonald)
- The patch is associated with the bug tracker id: 1936220
- library/tkfbox.tcl : fix the multiple selection error for
- tk_getOpenFile -multiple 1 which fails on all unix platforms since
- the adoption of ttk widgets.
+ * win/tkWinMenu.c: Applied patch for menu image display bug.
+ [Bug 1329198, 456299] [Patch 2507419] (cjmcdonald)
-2008-08-19 Joe English <jenglish@users.sourceforge.net>
+2009-02-22 Pat Thoyts <patthoyts@users.sourceforge.net>
- * generic/ttk/ttkScroll.c: Don't use sprintf "%g" to
- format floating point numbers in -[xy]scrollcommand callbacks
- or [xy]view methods. Minor incompatibility: 0 and 1 now
- formatted as "0.0" resp "1.0".
- * tests/ttk/entry.test, tests/ttk/treeview.test: Updated
- to account for above change.
+ * win/tkWinCursor.c: Applied patch to support stock Win32 help arrow
+ cursor when question_arrow requested [Patch 2542828] (danckaert)
-2008-08-19 Daniel Steffen <das@users.sourceforge.net>
+2009-02-21 Pat Thoyts <patthoyts@users.sourceforge.net>
- * macosx/tkMacOSXFont.c (SetFontFeatures): Disable antialiasing of
- fixed-width fonts with
- size <= 10.
+ * library/ttk/vistaTheme.tcl: Correct the ttk::treeview border on
+ * win/ttkWinXpTheme.c: XP and vista.
-2008-08-14 Daniel Steffen <das@users.sourceforge.net>
+ * library/console.tcl: [Bug 2546087]: In 2004 a fix to Tcl channels
+ prevented the exposure of the internal UTF-8 representation of the
+ ASCII NUL character (\uc080). Since then strings in the console have
+ been truncated at NUL. This restores the older behaviour.
- *** 8.5.4 TAGGED FOR RELEASE ***
+2009-02-17 Jeff Hobbs <jeffh@ActiveState.com>
- * unix/tcl.m4 (SC_PATH_X): check for libX11.dylib in addition to
- libX11.so et al.
+ * win/tcl.m4, win/configure: Check if cl groks _WIN64 already to avoid
+ CC manipulation that can screw up later configure checks. Use 'd'ebug
+ runtime in 64-bit builds.
- * unix/configure: autoconf-2.59
+2009-02-16 Jeff Hobbs <jeffh@ActiveState.com>
-2008-08-08 Don Porter <dgp@users.sourceforge.net>
+ * win/configure.in, win/configure: Align better with tcl version.
+ Ensures finding correct CPP for Win64.
- * generic/tk.h: Bump to 8.5.4 for release.
- * library/tk.tcl:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in:
- * README:
+2009-02-16 Donal K. Fellows <dkf@users.sf.net>
- * unix/configure: autoconf-2.59
- * win/configure:
+ * doc/ttk_intro.n: [Bug 2604420]: Improve wording so that this page
+ feels less obviously incomplete.
- * changes: Updates for 8.5.4 release.
+2009-02-12 Donal K. Fellows <dkf@users.sf.net>
-2008-08-05 Joe English <jenglish@users.sourceforge.net>
+ * library/iconlist.tcl: Split out the IconList megawidget from
+ tkfbox.tcl into its own file so as to make it easier to maintain. Also
+ cleans up the API for the megawidget, making it more like a
+ conventional Tk widget.
- * generic/tk.h, generic/tkEvent.c: Fix for [Bug 2010422]
- "no event type or button # or keysym while executing
- "bind Listbox <MouseWheel> [...]".
+2009-02-11 Donal K. Fellows <dkf@users.sf.net>
-2008-08-01 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * library/demos/items.tcl, .../label.tcl, .../twind.tcl:
+ * library/demos/images/ouster.png: [Bug 2588919]: Demo GOOBE. Added
+ new image of John Ousterhout that does not look quite so massively out
+ of date, and also showed off a bit of how we can adjust PNG images
+ when loading them. Also labeled JO as the creator; it's the TCT who
+ are the proprietors now.
- * win/tkWinWm.c: Backported fixes for handling unmapped parent
- * test/wm.test: toplevels. [Bug 2009788, 2028703]
+2009-02-10 Jan Nijtmans <nijtmans@users.sf.net>
-2008-07-31 Don Porter <dgp@users.sourceforge.net>
+ * unix/tcl.m4: [Bug 2502365]: Building of head on HPUX was broken when
+ using the native CC.
+ * unix/configure (autoconf-2.59)
- * generic/tk.h: Added missing EXTERN for the Tcl_PkgInitStubsCheck
- declaration to fix inability to embed non-stub-enabled Tk on Windows.
+2009-02-08 Joe English <jenglish@users.sourceforge.net>
-2008-07-26 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * generic/ttk/*.[ch]: Renamed several internal data structures and
+ functions: ElementImpl -> ElementClass, LayoutNode -> Element. Remove
+ more unnecessary casts. Add function Ttk_ClientRegion, common factor
+ of entry, scale, progress, and treeview widgets.
+ * generic/ttk/ttkTrack.c: Fix [Bug 2431428].
- * doc/options.n: Direct to the font manual for -font [Bug 1686012]
+2009-02-06 Daniel Steffen <das@users.sourceforge.net>
- * win/tkWinWindow.c: Check for 0x prefix in sprintf %p. Bug [2026405]
+ * generic/tkImgPhInstance.c: Fix numerous leaks discovered with the
+ * generic/tkMenu.c: Mac OS X Instruments.app Leaks tool.
+ * generic/tkText.c:
+ * generic/tkTextImage.c:
+ * generic/tkTextIndex.c:
+ * generic/tkUndo.c:
+ * generic/tkUtil.c:
+ * generic/ttk/ttkFrame.c:
+ * macosx/tkMacOSXWm.c:
-2008-07-22 Daniel Steffen <das@users.sourceforge.net>
+2009-01-29 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkCanvArc.c - eliminate some unnessary type casts
+ * generic/tkCanvBmap.c - some internal const decorations
+ * generic/tkCanvImg.c - spacing
+ * generic/tkCanvWind.c
+ * generic/tkCmds.c
+ * generic/tkConfig.c
+ * generic/tkEntry.c
+ * generic/tkFocus.c
+ * generic/tkFont.c
+ * generic/tkFrame.c
+ * generic/tkGrab.c
+ * generic/tkGrid.c
+ * generic/tkImage.c
+ * generic/tkListbox.c
+ * generic/tkObj.c
+ * generic/tkOption.c
+ * generic/tkPack.c
+ * generic/tkPanedWindow.c
+ * generic/tkRectOval.c
+ * generic/tkSelect.c
+ * generic/tkText.c
+ * generic/tkTextMark.c
+ * generic/tkTextTag.c
- * library/ttk/aquaTheme.tcl: Use system color names and TIP145 named
- font instead of hardcoded color values and deprecated native font name.
+2009-01-28 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/ttk/ttkCache.c: - eliminate some unnessary type casts
+ * generic/ttk/ttkLayout.c - some internal const decorations
+ * generic/ttk/ttkState.c - spacing
+ * generic/ttk/ttkTheme.c
+ * macosx/tkMacOSXMenu.c
+ * macosx/tkMacOSXPrivate.h
+ * unix/tkUnixFont.c
+ * unix/tkUnixMenu.c
+ * unix/tkUnixWm.c
+ * win/tkWinColor.c
+ * win/tkWinDialog.c
+ * win/tkWinFont.c
+ * win/tkWinMenu.c
+ * win/tkWinSend.c
+ * win/tkWinWindow.c
+ * win/tkWinWM.c
- * macosx/tkMacOSXHLEvents.c: sync with HEAD.
+2009-01-22 Kevin B. Kenny <kennykb@acm.org>
-2008-07-04 Joe English <jenglish@users.sourceforge.net>
+ * unix/tcl.m4: Corrected a typo ($(SHLIB_VERSION) should be
+ ${SHLIB_VERSION}).
+ * unix/configure: Autoconf 2.59
- * generic/ttk/ttkDefaultTheme.c, generic/ttk/ttkClamTheme.c,
- generic/ttk/ttkClassicTheme.c, generic/ttk/ttkElements.c:
- Backport [Bug 2009213].
+2009-01-19 Kevin B. Kenny <kennykb@acm.org>
-2008-06-29 Don Porter <dgp@users.sourceforge.net>
+ * unix/Makefile.in: Added a CONFIG_INSTALL_DIR parameter so that
+ * unix/tcl.m4: distributors can control where tclConfig.sh goes.
+ Made the installation of 'ldAix' conditional upon actually being on an
+ AIX system. Allowed for downstream packagers to customize
+ SHLIB_VERSION on BSD-derived systems.
+ Thanks to Stuart Cassoff for [Patch 907924].
+ * unix/configure: Autoconf 2.59
- *** 8.5.3 TAGGED FOR RELEASE ***
+2009-01-16 Don Porter <dgp@users.sourceforge.net>
- * generic/tk.h: Bump to 8.5.3 for release.
- * library/tk.tcl:
- * unix/configure.in:
- * unix/tk.spec:
+ * generic/tk.h: Bump patchlevel to 8.6b1.1 to distinguish
+ * library/tk.tcl: CVS snapshots from the 8.6b1 and 8.6b2
+ * unix/configure.in: releases.
* win/configure.in:
- * README:
* unix/configure: autoconf-2.59
* win/configure:
- * changes: Updates for 8.5.3 release.
-
-2008-06-26 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkPanedWindow.c (PanedWindowProxyCommand)
- (DisplayPanedWindow): Ensure that a zero width never gets fed to the
- underlying window system. [Bug 1639824] (Backport fix from dkf).
-
-2008-06-20 Joe English <jenglish@users.sourceforge.net>
-
- * library/ttk/treeview.tcl: Backport fix for [Bug 1951733]
-
-2008-06-19 Don Porter <dgp@users.sourceforge.net>
-
- * changes: Updates for 8.5.3 release.
-
-2008-06-18 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXCarbonEvents.c: fix debug carbon event tracing;
- (InstallStandardApplicationEventHandler): replace needless use of
- TkMacOSXInitNamedDebugSymbol() by standard TkMacOSXInitNamedSymbol().
-
- * macosx/tkMacOSXDebug.c: revert 2007-11-09 commit making
- * macosx/tkMacOSXDebug.h: TkMacOSXInitNamedDebugSymbol()
- available outside of debug builds.
-
- * macosx/tkMacOSXEmbed.c (TkpMakeWindow): fix bug with missing
- * macosx/tkMacOSXSubwindows.c (XMapWindow): focus on first map by
- only sending VisibilityNotify events once windows are mapped (rather
- than when they are created).
-
- * macosx/tkMacOSXWindowEvent.c (TkMacOSXProcessWindowEvent): fix
- return value.
-
- * macosx/tkMacOSXInit.c: add helper to efficiently convert from
- * macosx/tkMacOSXPrivate.h: CFString to Tcl_Obj.
-
- * macosx/tkMacOSXFont.c (TkpGetFontFromAttributes, InitFont): fix
- incorrect conversion to points of font sizes already in points; factor
- out retrieval of font family name from font family ID.
-
-2008-06-13 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/configure, win/configure.in (TK_WIN_VERSION): fix handling
- of interim a/b versioning for manifest usage.
-
-2008-06-12 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkPointer.c (Tk_UpdatePointer): fix failure to restore a
- global grab capture and to release the restrict window capture when
- releasing a button grab. Fixes segfault due to dangling reference to
- restrict window inside TkpSetCapture() implementation. [Bug 1991932]
-
- * unix/tcl.m4 (SunOS-5.11): fix 64bit amd64 support with gcc & Sun cc.
- * unix/configure: autoconf-2.59
-
- * macosx/tkMacOSXXStubs.c (Tk_ResetUserInactiveTime): use UsrActivity
- instead of OverallAct (which may be ignored in some circumstances).
-
- * macosx/Wish.xcodeproj/project.pbxproj: add debug configs for 64bit,
- * macosx/Wish.xcodeproj/default.pbxuser: with gcov, and with
- corefoundation disabled; updates & cleanup for Xcode 3.1 and for
- Leopard; sync with Tcl.xcodeproj.
- * macosx/Wish.xcode/project.pbxproj: sync Wish.xcodeproj changes.
- * macosx/Wish.xcode/default.pbxuser:
- * macosx/README: document new build configs.
-
-2008-06-10 Joe English <jenglish@users.sourceforge.net>
-
- * unix/tkUnixKey.c: tkUnixKey.c: Use Xutf8LookupString if available
- [Patch #1986818]. This should fix problems (like #1908443) where
- Xlib's idea of the system encoding does not match Tcl's.
-
-2008-05-23 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/ttkLabel.c: Avoid passing width or height <= 0 to
- Tk_RedrawImage, as this leads to a panic on Windows [Bug 1967576]
-
-2008-05-11 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * library/tk.tcl: Support for ttk widgets in AmpWidget
-
- * doc/button.n: Note negative widths for button [Patch #1883418]
- * doc/ttk_*: 'identify' widget command is on all ttk widgets.
-
-2008-05-04 Joe English <jenglish@users.sourceforge.net>
-
- * macosx/ttkMacOSAquaTheme.c: "default" and "focus" adornments
- should not be disjoint [Bug 1942785]
-
-2008-04-17 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkCanvas.c: Fix logic that determines when canvas item
- <Enter> event should fire. Thanks to Sebastian Wangnick. [Bug 1327482]
-
-2008-04-14 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/tkWinDialog.c: backport tk_chooseColor -title fix from head
- * win/tkWinTest.c: Added parent to testgetwininfo
- * tests/winDialog.test: Created some tk_chooseColor win tests.
-
-2008-04-11 Don Porter <dgp@users.sourceforge.net>
+2009-01-14 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tk.h: Bump version number to 8.5.3b1 to distinguish
- * library/tk.tcl: CVS development snapshots from the 8.5.2 and
- * unix/configure.in: 8.5.3 releases.
- * unix/tk.spec:
- * win/configure.in:
+ * generic/tkImgPhoto.c: [Bug 2507326]: Fix for aMSN compatibility
+ * generic/tkMenu.h: CONSTify Tk(Create|Find)MenuReferences
+ * generic/tkMenu.c: various internal "const" decorations.
- * unix/configure: autoconf (2.59)
- * win/configure:
+2009-01-13 Jan Nijtmans <nijtmans@users.sf.net>
-2008-04-07 Jeff Hobbs <jeffh@ActiveState.com>
+ * unix/tcl.m4: [Bug 2502365]: Building of head on HPUX was broken when
+ using the native CC
+ * unix/configure (autoconf-2.59)
- * generic/tkWindow.c (Initialize): fix double-free on Tk_ParseArgv
- * tests/main.test (main-3.*): error. [Bug 1937135]
+2009-01-13 Pat Thoyts <patthoyts@users.sourceforge.net>
- * generic/tkArgv.c: fix -help mem explosion. [Bug 1936238] (kenny)
+ * tests/constraints.tcl: Made the tests more independent of the
+ * tests/*.test: presence of images in the interpreter.
-2008-04-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+2009-01-11 Pat Thoyts <patthoyts@users.sourceforge.net>
- * library/ttk/xpTheme.tcl: fix the colour of labelframe in xp
+ * tests/bind.test: Fixed keysym bind tests for unix [Bug 2336454]
-2008-04-01 Don Porter <dgp@users.sourceforge.net>
+2009-01-11 George Peter Staplin <georgeps@users.sourceforge.net>
- * generic/tkStubLib.c (Tk_InitStubs): Added missing error message.
- * generic/tkWindow.c (Tk_PkgInitStubsCheck):
+ * generic/tkEvent.c: Fix a possible segv due to a NULL pointer
+ dereference that occurs when XCreateIC fails.
-2008-03-28 Don Porter <dgp@users.sourceforge.net>
+2009-01-11 Pat Thoyts <patthoyts@users.sourceforge.net>
- *** 8.5.2 TAGGED FOR RELEASE ***
-
- * README: Bump to 8.5.2 for release.
- * generic/tk.h:
+ * library/bgerror.tcl: Pretty up the unix tk_messageBox icons with PNG
+ * library/icons.tcl: images and grouped all the stock icons in one
+ * library/msgbox.tcl: file.
* library/tk.tcl:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in:
-
- * unix/configure: autoconf-2.59
- * win/configure:
- * changes: Updates for 8.5.2 release.
-
-2008-03-27 Jeff Hobbs <jeffh@ActiveState.com>
+2009-01-11 Joe English <jenglish@users.sourceforge.net>
- * library/safetk.tcl (::safe::tkInterpInit): make sure tk_library
- and its subdirs (eg, ttk) are on the "safe" access path.
-
-2008-03-27 Daniel Steffen <das@users.sourceforge.net>
+ * generic/ttk/ttkNotebook.c (NotebookCleanup): [Bug 2496162]: Don't
+ call Tk_DeleteOptionTable(), it's unnecessary and quite possibly
+ harmful.
- * unix/tcl.m4 (SunOS-5.1x): fix 64bit support for Sun cc. [Bug 1921166]
+2009-01-08 Jan Nijtmans <nijtmans@users.sf.net>
- * unix/configure: autoconf-2.59
+ * generic/tk3d.c: CONSTify TkDebugBorder
+ * generic/tkBind.c: CONSTify TkStringToKeysym
+ * generic/tkBitmap.c: CONSTify TkDebugBitmap
+ * generic/tkColor.c: CONSTify TkDebugColor
+ * generic/tkCursor.c: CONSTify TkDebugCursor
+ * generic/tkFont.c: CONSTify TkDebugFont
+ * generic/tkInt.decls All those mods TIP #27 complient,
+ no incompatibility risks.
+ * generic/tkIntDecls.h (regenerated)
-2008-03-27 Daniel Steffen <das@users.sourceforge.net>
+2009-01-08 Pat Thoyts <patthoyts@users.sourceforge.net>
- * generic/ttk/ttkStubLib.c: ensure tcl stubs are used in libtkstub
- even in a static build of Tk.
- * generic/ttk/ttkDecls.h: fix incorrect number of arguments in
- Ttk_InitStubs macro definition.
+ * library/bgerror.tcl: Theme the bgerror dialog and make use of our
+ PNG support to improve the icon.
-2008-03-26 Don Porter <dgp@users.sourceforge.net>
-
- * changes: Updates for 8.5.2 release.
-
- * unix/tkUnixCursor.c: Stop crash in [. configure -cursor] on X11.
- Thanks to emiliano gavilán. [Bug 1922466]
-
-2008-03-26 Joe English <jenglish@users.sourceforge.net>
-
- * generic/tkInt.h, generic/tkEvent.c, unix/tkUnixEvent.c,
- unix/tkUnixKey.c: XIM reorganization and cleanup; see
- [Patch 1919791] for details.
-
-2008-03-21 Joe English <jenglish@users.sourceforge.net>
-
- * generic/tk.decls, generic/ttk/ttkStubLib.c, unix/Makefile.in:
- Keep ttkStubLib.o in libtkstub instead of libtk. [Bug 1920030]
-
-2008-03-20 Donal K. Fellows <dkf@users.sf.net>
-
- * tests/wm.test: Rewrote so that tests clean up after themselves
- rather than leaving that to the following test. Makes it easier to
- catch problems where they originate. Inspired by [Bug 1852338]
-
-2008-03-19 Donal K. Fellows <dkf@users.sf.net>
-
- * doc/GetClrmap.3: Documented Tk_PreserveColormap. [Bug 220809]
-
-2008-03-17 Joe English <jenglish@users.sourceforge.net>
-
- * unix/Makefile.in, win/Makefile.in, win/makefile.vc: Put ttkStubLib.o
- in libtkstub instead of libtk. [Bug 1863007]
-
-2008-03-16 Donal K. Fellows <dkf@users.sf.net>
-
- * library/demos/goldberg.tcl: Made work when run twice in the same
- session. [Bug 1899664] Also made the control panel use Ttk widgets.
-
-2008-03-13 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/configure.in: Use backslash-quoting instead of double-quoting
- * unix/tcl.m4: for lib paths in tkConfig.sh. [Bug 1913622]
- * unix/configure: autoconf-2.59
-
-2008-03-13 Don Porter <dgp@users.sourceforge.net>
-
- * changes: Updates for 8.5.2 release.
+2009-01-07 Pat Thoyts <patthoyts@users.sourceforge.net>
-2008-03-12 Daniel Steffen <das@users.sourceforge.net>
+ * library/tkfbox.tcl: [Bug 2473120]: Mis-ordered messagebox args.
- * macosx/Wish.xcodeproj/project.pbxproj: Add support for Xcode 3.1
- * macosx/Wish.xcodeproj/default.pbxuser: CODE_SIGN_IDENTITY and
- * macosx/Wish-Common.xcconfig: 'xcodebuild install'.
-
-2008-03-12 Joe English <jenglish@users.sourceforge.net>
+ * win/tkWinWm.c: [Bug 1847002]: Prevent grabs being bypassed on
+ Windows.
- * unix/tkUnixRFont.c: Try a fallback font if XftFontOpenPattern()
- fails in GetFont (workaround for [Bug 1090382]).
+2009-01-06 Jan Nijtmans <nijtmans@users.sf.net>
-2008-03-11 Daniel Steffen <das@users.sourceforge.net>
+ * generic/tk.h: A few const -> CONST86 modifications,
+ * generic/tkCanvas.c: improving backwards compatibility. Change
+ * generic/tkCanvLine.c: Tk_ItemIndexProc and Tk_ItemInsertProc
+ * generic/tkCanvPoly.c: signature to have a Tcl_Obj parameter instead
+ * generic/tkCanvText.c: of a string parameter. This is binary and
+ * doc/CrtItemType.3: source compatible with previous API, it just
+ * doc/Clipboard.3: prevents the need for a type cast in the
+ * doc/ConfigWidg.3: Tk_ItemType table construction. Bring doc in
+ * doc/ParseArgv.3: line with API.
- * library/demos/knightstour.tcl: Aqua GOOBE.
- * library/demos/widget:
+2009-01-06 Donal K. Fellows <dkf@users.sf.net>
- * macosx/Wish.xcodeproj/project.pbxproj: Add support for Xcode 3.1 and
- * macosx/Wish.xcodeproj/default.pbxuser: configs for building with
- * macosx/Wish-Common.xcconfig: gcc-4.2 and llvm-gcc-4.2.
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock): Optimize a common case for
+ photo image building. [Patch 1539990] (jepler)
- * generic/tkCanvUtil.c: Fix gcc-4.2 warnings.
+2009-01-06 Pat Thoyts <patthoyts@users.sourceforge.net>
- * macosx/GNUmakefile: Fix quoting to allow paths to
- * macosx/Wish-Common.xcconfig: ${builddir}, ${INSTALL_ROOT}
- * unix/Makefile.in: and ${TCL_BIN_DIR} to contain
- * unix/configure.in: spaces.
- * unix/install-sh:
- * unix/tcl.m4:
+ * win/tkWinDialog.c: Use task modal for messagebox instead of system
+ modal. [Bug 2484771] (ferrieux,thoyts,mjanssen)
- * unix/configure: autoconf-2.59
+2009-01-03 Donal K. Fellows <dkf@users.sf.net>
- * unix/Makefile.in (install-strip): Strip non-global symbols from
- dynamic library.
+ * doc/canvas.n: [Bug 1836621]: Improve the documentation of the
+ -offset and -outlineoffset item options.
-2008-03-10 Don Porter <dgp@users.sourceforge.net>
+2009-01-03 Jan Nijtmans <nijtmans@users.sf.net>
- * changes: Updates for 8.5.2 release.
+ * generic/tk.decls: CONSTify Tk_ClipboardAppend
+ * generic/tkClipboard.c:
+ * generic/tkDecls.h: (regenerated)
-2008-03-07 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2008-12-31 David Gravereaux <davygrvy@pobox.com>
- * doc/colors.n: Reworked to produce nicer HTML output.
+ * win/rules.vc: Small bug not setting SYMBOLS macro fixed.
-2008-03-06 Joe English <jenglish@users.sourceforge.net>
+2008-12-31 Joe English <jenglish@users.sourceforge.net>
- * doc/ttk_notebook.n: Move "TAB IDENTIFIERS" section above "WIDGET
- COMMAND" section. [Bug 1882011]
+ * generic/ttk/ttkDefaultTheme.c: Fix color palette for radiobutton and
+ checkbutton indicators. Fixes [Bug 2003310]; also makes "alt" theme
+ check/radiobuttons look like Windows 98, as intended.
+ * library/ttk/altTheme.tcl: Specify dark gray -bordercolor to soften
+ edges.
+ * tests/ttk/{checkbutton,radiobutton}.test: Split out of ttk.test.
-2008-02-29 Pat Thoyts <patthoyts@users.sourceforge.net>
+2008-12-28 Donal K. Fellows <dkf@users.sf.net>
- * library/demos/widget: Added a Knight's tour canvas demo.
- * library/demos/knightstour.tcl:
+ TIP #171 IMPLEMENTATION
-2008-02-27 Daniel Steffen <das@users.sourceforge.net>
+ * library/listbox.tcl, library/scrlbar.tcl, library/text.tcl: Adjust
+ users of the <MouseWheel> event to do the right thing horizontally as
+ well as vertically.
+ * win/tkWinX.c (GenerateXEvent): Redirect <MouseWheel> to the window
+ that contains the mouse.
+ * generic/tkEvent.c (InvokeFocusHandlers): Do not direct <MouseWheel>
+ through the focus mechanism.
+ *** POTENTIAL INCOMPATIBILITY *** for anyone counting on shift-wheel
+ to do something else (or nothing at all) or for the wheel events to be
+ following the keyboard on Win.
- * macosx/tkMacOSXDraw.c: workaround leak in Carbon SetPortPenPixPat()
- API [Bug 1863346]; avoid repeated PixPat allocation/deallocation.
+ * generic/tkImgPNG.c (ReadIDAT): Corrected code to transfer blocks of
+ compressed data into the Tcl_ZlibStream. Allows the reading of all
+ images from PngSuite set. Thanks to Michael Kirkham for fix/testing.
-2008-02-23 Joe English <jenglish@users.sourceforge.net>
+ TIP #244 IMPLEMENTATION
- * library/ttk/combobox.tcl, doc/ttk_combobox.n,
- * tests/ttk/combobox.test: Arrange to deliver <<ComboboxSelected>>
- event after listbox is unposted, as intended [Bug 1890211]. Clarified
- documentation.
+ * generic/tkImgPNG.c, tests/imgPNG.test, doc/photo.n: Adaptation of
+ tkpng to the Tk core, proving support for PNG image reading and
+ writing, based on Tcl's zlib support.
-2008-02-23 Joe English <jenglish@users.sourceforge.net>
+2008-12-27 Joe English <jenglish@users.sourceforge.net>
- * generic/ttk/ttkPanedWindow.c: Don't enforce minimum sash thickness
- of 5 pixels, just use 5 as a default. [FR 1898288]
+ * generic/ttk/ttkTreeview.c: [Bug 2381555]: Fix inconsistent use of
+ treeArea / headingArea. ([$tv identify] didn't work when horizontally
+ scrolled).
-2008-02-14 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2008-12-21 Donal K. Fellows <dkf@users.sf.net>
- * unix/README: Documented missing configure flags.
+ * doc/canvas.n (postscript): Regularized documentation of -channel
+ option.
-2008-02-06 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2008-12-19 Don Porter <dgp@users.sourceforge.net>
- * doc/ttk_scale.n (new file): Added basic documentation. [Bug 1881925]
+ *** 8.6b1 TAGGED FOR RELEASE ***
-2008-02-04 Don Porter <dgp@users.sourceforge.net>
+ * changes: Updates for 8.6b1 release.
- *** 8.5.1 TAGGED FOR RELEASE ***
+ * tests/clrpick.test: Eliminate duplicate test names.
+ * tests/embed.test:
+ * tests/text.test:
+ * tests/textMark.test:
- * generic/tk.h: Bump to 8.5.1 for release.
+ * README: Bump version number to 8.6b1
+ * generic/tk.h:
* library/tk.tcl:
* unix/configure.in:
* unix/tk.spec:
@@ -2040,364 +3079,544 @@
* unix/configure: autoconf-2.59
* win/configure:
-2008-02-04 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * doc/MeasureChar.3, doc/FontId.3: Minor improvements (formatting,
- keywords).
-
-2008-02-02 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish-Info.plist.in: add CFBundleLocalizations key, listing
- * unix/configure.in (Darwin): all library/msgs locales.
-
- * unix/configure.in (Darwin): correct Info.plist year substitution in
- non-framework builds.
-
- * unix/configure: autoconf-2.59
-
-2008-02-01 Don Porter <dgp@users.sourceforge.net>
+2008-12-18 Don Porter <dgp@users.sourceforge.net>
- * changes: Updates for 8.5.1 release.
+ * library/msgs/de.msg: [Patch 2442309]: Updated German messages.
+ Thanks to Ruediger Haertel.
-2008-02-01 Reinhard Max <max@suse.de>
-
- * generic/tkImgGIF.c: Fixed a buffer overflow (CVE-2008-0553).
- * tests/imgPhoto.test: Added a test for the above.
+2008-12-17 Jan Nijtmans <nijtmans@users.sf.net>
-2008-01-31 Jeff Hobbs <jeffh@ActiveState.com>
+ * generic/tk.h: VOID --> void
+ * unix/tkUnixPort.h:
+ * macosx/tkMacOSXPort.h:
- * library/msgbox.tcl (::tk::MessageBox): don't use ttk::label in
- low depth/aqua fallback, as it doesn't support -bitmap.
+2008-12-17 Donal K. Fellows <dkf@users.sf.net>
- * win/tkWinDialog.c (Tk_MessageBoxObjCmd): pass "" instead of NULL
- when -title isn't set. [Bug 1881892]
+ * doc/selection.n: [Bugs 2441817,2441884]: Assorted small fixes.
-2008-01-31 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2008-12-16 Jan Nijtmans <nijtmans@users.sf.net>
- * doc/panedwindow.n: Added proper description of -height and -width
- options, which aren't "standard". Last of fallout from [Bug 1882495].
+ * win/tkWinDialog.c: Remove unused variables
-2008-01-30 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2008-12-15 Don Porter <dgp@users.sourceforge.net>
- * doc/canvas.n, doc/listbox.n, doc/message.n: Fix erroneous listing of
- "standard" options. [Bug 1882495]
+ TIP #338 IMPLEMENTATION
-2008-01-29 Joe English <jenglish@users.sourceforge.net>
+ * doc/Tk_Main.c: Removed the last two '#include "tclInt.h"'.
+ * generic/tkMain.c: Tk is now limited to Tcl's public interface.
+ * macosx/tkMacOSXInit.c:
- * library/treeview.tcl: Fix bug in Shift-ButtonPress-1 binding (error
- if no current focus item; reported on c.l.t.)
+2008-12-12 Pat Thoyts <patthoyts@users.sourceforge.net>
-2008-01-29 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * library/demos/fontchoose.tcl: Simple fontchooser demo.
+ * library/demos/widget:
- * doc/ttk_*.n: Adjusted handling of the standard options part of the
- Ttk manual pages so that they are documented in the correct location.
- [Bug 1876493]
+2008-12-11 Jan Nijtmans <nijtmans@users.sf.net>
-2008-01-28 Joe English <jenglish@users.sourceforge.net>
+ * generic/tk3d.c: Make error message from Tk_GetRelief the same
+ as for Tk_GetReliefFromObj.
+ * tests/canvas.test: Adapt test cases for changed error message.
+ * tests/scrollbar.test
+ * tests/textTag.test
- * unix/tkUnixRFont.c: Re-fix strict-aliasing warnings reintroduced by
- last patch.
+2008-12-11 Joe English <jenglish@users.sourceforge.net>
-2008-01-27 Joe English <jenglish@users.sourceforge.net>
+ * library/demos/*.tcl: Omit contraindicated [package require Ttk].
+ Remove logic that switches [ttk::scrollbar]s to [tk::scrollbar]s
+ based on [tk windowingsystem]; this is already handled in
+ library/ttk/scrollbar.tcl.
- * generic/ttk/ttkNotebook.c: Make sure to schedule a redisplay when
- adding and/or hiding tabs. [Bug 1878298]
+2008-12-10 Daniel Steffen <das@users.sourceforge.net>
-2008-01-27 Joe English <jenglish@users.sourceforge.net>
+ TIP #324 IMPLEMENTATION
- * unix/tkUnixRFont.c: Merged common code from InitFont() and
- TkpGetFontAttrsForChar(), factored into GetTkFontAttributes() and
- GetTkFontMetrics(). Removed write-only struct UnixFtFont member
- 'drawable'. Removed unneeded double-pointer indirections. Ensure that
- TkFontAttributes.family member is a Tk_Uid, as specified. Use
- FcTypeDouble for XFT_SIZE attribute. Finally: fix [Bug 1835848]
+ * generic/tkCmds.c: Implementation of [tk fontchooser] as
+ * generic/tkInt.h: a Ttk dialog for X11 and as a native
+ * win/tkWinDialog.c: platform dialog on Mac OS X & Windows.
+ * win/tkWinInt.h: (thoyts, vetter, robert, steffen)
+ * win/tkWinTest.c: [Patch 1477426]
+ * win/tkWinX.c:
+ * macosx/tkMacOSXCarbonEvents.c:
+ * macosx/tkMacOSXDialog.c:
+ * macosx/tkMacOSXEvent.c:
+ * macosx/tkMacOSXEvent.h:
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXFont.h:
+ * macosx/Wish.xcodeproj/project.pbxproj:
+ * library/fontchooser.tcl (new):
+ * library/tclIndex:
+ * library/msgs/de.msg:
+ * library/msgs/en.msg:
+ * tests/fontchooser.test (new):
+ * tests/winDialog.test:
+ * doc/fontchooser.n (new):
+ * doc/tk.n:
-2008-01-25 Don Porter <dgp@users.sourceforge.net>
+ * library/console.tcl: Let user select console font via
+ [tk fontchooser].
+ * library/demos/text.tcl: Add [tk fontchooser] demo.
- * changes: Updates for 8.5.1 release.
+ * generic/tkUtil.c: Add TkBackgroundEvalObjv() and
+ TkSendVirtualEvent() utility functions
+ (used by TIP #324 code).
-2008-01-08 Joe English <jenglish@users.sourceforge.net>
+ * generic/tkInt.h: Turn [tk] into an ensemble.
+ * generic/tkBusy.c: (thoyts, steffen)
+ * generic/tkCmds.c:
+ * generic/tkWindow.c:
- * generic/ttk/ttkFrame.c: BUGFIX: fix crash in [ttk::labelframe] when
- -style option specified. [Bug 1867122]
+ * macosx/tkMacOSXInit.c (TkpInit): Unconditionally show Tk console if
+ TK_CONSOLE env var is set.
-2008-01-08 Joe English <jenglish@users.sourceforge.net>
+2008-12-09 Don Porter <dgp@users.sourceforge.net>
- * win/ttkWinTheme.c: Add tristate support to checkbuttons and
- radiobuttons. [Bug 1865898]
- Fix check and radio indicator size. [Bug 1679067]
+ TIP #337 IMPLEMENTATION
-2008-01-06 Joe English <jenglish@users.sourceforge.net>
+ * generic/tkBind.c: Updated callers of Tcl_BackgroundError() to
+ * generic/tkCanvas.c: use the new routine
+ * generic/tkEntry.c: Tcl_BackgroundException() as appropriate.
+ * generic/tkImgBmap.c:
+ * generic/tkListbox.c:
+ * generic/tkSelect.c:
+ * generic/tkTextDisp.c:
+ * generic/tkTextWind.c:
+ * macosx/tkMacOSXHLEvents.c:
+ * macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXMenus.c:
+ * macosx/tkMacOSXScale.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * unix/tkUnixScale.c:
+ * unix/tkUnixWm.c:
+ * win/tkWinButton.c:
+ * win/tkWinMenu.c:
+ * win/tkWinScrlbr.c:
+ * win/tkWinWm.c:
- * generic/ttk/ttkWidget.c, generic/ttk/ttkWidget.h: Call
- Tk_MakeWindowExist() in widget constructor. Removed now-unnecessary
- initial ConfigureNotify processing.
+2008-12-07 Joe English <jenglish@users.sourceforge.net>
-2008-01-06 Joe English <jenglish@users.sourceforge.net>
+ * macosx/ttkMacOSXTheme.c: [Bug 2219588]: Add native aqua elements for
+ ttk::spinbox
+ * generic/ttk/ttkEntry.c, library/ttk/spinbox.tcl,
+ * tests/ttk/spinbox.test: Moved most spinbox "business logic" out of
+ ttkEntry.c into Tcl bindings.
+ * library/ttk/clamTheme.tcl: Minor spinbox appearance improvements.
+ * library/ttk/combobox.tcl, library/ttk/utils.tcl:
+ Factor out ttk::bindMouseWheel procedure.
+ * library/ttk/spinbox.tcl: Add cross-platform MouseWheel bindings.
- * library/ttk/treeview.tcl, library/ttk/utils.tcl: Fix MouseWheel
- bindings for ttk::treeview widget. [Bugs 1442006, 1821939, 1862692]
+2008-12-06 Donal K. Fellows <dkf@users.sf.net>
-2008-01-02 Don Porter <dgp@users.sourceforge.net>
+ TIP #197 IMPLEMENTATION
- * generic/tk.h: Bump version number to 8.5.1b1 to distinguish
- * library/tk.tcl: CVS development snapshots from the 8.5.0 and
- * unix/configure.in: 8.5.1 releases.
- * unix/tk.spec:
- * win/configure.in:
+ * generic/tkText.c (insertUnfocussedStrings, optionSpecs):
+ * generic/tkText.h (TkText, TkTextInsertUnfocussed):
+ * doc/text.n, tests/text.test:
+ Added definitions/tests/docs for "-insertunfocussed" field.
+ * generic/tkTextMark.c (TkTextInsertDisplayProc):
+ * generic/tkText.c (TextBlinkProc):
+ Added user-controlledrendering of insertion cursor when focus is not
+ in the text widget.
- * unix/configure: autoconf (2.59)
- * win/configure:
+2008-12-05 Pat Thoyts <patthoyts@users.sourceforge.net>
-2007-12-30 Donal K. Fellows <dkf@users.sf.net>
+ * library/ttk/ttk.tcl: Added vista theme to iron out the visual
+ * library/ttk/vistaTheme.tcl: differences between vista and XP.
+ * library/ttk/xpTheme.tcl:
+ * win/ttkWinXPTheme.c:
- * doc/canvas.n: Documented exact behaviour of items with respect to
- when they are the current item. [Bug 1774593] Also documented the
- clipping behaviour of window items.
+2008-12-05 Donal K. Fellows <dkf@users.sf.net>
- * library/demos/nl.msg: Corrected following testing "in the field" by
- Arjen Markus. [Bug 1860802]
+ * generic/tkCanvPs.c (Tk_PostscriptFont): [Bug 2107938]: Ensure that
+ font sizes can ever be negative; it triggers a really strange case
+ that is definitely not what is wanted.
+ * library/mkpsenc.tcl: Corrected and improved generation of postscript
+ * library/prolog.ps: prolog. Removed prolog.ps, which wasn't used and
+ was misleading.
-2007-12-17 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+2008-12-04 Jan Nijtmans <nijtmans@users.sf.net>
- *** 8.5.0 TAGGED FOR RELEASE ***
+ * generic/tkInt.decls: [FRQ 220906]: Move 10 functions from tkText.h
+ * generic/tkText.h: to stub table.
+ * generic/tkStubInit.c (regenerated)
+ * generic/tkIntDecls.h (regenerated)
- * doc/canvas.n: Documented -outlineoffset item option. [Bug 1836621]
+2008-12-04 Donal K. Fellows <dkf@users.sf.net>
-2007-12-14 Don Porter <dgp@users.sourceforge.net>
+ * doc/ttk_button.n, doc/ttk_checkbutton.n, doc/ttk_menubutton.n:
+ * doc/ttk_radiobutton.n: Added mention of the Toolbutton style to all
+ widgets that can sensibly make use of it.
- * changes: More updates for 8.5.0 release.
+2008-12-03 Joe English <jenglish@users.sourceforge.net>
-2007-12-14 Joe English <jenglish@users.sourceforge.net>
+ * generic/ttk/ttkState.c, generic/ttk/ttkTheme.h,
+ * generic/ttk/ttkWidget.c, doc/ttk_widget.n:
+ Add new "hover" state (patch from Pat Thoyts; needed to support proper
+ visual feedback on Vista).
- * doc/ttk_treeview.n: Fix typo. [Bug 1850713]
+2008-11-29 Pat Thoyts <patthoyts@users.sourceforge.net>
-2007-12-14 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * library/ttk/altTheme.tcl: Use a styled frame around the popdown
+ * library/ttk/clamTheme.tcl: listbox so we can adjust the border
+ * library/ttk/classicTheme.tcl: for each theme as needed.
+ * library/ttk/combobox.tcl:
+ * library/ttk/defaults.tcl:
+ * library/ttk/winTheme.tcl:
+ * library/ttk/xpTheme.tcl:
+ * tests/ttk/combobox.test:
- * win/tkWinInt.h: Add in missing function definitions
- * win/tkWinButton.c: to support plain MSVC6 and use INT_PTR
- * win/tkWinScrlBar.c: rather than LONG_PTR which isn'tr defined
- * win/tkWinWm.c: in the msvc6 headers.
+2008-11-28 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
-2007-12-14 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * generic/tkCanvUtil.c: [Bug 1813597,2218964]: Millimeter patch.
+ * generic/tkInt.h: Eliminates the functional redundancy and
+ * generic/tkObj.c: unnecessary loss of precision of the
+ * generic/tkText.c: {pixel,mm}ObjType tandem.
- * win/nmakehlp.c: Support compilation with MSVC9 for AMD64.
- * win/makefile.vc:
+2008-11-27 Jan Nijtmans <nijtmans@users.sf.net>
-2007-12-13 Jeff Hobbs <jeffh@ActiveState.com>
+ * generic/tkCanvLine.c: Replace Tcl_SetResult(interp, NULL, ....)
+ * generic/tkEntry.c: calls with Tcl_ResetResult(interp)
+ * generic/tkMenu.c
+ * generic/tkOldConfig.c
+ * win/tkWinTest.c: Eliminate warning: unused variable 'tkwin'
- * generic/tkMenubutton.c (ConfigureMenuButton): trace the
- -textvariable even if an image exists as it may use -compound.
+2008-11-23 Pat Thoyts <patthoyts@users.sourceforge.net>
-2007-12-12 Jeff Hobbs <jeffh@ActiveState.com>
+ * generic/tkBind.c: [Bug 1389270]: event generate silently ignored
+ * generic/tkFocus.c: focus events. These can now be generated.
+ * generic/tkGrab.c:
+ * generic/tkInt.h:
+ * tests/bind.test: Fixed some locale dependencies in various
+ tests to reduce the noise on non-English windows systems.
- * generic/tkText.c (DeleteIndexRange, TextEditCmd, UpdateDirtyFlag):
- * tests/text.test (text-25.10.1,25.11.[12]):
- Don't require [update idle] to trigger Modified event [Bug 1809538]
- Modified virtual event should only fire on state change [Bug 1799782]
- Make sure we delete chars before triggering <<Modified>> [Bug 1737288]
+2008-11-22 Donal K. Fellows <dkf@users.sf.net>
-2007-12-12 Daniel Steffen <das@users.sourceforge.net>
+ * library/demos/ctext.tcl: Extended to show off what you can do with
+ angled text; there is now a pie selector to change the orientation.
- * macosx/tkMacOSXWm.c (ApplyMasterOverrideChanges): Revert 2007-10-26
- change to window class of transient toplevels that are not also
- overrideredirect. [Bug 1845899]
+2008-11-22 Pat Thoyts <patthoyts@users.sourceforge.net>
- * macosx/tkMacOSXWm.c (ApplyMasterOverrideChanges): Implement more
- * macosx/tkMacOSXMouseEvent.c (BringWindowForward): X11-like transient
- * macosx/tkMacOSXSubwindows.c (XDestroyWindow): behaviour by adding
- transient windows to a window group owned by the master window, this
- ensures transients always remain in front of and are collapsed with the
- master; bring master to front when selecting transient windows; restore
- default window group of transients if master destroyed. [Bug 1845899]
+ * library/ttk/combobox.tcl: [Bug 1939129,1991930]: combobox dropdown
+ was drawn behind topmost toplevels.
+ * generic/tkCanvText.c: Fixed up complaints from MSVC engendered
+ * generic/tkFont.c: by the last commit. In particular replaced
+ * win/tkWinDraw.c: round() which is a C99 function.
+ * win/tkWinFont.c:
-2007-12-12 Joe English <jenglish@users.sourceforge.net>
+2008-11-22 Donal K. Fellows <dkf@users.sf.net>
- * doc/ttk_intro.n, doc/ttk_style.n, doc/ttk_widget.n:
- Various minor updates.
+ TIP #119 IMPLEMENTATION
-2007-12-12 Don Porter <dgp@users.sourceforge.net>
+ * generic/tkCanvText.c: Added -angle configuration option to canvas
+ * generic/tkFont.c: text items. This required reengineering the
+ * library/prolog.ps: whole text rendering engine to be able to
+ * macosx/tkMacOSXFont.c: handle an angle! No change to any external
+ * unix/tkUnixFont.c: API. Note, this feature was originally
+ * unix/tkUnixRFont.c: approved for Tk 8.5, but it has proved much
+ * win/tkWinFont.c: harder to implement than originally
+ * generic/tkInt.h: estimated. [Patch 1611359]
+ * tests/canvText.test:
- * changes: Updated for 8.5.0 release.
+2008-11-22 Pat Thoyts <patthoyts@users.sourceforge.net>
-2007-12-11 Joe English <jenglish@users.sourceforge.net>
+ * test/winDialog.test: [Bug 2307837]: Avoid some locale-dependent
+ * win/tkWinTest.c: failures by using id's or an english constraint
- * generic/ttk/ttkTheme.c(StyleElementOptionsCmd):
- Use Ttk_GetElement() to find element instead of direct
- hash table access.
+2008-11-19 Joe English <jenglish@users.sourceforge.net>
-2007-12-11 Donal K. Fellows <dkf@users.sf.net>
+ * doc/ttk_panedwindow.n: [Bug 1824996]: Remove inoperative text
+ stating that slave windows must be direct children of the master.
- * generic/tkText.c (TextReplaceCmd): Added code to rebuild the from
- index after the deletion phase so that the linePtr field is valid for
- the insertion phase. [Bug 1602537]
+2008-11-19 Jan Nijtmans <nijtmans@users.sf.net>
-2007-12-10 Donal K. Fellows <dkf@users.sf.net>
+ * generic/tkImgPhoto.c Minor simplification in fix for [Bug 2312027]
+ no need to malloc and copy photo type name
+ because it is a constant to begin with.
+ * generic/tkOldConfig.c Convert Tcl_SetResult(......, TCL_DYNAMIC) to
+ * mac/tkMacOSXWm.c Tcl_SetResult(......, TCL_VOLATILE), in
+ * unix/tkUnixWm.c preparation for TIP #340
+ * unix/tkUnixSend.c
+ * win/tkWinWm.c
- * doc/event.n: Clarify the fact that [event info] only returns the
- names of virtual events that are bound to physical event sequences.
- This follows on from comments on comp.lang.tcl.
- http://groups.google.com/group/comp.lang.tcl/msg/935d2d226ae8a770
+2008-11-16 Joe English <jenglish@users.sourceforge.net>
-2007-12-10 Joe English <jenglish@users.sourceforge.net>
+ * generic/ttk/ttkWidget.c: [Bug 2298720]: Widget self-destruction is
+ not necessarily an error.
- * doc/AddOption.3, doc/CrtImgType.3, doc/CrtPhImgFmt.3,
- * doc/InternAtom.3, doc/TextLayout.3, doc/chooseColor.n,
- * doc/chooseDirectory.n, doc/loadTk.n, doc/palette.n,
- * doc/ttk_combobox.n: Various markup fixes (mostly: missing quotes on
- .SH arguments, extraneous .PPs)
+2008-11-16 Donal K. Fellows <dkf@users.sf.net>
- * doc/ttk_entry.n, doc/ttk_scrollbar.n, doc/ttk_treeview.n: Remove
- extra .BEs that got added by mistake somewhere.
+ * doc/wm.n: Added note about [wm overrideredirect] so that users will
+ avoid making unwarranted assumptions about how magical it is.
+ Triggered by [Bug 2282861] discussion.
-2007-12-10 Daniel Steffen <das@users.sourceforge.net>
+2008-11-14 Pat Thoyts <patthoyts@users.sourceforge.net>
- * generic/tk.decls: use new genstubs 'export' command to
- * generic/tkInt.decls: mark exported symbols not in stubs
- table [FR 1716117]; cleanup formatting
+ * generic/tk.h: The TIP 125 implementation permits the
+ * generic/tkFrame.c: [wm manage] command to manage any widget but
+ * macosx/tkMacOSXWm.c: only those with Frame instance data should be
+ * unix/tkUnixWm.c: permitted. We now check for the suitability and
+ * win/tkWinWm.c: raise an error for non-frame widgets. Updated
+ * test/wm.test: the tests and documentation. See also [Bug
+ * doc/wm.n: 2239034]
- * generic/tkIntDecls.h: regen with new genStubs.tcl.
- * generic/tkIntPlatDecls.h: [Tcl Bug 1834288]
- * generic/tkIntXlibDecls.h:
- * generic/tkPlatDecls.h:
- * generic/tkStubInit.c:
+2008-11-12 Joe English <jenglish@users.sourceforge.net>
-2007-12-10 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+ * generic/ttk/ttkWidget.c: Reworked widget construction and
+ destruction sequence; fixes [Bug 2207435] and several other problems
+ discovered during investigation of same.
+ * generic/ttk/ttkButton.c (CheckbuttonInitialize): Account for
+ initializeProc being called earlier in the construction sequence now.
+ * tests/ttk/ttk.test: Updated test suite.
- * tests/safe.test: Ensure list of hidden commands is correct. [Bug
- 1847925]
+2008-11-12 Pat Thoyts <patthoyts@users.sourceforge.net>
-2007-12-10 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * library/text.tcl: [Bug 1777362]: Handle windows with funky names by
+ * test/text.test: avoiding use of the window path for anchors.
- * win/tkWin.h: We must specify the lowest Windows version we intend to
- support. In particular the SystemParametersInfo API doesn't like to
- receive structures that are larger than it expects which affects the
- font assignements. Set to Win98 support.
+2008-11-11 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tkWinFont.c: Handle failure to read the system parameters. This
- causes ttk/fonts.tcl to set any missing named fonts.
+ * generic/tkImgPhoto.c Fix [Bug 2265860] new test failures
- * win/ttkWinMonitor.c: Only tkWin.h should include windows.h unless
- * win/ttkWinTheme.c: we have an explicit override of the WINVER
- * tin/ttkWinXPTheme.c: macro.
+2008-11-11 Joe English <jenglish@users.sourceforge.net>
- * win/rules.vc: Handle MSVC 9 (aka: Visual Studio 2008)
+ * generic/ttk/ttkWidget.c (BeginDrawing): [Bug 2264732]: Don't crash
+ when application uses nondefault visual.
- * tests/safe.test: Update for 'unload' as a safe command (tcl 8.5b3+)
+2008-11-11 Jan Nijtmans <nijtmans@users.sf.net>
-2007-12-09 Donal K. Fellows <dkf@users.sf.net>
+ * win/tcl.m4: Reverted change from 2008-11-06 (was under the
+ impression that "-Wno-implicit-int" added an extra
+ warning)
+ * win/configure (regenerated)
+ * unix/tcl.m4: Use -O2 as gcc optimization compiler flag, and get
+ rid of -Wno-implicit-int for UNIX
+ * unix/configure (regenerated)
- * win/configure.in: Adjusted code so that running configure does not
- generate an error message when the full current directory name
- contains a space.
+ * generic/tk.decls Modify Tk_Create(Old)ImageType signature,
+ * generic/tk.h relaxing the constraint that every Tk_ImageType
+ * generic/tkImage.c can only be passed to this function once. This
+ * generic/tkImgBmap.c lets tkImg be loaded in multiple interpreters
+ * generic/tkImgPhoto.c in a thread-enabled build of Tk. [Bug 2312027]
+ * generic/tkTest.c This CONSTification complies with TIP #27. It
+ * doc/CrtImgType.3 is binary compatible with the old interface,
+ but not fully source compatible (although tkImg
+ does not suffer).
+ * generic/tkDecls.h (regenerated)
- * win/tkWinWm.c: Added set of #defs to make this file build with my
- version of the SDK (i.e. with the msys suite we distribute).
+ *** POTENTIAL INCOMPATIBILITY ***
-2007-12-07 Joe English <jenglish@users.sourceforge.net>
+2008-11-09 Joe English <jenglish@users.sourceforge.net>
- * library/ttk/altTheme.tcl, library/ttk/classicTheme.tcl:
- s/style/ttk::style/.
+ * generic/ttk/ttkWidget.c: Remove unnecessary casts.
-2007-12-07 Don Porter <dgp@users.sourceforge.net>
+ * generic/ttk/ttkWidget.h, generic/ttk/ttkWidget.c: Ttk widget
+ initializeProc()s now return void instead of a status code, and are no
+ longer allowed to fail. (Fix for [Bug 2207435] in progress).
- * unix/README: Mention the stub library created by `make` and warn
- about the effect of embedded paths in the installed binaries. Thanks
- to Larry Virden. [Tcl Bug 1794084]
+ * generic/ttk/ttkButton.c, generic/ttk/ttkEntry.c,
+ * generic/ttk/ttkFrame.c, generic/ttk/ttkNotebook.c,
+ * generic/ttk/ttkPanedwindow.c, generic/ttk/ttkProgress.c,
+ * generic/ttk/ttkScale.c, generic/ttk/ttkScrollbar.c,
+ * generic/ttk/ttkTreeview.c: Adjustments for the above.
+
+2008-11-09 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkCanvas.c: Make all Tk_CustomOption tables const and
+ * generic/tkCanvBmap.c: remove unnecessary type cast.
+ * generic/tkCanvImg.c:
+ * generic/tkCanvPoly.c:
+ * generic/tkCanvText.c:
+ * generic/tkCanvWind.c:
+ * generic/tkRectOval.c:
+ * generic/tkScrollbar.c:
+ * generic/tk.decls: Two more (hopefully the last) signature
+ * generic/tkInt.h: changes in Tk_CreateSmoothMethod and
+ * generic/tkCanvLine.c: Tk_CreatePhotoImageFormat
+ * generic/tkCanvUtil.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkDecls.h: (regenerated)
+ * doc/CrtImgType.3: doc updates
+ * doc/CrtPhImgFmt.3:
-2007-12-05 Joe English <jenglish@users.sourceforge.net>
+2008-11-06 Jan Nijtmans <nijtmans@users.sf.net>
- * macosx/ttkMacOSXTheme.c: Fix TCombobox layout so as not to truncate
- long text when combobox is wider than requested. [Bug 1845164]
+ * win/tcl.m4: Add "-Wno-implicit-int" flag for gcc, as on UNIX
+ * win/configure: (regenerated)
+ * generic/default.h: Use tkUnixDefault.h under CygWin. With this
+ change, at least the X11 version of Tk can be
+ built with cygwin.
-2007-12-05 Jeff Hobbs <jeffh@ActiveState.com>
+2008-11-06 Donal K. Fellows <dkf@users.sf.net>
- * library/demos/widget: reduce start size to 70% of screenheight from
- sh-200 for a more reasonable size.
+ * unix/configure.in: [Bug 2229999]: Work around the fact that the
+ HP-UX system compiler cannot handle 'inline'.
- * win/tkWinButton.c, win/tkWinDialog.c: use SetWindowLongPtr and
- * win/tkWinScrlbr.c, win/tkWinWm.c: GetWindowLongPtr only.
- * win/ttkWinMonitor.c:
+2008-11-05 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tkWinInt.h: remove CS_CLASSDC (not recommended for any apps now)
- * win/tkWinX.c: and simplify WNDCLASS to one style.
- * win/tkWinWm.c: Reduce wrapper update for exStyle to toolwindow
- change only and set WS_EX_LAYERED as sticky (once set on a window, do
- not remove it) to reduce alpha transition flicker.
+ * unix/tkUnixFont.c: [Bug 2226093]: Const changes not all correct
+ * unix/tkUnixButton.c: More internal -Wwrite-strings warning fixes
+ * unix/tkUnixCursor.c:
+ * unix/tkUnixSend.c:
+ * unix/tkUnixRFont.c:
+ * generic/tkInt.h: No need to use CONST in internal header files
+ * generic/tkFont.h
+ * generic/tkInt.decls: CONSTify string and fileName parameters of
+ * generic/tkImgBmap.c: TkGetBitmapData
+ * generic/tkBitmap.c: Remove unneccessary type cast
+ * generic/tkIntDecls.h: (regenerated)
+ * doc/GetCursor.3: Fix documentation about obsolete X10 bitmaps
+ * doc/GetBitmap.3: [Bug 1866774]: Remove X10 references from docs
+
+2008-11-03 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/ttk/ttkEntry.c: Fix warning: unused variable `currentValue'
+ * generic/tkOldTest.c: Fix warning: assignment discards qualifiers
+ * win/tkWinTest.c: from pointer target type
+
+2008-11-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * tests/winClipboard.test: testclipboard no longer returns strings
+ with embedded \r but now returns Tcl strings
+ * tests/winfo.test: Fixed embedding test broken during upgrade
+ * tests/busy.test: Default wait cursor on windows is 'wait'
+ * win/tkWinFont.c: const fixes for the windows code.
+
+2008-11-02 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkFont.h: More internal -Wwrite-strings warning fixes
+ * generic/tkFont.c
+ * generic/ttk/ttkTheme.h
+ * generic/ttk/ttkDefaultTheme.c
+ * generic/ttk/ttkState.c
+ * macosx/tkMacOSXFont.c
+ * unix/tkUnixFont.c
+ * win/tkWinFont.c
- * win/configure, win/tcl.m4 (LIBS_GUI): mingw needs -lole32 -loleaut32
- but not msvc for Tk's [send]. [Bug 1844749]
+2008-11-01 Donal K. Fellows <dkf@users.sf.net>
-2007-12-04 Joe English <jenglish@users.sourceforge.net>
+ TIP #97 IMPLEMENTATION
- * doc/ttk_style.n: Remove nonsense about "this manpage has not yet
- been written"; everything supported is documented.
+ * generic/tkCanvas.c (CanvasWidgetCmd): Implementation of the 'imove'
+ and 'rchars' subcommands.
+ * generic/tk.h (TK_MOVABLE_POINTS): New flag to allow items to state
+ whether they support finding and moving individual coordinates.
+ * doc/canvas.n, tests/canvas.test: Docs 'n' tests.
-2007-12-04 Donal K. Fellows <dkf@users.sf.net>
+2008-11-01 Pat Thoyts <patthoyts@users.sourceforge.net>
- * library/msgs/en.msg: Added missing messages. [Patch 1800744]
+ * generic/ttk/ttkEntry.c: Implemented the themed spinbox
+ * library/ttk/altTheme.tcl: widget.
+ * library/ttk/clamTheme.tcl:
+ * library/ttk/classicTheme.tcl:
+ * library/ttk/defaults.tcl:
+ * library/ttk/entry.tcl:
+ * library/ttk/ttk.tcl:
+ * library/ttk/winTheme.tcl:
+ * library/ttk/xpTheme.tcl:
+ * library/ttk/spinbox.tcl:
+ * win/ttkWinTheme.c:
+ * win/ttkWinXPTheme.c:
+ * doc/ttk_spinbox.n:
+ * tests/ttk/spinbox.test:
+
+2008-10-31 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/widget.c: Temporary workaround for [Bug 2207435]
+
+2008-10-30 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * generic/tkAtom.c: more internal -Wwrite-strings warning fixes
+ * generic/tkBusy.c
+ * generic/tkButton.c
+ * generic/tkCanvPoly.c
+ * generic/tkCanvText.c
+ * generic/tkCmds.c
+ * generic/tkListbox.c
+ * generic/tkMenu.c
+ * generic/tkOldConfig.c
+ * generic/tkOption.c
+ * generic/tkPanedWindow.c
+ * generic/tkPlace.c
+ * generic/tkScale.c
+ * generic/tkTest.c
+ * generic/tkText.c
+ * generic/tkTextImage.c
- * library/msgs/da.msg: Added Danish messages. [Patch 1844143]. Many
- thanks to Torsten Berg <treincke@users.sf.net>.
+2008-10-30 Don Porter <dgp@users.sourceforge.net>
-2007-12-03 Jeff Hobbs <jeffh@ActiveState.com>
+ * tests/unixSelect.test: Revise the unixSelect-1.* tests so that
+ they test the ability of Tk's selection mechanism to faithfully pass
+ valid Tcl values without corruption, and stop testing details of
+ Tcl's internal encoding scheme. With this change, the Tk test suite
+ no longer uses the identity encoding or [string bytelength].
- * win/configure, win/tcl.m4 (LIBS_GUI): remove ole32.lib oleaut32.lib
- (LIBS): add ws2_32.lib for static builds with Tcl.
+2008-10-30 Jan Nijtmans <nijtmans@users.sf.net>
-2007-12-01 Joe English <jenglish@users.sourceforge.net>
+ * generic/tk.h: CONSTify return value of
+ * generic/tkInt.h Tk_OptionPrintProc, and customPtr
+ * generic/tk.decls field of Tk_ConfigSpec.
+ * generic/tkCanvArc.c See [Bug 2190619]: Warnings due to
+ * generic/tkCanvLine.c Tk_SmoothMethod name constness change
+ * generic/tkCanvUtil.c
+ * generic/tkUtil.c
+ * generic/tkDecls.h: (regenerated)
- * generic/ttk/ttkTheme.h, generic/ttk/ttkThemeInt.h,
- * generic/ttk/ttkTheme.c, generic/ttk/ttkLayout.c,
- * generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c,
- * generic/ttk/ttkTreeview.c, macosx/ttkMacOSXTheme.c,
- * win/ttkWinTheme.c, win/ttkWinXPTheme.c: Improved macrology for
- statically-initialized layout template tables.
+2008-10-29 Joe English <jenglish@users.sourceforge.net>
-2007-11-28 Don Porter <dgp@users.sourceforge.net>
+ * generic/tkAtom.c(Tk_GetAtomName): Remove incorrect 'const' qualifier.
+ Remove useless 'register' declarations too, while we're at it.
- * unix/tkUnixPort.h: When unix/configure determines whether the
- intptr_t type is available, it has the <inttypes.h> header present.
- It's only fair that we let Tk have it too.
+2008-10-28 Jan Nijtmans <nijtmans@users.sf.net>
-2007-11-26 Kevin Kenny <kennykb@acm.org>
+ * generic/tk.h: Add "const" to a few struct member fields.
+ * generic/tkInt.h: CONSTify TkPrintPadAmount
+ * generic/tkSelect.h: Move TkSelGetSelection to tkInt.decls
+ * generic/tk.decls: CONSTify Tk_ParseArgv
+ * generic/tkInt.decls: CONSTify TkCreateFrame and TkCreateMainWindow
+ * generic/tkDecls.h: (regenerated)
+ * generic/tkIntDecls.h: (regenerated)
+ * generic/tkArgv.c:
+ * generic/tkAtom.c:
+ * generic/tkEntry.c:
+ * generic/tkFrame.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkPack.c:
+ * generic/tkSelect.c:
+ * generic/tkVisual.c:
+ * generic/tkWindow.c:
+ * win/tkWinTest.c: Fix compilation under mingw32
- * generic/tkImgPPM.c (StringReadPPM): Corrected a comparison whose
- sense was reversed that resulted in reading beyond the end of the
- input buffer on malformed PPM data. [Bug 1822391]
- * library/tkfbox.tcl (VerifyFileName): Corrected a couple of typos in
- handling of bad file names. [Bug 1822076] Thanks to Christoph Bauer
- (fridolin@users.sf.net) for the patch.
- * tests/filebox.test (filebox-7.1, filebox-7.2): Added test cases that
- exercise. [Bug 1822076]
- * tests/imgPPM.test (imgPPM-4.1): Added test case that exercises. [Bug
- 1822391]
+2008-10-28 Joe English <jenglish@users.sourceforge.net>
-2007-11-25 Joe English <jenglish@users.sourceforge.net>
+ * library/ttk/cursors.tcl, library/ttk/combobox.tcl,
+ library/ttk/entry.tcl, library/ttk/paned.tcl, library/ttk/sizegrip.tcl,
+ library/treeview.tcl:
+ [Bug 2054562]: Add correct platform-specific cursors for OSX
+ [Bug 1534835]: Expanded set of symbolic cursors. Use correct cursor
+ for ttk::entry and ttk::combobox widgets
- * generic/ttk/ttkManager.h, generic/ttk/ttkManager.c,
- * generic/ttk/ttkFrame.c, generic/ttk/ttkNotebook.c,
- * generic/ttk/ttkPanedwindow.c: Internal Ttk_Manager API updates;
- Fixed [Bug 1343984]; Added [$nb hide] method; [$nb add] on
- already-managed windows no longer throws an error, can be used to
- re-add a hidden tab.
+2008-10-28 Don Porter <dgp@users.sourceforge.net>
- * doc/ttk_notebook.n, tests/ttk/notebook.test,
- * tests/ttk/panedwindow.test: Updated docs and test suite.
+ * win/tkWinTest.c: [Bug 2191960]: Revise [testclipboard]
+ * tests/winClipboard.test: to form that handles encodings.
+ * tests/constraints.tcl: [tcltest::bytestring] no longer used.
-2007-11-23 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+2008-10-24 Joe English <jenglish@users.sourceforge.net>
- * unix/README: General improvements.
+ * tests/ttk/ttk.test: [Bug 2175411]: Disable test ttk-6.3, it's not
+ applicable.
-2007-11-21 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+ * generic/ttk/ttkTheme.c: Use different Tcl_AssocData key so the tile
+ extension can be loaded into an 8.6 interp, in the off-chance that
+ anyone wants to do this.
- * library/tkfbox.tcl: Better theming in the file list area.
+2008-10-24 Donal K. Fellows <dkf@users.sf.net>
-2007-11-19 Don Porter <dgp@users.sourceforge.net>
+ * generic/tkCanvUtil.c (TkSmoothPrintProc): [Bug 2190619]: Corrected
+ 'const'ness to quell warning.
- *** 8.5b3 TAGGED FOR RELEASE ***
+2008-10-23 Don Porter <dgp@users.sourceforge.net>
- * README: Bump version number to 8.5b3.
+ * README: Bump version number to 8.6a4
* generic/tk.h:
* library/tk.tcl:
* unix/configure.in:
@@ -2407,396 +3626,273 @@
* unix/configure: autoconf-2.59
* win/configure:
- * changes: Update changes for 8.5b3 release.
-
-2007-11-19 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * generic/ttk/ttkTheme.c: Fix crash when 'style element create'
- * tests/ttk/ttk.test: called w/ insufficient args; add tests.
-
-2007-11-18 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/ttkElements.c, macosx/ttkMacOSXTheme.c: Add "fill"
- element: like "background" but only erases parcel.
+2008-10-22 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/ttk/ttkFrame.c: Use fill element in Labelframe Label
- sublayout. Also improved default labelmargins for -labelanchor w*, e*.
+ * generic/tk.h: CONST -> const and white-spacing
+ * generic/tk.decls
+ * generic/tkInt.decls
+ * generic/tkDecls.h: (regenerated)
+ * generic/tkIntDecls.h: (regenerated)
+ * generic/tkIntPlatDecls.h: (regenerated)
+ * generic/tkIntXlibDecls.h: (regenerated)
+ * generic/tkPlatDecls.h: (regenerated)
+ * generic/ttk/tk.decls
+ * generic/ttk/ttkDecls.h (regenerated)
+ * generic/ttk/ttkGenStubs.tcl
- * generic/ttk/ttkLabel.c: no longer need Labelframe hack.
+2008-10-20 Donal K. Fellows <dkf@users.sf.net>
- * library/ttk/aquaTheme.tcl: ImageTextElement no longer needed.
- TextElement no longer needs '-background' option.
+ * generic/tkBusy.c, macosx/tkMacOSXEmbed.c, unix/tkUnixEmbed.c:
+ * win/tkWinWindow.c: [Bug 2180919]: Factor out the platform-specific
+ parts into the platform directories.
- * generic/ttk/ttkFrame.c: Use sublayout for ttk::labelframe labels
- instead of single element.
+2008-10-18 Donal K. Fellows <dkf@users.sf.net>
- * generic/ttk/ttkLabel.c: Default -anchor for text and label elements
- is now "w" instead of "center". [Bug 1614540]
+ TIP #321 IMPLEMENTATION
- * library/ttk/defaults.tcl, library/ttk/*Theme.tcl: Button styles now
- need explicit "-anchor center".
+ * generic/tkBusy.c, doc/busy.n, tests/busy.test: [Patch 1997907]:
+ Implementation of the [tk busy] command.
- * generic/ttk/ttkLayout.c (TTKInitPadding): BUGFIX:
- Ttk_GetPaddingFromObj() and Ttk_GetBorderFromObj() returned garbage
- when passed an empty list.
+2008-10-18 Pat Thoyts <patthoyts@users.sourceforge.net>
- * macosx/ttkMacOSXTheme.c: Resynchronize with Tile codebase so that
- patches can flow back and forth.
+ * win/tkWinFont.c: [Bug 1825353]: To fix a problem with tiny fonts on
+ Russian versions of Windows we will avoid removing the internal
+ leading for fixed width fonts.
- * library/ttk/aquaTheme.tcl: Extra TButton -padding no longer needed.
+2008-10-15 Jan Nijtmans <nijtmans@users.sf.net>
-2007-11-18 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/ttkWinXPTheme.c: Add support for size information flags for
- scrollbar and combobox buttons. This handles Tile [Patches 1596647 and
- 1596657] but a bit more generically.
-
-2007-11-17 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * generic/(tkArgv.c, tkBind.c, tkCipboard.c, tkEntry.c, tkOption.c,
- tkScale.c, tkScrollbar.c, tkTextImage.c, tkVisual.c, tkWindow.c): Tidy
- up some variable types.
-
- * generic/tkFont.c: Only check for -displayof if there are
- * test/font.test: sufficient arguments. This permits checking
- strings like -d.
-
-2007-11-17 Joe English <jenglish@users.sourceforge.net>
-
- * library/ttk/scrollbar.tcl: Swap in core scrollbars for
- [ttk::scrollbar]s on OSX.
-
-2007-11-16 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
-
- * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Correct an
- oversight in the bug fix from 2007-11-11. [Bug 1824638]
-
-2007-11-15 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.xcodeproj/project.pbxproj: add new chanio.test.
- * macosx/Wish.xcode/project.pbxproj:
-
-2007-11-14 Donal K. Fellows <dkf@users.sf.net>
-
- * library/msgs/sv.msg: Get the locale declared within the message
- catalog correct! [Bug 1831803]
-
-2007-11-11 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
-
- * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Fix the case when
- TK_WHOLE_WORDS and TK_AT_LEAST_ONE are both set and maxLength is small.
- [Bug 1824638]
-
-2007-11-09 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXCarbonEvents.c
- (InstallStandardApplicationEventHandler): on Mac OS X Leopard, replace
- the 2005-11-27 approach of installing the standard application handler
- by calling RAEL and immediately longjmping out of it from an event
- handler, as that now leads to crashes in -[NSView unlockFocus] whenever
- HIToolbox uses Cocoa in Leopard (Help menu, Nav Services, Color
- Picker). Instead call InstallStandardEventHandler() on the application
- and menubar event targets, as Leopard ISEH finally handles these
- correctly. Unfortunately need a HIToolbox-internal SPI to retrieve the
- menubar event target, no public API appears have that functionality.
-
- * macosx/tkMacOSXDebug.c: make TkMacOSXInitNamedDebugSymbol()
- * macosx/tkMacOSXDebug.h: available outside of debug builds as
- the new Leopard ISAEH needs it.
-
- * macosx/tkMacOSXButton.c: replace HiliteControl() by modern API
- * macosx/tkMacOSXMenubutton.c: for activation and enabling;
- distinguish inactive and disabled
- look&feel; correct activation handling
- to match that of container toplevel.
-
- * macosx/tkMacOSXMenubutton.c: correct size computation of bevelbutton
- variant to match that of buttons;
- fix crash with bitmap due to NULL GC;
- delay picParams setup until needed;
- formatting cleanup. [Bug 1824521]
-
- * library/menu.tcl: correct handling of menubutton "active"
- state on Aqua to match that of buttons.
-
- * macosx/tkMacOSXDefault.h: correct button & menubutton active
- foreground and background colors and
- menubutton border width.
-
- * macosx/tkMacOSXWindowEvent.c: handle kEventWindowExpanding carbon
- * macosx/tkMacOSXCarbonEvents.c: event instead of kEventWindowExpanded
- to ensure activate event arrives after
- window is remapped, also need to
- process all Tk events generated by
- remapping in the event handler to
- ensure children are remapped before
- activate event is processed.
-
- * macosx/tkMacOSXSubwindows.c: add pixmap size field to MacDrawable
- * macosx/tkMacOSXInt.h: struct; add flag for B&W pixmaps.
- * macosx/tkMacOSXDraw.c:
- * macosx/tkMacOSXEmbed.c:
- * macosx/tkMacOSXMenu.c:
-
- * macosx/tkMacOSXPrivate.h: correct Leopard HIToolboxVersionNumber.
-
- * macosx/ttkMacOSXTheme.c: add error checking; cleanup formatting.
-
- * macosx/tkMacOSXFont.c (TkpGetFontAttrsForChar): panic on false return
- from TkMacOSXSetupDrawingContext().
-
- * macosx/tkMacOSXButton.c: sync formatting, whitespace, copyright
- * macosx/tkMacOSXDialog.c: with core-8-4-branch.
- * macosx/tkMacOSXMenus.c:
- * macosx/tkMacOSXWm.c:
- * xlib/xgc.c
- * library/bgerror.tcl:
- * library/console.tcl:
- * library/menu.tcl:
-
-2007-11-07 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/ttkTheme.c (Ttk_ElementSize): Fixed longstanding,
- subtle bug that caused element padding to sometimes be counted
- twice in size computations.
-
- * generic/ttk/ttkElements.c, generic/ttk/ttkClamTheme.c,
- generic/ttk/ttkDefaultTheme.c, generic/ttk/ttkTreeview.c,
- generic/ttk/ttkImage.c, macosx/ttkMacOSXTheme.c,
- win/ttkWinTheme.c, win/ttkWinXPTheme.c: Fix ElementSizeProcs affected
- by previous change.
-
-2007-11-06 Andreas Kupries <andreask@activestate.com>
-
- * doc/CrtConsoleChan.3: Fixed markup typo and extended see also
- section per suggestions by Donal.
-
-2007-11-05 Joe English <jenglish@users.sourceforge.net>
-
- * library/ttk/combobox.tcl: Set focus to listbox in <Map> binding
- instead of in Post command (see [Bug 1349811] for info).
-
-2007-11-05 Andreas Kupries <andreask@activestate.com>
-
- * doc/CrtConsoleChan.3: New file providing minimal documentation
- of 'Tk_InitConsoleChannels()'. [Bug 432435]
-
-2007-11-05 Joe English <jenglish@users.sourceforge.net>
-
- * macosx/ttkMacOSXTheme.c (TreeitemLayout): Remove focus ring
- from treeview items on OSX (problem reported by Kevin Walzer).
-
-2007-11-04 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/ttkTreeview.c: Use null "treearea" element for
- treeview owner-draw area instead of "client", to avoid
- nameclash with Notebook.client element (this was causing
- sizing anomalies in XP theme, and introduced extraneous
- padding).
- * generic/ttk/ttkDefaultTheme.c: Treeitem.indicator element
- needs left margin now.
-
-2007-11-04 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXMenus.c: add "Run Widget Demo" menu item to the
- default Edit menu along with associated carbon event handler enabling
- the item only if demo files are installed; cleanup handling of "About"
- and "Source" menu items.
-
- * library/bgerror.tcl: fix background of detail text on Aqua.
-
- * library/console.tcl: add accelerators and fix Aqua bindings
- of the new font size menu items.
-
- * library/demos/mclist.tcl: Aqua GOOBE.
- * library/demos/tree.tcl:
- * library/demos/ttknote.tcl:
- * library/demos/widget:
-
- * doc/chooseDirectory.n: remove/correct obsolete Mac OS 9-era
- * doc/getOpenFile.n: information.
- * doc/menu.n:
-
- * macosx/tkMacOSXEvent.c (TkMacOSXProcessCommandEvent): fix boolean arg
-
- * macosx/Wish.xcodeproj/project.pbxproj: add new demo file.
- * macosx/Wish.xcode/project.pbxproj:
-
-2007-11-03 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * library/console.tcl: Add menu item and key binding to adjust font.
-
-2007-11-02 Donal K. Fellows <dkf@users.sf.net>
-
- * library/demos/mclist.tcl: Added a demo of how to do a multi-column
- sortable listbox.
-
- * library/msgbox.tcl: Made message dialog use Ttk widgets for better
- L&F.
-
- * library/tkfbox.tcl (::tk::dialog::file::CompleteEnt): Added <Tab>
- completion. [FR 805091]
- * library/tkfbox.tcl: Made file dialog use Ttk widgets for better L&F.
-
- * library/demos/sayings.tcl: Better resizing. [Bug 1822410]
-
-2007-11-01 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * library/demos/textpeer.tcl: Better resizing. [Bug 1822601]
-
- * doc/colors.n: Added list of Windows system colors. [Bug 945409]
-
-2007-11-01 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXColor.c (GetThemeColor): improve translation of RGB
- pixel values into RGBColor.
-
- * library/demos/widget: increase height of main window text widget to
- use more of the available vertical space.
-
- * doc/bind.n: document the Option modifier, clarify meaning
- and availability of Command & Option.
-
- * doc/console.n: clarify availability of [console] in TkAqua.
-
-2007-11-01 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * unix/installManPage, doc/*.n: Make documentation use the name that
- scripts use as much as possible. [Bug 1640073]
-
- * doc/text.n: Fixed mistake in [$t tag remove] docs. [Bug 1792191]
-
- * doc/bind.n: Documented the Command modifier. [Bug 1232908]
-
- * doc/console.n, doc/wish.1: Made it clearer when and why the console
- command is present. [Bug 1386955]
-
-2007-10-31 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * library/demos/entry3.tcl: Improved description/comments so that
- people better understand what is being validated, following suggestion
- from Don Porter.
-
- * library/demos/image2.tcl (loadImage): Mark non-loadable images
- as such instead of throwing a nasty dialog, following suggestion
- from Don Porter.
-
- * generic/tkImgPhoto.c (Tk_PhotoPutBlock): More optimization, derived
- from [Patch 224066].
-
-2007-10-30 Joe English <jenglish@users.sourceforge.net>
+ * generic/tk.h: Add "const" to many internal const tables, so
+ * generic/tkBind.c: those will be put by the C-compiler in the
+ * generic/tkButton.c: TEXT segment instead of the DATA segment.
+ * generic/tkCanvas.c: This makes those tables as being shareable in
+ * generic/tkClipboard.c: shared libraries.
+ * generic/tkCmds.c:
+ * generic/tkConsole.c:
+ * generic/tkEntry.c:
+ * generic/tkFocus.c:
+ * generic/tkFrame.c:
+ * generic/tkGet.c:
+ * generic/tkGrab.c:
+ * generic/tkGrid.c:
+ * generic/tkImage.c:
+ * generic/tkImgBmap.c:
+ * generic/tkImgGIF.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkListbox.c:
+ * generic/tkMenu.c:
+ * generic/tkMenu.h:
+ * generic/tkMenubutton.c:
+ * generic/tkMessage.c:
+ * generic/tkOption.c:
+ * generic/tkPack.c:
+ * generic/tkPanedWindow.c:
+ * generic/tkPlace.c:
+ * generic/tkScale.c:
+ * generic/tkSelect.c:
+ * generic/tkSquare.c:
+ * generic/tkTest.c:
+ * generic/tkText.c:
+ * generic/tkTextDisp.c:
+ * generic/tkTextMark.c:
+ * generic/tkTextTag.c:
+ * generic/tkTextWind.c:
+ * macosx/tkMacOSXDialog.c:
+ * macosx/tkMacOSXSend.c:
+ * macosx/tkMacOSXWin.c:
+ * unix/tkUnixFont.c:
+ * unix/tkUnixWm.c:
+ * win/tkWinButton.c:
+ * win/tkWinColor.c:
+ * win/tkWinDialog.c:
+ * win/tkWinMenu.c:
+ * win/tkWinSend.c:
+ * win/tkWinWm.c:
+ * xlib/xcolors.c:
- * library/ttk/combobox.tcl (Unpost): BUGFIX: Unpost can be called with
- no preceding Post.
+2008-10-17 Pat Thoyts <patthoyts@users.sourceforge.net>
-2007-10-31 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * library/ttk/scale.tcl: Implemented keyboard bindings for ttk::scale
- * win/rules.vc: Use -fp:strict with msvc8 as -fp:precise fails on
- * generic/tkObj.c: amd64 builds. Fix the two places in Tk that
- * generic/tkTrig.c: generate errors with msvc8 when using this flag.
+2008-10-15 Jan Nijtmans <nijtmans@users.sf.net>
-2007-10-30 Jeff Hobbs <jeffh@ActiveState.com>
+ * generic/tkInt.h: Add "const" to many internal const tables, so
+ * generic/tk3d.c: those will be put by the C-compiler in the
+ * generic/tkBitmap.c: TEXT segment instead of the DATA segment.
+ * generic/tkColor.c: This makes those tables as being shareable in
+ * generic/tkConfig.c: shared libraries.
+ * generic/tkCursor.c:
+ * generic/tkFont.c:
+ * generic/tkObj.c:
+ * generic/tkStyle.c:
+ * generic/tkTextIndex.c:
+ * generic/tkUtil.c:
- * library/choosedir.tcl: only enable OK button when valid in
- conjunction with -mustexist. [Bug 1550528]
+2008-10-14 Donal K. Fellows <dkf@users.sf.net>
- * library/listbox.tcl (::tk::ListboxBeginSelect): ignore -takefocus
- when considering focus on <1>, it is for tab focus.
+ * generic/tkObj.c (TkNewWindowObj): Added utility function for making
+ a Tcl_Obj from a Tk_Window reference. Candidate for future exposure to
+ third-party code I suppose, but useful internal to Tk for sure.
-2007-10-30 Don Porter <dgp@users.sourceforge.net>
+2008-10-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
- * generic/tk.h: Bump version number to 8.5b2.1 to distinguish
- * library/tk.tcl: CVS development snapshots from the 8.5b2
- * unix/configure.in: release.
- * unix/tk.spec:
- * win/configure.in:
+ * generic/tkCanvas.c (CanvasWidgetCmd): Corrected result generation.
- * unix/configure: autoconf (2.59)
- * win/configure:
+2008-10-10 Don Porter <dgp@users.sourceforge.net>
-2007-10-30 Jeff Hobbs <jeffh@ActiveState.com>
+ *** 8.6a3 TAGGED FOR RELEASE ***
- * doc/text.n: fix spelling of -inactiveselectbackground [Bug 1626415]
+ * changes: Updates for 8.6a3 release.
- * library/entry.tcl: don't error with Clear event. [Bug 1509288]
+2008-10-09 Don Porter <dgp@users.sourceforge.net>
- * library/ttk/fonts.tcl: use size -12 TkFixedFont (was -10) on X11
+ * generic/tkListbox.c: Make literal return values consistent with
+ those generated by Tcl_PrintDouble().
-2007-10-30 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+ * tests/entry.test: Restore test naming consistency with Tk 8.5.
+ * tests/listbox.test: Remove some more dependency on precision in
+ * tests/spinbox.test: test results.
- * library/demos/unicodeout.tcl: Fixed Arabic and Hebrew rendering on
- Windows. [Bug 1803723]
+2008-10-08 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkImgPhoto.c (ImgPhotoCmd): Rename enumeration for somewhat
- simpler-to-read code. [Bug 1677613]
+ * unix/tcl.m4: [Bug 2073255]: fix
+ * unix/configure: regenerated
-2007-10-30 Joe English <jenglish@users.sourceforge.net>
+2008-10-08 Don Porter <dgp@users.sourceforge.net>
- * generic/ttk/ttkWidget.c: Split up RedisplayWidget() to factor out
- double-buffering related code.
+ * tests/textDisp.test (textDisp-16.34): Update test that tested string
+ equality of double values based on an assumption of tcl_precision==12.
+ Test now does its own formatting.
- * macosx/ttkMacOSXAquaTheme.c: Use SetThemeBackGround/
- kThemeBrushModelessDialogBackground{Active|Inactive} instead of
- ApplyThemeBackground/kThemeBackgroundWindowHeader (advice from DAS).
+ * tests/scrollbar.test: Revised testing of the cget subcommand so that
+ it tests consistency with the configure subcommand and not agreement
+ with a hardcoded value that will change as tastes in GUIs evolve.
- * library/ttk/aquaTheme.tcl: Use darker shade for inactive and
- disabled text, to match typical values of most
- kThemeXXXTextColorInactive values.
+ * tests/canvText.test (canvText-17.1): Update expected result to match
+ revised PostScript output due to more predictable formatting of
+ floating point values.
-2007-10-30 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * unix/tkUnixWm.c: [Bug 2021443]: Restored consistency of error
+ * macosx/tkMacOSXWm.c: messages from [wm iconphoto] with the test
+ * tests/unixWm.test: suite and across all platforms.
- * doc/selection.n: Clarify UTF8_STRING handling. [Bug 1778563]
+2008-10-07 Pat Thoyts <patthoyts@users.sourceforge.net>
- * doc/text.n: Clarify search subccommand docs. [Bug 1622919]
+ * tests/canvImg.test: Removed dependency on precision in results
+ * tests/canvRect.test:
+ * tests/canvText.test:
+ * tests/entry.test:
+ * tests/listbox.test:
+ * tests/scrollbar.test:
+ * tests/spinbox.test:
+ * tests/winWm.test: Fixed incorrect error strings
+ * tests/wm.test:
-2007-10-29 Jeff Hobbs <jeffh@ActiveState.com>
+2008-10-06 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * tests/winDialog.test: Fixed tests for Vista+
+ * win/tkWinWm.c: corrected some errors from the previous commit
+
+2008-10-05 Donal K. Fellows <dkf@users.sf.net>
+
+ * win/tkWinWm.c (WmAttributesCmd, WmOverrideredirectCmd)
+ (WmStackorderCmd):
+ * win/tkWinSendCom.c (Async):
+ * win/tkWinSend.c (Tk_SendObjCmd):
+ * win/tkWinFont.c (TkpGetFontFamilies, TkpGetSubFonts):
+ * unix/tkUnixWm.c (WmOverrideredirectCmd, WmStackorderCmd):
+ * unix/tkUnixFont.c (TkpGetFontFamilies, TkpGetSubFonts):
+ * macosx/tkMacOSXWm.c (WmOverrideredirectCmd, WmStackorderCmd):
+ * generic/tkTextIndex.c (SetTextIndexFromAny):
+ * generic/tkTest.c (TrivialConfigObjCmd):
+ * generic/tkSelect.c (HandleTclCommand):
+ * generic/tkPanedWindow.c (Tk_PanedWindowObjCmd)
+ (PanedWindowSashCommand, PanedWindowProxyCommand):
+ * generic/tkMenubutton.c (Tk_MenubuttonObjCmd):
+ * generic/tkMenu.c (MenuWidgetObjCmd):
+ * generic/tkListbox.c (ListboxWidgetObjCmd):
+ * generic/tkImgPhoto.c (ImgPhotoCmd): (mostly)
+ * generic/tkImage.c (Tk_ImageObjCmd):
+ * generic/tkFont.c (Tk_FontObjCmd, GetAttributeInfoObj):
+ * generic/tkEntry.c (EntryWidgetObjCmd, SpinboxWidgetObjCmd):
+ * generic/tkConfig.c (SetOptionFromAny, Tk_SetOptions):
+ * generic/tkCmds.c (Tk_TkObjCmd, Tk_WinfoObjCmd, TkGetDisplayOf):
+ * generic/tkButton.c (ButtonCreate): Get rid of code that insists on
+ non-idiomatically writing to the object in the interpreter result.
+
+2008-10-03 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkArgv.c, generic/tkCanvText.c, generic/tkEntry.c:
+ * generic/tkListbox.c, generic/tkScrollbar.c, macosx/tkMacOSXScrlbr.c:
+ * win/tkWinScrlbr.c: [Bug 2112563]: Convert use of %g to
+ Tcl_PrintDouble to create string versions of floats so as to avoid
+ trouble with some locales.
+
+2008-10-02 Joe Mistachkin <joe@mistachkin.com>
+
+ * doc/canvas.n: Fix unmatched font change.
+ * win/buildall.vc.bat: Prefer the HtmlHelp target over the WinHelp
+ target.
+
+2008-10-01 Donal K. Fellows <dkf@users.sf.net>
+
+ TIP #236 IMPLEMENTATION
+
+ * doc/canvas.n, generic/tkCanvas.c (CanvasWidgetCmd)
+ * tests/canvMoveto.test: Added 'moveto' subcommand to canvases to
+ allow items to be easily moved to a particular place.
+
+2008-09-23 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/listbox.n (SEE ALSO): [Bug 2123813]: Redirected this to
+ ttk::treeview(n) which is far more useful (it does multicolumn listbox
+ duties).
+
+ * doc/*.n: [Bug 2118116]: Make sure that the initial line of the
+ manpage includes nothing that chokes old versions of man.
- * macosx/tkMacOSXFont.c (InitSystemFonts):
- * library/ttk/fonts.tcl: use Monaco 11 (was 9) as Aqua TkFixedFont
+2008-08-25 Todd M. Helfter <tmh@users.sourceforge.net>
- * tests/listbox.test, tests/panedwindow.test, tests/scrollbar.test:
- * library/bgerror.tcl, library/dialog.tcl, library/listbox.tcl:
- * library/msgbox.tcl, library/optMenu.tcl, library/tclIndex:
- * library/tkfbox.tcl, library/demos/floor.tcl, library/demos/rmt:
- * library/demos/tcolor, library/demos/text.tcl:
- * library/demos/twind.tcl, library/demos/widget: Buh-bye Motif look
- * library/ttk/fonts.tcl: Update of Tk default look in 8.5
- * macosx/tkMacOSXDefault.h: Trims border sizes, cleaner X11 look
- * unix/tkUnixDefault.h: with minor modifications for Win32/Aqua.
- * win/tkWinDefault.h: Uses Tk*Font definitions throughout for
- * win/tkWinFont.c: classic widgets. [Bug 1820344]
- * library/obsolete.tcl (::tk::classic::restore): This restores
- changes made to defaults in 8.5 using the 'option' command,
- segmented into logical groups.
+ * library/menu.tcl: [Bug 1023955]: Additional fix.
- * tests/winfo.test: winfo-4.5 raise .t to above . for Windows
+2008-09-08 Todd M. Helfter <tmh@users.sourceforge.net>
- * tests/unixWm.test: note TIP#142 results and remove unnecessary
- catches.
+ * doc/menu.n: [Bug 2098425]: Fix typo in docs.
-2007-10-29 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+2008-09-03 Don Porter <dgp@users.sourceforge.net>
- * doc/*.1, doc/*.n, doc/*.3: Lots more GOOBE work.
+ * generic/tk.h: Dropped use of _ANSI_ARGS_ macro to preserve
+ * generic/tkSelect.h: Tk's TCL_NO_DEPRECATED build.
-2007-10-28 Joe English <jenglish@users.sourceforge.net>
+2008-08-30 Ania Pawelczyk <aniap@users.sourceforge.net>
- * library/ttk/combobox.tcl: Make popdown window [wm resizable 0 0] on
- OSX, to prevent TkAqua from shrinking the scrollbar to make room for a
- grow box that isn't there.
- * macosx/ttkMacOSXTheme.c, library/ttk/aquaTheme.tcl: Reworked
- combobox layout.
+ * tests/textWind.test: Update to tcltest2
+ * tests/unixSelect.test:
+ * tests/visual_bb.test:
+ * tests/visual.test:
+ * tests/window.test:
+ * tests/winfo.test:
+ * tests/xmfbox.test:
+ * tests/winButton.test:
+ * tests/winDialog.test:
+ * tests/winFont.test:
+ * tests/winMenu.test:
+ * tests/winMsbox.test:
+ * tests/winWm.test:
-2007-10-26 Don Porter <dgp@users.sourceforge.net>
+2008-08-28 Don Porter <dgp@users.sourceforge.net>
- *** 8.5b2 TAGGED FOR RELEASE ***
+ * unix/tkConfig.sh.in: Added @XFT_LIBS@ to the definition of TK_LIBS
+ to avoid link failures when a "big wish" program links against a
+ --disable-shared build of libtk. (Discovered building expectTk.)
- * changes: Update changes for 8.5b2 release.
+ * generic/tkImgPhoto.c: Changed TclStack* calls to ck* calls so that
+ we don't create new dependencies on Tcl internals.
- * doc/*.1: Revert doc changes that broke
- * doc/*.3: `make html` so we can get the release
- * doc/*.n: out the door.
+ * unix/tkUnixPort.h: Removed #include of tclInt.h that has been
+ * win/tkWinPort.h: disabled for three years. If we needed this
+ we'd have noticed by now.
- * README: Bump version number to 8.5b2.
+ * README: Bump version number to 8.6a3
* generic/tk.h:
* library/tk.tcl:
* unix/configure.in:
@@ -2806,2620 +3902,614 @@
* unix/configure: autoconf-2.59
* win/configure:
-2007-10-26 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXWm.c (ApplyMasterOverrideChanges): fix window class
- of transient toplevels that are not also overrideredirect. [Bug
- 1816252]
-
- * macosx/tkMacOSXDialog.c: TIP#242 cleanup.
- * library/demos/filebox.tcl: demo TIP#242 -typevariable.
-
-2007-10-25 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/ttkNotebook.c: [Bug 1817596]
-
-2007-10-25 Jeff Hobbs <jeffh@ActiveState.com>
-
- * doc/getOpenFile.n: TIP#242 implementation of -typevariable to
- * library/tkfbox.tcl: return type of selected file in file dialogs.
- * library/xmfbox.tcl: [Bug 1156388]
- * macosx/tkMacOSXDialog.c:
- * tests/filebox.test:
- * tests/winDialog.test:
- * win/tkWinDialog.c:
-
-2007-10-25 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkPlace.c: Prevent segfault in place geometry manager.
- Thanks to Colin McDonald. [Bug 1818491]
-
-2007-10-24 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/*.c, win/{ttkWinMonitor,ttkWinTheme,ttkWinXPTheme}.c,
- * macosx/ttkMacOSXTheme.c: Move widget layout registration
- from TtkElements_Init() to widget *_Init() routines.
- Renaming/consistency: s/...ElementGeometry()/...ElementSize()/
-
-2007-10-24 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * doc/*.n, doc/*.3, doc/*.1: Lots of changes to take advantage of the
- new macros.
-
-2007-10-24 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/tkWinDraw.c: Applied [Patch 1723362] for transparent bitmaps.
-
- * generic/tkWindow.c: permit wm manage of any widget (esp: ttk::frame)
-
-2007-10-23 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/ttk/combobox.tcl (ttk::combobox::PopdownWindow): redo wm
- transient on each drop to handle reparent-able frames. [Bug 1818441]
-
-2007-10-23 Joe English <jenglish@users.sourceforge.net>
-
- * library/ttk/combobox.tcl: [namespace import ::ttk::scrollbar]
- doesn't work, since ttk::scrollbar isn't [namespace export]ed.
-
-2007-10-23 Don Porter <dgp@users.sourceforge.net>
-
- * tests/cursor.test: Make tests robust against changes in Tcl's
- rules for accepting integers in octal format.
-
-2007-10-23 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * doc/font.n: Added section on the TIP#145 fonts.
-
-2007-10-23 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/tkWinFont.c: Fixed leak in CreateNamedFont spotted by das.
-
-2007-10-23 Daniel Steffen <das@users.sourceforge.net>
-
- * library/demos/combo.tcl: Aqua GOOBE.
- * library/demos/toolbar.tcl:
- * library/demos/tree.tcl:
- * library/demos/ttknote.tcl:
- * library/demos/ttkprogress.tcl:
- * library/demos/widget:
-
- * macosx/Wish.xcodeproj/project.pbxproj: add new demo files.
- * macosx/Wish.xcode/project.pbxproj:
-
-2007-10-22 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * library/demos/widget: Added more demos, reorganized to make Tk and
- Ttk demos seem to be more coherent whole. Made localization a bit
- easier by reducing the amount of duplication.
- * library/demos/{combo,toolbar,tree,ttknote,ttkprogress}.tcl: New
- demos of new (mostly) Ttk widgets.
- * library/demos/ttkbut.tcl: Improvements.
-
-2007-10-22 Joe English <jenglish@users.sourceforge.net>
-
- * library/ttk/combobox.tcl: ttk::combobox overhaul; fixes [Bugs
- 1814778, 1780286, 1609168, 1349586]
- * library/ttk/aquaTheme.tcl: Factored out aqua-specific combobox
- -postposition adjustments.
- * generic/ttk/ttkTrack.c: Detect [grab]s and unpress pressed
- element; combobox workaround no longer
- needed.
-
-2007-10-22 Daniel Steffen <das@users.sourceforge.net>
+2008-08-28 Donal K. Fellows <dkf@users.sf.net>
- * macosx/tkMacOSXFont.c: register named fonts for TIP #145 fonts
- and all theme font IDs.
+ * tests/imgPhoto.test: [Bug 2080587]: Fix failures.
- * generic/tkFont.c (Tk{Create,Delete}NamedFont): allow NULL interp.
+2008-08-28 Ania Pawelczyk <aniap@users.sourceforge.net>
- * library/ttk/fonts.tcl: check for TIP #145 fonts on all
- platforms; correct aqua font sizes.
-
- * library/demos/ttkmenu.tcl: Aqua GOOBE.
- * library/demos/ttkpane.tcl:
- * library/demos/widget:
-
- * macosx/Wish.xcodeproj/project.pbxproj: add new demo files.
- * macosx/Wish.xcode/project.pbxproj:
-
-2007-10-18 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * library/demos/ttkmenu.tcl: Added more demos of Ttk widgets. These
- * library/demos/ttkpane.tcl: ones are of menubuttons, panedwindows and
- a progress bar (indirectly).
+ * tests/option.test: Update to tcltest2
+ * tests/place.test:
+ * tests/scale.test:
+ * tests/select.test:
+ * tests/textBTree.test:
+ * tests/textImage.test:
+ * tests/textMark.test:
+ * tests/textTag.test:
+ * tests/unixMenu.test:
-2007-10-18 Pat Thoyts <patthoyts@users.sourceforge.net>
+2008-08-25 Todd M. Helfter <tmh@users.sourceforge.net>
- * library/ttk/fonts.tcl: Create all the TIP #145 font names on all
- platforms (mac and unix get handled in script, windows in C)
+ * library/menu.tcl: [Bug 1023955]: Fix typo.
-2007-10-17 David Gravereaux <davygrvy@pobox.com>
+2008-08-27 Peter Spjuth <peter.spjuth@gmail.com>
- * bitmaps/*.xbm: Changed CVS storage mode from -kb to -kkv as these
- are really text files, not binaries.
- * win/makefile.vc: Added $(BITMAPDIR) to the search path for the
- depend target.
+ * tests/grid.test: [Bug 2075285]: Added a "knownBug"-marked test to
+ show a problem identified in the grid implementation.
-2007-10-18 Daniel Steffen <das@users.sourceforge.net>
+2008-08-26 Donal K. Fellows <dkf@users.sf.net>
- * library/demos/widget: Aqua GOOBE, cleanup icons.
- * library/demos/ttkbut.tcl:
- * library/demos/entry3.tcl:
- * library/demos/msgbox.tcl:
+ * tests/imgPhoto.test: More style improvements.
- * library/demos/button.tcl: restore setting of button
- highlightbackground on Aqua.
+2008-08-25 Todd M. Helfter <tmh@users.sourceforge.net>
- * macosx/ttkMacOSXTheme.c: adjust button and separator geometry.
+ * library/menu.tcl: [Bug 1023955]: Do not flip to the arrow cursor on
+ menus. This was a Motif convention. Current behavior is maintained iff
+ tk_strictMotif is enabled.
- * macosx/tkMacOSXWm.c: fix warnings.
+2008-08-25 Donal K. Fellows <dkf@users.sf.net>
- * macosx/Wish.xcodeproj/project.pbxproj: add new demo files.
- * macosx/Wish.xcode/project.pbxproj:
+ * generic/tkImgPhoto.c (ImgPhotoConfigureMaster): Ensure that uses of
+ TclStackAlloc and TclStackFree balance.
-2007-10-17 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+2008-08-25 Todd M. Helfter <tmh@users.sourceforge.net>
- * library/demos/ttkbut.tcl: Added demo of the basic Ttk widgets.
+ * library/tkfbox.tcl: [Bug 1936220]: Fix the multiple selection error
+ for tk_getOpenFile -multiple 1 which fails on all unix platforms since
+ the adoption of ttk widgets.
-2007-10-16 David Gravereaux <davygrvy@pobox.com>
+2008-08-25 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkImgPhoto.c: Split the implementation of the core of
+ * generic/tkImgPhoto.h: photo images into two pieces, the photo
+ * generic/tkImgPhInstance.c: master (which manages the data model and
+ the interaction with the script level) and the photo instances (which
+ handle display).
+
+2008-08-22 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.6a2 TAGGED FOR RELEASE ***
+
+ * changes: Updates for 8.6a2 release.
+
+2008-08-21 Ania Pawelczyk <aniap@users.sourceforge.net>
+
+ * tests/menuDraw.test: Update to tcltest2
+ * tests/msgbox.test:
+ * tests/oldpack.test:
+ * tests/pack.test:
+ * tests/panedwindow.test:
+
+2008-08-21 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkOption.c (ExtendArray): Rework so that the code uses
+ ckrealloc (idiomatically) rather than its home-brewed version.
+
+2008-08-19 George Peter Staplin <georgeps@users.sourceforge.net>
+
+ [Bug 2039720]: After some discussion with Joe English and subsequently
+ the X.org developers (Keith Packard in particular), it was discovered
+ that Tk is doing management of XIDs that it shouldn't need to do. The
+ very common XC-MISC extension which has come with every version of X
+ for the last 15 years is used with Xlib now, to retrieve the
+ information about the used/unused XIDs. The public Tk_FreeXId is now a
+ no-op.
+
+ * generic/tkError.c: Remove the usage of TkpWindowWasRecentlyDeleted.
+ * generic/tkInt.decls: Update the declarations for the now unused
+ internal stubs.
+ * generic/tkIntDecls.h: Regenerated based on tkInt.decls.
+ * generic/tkIntPlatDecls.h: Regenerated based on tkInt.decls.
+ * generic/tkStubInit.c
+ * generic/tkWindow.c: Remove the calls to TkInitXId, and
+ TkFreeWindowId.
+ * macosx/tkMaxOSXPort.h: Remove TkFreeWindowId and TkInitXId macro
+ definitions.
+ * macosx/tkMacOSXXStubs.c: Remove the no-op
+ TkpWindowWasRecentlyDeleted.
+ * unix/tkUnixEvent.c: Remove call to TkFreeXId.
+ * unix/tkUnixXId.c: Remove a lot of unnecessary code (see above).
+ * win/tkWinPort.h: Remove TkFreeWindowId and TkInitXId.
+ * win/tkWinWindow.c: Remove TkpWindowWasRecentlyDeleted.
+ * tests/id.test: Remove this unnecessary test.
- * win/makefile.vc: depend target now works and builds a generated
- dependency list with $(TCLTOOLSDIR)/mkdepend.tcl
+2008-08-19 Joe English <jenglish@users.sourceforge.net>
-2007-10-16 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+ * generic/ttk/ttkScroll.c: Don't use sprintf "%g" to format floating
+ point numbers in -[xy]scrollcommand callbacks or [xy]view methods.
+ Minor incompatibility: 0 and 1 now formatted as "0.0" resp "1.0".
+ * tests/ttk/entry.test, tests/ttk/treeview.test: Updated to account
+ for above change.
- * library/demos/widget: Made the code for generating the contents of
- the main widget more informative. Added 'new' flagging for wholly new
- demos.
+2008-08-19 Daniel Steffen <das@users.sourceforge.net>
- * doc/text.n: Made it clearer what things are text widget invokations
- and what are not. Also some other clarity improvements.
+ * macosx/tkMacOSXFont.c (SetFontFeatures): Disable antialiasing of
+ fixed-width fonts with
+ size <= 10.
-2007-10-15 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+2008-08-18 Ania Pawelczyk <aniap@users.sourceforge.net>
- * library/demos/widget: Use Ttk widgets for the widget demo core, for
- vastly improved look-and-feel on at least one platform (Windows).
- * library/demos/{button,check,style,twind}.tcl: Various tweaks for
- GOOBE...
- * library/demos/textpeer.tcl: New demo script to show off peering as a
- specific feature.
+ * tests/canvWind.test: Update to tcltest2
+ * tests/menubut.test:
+ * tests/raise.test:
+ * tests/unixButton.test:
+ * tests/unixEmbed.test:
+ * tests/winClipboard.test:
-2007-10-15 Jeff Hobbs <jeffh@ActiveState.com>
+2008-08-17 Ania Pawelczyk <aniap@users.sourceforge.net>
- * generic/tkFocus.c, generic/tkFrame.c, generic/tkInt.h:
- * macosx/tkMacOSXButton.c, macosx/tkMacOSXMenubutton.c:
- * macosx/tkMacOSXWm.c, unix/tkUnixWm.c, win/tkWinWm.c:
- * doc/wm.n, tests/wm.test: TIP #125 implementation [Bug 998125]
- Adds [wm manage|forget] for dockable frames.
- Finished X11 and Windows code, needs OS X completion.
+ * tests/focus.test: Update to tcltest2
+ * tests/focusTcl.test:
+ * tests/geometry.test:
+ * tests/grab.test:
+ * tests/grid.test:
+ * tests/imgBmap.test:
+ * tests/imgPhoto.test:
+ * tests/imgPPM.test:
+ * tests/listbox.test:
+ * tests/safe.test:
+ * tests/tk.test:
+ * tests/util.test:
-2007-10-15 Joe English <jenglish@users.sourceforge.net>
+2008-08-15 Ania Pawelczyk <aniap@users.sourceforge.net>
- * generic/ttk/ttkTreeview.c: Store pointer to column table entry
- instead of column index in columnNames hash table. This avoids the
- need for the evil PTR2INT and INT2PTR macros, and simplifies things a
- bit.
+ * tests/clrpick.test: Update to tcltest2
+ * tests/frame.test:
+ * tests/font.test:
+ * tests/image.test:
-2007-10-15 Daniel Steffen <das@users.sourceforge.net>
+2008-08-14 Ania Pawelczyk <aniap@users.sourceforge.net>
- * generic/tkArgv.c: Fix gcc warnings about 'cast to/from
- * generic/tkCanvUtil.c: pointer from/to integer of different
- * generic/tkCanvas.c: size' on 64-bit platforms by casting
- * generic/tkCursor.c: to intermediate types
- * generic/tkInt.h: intptr_t/uintptr_t via new PTR2INT(),
- * generic/tkListbox.c: INT2PTR(), PTR2UINT() and UINT2PTR()
- * generic/tkObj.c: macros.
- * generic/tkStyle.c:
- * generic/tkTextIndex.c:
- * generic/tkUtil.c:
- * generic/ttk/ttkTheme.h:
- * generic/ttk/ttkTreeview.c:
- * unix/tkUnixMenu.c:
- * unix/configure.in:
+ * tests/event.test: Update to tcltest2
+ * tests/id.test:
+ * tests/menu.test:
- * unix/configure: autoconf-2.59
- * unix/tkConfig.h.in: autoheader-2.59
+2008-08-14 Daniel Steffen <das@users.sourceforge.net>
- * macosx/Wish-Common.xcconfig: add 'tktest-X11' target.
- * macosx/Wish.xcode/project.pbxproj:
- * macosx/Wish.xcode/default.pbxuser:
- * macosx/Wish.xcodeproj/default.pbxuser:
- * macosx/Wish.xcodeproj/project.pbxproj:
+ * unix/tcl.m4 (SC_PATH_X): Check for libX11.dylib in addition to
+ libX11.so et al.
- * unix/configure.in (Darwin): add support for 64-bit X11.
* unix/configure: autoconf-2.59
-2007-10-14 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/configure, win/configure.in (TK_WIN_VERSION): Make sure the
- patchlevel doesn't contain extra dotted pairs (eg. interim release)
-
-2007-10-12 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/makefile.vc: Mine all version information from headers.
- * win/rules.vc: Sync tcl and tk and bring extension versions
- * win/nmakehlp.c: closer together. Try and avoid using tclsh
- to do substitutions as we may cross compile.
-
- * library/console.tcl: Use TkFixedFont and ttk widgets
-
-2007-10-12 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXDraw.c: replace all (internal) use of QD region
- * macosx/tkMacOSXSubwindows.c: API by HIShape API, with conversion to
- * macosx/tkMacOSXWindowEvent.c: QD regions only when required by legacy
- * macosx/tkMacOSXPrivate.h: Carbon or Tk API.
- * macosx/tkMacOSXRegion.c:
- * macosx/tkMacOSXDebug.c:
- * macosx/tkMacOSXDebug.h:
-
- * macosx/tkMacOSXInt.h: replace MacDrawable's QD RgnHandles
- * macosx/tkMacOSXEmbed.c: clipRgn, aboveClipRgn & drawRgn by
- * macosx/tkMacOSXMenu.c: HIShapeRefs visRgn & aboveVisRgn and
- * macosx/tkMacOSXSubwindows.c: CGRect drawRect.
-
- * macosx/tkMacOSXWindowEvent.c: remove use of QD port vis rgn in window
- * macosx/tkMacOSXSubwindows.c: update rgn calculation, manually excise
- * macosx/tkMacOSXWm.c: growbox from toplevel clip rgn instead.
-
- * macosx/tkMacOSXDraw.c: replace use of QD port clip rgn by new
- * macosx/tkMacOSXPrivate.h: clipRgn fld in TkMacOSXDrawingContext;
- handle QD/CG drawing mismatches in
- XCopyArea, XCopyPlane and TkPutImage;
- cleanup/speedup CGContext setup in
- TkMacOSXSetupDrawingContext().
-
- * macosx/tkMacOSXDraw.c: change TkMacOSXSetupDrawingContext() to
- * macosx/tkMacOSXEntry.c: return boolean indicating whether
- * macosx/tkMacOSXFont.c: drawing is allowed (and was setup) or
- * macosx/tkMacOSXMenu.c: not (e.g. when clipRgn is empty).
- * macosx/ttkMacOSXTheme.c:
-
- * macosx/tkMacOSXSubwindows.c: signal that drawable is a pixmap via
- * macosx/tkMacOSXInt.h: new explicit TK_IS_PIXMAP flag instead
- of a NULL cligRgn field.
-
- * macosx/tkMacOSXRegion.c: add wrappers for missing/buggy HIShape
- * macosx/tkMacOSXPrivate.h: API, and private helpers to operate on
- HIShapeRefs & convert to/from TkRegion.
-
- * macosx/tkMacOSXRegion.c: add Tkp{Retain,Release}Region() API for
- * macosx/tkMacOSXInt.h: TkRegion.
+2008-08-12 Ania Pawelczyk <aniap@users.sourceforge.net>
- * xlib/xgc.c: factor out alloc/free of GC clip_mask;
- * macosx/tkMacOSXXStubs.c: manage clip rgn lifetime with new
- Tkp{Retain,Release}Region().
+ * tests/choosedir.test: Update to tcltest2
+ * tests/clipboard.test:
+ * tests/embed.test:
+ * tests/main.test:
- * macosx/tkMacOSXButton.c: delay picParams setup until needed.
+2008-08-12 Don Porter <dgp@users.sourceforge.net>
- * generic/tkTextDisp.c (CharUndisplayProc): fix textDisp.test crash.
-
-2007-10-11 David Gravereaux <davygrvy@pobox.com>
-
- * win/winMain.c: Replaced incorrect comments in main() to descibe
- why the console widget does not need to be created for this
- application entry point (if used). Must have been a bad copy/paste
- of WinMain() from 10 years back.
-
-2007-10-11 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXWm.c (TkMacOSXGrowToplevel): manually constrain resize
- limitBounds to maxBounds, works around SectRect() mis-feature (return
- zero rect if input rect has zero height/width). [Bug 1810818]
-
-2007-10-09 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * generic/tkImage.c: Make Ttk_GetImage safe if called with NULL
- * tests/ttk/image.test: interp. Added some tests that crash
- on Windows without this fix.
-
-2007-10-02 Don Porter <dgp@users.sourceforge.net>
-
- [core-stabilizer-branch]
-
- * README: Bump version number to 8.5.0
+ * README: Bump version number to 8.6a2
* generic/tk.h:
* library/tk.tcl:
- * unix/configure.in: Updated LOCALES.
+ * unix/configure.in:
* unix/tk.spec:
* win/configure.in:
- * unix/configure: autoconf (2.59)
+ * unix/configure: autoconf-2.59
* win/configure:
-2007-09-30 Joe English <jenglish@users.sourceforge.net>
-
- * library/ttk/entry.tcl (WordBack, WordForward):
- Fix private routines accidentally defined in global namespace
- [Bug 1803836]
-
-2007-09-26 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * library/msgs/hu.msg: Added Hungarian message set, from Pader Reszo.
- [Patch 1800742]
-
-2007-09-20 Donal K. Fellows <dkf@users.sf.net>
-
- *** 8.5b1 TAGGED FOR RELEASE ***
-
- * generic/tkTextDisp.c (LayoutDLine): Only call callbacks that are
- * tests/textDisp.test (textDisp-32.3): not NULL. [Bug 1791052]
-
-2007-09-20 Don Porter <dgp@users.sourceforge.net>
-
- * changes: updates for 8.5b1 release.
-
-2007-09-19 Don Porter <dgp@users.sourceforge.net>
-
- * README: Bump version number to 8.5b1.
- * generic/tk.h: Merge from core-stabilizer-branch.
- * library/tk.tcl: Stabilizing toward 8.5b1 release now done
- * unix/configure.in: on the HEAD. core-stabilizer-branch is
- * unix/tk.spec: now suspended.
- * win/configure.in:
-
-2007-09-19 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * generic/tkStubLib.: Replaced isdigit with internal implementation.
-
-2007-09-18 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkStubLib.c: Remove C library calls from Tk_InitStubs()
- * win/makefile.vc: so that we don't need the C library linked
- in to libtkStub.
-
-2007-09-18 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * generic/tkImgGIF.c (FileReadGIF, StringReadGIF): Rewrite for greater
- clarity (more comments, saner code arrangement, etc.)
-
-2007-09-18 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * tests/all.tcl: Made ttk/all.tcl be the same as tk's all.tcl and
- * tests/ttk/all.tcl: make use of file normalize (bugs noted by
- mjanssen and GPS with msys)
-
-2007-09-17 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/makefile.vc: Add crt flags for tkStubLib now it uses C-library
- functions.
-
-2007-09-17 Joe English <jenglish@users.sourceforge.net>
-
- * unix/tcl.m4: use '${CC} -shared' instead of 'ld -Bshareable' to
- build shared libraries on current NetBSDs. [Bug 1749251]
- * unix/configure: regenerated (autoconf-2.59).
-
-2007-09-17 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkConsole.c: Revised callers of Tcl_InitStubs() to account
- * generic/tkMain.c: for restored compatible support for the call
- * generic/tkWindow.c: Tcl_InitStubs(interp, TCL_VERSION, 1). Also
- revised Tcl_PkgRequire() call for Tcl so that, for example, a Tk
- library built against Tcl 8.5.1 headers will not refuse to [load] into
- a Tcl 8.5.0 interpreter. [Tcl Bug 1578344]
-
- * generic/tk.h: Revised Tk_InitStubs() to restore Tk 8.4
- * generic/tkStubLib.c: source compatibility with callers of
- * generic/tkWindow.c: Tk_InitStubs(interp, TK_VERSION, 1).
-
-2007-09-17 Joe English <jenglish@users.sourceforge.net>
-
- * library/ttk/combobox.tcl: Try to improve combobox appearance on
- OSX + Tk 8.5. [Bug 1780286]
+ * changes: Updates for 8.6a2 release.
-2007-09-15 Daniel Steffen <das@users.sourceforge.net>
+2008-08-11 Ania Pawelczyk <aniap@users.sourceforge.net>
- * unix/tcl.m4: replace all direct references to compiler by ${CC} to
- enable CC overriding at configure & make time; run
- check for visibility "hidden" with all compilers;
- quoting fixes from TEA tcl.m4.
- (SunOS-5.1x): replace direct use of '/usr/ccs/bin/ld' in SHLIB_LD by
- 'cc' compiler driver.
- * unix/configure: autoconf-2.59
-
-2007-09-14 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish-Common.xcconfig: enable Tcl DTrace support.
- * macosx/Wish.xcodeproj/project.pbxproj:
-
-2007-09-12 Andreas Kupries <andreask@activestate.com>
-
- * win/Makefile.in (install-binaries): Fixed missing brace in the
- * win/makefile.vc (install-binaries): generated package index file.
- Note: unix/Makefile.in is good.
-
-2007-09-11 Reinhard Max <max@suse.de>
-
- * generic/tkImgGIF.c: Fixed a buffer overrun that got triggered by
- multi-frame interlaced GIFs that contain subsequent frames that are
- smaller than the first one.
-
- * tests/imgPhoto.test: Added a test for the above.
-
-2007-09-11 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkConsole.c: Revised calls to Tcl_InitStubs() and
- * generic/tkMain.c: [package require Tcl] so that Tk Says What It
- * generic/tkWindow.c: Means using the new facilties of [package] in
- * library/tk.tcl: Tcl 8.5 about what version(s) of Tcl it is
- * unix/Makefile.in: willing to work with. [Bug 1578344]
- * win/Makefile.in:
- * win/makefile.vc:
-
-2007-09-10 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/README: typo corrections [Bug 1788682]
-
-2007-09-10 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkConsole.c: Revise all Tcl_InitStubs() calls to restore
- * generic/tkMain.c: the traditional practice that a Tk shared
- * generic/tkWindow.c: library may [load] into a Tcl 8.5 interp at
- any patchlevel. This practice also matches the compile time checks of
- TCL_MAJOR_VERSION and TCL_MINOR_VERSION in tk.h. [Bug 1723622]
-
-2007-09-06 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkWindow.c (Initialize): Moved common Tk initialization
- * generic/tkInitScript.h (removed): script out of tkInitScript.h
- * macosx/tkMacOSXInit.c: and multiple TkpInit() routines and
- * unix/Makefile.in: into the common Initialize() routine in
- * unix/tkUnixInit.c: generic code. Also removed constraint on
- * win/tkWinInit.c: ability to define a custom [tkInit] before
- calling Tk_Init(). Until now the custom [tkInit] had to be a proc. Now
- it can be any command. Removal of tkInitScript.h also fixes [Bug
- 1656283].
-
-2007-09-06 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.xcode/project.pbxproj: discontinue unmaintained support
- * macosx/Wish.xcode/default.pbxuser: for Xcode 1.5; replace by Xcode2
- project for use on Tiger (with Wish.xcodeproj to be used on Leopard).
-
- * macosx/Wish.xcodeproj/project.pbxproj: updates for Xcode 2.5 and 3.0.
- * macosx/Wish.xcodeproj/default.pbxuser:
- * macosx/Wish.xcode/project.pbxproj:
- * macosx/Wish.xcode/default.pbxuser:
- * macosx/Wish-Common.xcconfig:
-
- * macosx/README: document project changes.
-
-2007-09-04 Joe English <jenglish@users.sourceforge.net>
-
- * generic/tkTest.c: Fix for [Bug 1788019] "tkTest.c compiler warning".
-
-2007-09-04 Don Porter <dgp@users.sourceforge.net>
-
- * unix/Makefile.in: It's unreliable to count on the release
- manager to remember to `make genstubs` before `make dist`. Let the
- Makefile remember the dependency for us.
-
- * unix/Makefile.in: Corrections to `make dist` dependencies to be
- sure that macosx/configure gets generated whenever it does not exist.
-
-2007-09-03 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/ttk/ttkInit.c (Ttk_Init): register ttk in package database
- to enable extension access to the ttkStubs table.
-
- * generic/ttk/ttkDecls.h: correct capitalization of ttk package name.
-
-2007-08-28 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- Assorted documentation improvements.
- * doc/button.n: Added examples.
- * doc/checkbutton.n: Added example.
- * doc/console.n: Standardized section ordering.
- * doc/tk.n: Added "See also".
- * doc/ttk_combobox.n: Added keywords.
-
-2007-08-27 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXDialog.c (Tk_ChooseColorObjCmd): correct setting of
- interp result [Bug 1782105]; fix -initialcolor overwriting last color
- selection; style cleanup.
-
-2007-08-21 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/rules.vc: Synchronize with tcl rules.vc
- * tests/all.tcl: Fix the line-endings.
-
-2007-08-07 Daniel Steffen <das@users.sourceforge.net>
+ * tests/canvImg.test: Update to tcltest2
+ * tests/canvRect.test:
+ * tests/canvText.test:
+ * tests/obj.test:
- * unix/Makefile.in: Add support for compile flags specific to
- object files linked directly into executables.
+2008-08-07 Ania Pawelczyk <aniap@users.sourceforge.net>
- * unix/configure.in (Darwin): Only use -seg1addr flag when prebinding;
- use -mdynamic-no-pic flag for object files linked directly into exes.
+ * tests/canvPs.test: Update to tcltest2
+ * tests/config.test:
+ * tests/canvas.test:
- * unix/configure: autoconf-2.59
-
-2007-08-01 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/tkWinDialog.c: Fix [Bug 1692927] (buffer length problems)
- * win/tkWinTest.c: Added 'testfindwindow' and 'testgetwindowinfo'
- and extended 'testwinevent' for WM_COMMAND support to enable testing
- native messagebox dialogs.
- * tests/winMsgbox.test: New Windows native messagebox tests.
-
-2007-07-25 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXDialog.c (NavServicesGetFile): Reset interp result on
- nav dialog cancel. [Bug 1743786]
-
-2007-07-09 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/Makefile.in: clarify what the headers installed are, and
- add ttkTheme.h and ttkDecls.h to private headers (later public).
-
-2007-07-09 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXWindowEvent.c (Tk_MacOSXIsAppInFront): Use process mgr
- * macosx/tkMacOSXMouseEvent.c: to determine if
- app is in front instead of relying on activate/deactivate events (which
- may arrive after this info is needed, e.g. during window drag/click
- activation); replace other process mgr use to get this info with calls
- to Tk_MacOSXIsAppInFront().
-
- * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): Correct
- window click activation, titlebar click handling and background window
- dragging/growing in the presence of grabs or window-/app-modal windows;
- fix window click activation bringing all other app windows to front.
-
- * macosx/tkMacOSXDraw.c (TkPutImage): Handle non-native XImage byte and
- bit orders; reverse bits via xBitReverseTable instead of InvertByte().
-
-2007-07-06 Joe English <jenglish@users.sourceforge.net>
-
- * library/ttk/aquaTheme.tcl: Set -anchor w for TMenubuttons.
- [Bug 1614540]
-
-2007-07-04 Andreas Kupries <andreask@activestate.com>
-
- * macosx/tkMacOSXXStubs.c (DestroyImage): Fixed seg.fault in release
- of image data for images coming from XGetImage. Change committed by me
- for Daniel Steffen. See 2007-06-23 for the change which introduced the
- problem.
-
-2007-07-02 Daniel Steffen <das@users.sourceforge.net>
-
- * xlib/xgc.c (XCreateGC): Correct black and white pixel values used to
- initialize GC foregrund and background fields.
-
- * macosx/tkMacOSXColor.c: Add debug messages for unknown pixel values.
-
- * macosx/tkMacOSXDraw.c (TkMacOSXRestoreDrawingContext): Don't restore
- port state if it wasn't altered by TkMacOSXSetupDrawingContext().
-
-2007-06-29 Daniel Steffen <das@users.sourceforge.net>
-
- * xlib/ximage.c: Bitmaps created from the static .xbm
- arrays always have LSBFirst bit order.
-
- * unix/configure.in: Fix flag used to weak-link libXss.
- * unix/configure: autoconf-2.59
-
- * macosx/tkMacOSXScrlbr.c: Correct int <-> dobule conversion issues
- that could lead to Carbon getting confused about scrollbar thumb size.
-
- * macosx/tkMacOSXDraw.c (XCopyArea, XCopyPlane, TkPutImage): Use
- TkMacOSX{Setup,Restore}DrawingContext() to setup/restore clip & colors.
- (TkMacOSXSetupDrawingContext, TkMacOSXRestoreDrawingContext): Add save
- and restore of QD port clip region; factor out clip region code common
- to CG and QD branches; check for port and context validity; handle
- tkPictureIsOpen flag during QD port setup.
- (TkScrollWindow): Remove unnecessary scroll region manipulation
-
- * macosx/tkMacOSXDraw.c: Remove second global QD temp region
- * macosx/tkMacOSXInt.h: (no longer necessary) and rename
- * macosx/tkMacOSXRegion.c: remaining global QD temp region.
- * macosx/tkMacOSXSubwindows.c:
- * macosx/tkMacOSXWindowEvent.c:
-
- * macosx/tkMacOSXDraw.c: Make useCGDrawing variable MODULE_SCOPE
- * macosx/tkMacOSXFont.c: and respect it for ATSUI font drawing.
-
- * macosx/tkMacOSXButton.c: Reduce reliance on current QD port
- * macosx/tkMacOSXColor.c: setting and remove unnecessary
- * macosx/tkMacOSXDebug.c: references to a drawable's QD port,
- * macosx/tkMacOSXDebug.h: notably replace GetWindowFromPort(
- * macosx/tkMacOSXDialog.c: TkMacOSXGetDrawablePort()) idiom by new
- * macosx/tkMacOSXDraw.c: TkMacOSXDrawableWindow() and change
- * macosx/tkMacOSXKeyEvent.c: TkMacOSXSetColorInPort() to take a port
- * macosx/tkMacOSXMenu.c: argument.
- * macosx/tkMacOSXMenubutton.c:
- * macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXScale.c:
- * macosx/tkMacOSXScrlbr.c:
- * macosx/tkMacOSXSubwindows.c:
- * macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXWm.c:
-
- * macosx/tkMacOSXInt.h: Factor out macros, declarations
- * macosx/tkMacOSXPrivate.h (new): and prototypes that are purely
- internal and private to the 'macosx' sources into a new internal header
- file that does _not_ get installed into Tk.framework/PrivateHeaders.
-
- * macosx/tkMacOSXButton.c: #include new tkMacOSXPrivate.h
- * macosx/tkMacOSXCarbonEvents.c: instead of tkMacOSXInt.h.
- * macosx/tkMacOSXClipboard.c:
- * macosx/tkMacOSXColor.c:
- * macosx/tkMacOSXCursor.c:
- * macosx/tkMacOSXDebug.c:
- * macosx/tkMacOSXDialog.c:
- * macosx/tkMacOSXDraw.c:
- * macosx/tkMacOSXEntry.c:
- * macosx/tkMacOSXEvent.c:
- * macosx/tkMacOSXFont.c:
- * macosx/tkMacOSXHLEvents.c:
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXKeyEvent.c:
- * macosx/tkMacOSXMenu.c:
- * macosx/tkMacOSXMenubutton.c:
- * macosx/tkMacOSXMenus.c:
- * macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXNotify.c:
- * macosx/tkMacOSXRegion.c:
- * macosx/tkMacOSXScale.c:
- * macosx/tkMacOSXScrlbr.c:
- * macosx/tkMacOSXSubwindows.c:
- * macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXXStubs.c:
- * macosx/ttkMacOSXTheme.c:
-
- * macosx/Wish.xcodeproj/project.pbxproj: Improve support for renamed
- * macosx/Wish.xcodeproj/default.pbxuser: tcl and tk source dirs; add
- * macosx/Wish-Common.xcconfig: 10.5 SDK build config; remove
- tclMathOp.c.
-
- * macosx/README: Document Wish.xcodeproj changes.
-
-2007-06-23 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkImgPhoto.c (ImgPhotoConfigureInstance, DisposeInstance):
- Use XDestroyImage instead of XFree to destroy XImage; replace runtime
- endianness determination by compile-time check for WORDS_BIGENDIAN.
-
- * xlib/ximage.c (XCreateBitmapFromData): Use XCreateImage and
- XDestroyImage instead of creating XImage structure manually.
-
- * macosx/tkMacOSXXStubs.c (XCreateImage, DestroyImage): Correct XImage
- bytes_per_line/bitmap_pad calculations and endianness setting; free
- image data and XImage structure at destruction; formatting cleanup.
-
- * macosx/tkMacOSXDialog.c (NavServicesGetFile): Disable app-modal
- sheet variant of nav dialog on OS versions where it causes problems.
-
-2007-06-20 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/ttk/ttk.tcl: Should require Tk before pseudo-providing
- tile 0.8.0.
-
-2007-06-09 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/ttkPanedwindow.c, doc/ttk_panedwindow.n,
- * tests/ttk/panedwindow.test: Added -width and -height options. Added
- 'panes' method, return list of managed windows. 'sashpos' method is
- now documented as part of the public interface, and details clarified.
- Should be easier to set initial sash positions now. Alleviates [Bug
- 1659067].
-
-2007-06-09 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinWm.c (WmIconphotoCmd): fix wm iconphoto RGBA issues.
- [Bug 1467997] (janssen)
-
- * win/tkWinMenu.c (TkWinHandleMenuEvent): Improve handling to allow
- for unicode char menu indices and not use CharUpper on Tcl utf
- strings. [Bug 1734223]
-
-2007-06-09 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/ttkManager.h, generic/ttk/ttkManager.c,
- * generic/ttk/ttkNotebook.c, generic/ttk/ttkPanedwindow.c,
- * generic/ttk/ttkFrame.c: Ttk_Manager API overhaul:
- + Ttk_Manager no longer responsible for managing slave records
- + Ttk_Manager structure now opaque
- + Ttk_Slave structure now private
- + Pass Ttk_Manager* to Tk_GeomMgr hooks instead of Ttk_Slave*
-
- * generic/ttk/ttkFrame.c: Simplified -labelwidget management.
-
- * doc/ttk_panedwindow.n, library/ttk/panedwindow.tcl: Changed
- documentation of ttk::panedwindow 'identify' command to match
- implementation.
-
- * generic/ttk/ttkNotebook.c, tests/ttk/notebook.test:
- BUGFIX: ttk::noteboook 'insert' command didn't correctly maintain
- current tab.
-
-2007-06-09 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXColor.c: Fix issues with TK_{IF,ELSE,ENDIF} macros;
- * macosx/tkMacOSXDraw.c: implement Jaguar equivalent of unavailable
- * macosx/tkMacOSXEntry.c: kHIToolboxVersion global; panic at startup
- * macosx/tkMacOSXEvent.c: if MAC_OS_X_VERSION_MIN_REQUIRED constraint
- * macosx/tkMacOSXInit.c: is not satisfied.
- * macosx/tkMacOSXInt.h:
- * macosx/tkMacOSXWm.c:
-
- * macosx/tkMacOSXDraw.c (XCopyArea, XCopyPlane, TkPutImage)
- (TkMacOSXSetupDrawingContext): Factor out common code and standardize
- setup/restore of port, context and clipping; formatting cleanup.
-
- * macosx/tkMacOSXWindowEvent.c: Add error checking.
- * macosx/tkMacOSXMenu.c: Fix gcc3 warning.
- * macosx/tkMacOSXScrlbr.c: Fix testsuite crash.
- * macosx/tkMacOSXSubwindows.c: Formatting cleanup.
- * macosx/tkMacOSXRegion.c: Fix typos.
- * macosx/tkMacOSXScale.c:
-
- * macosx/tkMacOSXXStubs.c (Tk_GetUserInactiveTime): Remove superfluous
- CFRetain/CFRelease.
-
- * macosx/Wish-Release.xcconfig: Disable tktest release build stripping.
-
- * macosx/Wish.xcodeproj/project.pbxproj: Add new Tclsh-Info.plist.in.
-
-2007-06-06 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXInt.h: Use native debug message API when available.
- * macosx/Wish-Debug.xcconfig:
-
- * macosx/tkMacOSXMouseEvent.c (GenerateMouseWheelEvent): Enable
- processing of mousewheel events in background windows.
-
- * macosx/tkMacOSXScrlbr.c: Modernize checks for active/front window.
- * macosx/tkMacOSXScale.c:
- * macosx/tkMacOSXWm.c:
-
- * macosx/tkMacOSXColor.c: Factor out verbose #ifdef checks of
- * macosx/tkMacOSXDraw.c: MAC_OS_X_VERSION_{MAX_ALLOWED,MIN_REQUIRED}
- * macosx/tkMacOSXEntry.c: and runtime checks of kHIToolboxVersion into
- * macosx/tkMacOSXEvent.c: new TK_{IF,ELSE,ENDIF}_MAC_OS_X macros.
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXInt.h:
- * macosx/tkMacOSXWm.c:
+2008-08-05 Joe English <jenglish@users.sourceforge.net>
- * macosx/tkMacOSXDraw.c: Factor out clip clearing in QD ports;
- * macosx/tkMacOSXEntry.c: Formatting cleanup.
+ * generic/tk.h, generic/tkEvent.c: Fix for [Bug 2010422] "no event
+ type or button # or keysym while executing "bind Listbox
+ <MouseWheel> [...]".
- * macosx/Wish.xcodeproj/project.pbxproj: Add settings for Fix&Continue.
+2008-08-03 Ania Pawelczyk <aniap@users.sourceforge.net>
- * unix/configure.in (Darwin): Link the Tk and Wish plists into their
- binaries in all cases; fix 64bit arch removal in fat 32&64bit builds.
+ * tests/cmds.test: Update to tcltest2
+ * tests/dialog.test:
+ * tests/get.test:
+ * tests/text.test: Update to tcltest2; report: 33.11 fails
- * unix/tcl.m4 (Darwin): Fix CF checks in fat 32&64bit builds.
- * unix/configure: autoconf-2.59
+2008-08-01 Pat Thoyts <patthoyts@users.sourceforge.net>
-2007-06-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * win/tkWinWm.c: [Bug 2028703]: Check wmPtr is valid in
+ * tests/wm.test: TopLevelReqProc.
- * doc/photo.n: Clarified the fact that base64 support for the -data
- option is not universal. [Bug 1731348] (matzek)
+2008-07-31 Don Porter <dgp@users.sourceforge.net>
-2007-06-03 Daniel Steffen <das@users.sourceforge.net>
+ * generic/tk.h: Added missing EXTERN for the Tcl_PkgInitStubsCheck
+ declaration to fix inability to embed non-stub-enabled Tk on Windows.
- * unix/Makefile.in: Add datarootdir to silence autoconf-2.6x warning.
+2008-07-29 Ania Pawelczyk <aniap@users.sourceforge.net>
- * macosx/Wish.xcodeproj/default.pbxuser: Add ttk tests.
+ * tests/constraints.tcl: -highlightthickness entry's option (fonts
+ constraint)
- * macosx/tkMacOSXMenu.c: Add error checking; whitespace cleanup.
+2008-07-28 Ania Pawelczyk <aniap@users.sourceforge.net>
- * macosx/tkMacOSXDraw.c: Comment formatting fixes for Xcode 3.0
- * macosx/tkMacOSXEmbed.c:
- * macosx/tkMacOSXEntry.c:
- * macosx/tkMacOSXFont.c:
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXKeyEvent.c:
- * macosx/tkMacOSXKeyboard.c:
- * macosx/tkMacOSXMenus.c:
- * macosx/tkMacOSXSend.c:
- * macosx/tkMacOSXSubwindows.c:
- * macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXXStubs.c:
+ * tests/cursor.test: Update to tcltest2
+ * tests/message.test:
-2007-06-02 Daniel Steffen <das@users.sourceforge.net>
+2008-07-26 Pat Thoyts <patthoyts@users.sourceforge.net>
- * macosx/tkMacOSXMenu.c (TkpPostMenu): Ensure cascade menus display in
- posted menus that are not part of the menubar or attached to a
- menubutton (fixes bug reported on tcl-mac by Linus Nyberg).
+ * doc/options.n: [Bug 1686012]: Direct to the font manual for -font.
-2007-05-31 Daniel Steffen <das@users.sourceforge.net>
+ * tests/constraints.tcl: Add a nonwin contraint.
+ * tests/listbox.test: [Bug 2024753]: Conform to testing policy.
- * macosx/tkMacOSXWindowEvent.c (GenerateUpdateEvent): Complete all
- pending idle-time redraws before newly posted Expose events are
- processed; add bounds of redrawn windows to update region to ensure
- all child windows overdrawn by parents are redrawn.
+ * win/tkWinWm.c: [Bug 2009788]: Check that the parent has been mapped
+ * tests/wm.test: before calling RemapWindows.
- * macosx/tkMacOSXWindowEvent.c: Centralize clip and window invalidation
- * macosx/tkMacOSXSubwindows.c: after location/size changes in the
- * macosx/tkMacOSXWm.c: BoundsChanged carbon event handler;
- correct/add window invalidation after window attribute changes.
+ * win/tkWinWindow.c: [Bug 2026405]: Check for 0x prefix in sprintf %p.
- * macosx/tkMacOSXSubwindows.c (XResizeWindow, XMoveResizeWindow)
- (XMoveWindow): Factor out common code dealing with embedded and
- non-toplevel windows; remove unnecessary clip and window invalidation.
+2008-07-25 Ania Pawelczyk <aniap@users.sourceforge.net>
- * macosx/tkMacOSXButton.c (TkpDisplayButton): Move clip setup closer
- to native button drawing calls.
+ * tests/bind.test: Update to tcltest2
- * macosx/tkMacOSXWm.c (TkMacOSXIsWindowZoomed, TkMacOSXZoomToplevel):
- Correct handling of gridded windows in max size calculations.
+2008-07-24 Jan Nijtmans <nijtmans@users.sf.net>
- * macosx/tkMacOSXEvent.c (TkMacOSXFlushWindows): Use HIWindowFlush API
- when available.
+ * generic/*.c: [Bug 2021443]: Fix inconsistant "wrong # args" messages
+ * macosx/tkMacOSXSend.c
+ * macosx/tkMacOSXWm.c
+ * unix/tkUnixSend.c
+ * unix/tkUnixWm.c
+ * tests/*.test
- * macosx/tkMacOSXColor.c: Cleanup whitespace and formatting.
- * macosx/tkMacOSXDraw.c:
- * macosx/tkMacOSXSubwindows.c:
- * macosx/tkMacOSXWm.c:
+2008-07-22 Ania Pawelczyk <aniap@users.sourceforge.net>
- * generic/tkFont.c: #ifdef out debug msg printing to stderr.
- * generic/tkTextDisp.c:
+ * tests/bell.test: Update to tcltest2
+ * tests/bgerror.test:
+ * tests/bitmap.test:
+ * tests/border.test:
+ * tests/button.test:
+ * tests/entry.test:
+ * tests/spinbox.test:
-2007-05-30 Don Porter <dgp@users.sourceforge.net>
+2008-07-22 Daniel Steffen <das@users.sourceforge.net>
- * generic/tk.h: Correct placement of #include <tcl.h>. [Bug 1723812]
+ * library/ttk/aquaTheme.tcl: Use system color names and TIP145 named
+ font instead of hardcoded color values and deprecated native font name
-2007-05-30 Daniel Steffen <das@users.sourceforge.net>
+ * macosx/tkMacOSXHLEvents.c: Factor out common code; formatting.
- * library/bgerror.tcl: Standardize dialog option & button size
- * library/dialog.tcl: modifications done when running on on Aqua.
- * library/msgbox.tcl:
+2008-07-08 Pat Thoyts <patthoyts@users.sourceforge.net>
- * library/demos/button.tcl: Set button highlightbackground on Aqua.
+ * doc/*.n: Fixed broken line endings from last doc commit.
- * macosx/tkMacOSXMenu.c (DrawMenuSeparator): Use DrawingContext API.
+2008-07-04 Joe English <jenglish@users.sourceforge.net>
- * macosx/tkMacOSXWindowEvent.c (ClearPort): Clip to updateRgn.
+ * generic/ttk/ttkDefaultTheme.c, generic/ttk/ttkClamTheme.c,
+ * generic/ttk/ttkClassicTheme.c, generic/ttk/ttkElements.c:
+ [Bug 2009213]: Audit: ensure that output arguments to Tk_Get*FromObj()
+ are initialized, in case of erroneous style specifications.
- * macosx/tkMacOSXDebug.c: Factor out debug region flashing.
- * macosx/tkMacOSXDebug.h:
- * macosx/tkMacOSXDraw.c:
- * macosx/tkMacOSXSubwindows.c:
- * macosx/tkMacOSXWindowEvent.c:
+2008-07-02 Donal K. Fellows <dkf@users.sf.net>
- * macosx/tkMacOSXEvent.c: Cleanup whitespace and formatting.
- * macosx/tkMacOSXFont.c:
- * macosx/tkMacOSXRegion.c:
- * macosx/tkMacOSXSubwindows.c:
- * macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXXStubs.c:
- * xlib/xgc.c:
+ * macosx/tkMacOSXHLEvents.c: Some tidying up of this file. Make sure
+ that failing handling callbacks get reported as background errors.
- * macosx/Wish.xcodeproj/project.pbxproj: Delete references to removed
- * macosx/Wish.xcodeproj/default.pbxuser: ttk files.
+2008-06-30 Donal K. Fellows <dkf@users.sf.net>
-2007-05-28 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
+ * doc/*.1, doc/*.3, doc/*.n: Remove out of date changebars, make
+ formatting of typedefs consistent, other small changes.
- * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Fix short measures
- with flags=TK_WHOLE_WORDS|TK_AT_LEAST_ONE [Bug 1716141]. Make some
- casts unnecessary by changing variable types.
+2008-06-25 Don Porter <dgp@users.sourceforge.net>
-2007-05-25 Joe English <jenglish@users.sourceforge.net>
+ *** 8.6a1 TAGGED FOR RELEASE ***
- * library/ttk/ttk.tcl: Omit ttk::dialog and dependencies.
- * library/ttk/dialog.tcl, library/ttk/icons.tcl,
- * library/ttk/keynav.tcl: Removed.
- * tests/ttk/misc.test: Removed.
- * doc/ttk_dialog.tcl: Removed.
+ * changes: Updates for 8.6a1 release.
-2007-05-25 Donal K. Fellows <dkf@users.sf.net>
+2008-06-24 Pat Thoyts <patthoyts@users.sourceforge.net>
- * doc/canvas.n: Fixed documentation of default -joinstyle option
- values for line and polygon items. [Bug 1725782]
+ * library/demos/ttkpane.tcl: Work around missing timezones
+ * doc/text.n: [Bug 1997293]: Fix documentation of text tag options.
-2007-05-22 Don Porter <dgp@users.sourceforge.net>
+2008-06-19 Don Porter <dgp@users.sourceforge.net>
- [core-stabilizer-branch]
+ * changes: Updates for 8.6a1 release.
- * unix/configure: autoconf-2.59 (FC6 fork)
- * win/configure:
+ * generic/tk.h: TIP 285 additions make Tk 8.6 call the new
+ * library/tk.tcl: Tcl_Canceled() routine, available only in Tcl
+ 8.6, so bump our Tcl dependencies to version 8.6. Tk 8.6a1 will no
+ longer [load] into a Tcl 8.5 interp.
- * README: Bump version number to 8.5b1
+ * README: Bump version number to 8.6a1
* generic/tk.h:
* library/tk.tcl:
* unix/configure.in:
* unix/tk.spec:
* win/configure.in:
-2007-05-18 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/ttkEntry.c(EntrySetValue): Ensure that widget is in a
- consistent state before setting the linked -textvariable. Previously,
- it was possible for [$e index insert] to point past the end of the
- string, leading to heap corruption. [Bug 1721532]
- * tests/ttk/entry.test(entry-9.1): Add test case for the above.
-
-2007-05-18 Don Porter <dgp@users.sourceforge.net>
-
- * unix/configure: autoconf-2.59 (FC6 fork)
+ * unix/configure: autoconf-2.59
* win/configure:
- * README: Bump version number to 8.5a7
- * generic/tk.h:
- * library/tk.tcl:
- * unix/configure.in:
- * unix/tk.spec:
- * win/configure.in:
-
- * tests/ttk/treetags.test: Another bit of test suite
- SCIM-tolerance. [Bug 1609316]
-
-2007-05-17 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tk.decls: Workaround 'make checkstubs' failures from
- tkStubLib.c MODULE_SCOPE revert. [Bug 1716117]
-
- * macosx/Wish.xcodeproj/project.pbxproj: Add tkOldTest.c and remove
- tkStubImg.c.
-
-2007-05-16 Joe English <jenglish@users.sourceforge.net>
-
- * generic/tkStubLib.c: Change Tk_InitStubs(), tkStubsPtr, and the
- auxilliary stubs table pointers back to public visibility. See [Bug
- 1716117] for details.
-
- Removed TCL_STORAGE_CLASS monkey business, as it had no effect.
-
-2007-05-16 Don Porter <dgp@users.sourceforge.net>
-
- * library/choosedir.tcl: Removed uses of obsolete {expand}
- * library/comdlg.tcl: syntax; replaced with the now
- * library/tk.tcl: approved {*}. [Bug 1710633]
- * tests/canvImg.test:
- * tests/imgPhoto.test:
-
- * tests/bind.test: Make test suite more SCIM-tolerant. [Bug 1609316]
-
-2007-05-16 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/makefile.vc: Test ttk widgets.
-
-2007-05-15 Joe English <jenglish@users.sourceforge.net>
-
- * unix/tkUnixRFont.c: Fix crash introduced by previous fix exposed
- under newer fontconfig libraries [Bug 1717830] again.
-
-2007-05-15 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkGrid.c: Stop crash due to list intrep shimmer [Bug 1677608]
-
-2007-05-15 Joe English <jenglish@users.sourceforge.net>
-
- * unix/tkUnixRFont.c: Fix various memory leaks. [Bug 1717830], [Bug
- 800149]
-
-2007-05-14 Don Porter <dgp@users.sourceforge.net>
-
- [Tk Bug 1712081]
-
- * unix/Makefile.in: Updates to account for new and deleted files
- * win/Makefile.in: tkStubImg.c and tkOldTest.c.
- * win/makefile.bc:
- * win/makefile.vc:
-
- * generic/tkOldTest.c (new): New file used to create testing
- * generic/tkTest.c: commands for testing various Tk
- * tests/constraints.tcl: legacy interfaces where a separate
- * tests/image.test: compilation unit is needed in order to
- #define suitable macros during compilation. Only the effect of
- USE_OLD_IMAGE on Tk_CreateImageType() is currently tested, but more
- similar testing commands can be added to this same file. New
- constraint defined to detect presence of the image type provided by
- the new testing code, and a few tests added to exercise it. Having
- USE_OLD_IMAGE support tested by the default test suite should reduce
- chance of a recurrence of this bug.
-
- * doc/CrtImgType.3: Revised docs to better indicate the legacy
- * doc/CrtPhImgFmt.3: nature of the interfaces supported by
- USE_OLD_IMAGE.
-
- * generic/tkDecls.h: make genstubs
- * generic/tkStubInit.c:
-
- * generic/tk.decls: Reworked USE_OLD_IMAGE support to use
- * generic/tk.h: the same support mechanisms both with
- * generic/tkStubImg.c (deleted):and without a stub-enabled build. In
- each case, route the legacy calls to Tk_CreateImageType and
- Tk_CreatePhotoImageFormat through the Tk_CreateOldImageType and
- Tk_CreateOldPhotoImageFormat routines. Add those routines to the
- public stub table so they're available to a stub-enabled extension.
- Remove the definition of Tk_InitImageArgs() and use a macro to convert
- any calls to it in source code into a comment.
-
- * generic/tkImage.c: Removed the MODULE_SCOPE declarations that
- * generic/tkImgPhoto.c: broke USE_OLD_IMAGE support.
-
-2007-05-11 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * tests/winButton.test: Avoid font dependencies in results.
-
- * generic/tkFont.c: propagate error from TkDeleteNamedFont. [Bug
- 1716613]
-
-2007-05-09 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkFileFilter.c (AddClause): OSType endianness fixes.
-
- * library/palette.tcl (tk::RecolorTree): Handle color options with
- empty value, fixes error due to emtpy -selectforeground (reported on
- tcl-mac by Russel E. Owen).
-
- * macosx/tkMacOSXWindowEvent.c: Ensure window is brought to the front
- * macosx/tkMacOSXMouseEvent.c: at the start of a window drag (except
- * macosx/tkMacOSXInt.h: when cmd key is down); formatting and
- whitespace fixes.
-
- * macosx/tkMacOSXDialog.c (Tk_GetSaveFileObjCmd): Add -filetypes option
- processing (fixes fileDialog-0.1, fileDialog-0.2 failures).
-
- * macosx/tkMacOSXEmbed.c (TkpMakeWindow, TkpUseWindow): Fix sending of
- Visibility event for embedded windows (fixes frame-3.9 hang).
-
- * macosx/tkMacOSXScrlbr.c (ScrollbarBindProc): Fix testsuite
- * macosx/tkMacOSXSubwindows.c (TkMacOSXUpdateClipRgn): crashes by
- adding sanity checks.
-
- * macosx/Wish.xcodeproj/project.pbxproj: Add 'DebugUnthreaded' &
- * macosx/Wish.xcodeproj/default.pbxuser: 'DebugLeaks' targets and env
- var settings needed to run the 'leaks' tool.
-
- * macosx/tkMacOSXButton.c: Fix debug msg typo.
-
- * tests/constraints.tcl: Ensure 'nonUnixUserInteraction' constraint is
- set for aqua.
-
- * tests/choosedir.test: Add 'notAqua' constraints to X11-only tests;
- * tests/clrpick.test: add 'nonUnixUserInteraction' to 'unix' tests
- * tests/menuDraw.test: requiring interaction on aqua.
- * tests/unixMenu.test:
- * tests/unixWm.test:
- * tests/winMenu.test:
-
-2007-05-07 Joe English <jenglish@users.sourceforge.net>
-
- * unix/tkUnixRFont.c: Properly cast sentinel arguments to variadic
- function (fixes "warning: missing sentinel in function call", [Bug
- 1712001])
-
-2007-05-04 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * generic/tkFont.c: TIP #145 implementation -
- * generic/tkFont.h: Enhanced font handling.
- * win/tkWinDefault.h:
- * win/tkWinFont.c:
- * win/tkWinInt.h:
- * win/tkWinWm.c:
- * library/demos/widget:
- * library/ttk/fonts.tcl:
-
-2007-05-04 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * doc/ttk_treeview.n, doc/ttk_panedwindow.n, doc/ttk_dialog.n:
- * doc/ttk_checkbutton.n, doc/tk.n, doc/menu.n, doc/font.n:
- * doc/canvas.n: Spelling fixes. [Bug 1686210]
-
-2007-05-03 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-
- * generic/tkStubLib.c (Tk_InitStubs):
- * generic/ttk/ttkLabel.c (LabelSetup):
- * unix/tkUnixSelect.c (ConvertSelection):
- * unix/tkUnixEvent.c (TkUnixDoOneXEvent):
- * generic/tkConfig.c (Tk_RestoreSavedOptions):
- * generic/tkCanvPs.c (TkCanvPostscriptCmd):
- * generic/tkOption.c (GetDefaultOptions):
- * unix/tkUnixRFont.c (TkpGetFontAttrsForChar, InitFont)
- (TkpGetFontFamilies, TkpGetSubFonts):
- * unix/tkUnixSend.c (TkpTestsendCmd, RegOpen): Squelch warnings from
- GCC type aliasing. [Bug 1711985 and others]
-
-2007-04-29 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/configure.in: Fix for default case in tk debug build detection.
- * unix/configure: autoconf-2.59
-
-2007-04-27 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/ttkTreeview.c(TagOptionSpecs): Use TK_OPTION_STRING
- instead of TK_OPTION_FONT to avoid resource leak in tag management.
-
-2007-04-26 Joe English <jenglish@users.sourceforge.net>
-
- * macosx/ttkMacOSXTheme.c: Merged OFFSET_RECT processing into
- BoxToRect(); factored out PatternOrigin; resynchronized with Tile
- codebase.
-
-2007-04-26 Jeff Hobbs <jeffh@ActiveState.com>
-
- *** 8.5a6 TAGGED FOR RELEASE ***
-
- * unix/Makefile.in (dist): Correct tests/ttk glob inclusion
-
-2007-04-25 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/Makefile.in (dist): Add tests/ttk dir to src dist
-
- * unix/tkUnixMenubu.c (TkpDisplayMenuButton): Init width/height to 0
-
-2007-04-25 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/Makefile.in (dist): Add macosx/*.xcconfig files to src dist;
- copy license.terms to dist macosx dir; fix autoheader bits.
-
-2007-04-24 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/Makefile.in (dist): Add ttk bits to src dist
-
- * tests/font.test (font-46.[12]): Correct listification of result
-
-2007-04-23 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkCanvas.c: Allow -selectforeground option to be None; add
- * generic/tkCanvText.c: fallback to fgColor when selFgColor is None
- * generic/tkEntry.c: (new default on aqua to match native L&F).
- * generic/tkListbox.c:
- * generic/tkText.c:
-
- * generic/tkCanvas.c: Add support for bypassing all of Tk's double
- * generic/tkEntry.c: buffered drawing into intermediate pixmaps
- * generic/tkFrame.c: (via TK_NO_DOUBLE_BUFFERING #define), it is
- * generic/tkListbox.c: unnecessary & wasteful on aqua where all
- * generic/tkPanedWindow.c: drawing is already double-buffered by the
- * generic/tkTextDisp.c: window server. (Use of this on other
- * generic/ttk/ttkWidget.c: platforms would only require implementation
- * unix/tkUnixScale.c: of TkpClipDrawableToRect()).
- * macosx/tkMacOSXPort.h:
-
- * library/bgerror.tcl: On aqua, use moveable alert resp. modal dialog
- * library/dialog.tcl: window class and corresponding system
- background pattern; fix button padding.
-
- * library/tearoff.tcl: Correct aqua menu bar height; vertically offset
- * library/tk.tcl: aqua tearoff floating window to match menu.
-
- * library/demos/goldberg.tcl: Fix overwriting of widget demo global.
-
- * library/demos/menu.tcl: On aqua, use custom MDEF and tearoffs;
- * library/demos/menubu.tcl: correct menubutton toplevel name.
-
- * library/demos/puzzle.tcl: Fix button size & padding for aqua.
- * library/demos/radio.tcl:
-
- * macosx/tkMacOSXCarbonEvents.c: Add window event target carbon event
- * macosx/tkMacOSXEvent.c: handler for all kEventClassWindow and
- * macosx/tkMacOSXEvent.h: kEventClassMouse events; move all
- * macosx/tkMacOSXNotify.c: remaining events except for
- * macosx/tkMacOSXWindowEvent.c: kEventClassKeyboard from dispatcher to
- application event handler; pass event handler callRef downstream; fix
- debug event tracing; process all tcl event types in carbon event timer;
- delay carbon event timer first fire; add TkMacOSXTrackingLoop() to mark
- enter/exit of event tracking loop during which all tcl events but only
- carbon update events should be processed by the timer (replaces various
- calls to Tcl_SetServiceMode()); rename TkMacOSXReceiveAndProcessEvent()
- to TkMacOSXReceiveAndDispatchEvent(), move it from tkMacOSXEvent.c to
- tkMacOSXCarbonEvents.c and modify it to dequeue only update events
- during a tracking loop; add TkMacOSXRunTclEventLoop() to standardize
- the various ways in use to run the tcl event loop; add handling of
- kEventClassAppearance events (for ScrollBarVariantChanged event).
-
- * macosx/tkMacOSXDialog.c: Use new TkMacOSXTrackingLoop() around
- * macosx/tkMacOSXEvent.c: blocking API that puts up modal dialogs
- * macosx/tkMacOSXMenu.c: or when entering/exiting menu/control
- * macosx/tkMacOSXMouseEvent.c: tracking, window dragging and other
- * macosx/tkMacOSXScale.c: mouse tracking loops.
- * macosx/tkMacOSXScrlbr.c:
- * macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXWm.c:
-
- * macosx/tkMacOSXDialog.c: Use new TkMacOSXRunTclEventLoop()
- * macosx/tkMacOSXScale.c: instead of Tcl_DoOneEvent(),
- * macosx/tkMacOSXScrlbr.c: Tcl_ServiceAll(), TclServiceIdle()
- * macosx/tkMacOSXWindowEvent.c: and Tcl_GlobalEval("update idletasks").
-
- * macosx/tkMacOSXColor.c: Make available as Tk system colors all
- * macosx/tkMacOSXPort.h: appearance manager brushes, text colors and
- backgrounds with new and legacy names, as well as the fully transparent
- color "systemTransparent"; add TkMacOSXSetColorIn{Port,Context}() to
- directly set an X pixel color value in the current QD port resp. the
- given CG context without requiring passage through rgb representation
- (lossy for most system colors); modernize/remove Classic-era code;
- replace crufty strcmp() elseifs by Tcl_GetIndexFromObjStruct().
-
- * macosx/tkMacOSXButton.c: Use new TkMacOSXSetColorInPort()
- * macosx/tkMacOSXDraw.c: instead of setting rgb color directly
- * macosx/tkMacOSXMenubutton.c: to allow for non-rgb system colors.
-
- * macosx/tkMacOSXCursor.c: Implement "none" cursor as on other
- platforms [Patch 1615427]; add all missing appearance manager cursors.
-
- * macosx/tkMacOSXDefault.h: Set SELECT_FG_COLORs to None to match aqua
- L&F; use standard system color names; use new 'menu' system font;
- correct default scrollbar width.
-
- * macosx/tkMacOSXDraw.c: Standardize initialization, use and
- * macosx/tkMacOSXInt.h: emptying of various static temp rgns
- * macosx/tkMacOSXRegion.c: onto two global RgnHandles; in debug
- * macosx/tkMacOSXSubwindows.c: builds, verify emptiness of these temp
- * macosx/tkMacOSXWindowEvent.c: rgns before use.
-
- * macosx/tkMacOSXDraw.c: Add TkMacOSX{Setup,Restore}DrawingContext() to
- * macosx/tkMacOSXInt.h: abstract common setup & teardown of drawing
- environment (for both CG and QD); save/restore QD theme drawing state;
- handle GC clip region; add TkpClipDrawableToRect() to allow clipped
- drawing into drawable regardless of GC used; use new system color
- "systemWindowHeaderBackground" to setup background in themed toplevels;
- correct implementation of TkMacOSXMakeStippleMap().
-
- * macosx/tkMacOSXEntry.c: Use new TkMacOSXSetupDrawingContext() and
- * macosx/tkMacOSXFont.c: TkMacOSXRestoreDrawingContext() instead of
- * macosx/ttkMacOSXTheme.c: various setup/teardown procs like
- TkMacOSX{SetUp,Release}CGContext(), TkMacOSXQuarz{Start,End}Draw(),
- TkMacOSXSetUpGraphicsPort() etc.
-
- * macosx/tkMacOSXEmbed.c: Add CG context and drawable clip rgn fields
- * macosx/tkMacOSXInt.h: to MacDrawable struct.
- * macosx/tkMacOSXSubwindows.c:
-
- * macosx/tkMacOSXDialog.c: Make -parent option of tk_getOpenFile et al.
- use the sheet version of NavServices dialogs; ensure native parent win
- exists before using StandardSheet API for tk_messageBox [Bug 1677611];
- force sheets to behave like app-modal dialogs via WindowModality() API;
- use more modern ColorPicker API.
-
- * macosx/tkAboutDlg.r: Use themed movable modal dialog, fix (c) year.
-
- * macosx/tkMacOSXEntry.c: Take xOff/yOff of MacDrawable into account
- * macosx/ttkMacOSXTheme.c: when computing locations/bounds to ensure
- correct posititioning when not drawing into intermediate pixmap.
-
- * macosx/tkMacOSXFont.c: Use appearance manager API to map system font
- * macosx/tkMacOSXFont.h: names to TkFonts; add "menu" system font for
- menu item text drawing from MDEF; always draw with CG; remove QD
- dependent stippling algorithm; move most header declarations into the
- source file (as they were not used anywhere else).
-
- * macosx/tkMacOSXMenu.c: Large-scale rewrite of custom
- * macosx/tkMacOSXMenu.r (removed): MDEF and related code that
- * macosx/Wish.xcode/project.pbxproj: restores many longtime-MIA
- * macosx/Wish.xcodeproj/project.pbxproj: features to working order
- * unix/Makefile.in: (e.g. images, custom colors &
- fonts in menus etc); implement compound menu items; use Appearance Mgr
- and ThemeText APIs to mimic native MDEF as closely as possible when
- default "menu" system font is used; remove now obsolete SICN drawing
- code and resources.
-
- * macosx/tkMacOSXCarbonEvents.c: Handle additional menu carbon events
- * macosx/tkMacOSXEvent.c: in order to support <<MenuSelect>> in
- * macosx/tkMacOSXMenu.c: the menubar and in menus that are not
- * macosx/tkMacOSXMenus.c: using the custom MDEF [Bug 1620826];
- fix early and missing clearing of current Tk active menu entry; fix
- extraneous sending of <<MenuSelect>> during active menu entry clearing.
-
- * macosx/tkMacOSXMouseEvent.c: Add support for async window dragging by
- the window server; set the corresponding window attribute by default.
-
- * macosx/tkMacOSXMouseEvent.c: Rationalized handling order of
- non-mousedown events; add TkMacOSXModifierState() to retrieve the
- current key modifiers in carbon format.
-
- * macosx/tkMacOSXScrlbr.c: Use appearance manager API to retrieve
- scrollbar component metrics; add awareness of multiple possibilites for
- scrollbar arrow position in aqua and handle user changes to arrow
- position pref; handle difference in metrics of small & large scrollbar
- variants; handle aqua "jump to here" scrollbar behaviour; correct
- computation of scroll view size and position; enforce min scrollbar
- height to avoid scrollbar component overlap; erase scrollbar area
- outside of standard width; remove broken auto-adjust code; account for
- window class when leaving space for grow box; remove code to manually
- draw grow box; use modern API for thumb scroll proc; replace
- HiliteControl() by modern API; replace control mgr constants with
- appearance mgr equivalents.
-
- * macosx/tkMacOSXSubwindows.c: Use SetWindowBounds() API instead of
- SizeWindow(); invalidate clip regions after X{Map,Unmap}Window as fix
- for [Bug 940117] made them dependent on mapping state; remove unneeded
- calls to TkMacOSXInvalClipRgns() and unnecessary setting of QD port;
- use native-endian pixmap on intel; remove obsolete pixmap pix locking.
-
- * macosx/tkMacOSXWindowEvent.c: Handle only the first of a batch of
- kEventAppAvailableWindowBoundsChanged events sent per transaction;
- handle kEventWindowBoundsChanged event to support live window resizing
- and centralized sending of location/size changed ConfigureNotify
- events; ensure HIGrowBox is redrawn after bounds change; constrain
- window after dragging to ensure titlebar is not inacessible
- offscreen or under dock/menubar; handle kEventWindowGetRegion and
- kEventWindowDrawContent for transparent windows to mark resp. paint
- content region as transparent; handle kEventWindowConstrain for
- fullscreen windows to ensure bounds match new screen size; enter/exit
- fullscreen UIMode upon activation/deactivation of fullscreen window.
-
- * macosx/tkMacOSXWm.c: Use live-resize and async-drag carbon window
- * macosx/tkMacOSXWm.h: attributes for toplevels by default; implement
- new [wm attributes] -topmost, -transparent and -fullscreen; refactor
- WmAttributesCmd() parallelling the tkUnixWm.c implementation, use thus
- factored proc to set proxy icon from [wm iconbitmap]; dynamically
- determine default values for toplevel min and max sizes (similar to
- tkWinWm.c impl): min sizes depend on window class & attributes to
- ensure visibility of all titlebar widgets and grow box, max sizes
- depend on maximal window bounds for all active displays; factor out
- code that puts into effect changes to master or override_redirect; use
- RepositionWindow() API to determine staggered initial window bounds;
- correct resize limit calculations, handle gridding and use modern
- resize API in TkMacOSXGrowToplevel(); remove sending of ConfigureNotify
- after resize or zoom (now handled by BoundsChanged handler); correct
- composite carbon window attribute handling, remove currently unusable
- attributes and add new attributes in [tk::unsupported::MacWindowStyle];
- ensure validity of window class and attributes before use; apply
- changes to window class when handling carbon window attribute changes
- (if HIWindowChangeClass() API available); add debug build warning
- message when deprecated window style is used instead of window class;
- use transparent HIGrowBox for resizable windows; avoid unnecessary
- calls to window structure width API; use tcl time API in TkpGetMS();
- add TkMacOSXEnterExitFullscreen() to enter/exit UIMode with dock and
- menubar hidden; restrict wmTracing output to debug builds; remove
- unneeded calls to TkMacOSXInvalClipRgns() and unnecessary setting of QD
- port; workaround GetWindowStructureWidths() Carbon bug (bogus results
- for never-mapped floating windows).
-
- * macosx/tkMacOSXXStubs.c (TkMacOSXDisplayChanged): Add maximal window
- bounds field to Screen record (in ext_data), computed as the union of
- available window positioning bounds of all graphics devices (displays).
-
- * macosx/tkMacOSXBitmap.c: Fix macRoman encoding leak.
- * macosx/tkMacOSXCursor.c:
-
- * macosx/tkMacOSXDebug.c (TkMacOSXCarbonEventToAscii): Use static
- * macosx/tkMacOSXDebug.h: buffer to simplify callers; const fixes.
-
- * macosx/tkMacOSXBitmap.c: Use more efficient QDSwapPort() instead of
- * macosx/tkMacOSXButton.c: GetPort()/SetPort()/GetGWorld()/SetGWorld().
- * macosx/tkMacOSXDraw.c:
- * macosx/tkMacOSXMenubutton.c:
- * macosx/tkMacOSXScale.c:
- * macosx/tkMacOSXScrlbr.c:
- * macosx/tkMacOSXXStubs.c:
-
- * macosx/tkMacOSXColor.c: Use kHIToolboxVersionNumber for runtime OS
- * macosx/tkMacOSXEntry.c: version check rather than Gestalt() etc.
- * macosx/tkMacOSXInt.h:
- * macosx/tkMacOSXWm.c:
-
- * macosx/tkMacOSXDraw.c: Remove obsolete and now incorrect
- * macosx/tkMacOSXInt.h: tkMenuCascadeRgn clipping code.
- * macosx/tkMacOSXMenu.c:
-
- * macosx/tkMacOSXHLEvents.c: Replace Tcl_GlobalEval() resp. Tcl_Eval()
- * macosx/tkMacOSXScrlbr.c: by Tcl_EvalEx().
- * macosx/tkMacOSXInit.c:
-
- * macosx/tkMacOSXInit.c (TkpInit): Reorder initialization steps.
-
- * macosx/tkMacOSXKeyEvent.c: Remove pre-10.2 support.
-
- * macosx/tkMacOSXMenus.c: Remove now useless call to
- TkMacOSXHandleTearoffMenu(); use \x.. quoting for non-latin1 macroman
- literar chars to allow file to be edited as utf-8.
-
- * macosx/tkMacOSXScale.c: Replace TrackControl() by modern
- * macosx/tkMacOSXScrlbr.c: HandleControlClick() API (using new
- TkMacOSXModifierState()).
-
- * macosx/tkMacOSXInt.h: Move all constant #defines needed to
- * macosx/tkMacOSXColor.c: support building on older OS X releases
- * macosx/tkMacOSXEvent.h: to a central location in tkMacOSXInt.h.
- * macosx/tkMacOSXFont.c:
- * macosx/tkMacOSXMenu.c:
- * macosx/tkMacOSXMenubutton.c:
- * macosx/tkMacOSXMenus.c:
- * macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXWm.c:
- * macosx/ttkMacOSXTheme.c:
-
- * macosx/tkMacOSXInt.h: Add ChkErr() macro to factor out
- * macosx/tkMacOSXButton.c: Carbon OSStatus return value checking
- * macosx/tkMacOSXCarbonEvents.c: and TkMacOSXDbgMsg() macro to factour
- * macosx/tkMacOSXClipboard.c: out debug message output; use these
- * macosx/tkMacOSXColor.c: macros to replace #ifdef TK_MAC_DEBUG
- * macosx/tkMacOSXCursor.c: blocks & direct printing to stderr,
- * macosx/tkMacOSXDebug.c: and to do additional OSStatus return
- * macosx/tkMacOSXDialog.c: checking, and to standardize OSStatus
- * macosx/tkMacOSXDraw.c: usage.
- * macosx/tkMacOSXEntry.c:
- * macosx/tkMacOSXEvent.c:
- * macosx/tkMacOSXFont.c:
- * macosx/tkMacOSXHLEvents.c:
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXKeyEvent.c:
- * macosx/tkMacOSXMenu.c:
- * macosx/tkMacOSXMenubutton.c:
- * macosx/tkMacOSXMenus.c:
- * macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXScrlbr.c:
- * macosx/tkMacOSXSubwindows.c:
- * macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXXStubs.c:
-
- * macosx/tkMacOSXSend.c: Remove duplicate/unused declarations.
- * macosx/tkMacOSXXStubs.c:
-
- * macosx/tkMacOSXDebug.c: Const fixes.
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXTest.c:
- * macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXXStubs.c:
-
- * macosx/Wish-Info.plist.in: Add tcl document extensions/mime types and
- LSMinimumSystemVersion, LSRequiresCarbon & NSAppleScriptEnabled keys.
-
- * macosx/Wish-Common.xcconfig: Add Wish's Info.plist as __info_plist
- section to tktest; enable more warnings.
-
- * macosx/Wish.xcodeproj/project.pbxproj: Add 'DebugMemCompile' build
- configuration that calls configure with --enable-symbols=all; disable
- configure check for __attribute__((__visibility__("hidden"))) in Debug
- configuration to restore availability of ZeroLink.
-
- * macosx/Wish-Common.xcconfig: Fix whitespace.
- * macosx/Wish-Debug.xcconfig:
- * macosx/Wish-Release.xcconfig:
- * macosx/tkMacOSXAETE.r:
- * macosx/tkMacOSXConfig.c:
- * macosx/tkMacOSXCursors.r:
- * macosx/tkMacOSXKeyboard.c:
- * macosx/tkMacOSXSend.c:
- * macosx/ttkMacOSXTheme.c:
- * macosx/tkMacOSXXCursors.r:
- * macosx/README:
-
- * macosx/GNUmakefile: Fix/add copyright and license refs.
- * macosx/Tk-Info.plist.in:
- * macosx/Wish-Info.plist.in:
- * macosx/Wish.xcode/project.pbxproj:
- * macosx/Wish.xcodeproj/project.pbxproj:
- * macosx/tkMacOSX.h:
-
- * unix/configure.in: Install license.terms into Tk.framework; fix tk
- debug build detection.
- * unix/configure: autoconf-2.59
-
- * doc/colors.n: Document new Mac OS X system colors.
- * doc/cursors.n: Document new Mac OS X native cursors.
- * doc/font.n: Document new Mac OS X 'menu' system font.
- * doc/wm.n: Document new Mac OS X [wm attributes].
- * doc/ttk_image.n: Fix 'make html' warning.
- * doc/canvas.n: Fix nroff typo.
-
-2007-04-21 Jeff Hobbs <jeffh@ActiveState.com>
-
- * macosx/tkMacOSXBitmap.c, macosx/tkMacOSXButton.c:
- * macosx/tkMacOSXCarbonEvents.c, macosx/tkMacOSXClipboard.c:
- * macosx/tkMacOSXCursor.c, macosx/tkMacOSXDialog.c:
- * macosx/tkMacOSXDraw.c, macosx/tkMacOSXEvent.c:
- * macosx/tkMacOSXFont.c, macosx/tkMacOSXInit.c, macosx/tkMacOSXInt.h:
- * macosx/tkMacOSXKeyEvent.c, macosx/tkMacOSXMenu.c:
- * macosx/tkMacOSXMenubutton.c, macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXScale.c, macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXWm.c: Revert of commits from 2007-04-13 which broke
- the OS X build.
-
-2007-04-17 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * generic/tkFont.c, generic/tkListbox.c, unix/tkUnixSelect.c:
- * win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c: Make
- the format of declarations much more standardized (removing K&R-isms
- and other things like that).
-
-2007-04-13 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * macosx/tkMacOSXInt.h (LOG_MSG, LOG_ON_ERROR): Added macros to make
- the OSX code much less #ifdef-full.
-
-2007-04-12 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/ttk/panedwindow.tcl (ttk::panedwindow::Press): handle Press
- triggering outside sash element boundaries.
-
-2007-04-10 Joe English <jenglish@users.sourceforge.net>
-
- * win/ttkWinMonitor.c, win/ttkWinXPTheme.c: Re-sync with Tile codebase
- so patches can flow back and forth.
-
- * win/ttkWinXPTheme.c: Skip OS version test, should work on Vista/Aero
- now as well as XP. Fixes [Bug 1687299], thanks to George Petasis for
- tracking this down.
-
-2007-03-21 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/ttkLayout.c(Ttk_BuildLayoutTemplate): BUGFIX: Nested
- TTK_GROUP nodes did not work unless they appeared at the end of the
- layout (and only by accident then).
-
-2007-03-08 Joe English <jenglish@users.sourceforge.net>
-
- * tests/grid.test(grid-21.7): Reset wm geometry . and pack propagate .
- at end of test. 'pack propagate . 0' was causing cascading failures in
- subsequent tests. [Bug 1676770]
-
-2007-03-07 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkMain.c (Tk_MainEx): Replicate macosx-specific code from
- TkpInit() that ensures the console window appears when wish is started
- from the OS X Finder (i.e. with stdin == /dev/null), jeffh's 2006-11-24
- change rendered the corresponding code in TkpInit() ineffective in wish
- because Tk_MainEx() sets tcl_interactive before calling TkpInit().
-
- * generic/ttk/ttkGenStubs.tcl (new): Add ttk-specific genstubs.tcl from
- * unix/Makefile.in (genstubs): tile and run it from 'genstubs'
- target, restores ability to generate all of Tk's stub sources.
-
- * generic/ttk/ttkTreeview.c: #ifdef out unused declaration.
-
- * macosx/tkMacOSXDebug.c (TkMacOSXGetNamedDebugSymbol): Add fix for
- libraries loaded with a DYLD_IMAGE_SUFFIX.
-
- * macosx/Wish.xcodeproj/project.pbxproj: Ensure gcc version used by
- * macosx/Wish.xcodeproj/default.pbxuser: Xcode and configure/make are
- * macosx/Wish-Common.xcconfig: consistent and independent of
- gcc_select default and CC env var; fixes for Xcode 3.0.
-
- * unix/tcl.m4 (Darwin): s/CFLAGS/CPPFLAGS/ in macosx-version-min check.
- * unix/configure: autoconf-2.59
-
-2007-02-25 Peter Spjuth <peter.spjuth@space.se>
-
- * generic/tkUtil.c: Fixed grid anchor center problem in labelframes.
- * tests/grid.test: [Bug 1545765]
-
-2007-02-23 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/ttk/notebook.tcl (ttk::notebook::enableTraversal): OS X
- needs Option instead of Alt binding
-
-2007-02-19 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/tcl.m4: use SHLIB_SUFFIX=".so" on HP-UX ia64 arch.
- * unix/configure: autoconf-2.59
-
- * library/tkfbox.tcl (::tk::IconList_Goto): avoid goto issues in empty
- dirs. [Bug 1662959]
-
-2007-02-09 Joe Mistachkin <joe@mistachkin.com>
-
- * win/nmakehlp.c: Properly cleanup after nmakehlp, including the
- * win/makefile.vc: vcX0.pch file. Sync up fixed nmakehlp usage from
- Tcl.
-
-2007-02-06 Joe English <jenglish@users.sourceforge.net>
-
- * library/ttk/ttk.tcl: Add no-op [package ifneeded] script for tile
- 0.8.0, so that existing applications that use "package require tile"
- won't fail when run under Tk 8.5.
-
-2007-02-04 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/tcl.m4: Use gcc4's __attribute__((__visibility__("hidden"))) if
- available to define MODULE_SCOPE effective on all platforms.
- * unix/configure.in: add caching to -pipe check.
- * unix/configure: autoconf-2.59
- * unix/tkConfig.h.in: autoheader-2.59
-
-2007-02-03 Joe Mistachkin <joe@mistachkin.com>
-
- * win/rules.vc: Fix platform specific file copy macros for downlevel
- Windows.
- * win/ttkWinMonitor.c: Windows portability support. Fix "noxp" build
- * win/ttkWinXPTheme.c: option handling and use GetWindowLongPtr and
- SetWindowLongPtr only when needed.
-
-2007-02-02 Pat Thoyts <patthoyts@users.sourceforge.net>
+2008-06-18 Daniel Steffen <das@users.sourceforge.net>
- * win/ttkWinXPTheme.c: Support IsAppThemed() call. This is what is
- used when theming is turned off just for an individual application.
+ * macosx/tkMacOSXCarbonEvents.c: Fix debug carbon event tracing.
+ (InstallStandardApplicationEventHandler): Replace needless use of
+ TkMacOSXInitNamedDebugSymbol() by standard TkMacOSXInitNamedSymbol().
-2007-01-28 Daniel Steffen <das@users.sourceforge.net>
+ * macosx/tkMacOSXDebug.c: Revert 2007-11-09 commit making
+ * macosx/tkMacOSXDebug.h: TkMacOSXInitNamedDebugSymbol()
+ available outside of debug builds.
- * macosx/Wish.xcodeproj/project.pbxproj: Extract build settings that
- * macosx/Wish.xcodeproj/default.pbxuser: were common to multiple
- * macosx/Wish-Common.xcconfig (new file): configurations into external
- * macosx/Wish-Debug.xcconfig (new file): xcconfig files; add extra
- * macosx/Wish-Release.xcconfig (new file): configurations for building
- with SDKs; convert legacy jam-based 'Tk' target to native target with
- single script phase; correct syntax of build setting references to use
- $() throughout; remove unused tcltest sources from 'tktest' target.
+ * macosx/tkMacOSXEmbed.c (TkpMakeWindow): Fix bug with missing
+ * macosx/tkMacOSXSubwindows.c (XMapWindow): focus on first map by
+ only sending VisibilityNotify events once windows are mapped (rather
+ than when they are created).
- * macosx/README: Document new Wish.xcodeproj configurations; other
- minor updates/corrections.
+ * macosx/tkMacOSXWindowEvent.c (TkMacOSXProcessWindowEvent): Fix
+ return value.
- * generic/tk.h: Update location of version numbers in macosx files.
+ * macosx/tkMacOSXInit.c: Add helper to efficiently convert from
+ * macosx/tkMacOSXPrivate.h: CFString to Tcl_Obj.
- * macosx/Wish.xcode/project.pbxproj: Restore 'tktest' target to working
- * macosx/Wish.xcode/default.pbxuser: order by replicating applicable
- changes to Wish.xcodeproj since 2006-07-20.
+ * macosx/tkMacOSXFont.c (TkpGetFontFromAttributes, InitFont): Fix
+ incorrect conversion to points of font sizes already in points; factor
+ out retrieval of font family name from font family ID.
-2007-01-25 Daniel Steffen <das@users.sourceforge.net>
+2008-06-13 Jeff Hobbs <jeffh@ActiveState.com>
- * unix/tcl.m4: Integrate CPPFLAGS into CFLAGS as late as possible and
- move (rather than duplicate) -isysroot flags from CFLAGS to CPPFLAGS to
- avoid errors about multiple -isysroot flags from some older gcc builds.
+ * win/configure, win/configure.in (TK_WIN_VERSION): Fix handling of
+ interim a/b versioning for manifest usage.
- * unix/configure: autoconf-2.59
+2008-06-13 Joe Mistachkin <joe@mistachkin.com>
-2007-01-19 Joe Mistachkin <joe@mistachkin.com>
+ TIP #285 IMPLEMENTATION
- * win/makefile.vc: Properly build man2tcl.c for MSVC8.
+ * generic/tkCmds.c: During [tkwait] and [update], always cooperatively
+ check for script cancellation.
+ * win/makefile.vc: Added 'pdbs' option for Windows build rules to
+ * win/rules.vc: allow for non-debug builds with full symbols.
-2007-01-19 Daniel Steffen <das@users.sourceforge.net>
+2008-06-12 Daniel Steffen <das@users.sourceforge.net>
- * macosx/Wish.xcodeproj/project.pbxproj: Remove libtommath defines.
+ * generic/tkPointer.c (Tk_UpdatePointer): [Bug 1991932]: Fix failure
+ to restore a global grab capture and to release the restrict window
+ capture when releasing a button grab. Fixes segfault due to dangling
+ reference to restrict window inside TkpSetCapture() implementation.
- * unix/tcl.m4: Ensure CPPFLAGS env var is used when set. [Bug 1586861]
- (Darwin): add -isysroot and -mmacosx-version-min flags to CPPFLAGS when
- present in CFLAGS to avoid discrepancies between what headers configure
- sees during preprocessing tests and compiling tests.
+ * generic/ttk/ttkTreeview.c: Fix warning.
+ * unix/tcl.m4 (SunOS-5.11): Fix 64bit amd64 support with gcc & Sun cc.
* unix/configure: autoconf-2.59
-2007-01-11 Jeff Hobbs <jeffh@activestate.com>
-
- * unix/tkUnixEvent.c, library/msgs/es.msg: s/CRLF/LF/g
-
-2007-01-11 Joe English <jenglish@users.sourceforge.net>
-
- * win/tcl.m4 (CFLAGS_WARNING): Remove "-Wconversion". This was removed
- from unix/tcl.m4 2004-07-16 but not from here.
- * win/configure: Regenerated.
-
-2007-01-11 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/ttkManager.h, generic/ttk/ttk*.c: Revert addition of
- contravariant 'const' qualifiers, to keep in sync with Tile codebase
- (which must remain compatible with Tk 8.4).
-
-2007-01-03 Jan Nijtmans <nijtmans@users.sf.net>
-
- * doc/ManageGeom.3,
- * generic/tk.decls,
- * generic/tk.h: Add const to 2nd parameter of Tk_ManageGeometry
- * generic/tkDecls.h: regenerated
- * generic/tkInt.h,
- * generic/tk*.c,
- * generic/ttk/ttk*.c: Added many "const" specifiers in implementation.
-
-2007-01-02 Donal K. Fellows <dkf@users.sf.net>
-
- * xlib/*: Made the generic fake-X11 glue layer abide by the formatting
- rules of the core.
-
-2006-12-31 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
-
- * macosx/tkMacOSXFont.c: Fill-in TkpGetFontAttrsForChar (TIP #300).
- * macosx/ttkMacOSXTheme.c: Define a constant to make it compile on Mac
- OS X 10.3.
-
-2006-12-28 Mo DeJong <mdejong@users.sourceforge.net>
-
- * tests/wm.test: Update wm attributes output so that tests pass after
- addition of -transparentcolor for Win32.
+ * macosx/tkMacOSXXStubs.c (Tk_ResetUserInactiveTime): Use UsrActivity
+ instead of OverallAct (which may be ignored in some circumstances).
-2006-12-26 Joe English <jenglish@users.sourceforge.net>
+ * macosx/Wish.xcodeproj/project.pbxproj: Add tclIORTrans.c; add tclOO
+ * macosx/Wish.xcodeproj/default.pbxuser: files to tktest-X11 target;
+ add debug configs for 64bit and with corefoundation disabled; updates
+ and cleanup for Xcode 3.1 and for Leopard; sync with Tcl.xcodeproj.
+ * macosx/Wish.xcode/project.pbxproj: Sync Wish.xcodeproj changes.
+ * macosx/Wish.xcode/default.pbxuser:
+ * macosx/README: Document new build configs.
- * generic/ttk/ttkLabel.c: ImageElement clientData no longer needed.
+2008-06-10 Joe English <jenglish@users.sourceforge.net>
-2006-12-22 Donal K. Fellows <dkf@users.sf.net>
+ * unix/tkUnixKey.c: [Patch 1986818]: Use Xutf8LookupString if
+ available. This should fix problems (like [Bug 1908443]) where Xlib's
+ idea of the system encoding does not match Tcl's.
- * unix/tkUnixEvent.c (TkUnixDoOneXEvent): Made correct on AMD64 and
- other similar 64-bit systems where fd_mask is not 'unsigned int' in
- effect. [Bug 1522467]
+2008-06-01 Daniel Steffen <das@users.sourceforge.net>
- * library/msgs/es_ES.msg (removed):
- * library/msgs/es.msg: Fixed translation fault that was present in all
- Spanish-speaking locales. [Bug 1111213]
+ * macosx/Wish.xcodeproj/project.pbxproj: Add new tclOO files; add
+ * macosx/README: debug configs with gcov;
+ update to Xcode 3.1.
-2006-12-19 Jeff Hobbs <jeffh@ActiveState.com>
+2008-05-27 Pat Thoyts <patthoyts@users.sourceforge.net>
- * win/tkWinButton.c (TkpDisplayButton): lint init. [Bug 1618604]
+ * generic/ttk/ttkTheme.c: [ttk::style theme use] without an argument
+ * doc/ttk_style.n: now returns the current theme.
-2006-12-19 Daniel Steffen <das@users.sourceforge.net>
+2008-05-23 Joe English <jenglish@users.sourceforge.net>
- * unix/tcl.m4 (Darwin): --enable-64bit: verify linking with 64bit -arch
- flag succeeds before enabling 64bit build.
- * unix/configure: autoconf-2.59
+ * doc/ttk_treeview.n, generic/ttk/ttkTreeview.c,
+ * generic/ttk/ttkTagSet.c, generic/ttk/ttkLayout.c,
+ * generic/ttk/ttkTheme.c, generic/ttk/ttkTheme.h,
+ * generic/ttk/ttkThemeInt.h, generic/ttk/ttkWidget.h:
+ Added [$tv identify region], [$tv identify element], and [$tv identify
+ item] subcommands. Simplified bindings. Added [$tv tag has]
+ subcommand. Tag-related display improvements; setting a tag
+ -background or -foreground no longer overrides selection feedback.
-2006-12-18 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/ttkTreeview.c, library/ttk/treeview.tcl, doc/treeview.n:
- Added column '-stretch' and '-minwidth' options. Improved column drag
- and resize behavior. Added horizontal scrolling [Bug 1518650]. Row
- height and child indent specifiable on Treeview style. Decreased
- default row height, no default -padding. Use correct heading height
- [Bug 1163349]. Apply tag settings to tree item as well as to data
- columns [NOTE: 'tag configure' still buggy]. Fix off-by-one condition
- when moving nodes forward [Bug 1618142]
- * generic/ttk/ttkScroll.c (TtkScrollTo): Prevent overscroll [Bug
- 1173434]
* library/ttk/altTheme.tcl, library/ttk/aquaTheme.tcl,
* library/ttk/clamTheme.tcl, library/ttk/classicTheme.tcl,
- * library/ttk/defaults.tcl, library/ttk/winTheme.tcl,
- * library/ttk/xpTheme.tcl: Per-theme treeview settings.
- * macosx/ttkMacOSXTheme.c: Added disclosure triangle element.
-
-2006-12-17 Joe English <jenglish@users.sourceforge.net>
-
- * library/ttk/combobox.tcl, generic/ttk/ttkEntry.c,
- * doc/ttk_combobox.n: Add combobox -height option; only show scrollbar
- if the listbox needs to scroll. [Bug 1032869]
-
-2006-12-16 Mo DeJong <mdejong@users.sourceforge.net>
-
- * doc/cursors.n: Mention "none" in supported cursor list. Fix comment
- that incorrectly claims that the Win32 "no" cursor hides the cursor.
- * tests/cursor.test: Test "none" cursor.
- * unix/tkUnixCursor.c (CreateCursorFromTableOrFile)
- (TkGetCursorByName): Define a table of Tk cursors that is searched in
- addition to the X cursor table. A Tk cursor is loaded from a data
- string and works with the same options as the built in X cursors. This
- code makes it possible to use "none" as a cursor name under Unix.
- * win/rc/cursor9a.cur: Added none Win32 cursor.
- * win/rc/tk_base.rc: Define a built-in Win32 cursor named "none".
- [Patch 1615427]
-
-2006-12-14 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/ttkButton.c, generic/ttk/ttkElements.c,
- * generic/ttk/ttkEntry.c, generic/ttk/ttkFrame.c,
- * generic/ttk/ttkImage.c, generic/ttk/ttkInit.c,
- * generic/ttk/ttkLabel.c, generic/ttk/ttkNotebook.c,
- * generic/ttk/ttkPanedwindow.c, generic/ttk/ttkProgress.c,
- * generic/ttk/ttkScale.c, generic/ttk/ttkScrollbar.c,
- * generic/ttk/ttkSeparator.c, generic/ttk/ttkTheme.h,
- * generic/ttk/ttkTreeview.c, generic/ttk/ttkWidget.h:
- Global reduction: use per-file *_Init() routines to reduce the number
- of globally-visible initialization records.
-
-2006-12-13 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/Makefile.in (install-doc): intentionally skip ttk_dialog.n
- installation (not for public consumption)
-
- * doc/scrollbar.n, doc/button.n, doc/checkbutton.n:
- * doc/entry.n, doc/frame.n, doc/label.n, doc/labelframe.n:
- * doc/menu.n, doc/menubutton.n, doc/panedwindow.n:
- * doc/radiobutton.n, doc/scrollbar.n, doc/ttk_*: revamp ttk docs to
- use consist nroff format (not 100% consistent with classic widget
- docs). Add more man page cross-linking "SEE ALSO".
-
- * generic/ttk/ttkInit.c:
- * generic/ttk/ttkTreeview.c: make treeview exist by default
- * generic/ttk/ttkPanedwindow.c: s/TtkPaned_Init/TtkPanedwindow_Init/
-
- * win/Makefile.in, unix/Makefile.in (demo): add 'demo' target
-
-2006-12-13 Joe English <jenglish@users.sourceforge.net>
-
- * library/ttk/ttk.tcl: Try to straighten out theme loading and
- selection logic.
- * generic/ttk/ttkElements.c, library/ttk/defaults.tcl,
- * generic/ttk/ttkClamTheme.c, library/ttk/clamTheme.tcl:
- Provide package in C part instead of Tcl part.
-
-2006-12-12 Joe English <jenglish@users.sourceforge.net>
-
- * library/ttk/ttk.tcl, generic/ttkTheme.c: Remove nonfunctional code.
-
-2006-12-12 Mo DeJong <mdejong@users.sourceforge.net>
+ * library/ttk/defaults.tcl, library/ttk/treeview.tcl,
+ * library/ttk/winTheme.tcl, library/ttk/xpTheme.tcl:
+ Don't need separate 'Item', 'Cell', and 'Row' style settings anymore,
+ only the base "Treeview" style is used.
- * win/tkWinButton.c (InitBoxes): Call Tcl_Panic() if loading of bitmap
- resources fails. This change generates an error if Tk is unable to
- find button widget resources instead of silently failing and then
- drawing widgets incorrectly.
- * win/rc/tk_base.rc: If the user defines BASE_NO_TK_ICON then compile
- the base resources file without a "tk" icon. This change makes it
- easier to replace the default tk icon with a custom icon. [Patch
- 1614362]
-
-2006-12-11 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * unix/tkUnixWm.c (TkWmMapWindow, WmClientCmd): Added support for
- _NET_WM_PID property from the EWMH spec. This is only installed when
- the client machine is set.
- (WmProtocolCmd, UpdateWmProtocols, TkWmProtocolEventProc): Added
- support for the _NET_WM_PING protocol from the EWMH spec. Note that
- the support for this is not exposed to the script level as that would
- prevent correct handling.
+2008-05-23 Joe English <jenglish@users.sourceforge.net>
-2006-12-10 Joe English <jenglish@users.sourceforge.net>
+ * generic/ttk/ttkLabel.c: [Bug 1967576]: Avoid passing width or height
+ <= 0 to Tk_RedrawImage, as this leads to a panic on Windows.
- * generic/ttk/ttkTheme.h, generic/ttk/ttkThemeInt.h,
- * generic/ttk/ttk.decls, generic/ttk/ttkTheme.c,
- * generic/ttk/ttkLayout.c, generic/ttk/ttkDecls.h:
- Rename typedef Ttk_Element => Ttk_ElementImpl.
+2008-05-16 Pat Thoyts <patthoyts@users.sourceforge.net>
-2006-12-09 Joe English <jenglish@users.sourceforge.net>
+ * library/ttk/xpTheme.tcl: Add correct border to combobox on Vista
- * generic/ttk/ttkButton.c, generic/ttk/ttkImage.c,
- * generic/ttk/ttkLabel.c, generic/ttk/ttkWidget.h,
- * generic/ttk/ttkTheme.h, generic/ttk/ttkNotebook.c,
- * generic/ttk/ttkTreeview.c, doc/ttk_image.n:
- Merged duplicate functionality between image element factory, image
- element, and -image option processing. Image element factory now takes
- an imageSpec argument instead of a separate image name and -map option
- * tests/ttk/image.test(image-1.1): Can catch this error earlier now.
+2008-05-15 Pat Thoyts <patthoyts@users.sourceforge.net>
-2006-12-06 Kevin Kenny <kennykb@acm.org>
+ * win/makefile.vc: We should use the thread allocator for threaded
+ * win/rules.vc: builds. Added 'tclalloc' option to disable.
- * unix/configure.in: Further changes to avoid attempting to link
- * unix/configure: against Xft libraries in a non-Xft build
- [Bug 1609616] (dgp)
+2008-05-14 Donal K. Fellows <dkf@users.sf.net>
-2006-12-04 Jeff Hobbs <jeffh@ActiveState.com>
+ * generic/tkPanedWindow.c (PanedWindowProxyCommand)
+ (DisplayPanedWindow): [Bug 1639824]: Ensure that a zero width never
+ gets fed to the underlying window system.
- * generic/tkListbox.c (ConfigureListboxItem): ListboxWorldChanged not
- needed - just call EventuallyRedrawRange. [Bug 1608046] (rezic)
+2008-05-13 Pat Thoyts <patthoyts@users.sourceforge.net>
-2006-12-04 Donal K. Fellows <dkf@users.sf.net>
+ * library/console.tcl: Support pixel sized font in +/- keybinding.
+ * tests/listbox.test: -activestyle default is underline on windows.
+ * tests/winDialog.test: Fixed hanging tk_chooseColor tests.
- TIP #286 IMPLEMENTATION
+2008-05-11 Pat Thoyts <patthoyts@users.sourceforge.net>
- * generic/tkMenu.c (MenuWidgetObjCmd, MenuDoXPosition):
- * doc/menu.n, tests/menu.test: Added an [$menu xposition] subcommand
- which is useful in menubars and when menus use multiple columns. Many
- thanks to Schelte Bron for the implementation.
+ * library/tk.tcl: Support for ttk widgets in AmpWidget
+ * doc/button.n: [Patch 1883418]: Note negative widths for button.
-2006-12-01 Kevin Kenny <kennykb@acm.org>
+2008-05-09 Pat Thoyts <patthoyts@users.sourceforge.net>
- TIP #300 IMPLEMENTATION
+ * doc/ttk_*: 'identify' widget command is on all ttk widgets.
- * doc/font.n: Added a [font actual $font $char]
- * generic/tkFont.c: variant that introspects the font that
- * generic/tkFont.h: is chosen to render a given character
- * macosx/tkMacOSXFont.c: in a given nominal font. Added
- * tests/font.test: documentation and test cases for the
- * unix/tkUnixFont.c: new command syntax.
- * unix/tkUnixRFont.c:
- * win/tkWinFont.c:
+2008-05-04 Joe English <jenglish@users.sourceforge.net>
-2006-12-01 Jeff Hobbs <jeffh@ActiveState.com>
+ * macosx/ttkMacOSAquaTheme.c: [Bug 1942785]: "default" and "focus"
+ adornments should not be disjoint.
- * doc/wm.n, tests/winWm.test:
- * win/tkWinWm.c: add -transparentcolor attribute for Windows.
+2008-04-27 Donal K. Fellows <dkf@users.sf.net>
-2006-12-01 Joe English <jenglish@users.sourceforge.net>
+ * */*.c: A large tranche of getting rid of pre-C89-isms; if your
+ compiler doesn't support things like proper function declarations,
+ 'void' and 'const', borrow a proper one when building Tcl. (The header
+ files allow building things that link against Tcl with really ancient
+ compilers still; the requirement is just when building Tcl itself.)
- * generic/ttk/ttkTheme.h, generic/ttk/ttkLayout.c: Dead code removal.
+2008-04-25 Joe English <jenglish@users.sourceforge.net>
-2006-11-30 Daniel Steffen <das@users.sourceforge.net>
+ * library/ttk/treeview.tcl: [Bug 1951733]: [$tv selection] takes a
+ list of items, not a single item.
- * macosx/tkMacOSXDialog.c (Tk_MessageBoxObjCmd): fix inability to use
- buttons with standard Escape key binding as -default button (reported
- on tcl-mac by Hans-Christoph Steiner).
+2008-04-20 Pat Thoyts <patthoyts@users.sourceforge.net>
- * macosx/tkMacOSXWm.c (WmAttributesCmd): fix getting [wm attr -alpha].
- [Bug 1581932]
+ * win/makefile.vc: [Bug 1900872]: Include ws2_32 in the link list.
+ * doc/menu.n: [Bug 1887169]: Minor change regarding the system menu.
+ * doc/button.n: [Bug 1926223]: Minor clarification of button flash.
-2006-11-28 Joe English <jenglish@users.sourceforge.net>
+2008-04-17 Donal K. Fellows <dkf@cspool38.cs.man.ac.uk>
- * library/ttk/fonts.tcl: Clean up temporary variables.
+ * doc/text.n: Correct description of when -relief option is ignored on
+ a tag. Thanks to emiliano for spotting.
-2006-11-27 Kevin Kenny <kennykb@acm.org>
+2008-04-17 Don Porter <dgp@users.sourceforge.net>
- * unix/configure.in: Corrected Xft configuration so that Xft actually
- does get turned on when available.
- * unix/configure: autoconf
+ * generic/tkCanvas.c: [Bug 1327482]: Fix logic that determines when
+ canvas item <Enter> event should fire. Thanks to Sebastian Wangnick.
-2006-11-26 Joe English <jenglish@users.sourceforge.net>
+2008-04-16 Daniel Steffen <das@users.sourceforge.net>
- * generic/ttk/ttkWidget.c, generic/ttk/ttkPaned.c: Fix [Bug 1603506]
- * library/ttk/button.tcl, library/ttk/combobox.tcl,
- * library/ttk/utils.tcl: Rename ttk::CopyBindings to ttk::copyBindings
- * generic/ttk/ttkTreeview.c, doc/ttk_treeview.n:
- -displaycolumns {} now means "no columns" instead of "all columns".
- Use -displaycolumns #all for "all columns". [Bug 1547622]
+ * generic/tkStubInit.c: [Patch 1938497]: Make stubs
+ * generic/tkWindow.c (Initialize): tables static const and export
+ only a module-scope pointer to to the main stubs table (for package
+ init).
-2006-11-26 Daniel Steffen <das@users.sourceforge.net>
+2008-04-14 Pat Thoyts <patthoyts@users.sourceforge.net>
- * unix/tcl.m4 (Linux): --enable-64bit support. [Patch 1597389]
- * unix/configure: autoconf-2.59 [Bug 1230558]
+ * win/tkWinDialog.c: [Bug 1941740]: Fix [tk_chooseColor -title].
+ * win/tkWinTest.c: Added parent to testgetwininfo
+ * tests/winDialog.test: Created some tk_chooseColor win tests.
-2006-11-24 Jeff Hobbs <jeffh@ActiveState.com>
+2008-04-09 Jan Nijtmans <nijtmans@users.sourceforge.net>
- * macosx/tkMacOSXInit.c (TkpInit): only set tcl_interactive 1 if it
- isn't already defined. Allows embedders to set it to 0 to prevent the
- console appearing on OS X. [Bug 1487701]
+ * generic/tkImgGIF.c: Let the GIF writer use a real LZW compressor.
- * unix/tkUnixMenu.c (DrawMenuUnderline): bound Tcl_UtfAtIndex usage
- * tests/menu.test (menu-36.1): [Bug 1599877]
+2008-04-08 Pat Thoyts <patthoyts@users.sourceforge.net>
-2006-11-24 Joe English <jenglish@users.sourceforge.net>
+ * win/ttkWinXpTheme.c: Provide a visual-styles API element engine
+ * tests/ttk/vsapi.test: to permit scripts to create any available
+ * doc/ttk_vsapi.n: windows xp/vista element. Plus basic tests.
- * library/ttk/altTheme.tcl, library/ttk/clamTheme.tcl,
- * library/ttk/defaults.tcl, library/ttk/winTheme.tcl,
- * library/ttk/xpTheme.tcl: explicitly specify -anchor w on TMenubutton
- * tests/ttk/entry.test: Fixed font dependency; test entry-3.2 should
- work on all platforms now.
- * library/classicTheme.tcl: Don't define or use TkClassicDefaultFont.
- * generic/ttk/ttkTreeview.c, generic/ttk/ttkPanedwindow.c: Handle
- missing layouts.
+2008-04-08 Daniel Steffen <das@users.sourceforge.net>
-2006-11-23 Jeff Hobbs <jeffh@ActiveState.com>
+ * generic/tkDecls.h: make genstubs (genStubs.tcl changes).
+ * generic/tkIntDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkIntXlibDecls.h:
+ * generic/tkPlatDecls.h:
- * win/tkWinMenu.c (TkWinHandleMenuEvent, DrawMenuUnderline): Handle
- unichar underlining correctly and safely. [Bug 1599877]
+2008-04-08 Kevin Kenny <kennykb@acm.org>
-2006-11-20 Joe English <jenglish@users.sourceforge.net>
+ * tkWinEmbed.c: Removed #if 0 code. Trust the revision control
+ system, if you need it again, you can find it.
- * win/ttkWinXPTheme.c: Add support for alternate/indeterminate
- checkbutton state. Fix various spacing parameters [Bug 1596020, patch
- from Tim Baker]. Remove unused uxtheme hooks.
+ * tkWinSend.c: Added conditional compilation to silence several
+ compiler warnings.
-2006-11-16 Donal K. Fellows <dkf@users.sf.net>
+2008-04-07 Jeff Hobbs <jeffh@ActiveState.com>
- * doc/colors.n, doc/wm.n: Minor fixes, added See Also.
+ * generic/tkWindow.c (Initialize): [Bug 1937135]: Fix double-free on
+ * tests/main.test (main-3.*): Tk_ParseArgv error.
- * doc/labelframe.n: Added an example.
+ * generic/tkArgv.c: Fix -help mem explosion. [Bug 1936238] (kenny)
-2006-11-15 Donal K. Fellows <dkf@users.sf.net>
+2008-04-04 Pat Thoyts <patthoyts@users.sourceforge.net>
- * doc/label.n: Added an example and some See Also refs.
+ * library/ttk/sizegrip.tcl: Don't resize if the toplevel is not
+ resizable or the sizegrip has been disabled.
- * doc/ConfigWidg.3, doc/bind.n, doc/grid.n, doc/panedwindow.n:
- * doc/text.n, doc/ttk_Geometry.3, doc/ttk_button.n:
- * doc/ttk_checkbutton.n, doc/ttk_combobox.n, doc/ttk_dialog.n:
- * doc/ttk_entry.n, doc/ttk_frame.n, doc/ttk_image.n, doc/ttk_intro.n:
- * doc/ttk_label.n, doc/ttk_labelframe.n, doc/ttk_menubutton.n:
- * doc/ttk_notebook.n, doc/ttk_panedwindow.n, doc/ttk_progressbar.n:
- * doc/ttk_radiobutton.n, doc/ttk_scrollbar.n, doc/ttk_separator.n:
- * doc/ttk_sizegrip.n, doc/ttk_style.n, doc/ttk_widget.n, doc/wm.n:
- Convert \fP to \fR so that man-page scrapers have an easier time.
+2008-04-03 Pat Thoyts <patthoyts@users.sourceforge.net>
-2006-11-14 Joe English <jenglish@users.sourceforge.net>
+ * win/makefile.vc: Fixed stubs usage
+ * library/ttk/xpTheme.tcl: fix the colour of labelframe in xp
- * generic/ttk/ttkDefaultTheme.c: Fix off-by-one bug in tree indicator
- size computation [Bug 1596021, patch from Tim Baker]. Increased
- default size from 7 to 9 pixels.
+2008-04-02 Daniel Steffen <das@users.sourceforge.net>
-2006-11-12 Joe English <jenglish@users.sourceforge.net>
+ * generic/tk.decls: Remove 'export' declarations of symbols now
+ only in libtkstub and no longer in libtk.
- * generic/ttkScroll.c: *correct* fix for [Bug 1588251].
+ * generic/tkStubLib.c: [Bug 1819422]: Make symbols in libtkstub.a
+ MODULE_SCOPE to avoid exporting them from
+ libraries that link with -ltkstub; constify
+ tk*StubsPtr and stub table hook pointers.
-2006-11-12 Joe English <jenglish@users.sourceforge.net>
+ * generic/tkStubLib.c: Undef USE_TCL_STUBS before defining it
+ * generic/ttk/ttkStubLib.c: unconditionally; remove needless #ifdef
- * tests/ttk/ttk.test(ttk-6.9): Workaround for [Bug 1583038]
+ * generic/tkDecls.h: make genstubs
+ * generic/tkIntDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkIntXlibDecls.h:
+ * generic/tkPlatDecls.h:
+ * generic/tkStubInit.c:
-2006-11-12 Joe English <jenglish@users.sourceforge.net>
+ * unix/configure.in (Darwin): Remove now unnecessary unexporting of
+ libtclstub symbols from libtk.
- * generic/ttkScroll.c: Reworked cleanup procedure; "self-cancelling"
- idle call is not robust, call Tcl_CancelIdleCall() in
- TtkFreeScrollHandle instead. Fixes [Bug 1588251]
+ * unix/configure: autoconf-2.59
-2006-11-10 Daniel Steffen <das@users.sourceforge.net>
+2008-04-01 Don Porter <dgp@users.sourceforge.net>
- * macosx/Wish.xcodeproj/project.pbxproj: remove tclParseExpr.c and
- bwidget.test.
+ * generic/tkStubLib.c (Tk_InitStubs): Added missing error
+ * generic/tkWindow.c (Tk_PkgInitStubsCheck): message and removed
+ needless #ifdef complexity.
- * unix/tcl.m4 (Darwin): suppress linker arch warnings when building
- universal for both 32 & 64 bit and no 64bit CoreFoundation is
- available; sync with tcl tcl.m4 change.
- * unix/configure: autoconf-2.59
- * unix/tkConfig.h.in: autoheader-2.59
-
-2006-11-08 Kevin Kenny <kennykb@acm.org>
-
- * unix/configure.in: Silenced warnings about missing Xft configuration
- unless --enable-xft is requested explicitly. Also added a few basic
- checks that we can actually compile and link against Xft headers and
- libraries. [Bug 1592667]
- * unix/configure: Regen.
-
-2006-11-07 Kevin Kenny <kennykb@acm.org>
-
- * unix/configure.in: Made --enable-xft the default.
- * unix/configure: Regen.
-
-2006-11-06 Joe English <jenglish@users.sourceforge.net>
-
- * generic/ttk/ttkClassicTheme.c, generic/ttk/ttkPanedwindow.c,
- * generic/ttk/ttkTheme.c, generic/ttk/ttkTreeview.c,
- * win/ttkWinXPTheme.c, library/ttk/entry.tcl,
- * library/ttk/notebook.tcl, library/ttk/panedwindow.tcl,
- * library/ttk/utils.tcl, tests/ttk/entry.test, tests/ttk/bwidget.test:
- Miscellaneous minor changes to re-sync Ttk codebase with Tile CVS: fix
- comments damaged by overzealous search-and-destroy; removed obsolete
- [style default] synonym for [ttk::style configure]; removed other dead
- code.
-
-2006-11-03 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * library/safetk.tcl (::safe::tkTopLevel): Theme it.
-
- * generic/ttk/ttkLayout.c: We do not want to require tkInt in all
- * generic/ttk/ttkMananager.h: the ttk files so added the definition
- * generic/ttk/ttkTheme.h: of MODULE_SCOPE to ttkTheme.h. Ensures
- * generic/ttk/ttkWinMonitor.c: everyone gets to see the definition
- from someplace.
-
- * library/ttk/fonts.tcl: In a safe interp there is no osVersion field
- in tcl_platform so work around it.
-
-2006-11-02 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/ttk/ttkBlink.c, generic/ttk/ttkButton.c:
- * generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c:
- * generic/ttk/ttkDecls.h, generic/ttk/ttkDefaultTheme.c:
- * generic/ttk/ttkElements.c, generic/ttk/ttkEntry.c:
- * generic/ttk/ttkFrame.c, generic/ttk/ttkImage.c:
- * generic/ttk/ttkInit.c, generic/ttk/ttkLabel.c:
- * generic/ttk/ttkLayout.c, generic/ttk/ttkManager.h:
- * generic/ttk/ttkNotebook.c, generic/ttk/ttkPanedwindow.c:
- * generic/ttk/ttkProgress.c, generic/ttk/ttkScale.c:
- * generic/ttk/ttkScroll.c, generic/ttk/ttkScrollbar.c:
- * generic/ttk/ttkSeparator.c, generic/ttk/ttkSquare.c:
- * generic/ttk/ttkStubInit.c, generic/ttk/ttkStubLib.c:
- * generic/ttk/ttkTheme.c, generic/ttk/ttkTheme.h:
- * generic/ttk/ttkThemeInt.h, generic/ttk/ttkTrack.c:
- * generic/ttk/ttkTreeview.c, generic/ttk/ttkWidget.c:
- * generic/ttk/ttkWidget.h, macosx/ttkMacOSXTheme.c:
- * win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c: ensure
- all global Ttk symbols have Ttk or ttk prefix; declare all externally
- visible Ttk symbols not contained in stubs table as MODULE_SCOPE (or as
- static when possible); so that 'make check{exports,stubs}' once again
- complete without errors.
-
- * macosx/tkMacOSXColor.c (TkMacOSXCompareColors): ifdef out when unused
-
- * macosx/Wish.xcodeproj/project.pbxproj: check autoconf/autoheader exit
- status and stop build if they fail.
-
- * macosx/tkMacOSXWindowEvent.c (GenerateUpdateEvent): fix handling of
- Carbon Update events: the QuickDraw window update region was being
- ignored and all child TkWindows were sent an Expose XEvent even when
- they did not need to be redrawn. [Patch 1589226]
-
-2006-11-01 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXDebug.c: add TkMacOSX prefix to leftover
- * macosx/tkMacOSXDebug.h: macosx-private global symbols without Tk
- * macosx/tkMacOSXEmbed.c: prefix; ifdef out currently unused debug
- * macosx/tkMacOSXEvent.c: procs.
- * macosx/tkMacOSXInt.h:
- * macosx/tkMacOSXCarbonEvents.c:
- * macosx/tkMacOSXSubwindows.c:
- * macosx/tkMacOSXWm.c:
+ * generic/tkWindow.c: [Tcl Bug 1819422]: Revised package init so
+ * unix/Makefile.in: that "tkStubsPtr" is not present in libtk.so,
+ * win/Makefile.in: but is present only in libtkstub.a. This
+ * win/makefile.bc: tightens up the rules for users of the stubs
+ * win/makefile.vc: interfaces.
-2006-10-31 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * win/makefile.vc: Added ttk files to msvc build and add manifest
- * win/rules.vc: files to binaries with MSVC8.
-
-2006-10-31 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.xcodeproj/project.pbxproj: add new Ttk files.
-
- * macosx/ttkMacOSXTheme.c: standardize header #includes.
-
- * unix/Makefile (checkstubs, checkexports): check ttk.decls, allow
- export of Ttk prefixed symbols.
-
- * generic/ttk/tkDefaultTheme.c: fix warnings.
-
-2006-10-30 Jeff Hobbs <jeffh@ActiveState.com>
-
- * doc/ttk_Geometry.3, doc/ttk_Theme.3, doc/ttk_button.n:
- * doc/ttk_checkbutton.n, doc/ttk_combobox.n, doc/ttk_dialog.n:
- * doc/ttk_entry.n, doc/ttk_frame.n, doc/ttk_image.n:
- * doc/ttk_intro.n, doc/ttk_label.n, doc/ttk_labelframe.n:
- * doc/ttk_menubutton.n, doc/ttk_notebook.n, doc/ttk_panedwindow.n:
- * doc/ttk_progressbar.n, doc/ttk_radiobutton.n, doc/ttk_scrollbar.n:
- * doc/ttk_separator.n, doc/ttk_sizegrip.n, doc/ttk_style.n:
- * doc/ttk_treeview.n, doc/ttk_widget.n,:
- * generic/ttk/ttk.decls, generic/ttk/ttkBlink.c:
- * generic/ttk/ttkButton.c, generic/ttk/ttkCache.c:
- * generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c:
- * generic/ttk/ttkDecls.h, generic/ttk/ttkDefaultTheme.c:
- * generic/ttk/ttkElements.c, generic/ttk/ttkEntry.c:
- * generic/ttk/ttkFrame.c, generic/ttk/ttkImage.c:
- * generic/ttk/ttkInit.c, generic/ttk/ttkLabel.c:
- * generic/ttk/ttkLayout.c, generic/ttk/ttkManager.c:
- * generic/ttk/ttkManager.h, generic/ttk/ttkNotebook.c:
- * generic/ttk/ttkPanedwindow.c, generic/ttk/ttkProgress.c:
- * generic/ttk/ttkScale.c, generic/ttk/ttkScroll.c:
- * generic/ttk/ttkScrollbar.c, generic/ttk/ttkSeparator.c:
- * generic/ttk/ttkSquare.c, generic/ttk/ttkState.c:
- * generic/ttk/ttkStubInit.c, generic/ttk/ttkStubLib.c:
- * generic/ttk/ttkTagSet.c, generic/ttk/ttkTheme.c:
- * generic/ttk/ttkTheme.h, generic/ttk/ttkThemeInt.h:
- * generic/ttk/ttkTrace.c, generic/ttk/ttkTrack.c:
- * generic/ttk/ttkTreeview.c, generic/ttk/ttkWidget.c:
- * generic/ttk/ttkWidget.h:
- * library/demos/ttk_demo.tcl, library/demos/ttk_iconlib.tcl:
- * library/demos/ttk_repeater.tcl:
- * library/ttk/altTheme.tcl, library/ttk/aquaTheme.tcl:
- * library/ttk/button.tcl, library/ttk/clamTheme.tcl:
- * library/ttk/classicTheme.tcl, library/ttk/combobox.tcl:
- * library/ttk/cursors.tcl, library/ttk/defaults.tcl:
- * library/ttk/dialog.tcl, library/ttk/entry.tcl:
- * library/ttk/fonts.tcl, library/ttk/icons.tcl:
- * library/ttk/keynav.tcl, library/ttk/menubutton.tcl:
- * library/ttk/notebook.tcl, library/ttk/panedwindow.tcl:
- * library/ttk/progress.tcl, library/ttk/scale.tcl:
- * library/ttk/scrollbar.tcl, library/ttk/sizegrip.tcl:
- * library/ttk/treeview.tcl, library/ttk/ttk.tcl:
- * library/ttk/utils.tcl, library/ttk/winTheme.tcl:
- * library/ttk/xpTheme.tcl:
- * macosx/ttkMacOSXTheme.c:
- * tests/ttk/all.tcl, tests/ttk/bwidget.test, tests/ttk/combobox.test:
- * tests/ttk/entry.test, tests/ttk/image.test:
- * tests/ttk/labelframe.test, tests/ttk/layout.test:
- * tests/ttk/misc.test, tests/ttk/notebook.test:
- * tests/ttk/panedwindow.test, tests/ttk/progressbar.test:
- * tests/ttk/scrollbar.test, tests/ttk/treetags.test:
- * tests/ttk/treeview.test, tests/ttk/ttk.test, tests/ttk/validate.test:
- * win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c:
- First import of Ttk themed Tk widgets as branched from tile 0.7.8
-
- * generic/tkInt.h, generic/tkWindow.c: add Ttk_Init call, copy tk
- classic widgets to ::tk namespace.
- * library/tk.tcl: add source of ttk/ttk.tcl, define $::ttk::library.
- * unix/Makefile.in, win/Makefile.in: add Ttk build bits
- * win/configure, win/configure.in: check for uxtheme.h (XP theme).
-
-2006-10-23 Don Porter <dgp@users.sourceforge.net>
-
- * README: Bump version number to 8.5a6
+ * README: Bump version number to 8.6a0
* generic/tk.h:
* library/tk.tcl:
+ * macosx/Wish-Common.xcconfig:
* unix/configure.in:
* unix/tk.spec:
+ * win/README:
* win/configure.in:
+ * win/tcl.m4:
* unix/configure: autoconf-2.59
* win/configure:
-2006-10-19 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- *** 8.5a5 TAGGED FOR RELEASE ***
-
- * generic/tkImgBmap.c: Fixed line endings.
- * win/makefile.vc: Patched up build system to manage
- * win/rules.vc: AMD64 with MSVC8
- * win/nmakehlp.c: Ensure operation without Platform SDK.
-
-2006-10-18 Don Porter <dgp@users.sourceforge.net>
-
- * changes: 8.5a5 release date set.
-
-2006-10-17 Jeff Hobbs <jeffh@ActiveState.com>
-
- * doc/text.n: fix docs to not correct -tabs usage case.
-
- * generic/tkTextDisp.c (SizeOfTab): fix -tabstyle wordprocessor tab
- alignment to correct tab edge case. [Bug 1578858]
-
-2006-10-17 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * generic/tkText.c: Applied suggested patch from [Bug 1536735]
- * tests/text.test: Update test for above patch.
- * tests/textWind.test: Corrected test to catch all messages
- * tests/safe.test: Silence spurious win32 failure awaiting TIP150
- * tests/winDialog.test: Updated test for file name length check.
- * test/winWm.test: Corrected test expectation for menu wrapping.
-
-2006-10-16 Andreas Kupries <andreask@activestate.com>
-
- * doc/WindowId.3: Pat's commit on 2006-10-08 broke the .SH NAME
- information across several lines, breaking the cross-linking of
- manpages during installation for this one. Put everything back on a
- single line, unbreaking it.
-
-2006-10-16 Daniel Steffen <das@users.sourceforge.net>
-
- * changes: updates for 8.5a5 release.
-
- * macosx/tkMacOSXDraw.c: fix numerous issues in CG and QD drawing
- procs so that they now match X11 drawing much more closely [Bug
- 1558051]; use Tiger ellipse drawing API when available; fix comments &
- whitespace.
-
- * macosx/tkMacOSXInit.c: set default linewidth limit for CG
- antialiasing to 0 as thin horizontal/vertical lines look good now.
- * macosx/README: document CG antialiasing limit changes.
-
- * generic/tkCanvLine.c (ConfigureLine): on TkAqua, pass outline
- * generic/tkCanvPoly.c (ConfigurePolygon): linewidth in gc even for
- * generic/tkRectOval.c (ConfigureRectOval): fills (as it controls AA).
-
- * macosx/GNUmakefile: don't redo prebinding of non-prebound binaires.
-
- * library/demos/pendulum.tcl: fix incorrect setting of toplevel title.
-
-2006-10-10 Don Porter <dgp@users.sourceforge.net>
-
- * changes: Updates for 8.5a5 release
-
-2006-10-08 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * generic/tkWindow.c: Implemented TIP #264 - Tk_Interp function.
- * doc/WindowId.3: Documented Tk_Interp.
- * generic/tk.decls: Added to the stubs interface and
- * generic/tkDecls.h: regenerated.
- * generic/tkStubsInit.c:
-
-2006-10-05 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/tkUnixFont.c (Ucs2beToUtfProc, UtfToUcs2beProc):
- (TkpFontPkgInit, encodingAliases): Correct alignment issues in
- encoding conversion. Call ucs-2be "unicode" on big-endian systems.
- [Bug 1122671]
-
-2006-09-27 Andreas Kupries <andreask@activestate.com>
-
- * unix/Makefile.in (install-binaries): Added a second guard to the
- * win/Makefile.in: package index file to prevent older versions of Tcl
- * win/makefile.vc: from seeing version numbers which may contain a/b
- information, and then balking on them. This could otherwise happen
- when Tcl/Tk 8.4 and 8.5 are installed in the same directory, seeing
- each other. [Bug 1566418]
-
-2006-09-22 Andreas Kupries <andreask@activestate.com>
-
- * generic/tkConsole.c: TIP #268 update regarding registered package
- * generic/tkMain.c: version, now using full patchlevel instead of
- * generic/tkWindow.c: major.minor
- * library/tk.tcl:
- * unix/configure:
- * unix/Makefile.in:
- * unix/tcl.m4:
- * win/configure:
- * win/Makefile.in:
- * win/makefile.vc:
- * win/rules.vc:
- * win/tcl.m4:
-
-2006-09-20 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinMenu.c (TkpPostMenu): disable menu animation in menus with
- images to avoid clipping bug. [Bug 1329198]
-
-2006-09-21 Donal K. Fellows <dkf@users.sf.net>
-
- * generic/tkImgBmap.c (ImgBmapPostscript): Change 0 to NULL, since
- they are not interchangable on all platforms in all circumstances.
- [Tcl Bug 1562528]
-
-2006-09-11 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXWm.c (TkMacOSXMakeRealWindowExist): revert part of
- 2006-05-16 change that had set overrideredirect windows to not become
- activated by the window manager, as this prevented interaction with
- native widgets in such windows [Bug 1472624]; apply changes to carbon
- window attributes even if native window has already been created.
-
- * macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): fix app
- * macosx/tkMacOSXMenu.c (DrawMenuBarWhenIdle): menu item key shortcuts
- * macosx/tkMacOSXInt.h: when custom ".apple" menu is installed.
-
- * library/demos/widget: on TkAqua, don't install file menu with single
- quit menu item, as the application menu already has a quit item.
-
- * macosx/tkMacOSXColor.c: fix building on Mac OS X 10.2.
-
-2006-09-10 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXColor.c (TkSetMacColor,TkpGetColor): use AppearanceMgr
- * macosx/tkMacOSXDefault.h: to retrieve platform std colors for text
- * macosx/tkMacOSXPort.h: selections, add "systemHighlightSecondary"
- color name for standard color of inactive selections, use this color as
- default for text widget -inactiveselectbackground to implement platform
- standard look for inactive text selections.
-
- * library/text.tcl (aqua): remove focus bindings to set selection color
-
- * generic/tkTextBTree.c (TkTextIsElided): on TkAqua, don't show
- * generic/tkTextDisp.c (GetStyle): inactive text selection when
- text widget is disabled.
-
- * generic/tkEntry.c (DisplayEntry): change default TkAqua selection
- * macosx/tkMacOSXDefault.h: relief to "flat" (platform std).
-
- * generic/tkText.c (CreateWidget): fix bug leading to default text
- selection relief string DEF_TEXT_SELECT_RELIEF being ignored.
-
- * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): allow mouse
- event delivery to background windows with kWindowNoActivatesAttribute
- (e.g. overrideredirect windows), as these never come to the foreground
- they would never receive any mouse events otherwise. [Bug 1472624]
-
- * macosx/tkMacOSXWindowEvent.c (TkMacOSXGenerateFocusEvent): do not
- send focus events to any windows with kWindowNoActivatesAttribute.
-
- * macosx/tkMacOSXXStubs.c (XQueryColor, XQueryColors): implement basic
- XColor computation from pixel values, enough to make tkImg's window.c
- happy, fixes img::window failures reported on tcl-mac.
-
- * macosx/tkMacOSXMenu.c (DrawMenuEntryLabel): fix leak. [Bug 1554672]
-
- * macosx/GNUmakefile: workaround bug in 'cp -pRH' on Darwin 6 and
- earlier, fixes 'make embedded' failure reported on tcl-mac; fix error
- from 'make deploy' with same build tree as previous 'make embedded'.
-
- * macosx/Wish.xcodeproj/project.pbxproj: add new tclUnixCompat.c file.
-
- * macosx/tkMacOSXEntry.c (TkpDrawEntryBorderAndFocus): fix typo.
-
- * unix/tcl.m4: sync with tcl/unix/tcl.m4.
- * unix/configure: autoconf-2.59
-
-2006-09-06 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkEntry.c: move hard-coded ALWAYS_SHOW_SELECTION control
- * generic/tkInt.h: of entry/text selection display based on focus
- * generic/tkText.c: to the Tcl level, controlled by
- * generic/tkWindow.c: ::tk::AlwaysShowSelection (boolean, private).
- * library/tk.tcl: [Bug 1553691]
- * macosx/tkMacOSXDefault.h:
- * unix/tkUnixDefault.h:
- * unix/tkUnixPort.h:
- * win/tkWinDefault.h:
-
-2006-08-30 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinKey.c: Add WM_UNICHAR window message support (used by
- * win/tkWinX.c: virtual keyboard apps). [Bug 1518677] (petasis)
-
-2006-08-24 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXScrlbr.c (UpdateControlValues): set native scrollbar
- control bounds only once all size adjustments have been computed.
- Fixes issue with grow icon obscuring scrollbar reported on tcl-mac.
-
-2006-08-21 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXCarbonEvents.c (CarbonTimerProc): avoid starving main
- event loop: limit the number of tcl events processed per invocation.
- Fixes bug reported on tcl-mac by Kevan Hashemi.
-
-2006-08-18 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * tests/text.test (text-25.15): Added test suggested by Sam
- <baudinm@yahoo.com> on comp.lang.tcl
-
- * generic/tk.h, generic/tkInt.h: Stylistic improvements. No API change.
-
-2006-08-18 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/tcl.m4 (Darwin): add support for --enable-64bit on x86_64, for
- universal builds including x86_64, for 64-bit CoreFoundation on Leopard
- and for use of -mmacosx-version-min instead of MACOSX_DEPLOYMENT_TARGET
- * unix/configure.in (Darwin): remove 64-bit arch flags from CFLAGS for
- combined 32-bit and 64-bit universal builds, as neither TkAqua nor
- TkX11 can be built for 64-bit at present.
- * unix/configure: autoconf-2.59
- * unix/tkConfig.h.in: autoheader-2.59
-
- * macosx/Wish.xcodeproj/project.pbxproj: switch native release targets
- to use DWARF with dSYM, Xcode 3.0 changes.
- * macosx/README: updates for x86_64 support in Tcl.
-
- * macosx/tkMacOSXInit.c (TkpInit): when available, use public
- TransformProcessType() API instead of CPSEnableForegroundOperation()
- SPI to notify the window server that we are a GUI application.
-
- * macosx/tkMacOSXWm.c (WmAttrGetTitlePath): use HIWindow API on >=Tiger
-
- * macosx/tkMacOSXMouseEvent.c (GenerateToolbarButtonEvent):
- * macosx/tkMacOSXMenus.c (GenerateEditEvent):
- * macosx/tkMacOSXMenu.c (MenuSelectEvent): bzero() the XVirtualEvent
- structure before use to ensure all fields are initialized. [Bug
- 1542205]
-
-2006-08-16 Jeff Hobbs <jeffh@ActiveState.com>
-
- * macosx/tkMacOSXWm.c (WmAttributesCmd): correct OS X result for [wm
- attributes $top].
-
-2006-07-25 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): handle key
- shortcut for kHICommandQuit in the same way as other application menu
- item key shortcuts. [Bug 1516950]
-
-2006-07-24 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXWm.c (TkWmMapWindow): fix incorrect values of wmInfo
- parentWidth/Height for toplevels by recalculating them once the window
- is mapped (i.e once the window&structure sizes are known). [Bug
- 1358663]
- (ParseGeometry): sync with ParseGeometry in tkUnixWm.c/tkWinWm.c.
-
-2006-07-21 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkBind.c (TkBindInit): for REDO_KEYSYM_LOOKUP, change
- keysym-to-string mapping hash to use first name in ks_names.h instead
- of last (if there are multiple possibilities), e.g. "F11" instead of
- "L1".
-
- * macosx/tkMacOSXKeyboard.c (TkpGetKeySym): correct keysyms for pure
- modifier key presses [Bugs 700311, 1525905]; correct keysym for Enter
- key; add keysyms for new NumLock and Fn modifiers (added 2005-08-09).
-
-2006-07-20 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXWm.c (WmAttributesCmd, WmIconbitmapCmd): add support
- * unix/tkUnixSend.c (Tk_GetUserInactiveTime): for weakly
- importing symbols not available on OSX 10.2 or 10.3, enables binaires
- built on later OSX versions to run on earlier ones.
- * macosx/Wish.xcodeproj/project.pbxproj: enable weak-linking; turn on
- extra warnings.
- * macosx/README: document how to enable weak-linking; cleanup.
- * unix/configure.in: add check on Darwin-X11 for ld support of -weak-l
- * unix/tcl.m4: flag and weak-link libXss if possible as it is not
- available before OSX 10.4; enforce requirement of OSX 10.2 for TkAqua;
- move Darwin specific checks & defines that are only relevant to the tcl
- build out of tcl.m4; restrict framework option to Darwin; clean up
- quoting and help messages.
- * unix/configure: autoconf-2.59
- * unix/tkConfig.h.in: autoheader-2.59
-
- * macosx/GNUmakefile: enable xft for TkX11 build.
- * macosx/tkMacOSXFont.c (TkMacOSXQuarzStartDraw, TkMacOSXQuarzEndDraw):
- verify validity of context returned from QDBeginCGContext() before use.
- * macosx/tkMacOSXKeyEvent.c: ifdef out diagnostic messages to stderr.
-
- * macosx/tkMacOSXEvent.h: standardize MAC_OS_X_VERSION_MAX_ALLOWED
- * macosx/tkMacOSXMenu.c: checks per QA1316, ensure define can be
- * macosx/tkMacOSXMenubutton.c: overridden on command line (from default
- * macosx/tkMacOSXMenus.c: of current OS version).
- * macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXWm.c:
-
- * generic/tkImgGIF.c (ReadImage):
- * macosx/tkMacOSXCursor.c (TkMacOSXCursor):
- * macosx/tkMacOSXDebug.c (TkMacOSXGetNamedDebugSymbol):
- * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext):
- * macosx/tkMacOSXInit.c (Map):
- * xlib/xgc.c (XCreateGC): fix signed-with-unsigned comparison and other
- warnings from gcc4 -Wextra.
-
-2006-07-14 Andreas Kupries <andreask@activestate.com>
-
- * generic/tkWindow.c (Initialize): Modify change of 2006-05-25 (jeffh).
- Release mutex a bit earlier, to prevent lock when OS X creates its
- console windows (recursively enters Tk_Init). Patch by JeffH.
-
-2006-07-06 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/tkfbox.tcl: catch scrollbar use of highlightthickness
-
-2006-06-21 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/bgerror.tcl (::tk::dialog::error::bgerror): remove a couple
- of unnecessary hardcoded options
-
-2006-06-14 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkScale.c: Revised variable writing logic to account for
- [scale]'s design that it deals with its value as a formatted string,
- and not as a double. [Bug 891141]
-
-2006-06-14 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXSubwindows.c (TkMacOSXInvalidateWindow): ensure
- invalid clip regions are recreated via TkMacOSXUpdateClipRgn() before
- they are used; correct call order of TkMacOSXInvalidateWindow() and
- TkMacOSXInvalClipRgns() throughout. [Bug 1501922]
-
- * macosx/tkMacOSXDraw.c (TkPutImage): implement drawing of very wide
- images in slices of less than 4096 pixels to workaround CopyBits
- limitation. [Bug 950121]
-
-2006-06-09 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkMain.c: Added Tcl_Preserve() call on the master interp
- as crash protection against any Tcl_DeleteInterp() call that might
- happen.
-
-2006-06-01 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkConsole.c: Added Tcl_RegisterChannel() calls to bump the
- refcount of channels passed to Tcl_SetStdChannel(). This prevents early
- free-ing of the channels that leads to crashes. [Bug 912571]
-
-2006-05-29 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinEmbed.c (TkpGetOtherWindow): Do not panic if no window is
- * unix/tkUnixEmbed.c (TkpGetOtherWindow): found; caller handles. [Bug
- * unix/tkUnixWm.c (Tk_CoordsToWindow, UpdateGeometryInfo): 1212056]
-
- * tests/entry.test (entry-22.1):
- * tests/listbox.test (listbox-6.15):
- * generic/tkListbox.c (ListboxInsertSubCmd, ListboxDeleteSubCmd):
- Ignore Tcl_SetVar2Ex failure of listVarName, similar to entry widget
- handling. [Bug 1424513]
-
-2006-05-26 Jeff Hobbs <jeffh@ActiveState.com>
-
- * macosx/tkMacOSXButton.c (TkMacOSXDrawControl): correct redraw for
- direct transition from disabled to active state. [Bug 706446]
-
-2006-05-25 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinMenu.c (TkWinMenuKeyObjCmd): get eventPtr after we know the
- window is still alive. [AS bug 45987] [Bug 1236306]
-
- * generic/tkMenu.c (DeleteMenuCloneEntries): Modify entry index
- changes to work around VC6 optimization bug. [Bug 1224330]
-
- * generic/tkMessage.c (MessageWidgetObjCmd): Correct msgPtr
- preserve/release pairing. [Bug 1485750] (afredd)
-
- * generic/tkWindow.c (Initialize): Correct mutex (un)lock pairing.
- [Bug 1479587] (loewis)
-
- * generic/tkBind.c (Tk_BindEvent, TkCopyAndGlobalEval): use Tcl_EvalEx
- instead of Tcl_GlobalEval.
-
-2006-05-16 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXWindowEvent.c (TkMacOSXGenerateFocusEvent): don't send
- focus events to windows of class help or to overrideredirect windows.
- [Bug 1472624]
-
- * macosx/tkMacOSXWm.c: set overrideredirect windows to not become
- activated by the window manager and to not receive OS activate events
- (should make them behave more like on other platforms); use modern
- window class API for overrideredirect and transient windows; set the
- default class of overrideredirect windows to 'simple' rather than
- 'plain' (i.e. no window frame); add missing Panther and Tiger window
- attributes to [::tk::unsupported::MacWindowStyle].
-
-2006-05-12 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock): Fix
- opt added 2006-03 that caused slowdown for some common cases. [Bug
- 1409140]
-
-2006-05-13 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkCanvWind.c (DisplayWinItem, WinItemRequestProc): ensure
- canvas window items are unmapped when canvas is unmapped. [Bug 940117]
-
- * macosx/tkMacOSXSubwindows.c (TkMacOSXUpdateClipRgn): empty clip
- region of unmapped windows to prevent any drawing into them or into
- their children from becoming visible. [Bug 940117]
-
- * macosx/tkMacOSXInt.h: revert Jim's attempt of 2005-03-14 to
- * macosx/tkMacOSXSubwindows.c: fix Bug 940117 as it disables Map/Unmap
- event propagation to children. [Bug 1480105]
-
- * macosx/tkMacOSXDraw.c (TkPutImage): handle tkPictureIsOpen flag,
- fixes incorrect positioning of images with complex alpha on native
- buttons; actual alpha blending is still broken in this situation. [Bug
- 1155596]
-
- * macosx/tkMacOSXEvent.c (TkMacOSXProcessCommandEvent):
- * macosx/tkMacOSXMenus.c (TkMacOSXInitMenus): workaround carbon bug
- with key shortcut for 'Preferences' app menu item. [Bug 1481503]
-
- * macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): only check
- for HICommand menu item shortcuts in the application menu.
+ * generic/tkConsole.c: Relax Tcl_InitStubs() calls so that a Tk 8.6
+ * generic/tkMain.c: might [load] into a Tcl 8.5 interp.
+ * generic/tkWindow.c:
- * macosx/tkMacOSXInt.h: initialize keyboard layout setup in
- * macosx/tkMacOSXInit.c: TkpInit() rather than during handling of
- * macosx/tkMacOSXKeyEvent.c: first key down event.
+ * generic/tkDecls.h: make genstubs
+ * generic/tkIntDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkIntXlibDecls.h:
+ * generic/tkPlatDecls.h:
- * macosx/tkMacOSXDraw.c: add optional debug code to flash clip
- * macosx/tkMacOSXSubwindows.c: regions during update or draw.
+2008-03-28 Don Porter <dgp@users.sourceforge.net>
-2006-05-04 Don Porter <dgp@users.sourceforge.net>
+ *** 8.5.2 TAGGED FOR RELEASE ***
- * README: Bump version number to 8.5a5
+ * README: Bump to 8.5.2 for release.
* generic/tk.h:
+ * library/tk.tcl:
* unix/configure.in:
* unix/tk.spec:
* win/configure.in:
@@ -5427,2007 +4517,277 @@
* unix/configure: autoconf-2.59
* win/configure:
-2006-04-28 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXWm.c (TkWmMapWindow, InitialWindowBounds): fix use of
- potentially stale window position in initial configure event on first
- map of a window. [Bug 1476443]
- (TkMacOSXWindowOffset): use modern GetWindowStructureWidths API.
-
- * macosx/tkMacOSXInt.h:
- * macosx/tkMacOSXMouseEvent.c (TkGenerateButtonEventForXPointer): new
- internal function to generate button events for current pointer
- directly, without requiring prior call to XQueryPointer().
-
- * macosx/tkMacOSXMouseEvent.c (XQueryPointer): implement return of
- window-local pointer position.
-
- * macosx/tkMacOSXInt.h: use improvements above to avoid calls to
- * macosx/tkMacOSXKeyEvent.c: GlobalToLocal() when the current port
- * macosx/tkMacOSXMenu.c: might not be set correctly. May fix [Bug
- * macosx/tkMacOSXMenus.c: 1243318]
- * macosx/tkMacOSXScale.c:
- * macosx/tkMacOSXScrlbr.c:
-
- * tkAboutDlg.r: update copyright.
-
- * macosx/tkMacOSXDebug.h: sync #includes with core-8-4-branch.
- * macosx/tkMacOSXEvent.h:
- * macosx/tkMacOSXFont.h:
-
-2006-04-26 Don Porter <dgp@users.sourceforge.net>
-
- *** 8.5a4 TAGGED FOR RELEASE ***
-
- * changes: Updates for next RC
-
-2006-04-25 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * unix/tkUnixFont.c (TkpGetFontFamilies): Fix crash caused when the
- XServer returns invalid font names. [Bug 1475865]
-
-2006-04-23 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * tests/scrollbar.test: fix to tkAqua test failures
-
-2006-04-18 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * macosx/tkMacOSXEmbed.c: fix to [Bug 1088814] test failures in
- embed.test
-
- * macosx/tkMacOSXWm.c:
- * tests/constraints.tcl:
- * tests/wm.test: fix to 'wm attributes' test for TkAqua
-
-2006-04-11 Peter Spjuth <peter.spjuth@space.se>
-
- * generic/tkWindow.c (Tk_NameToWindow): Allow NULL interp to
- Tk_NameToWindow. This fixes TkGetWindowFromObj which promises to handle
- NULL but didn't.
-
- * generic/tkGrid.c: Fixed handling of out of bounds row or column.
- * tests/grid.test: [Bug 1432666]
-
-2006-04-11 Don Porter <dgp@users.sourceforge.net>
-
- * unix/Makefile.in: Updated `make dist` target to be sure the
- message catalogs for the widget demo get packaged into the source code
- distribution. [Bug 1466509]
-
-2006-04-11 Daniel Steffen <das@users.sourceforge.net>
-
- * changes: added latest aqua bug fixes.
-
- * macosx/tkMacOSXDialog.c (Tk_MessageBoxObjCmd): added standard Escape
- key binding for msgbox cancel buttons [Patch 1193614], whitespace.
-
- * macosx/tkMacOSXCarbonEvents.c: handle kEventCommandUpdateStatus
- * macosx/tkMacOSXEvent.c: carbon event to dynamically enable
- the 'Preferences' app menu item when proc [::tk::mac::ShowPreferences]
- is defined. [Bug 700316]
-
- * macosx/tkMacOSXHLEvents.c: call ::tk::mac::* procs for all
- * macosx/tkMacOSXWindowEvent.c: registered appleevents [FR 1105284],
- implement print applevent handling, style/whitespace cleanup.
-
- * macosx/tkMacOSXDraw.c (TkMacOSXInitCGDrawing): prevent multiple init.
-
- * macosx/tkMacOSXFont.c: remove #ifdef'd text measuring codepaths now
- * macosx/tkMacOSXInit.c: known to be incorrect, cleanup obsolete text
- * macosx/README: antialiasing control code, document ATSUI text
- antialiasing changes.
-
- * 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 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * library/tkfbox.tcl (::tk::IconList_Goto): Fix prefix searching so
- that the start location is reasonable, and the prefix matching is using
- the correct Tcl command for this. [Bug 1467938]
-
-2006-04-10 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
-
- * macosx/tkMacOSXFont.c (MeasureStringWidth): Use implementation based
- on ATSUGetGlyphBounds (TK_MAC_USE_GETGLYPHBOUNDS), so we can use
- kATSUseFractionalOrigins. This in turn corrects [Bug 1461650].
- (InitFont): Use "." and "W" instead of "i" and "w" to determine the
- "-fixed" attribute. This prevents "Apple Chancery" from being
- classified as fixed.
- (InitFontFamilies): Only get the font families once.
-
-2006-04-09 Daniel Steffen <das@users.sourceforge.net>
-
- * 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 <das@users.sourceforge.net>
-
- * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): fix return
- values, implement window dragging & growing in background (with Command
- key down) and by fronting clicks [Bug 934524], use correct button &
- modifier state API when application is in background (also in
- TkMacOSXButtonKeyState).
-
- * macosx/tkMacOSXWm.c (TkMacOSXGrowToplevel): ensure QD port is set
- correctly before using API relying on it.
-
-2006-04-06 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * macosx/tkMacOSXMouseEvent.c: Now that [wm attributes -titlepath]
- works correctly, add OS support for dragging proxy icons and using the
- titlepath menu.
-
-2006-04-06 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXWm.c (WmAttributesCmd, WmIconbitmapCmd): fix errors in
- setting/removing window proxy icons via [wm attributes -titlepath] and
- [wm iconbitmap], use HIWindow API on Tiger or later. [Bug 1455241]
-
- * unix/tcl.m4: remove TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING
- define on Darwin. [Tcl Bug 1457515]
- * unix/configure: autoconf-2.59
- * unix/tkConfig.h.in: autoheader-2.59
-
-2006-04-05 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkWindow.c (Initialize): remove impotent use of
- DeleteWindowsExitProc as a global exit handler.
-
- * generic/tkMenu.c (TkSetWindowMenuBar): remove extra TkMenuInit call
- that caused finalization panic. [Bug 1456851]
- * win/tkWinMenu.c (FreeID, TkpNewMenu, MenuExitHandler)
- (MenuThreadExitHandler, TkpMenuInit, TkpMenuThreadInit): rework Windows
- menu init/finalization to better respect per-process and per-thread
- boundaries. [Bug 1456851]
- (TkWinMenuKeyObjCmd): Do not error when unknown window is passed in.
- [Bug 1236306]
-
- * win/tkWinX.c (TkWinXInit): init default keyboard charset correctly.
- [Bug 1374119] (pajas)
-
- * win/tkWinWm.c (WmProc): pass WM_QUERYENDSESSION message to Tk as
- WM_SAVE_YOURSELF wm protocol callback.
-
- * tests/textWind.test (textWind-10.6.1): prevent infinite update loop
- in case of test failure.
-
- * tests/wm.test (wm-attributes-1.2.4): correct expected result.
-
- * tests/grid.test: fix segfault on empty or "all" index list
- * generic/tkGrid.c (GridRowColumnConfigureCommand): [Bug 1422430]
-
-2006-04-05 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * generic/tkText.c: fix to crash caused on some platforms by new tests
- introduced to check for [Bug 1414171], which destroy the text widget in
- the dump callback script.
-
-2006-03-29 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkOption.c (TkOptionDeadWindow): handle OptionThreadExitProc
- being called before DeleteWindowsExitProc.
-
- * win/Makefile.in: convert _NATIVE paths to use / to avoid ".\"
- path-as-escape issue.
-
-2006-03-29 Don Porter <dgp@users.sourceforge.net>
-
- * changes: Updates for next RC
-
- * unix/tkUnixDefault.h: Changed "Black" to "#000000" and "White" to
- "#ffffff" to work around the (broken?) X servers that do not accept
- those color names. [Bug 917433]
-
-2006-03-28 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/tcl.m4, win/tcl.m4: []-quote AC_DEFUN functions.
-
-2006-03-26 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * generic/tkText.c:
- * tests/text.test: Fix for elaborations of [Bug 1414171] for '$text
- dump -command <script>' where script deletes large portions of the
- text widget, or even destroys the widget.
-
-2006-03-28 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.xcode/default.pbxuser: add '-singleproc 1' cli arg to
- * macosx/Wish.xcodeproj/default.pbxuser: tktest to ease test debugging.
-
- * macosx/Wish.xcode/project.pbxproj: removed $prefix/share from
- * macosx/Wish.xcodeproj/project.pbxproj: TCL_PACKAGE_PATH as per change
- to tcl/unix/configure.in of 2006-03-13.
-
- * macosx/tkMacOSXDraw.c: sync whitespace & minor changes with
- * macosx/tkMacOSXEvent.h: core-8-4-branch.
- * macosx/tkMacOSXFont.h:
- * macosx/tkMacOSXMenu.c:
- * macosx/tkMacOSXNotify.c:
-
-2006-03-27 Don Porter <dgp@users.sourceforge.net>
-
- * changes: Updates for next RC
-
-2006-03-27 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
-
- * generic/tkTextDisp.c (MeasureChars): Fix calculations of start and
- end of string. [Bugs 1325998, 1456157]
-
-2006-03-27 Donal K. Fellows <dkf@users.sf.net>
-
- * generic/tkImgGIF.c (FileReadGIF): Stop crashes when the first GIF
- frame does not define the overall size of the image. [Bug 1458234]
-
-2006-03-26 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * generic/tkText.c:
- * generic/tkText.h:
- * generic/tkTextBTree.c:
- * tests/text.test: Fix for [Bug 1414171] for '$text dump -command
- <script>' where 'script' actually modifies the widget during the
- process.
-
-2006-03-25 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXDraw.c (TkMacOSXSetUpCGContext):
- * macosx/tkMacOSXFont.c (TkMacOSXQuarzStartDraw, TkMacOSXQuarzEndDraw):
- performance improvements, sync similar code, formatting & whitespace.
-
-2006-03-24 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkTextDisp.c: Moved #ifdef MAC_OSX_TK code added by
- * macosx/tkMacOSXColor.c: [Patch 638966] into platform specific files.
- * macosx/tkMacOSXInt.h:
-
- * macosx/tkMacOSX.h: Cleaned up & rationalized order of
- * macosx/tkMacOSXBitmap.c: #includes of tk and carbon headers.
- * macosx/tkMacOSXButton.c:
- * macosx/tkMacOSXCarbonEvents.c:
- * macosx/tkMacOSXClipboard.c:
- * macosx/tkMacOSXColor.c:
- * macosx/tkMacOSXConfig.c:
- * macosx/tkMacOSXCursor.c:
- * macosx/tkMacOSXDialog.c:
- * macosx/tkMacOSXDraw.c:
- * macosx/tkMacOSXEmbed.c:
- * macosx/tkMacOSXEntry.c:
- * macosx/tkMacOSXEvent.c:
- * macosx/tkMacOSXEvent.h:
- * macosx/tkMacOSXFont.h:
- * macosx/tkMacOSXHLEvents.c:
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXInt.h:
- * macosx/tkMacOSXKeyEvent.c:
- * macosx/tkMacOSXKeyboard.c:
- * macosx/tkMacOSXMenu.c:
- * macosx/tkMacOSXMenubutton.c:
- * macosx/tkMacOSXMenus.c:
- * macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXRegion.c:
- * macosx/tkMacOSXScale.c:
- * macosx/tkMacOSXScrlbr.c:
- * macosx/tkMacOSXSend.c:
- * macosx/tkMacOSXSubwindows.c:
- * macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXWm.h:
- * macosx/tkMacOSXXStubs.c:
-
-2006-03-23 Reinhard Max <max@tclers.tk>
-
- * unix/tkUnixRFont.c (TkpMeasureCharsInContext): Copied over from
- tkUnixFont.c to fix compiling with --enable-xft .
-
- * unix/tk.spec: Cleaned up and completed. An RPM can now be built from
- the tk source distribution with "rpmbuild -tb <tarball>".
-
-2006-03-23 Don Porter <dgp@users.sourceforge.net>
-
- * tests/textDisp.test: Updated expected error messages to match the
- standardized formats established on 2005-11-17. [Bug 1370296]
-
-2006-03-22 Don Porter <dgp@users.sourceforge.net>
-
- * changes: Updates for next RC
-
-2006-03-21 Daniel Steffen <das@users.sourceforge.net>
+ * changes: Updates for 8.5.2 release.
- * generic/tkFont.c: implementation of ATSUI text rendering
- * generic/tkInt.h: in TkAqua provided by Benjamin
- * generic/tkTextDisp.c: Riefenstahl. [Patch 638966]
- * library/demos/unicodeout.tcl:
- * macosx/tkMacOSXFont.h (new file):
- * macosx/tkMacOSXFont.c:
- * tests/font.test:
- * unix/tkUnixFont.c:
- * win/tkWinFont.c:
+2008-03-27 Jeff Hobbs <jeffh@ActiveState.com>
- * generic/tkFont.c: moved MODULE_SCOPE declarations of font
- * generic/tkFont.h: helper procs into header files.
- * macosx/tkMacOSXButton.c:
- * macosx/tkMacOSXFont.h:
- * macosx/tkMacOSXMenubutton.c:
+ * library/safetk.tcl (::safe::tkInterpInit): Make sure tk_library and
+ its subdirs (eg, ttk) are on the "safe" access path.
- * macosx/Wish.xcode/project.pbxproj: add new tkMacOSXFont.h file,
- * macosx/Wish.xcodeproj/project.pbxproj: turn off dead code stripping
- as it interferes with -sectcreate (rdar://4486223).
+2008-03-27 Daniel Steffen <das@users.sourceforge.net>
- * macosx/Wish.xcode/default.pbxuser: add TCLLIBPATH=/Library/Tcl
- * macosx/Wish.xcodeproj/default.pbxuser: env var setting to tktest.
+ * unix/tcl.m4 (SunOS-5.1x): [Bug 1921166]: Fix 64bit support for Sun
+ cc.
- * unix/configure.in: fix detection of symbols build when enabling
- TkAqua debug code; filter nm output of libtclstub better to avoid
- error on intel macs. [Bug 1415789]
* unix/configure: autoconf-2.59
-2006-03-20 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkConsole.c: Added exit handler to clean up the interp where
- the console window lives. Also added code to handle multiple calls to
- Tk_CreateConsoleWindow so that the console channels connect to the last
- console window opened, in compatibility with the previous
- implementation.
-
-2006-03-18 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * generic/tkText.c: Fix for undo/modified status of text widgets when
- empty strings are inserted and undone.
-
-2006-03-17 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * library/clrpick.tcl: Avoid using abbreviated sub-commands in core
- * library/palette.tcl: scripts as this can cause problems with
- * library/scale.tcl: mega-widget libraries like snit.
- * library/scrlbar.tcl: [Bug 1451587]
- * library/tkfbox.tcl:
- * library/xmfbox.tcl:
-
-2006-03-16 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkConsole.c: Substantial rewrite of [console] support.
- * generic/tkInt.h: Included Obj-ification of the [console] and
- [consoleinterp] commands, and reworking of all the supporting data
- structures for cleaner sharing and lifetime management especially in
- multi-threaded configurations.
-
-2006-03-16 Donal K. Fellows <dkf@users.sf.net>
-
- * library/msgs/pt.msg: Messages for Portuguese (strictly just for
- Brazilian Portuguese, but they'll do until we get other Portuguese
- speakers localize) from Ricardo Jorge <ricardoj@users.sf.net> and Silas
- Justiano <silasj@users.sf.net>. Many thanks! [Bug 1405069]
-
- * generic/tkImgPhoto.c (ImgPhotoCmd, Tk_PhotoPutBlock)
- (Tk_PhotoPutZoomedBlock): Added hack to detect copying of a photo with
- a simple alpha channel and skip calling ToggleComplexAlphaIfNeeded.
- This should speed up many photo-to-photo copies, keeping the cost of
- the alpha channel down.
-
-2006-03-15 Donal K. Fellows <dkf@users.sf.net>
-
- * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock): Try
- to squelch performance issue with code that writes to large images by
- single pixels. Masses of thanks to George Staplin for helping to trace
- this down to the COMPLEX_ALPHA flag handling code. [Bug 1409140]
-
-2006-03-13 Don Porter <dgp@users.sourceforge.net>
-
- * tests/scrollbar.test: Corrected several broken calls to [testmetrics]
- that were crashing the test suite.
-
- * tests/constraints.tcl: Added notAqua constraint to canvPs-3.1
- * tests/canvPs.test: to stop test suite crash on Mac OSX.
- [Bug 1088807]
-
- * generic/tkCmds.c: Purged remaining references to errno,
- * macosx/tkMacOSXPort.h: and errno.h. Standardized the logic
- * macosx/tkMacOSXWm.c: for using header files from the compat
- * macosx/tkMacOSXWm.h: directory. Thanks Joe English for the
- * unix/tkUnixPort.h: patch. [Patch 1445404]
-
-2006-03-08 Don Porter <dgp@users.sourceforge.net>
-
- * unix/Makefile.in: Update `make dist` to copy the image files needed
- by the test suite into the source distro. This was overlooked in the
- 2005-10-12 commit.
-
- * changes: Update in prep. for 8.5a4 release.
-
-2006-03-07 Joe English <jenglish@users.sourceforge.net>
-
- * unix/tcl.m4: Set SHLIB_LD_FLAGS='${LIBS}' on NetBSD, as per the other
- *BSD variants. [Bug 1334613]
- * unix/configure: Regenerated.
-
-2006-03-07 Donal K. Fellows <dkf@users.sf.net>
-
- * doc/canvas.n: Added note that stipples are not well-supported on
- non-X11 platforms. [Bug 220787] It's not a great solution, but it does
- indicate the state of affairs that has existed for years anyway; not
- much modern software uses stipples anyway.
-
-2006-03-02 Jeff Hobbs <jeffh@ActiveState.com>
-
- * macosx/tkMacOSXDraw.c (TkPutImage): Fix endian issue on OS X x86
- displaying images. Bitmap images still have a black/white reversal
- issue, appears to be a general OS X issue (as seen in frogger demo).
-
-2006-02-27 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * generic/tkBitmap.c (Tk_GetBitmapFromData): Improve thread-safety.
- [Bug 470322]
-
- * generic/tkImgBmap.c (ImgBmapConfigureInstance): Force creation of new
- Pixmaps before deletion of old ones to prevent stupid caching problems.
- [Bug 480862]
-
-2006-02-09 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tk.decls: fix signature of TkMacOSXInvalClipRgns
- * generic/tkPlatDecls.h: to use Tk_Window instead of internal
- * macosx/tkMacOSXSubwindows.c: type TkWindow (which led to any include
- * macosx/tkMacOSXWindowEvent.c: of public header tkMacOSX.h requiring
- * macosx/tkMacOSXWm.c: prior include of tkInt.h).
-
- * generic/tk.h: move TkAqua specific REDO_KEYSYM_LOOKUP define
- * macosx/tkMacOSXPort.h: out of tk.h into platform header.
-
-2006-01-31 Donal K. Fellows <dkf@users.sf.net>
-
- * library/bgerror.tcl (::tk::dialog::error::bgerror): Finish the
- internationalization of the error dialog. [Bug 1409264]
-
-2006-01-25 Don Porter <dgp@users.sourceforge.net>
-
- * library/bgerror.tcl: Updates to use Tcl 8.4 features. [Patch 1237759]
- * library/choosedir.tcl:
- * library/comdlg.tcl:
- * library/console.tcl:
- * library/dialog.tcl:
- * library/focus.tcl:
- * library/msgbox.tcl:
- * library/palette.tcl:
- * library/tk.tcl:
- * library/tkfbox.tcl:
- * library/xmfbox.tcl:
-
-2006-01-23 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/configure: minor fix to Darwin specific code removing
- * unix/configure.in: 64bit flags from CFLAGS for Tk build.
-
-2006-01-20 Joe English <jenglish@users.sourceforge.net>
-
- * generic/tkEvent.c, unix/tkUnixEvent.c: XIM fixes [See 905830, patch
- tk84-xim-fixes.patch], and revert 2005-12-05 patch disabling XIM when
- SCIM in use, and make sure all X events get passed to XFilterEvent,
- including those without a corresponding Tk window.
-
-2006-01-13 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
-
- * generic/tkUndo.c (TkUndoSetDepth): Don't free TkUndoSubAtoms for
- separator entries that are deleted: there is some unpredictable garbage
- instead of subatoms.
-
- Free both 'apply' and 'revert' action chains for non-separator entries.
-
-2006-01-12 Donal K. Fellows <dkf@users.sf.net>
-
- TIP #260 IMPLEMENTATION
-
- * generic/tkCanvText.c (TextItem, CreateText, DisplayCanvText):
- * doc/canvas.n: Code, docs and tests to implement an -underline
- * tests/canvText.test: option for canvases' text items.
-
-2006-01-11 Peter Spjuth <peter.spjuth@space.se>
-
- * generic/tkGrid.c: Removed a lingering error message from TIP#147
- implementation.
-
-2006-01-10 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXDebug.c: add TkMacOSXGetNamedDebugSymbol() function
- * macosx/tkMacOSXDebug.h: that finds unexported symbols in loaded
- libraries by manually walking their symbol table; only to be used for
- debugging purposes, may break unexpectedly in the future. Needed to get
- access to private_extern internal debugging functions in HIToolbox.
-
- * macosx/tkMacOSXCarbonEvents.c: fix debug event tracing on Tiger.
- * macosx/tkMacOSXMenu.c: add debug menu printing during reconfigure.
- * macosx/tkMacOSXInit.c: conditionalize 64bit-unsafe dyld code.
- * macosx/GNUmakefile: add 'wish8.x' symlink to SYMROOT.
-
- * macosx/Wish.xcode/project.pbxproj: fix copy to tktest resource
- * macosx/Wish.xcodeproj/project.pbxproj: fork when zerolinked.
-
- * macosx/Wish.xcode/default.pbxuser: add widget demo as argument to
- * macosx/Wish.xcodeproj/default.pbxuser: executables (on by default).
-
- * unix/configure: add caching, use AC_CACHE_CHECK instead of
- * unix/configure.in: AC_CACHE_VAL where possible, consistent message
- * unix/tcl.m4: quoting, sync relevant tclconfig/tcl.m4 changes
- and gratuitous formatting differences, fix SC_CONFIG_MANPAGES with
- default argument, Darwin improvements to SC_LOAD_*CONFIG.
-
-2005-12-28 Donal K. Fellows <dkf@users.sf.net>
-
- * generic/tkUndo.c (TkUndoSetDepth): Apply [Patch 1391939] from Ludwig
- Callewaert to fix [Bug 1380427].
-
-2005-12-14 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Wish.xcode/project.pbxproj:
- * macosx/Wish.xcodeproj/project.pbxproj: add new tclTomMath* files.
-
-2005-12-13 Daniel Steffen <das@users.sourceforge.net>
-
- * library/demos/cscroll.tcl: add MouseWheel bindings for aqua.
-
- * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents):
- * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent)
- (GenerateMouseWheelEvent): add support for kEventMouseScroll events
- (smooth mouse wheel scrolling from mighty mouse or scrolling trackpad)
- by handling kEventMouseWheelMoved on application target as well as on
- dispatcher, in order to pick up synthesized MouseWheel events from
- HIObject handler (c.f. QA1453); add support for horizontal scrolling
- events by generating MouseWheel XEvent with Shift modifier.
-
-2005-12-12 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/tcl.m4, unix/configure: Fix sh quoting error reported in
- bash-3.1+ [Bug 1377619] (schafer)
-
-2005-12-09 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/tkWinWm.c (WinSetIcon): Don't check result of SetClassLong() or
- SetClassLongPtr() since it was generating an incorrect error and the
- MSDN docs indicate that the result need not be checked.
-
-2005-12-09 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/configure: Regen.
- * win/tcl.m4 (SC_CONFIG_CFLAGS): Define MACHINE for gcc builds. The
- lack of a definition of this variable in the manifest file was causing
- a runtime error in wish built with gcc.
-
-2005-12-09 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkInt.decls: Move all platform test sources from tk lib into
- * generic/tkTest.c: tktest directly, removes requirement to export
- * macosx/tkMacOSXTest.c:TkplatformtestInit from internal stubs table.
- * unix/Makefile.in:
- * win/Makefile.in:
- * win/makefile.vc:
- * win/tkWinTest.c:
-
- * generic/tkIntPlatDecls.h:
- * generic/tkStubInit.c: regen.
-
-2005-12-08 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tcl.m4: Add build support for Windows-x64 builds.
- * win/configure: --enable-64bit now accepts =amd64|ia64 for
- * win/Makefile.in: Windows 64-bit build variants (default: amd64)
- * win/makefile.vc: [Bug 1369597]
- (TKOBJS): add tkWinTest.obj to regular Tk obj for TkplatformtestInit
-
- * win/configure.in: Add CE build support (some C code fixes needed)
- * win/wish.exe.manifest.in (new): manifest must map in MACHINE and
- * win/rc/wish.exe.manifest (removed): VERSION to be correct.
- * unix/Makefile.in: fix dist target for manifest dir change
-
- * generic/tkTextTag.c (TkTextTagCmd): use correct arraySize for peered
- text widgets in [$text tag names]. [Bugs 1375069, 1374935]
-
-2005-12-08 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXDraw.c: Remove inclusion of tclInt.h and use of tcl
- * macosx/tkMacOSXFont.c: internals wherever possible in tk/macosx, the
- * macosx/tkMacOSXInit.c: only remaining tcl internals in TkAqua are
- * macosx/tkMacOSXNotify.c:TclServiceIdle() in tkMacOSXScrlbr.c and
- * macosx/tkMacOSXScrlbr.c:Tcl_Get/SetStartupScript() in tkMacOSXInit.c
- [RFE 1336531]
-
- * macosx/tkMacOSXInt.h: sync comments with core-8-4-branch.
-
-2005-12-07 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/tkUnixEvent.c (OpenIM): remove extraneous const
-
-2005-12-06 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * doc/ConfigWidg.3 (TK_CONFIG_OPTION_SPECIFIED): Mentioned that the
- flag is deprecated because it is not thread-safe.
-
-2005-12-05 Reinhard Max <max@suse.de>
-
- * unix/tkUnixEvent.c (OpenIM): Added a workaround to allow at least
- ASCII and the Compose key when typing into text and entry widgets on a
- system that uses SCIM. This has to be taken out again once the SCIM
- problems have been fixed.
-
-2005-12-01 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/tcl.m4 (Darwin): fixed error when MACOSX_DEPLOYMENT_TARGET unset
- * unix/configure: regen.
-
-2005-11-30 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinWm.c (WmAttributesCmd): set (no)topmost window aspect before
- rewrapping. [Bug 1086049]
-
- * macosx/tkMacOSXXStubs.c (TkpOpenDisplay, TkMacOSXDisplayChanged):
- * macosx/tkMacOSXWindowEvent.c (TkMacOSXProcessApplicationEvent):
- * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents):
- * macosx/tkMacOSXEvent.h: Trap kEventAppAvailableWindowBoundsChanged
- * macosx/tkMacOSXInt.h: event to watch for change in display size and
- adjust internal state appropriately.
-
- * doc/checkbutton.n: fix -selectcolor docs. [Bug 1083838]
-
- * generic/tkImgGIF.c: cast calls to blockOut
-
- * win/Makefile.in: place TCL_BIN_DIR first in PATH for targets to get
- Tcl built dll first.
- Add tkWinTest.obj to tk84.dll to handle some needed test functions
- being defined in stubs (TkplatformtestInit).
-
- * tests/scrollbar.test (6.22): fix rounding-error sensitive test
-
-2005-11-29 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/console.tcl (::tk::ConsoleInit): improve work-around to avoid
- '% ' from tclMain.c. [Bug 1252259]
-
-2005-11-27 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/tcl.m4 (Darwin): add 64bit support, check for Tiger copyfile(),
- add CFLAGS to SHLIB_LD to support passing -isysroot in env(CFLAGS) to
- configure (flag can't be present twice, so can't be in both CFLAGS and
- LDFLAGS during configure), don't use -prebind when deploying on 10.4,
- define TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING (rdar://3171542).
- (SC_ENABLE_LANGINFO, SC_TIME_HANDLER): add/fix caching, fix obsolete
- autoconf macros. Sync with tcl/unix/tcl.m4.
-
- * unix/configure.in: fix obsolete autoconf macros, sync gratuitous
- formatting/ordering differences with tcl/unix/configure.in.
-
- * unix/Makefile.in: add CFLAGS to wish/tktest link to make executable
- linking the same as during configure (needed to avoid loosing any
- linker relevant flags in CFLAGS, in particular flags that can't be in
- LDFLAGS). Avoid concurrent linking of wish and compiling of
- tkTestInit.o during parallel make, fix dependencies and flags for
- building tkMacOSXInit.o
- (checkstubs, checkexports): dependency and Darwin fixes
- (dist): add new macosx files.
-
- * macosx/tkMacOSXEvent.c (TkMacOSXProcessEvent):
- * macosx/tkMacOSXEvent.h:
- * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent):
- * macosx/tkMacOSXCarbonEvents.c: install standard application event
- handler, add & call functions to start and stop carbon even timer that
- runs the tcl event loop periodically during a nested carbon event loop
- in the toolbox (e.g. during menutracking) to ensure tcl timers etc.
- continue to fire, register app event handler for menu tracking and HI
- command carbon events, move menu event handling to new handlers for
- those carbon events, no longer register for/handle appleevent carbon
- event (now dealt with by standard application event handler), event
- debugging code dynamically acquires carbon event debugging functions to
- allow use on Tiger where they are no longer exported from HIToolbox.
-
- * macosx/tkMacOSXFont.c (TkMacOSXUseAntialiasedText):
- * macosx/tkMacOSXKeyEvent.c (GetKeyboardLayout):
- * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents):
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXInt.h: abstract common code to dynamically acquire
- address of a named symbol (from a loaded dynamic library) into new
- function TkMacOSXGetNamedSymbol() and macro TkMacOSXInitNamedSymbol.
-
- * macosx/tkMacOSXMenu.c (TkpNewMenu):
- * macosx/tkMacOSXMenubutton.c (MenuButtonInitControl):
- * macosx/tkMacOSXMenus.c (TkMacOSXHandleMenuSelect): switch to modern
- utf-8 aware menu manager API, remove obsolete code, add error handling.
-
- * macosx/tkMacOSXMenu.c:
- * macosx/tkMacOSXMenus.c:
- * macosx/tkMacOSXMenubutton.c:
- * macosx/tkMacOSXMouseEvent.c: define OSX 10.3 or later only constants
- if necessary to allow compilation on OSX 10.2
-
- * macosx/tkMacOSXWm.c (UpdateSizeHints): remove code that is never
- executed.
-
- * xlib/xgc.c (XCreateGC): sync with core-8-4-branch change.
-
- * generic/tk.h: add/correct location of version numbers in macosx files
-
- * generic/tkInt.h: clarify fat compile comment.
-
- * macosx/Wish.pbproj/default.pbxuser (new):
- * macosx/Wish.pbproj/jingham.pbxuser:
- * macosx/Wish.pbproj/project.pbxproj:
- * macosx/Wish.xcode/default.pbxuser:
- * macosx/Wish.xcode/project.pbxproj:
- * macosx/Wish.xcodeproj/default.pbxuser (new):
- * macosx/Wish.xcodeproj/project.pbxproj (new): new/updated projects for
- Xcode 2.2 on 10.4, Xcode 1.5 on 10.3 & ProjectBuilder on 10.2, with
- native tktest targets and support for universal (fat) compiles.
-
- * macosx/Tk-Info.plist (removed):
- * macosx/Wish-Info.plist (removed):
- * macosx/buildTkConfig.tcl (removed): remove obsolete build files.
-
- * macosx/README: clarification/cleanup, document new Xcode projects and
- universal (fat) builds via CFLAGS (i.e. ppc and i386 at the same time).
-
- * unix/Makefile.in:
- * unix/aclocal.m4:
- * unix/configure.in:
- * macosx/configure.ac (new): add support for inclusion of
- unix/configure.in by macosx/configure.ac, allows generation of a
- config headers enabled configure script in macosx (required by Xcode
- projects).
-
- * macosx/GNUmakefile: rename from Makefile to avoid overwriting by
- configure run in tk/macosx, add support for reusing configure cache,
- build target fixes.
-
- * generic/tk3d.h:
- * generic/tkButton.h:
- * generic/tkCanvas.c:
- * generic/tkCanvas.h:
- * generic/tkColor.h:
- * generic/tkEntry.h:
- * generic/tkFileFilter.h:
- * generic/tkFont.c:
- * generic/tkFont.h:
- * generic/tkImage.c:
- * generic/tkImgPhoto.c:
- * generic/tkInt.h:
- * generic/tkMenu.c:
- * generic/tkMenu.h:
- * generic/tkMenubutton.h:
- * generic/tkScale.h:
- * generic/tkScrollbar.h:
- * generic/tkSelect.h:
- * generic/tkStubInit.c:
- * generic/tkStubLib.c:
- * generic/tkText.h:
- * generic/tkUndo.h:
- * macosx/tkMacOSXButton.c:
- * macosx/tkMacOSXDebug.c:
- * macosx/tkMacOSXDebug.h:
- * macosx/tkMacOSXDialog.c:
- * macosx/tkMacOSXDraw.c:
- * macosx/tkMacOSXEntry.c:
- * macosx/tkMacOSXFont.c:
- * macosx/tkMacOSXInt.h:
- * macosx/tkMacOSXMenu.c:
- * macosx/tkMacOSXMenubutton.c:
- * macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXSend.c:
- * macosx/tkMacOSXSubwindows.c:
- * macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXXStubs.c:
- * unix/tkUnixButton.c:
- * unix/tkUnixMenu.c:
- * xlib/xgc.c: ensure externally visible symbols not contained in stubs
- table are declared as MODULE_SCOPE (or as static if not used outside of
- own source file), #ifdef out a few Xlib and aqua functions that are
- never called. These changes allow 'make checkstubs' to complete without
- error on Darwin with gcc 4.
-
- * macosx/tkMacOSXTest.c:
- * macosx/tkMacOSXPort.h:
- * win/tkWinTest.c:
- * generic/tkInt.decls: add functions needed by tktest to internal stubs
- table, correct signature of TkMacOSXHandleMenuSelect, add XSync to aqua
- Xlib stubs.
+2008-03-27 Daniel Steffen <das@users.sourceforge.net>
- * unix/tkUnixSend.c:
- * generic/tkText.c:
- * generic/tkTest.c: #ifdef unix only declarations.
- (TestmetricsCmd): unify win and mac implementation.
- (TestsendCmd): move to tkUnixSend.c to avoid access to global var.
- (TesttextCmd): move to tkText.c to avoid having to put all the internal
- text functions it uses into the stubs table.
+ * generic/ttk/ttkStubLib.c: Ensure tcl stubs are used in libtkstub
+ even in a static build of Tk.
+ * generic/ttk/ttkDecls.h: Fix incorrect number of arguments in
+ Ttk_InitStubs macro definition.
- * generic/tkTextDisp.c:
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXKeyEvent.c:
- * macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXXStubs.c: fix gcc 4 warnings.
+2008-03-26 Don Porter <dgp@users.sourceforge.net>
- * macosx/tkMacOSXNotify.c:
- * macosx/tkMacOSXScrlbr.c: sync with core-8-4-branch.
+ * changes: Updates for 8.5.2 release.
- * generic/tkIntDecls.h:
- * generic/tkIntPlatDecls.h:
- * generic/tkIntXlibDecls.h:
- * generic/tkStubInit.c:
- * unix/configure:
- * unix/tkConfig.h.in: regen.
+ * unix/tkUnixCursor.c: [Bug 1922466]: Stop crash in [. configure
+ -cursor] on X11. Thanks to emiliano gavilan.
-2005-11-22 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+2008-03-26 Joe English <jenglish@users.sourceforge.net>
- * library/tkfbox.tcl: Remove all references to data(curItem), as it is
- no longer used. [Bug 600313]
- (::tk::IconList_CurSelection): Renamed for clarity.
+ * generic/tkInt.h, generic/tkEvent.c, unix/tkUnixEvent.c,
+ * unix/tkUnixKey.c: XIM reorganization and cleanup; see
+ [Patch 1919791] for details.
- * doc/GetFont.3: Revert previous fix; a NULL interp is now legal.
- * generic/tkFont.c (ParseFontNameObj, GetAttributeInfoObj): Allow these
- functions to work with a NULL interp by making them check when
- generating error messages. [Bug 1151523]
+2008-03-21 Joe English <jenglish@users.sourceforge.net>
- * library/tkfbox.tcl (::tk::dialog::file::): Correct the quoting of the
- script used in variable traces so that widget names with spaces in will
- work. [Bug 1335485]
+ * generic/tk.decls, generic/ttk/ttkStubLib.c, unix/Makefile.in:
+ [Bug 1920030]: Keep ttkStubLib.o in libtkstub instead of libtk.
-2005-11-16 Vince Darley <vincentdarley@users.sourceforge.net>
+2008-03-20 Donal K. Fellows <dkf@users.sf.net>
- * doc/text.n: clarify left to right interpretation of index modifiers,
- including the fact that validation occurs after each step. [Bug
- 1357575]
+ * tests/wm.test: Rewrote so that tests clean up after themselves
+ rather than leaving that to the following test. Makes it easier to
+ catch problems where they originate. Inspired by [Bug 1852338]
-2005-11-15 Joe English <jenglish@users.sourceforge.net>
+2008-03-19 Donal K. Fellows <dkf@users.sf.net>
- * unix/tkUnixWm.c, tests/unixWm.test, doc/wm.n: Support for [wm
- attributes] on X11. [TIP#231, Patch 1062022]
+ * doc/GetClrmap.3: [Bug 220809]: Documented Tk_PreserveColormap.
-2005-11-14 Joe English <jenglish@users.sourceforge.net>
+2008-03-17 Joe English <jenglish@users.sourceforge.net>
- * library/bgerror.tcl: Truncate error messages at 45 characters
- instead of 30. [Bug 1224235]
+ * unix/Makefile.in, win/Makefile.in, win/makefile.vc: [Bug 1863007]:
+ Put ttkStubLib.o in libtkstub instead of libtk.
-2005-11-14 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+2008-03-16 Donal K. Fellows <dkf@users.sf.net>
- * generic/tkSelect.c (TkSelDefaultSelection): Test select-9.5
- highlighted further brokenness in this function.
+ * library/demos/goldberg.tcl: [Bug 1899664]: Made work when run twice
+ in the same session. Also made the control panel use Ttk widgets.
-2005-11-13 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+2008-03-13 Daniel Steffen <das@users.sourceforge.net>
- * unix/tkUnixSelect.c (SelCvtToX): Arrange for the parsing code to use
- Tcl's list parsing code, another simplification that enables testing
- of the [Bug 1353414] fix.
+ * unix/configure.in: [Bug 1913622]: Use backslash-quoting instead of
+ * unix/tcl.m4: double-quoting for lib paths in tkConfig.sh.
+ * unix/configure: autoconf-2.59
- * unix/tkUnixSelect.c (SelCvtFromX): Generate string forms of the
- advanced selection types in a Tcl_DString. This makes fixing [Bug
- 1353414] trivial, and simplifies the code at the same time.
- * tests/select.test (select-9.5): Added test for [Bug 1353414]
+2008-03-13 Don Porter <dgp@users.sourceforge.net>
-2005-11-10 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+ * changes: Updates for 8.5.2 release.
- * generic/tkBind.c (ChangeScreen): More DString fixes from
- * generic/tkTextWind.c (EmbWinLayoutProc): [Bug 1353022]
- * win/tkWinMenu.c (SetDefaults):
+2008-03-12 Daniel Steffen <das@users.sourceforge.net>
- * win/tkWinDialog.c (ConvertExternalFilename): Factored out the
- encoding conversion and de-backslash-ing code that is used in many
- places in this file.
- (GetFileNameW, GetFileNameA, ChooseDirectoryValidateProc): Make sure
- that data is freed correctly and that certain (hopefully impossible)
- failure modes won't cause crashes. [Bug 1353022]
+ * macosx/Wish.xcodeproj/project.pbxproj: Add support for Xcode 3.1
+ * macosx/Wish.xcodeproj/default.pbxuser: CODE_SIGN_IDENTITY and
+ * macosx/Wish-Common.xcconfig: 'xcodebuild install'.
-2005-11-06 Pat Thoyts <pat@zsplat.freeserve.co.uk>
+2008-03-12 Joe English <jenglish@users.sourceforge.net>
- * unix/tcl.m4: Fix SHLIB_LD_LIBS for building tclkit on OpenBSD.
- * unix/configure: regenerated
+ * unix/tkUnixRFont.c: Try a fallback font if XftFontOpenPattern()
+ fails in GetFont (workaround for [Bug 1090382]).
-2005-10-31 Vince Darley <vincentdarley@users.sourceforge.net>
+2008-03-11 Daniel Steffen <das@users.sourceforge.net>
- * generic/tkText.c
- * tests/textDisp.test: fix and test for [Bug 1333951] in '.text count
- -displaylines'.
+ * library/demos/knightstour.tcl: Aqua GOOBE.
+ * library/demos/widget:
-2005-10-18 Don Porter <dgp@users.sourceforge.net>
+ * macosx/Wish.xcodeproj/project.pbxproj: Add support for Xcode 3.1 and
+ * macosx/Wish.xcodeproj/default.pbxuser: configs for building with
+ * macosx/Wish-Common.xcconfig: gcc-4.2 and llvm-gcc-4.2.
- * generic/tkMain.c: Rewrote code that sets the ::argv value to be sure
- conversion from the system encoding is complete before any processing
- sensitive to list-special characters is done. [Bug 1328926]
+ * generic/tkCanvUtil.c: Fix gcc-4.2 warnings.
-2005-10-17 Jeff Hobbs <jeffh@ActiveState.com>
+ * macosx/GNUmakefile: Fix quoting to allow paths to
+ * macosx/Wish-Common.xcconfig: ${builddir}, ${INSTALL_ROOT}
+ * unix/Makefile.in: and ${TCL_BIN_DIR} to contain
+ * unix/configure.in: spaces.
+ * unix/install-sh:
+ * unix/tcl.m4:
- * macosx/tkMacOSXScrlbr.c (UpdateControlValues): check geomMgrPtr is
- valid before checking type
+ * unix/configure: autoconf-2.59
-2005-10-15 Jeff Hobbs <jeffh@ActiveState.com>
+ * unix/Makefile.in (install-strip): Strip non-global symbols from
+ dynamic library.
- * library/menu.tcl (::tk::MenuUnpost): remove leftover ] from string
- equal mods of 2005-07-25. (sowadsky)
+2008-03-10 Don Porter <dgp@users.sourceforge.net>
-2005-10-14 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * changes: Updates for 8.5.2 release.
- * win/tkWinSend.c: Avoid using tcl internal headers and fix to
- * win/tkWinSendCom.h: correctly link on all types of build (was
- * win/tkWinSendCom.c: broken in static,msvcrt builds).
+2008-03-07 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-2005-10-12 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * doc/colors.n: Reworked to produce nicer HTML output.
- * tests/canvPs.test, tests/canvPsBmap.tcl, tests/canvPsImg.tcl:
- * tests/imgPhoto.test, tests/menu.test: Arrange for the test suite to
- only ever refer to images in the same directory as the tests. This
- makes it possible to package the test suite itself as a starkit. Thanks
- to David Zolli for suggesting this.
+2008-03-06 Joe English <jenglish@users.sourceforge.net>
-2005-10-10 Jeff Hobbs <jeffh@ActiveState.com>
+ * doc/ttk_notebook.n: [Bug 1882011]: Move "TAB IDENTIFIERS" section
+ above "WIDGET COMMAND" section.
- * generic/tkConfig.c (Tk_DeleteOptionTable, Tk_CreateOptionTable):
- properly alloc/delete one more option. [Bug 1319720] (melbardis)
+2008-02-29 Pat Thoyts <patthoyts@users.sourceforge.net>
- * macosx/tkMacOSXInt.h: Move MODULE_SCOPE defn to tkInt.h and add
- * generic/tkInt.h: WORDS_BIGENDIAN checks that will work with OS X
- universal binary compiles. (steffen)
+ * library/demos/widget: Added a Knight's tour canvas demo.
+ * library/demos/knightstour.tcl:
- * generic/tkMenu.c (TkSetWindowMenuBar): do not call TkMenuInit if the
- winPtr indicates TK_ALREADY_DEAD. This prevents reinit that creates a
- Tk exit handler after all exit handlers should be called. [Bug 749908,
- 1322294]
+2008-02-27 Daniel Steffen <das@users.sourceforge.net>
-2005-10-10 Vince Darley <vincentdarley@users.sourceforge.net>
+ * macosx/tkMacOSXDraw.c: Workaround leak in Carbon SetPortPenPixPat()
+ API [Bug 1863346]; avoid repeated PixPat allocation/deallocation.
- TIP #256 IMPLEMENTATION
+2008-02-23 Joe English <jenglish@users.sourceforge.net>
- * doc/text.n
- * generic/tkText.c
- * generic/tkText.h
- * generic/tkTextBTree.c
- * generic/tkTextDisp.c
- * generic/tkTextImage.c
- * generic/tkTextIndex.c
- * generic/tkTextMark.c
- * generic/tkTextTag.c
- * generic/tkTextWind.c
- * macosx/tkMacOSXDefault.h
- * tests/text.test
- * tests/textDisp.test
- * unix/tkUnixDefault.h
- * win/tkWinDefault.h: Implementation of TIP#256, adding a new text
- widget configuration option '-tabstyle', with new tests and
+ * library/ttk/combobox.tcl, doc/ttk_combobox.n,
+ * tests/ttk/combobox.test: Arrange to deliver <<ComboboxSelected>>
+ event after listbox is unposted, as intended [Bug 1890211]. Clarified
documentation.
- Also a fix for [Bug 1281228] (documentation and full implementation of
- -strictlimits), and [Bug 1288677] (corrected elide behaviour), again
- with more tests.
-
-2005-10-04 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/dialog.tcl (::tk_dialog): add tkwait visibility before grab.
- [Bug 1216775]
-
- * win/tkWinDialog.c (ChooseDirectoryValidateProc): reset stored path to
- "" if it doesn't exist and -mustexist is true. [Bug 1309218] Remove
- old-style dir chooser (no longer used).
-
- * macosx/tkMacOSXInt.h: add MODULE_SCOPE definition check for extension
- writers that access private headers on OS X and don't define it in
- configure.
-
-2005-09-28 Don Porter <dgp@users.sourceforge.net>
-
- * unix/tkUnixPort.h: Disabled inclusion of the private Tcl header
- * win/tkWinPort.h: file tclInt.h. Tk ought to have a tiny and
- shrinking number of calls of private Tcl routines. Each Tk source file
- doing this should follow the convention in the macosx port and have its
- own #include "tclInt.h".
-
- * generic/tkEvent.c: Disabled calls to private Tcl routine
- TclInExit(). See comment in TkCreateExitHandler() for full rationale.
-
-2005-09-21 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * generic/tkEvent.c (TkCreateThreadExitHandler, TkFinalizeThread)
- (TkDeleteThreadExitHandler): New internal API (from Joe Mistachkin) to
- allow Tk to finalize itself correctly in a multi-threaded
- environment. [Bug 749908]
-
-2005-09-14 Donal K. Fellows <dkf@users.sf.net>
-
- * generic/tkOldConfig.c (GetCachedSpecs): Split out the code to
- manipulate the cached writable specs so that it can be reused from all
- the public Tk_Configure* functions.
- (Tk_ConfigureInfo, Tk_ConfigureWidget, Tk_ConfigureValue): Use the
- factored out code everywhere, so we always manipulate the cache
- correctly. [Bug 1288128]
-
-2005-09-13 Don Porter <dgp@users.sourceforge.net>
-
- * win/winMain.c (WishPanic): Replaced TCL_VARARGS* macros with direct
- use of stdarg.h conventions.
-
-2005-09-11 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): check if
- process is in front on MouseDown, otherwise request process activation
- from BringWindowForward() via new isFrontProcess param.
-
- * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents): register
- our event handler on the dispatcher target for all carbon events of
- interest to TkAqua; this replaces event processing directly from the
- event queue and thus allows to capture events that are syntesized by
- Carbon and sent directly to the dispatcher and not to the event queue.
-
- * macosx/tkMacOSXEvent.c: remove TkMacOSXCountAndProcessMacEvents(),
- rename ReceiveAndProcessEvent() to TkMacOSXReceiveAndProcessEvent().
- (TkMacOSXReceiveAndProcessEvent): remove tk event processing before
- sending events to the dispatcher, all events of interest are now
- processed in our dispatcher target event handler.
-
- * macosx/tkMacOSXNotify.c (CarbonEventsCheckProc): dispatch events
- directly via TkMacOSXReceiveAndProcessEvent(), but dispatch no more
- than four carbon events at one time to avoid starving other event
- sources.
-
- * macosx/tkMacOSXEvent.c: formatting cleanup, move XSync() to XStubs,
- * macosx/tkMacOSXEvent.h: removed obsolete kEventClassWish handling.
- * macosx/tkMacOSXXStubs.c
-
- * macosx/tkMacOSXEvent.h: declare macosx internal procs as MODULE_SCOPE
- * macosx/tkMacOSXEvent.c:
- * macosx/tkMacOSXKeyEvent.c:
- * macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXWindowEvent.c:
-
- * macosx/tkMacOSXButton.c: conditionalize all debug message printing to
- * macosx/tkMacOSXCursor.c: stderr via TK_MAC_DEBUG define.
- * macosx/tkMacOSXDebug.c:
- * macosx/tkMacOSXDebug.h:
- * macosx/tkMacOSXDialog.c:
- * macosx/tkMacOSXEvent.c:
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXKeyEvent.c:
- * macosx/tkMacOSXMenu.c:
- * macosx/tkMacOSXMenubutton.c:
- * macosx/tkMacOSXScale.c:
- * macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXWm.c:
-
- * unix/configure.in: define TK_MAC_DEBUG on aqua when symbols enabled.
- * unix/configure: autoconf-2.59
- * unix/tkConfig.h.in: autoheader-2.59
-
- * library/listbox.tcl: synced aqua MouseWheel bindings with
- * library/scrlbar.tcl: core-8-4-branch.
- * library/text.tcl:
-
- * xlib/xcolors.c: fixed warning
-
-2005-08-25 Daniel Steffen <das@users.sourceforge.net>
-
- * unix/Makefile.in (html): reverted/amended changes of 2005-08-23 that
- broke TkAqua 'make install'; added BUILD_HTML_FLAGS optional var like
- in tcl/unix/Makefile.in.
-
-2005-08-24 Donal K. Fellows <dkf@users.sf.net>
-
- * tests/text.test (text-8.18): Fix punctuation of error message to
- match good practice (actual message already fixed). [Bug 1267484]
-
-2005-08-23 Jeff Hobbs <jeffh@ActiveState.com>
-
- * macosx/tkMacOSXDialog.c: make dialogs ignore -initialfile "" and
- -initialdir "" instead of error.
-
-2005-08-23 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/tkWin32Dll.c (DllMain): Replace old asm SEH approach with Kenny's
- new SEH implementation. [Tcl Bug 1235544]
-
-2005-08-23 Mo DeJong <mdejong@users.sourceforge.net>
-
- * unix/Makefile.in: Subst BUILD_TCLSH and TCL_EXE.
- * unix/configure: Regen.
- * unix/configure.in: Update minimum autoconf version to 2.59. Invoke
- SC_PROG_TCLSH and SC_BUILD_TCLSH.
- * unix/tcl.m4 (SC_PROG_TCLSH, SC_BUILD_TCLSH):
- * win/Makefile.in: Subst BUILD_TCLSH and TCL_EXE.
- * win/configure: Regen.
- * win/configure.in: Update minimum autoconf version to 2.59. Invoke
- SC_BUILD_TCLSH.
- * win/tcl.m4 (SC_PROG_TCLSH, SC_BUILD_TCLSH): Split confused search
- for tclsh on PATH and build and install locations into two macros.
- SC_PROG_TCLSH searches just the PATH. SC_BUILD_TCLSH determines the
- name of the tclsh executable in the Tcl build directory. [Tcl Bug
- 1160114] [Tcl Patch 1244153]
-
-2005-08-22 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXButton.c:
- * macosx/tkMacOSXDialog.c: fix warnings.
-
-2005-08-20 Joe Mistachkin <joe@mistachkin.com>
-
- * win/tkWinX.c: Fixed bad cast. [Bug 1216006]
-
-2005-08-18 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * doc/GetFont.3: Reworded to reflect the truth. [Bug 1151523]
-
-2005-08-16 George Peter Staplin <GeorgePS@XMission.com>
-
- * doc/CrtItemType.3 prototypes were lacking [] after objv. Thus the man
- page was wrong about the actual prototypes. This was verified by
- studying tkCanvBmap.c.
-
-2005-08-13 Chengye Mao <chengye.geo@yahoo.com>
-
- * generic/tkOldConfig.c: Fixed [Bug 1258604]. This bug was introduced
- into the modfied Tk_ConfigureWidget. It failed to properly handle the
- specFlags' bit TK_CONFIG_OPTION_SPECIFIED.
-
-2005-08-12 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * generic/tkOldConfig.c (Tk_ConfigureWidget): Stop storing per-thread
- data in global data structures. Store it in per-interpreter data (i.e.
- per-thread data) instead. [Bug 749908]
-
-2005-08-10 Donal K. Fellows <dkf@users.sf.net>
-
- * generic/tkFrame.c (CreateFrame) and others: Don't use size_t when
- working with Tcl_GetStringFromObj because it is not 64-bit clean. [Bug
- 1252702]
-
-2005-08-04 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * doc/text.n: Clarify behaviour of tab stops (as per [Bug 1247835])
-
-2005-08-09 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXCarbonEvents.c (AppEventHandlerProc): handle carbon
- events sent directly to application event target via the general
- TkMacOSXProcessEvent() in the same way as events posted to the event
- loop. Moved existing app event handlers to tkMacOSXWindowEvent.c.
- (TkMacOSXInitCarbonEvents): register our application event handler for
- kEventWindowExpanded events to deal with uncollapsing from the dock.
-
- * macosx/tkMacOSXEvent.h: made TkMacOSXProcessEvent() non-static, added
- * macosx/tkMacOSXEvent.c: new interp field to TkMacOSXEvent struct for
- use by app event handler.
-
- * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): retrieve
- current window, partCode, modifiers and local cursor position from
- carbon mouse event if possible. Use new static GenerateButtonEvent()
- taking a MouseEventData struct instead of TkGenerateButtonEvent() to
- avoid recomputing already known values. Move process activation on
- MouseDown into BringWindowForward() to allow clicking on window
- titlebar widgets without activating process. Move code dealing with
- clicks in window titelbar into separate function
- HandleWindowTitlebarMouseDown() to avoid code duplication. Avoid
- repeated calls to TkMacOSXGetXWindow() by storing result in
- MouseEventData struct.
- (TkMacOSXButtonKeyState, XQueryPointer): try to get button and modifier
- state from currently processed carbon event (to avoid unnecessary IPC
- with the window server), otherwise use modern carbon API to get this
- info instead of Button() and GetKeys(); only retrieve info caller asks
- for (via non-NULL ptr passed to XQueryPointer).
- (ButtonModifiers2State): new static function converting carbon button
- and modifier state into tk state, allows detection of more than 3 mouse
- buttons (tk supports up to 5) and of NumLock and Fn modifier keys
- (NumLock is mapped to Mod3 and Fn to Mod4).
-
- * macosx/tkMacOSXWindowEvent.c (TkMacOSXProcessApplicationEvent):
- handle kEventWindowExpanded event to deal with window uncollapsing from
- the dock by generating tk Map event, handle kEventAppHidden and
- kEventAppShown events (moved here from tkMacOSXCarbonEvents.c).
-
- * macosx/tkMacOSXSubwindows.c (XUnmapWindow): only hide window when it
- is not iconified to avoid window flashing on collapse.
-
- * macosx/tkMacOSXWm.c: replaced Tk_DoWhenIdle() by Tcl_DoWhenIdle().
- (TkMacOSXZoomToplevel): remove call to TrackBox(), now done in
- HandleWindowTitlebarMouseDown() in tkMacOSXMouseEvent.c.
- (TkpWmSetState): avoid window flashing on collapse by unmapping after
- calling CollapseWindow(); only uncollapse window if it is collapsed.
-
- * generic/tkInt.decls: changed TkMacOSXZoomToplevel() signature.
- * generic/tkIntPlatDecls.h:
-
- * macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): only call
- GetMenuItemCommandID() on KeyDown or KeyRepeat events.
-
- * macosx/tkMacOSXMenu.c (ReconfigureMacintoshMenu): remove call to
- obsolete AppendResMenu() API.
-
- * macosx/tkMacOSXKeyEvent.c: replaced all direct uses of expensive
- * macosx/tkMacOSXMenu.c: GetMouse() and TkMacOSXButtonKeyState()
- * macosx/tkMacOSXMenus.c: APIs by calls to XQueryPointer()
- * macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXScale.c:
- * macosx/tkMacOSXScrlbr.c:
- * macosx/tkMacOSXWm.c:
-
- * macosx/tkMacOSXDialog.c: replaced use of FrontNonFloatingWindow()
- * macosx/tkMacOSXKeyEvent.c: by ActiveNonFloatingWindow() as
- * macosx/tkMacOSXMenu.c: recommended by Carbon docs.
- * macosx/tkMacOSXMenus.c:
- * macosx/tkMacOSXSubwindows.c:
- * macosx/tkMacOSXWm.c:
-
- * macosx/tkMacOSXDialog.c: fixed warnings
- * macosx/tkMacOSXTest.c:
-
- * macosx/tkMacOSXCarbonEvents.c: added CVS Id line to file header.
- * macosx/tkMacOSXDebug.c:
- * macosx/tkMacOSXDebug.h:
- * macosx/tkMacOSXEntry.c:
- * macosx/tkMacOSXEvent.h:
- * macosx/tkMacOSXKeyEvent.c:
- * macosx/tkMacOSXMouseEvent.c:
- * macosx/tkMacOSXWindowEvent.c:
- * macosx/tkMacOSXWm.h:
-
- * macosx/tkMacOSXInt.h: declare macosx internal procs as MODULE_SCOPE.
- * macosx/tkMacOSXCarbonEvents.c:
- * macosx/tkMacOSXDraw.c:
- * macosx/tkMacOSXFont.c:
- * macosx/tkMacOSXHLEvents.c:
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXWindowEvent.c
-
- * library/bgerror.tcl: sync with core-8-4-branch changes of 2005-07-28.
- * macosx/tkMacOSXDraw.c:
- * macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXMouseEvent.c:
-
- * generic/tkFrame.c: sync with core-8-4-branch changes of 2005-07-27.
- * generic/tkIntDecls.h:
- * generic/tkStubInit.c:
- * generic/tkFrame.c:
- * win/tkWinDraw.c:
- * unix/tkUnixDraw.c:
- * macosx/tkMacOSXDraw.c:
- * macosx/tkMacOSXInt.h:
- * macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXSubwindows.c:
-
- * macosx/tkMacOSXButton.c: sync with core-8-4-branch.
- * macosx/tkMacOSXEntry.c:
- * macosx/tkMacOSXScale.c:
-
- * library/demos/menu.tcl: removed errant '}'.
-
-2005-08-04 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * doc/clipboard.n: Add example demonstrating custom types of clipboard
- data.
-
-2005-07-25 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * library/*.tcl: Updated to use more 8.4 and 8.5 features as part of
- resolving [Patch 1237759].
-
-2005-07-22 Mo DeJong <mdejong@users.sourceforge.net>
-
- * win/tkWinX.c: Define _WIN32_WINNT with NT SP 3 data to fix compiler
- error because SendInput was not defined. The new msys_mingw7 release is
- now needed to compile the HEAD with mingw gcc. [Bug 1210712]
-
-2005-07-21 Jeff Hobbs <jeffh@ActiveState.com>
-
- * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): corrected if
- expression error (use of = instead of ==).
-
-2005-07-18 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * generic/tkTextMark.c: fix to segfault in "mark prev"
- * tests/textIndex.test: [Bug 1240221]
-
- * tests/textWind.test: make test more robust to avoid infinite loop
-
-2005-07-06 Jeff Hobbs <jeffh@ActiveState.com>
-
- * doc/getOpenFile.n: correct -multiple docs (takes boolean)
-
-2005-07-05 Don Porter <dgp@users.sourceforge.net>
-
- * unix/Makefile.in: Purged use of TCLTESTARGS. [RFE 1161550]
-
-2005-06-23 Daniel Steffen <das@users.sourceforge.net>
-
- * generic/tkConsole.c (TkConsolePrint): prevent potential NULL deref.
-
- * macosx/tkMacOSXDefault.h: change ENTRY_BORDER defaults to from 5 to 2
- to make default entry widgets in TkAqua look like in other aqua apps
- (and have same border dimensions as other platforms). [Bug 1176610]
-
-2005-06-21 Donal K. Fellows <dkf@users.sf.net>
-
- * doc/GetBitmap.3: Fix silly error in SYNOPSIS. [Bug 1224983]
-
-2005-06-19 Donal K. Fellows <dkf@users.sf.net>
-
- * generic/tkImgGIF.c: Cleanse all static (i.e. non-thread-safe) data
- at a miniscule performance hit.
-
-2005-06-18 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Makefile: for X11 build, add -X11 suffix to unversioned wish
- symbolic link.
-
- * unix/tcl.m4 (Darwin): add -headerpad_max_install_names to LDFLAGS to
- ensure we can always relocate binaries with install_name_tool.
-
- * unix/configure: autoconf-2.59
-
-2005-06-07 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- Bump patchlevel to a4 to distinguish from a3 release.
-
-2005-06-04 Jeff Hobbs <jeffh@ActiveState.com>
-
- *** 8.5a3 TAGGED FOR RELEASE ***
-
-2005-06-02 Jim Ingham <jingham@apple.com>
-
- * generic/tkEvent.c (InvokeFocusHandlers): On Mac OS X the scrollwheel
- events are sent to the window under the mouse, not to the focus window
-
- Another patch from M. Kirkham.
-
- * macosx/tkMacOSXScrlbr.c (ThumbActionProc, ScrollBarBindProc): Record
- the first mouse down point, and compute differences from that, rather
- than getting the mouse down each time through the loop. The old method
- would get fooled if you moved the mouse less than a text line height in
- the text widget. [Bug 1083728]
-
-2005-06-03 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/Makefile: fixed 'embedded' target.
-
-2005-06-02 Reinhard Max <max@suse.de>
-
- * unix/tkUnix.c (Tk_GetUserInactiveTime): Improvements to get it
- working on Solaris, and panic if we run out of memory.
- * unix/configure.in: Rework the searching for Xss, to make it work on
- Solaris and provide more useful output. Use AC_HELP_STRING where
- appropriate.
- * unix/tcl.m4: synced from Tcl.
- * unix/configure: regenerated with autoconf 2.59.
-
-2005-06-01 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinInt.h: added private decls of Tk_GetEmbeddedMenuHWND,
- Tk_GetMenuHWND, TkWinCleanupContainerList, and TkpWmGetState to that
- are used across source files.
-
- * win/tkWinX.c (Tk_ResetUserInactiveTime): cast to squelch compiler
- warning.
-
-2005-05-31 Reinhard Max <max@suse.de>
-
- * doc/Inactive.3 (new file): C level API documentationn for
- TIP#245 (Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime).
- * tests/tk.test: Added tests for the TIP#245 implementation.
-
-2005-05-30 Jeff Hobbs <jeffh@ActiveState.com>
-
- * generic/tkPanedWindow.c, tests/panedwindow.test: batch of fixes to
- panedwindow from Daniel South. Improved auto-size to fit internal
- windows, fixed sash placement at edge of pane, fixed calculation of
- stretch amount for internal windows. [Bug 1124198, 1161543, 1054117,
- 1010941, 795869, 690169, 1192323]
-
- * generic/tkMenu.c (MenuCmd): create event handler earlier to ensure
- proper destruction of menu through DestroyNotify. [Bug 1159367]
-
- * library/console.tcl (::tk::ConsoleInit): print out first prompt and
- swallow the extra "% " that comes once from Tcl on Windows.
-
-2005-05-29 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXFont.c: use Tcl_Panic instead of panic.
-
- * unix/configure.in: added description of HAVE_XSS for autoheader.
- * unix/configure: autoconf-2.59
- * unix/tkConfig.h.in: autoheader-2.59
-
- * macosx/Wish.pbproj/project.pbxproj:
- * macosx/Wish.xcode/project.pbxproj: added missing FRAMEWORK defines
- introduced with configure/make based build.
-
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXNotify.c: fixed warnings.
-
- * generic/tkDecls.h:
- * generic/tkIntPlatDecls.h:
- * generic/tkPlatDecls.h:
- * generic/tkStubInit.c: ran missing 'make genstubs' for TIP245 changes
- to tk.decls
-
- * macosx/tkMacOSXXStubs.c (Tk_ResetUserInactiveTime): use symbolic
- constant argument in call to UpdateSystemActivity();
-
- * macosx/Wish.pbproj/project.pbxproj:
- * macosx/Wish.xcode/project.pbxproj:
- * unix/configure.in: added/corrected linking to IOKit.framework for
- TIP245.
-
- * unix/configure.in: skip X11 configure checks when building tk_aqua.
- * unix/configure: autoconf-2.59
-
-2005-05-28 Donal K. Fellows <dkf@users.sf.net>
-
- TIP #245 IMPLEMENTATION from Reinhard Max <max@suse.de>
-
- * doc/tk.n: Documentation of [tk inactivity].
- * win/tkWinX.c (Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime):
- * unix/tkUnix.c (Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime):
- * macosx/tkMacOSXXStubs.c: Implementations of the core API for
- (Tk_GetUserInactiveTime): determining how long as user's left
- (Tk_ResetUserInactiveTime): her machine alone.
- * unix/configure.in: Test for XScreenSaver support.
- * generic/tkCmds.c (Tk_TkObjCmd): Implementation of [tk inactivity].
-
-2005-05-27 Todd Helfter <tmh@users.sourceforge.net>
-
- * library/menu.tcl: correct the sticky behavior of menus posted by
- tk_popup so that they "stick" after the initial <ButtonRelease>
- following the post, that is not over an active menu entry.
-
-2005-05-26 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXInit.c (TkpInit): fixed resource file extraction from
- __tk_rsrc section to work with non-prebound .dylib and .bundle.
-
- * macosx/Makefile: corrected EMBEDDED_BUILD check, use separate Tcl and
- Tk version vars to properly support tk/x11 framework version
- overriding, rewrite tkConfig.sh when overriding tk version, corrected
- Wish.app symlink in tk build dir.
+2008-02-23 Joe English <jenglish@users.sourceforge.net>
- * unix/configure.in: corrected framework finalization to softlink stub
- library to Versions/8.x subdir instead of Versions/Current.
- * unix/configure: autoconf-2.59
+ * generic/ttk/ttkPanedWindow.c: [FRQ 1898288]: Don't enforce minimum
+ sash thickness of 5 pixels, just use 5 as a default.
-2005-05-25 Jeff Hobbs <jeffh@ActiveState.com>
+2008-02-14 Donal K. Fellows <donal.k.fellows@man.ac.uk>
- * unix/Makefile.in (install-libraries): protect possible empty list in
- for with list= trick for older shells.
+ * unix/README: Documented missing configure flags.
-2005-05-23 Jeff Hobbs <jeffh@ActiveState.com>
+2008-02-06 Donal K. Fellows <donal.k.fellows@man.ac.uk>
- * generic/tkFileFilter.c (FreeGlobPatterns): s/null/NULL/
+ * doc/ttk_scale.n (new file): [Bug 1881925]: Added basic documentation
-2005-05-24 Daniel Steffen <das@users.sourceforge.net>
+2008-02-04 Don Porter <dgp@users.sourceforge.net>
- * generic/tkTest.c: disable commands not available on TkAqua.
+ *** 8.5.1 TAGGED FOR RELEASE ***
- * macosx/Makefile:
- * macosx/README:
- * macosx/Tk-Info.plist.in (new file):
- * macosx/Wish-Info.plist.in (new file):
- * unix/Makefile.in:
+ * generic/tk.h: Bump to 8.5.1 for release.
+ * library/tk.tcl:
* unix/configure.in:
- * unix/tcl.m4:
- * unix/tkUnixInit.c: moved all Darwin framework and TkAqua build
- support from macosx/Wish.pbproj and macosx/Makefile into the standard
- unix configure/make buildsystem, the project and macosx/Makefile are no
- longer required to build Tk.framework and/or TkAqua. TkAqua is now
- enabled by the --enable-aqua configure option, and static and
- non-framework builds of TkAqua are now available via the standard
- configure switches. Tk/X11 can also be built as a framework. The
- macosx/Makefile now wraps the unix buildsystem and no longer uses the
- projects, embedded builds are still only available via this Makefile,
- but for other builds it is not longer required (but its current
- functionality is still available for backwards compatibility). The
- projects currently do not call through to the Makefile to build (unlike
- Tcl.pbproj) so project builds may differ from makefile builds. Due to
- issues with spaces in pathnames, 'Wish Shell.app' has been renamed to
- 'Wish.app', the macosx/Makefile installs backwards compatibility
- symlinks for the old name.
- * macosx/tkMacOSXInit.c (TkpInit): added support for Tk resource file
- in non-framework and static builds: the resource file is copied into a
- __tk_rsrc MachO section of the library or executable at link time and
- extracted into a temporary location at initialization.
- * unix/configure: autoconf-2.59
- * unix/tkConfig.h.in (new file): autoheader-2.59
-
- * macosx/Wish.pbproj/project.pbxproj:
- * macosx/Tk-Info.plist:
- * macosx/Wish-Info.plist:
- * macosx/tkAboutDlg.r: updated copyright years to 2005.
-
-2005-05-22 Donal K. Fellows <dkf@users.sf.net>
-
- * generic/tkFileFilter.c (TkGetFileFilters): Add all filters, not just
- the first one. [Bug 1206133]
-
-2005-05-15 Jim Ingham <jingham@apple.com>
-
- Fixes from Michael Kirkham:
-
- * macosx/tkMacOSXMenu.c (TkpConfigureMenuEntry): Thinko in clearing the
- ENTRY_ACCEL_MASK before re-parsing it. [Bug 1012852]
-
- * macosx/tkMacOSXScrlbr.c (UpdateControlValues): Don't set the control
- value BEFORE setting the min and max or the control manager will reset
- it for you. [Bug 1202181]
-
- * macosx/tkMacOSXXStubs.c (TkMacOSXXGetPixel, TkMacOSXXPutPixel):
- Restore the port to what it was before putting we were called. [Bug
- 1202223]
-
-2005-05-14 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXScrlbr.c (ThumbActionProc): Missing Tcl_Release.
-
-2005-05-14 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXNotify.c: introduction of new tcl notifier based on
- CFRunLoop allows replacement of the custom TkAqua notifier by a
- standard tcl event source. Removes requirement of threaded tcl core
- for TkAqua, allows to stub-link TkAqua against Tcl by removing use of
- the unstubbed TclInitNotifier & TclFinalizeNotifier. [Tcl Patch
- 1202052]
-
- * macosx/Wish.xcode/project.pbxproj:
- * macosx/Wish.pbproj/project.pbxproj: stub-link TkAqua: build with
- USE_TCL_STUBS and link against libtclstub instead of Tcl.framework,
- unexport libtclstub symbols from Tk to avoid duplicate symbol warnings
- when linking with both Tcl and Tk, fixes for gcc4.0 warnings.
-
- * macosx/Wish.xcode/project.pbxproj: sync with Wish.pbproj changes
- since 2004-11-19.
- NOTE: to use this project, need to uncomment the tclConfig.h settings
- at the top of tcl/unix/configure.in, autoconf and rebuild tcl !
-
- * macosx/tkMacOSXBitmap.c:
- * macosx/tkMacOSXButton.c:
- * macosx/tkMacOSXDialog.c:
- * macosx/tkMacOSXFont.c:
- * macosx/tkMacOSXHLEvents.c:
- * macosx/tkMacOSXInit.c:
- * macosx/tkMacOSXKeyboard.c:
- * macosx/tkMacOSXMenu.c:
- * macosx/tkMacOSXMenubutton.c:
- * macosx/tkMacOSXWm.c:
- * macosx/tkMacOSXXStubs.c: fixed gcc 4.0 warnings.
-
- * unix/tcl.m4: sync with tcl
- * unix/configure: autoconf-2.59
-
-2005-05-10 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * library/text.tcl: test and fix to TextPrevPara to avoid infinite loop
- * tests/textIndex.test: at start of widget. [Bug 1191895]
-
- * generic/tkTextDisp.c: better synchronisation between explicit and
- implicit pixel line-height calculations. [Bug 1186558]
-
-2005-05-10 Don Porter <dgp@users.sourceforge.net>
-
- * generic/tkTextDisp.c (GetXView): Improved numerical precision of
- calculation of [.t xview] return values.
- * tests/textDisp.test: Match greater precisions of [.t xview] and
- [.t yview] values in tests.
-
-2005-05-06 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/configure: regen
- * unix/configure.in: Add AC_C_BIGENDIAN check and pkg-config xft checks
- to extend xft search.
- * unix/tcl.m4: Correct Solaris 10 (5.10) check and add support for
- x86_64 Solaris cc builds.
-
-2005-04-28 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * macosx/tkMacOSXNotify.c (TkMacOSXWaitForEvent): Fix for typo in
- waitTime computation. [Bug 1191097]
- (AlertNotifier): Factor out the core of the notifier alerting code.
-
-2005-04-25 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXNotify.c: sync with tclUnixNotfy.c changes since
- 2004-06-22, added compile time check for threaded tcl core, removed
- unthreaded code paths as they are never used anyway, fixed
- TkMacOSXAlertNotifier() implementation.
-
- * unix/Makefile.in: added TCL_STUB_LIB_FILE, needed for unexporting of
- symbols from libtclstub to avoid duplicate symbol warnings.
-
- * unix/tcl.m4 (Darwin): added configure checks for recently added
- linker flags -single_module and -search_paths_first to allow building
- with older tools (and on Mac OS X 10.1), use -single_module in SHLIB_LD
- and not just T{CL,K}_SHLIB_LD_EXTRAS, added unexporting from Tk of
- symbols from libtclstub to avoid duplicate symbol warnings, added
- PLAT_SRCS definition for Mac OS X, defined MODULE_SCOPE to
- __private_extern__.
- (SC_MISSING_POSIX_HEADERS): added caching of dirent.h check.
-
- * unix/configure: autoconf-2.59
-
-2005-04-22 George Peter Staplin <GeorgePS@XMission.com>
-
- * doc/FontId.3: I fixed a typo. "linespace" was used instead of
- "ascent". I also added a .PP before the paragraph to make the
- formatting look better for the ascent paragraph.
-
-2003-04-18 Joe English <jenglish@users.sourceforge.net>
-
- * unix/tkUnixRFont.c(Tk_MeasureChars): Use Tcl_UtfToUnichar() for lax
- UTF-8 parsing instead of strict parsing with FcUtf8ToUcs4()
- [fix/workaround for Bug 1185640]
-
-2003-04-18 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * library/text.tcl
- * doc/text.n: corrected 'Home' and 'End' and Control-a/e handling to
- work with display lines. This was an ommission of the previous tip155
- patch. Clarified the documentation on this point.
-
-2005-04-14 Jeff Hobbs <jeffh@ActiveState.com>
-
- * unix/tkUnixFont.c (FontMapLoadPage): reorder char[] decls to avoid
- possible segv. Minimal fix for [Bug 1122671]
-
-2005-04-12 Jeff Hobbs <jeffh@ActiveState.com>
-
- * library/tkfbox.tcl (::tk::dialog::file::): fix typeMenuLab ref. Add
- undoc'd ::tk::dialog::file::showHiddenBtn var (default 0) that will add
- a "Show Hidden" checkbutton to tk_get*File and tk_chooseDirectory if
- set to true.
- * library/choosedir.tcl (::tk::dialog::file::chooseDir::): fix
- cancelBtn ref, add hiddenBtn ref for "Show Hidden" button.
-
-2005-04-09 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/README: updated requirements for OS & developer tool versions
- + other small fixes/cleanup.
-
- * macosx/tkMacOSXEntry.c (ComputeIncDecParameters): manually define
- constants present only in 10.3 headers so that we can build on 10.2.
-
- * macosx/Wish.pbproj/project.pbxproj: fixed absolute path to tkEntry.h
- that confused 10.2 PBX.
-
- * unix/tcl.m4 (Darwin): added -single_module linker flag to
- TCL_SHLIB_LD_EXTRAS and TK_SHLIB_LD_EXTRAS.
- * unix/configure: autoconf-2.59
-
-2005-04-07 Mo DeJong <mdejong@users.sourceforge.net>
-
- * macosx/tkMacOSXWm.c (TkWmStackorderToplevelWrapperMap,
- (TkWmStackorderToplevel):
- * unix/tkUnixWm.c (TkWmStackorderToplevelWrapperMap,
- (TkWmStackorderToplevel):
- * win/tkWinWm.c (TkWmStackorderToplevelWrapperMap,
- (TkWmStackorderToplevel):
- Fix panic in wm stackorder when a toplevel is created on another
- display. The code now ignores toplevels that have a display that does
- not match the display of the parent window. [Bug 1152809]
-
-2005-04-06 Donal K. Fellows <dkf@users.sf.net>
-
- * doc/wm.n, doc/winfo.n, doc/tk.n, doc/send.n, doc/selection.n:
- * doc/radiobutton.n, doc/photo.n, doc/options.n, doc/menu.n:
- * doc/listbox.n, doc/getOpenFile.n, doc/font.n, doc/event.n:
- * doc/entry.n, doc/clipboard.n, doc/checkbutton.n, doc/canvas.n:
- * doc/button.n, doc/bind.n, doc/TextLayout.3, doc/MeasureChar.3:
- * doc/GetRelief.3, doc/GetPixels.3, doc/GetJustify.3, doc/GetFont.3:
- * doc/GetCursor.3, doc/GetColor.3, doc/GetBitmap.3, doc/GetAnchor.3:
- * doc/FontId.3, doc/CrtWindow.3, doc/CrtImgType.3, doc/ConfigWidg.3:
- * doc/3DBorder.3: Purge old .VS/.VE macro instances.
-
-2005-04-04 Don Porter <dgp@users.sourceforge.net>
-
- * library/comdlg.tcl: Added Macintosh file type validation to
- [::tk::FDGetFileTypes]. [Bug 1083878] (Thanks, Vince Darley)
-
-2005-04-04 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * generic/tkText.c:
- * tests/text.test: fix to elide searching problems [Bug 1174269] and
- disappearing cursor with insertofftime 0. [Bug 1169429]
-
-2005-04-03 Peter Spjuth <peter.spjuth@space.se>
-
- * tests/grid.test:
- * generic/tkGrid.c: Fixed bug in geometry calculations for widgets that
- span multiple columns/row. Bug was introduced in 8.5a1 when fixing
- 792387. [Bug 1175092]
-
-2005-03-29 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tcl.m4, win/configure: do not require cygpath in macros to allow
- msys alone as an alternative.
-
-2005-03-27 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * tests/textDisp.test: added test for fix of 2005-03-15.
-
-2005-03-24 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXEntry.c (TkpDrawEntryBorderAndFocus): Dopey bug - do
- not reset the width for entry widgets - we didn't change it for them.
-
-2005-03-23 Jim Ingham <jingham@apple.com>
-
- These changes allow us to draw the Entry and Spinbox widget with a
- native look and feel on Mac OS X.
-
- * generic/tkEntry.h: New file, extracting the definitions of Entry and
- Spinbox.
- * generic/tkEntry.c (DisplayEntry): Call out to TkpDrawSpinboxButtons
- and TkpDrawEntryBorderAndFocus. Also provide default implementations
- for X11 & Win.
- * macosx/tkMacOSXEntry.c: New file, implements the entry & focus and
- spinbox button drawing.
- * tkMacOSXDefaults.h: Change the Mac OS X defaults so they fit the
- native widget shapes.
-
- This is cleanup thanks to Neil Madden <nem@cs.nott.ac.uk>.
-
- * macosx/tkMacOSXWm.c (TkMacOSXWinStyle) New function.
- (TkUnsupported1ObjCmd): New function, replaces the un-objectified
- version of the command.
- * generic/tkInt.h: Swap TkUnsupported1Cmd for TkUnsupported1ObjCmd.
- * generic/tkWindow.c (): Ditto.
-
- This adds a "-notify" flag to "wm attributes" that will bounce the
- dock icon on Mac OS X. This is from Revar Desmera <revarbat@gmail.com>
-
- * macosx/tkMacOSXWm.c (WmAttrGetNotifyStatus, WmAttrSetNotifyStatus):
- New functions.
- (WmAttributesCmd): Add the -notify.
- * doc/wm.n: Document -notify.
-
-2005-03-19 Donal K. Fellows <dkf@users.sf.net>
-
- * generic/tkConsole.c (Tk_CreateConsoleWindow,TkConsolePrint): Rewrite
- so that TkConsolePrint cannot become detached from the console when the
- [console] command is renamed. [Bug 1016385]
-
-2005-03-15 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * generic/tkTextDisp.c: fix for [Bug 1143776] in adjusting displayed
- lines when running into the bottom of the window.
-
-2005-03-14 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXScrlbr.c (ThumbActionProc): No need to use "update
- idletasks" here, TclServiceIdle will do as well and it is simpler.
-
- These changes implement a change on the Mac OS X side. When we unmap a
- window we mark all its children as unmapped (not following toplevels.
- But we preserve whether they had been mapped before, and when the
- parent is remapped, we remap the children as well. [Bug 940117]
-
- * macosx/tkMacOSXInt.h: Added TK_MAPPED_IN_PARENT
- * macosx/tkMacOSXSubwindows.c (FixMappingFlags): New function.
- (XMapWindow): Call FixMappingFlags.
- (XUnMapWindow): Ditto.
-
- * macosx/tkMacOSXSubwindows.c (XMoveResizeWindow): Update the xOff &
- yOff data in the Macdrawable even if the native window hasn't been
- created yet. [Bug 700305]
- (XMoveWindow): Ditto.
- (XResizeWindow): Ditto.
-
-2005-03-15 Pat Thoyts <patthoyts@users.sourceforge.net>
-
- * unix/tcl.m4: Updated the OpenBSD configuration and regenerated the
- * unix/configure: configure script.
-
-2005-03-14 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
-
- * generic/tkEvent.c (InvokeClientMessageHandlers): Ensure that client
- messages are handled correctly. Thanks to George Petasis for tracking
- this down. [Bug 1162356]
-
-2005-03-11 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXButton.c (TkpDisplayButton): Set the port to the
- Button window's port BEFORE you set the clip, otherwise you are setting
- the clip on the wrong window!
- Also, a little cleanup - move x & y into the branches where they are
- used, and don't compute the TextAnchor if we are using the native
- button text, since we aren't going to use it.
- (TkMacOSXDrawControl): Call ShowControl & SetControlVisibility in a
- more logical order.
-
- * tkMacOSXInt.h: Add TkMacOSXGenerateFocusEvent.
- * tkMacOSXSubwindows.c (XDestroyWindow): We don't get Activate events
- for the remaining windows when a Floating window is destroyed. This can
- cause the focus to disappear. So catch this case when the window is
- being destroyed and move the focus here.
-
- * tkMacOSXWindowEvent.c (TkMacOSXGenerateFocusEvent): Make this public
- (used to be GenerateFocusEvent) since we need it here and in
- tkMacOSXSubwindows.c. Then change the name everywhere it is used. [Bug
- 1124237]
-
-2005-03-10 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): In the
- inDrag section, set the GrafPort to the drag window's GrafPort before
- doing LocalToGlobal. [Bug 1160025]
-
-2005-03-09 Jim Ingham <jingham@apple.com>
-
- * macosx/tkMacOSXInit.c (TkpInit): Check to see if the environment
- variable XCNOSTDIN is set, and if so, close stdin & stdout. This is
- necessary to make remote debugging under Xcode work properly.
-
-2005-03-08 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinWm.c (WinSetIcon): fix GCLP_ICONSM -> GCLP_HICONSM.
-
- * win/makefile.vc: clarify necessary defined vars that can come from
- MSVC or the Platform SDK.
-
-2005-02-28 Jeff Hobbs <jeffh@ActiveState.com>
-
- * win/tkWinX.c (GenerateXEvent): correct %A translation on MouseWheel.
- [Bug 1118340]
-
-2005-02-24 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSX.h: fixed incorrect inclusion of internal header.
- * macosx/tkMacOSXNotify.c: corrected included headers.
-
-2005-02-22 Daniel Steffen <das@users.sourceforge.net>
-
- * macosx/tkMacOSXDialog.c (Tk_GetSaveFileObjCmd, NavServicesGetFile):
- fixed encoding problems with -initialfile & -filetypes and corrected
- potential buffer overrun with -initialdir/-initialfile. [Bug 1146057]
-
-2005-02-16 Mo DeJong <mdejong@users.sourceforge.net>
-
- TIP#223 IMPLEMENTATION
-
- * doc/wm.n: Add documentation for -fullscreen attribute.
- * tests/winWm.test: Add -fullscreen to wm attribute usage message.
- * tests/wm.test: Add -fullscreen to wm attribute usage message. Add
- -fullscreen attribute test cases for Windows.
- * win/tkWinWm.c (WmInfo, UpdateWrapper, TkpWmSetFullScreen)
- (WmAttributesCmd, UpdateGeometryInfo):
- Implement TIP 223 [wm attributes -fullscreen].
-
-2005-02-14 Vince Darley <vincentdarley@users.sourceforge.net>
-
- * generic/tkText.c:
- * generic/tkText.h:
- * generic/tkTextDisp.c:
- * generic/tkTextIndex.c:
- * generic/tkTextBTree.c:
- * doc/text.n:
- * tests/textDisp.test:
- * tests/textIndex.test: fix of longstanding elide problem when eliding
- a newline without eliding the entire logical line. [Bug 443848]
-
-2005-02-14 Jeff Hobbs <jeffh@ActiveState.com>
-
- * doc/options.n: note -cursor {} behavior. [Bug 965618]
-
-2005-02-14 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * unix/tk.spec:
+ * win/configure.in:
- * tests/all.tcl: Add a [package require Tk] so that a missing display
- causes an early failure and keeps the error trace short. Issue observed
- in [FRQ 11122147], even though that's unrelated.
+ * unix/configure: autoconf-2.59
+ * win/configure:
-2005-02-11 Jeff Hobbs <jeffh@ActiveState.com>
+2008-02-04 Donal K. Fellows <donal.k.fellows@man.ac.uk>
- * library/panedwindow.tcl (::tk::panedwindow::Cursor): check window
- existence on delayed call. [Bug 949792]
+ * doc/MeasureChar.3, doc/FontId.3: Minor improvements (formatting,
+ keywords).
- * doc/text.n: note 'image' key in 'dump' command. [Bug 1115907]
+2008-02-02 Daniel Steffen <das@users.sourceforge.net>
- * win/tkWinWm.c (TkWinGetIcon): fix toplevel retrieval for determining
- icon ref (potential crash). [Bug 1105738]
+ * macosx/Wish-Info.plist.in: Add CFBundleLocalizations key, listing
+ * unix/configure.in (Darwin): all library/msgs locales.
- * generic/tkCanvBmap.c (ConfigureBitmap, ComputeBitmapBbox): Fixed
- possible crash with disabled bmap and bbox handling [Bug 1119460]
- (BitmapToPostscript): made aware of various bitmap types
+ * unix/configure.in (Darwin): Correct Info.plist year substitution
+ in non-framework builds.
- * unix/Makefile.in: remove SHLIB_LD_FLAGS (only for AIX, inlined into
- * unix/tcl.m4: SHLIB_LD). Combine AIX-* and AIX-5 branches in
- * unix/configure: SC_CONFIG_CFLAGS. Correct gcc builds for AIX-4+ and
- HP-UX-11. autoconf-2.59 gen'd.
+ * unix/configure: autoconf-2.59
-2005-02-09 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+2008-02-01 Don Porter <dgp@users.sourceforge.net>
- * tests/wm.test: Convert to use more tcltest2 features.
+ * changes: Updates for 8.5.1 release.
-2005-02-07 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+2008-02-01 Reinhard Max <max@suse.de>
- * generic/tkCanvas.c (CanvasWidgetCmd): Fix stupid mistake in variable
- names, reported by Andreas Leitgeb.
+ * generic/tkImgGIF.c: Fixed a buffer overflow (CVE-2008-0553).
+ * tests/imgPhoto.test: Added a test for the above.
-2005-02-03 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+2008-01-31 Jeff Hobbs <jeffh@ActiveState.com>
- * generic/tkCanvas.c (GetStaticUids): New function to manage the
- thread-specific data detailing the list of all uids in a thread.
- (typeList): Protect this (the other piece of global data) with a mutex.
- [Bug 1114977]
+ * library/msgbox.tcl (::tk::MessageBox): Don't use ttk::label in low
+ depth/aqua fallback, as it doesn't support -bitmap.
-2005-01-31 Jeff Hobbs <jeffh@ActiveState.com>
+ * win/tkWinDialog.c (Tk_MessageBoxObjCmd): [Bug 1881892]: Pass ""
+ instead of NULL when -title isn't set.
- * unix/tcl.m4, unix/configure: add solaris-64 gcc build support. [Bug
- 1021871]
+2008-01-31 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-2005-01-31 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+ * doc/panedwindow.n: Added proper description of -height and -width
+ options, which aren't "standard". Last of fallout from [Bug 1882495].
- * generic/tkImgPhoto.c (PhotoFormatThreadExitProc): Made the comments
- in the code more relevant to the function they were documenting! [Bug
- 1110553]
+2008-01-30 Donal K. Fellows <donal.k.fellows@man.ac.uk>
- * library/msgs/es_ES.msg: Added more localization for Spanish Spanish.
- [Bug 1111213]
+ * doc/canvas.n, doc/listbox.n, doc/message.n: [Bug 1882495]: Fix
+ erroneous listing of "standard" options.
-2005-01-25 Daniel Steffen <das@users.sourceforge.net>
+2008-01-29 Joe English <jenglish@users.sourceforge.net>
- * macosx/tkMacOSXInit.c (TkpInit): set tcl_interactive to 1 to show
- console at startup instead of directly calling [console show].
+ * library/treeview.tcl: Fix bug in Shift-ButtonPress-1 binding (error
+ if no current focus item; reported on c.l.t.)
- * unix/tcl.m4 (Darwin): fixed bug with static build linking to dynamic
- library in /usr/lib etc instead of linking to static library earlier in
- search path. [Tcl Bug 956908]
- Removed obsolete references to Rhapsody.
- * unix/configure: autoconf-2.57
+2008-01-29 Donal K. Fellows <donal.k.fellows@man.ac.uk>
-2005-01-18 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * doc/ttk_*.n: [Bug 1876493]: Adjusted handling of the standard
+ options part of the Ttk manual pages so that they are documented in
+ the correct location.
- * library/demos/menu.tcl: Reworked to make dialogs children of the
- demo widget so that they are properly visible. Issue reported by Keith
- Nash <k.j.nash@usa.net>
+2008-01-28 Joe English <jenglish@users.sourceforge.net>
-2005-01-13 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * unix/tkUnixRFont.c: Re-fix strict-aliasing warnings reintroduced by
+ last patch.
- * library/tkfbox.tcl (IconList_Selection, IconList_Create):
- (IconList_Arrange): Assorted tk_getOpenFile fixes. [part of Bug 600313]
- (IconList_ShiftMotion1): Also fix shift-drag.
+2008-01-27 Joe English <jenglish@users.sourceforge.net>
-2005-01-12 Don Porter <dgp@users.sourceforge.net>
+ * generic/ttk/ttkNotebook.c: [Bug 1878298]: Make sure to schedule a
+ redisplay when adding and/or hiding tabs.
- * unix/tcl.m4: Sync'ed to Tcl's copy.
- * unix/configure: autoconf-2.57
+2008-01-27 Joe English <jenglish@users.sourceforge.net>
-2005-01-12 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * unix/tkUnixRFont.c: Merged common code from InitFont() and
+ TkpGetFontAttrsForChar(), factored into GetTkFontAttributes() and
+ GetTkFontMetrics(). Removed write-only struct UnixFtFont member
+ 'drawable'. Removed unneeded double-pointer indirections. Ensure that
+ TkFontAttributes.family member is a Tk_Uid, as specified. Use
+ FcTypeDouble for XFT_SIZE attribute. Finally: fix [Bug 1835848]
- * doc/event.n: Added section on predefined virtual events. [Bug 608115]
+2008-01-25 Don Porter <dgp@users.sourceforge.net>
-2005-01-11 Vince Darley <vincentdarley@users.sourceforge.net>
+ * changes: Updates for 8.5.1 release.
- * generic/tkTextDisp.c: fix to scrollbar height calculations of text
- widgets containing a single very long (wrapped) line. This fixes at
- least part of [Bug 1093631].
+2008-01-08 Joe English <jenglish@users.sourceforge.net>
-2005-01-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * generic/ttk/ttkFrame.c: [Bug 1867122]: fix crash in
+ [ttk::labelframe] when -style option specified.
- * generic/tkObj.c (TkParsePadAmount):
- * generic/tkPack.c: Moved function to tkObj.c and rewrote so that it
- takes advantage of Tcl_Objs properly and cannot leave objects in an
- inconsistent state. [Bug 1098779]
+2008-01-08 Joe English <jenglish@users.sourceforge.net>
-2005-01-10 Joe English <jenglish@users.sourceforge.net>
+ * win/ttkWinTheme.c: [Bug 1865898]: Add tristate support to
+ checkbuttons and radiobuttons.
+ [Bug 1679067]: Fix check and radio indicator size.
- * unix/Makefile.in, unix/configure.in, unix/tkConfig.sh.in:
- Remove ${DBGX}, ${TK_DBGX} from Tk build system. [Patch 1081595]
- * unix/tcl.m4: re-synced with tcl/unix/tcl.m4
- * unix/configure: Regenerated.
+2008-01-06 Joe English <jenglish@users.sourceforge.net>
-2005-01-07 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * generic/ttk/ttkWidget.c, generic/ttk/ttkWidget.h: Call
+ Tk_MakeWindowExist() in widget constructor. Removed now-unnecessary
+ initial ConfigureNotify processing.
- * generic/tkWindow.c (GetScreen): Make sure the result is reset on all
- error paths to stop strange errors. [Bug 697915]
+2008-01-06 Joe English <jenglish@users.sourceforge.net>
-2005-01-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * library/ttk/treeview.tcl, library/ttk/utils.tcl:
+ [Bugs 1442006, 1821939, 1862692]: Fix MouseWheel bindings for
+ ttk::treeview widget.
- * doc/loadTk.n, doc/toplevel.n: Convert to other form of emacs mode
- control comment to prevent problems with old versions of man. [Bug
- 1085127]
+2008-01-02 Don Porter <dgp@users.sourceforge.net>
-2005-01-03 Jeff Hobbs <jeffh@ActiveState.com>
+ * generic/tk.h: Bump version number to 8.5.1b1 to distinguish
+ * library/tk.tcl: CVS development snapshots from the 8.5.0 and
+ * unix/configure.in: 8.5.1 releases.
+ * unix/tk.spec:
+ * win/configure.in:
- * win/tkWinWm.c (TkWinWmCleanup): clean up layered window class. This
- caused crash in reinit of Tk (as seen in plugin).
+ * unix/configure: autoconf (2.59)
+ * win/configure:
******************************************************************
+ *** CHANGELOG ENTRIES FOR 2005 TO 2007 IN "ChangeLog.2007" ***
*** CHANGELOG ENTRIES FOR 2004 AND 2003 IN "ChangeLog.2004" ***
*** CHANGELOG ENTRIES FOR 2002 AND EARLIER IN "ChangeLog.2002" ***
******************************************************************
diff --git a/ChangeLog.2007 b/ChangeLog.2007
new file mode 100644
index 0000000..8c458be
--- /dev/null
+++ b/ChangeLog.2007
@@ -0,0 +1,5283 @@
+2007-12-30 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/canvas.n: Documented exact behaviour of items with respect to
+ when they are the current item. [Bug 1774593] Also documented the
+ clipping behaviour of window items.
+
+ * library/demos/nl.msg: Corrected following testing "in the field" by
+ Arjen Markus. [Bug 1860802]
+
+2007-12-17 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ *** 8.5.0 TAGGED FOR RELEASE ***
+
+ * doc/canvas.n: Documented -outlineoffset item option. [Bug 1836621]
+
+2007-12-14 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: More updates for 8.5.0 release.
+
+2007-12-14 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/ttk_treeview.n: Fix typo. [Bug 1850713]
+
+2007-12-14 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinInt.h: Add in missing function definitions
+ * win/tkWinButton.c: to support plain MSVC6 and use INT_PTR
+ * win/tkWinScrlBar.c: rather than LONG_PTR which isn'tr defined
+ * win/tkWinWm.c: in the msvc6 headers.
+
+2007-12-14 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/nmakehlp.c: Support compilation with MSVC9 for AMD64.
+ * win/makefile.vc:
+
+2007-12-13 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkMenubutton.c (ConfigureMenuButton): trace the
+ -textvariable even if an image exists as it may use -compound.
+
+2007-12-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkText.c (DeleteIndexRange, TextEditCmd, UpdateDirtyFlag):
+ * tests/text.test (text-25.10.1,25.11.[12]):
+ Don't require [update idle] to trigger Modified event [Bug 1809538]
+ Modified virtual event should only fire on state change [Bug 1799782]
+ Make sure we delete chars before triggering <<Modified>> [Bug 1737288]
+
+2007-12-12 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXWm.c (ApplyMasterOverrideChanges): Revert 2007-10-26
+ change to window class of transient toplevels that are not also
+ overrideredirect. [Bug 1845899]
+
+ * macosx/tkMacOSXWm.c (ApplyMasterOverrideChanges): Implement more
+ * macosx/tkMacOSXMouseEvent.c (BringWindowForward): X11-like transient
+ * macosx/tkMacOSXSubwindows.c (XDestroyWindow): behaviour by
+ adding transient windows to a window group owned by the master window,
+ this ensures transients always remain in front of and are collapsed
+ with the master; bring master to front when selecting transient
+ windows; restore default window group of transients if master
+ destroyed. [Bug 1845899]
+
+2007-12-12 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/ttk_intro.n, doc/ttk_style.n, doc/ttk_widget.n:
+ Various minor updates.
+
+2007-12-12 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updated for 8.5.0 release.
+
+2007-12-11 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTheme.c (StyleElementOptionsCmd): Use
+ Ttk_GetElement() to find element instead of direct hash table access.
+
+2007-12-11 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkText.c (TextReplaceCmd): Added code to rebuild the from
+ index after the deletion phase so that the linePtr field is valid for
+ the insertion phase. [Bug 1602537]
+
+2007-12-10 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/event.n: Clarify the fact that [event info] only returns the
+ names of virtual events that are bound to physical event sequences.
+ This follows on from comments on comp.lang.tcl.
+ http://groups.google.com/group/comp.lang.tcl/msg/935d2d226ae8a770
+
+2007-12-10 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/AddOption.3, doc/CrtImgType.3, doc/CrtPhImgFmt.3,
+ * doc/InternAtom.3, doc/TextLayout.3, doc/chooseColor.n,
+ * doc/chooseDirectory.n, doc/loadTk.n, doc/palette.n,
+ * doc/ttk_combobox.n: Various markup fixes (mostly: missing quotes on
+ .SH arguments, extraneous .PPs)
+
+ * doc/ttk_entry.n, doc/ttk_scrollbar.n, doc/ttk_treeview.n: Remove
+ extra .BEs that got added by mistake somewhere.
+
+2007-12-10 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tk.decls: use new genstubs 'export' command to
+ * generic/tkInt.decls: mark exported symbols not in stubs
+ table [FR 1716117]; cleanup formatting
+
+ * generic/tkIntDecls.h: regen with new genStubs.tcl.
+ * generic/tkIntPlatDecls.h: [Tcl Bug 1834288]
+ * generic/tkIntXlibDecls.h:
+ * generic/tkPlatDecls.h:
+ * generic/tkStubInit.c:
+
+2007-12-10 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * tests/safe.test: Ensure list of hidden commands is correct. [Bug
+ 1847925]
+
+2007-12-10 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWin.h: We must specify the lowest Windows version we intend to
+ support. In particular the SystemParametersInfo API doesn't like to
+ receive structures that are larger than it expects which affects the
+ font assignements. Set to Win98 support.
+
+ * win/tkWinFont.c: Handle failure to read the system parameters. This
+ causes ttk/fonts.tcl to set any missing named fonts.
+
+ * win/ttkWinMonitor.c: Only tkWin.h should include windows.h unless
+ * win/ttkWinTheme.c: we have an explicit override of the WINVER
+ * tin/ttkWinXPTheme.c: macro.
+
+ * win/rules.vc: Handle MSVC 9 (aka: Visual Studio 2008)
+
+ * tests/safe.test: Update for 'unload' as a safe command (tcl 8.5b3+)
+
+2007-12-09 Donal K. Fellows <dkf@users.sf.net>
+
+ * win/configure.in: Adjusted code so that running configure does not
+ generate an error message when the full current directory name
+ contains a space.
+
+ * win/tkWinWm.c: Added set of #defs to make this file build with my
+ version of the SDK (i.e. with the msys suite we distribute).
+
+2007-12-07 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/altTheme.tcl, library/ttk/classicTheme.tcl:
+ s/style/ttk::style/.
+
+2007-12-07 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/README: Mention the stub library created by `make` and warn
+ about the effect of embedded paths in the installed binaries. Thanks
+ to Larry Virden. [Tcl Bug 1794084]
+
+2007-12-05 Joe English <jenglish@users.sourceforge.net>
+
+ * macosx/ttkMacOSXTheme.c: Fix TCombobox layout so as not to truncate
+ long text when combobox is wider than requested. [Bug 1845164]
+
+2007-12-05 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/demos/widget: reduce start size to 70% of screenheight from
+ sh-200 for a more reasonable size.
+
+ * win/tkWinButton.c, win/tkWinDialog.c: use SetWindowLongPtr and
+ * win/tkWinScrlbr.c, win/tkWinWm.c: GetWindowLongPtr only.
+ * win/ttkWinMonitor.c:
+
+ * win/tkWinInt.h: remove CS_CLASSDC (not recommended for any apps now)
+ * win/tkWinX.c: and simplify WNDCLASS to one style.
+ * win/tkWinWm.c: Reduce wrapper update for exStyle to toolwindow
+ change only and set WS_EX_LAYERED as sticky (once set on a window, do
+ not remove it) to reduce alpha transition flicker.
+
+ * win/configure, win/tcl.m4 (LIBS_GUI): mingw needs -lole32 -loleaut32
+ but not msvc for Tk's [send]. [Bug 1844749]
+
+2007-12-04 Joe English <jenglish@users.sourceforge.net>
+
+ * doc/ttk_style.n: Remove nonsense about "this manpage has not yet
+ been written"; everything supported is documented.
+
+2007-12-04 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/msgs/en.msg: Added missing messages. [Patch 1800744]
+
+ * library/msgs/da.msg: Added Danish messages. [Patch 1844143]. Many
+ thanks to Torsten Berg <treincke@users.sf.net>.
+
+2007-12-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/configure, win/tcl.m4 (LIBS_GUI): remove ole32.lib oleaut32.lib
+ (LIBS): add ws2_32.lib for static builds with Tcl.
+
+2007-12-01 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTheme.h, generic/ttk/ttkThemeInt.h,
+ * generic/ttk/ttkTheme.c, generic/ttk/ttkLayout.c,
+ * generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c,
+ * generic/ttk/ttkTreeview.c, macosx/ttkMacOSXTheme.c,
+ * win/ttkWinTheme.c, win/ttkWinXPTheme.c: Improved macrology for
+ statically-initialized layout template tables.
+
+2007-11-28 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/tkUnixPort.h: When unix/configure determines whether the
+ intptr_t type is available, it has the <inttypes.h> header present.
+ It's only fair that we let Tk have it too.
+
+2007-11-26 Kevin Kenny <kennykb@acm.org>
+
+ * generic/tkImgPPM.c (StringReadPPM): Corrected a comparison whose
+ sense was reversed that resulted in reading beyond the end of the
+ input buffer on malformed PPM data. [Bug 1822391]
+ * library/tkfbox.tcl (VerifyFileName): Corrected a couple of typos in
+ handling of bad file names. [Bug 1822076] Thanks to Christoph Bauer
+ (fridolin@users.sf.net) for the patch.
+ * tests/filebox.test (filebox-7.1, filebox-7.2): Added test cases that
+ exercise. [Bug 1822076]
+ * tests/imgPPM.test (imgPPM-4.1): Added test case that exercises. [Bug
+ 1822391]
+
+2007-11-25 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkManager.h, generic/ttk/ttkManager.c,
+ * generic/ttk/ttkFrame.c, generic/ttk/ttkNotebook.c,
+ * generic/ttk/ttkPanedwindow.c: Internal Ttk_Manager API updates;
+ Fixed [Bug 1343984]; Added [$nb hide] method; [$nb add] on
+ already-managed windows no longer throws an error, can be used to
+ re-add a hidden tab.
+
+ * doc/ttk_notebook.n, tests/ttk/notebook.test,
+ * tests/ttk/panedwindow.test: Updated docs and test suite.
+
+2007-11-23 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * unix/README: General improvements.
+
+2007-11-21 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/tkfbox.tcl: Better theming in the file list area.
+
+2007-11-19 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.5b3 TAGGED FOR RELEASE ***
+
+ * README: Bump version number to 8.5b3.
+ * generic/tk.h:
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
+
+ * changes: Update changes for 8.5b3 release.
+
+2007-11-19 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/ttk/ttkTheme.c: Fix crash when 'style element create'
+ * tests/ttk/ttk.test: called w/ insufficient args; add tests.
+
+2007-11-18 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkElements.c, macosx/ttkMacOSXTheme.c: Add "fill"
+ element: like "background" but only erases parcel.
+
+ * generic/ttk/ttkFrame.c: Use fill element in Labelframe Label
+ sublayout. Also improved default labelmargins for -labelanchor w*, e*.
+
+ * generic/ttk/ttkLabel.c: no longer need Labelframe hack.
+
+ * library/ttk/aquaTheme.tcl: ImageTextElement no longer needed.
+ TextElement no longer needs '-background' option.
+
+ * generic/ttk/ttkFrame.c: Use sublayout for ttk::labelframe labels
+ instead of single element.
+
+ * generic/ttk/ttkLabel.c: Default -anchor for text and label elements
+ is now "w" instead of "center". [Bug 1614540]
+
+ * library/ttk/defaults.tcl, library/ttk/*Theme.tcl: Button styles now
+ need explicit "-anchor center".
+
+ * generic/ttk/ttkLayout.c (TTKInitPadding): BUGFIX:
+ Ttk_GetPaddingFromObj() and Ttk_GetBorderFromObj() returned garbage
+ when passed an empty list.
+
+ * macosx/ttkMacOSXTheme.c: Resynchronize with Tile codebase so that
+ patches can flow back and forth.
+
+ * library/ttk/aquaTheme.tcl: Extra TButton -padding no longer needed.
+
+2007-11-18 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/ttkWinXPTheme.c: Add support for size information flags for
+ scrollbar and combobox buttons. This handles Tile [Patches 1596647 and
+ 1596657] but a bit more generically.
+
+2007-11-17 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/(tkArgv.c, tkBind.c, tkCipboard.c, tkEntry.c, tkOption.c,
+ tkScale.c, tkScrollbar.c, tkTextImage.c, tkVisual.c, tkWindow.c): Tidy
+ up some variable types.
+
+ * generic/tkFont.c: Only check for -displayof if there are
+ * test/font.test: sufficient arguments. This permits checking
+ strings like -d.
+
+2007-11-17 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/scrollbar.tcl: Swap in core scrollbars for
+ [ttk::scrollbar]s on OSX.
+
+2007-11-16 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
+
+ * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Correct an
+ oversight in the bug fix from 2007-11-11. [Bug 1824638]
+
+2007-11-15 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add new chanio.test.
+ * macosx/Wish.xcode/project.pbxproj:
+
+2007-11-14 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/msgs/sv.msg: Get the locale declared within the message
+ catalog correct! [Bug 1831803]
+
+2007-11-11 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
+
+ * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Fix the case when
+ TK_WHOLE_WORDS and TK_AT_LEAST_ONE are both set and maxLength is small.
+ [Bug 1824638]
+
+2007-11-09 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXCarbonEvents.c
+ (InstallStandardApplicationEventHandler): on Mac OS X Leopard, replace
+ the 2005-11-27 approach of installing the standard application handler
+ by calling RAEL and immediately longjmping out of it from an event
+ handler, as that now leads to crashes in -[NSView unlockFocus] whenever
+ HIToolbox uses Cocoa in Leopard (Help menu, Nav Services, Color
+ Picker). Instead call InstallStandardEventHandler() on the application
+ and menubar event targets, as Leopard ISEH finally handles these
+ correctly. Unfortunately need a HIToolbox-internal SPI to retrieve the
+ menubar event target, no public API appears have that functionality.
+
+ * macosx/tkMacOSXDebug.c: make TkMacOSXInitNamedDebugSymbol()
+ * macosx/tkMacOSXDebug.h: available outside of debug builds as
+ the new Leopard ISAEH needs it.
+
+ * macosx/tkMacOSXButton.c: replace HiliteControl() by modern API
+ * macosx/tkMacOSXMenubutton.c: for activation and enabling;
+ distinguish inactive and disabled
+ look&feel; correct activation handling
+ to match that of container toplevel.
+
+ * macosx/tkMacOSXMenubutton.c: correct size computation of bevelbutton
+ variant to match that of buttons;
+ fix crash with bitmap due to NULL GC;
+ delay picParams setup until needed;
+ formatting cleanup. [Bug 1824521]
+
+ * library/menu.tcl: correct handling of menubutton "active"
+ state on Aqua to match that of buttons.
+
+ * macosx/tkMacOSXDefault.h: correct button & menubutton active
+ foreground and background colors and
+ menubutton border width.
+
+ * macosx/tkMacOSXWindowEvent.c: handle kEventWindowExpanding carbon
+ * macosx/tkMacOSXCarbonEvents.c: event instead of kEventWindowExpanded
+ to ensure activate event arrives after
+ window is remapped, also need to
+ process all Tk events generated by
+ remapping in the event handler to
+ ensure children are remapped before
+ activate event is processed.
+
+ * macosx/tkMacOSXSubwindows.c: add pixmap size field to MacDrawable
+ * macosx/tkMacOSXInt.h: struct; add flag for B&W pixmaps.
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXEmbed.c:
+ * macosx/tkMacOSXMenu.c:
+
+ * macosx/tkMacOSXPrivate.h: correct Leopard HIToolboxVersionNumber.
+
+ * macosx/ttkMacOSXTheme.c: add error checking; cleanup formatting.
+
+ * macosx/tkMacOSXFont.c (TkpGetFontAttrsForChar): panic on false return
+ from TkMacOSXSetupDrawingContext().
+
+ * macosx/tkMacOSXButton.c: sync formatting, whitespace, copyright
+ * macosx/tkMacOSXDialog.c: with core-8-4-branch.
+ * macosx/tkMacOSXMenus.c:
+ * macosx/tkMacOSXWm.c:
+ * xlib/xgc.c
+ * library/bgerror.tcl:
+ * library/console.tcl:
+ * library/menu.tcl:
+
+2007-11-07 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTheme.c (Ttk_ElementSize): Fixed longstanding, subtle
+ bug that caused element padding to sometimes be counted twice in size
+ computations.
+
+ * generic/ttk/ttkElements.c, generic/ttk/ttkClamTheme.c,
+ * generic/ttk/ttkDefaultTheme.c, generic/ttk/ttkTreeview.c,
+ * generic/ttk/ttkImage.c, macosx/ttkMacOSXTheme.c,
+ * win/ttkWinTheme.c, win/ttkWinXPTheme.c:
+ Fix ElementSizeProcs affected by previous change.
+
+2007-11-06 Andreas Kupries <andreask@activestate.com>
+
+ * doc/CrtConsoleChan.3: Fixed markup typo and extended see also
+ section per suggestions by Donal.
+
+2007-11-05 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl: Set focus to listbox in <Map> binding
+ instead of in Post command (see [Bug 1349811] for info).
+
+2007-11-05 Andreas Kupries <andreask@activestate.com>
+
+ * doc/CrtConsoleChan.3: New file providing minimal documentation of
+ 'Tk_InitConsoleChannels()'. [Bug 432435]
+
+2007-11-05 Joe English <jenglish@users.sourceforge.net>
+
+ * macosx/ttkMacOSXTheme.c (TreeitemLayout): Remove focus ring
+ from treeview items on OSX (problem reported by Kevin Walzer).
+
+2007-11-04 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTreeview.c: Use null "treearea" element for treeview
+ owner-draw area instead of "client", to avoid nameclash with
+ Notebook.client element (this was causing sizing anomalies in XP
+ theme, and introduced extraneous padding).
+ * generic/ttk/ttkDefaultTheme.c: Treeitem.indicator element needs left
+ margin now.
+
+2007-11-04 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXMenus.c: add "Run Widget Demo" menu item to the
+ default Edit menu along with associated carbon event handler enabling
+ the item only if demo files are installed; cleanup handling of "About"
+ and "Source" menu items.
+
+ * library/bgerror.tcl: fix background of detail text on Aqua.
+
+ * library/console.tcl: add accelerators and fix Aqua bindings
+ of the new font size menu items.
+
+ * library/demos/mclist.tcl: Aqua GOOBE.
+ * library/demos/tree.tcl:
+ * library/demos/ttknote.tcl:
+ * library/demos/widget:
+
+ * doc/chooseDirectory.n: remove/correct obsolete Mac OS 9-era
+ * doc/getOpenFile.n: information.
+ * doc/menu.n:
+
+ * macosx/tkMacOSXEvent.c (TkMacOSXProcessCommandEvent): fix boolean
+ arg
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add new demo file.
+ * macosx/Wish.xcode/project.pbxproj:
+
+2007-11-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/console.tcl: Add menu item and key binding to adjust font.
+
+2007-11-02 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/demos/mclist.tcl: Added a demo of how to do a multi-column
+ sortable listbox.
+
+ * library/msgbox.tcl: Made message dialog use Ttk widgets for better
+ L&F.
+
+ * library/tkfbox.tcl (::tk::dialog::file::CompleteEnt): Added <Tab>
+ completion. [FR 805091]
+ * library/tkfbox.tcl: Made file dialog use Ttk widgets for better L&F.
+
+ * library/demos/sayings.tcl: Better resizing. [Bug 1822410]
+
+2007-11-01 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/textpeer.tcl: Better resizing. [Bug 1822601]
+
+ * doc/colors.n: Added list of Windows system colors. [Bug 945409]
+
+2007-11-01 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXColor.c (GetThemeColor): improve translation of RGB
+ pixel values into RGBColor.
+
+ * library/demos/widget: increase height of main window text widget to
+ use more of the available vertical space.
+
+ * doc/bind.n: document the Option modifier, clarify meaning
+ and availability of Command & Option.
+
+ * doc/console.n: clarify availability of [console] in TkAqua.
+
+2007-11-01 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * unix/installManPage, doc/*.n: Make documentation use the name that
+ scripts use as much as possible. [Bug 1640073]
+
+ * doc/text.n: Fixed mistake in [$t tag remove] docs. [Bug 1792191]
+
+ * doc/bind.n: Documented the Command modifier. [Bug 1232908]
+
+ * doc/console.n, doc/wish.1: Made it clearer when and why the console
+ command is present. [Bug 1386955]
+
+2007-10-31 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/entry3.tcl: Improved description/comments so that
+ people better understand what is being validated, following suggestion
+ from Don Porter.
+
+ * library/demos/image2.tcl (loadImage): Mark non-loadable images as
+ such instead of throwing a nasty dialog, following suggestion from Don
+ Porter.
+
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock): More optimization, derived
+ from [Patch 224066].
+
+2007-10-30 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl (Unpost): BUGFIX: Unpost can be called with
+ no preceding Post.
+
+2007-10-31 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/rules.vc: Use -fp:strict with msvc8 as -fp:precise fails on
+ * generic/tkObj.c: amd64 builds. Fix the two places in Tk that
+ * generic/tkTrig.c: generate errors with msvc8 when using this flag.
+
+2007-10-30 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/choosedir.tcl: only enable OK button when valid in
+ conjunction with -mustexist. [Bug 1550528]
+
+ * library/listbox.tcl (::tk::ListboxBeginSelect): ignore -takefocus
+ when considering focus on <1>, it is for tab focus.
+
+2007-10-30 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk.h: Bump version number to 8.5b2.1 to distinguish
+ * library/tk.tcl: CVS development snapshots from the 8.5b2
+ * unix/configure.in: release.
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * unix/configure: autoconf (2.59)
+ * win/configure:
+
+2007-10-30 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/text.n: fix spelling of -inactiveselectbackground [Bug 1626415]
+
+ * library/entry.tcl: don't error with Clear event. [Bug 1509288]
+
+ * library/ttk/fonts.tcl: use size -12 TkFixedFont (was -10) on X11
+
+2007-10-30 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/unicodeout.tcl: Fixed Arabic and Hebrew rendering on
+ Windows. [Bug 1803723]
+
+ * generic/tkImgPhoto.c (ImgPhotoCmd): Rename enumeration for somewhat
+ simpler-to-read code. [Bug 1677613]
+
+2007-10-30 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkWidget.c: Split up RedisplayWidget() to factor out
+ double-buffering related code.
+
+ * macosx/ttkMacOSXAquaTheme.c: Use SetThemeBackGround/
+ kThemeBrushModelessDialogBackground{Active|Inactive} instead of
+ ApplyThemeBackground/kThemeBackgroundWindowHeader (advice from DAS).
+
+ * library/ttk/aquaTheme.tcl: Use darker shade for inactive and
+ disabled text, to match typical values of most
+ kThemeXXXTextColorInactive values.
+
+2007-10-30 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/selection.n: Clarify UTF8_STRING handling. [Bug 1778563]
+
+ * doc/text.n: Clarify search subccommand docs. [Bug 1622919]
+
+2007-10-29 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/tkMacOSXFont.c (InitSystemFonts):
+ * library/ttk/fonts.tcl: use Monaco 11 (was 9) as Aqua TkFixedFont
+
+ * tests/listbox.test, tests/panedwindow.test, tests/scrollbar.test:
+ * library/bgerror.tcl, library/dialog.tcl, library/listbox.tcl:
+ * library/msgbox.tcl, library/optMenu.tcl, library/tclIndex:
+ * library/tkfbox.tcl, library/demos/floor.tcl, library/demos/rmt:
+ * library/demos/tcolor, library/demos/text.tcl:
+ * library/demos/twind.tcl, library/demos/widget: Buh-bye Motif look
+ * library/ttk/fonts.tcl: Update of Tk default look in 8.5
+ * macosx/tkMacOSXDefault.h: Trims border sizes, cleaner X11 look
+ * unix/tkUnixDefault.h: with minor modifications for Win32/Aqua.
+ * win/tkWinDefault.h: Uses Tk*Font definitions throughout for
+ * win/tkWinFont.c: classic widgets. [Bug 1820344]
+ * library/obsolete.tcl (::tk::classic::restore): This restores
+ changes made to defaults in 8.5 using the 'option' command,
+ segmented into logical groups.
+
+ * tests/winfo.test: winfo-4.5 raise .t to above . for Windows
+
+ * tests/unixWm.test: note TIP#142 results and remove unnecessary
+ catches.
+
+2007-10-29 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/*.1, doc/*.n, doc/*.3: Lots more GOOBE work.
+
+2007-10-28 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl: Make popdown window [wm resizable 0 0] on
+ OSX, to prevent TkAqua from shrinking the scrollbar to make room for a
+ grow box that isn't there.
+ * macosx/ttkMacOSXTheme.c, library/ttk/aquaTheme.tcl: Reworked
+ combobox layout.
+
+2007-10-26 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.5b2 TAGGED FOR RELEASE ***
+
+ * changes: Update changes for 8.5b2 release.
+
+ * doc/*.1: Revert doc changes that broke
+ * doc/*.3: `make html` so we can get the release
+ * doc/*.n: out the door.
+
+ * README: Bump version number to 8.5b2.
+ * generic/tk.h:
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
+
+2007-10-26 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXWm.c (ApplyMasterOverrideChanges): fix window class
+ of transient toplevels that are not also overrideredirect. [Bug
+ 1816252]
+
+ * macosx/tkMacOSXDialog.c: TIP#242 cleanup.
+ * library/demos/filebox.tcl: demo TIP#242 -typevariable.
+
+2007-10-25 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkNotebook.c: [Bug 1817596]
+
+2007-10-25 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/getOpenFile.n: TIP#242 implementation of -typevariable to
+ * library/tkfbox.tcl: return type of selected file in file dialogs.
+ * library/xmfbox.tcl: [Bug 1156388]
+ * macosx/tkMacOSXDialog.c:
+ * tests/filebox.test:
+ * tests/winDialog.test:
+ * win/tkWinDialog.c:
+
+2007-10-25 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkPlace.c: Prevent segfault in place geometry manager.
+ Thanks to Colin McDonald. [Bug 1818491]
+
+2007-10-24 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/*.c, win/{ttkWinMonitor,ttkWinTheme,ttkWinXPTheme}.c,
+ * macosx/ttkMacOSXTheme.c: Move widget layout registration from
+ TtkElements_Init() to widget *_Init() routines. Renaming/consistency:
+ s/...ElementGeometry()/...ElementSize()/
+
+2007-10-24 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/*.n, doc/*.3, doc/*.1: Lots of changes to take advantage of the
+ new macros.
+
+2007-10-24 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinDraw.c: Applied [Patch 1723362] for transparent bitmaps.
+
+ * generic/tkWindow.c: permit wm manage of any widget (esp: ttk::frame)
+
+2007-10-23 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/ttk/combobox.tcl (ttk::combobox::PopdownWindow): redo wm
+ transient on each drop to handle reparent-able frames. [Bug 1818441]
+
+2007-10-23 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl: [namespace import ::ttk::scrollbar]
+ doesn't work, since ttk::scrollbar isn't [namespace export]ed.
+
+2007-10-23 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/cursor.test: Make tests robust against changes in Tcl's
+ rules for accepting integers in octal format.
+
+2007-10-23 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * doc/font.n: Added section on the TIP#145 fonts.
+
+2007-10-23 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinFont.c: Fixed leak in CreateNamedFont spotted by das.
+
+2007-10-23 Daniel Steffen <das@users.sourceforge.net>
+
+ * library/demos/combo.tcl: Aqua GOOBE.
+ * library/demos/toolbar.tcl:
+ * library/demos/tree.tcl:
+ * library/demos/ttknote.tcl:
+ * library/demos/ttkprogress.tcl:
+ * library/demos/widget:
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add new demo files.
+ * macosx/Wish.xcode/project.pbxproj:
+
+2007-10-22 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/widget: Added more demos, reorganized to make Tk and
+ Ttk demos seem to be more coherent whole. Made localization a bit
+ easier by reducing the amount of duplication.
+ * library/demos/{combo,toolbar,tree,ttknote,ttkprogress}.tcl: New
+ demos of new (mostly) Ttk widgets.
+ * library/demos/ttkbut.tcl: Improvements.
+
+2007-10-22 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl: ttk::combobox overhaul; fixes [Bugs
+ 1814778, 1780286, 1609168, 1349586]
+ * library/ttk/aquaTheme.tcl: Factored out aqua-specific combobox
+ -postposition adjustments.
+ * generic/ttk/ttkTrack.c: Detect [grab]s and unpress pressed
+ element; combobox workaround no longer
+ needed.
+
+2007-10-22 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXFont.c: register named fonts for TIP #145 fonts
+ and all theme font IDs.
+
+ * generic/tkFont.c (Tk{Create,Delete}NamedFont): allow NULL interp.
+
+ * library/ttk/fonts.tcl: check for TIP #145 fonts on all
+ platforms; correct aqua font sizes.
+
+ * library/demos/ttkmenu.tcl: Aqua GOOBE.
+ * library/demos/ttkpane.tcl:
+ * library/demos/widget:
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add new demo files.
+ * macosx/Wish.xcode/project.pbxproj:
+
+2007-10-18 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/ttkmenu.tcl: Added more demos of Ttk widgets. These
+ * library/demos/ttkpane.tcl: ones are of menubuttons, panedwindows and
+ a progress bar (indirectly).
+
+2007-10-18 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/ttk/fonts.tcl: Create all the TIP #145 font names on all
+ platforms (mac and unix get handled in script, windows in C)
+
+2007-10-17 David Gravereaux <davygrvy@pobox.com>
+
+ * bitmaps/*.xbm: Changed CVS storage mode from -kb to -kkv as these
+ are really text files, not binaries.
+ * win/makefile.vc: Added $(BITMAPDIR) to the search path for the
+ depend target.
+
+2007-10-18 Daniel Steffen <das@users.sourceforge.net>
+
+ * library/demos/widget: Aqua GOOBE, cleanup icons.
+ * library/demos/ttkbut.tcl:
+ * library/demos/entry3.tcl:
+ * library/demos/msgbox.tcl:
+
+ * library/demos/button.tcl: restore setting of button
+ highlightbackground on Aqua.
+
+ * macosx/ttkMacOSXTheme.c: adjust button and separator geometry.
+
+ * macosx/tkMacOSXWm.c: fix warnings.
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add new demo files.
+ * macosx/Wish.xcode/project.pbxproj:
+
+2007-10-17 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/ttkbut.tcl: Added demo of the basic Ttk widgets.
+
+2007-10-16 David Gravereaux <davygrvy@pobox.com>
+
+ * win/makefile.vc: depend target now works and builds a generated
+ dependency list with $(TCLTOOLSDIR)/mkdepend.tcl
+
+2007-10-16 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/widget: Made the code for generating the contents of
+ the main widget more informative. Added 'new' flagging for wholly new
+ demos.
+
+ * doc/text.n: Made it clearer what things are text widget invokations
+ and what are not. Also some other clarity improvements.
+
+2007-10-15 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/demos/widget: Use Ttk widgets for the widget demo core, for
+ vastly improved look-and-feel on at least one platform (Windows).
+ * library/demos/{button,check,style,twind}.tcl: Various tweaks for
+ GOOBE...
+ * library/demos/textpeer.tcl: New demo script to show off peering as a
+ specific feature.
+
+2007-10-15 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkFocus.c, generic/tkFrame.c, generic/tkInt.h:
+ * macosx/tkMacOSXButton.c, macosx/tkMacOSXMenubutton.c:
+ * macosx/tkMacOSXWm.c, unix/tkUnixWm.c, win/tkWinWm.c:
+ * doc/wm.n, tests/wm.test: TIP #125 implementation. [Bug 998125]
+ Adds [wm manage|forget] for dockable frames.
+ Finished X11 and Windows code, needs OS X completion.
+
+2007-10-15 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTreeview.c: Store pointer to column table entry
+ instead of column index in columnNames hash table. This avoids the
+ need for the evil PTR2INT and INT2PTR macros, and simplifies things a
+ bit.
+
+2007-10-15 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkArgv.c: Fix gcc warnings about 'cast to/from
+ * generic/tkCanvUtil.c: pointer from/to integer of different
+ * generic/tkCanvas.c: size' on 64-bit platforms by casting
+ * generic/tkCursor.c: to intermediate types
+ * generic/tkInt.h: intptr_t/uintptr_t via new PTR2INT(),
+ * generic/tkListbox.c: INT2PTR(), PTR2UINT() and UINT2PTR()
+ * generic/tkObj.c: macros.
+ * generic/tkStyle.c:
+ * generic/tkTextIndex.c:
+ * generic/tkUtil.c:
+ * generic/ttk/ttkTheme.h:
+ * generic/ttk/ttkTreeview.c:
+ * unix/tkUnixMenu.c:
+ * unix/configure.in:
+
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+
+ * macosx/Wish-Common.xcconfig: add 'tktest-X11' target.
+ * macosx/Wish.xcode/project.pbxproj:
+ * macosx/Wish.xcode/default.pbxuser:
+ * macosx/Wish.xcodeproj/default.pbxuser:
+ * macosx/Wish.xcodeproj/project.pbxproj:
+
+ * unix/configure.in (Darwin): add support for 64-bit X11.
+ * unix/configure: autoconf-2.59
+
+2007-10-14 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/configure, win/configure.in (TK_WIN_VERSION): Make sure the
+ patchlevel doesn't contain extra dotted pairs (eg. interim release)
+
+2007-10-12 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/makefile.vc: Mine all version information from headers.
+ * win/rules.vc: Sync tcl and tk and bring extension versions
+ * win/nmakehlp.c: closer together. Try and avoid using tclsh
+ to do substitutions as we may cross compile.
+
+ * library/console.tcl: Use TkFixedFont and ttk widgets
+
+2007-10-12 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXDraw.c: replace all (internal) use of QD region
+ * macosx/tkMacOSXSubwindows.c: API by HIShape API, with conversion to
+ * macosx/tkMacOSXWindowEvent.c: QD regions only when required by legacy
+ * macosx/tkMacOSXPrivate.h: Carbon or Tk API.
+ * macosx/tkMacOSXRegion.c:
+ * macosx/tkMacOSXDebug.c:
+ * macosx/tkMacOSXDebug.h:
+
+ * macosx/tkMacOSXInt.h: replace MacDrawable's QD RgnHandles
+ * macosx/tkMacOSXEmbed.c: clipRgn, aboveClipRgn & drawRgn by
+ * macosx/tkMacOSXMenu.c: HIShapeRefs visRgn & aboveVisRgn and
+ * macosx/tkMacOSXSubwindows.c: CGRect drawRect.
+
+ * macosx/tkMacOSXWindowEvent.c: remove use of QD port vis rgn in
+ * macosx/tkMacOSXSubwindows.c: window update rgn calculation,
+ * macosx/tkMacOSXWm.c: manually excise growbox from toplevel
+ clip rgn instead.
+
+ * macosx/tkMacOSXDraw.c: replace use of QD port clip rgn by new
+ * macosx/tkMacOSXPrivate.h: clipRgn fld in TkMacOSXDrawingContext;
+ handle QD/CG drawing mismatches in
+ XCopyArea, XCopyPlane and TkPutImage;
+ cleanup/speedup CGContext setup in
+ TkMacOSXSetupDrawingContext().
+
+ * macosx/tkMacOSXDraw.c: change TkMacOSXSetupDrawingContext()
+ * macosx/tkMacOSXEntry.c: to return boolean indicating whether
+ * macosx/tkMacOSXFont.c: drawing is allowed (and was setup) or
+ * macosx/tkMacOSXMenu.c: not (e.g. when clipRgn is empty).
+ * macosx/ttkMacOSXTheme.c:
+
+ * macosx/tkMacOSXSubwindows.c: signal that drawable is a pixmap via
+ * macosx/tkMacOSXInt.h: new explicit TK_IS_PIXMAP flag instead
+ of a NULL cligRgn field.
+
+ * macosx/tkMacOSXRegion.c: add wrappers for missing/buggy HIShape
+ * macosx/tkMacOSXPrivate.h: API, and private helpers to operate on
+ HIShapeRefs & convert to/from TkRegion
+
+ * macosx/tkMacOSXRegion.c: add Tkp{Retain,Release}Region() API
+ * macosx/tkMacOSXInt.h: for TkRegion.
+
+ * xlib/xgc.c: factor out alloc/free of GC clip_mask;
+ * macosx/tkMacOSXXStubs.c: manage clip rgn lifetime with new
+ Tkp{Retain,Release}Region().
+
+ * macosx/tkMacOSXButton.c: delay picParams setup until needed.
+
+ * generic/tkTextDisp.c (CharUndisplayProc): fix textDisp.test crash.
+
+2007-10-11 David Gravereaux <davygrvy@pobox.com>
+
+ * win/winMain.c: Replaced incorrect comments in main() to descibe why
+ the console widget does not need to be created for this application
+ entry point (if used). Must have been a bad copy/paste of WinMain()
+ from 10 years back.
+
+2007-10-11 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXWm.c (TkMacOSXGrowToplevel): manually constrain resize
+ limitBounds to maxBounds, works around SectRect() mis-feature (return
+ zero rect if input rect has zero height/width). [Bug 1810818]
+
+2007-10-09 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkImage.c: Make Ttk_GetImage safe if called with NULL
+ * tests/ttk/image.test: interp. Added some tests that crash on Windows
+ without this fix.
+
+2007-10-02 Don Porter <dgp@users.sourceforge.net>
+
+ [core-stabilizer-branch]
+
+ * README: Bump version number to 8.5.0
+ * generic/tk.h:
+ * library/tk.tcl:
+ * unix/configure.in: Updated LOCALES.
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * unix/configure: autoconf (2.59)
+ * win/configure:
+
+2007-09-30 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/entry.tcl (WordBack, WordForward):
+ Fix private routines accidentally defined in global namespace
+ [Bug 1803836]
+
+2007-09-26 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/msgs/hu.msg: Added Hungarian message set, from Pader Reszo.
+ [Patch 1800742]
+
+2007-09-20 Donal K. Fellows <dkf@users.sf.net>
+
+ *** 8.5b1 TAGGED FOR RELEASE ***
+
+ * generic/tkTextDisp.c (LayoutDLine): Only call callbacks that are
+ * tests/textDisp.test (textDisp-32.3): not NULL. [Bug 1791052]
+
+2007-09-20 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: updates for 8.5b1 release.
+
+2007-09-19 Don Porter <dgp@users.sourceforge.net>
+
+ * README: Bump version number to 8.5b1.
+ * generic/tk.h: Merge from core-stabilizer-branch.
+ * library/tk.tcl: Stabilizing toward 8.5b1 release now done
+ * unix/configure.in: on the HEAD. core-stabilizer-branch is
+ * unix/tk.spec: now suspended.
+ * win/configure.in:
+
+2007-09-19 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkStubLib.: Replaced isdigit with internal implementation.
+
+2007-09-18 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkStubLib.c: Remove C library calls from Tk_InitStubs()
+ * win/makefile.vc: so that we don't need the C library linked
+ in to libtkStub.
+
+2007-09-18 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkImgGIF.c (FileReadGIF, StringReadGIF): Rewrite for greater
+ clarity (more comments, saner code arrangement, etc.)
+
+2007-09-18 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * tests/all.tcl: Made ttk/all.tcl be the same as tk's all.tcl and
+ * tests/ttk/all.tcl: make use of file normalize (bugs noted by
+ mjanssen and GPS with msys)
+
+2007-09-17 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/makefile.vc: Add crt flags for tkStubLib now it uses C-library
+ functions.
+
+2007-09-17 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tcl.m4: use '${CC} -shared' instead of 'ld -Bshareable' to
+ build shared libraries on current NetBSDs. [Bug 1749251]
+ * unix/configure: regenerated (autoconf-2.59).
+
+2007-09-17 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkConsole.c: Revised callers of Tcl_InitStubs() to account
+ * generic/tkMain.c: for restored compatible support for the call
+ * generic/tkWindow.c: Tcl_InitStubs(interp, TCL_VERSION, 1). Also
+ revised Tcl_PkgRequire() call for Tcl so that, for example, a Tk
+ library built against Tcl 8.5.1 headers will not refuse to [load] into
+ a Tcl 8.5.0 interpreter. [Tcl Bug 1578344]
+
+ * generic/tk.h: Revised Tk_InitStubs() to restore Tk 8.4
+ * generic/tkStubLib.c: source compatibility with callers of
+ * generic/tkWindow.c: Tk_InitStubs(interp, TK_VERSION, 1).
+
+2007-09-17 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl: Try to improve combobox appearance on
+ OSX + Tk 8.5. [Bug 1780286]
+
+2007-09-15 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/tcl.m4: replace all direct references to compiler by ${CC} to
+ enable CC overriding at configure & make time; run
+ check for visibility "hidden" with all compilers;
+ quoting fixes from TEA tcl.m4.
+ (SunOS-5.1x): replace direct use of '/usr/ccs/bin/ld' in SHLIB_LD by
+ 'cc' compiler driver.
+ * unix/configure: autoconf-2.59
+
+2007-09-14 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish-Common.xcconfig: enable Tcl DTrace support.
+ * macosx/Wish.xcodeproj/project.pbxproj:
+
+2007-09-12 Andreas Kupries <andreask@activestate.com>
+
+ * win/Makefile.in (install-binaries): Fixed missing brace in the
+ * win/makefile.vc (install-binaries): generated package index file.
+ Note: unix/Makefile.in is good.
+
+2007-09-11 Reinhard Max <max@suse.de>
+
+ * generic/tkImgGIF.c: Fixed a buffer overrun that got triggered by
+ multi-frame interlaced GIFs that contain subsequent frames that are
+ smaller than the first one.
+
+ * tests/imgPhoto.test: Added a test for the above.
+
+2007-09-11 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkConsole.c: Revised calls to Tcl_InitStubs() and
+ * generic/tkMain.c: [package require Tcl] so that Tk Says What It
+ * generic/tkWindow.c: Means using the new facilties of [package] in
+ * library/tk.tcl: Tcl 8.5 about what version(s) of Tcl it is
+ * unix/Makefile.in: willing to work with. [Bug 1578344]
+ * win/Makefile.in:
+ * win/makefile.vc:
+
+2007-09-10 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/README: typo corrections [Bug 1788682]
+
+2007-09-10 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkConsole.c: Revise all Tcl_InitStubs() calls to restore
+ * generic/tkMain.c: the traditional practice that a Tk shared
+ * generic/tkWindow.c: library may [load] into a Tcl 8.5 interp at
+ any patchlevel. This practice also matches the compile time checks of
+ TCL_MAJOR_VERSION and TCL_MINOR_VERSION in tk.h. [Bug 1723622]
+
+2007-09-06 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkWindow.c (Initialize): Moved common Tk initialization
+ * generic/tkInitScript.h (removed): script out of tkInitScript.h
+ * macosx/tkMacOSXInit.c: and multiple TkpInit() routines and
+ * unix/Makefile.in: into the common Initialize() routine in
+ * unix/tkUnixInit.c: generic code. Also removed constraint on
+ * win/tkWinInit.c: ability to define a custom [tkInit] before
+ calling Tk_Init(). Until now the custom [tkInit] had to be a proc. Now
+ it can be any command. Removal of tkInitScript.h also fixes [Bug
+ 1656283].
+
+2007-09-06 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcode/project.pbxproj: discontinue unmaintained support
+ * macosx/Wish.xcode/default.pbxuser: for Xcode 1.5; replace by Xcode2
+ project for use on Tiger (with Wish.xcodeproj to be used on Leopard).
+
+ * macosx/Wish.xcodeproj/project.pbxproj: updates for Xcode 2.5 and 3.0.
+ * macosx/Wish.xcodeproj/default.pbxuser:
+ * macosx/Wish.xcode/project.pbxproj:
+ * macosx/Wish.xcode/default.pbxuser:
+ * macosx/Wish-Common.xcconfig:
+
+ * macosx/README: document project changes.
+
+2007-09-04 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tkTest.c: Fix for [Bug 1788019] "tkTest.c compiler warning".
+
+2007-09-04 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/Makefile.in: It's unreliable to count on the release
+ manager to remember to `make genstubs` before `make dist`. Let the
+ Makefile remember the dependency for us.
+
+ * unix/Makefile.in: Corrections to `make dist` dependencies to be
+ sure that macosx/configure gets generated whenever it does not exist.
+
+2007-09-03 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/ttk/ttkInit.c (Ttk_Init): register ttk in package database
+ to enable extension access to the ttkStubs table.
+
+ * generic/ttk/ttkDecls.h: correct capitalization of ttk package name.
+
+2007-08-28 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ Assorted documentation improvements.
+ * doc/button.n: Added examples.
+ * doc/checkbutton.n: Added example.
+ * doc/console.n: Standardized section ordering.
+ * doc/tk.n: Added "See also".
+ * doc/ttk_combobox.n: Added keywords.
+
+2007-08-27 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXDialog.c (Tk_ChooseColorObjCmd): correct setting of
+ interp result [Bug 1782105]; fix -initialcolor overwriting last color
+ selection; style cleanup.
+
+2007-08-21 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/rules.vc: Synchronize with tcl rules.vc
+ * tests/all.tcl: Fix the line-endings.
+
+2007-08-07 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/Makefile.in: Add support for compile flags specific to
+ object files linked directly into executables.
+
+ * unix/configure.in (Darwin): Only use -seg1addr flag when prebinding;
+ use -mdynamic-no-pic flag for object files linked directly into exes.
+
+ * unix/configure: autoconf-2.59
+
+2007-08-01 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinDialog.c: Fix [Bug 1692927] (buffer length problems)
+ * win/tkWinTest.c: Added 'testfindwindow' and 'testgetwindowinfo'
+ and extended 'testwinevent' for WM_COMMAND support to enable testing
+ native messagebox dialogs.
+ * tests/winMsgbox.test: New Windows native messagebox tests.
+
+2007-07-25 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXDialog.c (NavServicesGetFile): Reset interp result on
+ nav dialog cancel. [Bug 1743786]
+
+2007-07-09 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/Makefile.in: clarify what the headers installed are, and
+ add ttkTheme.h and ttkDecls.h to private headers (later public).
+
+2007-07-09 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXWindowEvent.c (Tk_MacOSXIsAppInFront): Use process mgr
+ * macosx/tkMacOSXMouseEvent.c: to determine if
+ app is in front instead of relying on activate/deactivate events (which
+ may arrive after this info is needed, e.g. during window drag/click
+ activation); replace other process mgr use to get this info with calls
+ to Tk_MacOSXIsAppInFront().
+
+ * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): Correct
+ window click activation, titlebar click handling and background window
+ dragging/growing in the presence of grabs or window-/app-modal windows;
+ fix window click activation bringing all other app windows to front.
+
+ * macosx/tkMacOSXDraw.c (TkPutImage): Handle non-native XImage byte and
+ bit orders; reverse bits via xBitReverseTable instead of InvertByte().
+
+2007-07-06 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/aquaTheme.tcl: Set -anchor w for TMenubuttons.
+ [Bug 1614540]
+
+2007-07-04 Andreas Kupries <andreask@activestate.com>
+
+ * macosx/tkMacOSXXStubs.c (DestroyImage): Fixed seg.fault in release
+ of image data for images coming from XGetImage. Change committed by me
+ for Daniel Steffen. See 2007-06-23 for the change which introduced the
+ problem.
+
+2007-07-02 Daniel Steffen <das@users.sourceforge.net>
+
+ * xlib/xgc.c (XCreateGC): Correct black and white pixel values used to
+ initialize GC foregrund and background fields.
+
+ * macosx/tkMacOSXColor.c: Add debug messages for unknown pixel values.
+
+ * macosx/tkMacOSXDraw.c (TkMacOSXRestoreDrawingContext): Don't restore
+ port state if it wasn't altered by TkMacOSXSetupDrawingContext().
+
+2007-06-29 Daniel Steffen <das@users.sourceforge.net>
+
+ * xlib/ximage.c: Bitmaps created from the static .xbm
+ arrays always have LSBFirst bit order.
+
+ * unix/configure.in: Fix flag used to weak-link libXss.
+ * unix/configure: autoconf-2.59
+
+ * macosx/tkMacOSXScrlbr.c: Correct int <-> dobule conversion issues
+ that could lead to Carbon getting confused about scrollbar thumb size.
+
+ * macosx/tkMacOSXDraw.c (XCopyArea, XCopyPlane, TkPutImage): Use
+ TkMacOSX{Setup,Restore}DrawingContext() to setup/restore clip & colors.
+ (TkMacOSXSetupDrawingContext, TkMacOSXRestoreDrawingContext): Add save
+ and restore of QD port clip region; factor out clip region code common
+ to CG and QD branches; check for port and context validity; handle
+ tkPictureIsOpen flag during QD port setup.
+ (TkScrollWindow): Remove unnecessary scroll region manipulation
+
+ * macosx/tkMacOSXDraw.c: Remove second global QD temp region
+ * macosx/tkMacOSXInt.h: (no longer necessary) and rename
+ * macosx/tkMacOSXRegion.c: remaining global QD temp region.
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWindowEvent.c:
+
+ * macosx/tkMacOSXDraw.c: Make useCGDrawing variable MODULE_SCOPE
+ * macosx/tkMacOSXFont.c: and respect it for ATSUI font drawing.
+
+ * macosx/tkMacOSXButton.c: Reduce reliance on current QD port
+ * macosx/tkMacOSXColor.c: setting and remove unnecessary
+ * macosx/tkMacOSXDebug.c: references to a drawable's QD port,
+ * macosx/tkMacOSXDebug.h: notably replace GetWindowFromPort(
+ * macosx/tkMacOSXDialog.c: TkMacOSXGetDrawablePort()) idiom by new
+ * macosx/tkMacOSXDraw.c: TkMacOSXDrawableWindow() and change
+ * macosx/tkMacOSXKeyEvent.c: TkMacOSXSetColorInPort() to take a port
+ * macosx/tkMacOSXMenu.c: argument.
+ * macosx/tkMacOSXMenubutton.c:
+ * macosx/tkMacOSXMouseEvent.c:
+ * macosx/tkMacOSXScale.c:
+ * macosx/tkMacOSXScrlbr.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c:
+
+ * macosx/tkMacOSXInt.h: Factor out macros, declarations
+ * macosx/tkMacOSXPrivate.h (new): and prototypes that are purely
+ internal and private to the 'macosx' sources into a new internal header
+ file that does _not_ get installed into Tk.framework/PrivateHeaders.
+
+ * macosx/tkMacOSXButton.c: #include new tkMacOSXPrivate.h
+ * macosx/tkMacOSXCarbonEvents.c: instead of tkMacOSXInt.h.
+ * macosx/tkMacOSXClipboard.c:
+ * macosx/tkMacOSXColor.c:
+ * macosx/tkMacOSXCursor.c:
+ * macosx/tkMacOSXDebug.c:
+ * macosx/tkMacOSXDialog.c:
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXEntry.c:
+ * macosx/tkMacOSXEvent.c:
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXHLEvents.c:
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXKeyEvent.c:
+ * macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXMenubutton.c:
+ * macosx/tkMacOSXMenus.c:
+ * macosx/tkMacOSXMouseEvent.c:
+ * macosx/tkMacOSXNotify.c:
+ * macosx/tkMacOSXRegion.c:
+ * macosx/tkMacOSXScale.c:
+ * macosx/tkMacOSXScrlbr.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXXStubs.c:
+ * macosx/ttkMacOSXTheme.c:
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Improve support for renamed
+ * macosx/Wish.xcodeproj/default.pbxuser: tcl and tk source dirs; add
+ * macosx/Wish-Common.xcconfig: 10.5 SDK build config; remove
+ tclMathOp.c.
+
+ * macosx/README: Document Wish.xcodeproj changes.
+
+2007-06-23 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkImgPhoto.c (ImgPhotoConfigureInstance, DisposeInstance):
+ Use XDestroyImage instead of XFree to destroy XImage; replace runtime
+ endianness determination by compile-time check for WORDS_BIGENDIAN.
+
+ * xlib/ximage.c (XCreateBitmapFromData): Use XCreateImage and
+ XDestroyImage instead of creating XImage structure manually.
+
+ * macosx/tkMacOSXXStubs.c (XCreateImage, DestroyImage): Correct XImage
+ bytes_per_line/bitmap_pad calculations and endianness setting; free
+ image data and XImage structure at destruction; formatting cleanup.
+
+ * macosx/tkMacOSXDialog.c (NavServicesGetFile): Disable app-modal
+ sheet variant of nav dialog on OS versions where it causes problems.
+
+2007-06-20 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/ttk/ttk.tcl: Should require Tk before pseudo-providing
+ tile 0.8.0.
+
+2007-06-09 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkPanedwindow.c, doc/ttk_panedwindow.n,
+ * tests/ttk/panedwindow.test: Added -width and -height options. Added
+ 'panes' method, return list of managed windows. 'sashpos' method is
+ now documented as part of the public interface, and details clarified.
+ Should be easier to set initial sash positions now. Alleviates [Bug
+ 1659067].
+
+2007-06-09 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinWm.c (WmIconphotoCmd): fix wm iconphoto RGBA issues.
+ [Bug 1467997] (janssen)
+
+ * win/tkWinMenu.c (TkWinHandleMenuEvent): Improve handling to allow
+ for unicode char menu indices and not use CharUpper on Tcl utf
+ strings. [Bug 1734223]
+
+2007-06-09 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkManager.h, generic/ttk/ttkManager.c,
+ * generic/ttk/ttkNotebook.c, generic/ttk/ttkPanedwindow.c,
+ * generic/ttk/ttkFrame.c: Ttk_Manager API overhaul:
+ + Ttk_Manager no longer responsible for managing slave records
+ + Ttk_Manager structure now opaque
+ + Ttk_Slave structure now private
+ + Pass Ttk_Manager* to Tk_GeomMgr hooks instead of Ttk_Slave*
+
+ * generic/ttk/ttkFrame.c: Simplified -labelwidget management.
+
+ * doc/ttk_panedwindow.n, library/ttk/panedwindow.tcl: Changed
+ documentation of ttk::panedwindow 'identify' command to match
+ implementation.
+
+ * generic/ttk/ttkNotebook.c, tests/ttk/notebook.test:
+ BUGFIX: ttk::noteboook 'insert' command didn't correctly maintain
+ current tab.
+
+2007-06-09 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXColor.c: Fix issues with TK_{IF,ELSE,ENDIF} macros;
+ * macosx/tkMacOSXDraw.c: implement Jaguar equivalent of unavailable
+ * macosx/tkMacOSXEntry.c: kHIToolboxVersion global; panic at startup
+ * macosx/tkMacOSXEvent.c: if MAC_OS_X_VERSION_MIN_REQUIRED constraint
+ * macosx/tkMacOSXInit.c: is not satisfied.
+ * macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXWm.c:
+
+ * macosx/tkMacOSXDraw.c (XCopyArea, XCopyPlane, TkPutImage)
+ (TkMacOSXSetupDrawingContext): Factor out common code and standardize
+ setup/restore of port, context and clipping; formatting cleanup.
+
+ * macosx/tkMacOSXWindowEvent.c: Add error checking.
+ * macosx/tkMacOSXMenu.c: Fix gcc3 warning.
+ * macosx/tkMacOSXScrlbr.c: Fix testsuite crash.
+ * macosx/tkMacOSXSubwindows.c: Formatting cleanup.
+ * macosx/tkMacOSXRegion.c: Fix typos.
+ * macosx/tkMacOSXScale.c:
+
+ * macosx/tkMacOSXXStubs.c (Tk_GetUserInactiveTime): Remove superfluous
+ CFRetain/CFRelease.
+
+ * macosx/Wish-Release.xcconfig: Disable tktest release build stripping.
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Add new Tclsh-Info.plist.in.
+
+2007-06-06 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXInt.h: Use native debug message API when available.
+ * macosx/Wish-Debug.xcconfig:
+
+ * macosx/tkMacOSXMouseEvent.c (GenerateMouseWheelEvent): Enable
+ processing of mousewheel events in background windows.
+
+ * macosx/tkMacOSXScrlbr.c: Modernize checks for active/front window.
+ * macosx/tkMacOSXScale.c:
+ * macosx/tkMacOSXWm.c:
+
+ * macosx/tkMacOSXColor.c: Factor out verbose #ifdef checks of
+ * macosx/tkMacOSXDraw.c: MAC_OS_X_VERSION_{MAX_ALLOWED,MIN_REQUIRED}
+ * macosx/tkMacOSXEntry.c: and runtime checks of kHIToolboxVersion into
+ * macosx/tkMacOSXEvent.c: new TK_{IF,ELSE,ENDIF}_MAC_OS_X macros.
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXWm.c:
+
+ * macosx/tkMacOSXDraw.c: Factor out clip clearing in QD ports;
+ * macosx/tkMacOSXEntry.c: Formatting cleanup.
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Add settings for Fix&Continue.
+
+ * unix/configure.in (Darwin): Link the Tk and Wish plists into their
+ binaries in all cases; fix 64bit arch removal in fat 32&64bit builds.
+
+ * unix/tcl.m4 (Darwin): Fix CF checks in fat 32&64bit builds.
+ * unix/configure: autoconf-2.59
+
+2007-06-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/photo.n: Clarified the fact that base64 support for the -data
+ option is not universal. [Bug 1731348] (matzek)
+
+2007-06-03 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/Makefile.in: Add datarootdir to silence autoconf-2.6x warning.
+
+ * macosx/Wish.xcodeproj/default.pbxuser: Add ttk tests.
+
+ * macosx/tkMacOSXMenu.c: Add error checking; whitespace cleanup.
+
+ * macosx/tkMacOSXDraw.c: Comment formatting fixes for Xcode 3.0
+ * macosx/tkMacOSXEmbed.c:
+ * macosx/tkMacOSXEntry.c:
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXKeyEvent.c:
+ * macosx/tkMacOSXKeyboard.c:
+ * macosx/tkMacOSXMenus.c:
+ * macosx/tkMacOSXSend.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXXStubs.c:
+
+2007-06-02 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXMenu.c (TkpPostMenu): Ensure cascade menus display in
+ posted menus that are not part of the menubar or attached to a
+ menubutton (fixes bug reported on tcl-mac by Linus Nyberg).
+
+2007-05-31 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXWindowEvent.c (GenerateUpdateEvent): Complete all
+ pending idle-time redraws before newly posted Expose events are
+ processed; add bounds of redrawn windows to update region to ensure
+ all child windows overdrawn by parents are redrawn.
+
+ * macosx/tkMacOSXWindowEvent.c: Centralize clip and window invalidation
+ * macosx/tkMacOSXSubwindows.c: after location/size changes in the
+ * macosx/tkMacOSXWm.c: BoundsChanged carbon event handler;
+ correct/add window invalidation after window attribute changes.
+
+ * macosx/tkMacOSXSubwindows.c (XResizeWindow, XMoveResizeWindow)
+ (XMoveWindow): Factor out common code dealing with embedded and
+ non-toplevel windows; remove unnecessary clip and window invalidation.
+
+ * macosx/tkMacOSXButton.c (TkpDisplayButton): Move clip setup closer
+ to native button drawing calls.
+
+ * macosx/tkMacOSXWm.c (TkMacOSXIsWindowZoomed, TkMacOSXZoomToplevel):
+ Correct handling of gridded windows in max size calculations.
+
+ * macosx/tkMacOSXEvent.c (TkMacOSXFlushWindows): Use HIWindowFlush API
+ when available.
+
+ * macosx/tkMacOSXColor.c: Cleanup whitespace and formatting.
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWm.c:
+
+ * generic/tkFont.c: #ifdef out debug msg printing to stderr.
+ * generic/tkTextDisp.c:
+
+2007-05-30 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tk.h: Correct placement of #include <tcl.h>. [Bug 1723812]
+
+2007-05-30 Daniel Steffen <das@users.sourceforge.net>
+
+ * library/bgerror.tcl: Standardize dialog option & button size
+ * library/dialog.tcl: modifications done when running on on Aqua.
+ * library/msgbox.tcl:
+
+ * library/demos/button.tcl: Set button highlightbackground on Aqua.
+
+ * macosx/tkMacOSXMenu.c (DrawMenuSeparator): Use DrawingContext API.
+
+ * macosx/tkMacOSXWindowEvent.c (ClearPort): Clip to updateRgn.
+
+ * macosx/tkMacOSXDebug.c: Factor out debug region flashing.
+ * macosx/tkMacOSXDebug.h:
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWindowEvent.c:
+
+ * macosx/tkMacOSXEvent.c: Cleanup whitespace and formatting.
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXRegion.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXXStubs.c:
+ * xlib/xgc.c:
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Delete references to removed
+ * macosx/Wish.xcodeproj/default.pbxuser: ttk files.
+
+2007-05-28 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
+
+ * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Fix short measures
+ with flags=TK_WHOLE_WORDS|TK_AT_LEAST_ONE [Bug 1716141]. Make some
+ casts unnecessary by changing variable types.
+
+2007-05-25 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/ttk.tcl: Omit ttk::dialog and dependencies.
+ * library/ttk/dialog.tcl, library/ttk/icons.tcl,
+ * library/ttk/keynav.tcl: Removed.
+ * tests/ttk/misc.test: Removed.
+ * doc/ttk_dialog.tcl: Removed.
+
+2007-05-25 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/canvas.n: Fixed documentation of default -joinstyle option
+ values for line and polygon items. [Bug 1725782]
+
+2007-05-22 Don Porter <dgp@users.sourceforge.net>
+
+ [core-stabilizer-branch]
+
+ * unix/configure: autoconf-2.59 (FC6 fork)
+ * win/configure:
+
+ * README: Bump version number to 8.5b1
+ * generic/tk.h:
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+
+2007-05-18 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkEntry.c(EntrySetValue): Ensure that widget is in a
+ consistent state before setting the linked -textvariable. Previously,
+ it was possible for [$e index insert] to point past the end of the
+ string, leading to heap corruption. [Bug 1721532]
+ * tests/ttk/entry.test(entry-9.1): Add test case for the above.
+
+2007-05-18 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/configure: autoconf-2.59 (FC6 fork)
+ * win/configure:
+
+ * README: Bump version number to 8.5a7
+ * generic/tk.h:
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * tests/ttk/treetags.test: Another bit of test suite
+ SCIM-tolerance. [Bug 1609316]
+
+2007-05-17 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tk.decls: Workaround 'make checkstubs' failures from
+ tkStubLib.c MODULE_SCOPE revert. [Bug 1716117]
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Add tkOldTest.c and remove
+ tkStubImg.c.
+
+2007-05-16 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tkStubLib.c: Change Tk_InitStubs(), tkStubsPtr, and the
+ auxilliary stubs table pointers back to public visibility. See [Bug
+ 1716117] for details.
+
+ Removed TCL_STORAGE_CLASS monkey business, as it had no effect.
+
+2007-05-16 Don Porter <dgp@users.sourceforge.net>
+
+ * library/choosedir.tcl: Removed uses of obsolete {expand}
+ * library/comdlg.tcl: syntax; replaced with the now
+ * library/tk.tcl: approved {*}. [Bug 1710633]
+ * tests/canvImg.test:
+ * tests/imgPhoto.test:
+
+ * tests/bind.test: Make test suite more SCIM-tolerant. [Bug 1609316]
+
+2007-05-16 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/makefile.vc: Test ttk widgets.
+
+2007-05-15 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixRFont.c: Fix crash introduced by previous fix exposed
+ under newer fontconfig libraries [Bug 1717830] again.
+
+2007-05-15 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkGrid.c: Stop crash due to list intrep shimmer [Bug 1677608]
+
+2007-05-15 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixRFont.c: Fix various memory leaks. [Bug 1717830], [Bug
+ 800149]
+
+2007-05-14 Don Porter <dgp@users.sourceforge.net>
+
+ [Tk Bug 1712081]
+
+ * unix/Makefile.in: Updates to account for new and deleted files
+ * win/Makefile.in: tkStubImg.c and tkOldTest.c.
+ * win/makefile.bc:
+ * win/makefile.vc:
+
+ * generic/tkOldTest.c (new): New file used to create testing
+ * generic/tkTest.c: commands for testing various Tk
+ * tests/constraints.tcl: legacy interfaces where a separate
+ * tests/image.test: compilation unit is needed in order to
+ #define suitable macros during compilation. Only the effect of
+ USE_OLD_IMAGE on Tk_CreateImageType() is currently tested, but more
+ similar testing commands can be added to this same file. New
+ constraint defined to detect presence of the image type provided by
+ the new testing code, and a few tests added to exercise it. Having
+ USE_OLD_IMAGE support tested by the default test suite should reduce
+ chance of a recurrence of this bug.
+
+ * doc/CrtImgType.3: Revised docs to better indicate the legacy
+ * doc/CrtPhImgFmt.3: nature of the interfaces supported by
+ USE_OLD_IMAGE.
+
+ * generic/tkDecls.h: make genstubs
+ * generic/tkStubInit.c:
+
+ * generic/tk.decls: Reworked USE_OLD_IMAGE support to use
+ * generic/tk.h: the same support mechanisms both with
+ * generic/tkStubImg.c (deleted):and without a stub-enabled build. In
+ each case, route the legacy calls to Tk_CreateImageType and
+ Tk_CreatePhotoImageFormat through the Tk_CreateOldImageType and
+ Tk_CreateOldPhotoImageFormat routines. Add those routines to the
+ public stub table so they're available to a stub-enabled extension.
+ Remove the definition of Tk_InitImageArgs() and use a macro to convert
+ any calls to it in source code into a comment.
+
+ * generic/tkImage.c: Removed the MODULE_SCOPE declarations that
+ * generic/tkImgPhoto.c: broke USE_OLD_IMAGE support.
+
+2007-05-11 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * tests/winButton.test: Avoid font dependencies in results.
+
+ * generic/tkFont.c: propagate error from TkDeleteNamedFont. [Bug
+ 1716613]
+
+2007-05-09 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkFileFilter.c (AddClause): OSType endianness fixes.
+
+ * library/palette.tcl (tk::RecolorTree): Handle color options with
+ empty value, fixes error due to emtpy -selectforeground (reported on
+ tcl-mac by Russel E. Owen).
+
+ * macosx/tkMacOSXWindowEvent.c: Ensure window is brought to the front
+ * macosx/tkMacOSXMouseEvent.c: at the start of a window drag (except
+ * macosx/tkMacOSXInt.h: when cmd key is down); formatting and
+ whitespace fixes.
+
+ * macosx/tkMacOSXDialog.c (Tk_GetSaveFileObjCmd): Add -filetypes option
+ processing (fixes fileDialog-0.1, fileDialog-0.2 failures).
+
+ * macosx/tkMacOSXEmbed.c (TkpMakeWindow, TkpUseWindow): Fix sending of
+ Visibility event for embedded windows (fixes frame-3.9 hang).
+
+ * macosx/tkMacOSXScrlbr.c (ScrollbarBindProc): Fix testsuite
+ * macosx/tkMacOSXSubwindows.c (TkMacOSXUpdateClipRgn): crashes by
+ adding sanity checks.
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Add 'DebugUnthreaded' &
+ * macosx/Wish.xcodeproj/default.pbxuser: 'DebugLeaks' targets and env
+ var settings needed to run the 'leaks' tool.
+
+ * macosx/tkMacOSXButton.c: Fix debug msg typo.
+
+ * tests/constraints.tcl: Ensure 'nonUnixUserInteraction' constraint is
+ set for aqua.
+
+ * tests/choosedir.test: Add 'notAqua' constraints to X11-only tests;
+ * tests/clrpick.test: add 'nonUnixUserInteraction' to 'unix' tests
+ * tests/menuDraw.test: requiring interaction on aqua.
+ * tests/unixMenu.test:
+ * tests/unixWm.test:
+ * tests/winMenu.test:
+
+2007-05-07 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixRFont.c: Properly cast sentinel arguments to variadic
+ function (fixes "warning: missing sentinel in function call", [Bug
+ 1712001])
+
+2007-05-04 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkFont.c: TIP #145 implementation -
+ * generic/tkFont.h: Enhanced font handling.
+ * win/tkWinDefault.h:
+ * win/tkWinFont.c:
+ * win/tkWinInt.h:
+ * win/tkWinWm.c:
+ * library/demos/widget:
+ * library/ttk/fonts.tcl:
+
+2007-05-04 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/ttk_treeview.n, doc/ttk_panedwindow.n, doc/ttk_dialog.n:
+ * doc/ttk_checkbutton.n, doc/tk.n, doc/menu.n, doc/font.n:
+ * doc/canvas.n: Spelling fixes. [Bug 1686210]
+
+2007-05-03 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkStubLib.c (Tk_InitStubs):
+ * generic/ttk/ttkLabel.c (LabelSetup):
+ * unix/tkUnixSelect.c (ConvertSelection):
+ * unix/tkUnixEvent.c (TkUnixDoOneXEvent):
+ * generic/tkConfig.c (Tk_RestoreSavedOptions):
+ * generic/tkCanvPs.c (TkCanvPostscriptCmd):
+ * generic/tkOption.c (GetDefaultOptions):
+ * unix/tkUnixRFont.c (TkpGetFontAttrsForChar, InitFont)
+ (TkpGetFontFamilies, TkpGetSubFonts):
+ * unix/tkUnixSend.c (TkpTestsendCmd, RegOpen): Squelch warnings from
+ GCC type aliasing. [Bug 1711985 and others]
+
+2007-04-29 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/configure.in: Fix for default case in tk debug build detection.
+ * unix/configure: autoconf-2.59
+
+2007-04-27 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTreeview.c(TagOptionSpecs): Use TK_OPTION_STRING
+ instead of TK_OPTION_FONT to avoid resource leak in tag management.
+
+2007-04-26 Joe English <jenglish@users.sourceforge.net>
+
+ * macosx/ttkMacOSXTheme.c: Merged OFFSET_RECT processing into
+ BoxToRect(); factored out PatternOrigin; resynchronized with Tile
+ codebase.
+
+2007-04-26 Jeff Hobbs <jeffh@ActiveState.com>
+
+ *** 8.5a6 TAGGED FOR RELEASE ***
+
+ * unix/Makefile.in (dist): Correct tests/ttk glob inclusion
+
+2007-04-25 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/Makefile.in (dist): Add tests/ttk dir to src dist
+
+ * unix/tkUnixMenubu.c (TkpDisplayMenuButton): Init width/height to 0
+
+2007-04-25 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/Makefile.in (dist): Add macosx/*.xcconfig files to src dist;
+ copy license.terms to dist macosx dir; fix autoheader bits.
+
+2007-04-24 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/Makefile.in (dist): Add ttk bits to src dist
+
+ * tests/font.test (font-46.[12]): Correct listification of result
+
+2007-04-23 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkCanvas.c: Allow -selectforeground option to be None; add
+ * generic/tkCanvText.c: fallback to fgColor when selFgColor is None
+ * generic/tkEntry.c: (new default on aqua to match native L&F).
+ * generic/tkListbox.c:
+ * generic/tkText.c:
+
+ * generic/tkCanvas.c: Add support for bypassing all of Tk's double
+ * generic/tkEntry.c: buffered drawing into intermediate pixmaps
+ * generic/tkFrame.c: (via TK_NO_DOUBLE_BUFFERING #define), it is
+ * generic/tkListbox.c: unnecessary & wasteful on aqua where all
+ * generic/tkPanedWindow.c: drawing is already double-buffered by the
+ * generic/tkTextDisp.c: window server. (Use of this on other
+ * generic/ttk/ttkWidget.c: platforms would only require implementation
+ * unix/tkUnixScale.c: of TkpClipDrawableToRect()).
+ * macosx/tkMacOSXPort.h:
+
+ * library/bgerror.tcl: On aqua, use moveable alert resp. modal dialog
+ * library/dialog.tcl: window class and corresponding system
+ background pattern; fix button padding.
+
+ * library/tearoff.tcl: Correct aqua menu bar height; vertically offset
+ * library/tk.tcl: aqua tearoff floating window to match menu.
+
+ * library/demos/goldberg.tcl: Fix overwriting of widget demo global.
+
+ * library/demos/menu.tcl: On aqua, use custom MDEF and tearoffs;
+ * library/demos/menubu.tcl: correct menubutton toplevel name.
+
+ * library/demos/puzzle.tcl: Fix button size & padding for aqua.
+ * library/demos/radio.tcl:
+
+ * macosx/tkMacOSXCarbonEvents.c: Add window event target carbon event
+ * macosx/tkMacOSXEvent.c: handler for all kEventClassWindow and
+ * macosx/tkMacOSXEvent.h: kEventClassMouse events; move all
+ * macosx/tkMacOSXNotify.c: remaining events except for
+ * macosx/tkMacOSXWindowEvent.c: kEventClassKeyboard from dispatcher to
+ application event handler; pass event handler callRef downstream; fix
+ debug event tracing; process all tcl event types in carbon event timer;
+ delay carbon event timer first fire; add TkMacOSXTrackingLoop() to mark
+ enter/exit of event tracking loop during which all tcl events but only
+ carbon update events should be processed by the timer (replaces various
+ calls to Tcl_SetServiceMode()); rename TkMacOSXReceiveAndProcessEvent()
+ to TkMacOSXReceiveAndDispatchEvent(), move it from tkMacOSXEvent.c to
+ tkMacOSXCarbonEvents.c and modify it to dequeue only update events
+ during a tracking loop; add TkMacOSXRunTclEventLoop() to standardize
+ the various ways in use to run the tcl event loop; add handling of
+ kEventClassAppearance events (for ScrollBarVariantChanged event).
+
+ * macosx/tkMacOSXDialog.c: Use new TkMacOSXTrackingLoop() around
+ * macosx/tkMacOSXEvent.c: blocking API that puts up modal dialogs
+ * macosx/tkMacOSXMenu.c: or when entering/exiting menu/control
+ * macosx/tkMacOSXMouseEvent.c: tracking, window dragging and other
+ * macosx/tkMacOSXScale.c: mouse tracking loops.
+ * macosx/tkMacOSXScrlbr.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c:
+
+ * macosx/tkMacOSXDialog.c: Use new TkMacOSXRunTclEventLoop()
+ * macosx/tkMacOSXScale.c: instead of Tcl_DoOneEvent(),
+ * macosx/tkMacOSXScrlbr.c: Tcl_ServiceAll(), TclServiceIdle()
+ * macosx/tkMacOSXWindowEvent.c: and Tcl_GlobalEval("update idletasks").
+
+ * macosx/tkMacOSXColor.c: Make available as Tk system colors all
+ * macosx/tkMacOSXPort.h: appearance manager brushes, text colors and
+ backgrounds with new and legacy names, as well as the fully transparent
+ color "systemTransparent"; add TkMacOSXSetColorIn{Port,Context}() to
+ directly set an X pixel color value in the current QD port resp. the
+ given CG context without requiring passage through rgb representation
+ (lossy for most system colors); modernize/remove Classic-era code;
+ replace crufty strcmp() elseifs by Tcl_GetIndexFromObjStruct().
+
+ * macosx/tkMacOSXButton.c: Use new TkMacOSXSetColorInPort()
+ * macosx/tkMacOSXDraw.c: instead of setting rgb color directly
+ * macosx/tkMacOSXMenubutton.c: to allow for non-rgb system colors.
+
+ * macosx/tkMacOSXCursor.c: Implement "none" cursor as on other
+ platforms [Patch 1615427]; add all missing appearance manager cursors.
+
+ * macosx/tkMacOSXDefault.h: Set SELECT_FG_COLORs to None to match aqua
+ L&F; use standard system color names; use new 'menu' system font;
+ correct default scrollbar width.
+
+ * macosx/tkMacOSXDraw.c: Standardize initialization, use and
+ * macosx/tkMacOSXInt.h: emptying of various static temp rgns
+ * macosx/tkMacOSXRegion.c: onto two global RgnHandles; in debug
+ * macosx/tkMacOSXSubwindows.c: builds, verify emptiness of these temp
+ * macosx/tkMacOSXWindowEvent.c: rgns before use.
+
+ * macosx/tkMacOSXDraw.c: Add TkMacOSX{Setup,Restore}DrawingContext() to
+ * macosx/tkMacOSXInt.h: abstract common setup & teardown of drawing
+ environment (for both CG and QD); save/restore QD theme drawing state;
+ handle GC clip region; add TkpClipDrawableToRect() to allow clipped
+ drawing into drawable regardless of GC used; use new system color
+ "systemWindowHeaderBackground" to setup background in themed toplevels;
+ correct implementation of TkMacOSXMakeStippleMap().
+
+ * macosx/tkMacOSXEntry.c: Use new TkMacOSXSetupDrawingContext() and
+ * macosx/tkMacOSXFont.c: TkMacOSXRestoreDrawingContext() instead of
+ * macosx/ttkMacOSXTheme.c: various setup/teardown procs like
+ TkMacOSX{SetUp,Release}CGContext(), TkMacOSXQuarz{Start,End}Draw(),
+ TkMacOSXSetUpGraphicsPort() etc.
+
+ * macosx/tkMacOSXEmbed.c: Add CG context and drawable clip rgn fields
+ * macosx/tkMacOSXInt.h: to MacDrawable struct.
+ * macosx/tkMacOSXSubwindows.c:
+
+ * macosx/tkMacOSXDialog.c: Make -parent option of tk_getOpenFile et al.
+ use the sheet version of NavServices dialogs; ensure native parent win
+ exists before using StandardSheet API for tk_messageBox [Bug 1677611];
+ force sheets to behave like app-modal dialogs via WindowModality() API;
+ use more modern ColorPicker API.
+
+ * macosx/tkAboutDlg.r: Use themed movable modal dialog, fix (c) year.
+
+ * macosx/tkMacOSXEntry.c: Take xOff/yOff of MacDrawable into account
+ * macosx/ttkMacOSXTheme.c: when computing locations/bounds to ensure
+ correct posititioning when not drawing into intermediate pixmap.
+
+ * macosx/tkMacOSXFont.c: Use appearance manager API to map system font
+ * macosx/tkMacOSXFont.h: names to TkFonts; add "menu" system font for
+ menu item text drawing from MDEF; always draw with CG; remove QD
+ dependent stippling algorithm; move most header declarations into the
+ source file (as they were not used anywhere else).
+
+ * macosx/tkMacOSXMenu.c: Large-scale rewrite of custom
+ * macosx/tkMacOSXMenu.r (removed): MDEF and related code that
+ * macosx/Wish.xcode/project.pbxproj: restores many longtime-MIA
+ * macosx/Wish.xcodeproj/project.pbxproj: features to working order
+ * unix/Makefile.in: (e.g. images, custom colors &
+ fonts in menus etc); implement compound menu items; use Appearance Mgr
+ and ThemeText APIs to mimic native MDEF as closely as possible when
+ default "menu" system font is used; remove now obsolete SICN drawing
+ code and resources.
+
+ * macosx/tkMacOSXCarbonEvents.c: Handle additional menu carbon events
+ * macosx/tkMacOSXEvent.c: in order to support <<MenuSelect>> in
+ * macosx/tkMacOSXMenu.c: the menubar and in menus that are not
+ * macosx/tkMacOSXMenus.c: using the custom MDEF [Bug 1620826];
+ fix early and missing clearing of current Tk active menu entry; fix
+ extraneous sending of <<MenuSelect>> during active menu entry clearing.
+
+ * macosx/tkMacOSXMouseEvent.c: Add support for async window dragging by
+ the window server; set the corresponding window attribute by default.
+
+ * macosx/tkMacOSXMouseEvent.c: Rationalized handling order of
+ non-mousedown events; add TkMacOSXModifierState() to retrieve the
+ current key modifiers in carbon format.
+
+ * macosx/tkMacOSXScrlbr.c: Use appearance manager API to retrieve
+ scrollbar component metrics; add awareness of multiple possibilites for
+ scrollbar arrow position in aqua and handle user changes to arrow
+ position pref; handle difference in metrics of small & large scrollbar
+ variants; handle aqua "jump to here" scrollbar behaviour; correct
+ computation of scroll view size and position; enforce min scrollbar
+ height to avoid scrollbar component overlap; erase scrollbar area
+ outside of standard width; remove broken auto-adjust code; account for
+ window class when leaving space for grow box; remove code to manually
+ draw grow box; use modern API for thumb scroll proc; replace
+ HiliteControl() by modern API; replace control mgr constants with
+ appearance mgr equivalents.
+
+ * macosx/tkMacOSXSubwindows.c: Use SetWindowBounds() API instead of
+ SizeWindow(); invalidate clip regions after X{Map,Unmap}Window as fix
+ for [Bug 940117] made them dependent on mapping state; remove unneeded
+ calls to TkMacOSXInvalClipRgns() and unnecessary setting of QD port;
+ use native-endian pixmap on intel; remove obsolete pixmap pix locking.
+
+ * macosx/tkMacOSXWindowEvent.c: Handle only the first of a batch of
+ kEventAppAvailableWindowBoundsChanged events sent per transaction;
+ handle kEventWindowBoundsChanged event to support live window resizing
+ and centralized sending of location/size changed ConfigureNotify
+ events; ensure HIGrowBox is redrawn after bounds change; constrain
+ window after dragging to ensure titlebar is not inacessible
+ offscreen or under dock/menubar; handle kEventWindowGetRegion and
+ kEventWindowDrawContent for transparent windows to mark resp. paint
+ content region as transparent; handle kEventWindowConstrain for
+ fullscreen windows to ensure bounds match new screen size; enter/exit
+ fullscreen UIMode upon activation/deactivation of fullscreen window.
+
+ * macosx/tkMacOSXWm.c: Use live-resize and async-drag carbon window
+ * macosx/tkMacOSXWm.h: attributes for toplevels by default; implement
+ new [wm attributes] -topmost, -transparent and -fullscreen; refactor
+ WmAttributesCmd() parallelling the tkUnixWm.c implementation, use thus
+ factored proc to set proxy icon from [wm iconbitmap]; dynamically
+ determine default values for toplevel min and max sizes (similar to
+ tkWinWm.c impl): min sizes depend on window class & attributes to
+ ensure visibility of all titlebar widgets and grow box, max sizes
+ depend on maximal window bounds for all active displays; factor out
+ code that puts into effect changes to master or override_redirect; use
+ RepositionWindow() API to determine staggered initial window bounds;
+ correct resize limit calculations, handle gridding and use modern
+ resize API in TkMacOSXGrowToplevel(); remove sending of ConfigureNotify
+ after resize or zoom (now handled by BoundsChanged handler); correct
+ composite carbon window attribute handling, remove currently unusable
+ attributes and add new attributes in [tk::unsupported::MacWindowStyle];
+ ensure validity of window class and attributes before use; apply
+ changes to window class when handling carbon window attribute changes
+ (if HIWindowChangeClass() API available); add debug build warning
+ message when deprecated window style is used instead of window class;
+ use transparent HIGrowBox for resizable windows; avoid unnecessary
+ calls to window structure width API; use tcl time API in TkpGetMS();
+ add TkMacOSXEnterExitFullscreen() to enter/exit UIMode with dock and
+ menubar hidden; restrict wmTracing output to debug builds; remove
+ unneeded calls to TkMacOSXInvalClipRgns() and unnecessary setting of QD
+ port; workaround GetWindowStructureWidths() Carbon bug (bogus results
+ for never-mapped floating windows).
+
+ * macosx/tkMacOSXXStubs.c (TkMacOSXDisplayChanged): Add maximal window
+ bounds field to Screen record (in ext_data), computed as the union of
+ available window positioning bounds of all graphics devices (displays).
+
+ * macosx/tkMacOSXBitmap.c: Fix macRoman encoding leak.
+ * macosx/tkMacOSXCursor.c:
+
+ * macosx/tkMacOSXDebug.c (TkMacOSXCarbonEventToAscii): Use static
+ * macosx/tkMacOSXDebug.h: buffer to simplify callers; const fixes.
+
+ * macosx/tkMacOSXBitmap.c: Use more efficient QDSwapPort() instead of
+ * macosx/tkMacOSXButton.c: GetPort()/SetPort()/GetGWorld()/SetGWorld().
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXMenubutton.c:
+ * macosx/tkMacOSXScale.c:
+ * macosx/tkMacOSXScrlbr.c:
+ * macosx/tkMacOSXXStubs.c:
+
+ * macosx/tkMacOSXColor.c: Use kHIToolboxVersionNumber for runtime OS
+ * macosx/tkMacOSXEntry.c: version check rather than Gestalt() etc.
+ * macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXWm.c:
+
+ * macosx/tkMacOSXDraw.c: Remove obsolete and now incorrect
+ * macosx/tkMacOSXInt.h: tkMenuCascadeRgn clipping code.
+ * macosx/tkMacOSXMenu.c:
+
+ * macosx/tkMacOSXHLEvents.c: Replace Tcl_GlobalEval() resp. Tcl_Eval()
+ * macosx/tkMacOSXScrlbr.c: by Tcl_EvalEx().
+ * macosx/tkMacOSXInit.c:
+
+ * macosx/tkMacOSXInit.c (TkpInit): Reorder initialization steps.
+
+ * macosx/tkMacOSXKeyEvent.c: Remove pre-10.2 support.
+
+ * macosx/tkMacOSXMenus.c: Remove now useless call to
+ TkMacOSXHandleTearoffMenu(); use \x.. quoting for non-latin1 macroman
+ literar chars to allow file to be edited as utf-8.
+
+ * macosx/tkMacOSXScale.c: Replace TrackControl() by modern
+ * macosx/tkMacOSXScrlbr.c: HandleControlClick() API (using new
+ TkMacOSXModifierState()).
+
+ * macosx/tkMacOSXInt.h: Move all constant #defines needed to
+ * macosx/tkMacOSXColor.c: support building on older OS X releases
+ * macosx/tkMacOSXEvent.h: to a central location in tkMacOSXInt.h.
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXMenubutton.c:
+ * macosx/tkMacOSXMenus.c:
+ * macosx/tkMacOSXMouseEvent.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/ttkMacOSXTheme.c:
+
+ * macosx/tkMacOSXInt.h: Add ChkErr() macro to factor out
+ * macosx/tkMacOSXButton.c: Carbon OSStatus return value checking
+ * macosx/tkMacOSXCarbonEvents.c: and TkMacOSXDbgMsg() macro to factour
+ * macosx/tkMacOSXClipboard.c: out debug message output; use these
+ * macosx/tkMacOSXColor.c: macros to replace #ifdef TK_MAC_DEBUG
+ * macosx/tkMacOSXCursor.c: blocks & direct printing to stderr,
+ * macosx/tkMacOSXDebug.c: and to do additional OSStatus return
+ * macosx/tkMacOSXDialog.c: checking, and to standardize OSStatus
+ * macosx/tkMacOSXDraw.c: usage.
+ * macosx/tkMacOSXEntry.c:
+ * macosx/tkMacOSXEvent.c:
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXHLEvents.c:
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXKeyEvent.c:
+ * macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXMenubutton.c:
+ * macosx/tkMacOSXMenus.c:
+ * macosx/tkMacOSXMouseEvent.c:
+ * macosx/tkMacOSXScrlbr.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXXStubs.c:
+
+ * macosx/tkMacOSXSend.c: Remove duplicate/unused declarations.
+ * macosx/tkMacOSXXStubs.c:
+
+ * macosx/tkMacOSXDebug.c: Const fixes.
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXTest.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXXStubs.c:
+
+ * macosx/Wish-Info.plist.in: Add tcl document extensions/mime types and
+ LSMinimumSystemVersion, LSRequiresCarbon & NSAppleScriptEnabled keys.
+
+ * macosx/Wish-Common.xcconfig: Add Wish's Info.plist as __info_plist
+ section to tktest; enable more warnings.
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Add 'DebugMemCompile' build
+ configuration that calls configure with --enable-symbols=all; disable
+ configure check for __attribute__((__visibility__("hidden"))) in Debug
+ configuration to restore availability of ZeroLink.
+
+ * macosx/Wish-Common.xcconfig: Fix whitespace.
+ * macosx/Wish-Debug.xcconfig:
+ * macosx/Wish-Release.xcconfig:
+ * macosx/tkMacOSXAETE.r:
+ * macosx/tkMacOSXConfig.c:
+ * macosx/tkMacOSXCursors.r:
+ * macosx/tkMacOSXKeyboard.c:
+ * macosx/tkMacOSXSend.c:
+ * macosx/ttkMacOSXTheme.c:
+ * macosx/tkMacOSXXCursors.r:
+ * macosx/README:
+
+ * macosx/GNUmakefile: Fix/add copyright and license refs.
+ * macosx/Tk-Info.plist.in:
+ * macosx/Wish-Info.plist.in:
+ * macosx/Wish.xcode/project.pbxproj:
+ * macosx/Wish.xcodeproj/project.pbxproj:
+ * macosx/tkMacOSX.h:
+
+ * unix/configure.in: Install license.terms into Tk.framework; fix tk
+ debug build detection.
+ * unix/configure: autoconf-2.59
+
+ * doc/colors.n: Document new Mac OS X system colors.
+ * doc/cursors.n: Document new Mac OS X native cursors.
+ * doc/font.n: Document new Mac OS X 'menu' system font.
+ * doc/wm.n: Document new Mac OS X [wm attributes].
+ * doc/ttk_image.n: Fix 'make html' warning.
+ * doc/canvas.n: Fix nroff typo.
+
+2007-04-21 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/tkMacOSXBitmap.c, macosx/tkMacOSXButton.c:
+ * macosx/tkMacOSXCarbonEvents.c, macosx/tkMacOSXClipboard.c:
+ * macosx/tkMacOSXCursor.c, macosx/tkMacOSXDialog.c:
+ * macosx/tkMacOSXDraw.c, macosx/tkMacOSXEvent.c:
+ * macosx/tkMacOSXFont.c, macosx/tkMacOSXInit.c, macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXKeyEvent.c, macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXMenubutton.c, macosx/tkMacOSXMouseEvent.c:
+ * macosx/tkMacOSXScale.c, macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c: Revert of commits from 2007-04-13 which broke
+ the OS X build.
+
+2007-04-17 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tkFont.c, generic/tkListbox.c, unix/tkUnixSelect.c:
+ * win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c: Make
+ the format of declarations much more standardized (removing K&R-isms
+ and other things like that).
+
+2007-04-13 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * macosx/tkMacOSXInt.h (LOG_MSG, LOG_ON_ERROR): Added macros to make
+ the OSX code much less #ifdef-full.
+
+2007-04-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/ttk/panedwindow.tcl (ttk::panedwindow::Press): handle Press
+ triggering outside sash element boundaries.
+
+2007-04-10 Joe English <jenglish@users.sourceforge.net>
+
+ * win/ttkWinMonitor.c, win/ttkWinXPTheme.c: Re-sync with Tile codebase
+ so patches can flow back and forth.
+
+ * win/ttkWinXPTheme.c: Skip OS version test, should work on Vista/Aero
+ now as well as XP. Fixes [Bug 1687299], thanks to George Petasis for
+ tracking this down.
+
+2007-03-21 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkLayout.c(Ttk_BuildLayoutTemplate): BUGFIX: Nested
+ TTK_GROUP nodes did not work unless they appeared at the end of the
+ layout (and only by accident then).
+
+2007-03-08 Joe English <jenglish@users.sourceforge.net>
+
+ * tests/grid.test(grid-21.7): Reset wm geometry . and pack propagate .
+ at end of test. 'pack propagate . 0' was causing cascading failures in
+ subsequent tests. [Bug 1676770]
+
+2007-03-07 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkMain.c (Tk_MainEx): Replicate macosx-specific code from
+ TkpInit() that ensures the console window appears when wish is started
+ from the OS X Finder (i.e. with stdin == /dev/null), jeffh's 2006-11-24
+ change rendered the corresponding code in TkpInit() ineffective in wish
+ because Tk_MainEx() sets tcl_interactive before calling TkpInit().
+
+ * generic/ttk/ttkGenStubs.tcl (new): Add ttk-specific genstubs.tcl from
+ * unix/Makefile.in (genstubs): tile and run it from 'genstubs'
+ target, restores ability to generate all of Tk's stub sources.
+
+ * generic/ttk/ttkTreeview.c: #ifdef out unused declaration.
+
+ * macosx/tkMacOSXDebug.c (TkMacOSXGetNamedDebugSymbol): Add fix for
+ libraries loaded with a DYLD_IMAGE_SUFFIX.
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Ensure gcc version used by
+ * macosx/Wish.xcodeproj/default.pbxuser: Xcode and configure/make are
+ * macosx/Wish-Common.xcconfig: consistent and independent of
+ gcc_select default and CC env var; fixes for Xcode 3.0.
+
+ * unix/tcl.m4 (Darwin): s/CFLAGS/CPPFLAGS/ in macosx-version-min check.
+ * unix/configure: autoconf-2.59
+
+2007-02-25 Peter Spjuth <peter.spjuth@space.se>
+
+ * generic/tkUtil.c: Fixed grid anchor center problem in labelframes.
+ * tests/grid.test: [Bug 1545765]
+
+2007-02-23 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/ttk/notebook.tcl (ttk::notebook::enableTraversal): OS X
+ needs Option instead of Alt binding
+
+2007-02-19 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tcl.m4: use SHLIB_SUFFIX=".so" on HP-UX ia64 arch.
+ * unix/configure: autoconf-2.59
+
+ * library/tkfbox.tcl (::tk::IconList_Goto): avoid goto issues in empty
+ dirs. [Bug 1662959]
+
+2007-02-09 Joe Mistachkin <joe@mistachkin.com>
+
+ * win/nmakehlp.c: Properly cleanup after nmakehlp, including the
+ * win/makefile.vc: vcX0.pch file. Sync up fixed nmakehlp usage from
+ Tcl.
+
+2007-02-06 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/ttk.tcl: Add no-op [package ifneeded] script for tile
+ 0.8.0, so that existing applications that use "package require tile"
+ won't fail when run under Tk 8.5.
+
+2007-02-04 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/tcl.m4: Use gcc4's __attribute__((__visibility__("hidden"))) if
+ available to define MODULE_SCOPE effective on all platforms.
+ * unix/configure.in: add caching to -pipe check.
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+
+2007-02-03 Joe Mistachkin <joe@mistachkin.com>
+
+ * win/rules.vc: Fix platform specific file copy macros for downlevel
+ Windows.
+ * win/ttkWinMonitor.c: Windows portability support. Fix "noxp" build
+ * win/ttkWinXPTheme.c: option handling and use GetWindowLongPtr and
+ SetWindowLongPtr only when needed.
+
+2007-02-02 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/ttkWinXPTheme.c: Support IsAppThemed() call. This is what is
+ used when theming is turned off just for an individual application.
+
+2007-01-28 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Extract build settings that
+ * macosx/Wish.xcodeproj/default.pbxuser: were common to multiple
+ * macosx/Wish-Common.xcconfig (new file): configurations into external
+ * macosx/Wish-Debug.xcconfig (new file): xcconfig files; add extra
+ * macosx/Wish-Release.xcconfig (new file): configurations for building
+ with SDKs; convert legacy jam-based 'Tk' target to native target with
+ single script phase; correct syntax of build setting references to use
+ $() throughout; remove unused tcltest sources from 'tktest' target.
+
+ * macosx/README: Document new Wish.xcodeproj configurations; other
+ minor updates/corrections.
+
+ * generic/tk.h: Update location of version numbers in macosx files.
+
+ * macosx/Wish.xcode/project.pbxproj: Restore 'tktest' target to working
+ * macosx/Wish.xcode/default.pbxuser: order by replicating applicable
+ changes to Wish.xcodeproj since 2006-07-20.
+
+2007-01-25 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/tcl.m4: Integrate CPPFLAGS into CFLAGS as late as possible and
+ move (rather than duplicate) -isysroot flags from CFLAGS to CPPFLAGS to
+ avoid errors about multiple -isysroot flags from some older gcc builds.
+
+ * unix/configure: autoconf-2.59
+
+2007-01-19 Joe Mistachkin <joe@mistachkin.com>
+
+ * win/makefile.vc: Properly build man2tcl.c for MSVC8.
+
+2007-01-19 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcodeproj/project.pbxproj: Remove libtommath defines.
+
+ * unix/tcl.m4: Ensure CPPFLAGS env var is used when set. [Bug 1586861]
+ (Darwin): add -isysroot and -mmacosx-version-min flags to CPPFLAGS when
+ present in CFLAGS to avoid discrepancies between what headers configure
+ sees during preprocessing tests and compiling tests.
+
+ * unix/configure: autoconf-2.59
+
+2007-01-11 Jeff Hobbs <jeffh@activestate.com>
+
+ * unix/tkUnixEvent.c, library/msgs/es.msg: s/CRLF/LF/g
+
+2007-01-11 Joe English <jenglish@users.sourceforge.net>
+
+ * win/tcl.m4 (CFLAGS_WARNING): Remove "-Wconversion". This was removed
+ from unix/tcl.m4 2004-07-16 but not from here.
+ * win/configure: Regenerated.
+
+2007-01-11 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkManager.h, generic/ttk/ttk*.c: Revert addition of
+ contravariant 'const' qualifiers, to keep in sync with Tile codebase
+ (which must remain compatible with Tk 8.4).
+
+2007-01-03 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * doc/ManageGeom.3,
+ * generic/tk.decls,
+ * generic/tk.h: Add const to 2nd parameter of Tk_ManageGeometry
+ * generic/tkDecls.h: regenerated
+ * generic/tkInt.h,
+ * generic/tk*.c,
+ * generic/ttk/ttk*.c: Added many "const" specifiers in implementation.
+
+2007-01-02 Donal K. Fellows <dkf@users.sf.net>
+
+ * xlib/*: Made the generic fake-X11 glue layer abide by the formatting
+ rules of the core.
+
+2006-12-31 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
+
+ * macosx/tkMacOSXFont.c: Fill-in TkpGetFontAttrsForChar (TIP #300).
+ * macosx/ttkMacOSXTheme.c: Define a constant to make it compile on Mac
+ OS X 10.3.
+
+2006-12-28 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * tests/wm.test: Update wm attributes output so that tests pass after
+ addition of -transparentcolor for Win32.
+
+2006-12-26 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkLabel.c: ImageElement clientData no longer needed.
+
+2006-12-22 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/tkUnixEvent.c (TkUnixDoOneXEvent): Made correct on AMD64 and
+ other similar 64-bit systems where fd_mask is not 'unsigned int' in
+ effect. [Bug 1522467]
+
+ * library/msgs/es_ES.msg (removed):
+ * library/msgs/es.msg: Fixed translation fault that was present in all
+ Spanish-speaking locales. [Bug 1111213]
+
+2006-12-19 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinButton.c (TkpDisplayButton): lint init. [Bug 1618604]
+
+2006-12-19 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/tcl.m4 (Darwin): --enable-64bit: verify linking with 64bit -arch
+ flag succeeds before enabling 64bit build.
+ * unix/configure: autoconf-2.59
+
+2006-12-18 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTreeview.c, library/ttk/treeview.tcl, doc/treeview.n:
+ Added column '-stretch' and '-minwidth' options. Improved column drag
+ and resize behavior. Added horizontal scrolling [Bug 1518650]. Row
+ height and child indent specifiable on Treeview style. Decreased
+ default row height, no default -padding. Use correct heading height
+ [Bug 1163349]. Apply tag settings to tree item as well as to data
+ columns [NOTE: 'tag configure' still buggy]. Fix off-by-one condition
+ when moving nodes forward [Bug 1618142]
+ * generic/ttk/ttkScroll.c (TtkScrollTo): Prevent overscroll [Bug
+ 1173434]
+ * library/ttk/altTheme.tcl, library/ttk/aquaTheme.tcl,
+ * library/ttk/clamTheme.tcl, library/ttk/classicTheme.tcl,
+ * library/ttk/defaults.tcl, library/ttk/winTheme.tcl,
+ * library/ttk/xpTheme.tcl: Per-theme treeview settings.
+ * macosx/ttkMacOSXTheme.c: Added disclosure triangle element.
+
+2006-12-17 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl, generic/ttk/ttkEntry.c,
+ * doc/ttk_combobox.n: Add combobox -height option; only show scrollbar
+ if the listbox needs to scroll. [Bug 1032869]
+
+2006-12-16 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * doc/cursors.n: Mention "none" in supported cursor list. Fix comment
+ that incorrectly claims that the Win32 "no" cursor hides the cursor.
+ * tests/cursor.test: Test "none" cursor.
+ * unix/tkUnixCursor.c (CreateCursorFromTableOrFile)
+ (TkGetCursorByName): Define a table of Tk cursors that is searched in
+ addition to the X cursor table. A Tk cursor is loaded from a data
+ string and works with the same options as the built in X cursors. This
+ code makes it possible to use "none" as a cursor name under Unix.
+ * win/rc/cursor9a.cur: Added none Win32 cursor.
+ * win/rc/tk_base.rc: Define a built-in Win32 cursor named "none".
+ [Patch 1615427]
+
+2006-12-14 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkButton.c, generic/ttk/ttkElements.c,
+ * generic/ttk/ttkEntry.c, generic/ttk/ttkFrame.c,
+ * generic/ttk/ttkImage.c, generic/ttk/ttkInit.c,
+ * generic/ttk/ttkLabel.c, generic/ttk/ttkNotebook.c,
+ * generic/ttk/ttkPanedwindow.c, generic/ttk/ttkProgress.c,
+ * generic/ttk/ttkScale.c, generic/ttk/ttkScrollbar.c,
+ * generic/ttk/ttkSeparator.c, generic/ttk/ttkTheme.h,
+ * generic/ttk/ttkTreeview.c, generic/ttk/ttkWidget.h:
+ Global reduction: use per-file *_Init() routines to reduce the number
+ of globally-visible initialization records.
+
+2006-12-13 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/Makefile.in (install-doc): intentionally skip ttk_dialog.n
+ installation (not for public consumption)
+
+ * doc/scrollbar.n, doc/button.n, doc/checkbutton.n:
+ * doc/entry.n, doc/frame.n, doc/label.n, doc/labelframe.n:
+ * doc/menu.n, doc/menubutton.n, doc/panedwindow.n:
+ * doc/radiobutton.n, doc/scrollbar.n, doc/ttk_*: revamp ttk docs to
+ use consist nroff format (not 100% consistent with classic widget
+ docs). Add more man page cross-linking "SEE ALSO".
+
+ * generic/ttk/ttkInit.c:
+ * generic/ttk/ttkTreeview.c: make treeview exist by default
+ * generic/ttk/ttkPanedwindow.c: s/TtkPaned_Init/TtkPanedwindow_Init/
+
+ * win/Makefile.in, unix/Makefile.in (demo): add 'demo' target
+
+2006-12-13 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/ttk.tcl: Try to straighten out theme loading and
+ selection logic.
+ * generic/ttk/ttkElements.c, library/ttk/defaults.tcl,
+ * generic/ttk/ttkClamTheme.c, library/ttk/clamTheme.tcl:
+ Provide package in C part instead of Tcl part.
+
+2006-12-12 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/ttk.tcl, generic/ttkTheme.c: Remove nonfunctional code.
+
+2006-12-12 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWinButton.c (InitBoxes): Call Tcl_Panic() if loading of bitmap
+ resources fails. This change generates an error if Tk is unable to
+ find button widget resources instead of silently failing and then
+ drawing widgets incorrectly.
+ * win/rc/tk_base.rc: If the user defines BASE_NO_TK_ICON then compile
+ the base resources file without a "tk" icon. This change makes it
+ easier to replace the default tk icon with a custom icon. [Patch
+ 1614362]
+
+2006-12-11 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * unix/tkUnixWm.c (TkWmMapWindow, WmClientCmd): Added support for
+ _NET_WM_PID property from the EWMH spec. This is only installed when
+ the client machine is set.
+ (WmProtocolCmd, UpdateWmProtocols, TkWmProtocolEventProc): Added
+ support for the _NET_WM_PING protocol from the EWMH spec. Note that
+ the support for this is not exposed to the script level as that would
+ prevent correct handling.
+
+2006-12-10 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTheme.h, generic/ttk/ttkThemeInt.h,
+ * generic/ttk/ttk.decls, generic/ttk/ttkTheme.c,
+ * generic/ttk/ttkLayout.c, generic/ttk/ttkDecls.h:
+ Rename typedef Ttk_Element => Ttk_ElementImpl.
+
+2006-12-09 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkButton.c, generic/ttk/ttkImage.c,
+ * generic/ttk/ttkLabel.c, generic/ttk/ttkWidget.h,
+ * generic/ttk/ttkTheme.h, generic/ttk/ttkNotebook.c,
+ * generic/ttk/ttkTreeview.c, doc/ttk_image.n:
+ Merged duplicate functionality between image element factory, image
+ element, and -image option processing. Image element factory now takes
+ an imageSpec argument instead of a separate image name and -map option
+ * tests/ttk/image.test(image-1.1): Can catch this error earlier now.
+
+2006-12-06 Kevin Kenny <kennykb@acm.org>
+
+ * unix/configure.in: Further changes to avoid attempting to link
+ * unix/configure: against Xft libraries in a non-Xft build
+ [Bug 1609616] (dgp)
+
+2006-12-04 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkListbox.c (ConfigureListboxItem): ListboxWorldChanged not
+ needed - just call EventuallyRedrawRange. [Bug 1608046] (rezic)
+
+2006-12-04 Donal K. Fellows <dkf@users.sf.net>
+
+ TIP #286 IMPLEMENTATION
+
+ * generic/tkMenu.c (MenuWidgetObjCmd, MenuDoXPosition):
+ * doc/menu.n, tests/menu.test: Added an [$menu xposition] subcommand
+ which is useful in menubars and when menus use multiple columns. Many
+ thanks to Schelte Bron for the implementation.
+
+2006-12-01 Kevin Kenny <kennykb@acm.org>
+
+ TIP #300 IMPLEMENTATION
+
+ * doc/font.n: Added a [font actual $font $char]
+ * generic/tkFont.c: variant that introspects the font that
+ * generic/tkFont.h: is chosen to render a given character
+ * macosx/tkMacOSXFont.c: in a given nominal font. Added
+ * tests/font.test: documentation and test cases for the
+ * unix/tkUnixFont.c: new command syntax.
+ * unix/tkUnixRFont.c:
+ * win/tkWinFont.c:
+
+2006-12-01 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/wm.n, tests/winWm.test:
+ * win/tkWinWm.c: add -transparentcolor attribute for Windows.
+
+2006-12-01 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkTheme.h, generic/ttk/ttkLayout.c: Dead code removal.
+
+2006-11-30 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXDialog.c (Tk_MessageBoxObjCmd): fix inability to use
+ buttons with standard Escape key binding as -default button (reported
+ on tcl-mac by Hans-Christoph Steiner).
+
+ * macosx/tkMacOSXWm.c (WmAttributesCmd): fix getting [wm attr -alpha].
+ [Bug 1581932]
+
+2006-11-28 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/fonts.tcl: Clean up temporary variables.
+
+2006-11-27 Kevin Kenny <kennykb@acm.org>
+
+ * unix/configure.in: Corrected Xft configuration so that Xft actually
+ does get turned on when available.
+ * unix/configure: autoconf
+
+2006-11-26 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkWidget.c, generic/ttk/ttkPaned.c: Fix [Bug 1603506]
+ * library/ttk/button.tcl, library/ttk/combobox.tcl,
+ * library/ttk/utils.tcl: Rename ttk::CopyBindings to ttk::copyBindings
+ * generic/ttk/ttkTreeview.c, doc/ttk_treeview.n:
+ -displaycolumns {} now means "no columns" instead of "all columns".
+ Use -displaycolumns #all for "all columns". [Bug 1547622]
+
+2006-11-26 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/tcl.m4 (Linux): --enable-64bit support. [Patch 1597389]
+ * unix/configure: autoconf-2.59 [Bug 1230558]
+
+2006-11-24 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/tkMacOSXInit.c (TkpInit): only set tcl_interactive 1 if it
+ isn't already defined. Allows embedders to set it to 0 to prevent the
+ console appearing on OS X. [Bug 1487701]
+
+ * unix/tkUnixMenu.c (DrawMenuUnderline): bound Tcl_UtfAtIndex usage
+ * tests/menu.test (menu-36.1): [Bug 1599877]
+
+2006-11-24 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/altTheme.tcl, library/ttk/clamTheme.tcl,
+ * library/ttk/defaults.tcl, library/ttk/winTheme.tcl,
+ * library/ttk/xpTheme.tcl: explicitly specify -anchor w on TMenubutton
+ * tests/ttk/entry.test: Fixed font dependency; test entry-3.2 should
+ work on all platforms now.
+ * library/classicTheme.tcl: Don't define or use TkClassicDefaultFont.
+ * generic/ttk/ttkTreeview.c, generic/ttk/ttkPanedwindow.c: Handle
+ missing layouts.
+
+2006-11-23 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinMenu.c (TkWinHandleMenuEvent, DrawMenuUnderline): Handle
+ unichar underlining correctly and safely. [Bug 1599877]
+
+2006-11-20 Joe English <jenglish@users.sourceforge.net>
+
+ * win/ttkWinXPTheme.c: Add support for alternate/indeterminate
+ checkbutton state. Fix various spacing parameters [Bug 1596020, patch
+ from Tim Baker]. Remove unused uxtheme hooks.
+
+2006-11-16 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/colors.n, doc/wm.n: Minor fixes, added See Also.
+
+ * doc/labelframe.n: Added an example.
+
+2006-11-15 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/label.n: Added an example and some See Also refs.
+
+ * doc/ConfigWidg.3, doc/bind.n, doc/grid.n, doc/panedwindow.n:
+ * doc/text.n, doc/ttk_Geometry.3, doc/ttk_button.n:
+ * doc/ttk_checkbutton.n, doc/ttk_combobox.n, doc/ttk_dialog.n:
+ * doc/ttk_entry.n, doc/ttk_frame.n, doc/ttk_image.n, doc/ttk_intro.n:
+ * doc/ttk_label.n, doc/ttk_labelframe.n, doc/ttk_menubutton.n:
+ * doc/ttk_notebook.n, doc/ttk_panedwindow.n, doc/ttk_progressbar.n:
+ * doc/ttk_radiobutton.n, doc/ttk_scrollbar.n, doc/ttk_separator.n:
+ * doc/ttk_sizegrip.n, doc/ttk_style.n, doc/ttk_widget.n, doc/wm.n:
+ Convert \fP to \fR so that man-page scrapers have an easier time.
+
+2006-11-14 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkDefaultTheme.c: Fix off-by-one bug in tree indicator
+ size computation [Bug 1596021, patch from Tim Baker]. Increased
+ default size from 7 to 9 pixels.
+
+2006-11-12 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttkScroll.c: *correct* fix for [Bug 1588251].
+
+2006-11-12 Joe English <jenglish@users.sourceforge.net>
+
+ * tests/ttk/ttk.test(ttk-6.9): Workaround for [Bug 1583038]
+
+2006-11-12 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttkScroll.c: Reworked cleanup procedure; "self-cancelling"
+ idle call is not robust, call Tcl_CancelIdleCall() in
+ TtkFreeScrollHandle instead. Fixes [Bug 1588251]
+
+2006-11-10 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcodeproj/project.pbxproj: remove tclParseExpr.c and
+ bwidget.test.
+
+ * unix/tcl.m4 (Darwin): suppress linker arch warnings when building
+ universal for both 32 & 64 bit and no 64bit CoreFoundation is
+ available; sync with tcl tcl.m4 change.
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+
+2006-11-08 Kevin Kenny <kennykb@acm.org>
+
+ * unix/configure.in: Silenced warnings about missing Xft configuration
+ unless --enable-xft is requested explicitly. Also added a few basic
+ checks that we can actually compile and link against Xft headers and
+ libraries. [Bug 1592667]
+ * unix/configure: Regen.
+
+2006-11-07 Kevin Kenny <kennykb@acm.org>
+
+ * unix/configure.in: Made --enable-xft the default.
+ * unix/configure: Regen.
+
+2006-11-06 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/ttk/ttkClassicTheme.c, generic/ttk/ttkPanedwindow.c,
+ * generic/ttk/ttkTheme.c, generic/ttk/ttkTreeview.c,
+ * win/ttkWinXPTheme.c, library/ttk/entry.tcl,
+ * library/ttk/notebook.tcl, library/ttk/panedwindow.tcl,
+ * library/ttk/utils.tcl, tests/ttk/entry.test, tests/ttk/bwidget.test:
+ Miscellaneous minor changes to re-sync Ttk codebase with Tile CVS: fix
+ comments damaged by overzealous search-and-destroy; removed obsolete
+ [style default] synonym for [ttk::style configure]; removed other dead
+ code.
+
+2006-11-03 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/safetk.tcl (::safe::tkTopLevel): Theme it.
+
+ * generic/ttk/ttkLayout.c: We do not want to require tkInt in all
+ * generic/ttk/ttkMananager.h: the ttk files so added the definition
+ * generic/ttk/ttkTheme.h: of MODULE_SCOPE to ttkTheme.h. Ensures
+ * generic/ttk/ttkWinMonitor.c: everyone gets to see the definition
+ from someplace.
+
+ * library/ttk/fonts.tcl: In a safe interp there is no osVersion field
+ in tcl_platform so work around it.
+
+2006-11-02 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/ttk/ttkBlink.c, generic/ttk/ttkButton.c:
+ * generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c:
+ * generic/ttk/ttkDecls.h, generic/ttk/ttkDefaultTheme.c:
+ * generic/ttk/ttkElements.c, generic/ttk/ttkEntry.c:
+ * generic/ttk/ttkFrame.c, generic/ttk/ttkImage.c:
+ * generic/ttk/ttkInit.c, generic/ttk/ttkLabel.c:
+ * generic/ttk/ttkLayout.c, generic/ttk/ttkManager.h:
+ * generic/ttk/ttkNotebook.c, generic/ttk/ttkPanedwindow.c:
+ * generic/ttk/ttkProgress.c, generic/ttk/ttkScale.c:
+ * generic/ttk/ttkScroll.c, generic/ttk/ttkScrollbar.c:
+ * generic/ttk/ttkSeparator.c, generic/ttk/ttkSquare.c:
+ * generic/ttk/ttkStubInit.c, generic/ttk/ttkStubLib.c:
+ * generic/ttk/ttkTheme.c, generic/ttk/ttkTheme.h:
+ * generic/ttk/ttkThemeInt.h, generic/ttk/ttkTrack.c:
+ * generic/ttk/ttkTreeview.c, generic/ttk/ttkWidget.c:
+ * generic/ttk/ttkWidget.h, macosx/ttkMacOSXTheme.c:
+ * win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c: ensure
+ all global Ttk symbols have Ttk or ttk prefix; declare all externally
+ visible Ttk symbols not contained in stubs table as MODULE_SCOPE (or as
+ static when possible); so that 'make check{exports,stubs}' once again
+ complete without errors.
+
+ * macosx/tkMacOSXColor.c (TkMacOSXCompareColors): ifdef out when unused
+
+ * macosx/Wish.xcodeproj/project.pbxproj: check autoconf/autoheader exit
+ status and stop build if they fail.
+
+ * macosx/tkMacOSXWindowEvent.c (GenerateUpdateEvent): fix handling of
+ Carbon Update events: the QuickDraw window update region was being
+ ignored and all child TkWindows were sent an Expose XEvent even when
+ they did not need to be redrawn. [Patch 1589226]
+
+2006-11-01 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXDebug.c: add TkMacOSX prefix to leftover
+ * macosx/tkMacOSXDebug.h: macosx-private global symbols without Tk
+ * macosx/tkMacOSXEmbed.c: prefix; ifdef out currently unused debug
+ * macosx/tkMacOSXEvent.c: procs.
+ * macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXCarbonEvents.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWm.c:
+
+2006-10-31 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/makefile.vc: Added ttk files to msvc build and add manifest
+ * win/rules.vc: files to binaries with MSVC8.
+
+2006-10-31 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add new Ttk files.
+
+ * macosx/ttkMacOSXTheme.c: standardize header #includes.
+
+ * unix/Makefile (checkstubs, checkexports): check ttk.decls, allow
+ export of Ttk prefixed symbols.
+
+ * generic/ttk/tkDefaultTheme.c: fix warnings.
+
+2006-10-30 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/ttk_Geometry.3, doc/ttk_Theme.3, doc/ttk_button.n:
+ * doc/ttk_checkbutton.n, doc/ttk_combobox.n, doc/ttk_dialog.n:
+ * doc/ttk_entry.n, doc/ttk_frame.n, doc/ttk_image.n:
+ * doc/ttk_intro.n, doc/ttk_label.n, doc/ttk_labelframe.n:
+ * doc/ttk_menubutton.n, doc/ttk_notebook.n, doc/ttk_panedwindow.n:
+ * doc/ttk_progressbar.n, doc/ttk_radiobutton.n, doc/ttk_scrollbar.n:
+ * doc/ttk_separator.n, doc/ttk_sizegrip.n, doc/ttk_style.n:
+ * doc/ttk_treeview.n, doc/ttk_widget.n,:
+ * generic/ttk/ttk.decls, generic/ttk/ttkBlink.c:
+ * generic/ttk/ttkButton.c, generic/ttk/ttkCache.c:
+ * generic/ttk/ttkClamTheme.c, generic/ttk/ttkClassicTheme.c:
+ * generic/ttk/ttkDecls.h, generic/ttk/ttkDefaultTheme.c:
+ * generic/ttk/ttkElements.c, generic/ttk/ttkEntry.c:
+ * generic/ttk/ttkFrame.c, generic/ttk/ttkImage.c:
+ * generic/ttk/ttkInit.c, generic/ttk/ttkLabel.c:
+ * generic/ttk/ttkLayout.c, generic/ttk/ttkManager.c:
+ * generic/ttk/ttkManager.h, generic/ttk/ttkNotebook.c:
+ * generic/ttk/ttkPanedwindow.c, generic/ttk/ttkProgress.c:
+ * generic/ttk/ttkScale.c, generic/ttk/ttkScroll.c:
+ * generic/ttk/ttkScrollbar.c, generic/ttk/ttkSeparator.c:
+ * generic/ttk/ttkSquare.c, generic/ttk/ttkState.c:
+ * generic/ttk/ttkStubInit.c, generic/ttk/ttkStubLib.c:
+ * generic/ttk/ttkTagSet.c, generic/ttk/ttkTheme.c:
+ * generic/ttk/ttkTheme.h, generic/ttk/ttkThemeInt.h:
+ * generic/ttk/ttkTrace.c, generic/ttk/ttkTrack.c:
+ * generic/ttk/ttkTreeview.c, generic/ttk/ttkWidget.c:
+ * generic/ttk/ttkWidget.h:
+ * library/demos/ttk_demo.tcl, library/demos/ttk_iconlib.tcl:
+ * library/demos/ttk_repeater.tcl:
+ * library/ttk/altTheme.tcl, library/ttk/aquaTheme.tcl:
+ * library/ttk/button.tcl, library/ttk/clamTheme.tcl:
+ * library/ttk/classicTheme.tcl, library/ttk/combobox.tcl:
+ * library/ttk/cursors.tcl, library/ttk/defaults.tcl:
+ * library/ttk/dialog.tcl, library/ttk/entry.tcl:
+ * library/ttk/fonts.tcl, library/ttk/icons.tcl:
+ * library/ttk/keynav.tcl, library/ttk/menubutton.tcl:
+ * library/ttk/notebook.tcl, library/ttk/panedwindow.tcl:
+ * library/ttk/progress.tcl, library/ttk/scale.tcl:
+ * library/ttk/scrollbar.tcl, library/ttk/sizegrip.tcl:
+ * library/ttk/treeview.tcl, library/ttk/ttk.tcl:
+ * library/ttk/utils.tcl, library/ttk/winTheme.tcl:
+ * library/ttk/xpTheme.tcl:
+ * macosx/ttkMacOSXTheme.c:
+ * tests/ttk/all.tcl, tests/ttk/bwidget.test, tests/ttk/combobox.test:
+ * tests/ttk/entry.test, tests/ttk/image.test:
+ * tests/ttk/labelframe.test, tests/ttk/layout.test:
+ * tests/ttk/misc.test, tests/ttk/notebook.test:
+ * tests/ttk/panedwindow.test, tests/ttk/progressbar.test:
+ * tests/ttk/scrollbar.test, tests/ttk/treetags.test:
+ * tests/ttk/treeview.test, tests/ttk/ttk.test, tests/ttk/validate.test:
+ * win/ttkWinMonitor.c, win/ttkWinTheme.c, win/ttkWinXPTheme.c:
+ First import of Ttk themed Tk widgets as branched from tile 0.7.8
+
+ * generic/tkInt.h, generic/tkWindow.c: add Ttk_Init call, copy tk
+ classic widgets to ::tk namespace.
+ * library/tk.tcl: add source of ttk/ttk.tcl, define $::ttk::library.
+ * unix/Makefile.in, win/Makefile.in: add Ttk build bits
+ * win/configure, win/configure.in: check for uxtheme.h (XP theme).
+
+2006-10-23 Don Porter <dgp@users.sourceforge.net>
+
+ * README: Bump version number to 8.5a6
+ * generic/tk.h:
+ * library/tk.tcl:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
+
+2006-10-19 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ *** 8.5a5 TAGGED FOR RELEASE ***
+
+ * generic/tkImgBmap.c: Fixed line endings.
+ * win/makefile.vc: Patched up build system to manage
+ * win/rules.vc: AMD64 with MSVC8
+ * win/nmakehlp.c: Ensure operation without Platform SDK.
+
+2006-10-18 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: 8.5a5 release date set.
+
+2006-10-17 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/text.n: fix docs to not correct -tabs usage case.
+
+ * generic/tkTextDisp.c (SizeOfTab): fix -tabstyle wordprocessor tab
+ alignment to correct tab edge case. [Bug 1578858]
+
+2006-10-17 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkText.c: Applied suggested patch from [Bug 1536735]
+ * tests/text.test: Update test for above patch.
+ * tests/textWind.test: Corrected test to catch all messages
+ * tests/safe.test: Silence spurious win32 failure awaiting TIP150
+ * tests/winDialog.test: Updated test for file name length check.
+ * test/winWm.test: Corrected test expectation for menu wrapping.
+
+2006-10-16 Andreas Kupries <andreask@activestate.com>
+
+ * doc/WindowId.3: Pat's commit on 2006-10-08 broke the .SH NAME
+ information across several lines, breaking the cross-linking of
+ manpages during installation for this one. Put everything back on a
+ single line, unbreaking it.
+
+2006-10-16 Daniel Steffen <das@users.sourceforge.net>
+
+ * changes: updates for 8.5a5 release.
+
+ * macosx/tkMacOSXDraw.c: fix numerous issues in CG and QD drawing
+ procs so that they now match X11 drawing much more closely [Bug
+ 1558051]; use Tiger ellipse drawing API when available; fix comments &
+ whitespace.
+
+ * macosx/tkMacOSXInit.c: set default linewidth limit for CG
+ antialiasing to 0 as thin horizontal/vertical lines look good now.
+ * macosx/README: document CG antialiasing limit changes.
+
+ * generic/tkCanvLine.c (ConfigureLine): on TkAqua, pass outline
+ * generic/tkCanvPoly.c (ConfigurePolygon): linewidth in gc even for
+ * generic/tkRectOval.c (ConfigureRectOval): fills (as it controls AA).
+
+ * macosx/GNUmakefile: don't redo prebinding of non-prebound binaires.
+
+ * library/demos/pendulum.tcl: fix incorrect setting of toplevel title.
+
+2006-10-10 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updates for 8.5a5 release
+
+2006-10-08 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * generic/tkWindow.c: Implemented TIP #264 - Tk_Interp function.
+ * doc/WindowId.3: Documented Tk_Interp.
+ * generic/tk.decls: Added to the stubs interface and
+ * generic/tkDecls.h: regenerated.
+ * generic/tkStubsInit.c:
+
+2006-10-05 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tkUnixFont.c (Ucs2beToUtfProc, UtfToUcs2beProc):
+ (TkpFontPkgInit, encodingAliases): Correct alignment issues in
+ encoding conversion. Call ucs-2be "unicode" on big-endian systems.
+ [Bug 1122671]
+
+2006-09-27 Andreas Kupries <andreask@activestate.com>
+
+ * unix/Makefile.in (install-binaries): Added a second guard to the
+ * win/Makefile.in: package index file to prevent older versions of Tcl
+ * win/makefile.vc: from seeing version numbers which may contain a/b
+ information, and then balking on them. This could otherwise happen
+ when Tcl/Tk 8.4 and 8.5 are installed in the same directory, seeing
+ each other. [Bug 1566418]
+
+2006-09-22 Andreas Kupries <andreask@activestate.com>
+
+ * generic/tkConsole.c: TIP #268 update regarding registered package
+ * generic/tkMain.c: version, now using full patchlevel instead of
+ * generic/tkWindow.c: major.minor
+ * library/tk.tcl:
+ * unix/configure:
+ * unix/Makefile.in:
+ * unix/tcl.m4:
+ * win/configure:
+ * win/Makefile.in:
+ * win/makefile.vc:
+ * win/rules.vc:
+ * win/tcl.m4:
+
+2006-09-20 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinMenu.c (TkpPostMenu): disable menu animation in menus with
+ images to avoid clipping bug. [Bug 1329198]
+
+2006-09-21 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkImgBmap.c (ImgBmapPostscript): Change 0 to NULL, since
+ they are not interchangable on all platforms in all circumstances.
+ [Tcl Bug 1562528]
+
+2006-09-11 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXWm.c (TkMacOSXMakeRealWindowExist): revert part of
+ 2006-05-16 change that had set overrideredirect windows to not become
+ activated by the window manager, as this prevented interaction with
+ native widgets in such windows [Bug 1472624]; apply changes to carbon
+ window attributes even if native window has already been created.
+
+ * macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): fix app
+ * macosx/tkMacOSXMenu.c (DrawMenuBarWhenIdle): menu item key shortcuts
+ * macosx/tkMacOSXInt.h: when custom ".apple" menu is installed.
+
+ * library/demos/widget: on TkAqua, don't install file menu with single
+ quit menu item, as the application menu already has a quit item.
+
+ * macosx/tkMacOSXColor.c: fix building on Mac OS X 10.2.
+
+2006-09-10 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXColor.c (TkSetMacColor,TkpGetColor): use AppearanceMgr
+ * macosx/tkMacOSXDefault.h: to retrieve platform std colors for text
+ * macosx/tkMacOSXPort.h: selections, add "systemHighlightSecondary"
+ color name for standard color of inactive selections, use this color as
+ default for text widget -inactiveselectbackground to implement platform
+ standard look for inactive text selections.
+
+ * library/text.tcl (aqua): remove focus bindings to set selection color
+
+ * generic/tkTextBTree.c (TkTextIsElided): on TkAqua, don't show
+ * generic/tkTextDisp.c (GetStyle): inactive text selection when
+ text widget is disabled.
+
+ * generic/tkEntry.c (DisplayEntry): change default TkAqua selection
+ * macosx/tkMacOSXDefault.h: relief to "flat" (platform std).
+
+ * generic/tkText.c (CreateWidget): fix bug leading to default text
+ selection relief string DEF_TEXT_SELECT_RELIEF being ignored.
+
+ * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): allow mouse
+ event delivery to background windows with kWindowNoActivatesAttribute
+ (e.g. overrideredirect windows), as these never come to the foreground
+ they would never receive any mouse events otherwise. [Bug 1472624]
+
+ * macosx/tkMacOSXWindowEvent.c (TkMacOSXGenerateFocusEvent): do not
+ send focus events to any windows with kWindowNoActivatesAttribute.
+
+ * macosx/tkMacOSXXStubs.c (XQueryColor, XQueryColors): implement basic
+ XColor computation from pixel values, enough to make tkImg's window.c
+ happy, fixes img::window failures reported on tcl-mac.
+
+ * macosx/tkMacOSXMenu.c (DrawMenuEntryLabel): fix leak. [Bug 1554672]
+
+ * macosx/GNUmakefile: workaround bug in 'cp -pRH' on Darwin 6 and
+ earlier, fixes 'make embedded' failure reported on tcl-mac; fix error
+ from 'make deploy' with same build tree as previous 'make embedded'.
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add new tclUnixCompat.c file.
+
+ * macosx/tkMacOSXEntry.c (TkpDrawEntryBorderAndFocus): fix typo.
+
+ * unix/tcl.m4: sync with tcl/unix/tcl.m4.
+ * unix/configure: autoconf-2.59
+
+2006-09-06 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkEntry.c: move hard-coded ALWAYS_SHOW_SELECTION control
+ * generic/tkInt.h: of entry/text selection display based on focus
+ * generic/tkText.c: to the Tcl level, controlled by
+ * generic/tkWindow.c: ::tk::AlwaysShowSelection (boolean, private).
+ * library/tk.tcl: [Bug 1553691]
+ * macosx/tkMacOSXDefault.h:
+ * unix/tkUnixDefault.h:
+ * unix/tkUnixPort.h:
+ * win/tkWinDefault.h:
+
+2006-08-30 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinKey.c: Add WM_UNICHAR window message support (used by
+ * win/tkWinX.c: virtual keyboard apps). [Bug 1518677] (petasis)
+
+2006-08-24 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXScrlbr.c (UpdateControlValues): set native scrollbar
+ control bounds only once all size adjustments have been computed.
+ Fixes issue with grow icon obscuring scrollbar reported on tcl-mac.
+
+2006-08-21 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXCarbonEvents.c (CarbonTimerProc): avoid starving main
+ event loop: limit the number of tcl events processed per invocation.
+ Fixes bug reported on tcl-mac by Kevan Hashemi.
+
+2006-08-18 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * tests/text.test (text-25.15): Added test suggested by Sam
+ <baudinm@yahoo.com> on comp.lang.tcl
+
+ * generic/tk.h, generic/tkInt.h: Stylistic improvements. No API change.
+
+2006-08-18 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/tcl.m4 (Darwin): add support for --enable-64bit on x86_64, for
+ universal builds including x86_64, for 64-bit CoreFoundation on Leopard
+ and for use of -mmacosx-version-min instead of MACOSX_DEPLOYMENT_TARGET
+ * unix/configure.in (Darwin): remove 64-bit arch flags from CFLAGS for
+ combined 32-bit and 64-bit universal builds, as neither TkAqua nor
+ TkX11 can be built for 64-bit at present.
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+
+ * macosx/Wish.xcodeproj/project.pbxproj: switch native release targets
+ to use DWARF with dSYM, Xcode 3.0 changes.
+ * macosx/README: updates for x86_64 support in Tcl.
+
+ * macosx/tkMacOSXInit.c (TkpInit): when available, use public
+ TransformProcessType() API instead of CPSEnableForegroundOperation()
+ SPI to notify the window server that we are a GUI application.
+
+ * macosx/tkMacOSXWm.c (WmAttrGetTitlePath): use HIWindow API on >=Tiger
+
+ * macosx/tkMacOSXMouseEvent.c (GenerateToolbarButtonEvent):
+ * macosx/tkMacOSXMenus.c (GenerateEditEvent):
+ * macosx/tkMacOSXMenu.c (MenuSelectEvent): bzero() the XVirtualEvent
+ structure before use to ensure all fields are initialized. [Bug
+ 1542205]
+
+2006-08-16 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/tkMacOSXWm.c (WmAttributesCmd): correct OS X result for [wm
+ attributes $top].
+
+2006-07-25 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): handle key
+ shortcut for kHICommandQuit in the same way as other application menu
+ item key shortcuts. [Bug 1516950]
+
+2006-07-24 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXWm.c (TkWmMapWindow): fix incorrect values of wmInfo
+ parentWidth/Height for toplevels by recalculating them once the window
+ is mapped (i.e once the window&structure sizes are known). [Bug
+ 1358663]
+ (ParseGeometry): sync with ParseGeometry in tkUnixWm.c/tkWinWm.c.
+
+2006-07-21 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkBind.c (TkBindInit): for REDO_KEYSYM_LOOKUP, change
+ keysym-to-string mapping hash to use first name in ks_names.h instead
+ of last (if there are multiple possibilities), e.g. "F11" instead of
+ "L1".
+
+ * macosx/tkMacOSXKeyboard.c (TkpGetKeySym): correct keysyms for pure
+ modifier key presses [Bugs 700311, 1525905]; correct keysym for Enter
+ key; add keysyms for new NumLock and Fn modifiers (added 2005-08-09).
+
+2006-07-20 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXWm.c (WmAttributesCmd, WmIconbitmapCmd): add support
+ * unix/tkUnixSend.c (Tk_GetUserInactiveTime): for weakly
+ importing symbols not available on OSX 10.2 or 10.3, enables binaires
+ built on later OSX versions to run on earlier ones.
+ * macosx/Wish.xcodeproj/project.pbxproj: enable weak-linking; turn on
+ extra warnings.
+ * macosx/README: document how to enable weak-linking; cleanup.
+ * unix/configure.in: add check on Darwin-X11 for ld support of -weak-l
+ * unix/tcl.m4: flag and weak-link libXss if possible as it is not
+ available before OSX 10.4; enforce requirement of OSX 10.2 for TkAqua;
+ move Darwin specific checks & defines that are only relevant to the tcl
+ build out of tcl.m4; restrict framework option to Darwin; clean up
+ quoting and help messages.
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+
+ * macosx/GNUmakefile: enable xft for TkX11 build.
+ * macosx/tkMacOSXFont.c (TkMacOSXQuarzStartDraw, TkMacOSXQuarzEndDraw):
+ verify validity of context returned from QDBeginCGContext() before use.
+ * macosx/tkMacOSXKeyEvent.c: ifdef out diagnostic messages to stderr.
+
+ * macosx/tkMacOSXEvent.h: standardize MAC_OS_X_VERSION_MAX_ALLOWED
+ * macosx/tkMacOSXMenu.c: checks per QA1316, ensure define can be
+ * macosx/tkMacOSXMenubutton.c: overridden on command line (from default
+ * macosx/tkMacOSXMenus.c: of current OS version).
+ * macosx/tkMacOSXMouseEvent.c:
+ * macosx/tkMacOSXWm.c:
+
+ * generic/tkImgGIF.c (ReadImage):
+ * macosx/tkMacOSXCursor.c (TkMacOSXCursor):
+ * macosx/tkMacOSXDebug.c (TkMacOSXGetNamedDebugSymbol):
+ * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext):
+ * macosx/tkMacOSXInit.c (Map):
+ * xlib/xgc.c (XCreateGC): fix signed-with-unsigned comparison and other
+ warnings from gcc4 -Wextra.
+
+2006-07-14 Andreas Kupries <andreask@activestate.com>
+
+ * generic/tkWindow.c (Initialize): Modify change of 2006-05-25 (jeffh).
+ Release mutex a bit earlier, to prevent lock when OS X creates its
+ console windows (recursively enters Tk_Init). Patch by JeffH.
+
+2006-07-06 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/tkfbox.tcl: catch scrollbar use of highlightthickness
+
+2006-06-21 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/bgerror.tcl (::tk::dialog::error::bgerror): remove a couple
+ of unnecessary hardcoded options
+
+2006-06-14 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkScale.c: Revised variable writing logic to account for
+ [scale]'s design that it deals with its value as a formatted string,
+ and not as a double. [Bug 891141]
+
+2006-06-14 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXSubwindows.c (TkMacOSXInvalidateWindow): ensure
+ invalid clip regions are recreated via TkMacOSXUpdateClipRgn() before
+ they are used; correct call order of TkMacOSXInvalidateWindow() and
+ TkMacOSXInvalClipRgns() throughout. [Bug 1501922]
+
+ * macosx/tkMacOSXDraw.c (TkPutImage): implement drawing of very wide
+ images in slices of less than 4096 pixels to workaround CopyBits
+ limitation. [Bug 950121]
+
+2006-06-09 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkMain.c: Added Tcl_Preserve() call on the master interp
+ as crash protection against any Tcl_DeleteInterp() call that might
+ happen.
+
+2006-06-01 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkConsole.c: Added Tcl_RegisterChannel() calls to bump the
+ refcount of channels passed to Tcl_SetStdChannel(). This prevents early
+ free-ing of the channels that leads to crashes. [Bug 912571]
+
+2006-05-29 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinEmbed.c (TkpGetOtherWindow): Do not panic if no window is
+ * unix/tkUnixEmbed.c (TkpGetOtherWindow): found; caller handles. [Bug
+ * unix/tkUnixWm.c (Tk_CoordsToWindow, UpdateGeometryInfo): 1212056]
+
+ * tests/entry.test (entry-22.1):
+ * tests/listbox.test (listbox-6.15):
+ * generic/tkListbox.c (ListboxInsertSubCmd, ListboxDeleteSubCmd):
+ Ignore Tcl_SetVar2Ex failure of listVarName, similar to entry widget
+ handling. [Bug 1424513]
+
+2006-05-26 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/tkMacOSXButton.c (TkMacOSXDrawControl): correct redraw for
+ direct transition from disabled to active state. [Bug 706446]
+
+2006-05-25 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinMenu.c (TkWinMenuKeyObjCmd): get eventPtr after we know the
+ window is still alive. [AS bug 45987] [Bug 1236306]
+
+ * generic/tkMenu.c (DeleteMenuCloneEntries): Modify entry index
+ changes to work around VC6 optimization bug. [Bug 1224330]
+
+ * generic/tkMessage.c (MessageWidgetObjCmd): Correct msgPtr
+ preserve/release pairing. [Bug 1485750] (afredd)
+
+ * generic/tkWindow.c (Initialize): Correct mutex (un)lock pairing.
+ [Bug 1479587] (loewis)
+
+ * generic/tkBind.c (Tk_BindEvent, TkCopyAndGlobalEval): use Tcl_EvalEx
+ instead of Tcl_GlobalEval.
+
+2006-05-16 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXWindowEvent.c (TkMacOSXGenerateFocusEvent): don't send
+ focus events to windows of class help or to overrideredirect windows.
+ [Bug 1472624]
+
+ * macosx/tkMacOSXWm.c: set overrideredirect windows to not become
+ activated by the window manager and to not receive OS activate events
+ (should make them behave more like on other platforms); use modern
+ window class API for overrideredirect and transient windows; set the
+ default class of overrideredirect windows to 'simple' rather than
+ 'plain' (i.e. no window frame); add missing Panther and Tiger window
+ attributes to [::tk::unsupported::MacWindowStyle].
+
+2006-05-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock): Fix
+ opt added 2006-03 that caused slowdown for some common cases. [Bug
+ 1409140]
+
+2006-05-13 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkCanvWind.c (DisplayWinItem, WinItemRequestProc): ensure
+ canvas window items are unmapped when canvas is unmapped. [Bug 940117]
+
+ * macosx/tkMacOSXSubwindows.c (TkMacOSXUpdateClipRgn): empty clip
+ region of unmapped windows to prevent any drawing into them or into
+ their children from becoming visible. [Bug 940117]
+
+ * macosx/tkMacOSXInt.h: revert Jim's attempt of 2005-03-14 to
+ * macosx/tkMacOSXSubwindows.c: fix Bug 940117 as it disables Map/Unmap
+ event propagation to children. [Bug 1480105]
+
+ * macosx/tkMacOSXDraw.c (TkPutImage): handle tkPictureIsOpen flag,
+ fixes incorrect positioning of images with complex alpha on native
+ buttons; actual alpha blending is still broken in this situation. [Bug
+ 1155596]
+
+ * macosx/tkMacOSXEvent.c (TkMacOSXProcessCommandEvent):
+ * macosx/tkMacOSXMenus.c (TkMacOSXInitMenus): workaround carbon bug
+ with key shortcut for 'Preferences' app menu item. [Bug 1481503]
+
+ * macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): only check
+ for HICommand menu item shortcuts in the application menu.
+
+ * macosx/tkMacOSXInt.h: initialize keyboard layout setup in
+ * macosx/tkMacOSXInit.c: TkpInit() rather than during handling of
+ * macosx/tkMacOSXKeyEvent.c: first key down event.
+
+ * macosx/tkMacOSXDraw.c: add optional debug code to flash clip
+ * macosx/tkMacOSXSubwindows.c: regions during update or draw.
+
+2006-05-04 Don Porter <dgp@users.sourceforge.net>
+
+ * README: Bump version number to 8.5a5
+ * generic/tk.h:
+ * unix/configure.in:
+ * unix/tk.spec:
+ * win/configure.in:
+
+ * unix/configure: autoconf-2.59
+ * win/configure:
+
+2006-04-28 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXWm.c (TkWmMapWindow, InitialWindowBounds): fix use of
+ potentially stale window position in initial configure event on first
+ map of a window. [Bug 1476443]
+ (TkMacOSXWindowOffset): use modern GetWindowStructureWidths API.
+
+ * macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXMouseEvent.c (TkGenerateButtonEventForXPointer): new
+ internal function to generate button events for current pointer
+ directly, without requiring prior call to XQueryPointer().
+
+ * macosx/tkMacOSXMouseEvent.c (XQueryPointer): implement return of
+ window-local pointer position.
+
+ * macosx/tkMacOSXInt.h: use improvements above to avoid calls to
+ * macosx/tkMacOSXKeyEvent.c: GlobalToLocal() when the current port
+ * macosx/tkMacOSXMenu.c: might not be set correctly. May fix [Bug
+ * macosx/tkMacOSXMenus.c: 1243318]
+ * macosx/tkMacOSXScale.c:
+ * macosx/tkMacOSXScrlbr.c:
+
+ * tkAboutDlg.r: update copyright.
+
+ * macosx/tkMacOSXDebug.h: sync #includes with core-8-4-branch.
+ * macosx/tkMacOSXEvent.h:
+ * macosx/tkMacOSXFont.h:
+
+2006-04-26 Don Porter <dgp@users.sourceforge.net>
+
+ *** 8.5a4 TAGGED FOR RELEASE ***
+
+ * changes: Updates for next RC
+
+2006-04-25 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * unix/tkUnixFont.c (TkpGetFontFamilies): Fix crash caused when the
+ XServer returns invalid font names. [Bug 1475865]
+
+2006-04-23 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * tests/scrollbar.test: fix to tkAqua test failures
+
+2006-04-18 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * macosx/tkMacOSXEmbed.c: fix to [Bug 1088814] test failures in
+ embed.test
+
+ * macosx/tkMacOSXWm.c:
+ * tests/constraints.tcl:
+ * tests/wm.test: fix to 'wm attributes' test for TkAqua
+
+2006-04-11 Peter Spjuth <peter.spjuth@space.se>
+
+ * generic/tkWindow.c (Tk_NameToWindow): Allow NULL interp to
+ Tk_NameToWindow. This fixes TkGetWindowFromObj which promises to handle
+ NULL but didn't.
+
+ * generic/tkGrid.c: Fixed handling of out of bounds row or column.
+ * tests/grid.test: [Bug 1432666]
+
+2006-04-11 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/Makefile.in: Updated `make dist` target to be sure the
+ message catalogs for the widget demo get packaged into the source code
+ distribution. [Bug 1466509]
+
+2006-04-11 Daniel Steffen <das@users.sourceforge.net>
+
+ * changes: added latest aqua bug fixes.
+
+ * macosx/tkMacOSXDialog.c (Tk_MessageBoxObjCmd): added standard Escape
+ key binding for msgbox cancel buttons [Patch 1193614], whitespace.
+
+ * macosx/tkMacOSXCarbonEvents.c: handle kEventCommandUpdateStatus
+ * macosx/tkMacOSXEvent.c: carbon event to dynamically enable
+ the 'Preferences' app menu item when proc [::tk::mac::ShowPreferences]
+ is defined. [Bug 700316]
+
+ * macosx/tkMacOSXHLEvents.c: call ::tk::mac::* procs for all
+ * macosx/tkMacOSXWindowEvent.c: registered appleevents [FR 1105284],
+ implement print applevent handling, style/whitespace cleanup.
+
+ * macosx/tkMacOSXDraw.c (TkMacOSXInitCGDrawing): prevent multiple init
+
+ * macosx/tkMacOSXFont.c: remove #ifdef'd text measuring codepaths now
+ * macosx/tkMacOSXInit.c: known to be incorrect, cleanup obsolete text
+ * macosx/README: antialiasing control code, document ATSUI
+ text antialiasing changes.
+
+ * 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 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/tkfbox.tcl (::tk::IconList_Goto): Fix prefix searching so
+ that the start location is reasonable, and the prefix matching is
+ using the correct Tcl command for this. [Bug 1467938]
+
+2006-04-10 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
+
+ * macosx/tkMacOSXFont.c (MeasureStringWidth): Use implementation based
+ on ATSUGetGlyphBounds (TK_MAC_USE_GETGLYPHBOUNDS), so we can use
+ kATSUseFractionalOrigins. This in turn corrects [Bug 1461650].
+ (InitFont): Use "." and "W" instead of "i" and "w" to determine the
+ "-fixed" attribute. This prevents "Apple Chancery" from being
+ classified as fixed.
+ (InitFontFamilies): Only get the font families once.
+
+2006-04-09 Daniel Steffen <das@users.sourceforge.net>
+
+ * 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 <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): fix return
+ values, implement window dragging & growing in background (with Command
+ key down) and by fronting clicks [Bug 934524], use correct button &
+ modifier state API when application is in background (also in
+ TkMacOSXButtonKeyState).
+
+ * macosx/tkMacOSXWm.c (TkMacOSXGrowToplevel): ensure QD port is set
+ correctly before using API relying on it.
+
+2006-04-06 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * macosx/tkMacOSXMouseEvent.c: Now that [wm attributes -titlepath]
+ works correctly, add OS support for dragging proxy icons and using the
+ titlepath menu.
+
+2006-04-06 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXWm.c (WmAttributesCmd, WmIconbitmapCmd): fix errors in
+ setting/removing window proxy icons via [wm attributes -titlepath] and
+ [wm iconbitmap], use HIWindow API on Tiger or later. [Bug 1455241]
+
+ * unix/tcl.m4: remove TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING
+ define on Darwin. [Tcl Bug 1457515]
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+
+2006-04-05 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkWindow.c (Initialize): remove impotent use of
+ DeleteWindowsExitProc as a global exit handler.
+
+ * generic/tkMenu.c (TkSetWindowMenuBar): remove extra TkMenuInit call
+ that caused finalization panic. [Bug 1456851]
+ * win/tkWinMenu.c (FreeID, TkpNewMenu, MenuExitHandler)
+ (MenuThreadExitHandler, TkpMenuInit, TkpMenuThreadInit): rework Windows
+ menu init/finalization to better respect per-process and per-thread
+ boundaries. [Bug 1456851]
+ (TkWinMenuKeyObjCmd): Do not error when unknown window is passed in.
+ [Bug 1236306]
+
+ * win/tkWinX.c (TkWinXInit): init default keyboard charset correctly.
+ [Bug 1374119] (pajas)
+
+ * win/tkWinWm.c (WmProc): pass WM_QUERYENDSESSION message to Tk as
+ WM_SAVE_YOURSELF wm protocol callback.
+
+ * tests/textWind.test (textWind-10.6.1): prevent infinite update loop
+ in case of test failure.
+
+ * tests/wm.test (wm-attributes-1.2.4): correct expected result.
+
+ * tests/grid.test: fix segfault on empty or "all" index list
+ * generic/tkGrid.c (GridRowColumnConfigureCommand): [Bug 1422430]
+
+2006-04-05 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.c: fix to crash caused on some platforms by new tests
+ introduced to check for [Bug 1414171], which destroy the text widget in
+ the dump callback script.
+
+2006-03-29 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkOption.c (TkOptionDeadWindow): handle OptionThreadExitProc
+ being called before DeleteWindowsExitProc.
+
+ * win/Makefile.in: convert _NATIVE paths to use / to avoid ".\"
+ path-as-escape issue.
+
+2006-03-29 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updates for next RC
+
+ * unix/tkUnixDefault.h: Changed "Black" to "#000000" and "White" to
+ "#ffffff" to work around the (broken?) X servers that do not accept
+ those color names. [Bug 917433]
+
+2006-03-28 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tcl.m4, win/tcl.m4: []-quote AC_DEFUN functions.
+
+2006-03-26 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.c:
+ * tests/text.test: Fix for elaborations of [Bug 1414171] for '$text
+ dump -command <script>' where script deletes large portions of the
+ text widget, or even destroys the widget.
+
+2006-03-28 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcode/default.pbxuser: add '-singleproc 1' cli arg to
+ * macosx/Wish.xcodeproj/default.pbxuser: tktest to ease test debugging.
+
+ * macosx/Wish.xcode/project.pbxproj: removed $prefix/share from
+ * macosx/Wish.xcodeproj/project.pbxproj: TCL_PACKAGE_PATH as per change
+ to tcl/unix/configure.in of 2006-03-13.
+
+ * macosx/tkMacOSXDraw.c: sync whitespace & minor changes with
+ * macosx/tkMacOSXEvent.h: core-8-4-branch.
+ * macosx/tkMacOSXFont.h:
+ * macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXNotify.c:
+
+2006-03-27 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updates for next RC
+
+2006-03-27 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
+
+ * generic/tkTextDisp.c (MeasureChars): Fix calculations of start and
+ end of string. [Bugs 1325998, 1456157]
+
+2006-03-27 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkImgGIF.c (FileReadGIF): Stop crashes when the first GIF
+ frame does not define the overall size of the image. [Bug 1458234]
+
+2006-03-26 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.c:
+ * generic/tkText.h:
+ * generic/tkTextBTree.c:
+ * tests/text.test: Fix for [Bug 1414171] for '$text dump -command
+ <script>' where 'script' actually modifies the widget during the
+ process.
+
+2006-03-25 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXDraw.c (TkMacOSXSetUpCGContext):
+ * macosx/tkMacOSXFont.c (TkMacOSXQuarzStartDraw, TkMacOSXQuarzEndDraw):
+ performance improvements, sync similar code, formatting & whitespace.
+
+2006-03-24 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkTextDisp.c: Moved #ifdef MAC_OSX_TK code added by
+ * macosx/tkMacOSXColor.c: [Patch 638966] into platform specific files.
+ * macosx/tkMacOSXInt.h:
+
+ * macosx/tkMacOSX.h: Cleaned up & rationalized order of
+ * macosx/tkMacOSXBitmap.c: #includes of tk and carbon headers.
+ * macosx/tkMacOSXButton.c:
+ * macosx/tkMacOSXCarbonEvents.c:
+ * macosx/tkMacOSXClipboard.c:
+ * macosx/tkMacOSXColor.c:
+ * macosx/tkMacOSXConfig.c:
+ * macosx/tkMacOSXCursor.c:
+ * macosx/tkMacOSXDialog.c:
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXEmbed.c:
+ * macosx/tkMacOSXEntry.c:
+ * macosx/tkMacOSXEvent.c:
+ * macosx/tkMacOSXEvent.h:
+ * macosx/tkMacOSXFont.h:
+ * macosx/tkMacOSXHLEvents.c:
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXKeyEvent.c:
+ * macosx/tkMacOSXKeyboard.c:
+ * macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXMenubutton.c:
+ * macosx/tkMacOSXMenus.c:
+ * macosx/tkMacOSXMouseEvent.c:
+ * macosx/tkMacOSXRegion.c:
+ * macosx/tkMacOSXScale.c:
+ * macosx/tkMacOSXScrlbr.c:
+ * macosx/tkMacOSXSend.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXWm.h:
+ * macosx/tkMacOSXXStubs.c:
+
+2006-03-23 Reinhard Max <max@tclers.tk>
+
+ * unix/tkUnixRFont.c (TkpMeasureCharsInContext): Copied over from
+ tkUnixFont.c to fix compiling with --enable-xft .
+
+ * unix/tk.spec: Cleaned up and completed. An RPM can now be built from
+ the tk source distribution with "rpmbuild -tb <tarball>".
+
+2006-03-23 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/textDisp.test: Updated expected error messages to match the
+ standardized formats established on 2005-11-17. [Bug 1370296]
+
+2006-03-22 Don Porter <dgp@users.sourceforge.net>
+
+ * changes: Updates for next RC
+
+2006-03-21 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkFont.c: implementation of ATSUI text rendering
+ * generic/tkInt.h: in TkAqua provided by Benjamin
+ * generic/tkTextDisp.c: Riefenstahl. [Patch 638966]
+ * library/demos/unicodeout.tcl:
+ * macosx/tkMacOSXFont.h (new file):
+ * macosx/tkMacOSXFont.c:
+ * tests/font.test:
+ * unix/tkUnixFont.c:
+ * win/tkWinFont.c:
+
+ * generic/tkFont.c: moved MODULE_SCOPE declarations of font
+ * generic/tkFont.h: helper procs into header files.
+ * macosx/tkMacOSXButton.c:
+ * macosx/tkMacOSXFont.h:
+ * macosx/tkMacOSXMenubutton.c:
+
+ * macosx/Wish.xcode/project.pbxproj: add new tkMacOSXFont.h file,
+ * macosx/Wish.xcodeproj/project.pbxproj: turn off dead code stripping
+ as it interferes with -sectcreate (rdar://4486223).
+
+ * macosx/Wish.xcode/default.pbxuser: add TCLLIBPATH=/Library/Tcl
+ * macosx/Wish.xcodeproj/default.pbxuser: env var setting to tktest.
+
+ * unix/configure.in: fix detection of symbols build when enabling
+ TkAqua debug code; filter nm output of libtclstub better to avoid
+ error on intel macs. [Bug 1415789]
+ * unix/configure: autoconf-2.59
+
+2006-03-20 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkConsole.c: Added exit handler to clean up the interp where
+ the console window lives. Also added code to handle multiple calls to
+ Tk_CreateConsoleWindow so that the console channels connect to the last
+ console window opened, in compatibility with the previous
+ implementation.
+
+2006-03-18 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.c: Fix for undo/modified status of text widgets when
+ empty strings are inserted and undone.
+
+2006-03-17 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * library/clrpick.tcl: Avoid using abbreviated sub-commands in core
+ * library/palette.tcl: scripts as this can cause problems with
+ * library/scale.tcl: mega-widget libraries like snit.
+ * library/scrlbar.tcl: [Bug 1451587]
+ * library/tkfbox.tcl:
+ * library/xmfbox.tcl:
+
+2006-03-16 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkConsole.c: Substantial rewrite of [console] support.
+ * generic/tkInt.h: Included Obj-ification of the [console] and
+ [consoleinterp] commands, and reworking of all the supporting data
+ structures for cleaner sharing and lifetime management especially in
+ multi-threaded configurations.
+
+2006-03-16 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/msgs/pt.msg: Messages for Portuguese (strictly just for
+ Brazilian Portuguese, but they'll do until we get other Portuguese
+ speakers localize) from Ricardo Jorge <ricardoj@users.sf.net> and Silas
+ Justiano <silasj@users.sf.net>. Many thanks! [Bug 1405069]
+
+ * generic/tkImgPhoto.c (ImgPhotoCmd, Tk_PhotoPutBlock)
+ (Tk_PhotoPutZoomedBlock): Added hack to detect copying of a photo with
+ a simple alpha channel and skip calling ToggleComplexAlphaIfNeeded.
+ This should speed up many photo-to-photo copies, keeping the cost of
+ the alpha channel down.
+
+2006-03-15 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkImgPhoto.c (Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock): Try
+ to squelch performance issue with code that writes to large images by
+ single pixels. Masses of thanks to George Staplin for helping to trace
+ this down to the COMPLEX_ALPHA flag handling code. [Bug 1409140]
+
+2006-03-13 Don Porter <dgp@users.sourceforge.net>
+
+ * tests/scrollbar.test: Corrected several broken calls to [testmetrics]
+ that were crashing the test suite.
+
+ * tests/constraints.tcl: Added notAqua constraint to canvPs-3.1
+ * tests/canvPs.test: to stop test suite crash on Mac OSX.
+ [Bug 1088807]
+
+ * generic/tkCmds.c: Purged remaining references to errno,
+ * macosx/tkMacOSXPort.h: and errno.h. Standardized the logic
+ * macosx/tkMacOSXWm.c: for using header files from the compat
+ * macosx/tkMacOSXWm.h: directory. Thanks Joe English for the
+ * unix/tkUnixPort.h: patch. [Patch 1445404]
+
+2006-03-08 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/Makefile.in: Update `make dist` to copy the image files needed
+ by the test suite into the source distro. This was overlooked in the
+ 2005-10-12 commit.
+
+ * changes: Update in prep. for 8.5a4 release.
+
+2006-03-07 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tcl.m4: Set SHLIB_LD_FLAGS='${LIBS}' on NetBSD, as per the other
+ *BSD variants. [Bug 1334613]
+ * unix/configure: Regenerated.
+
+2006-03-07 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/canvas.n: Added note that stipples are not well-supported on
+ non-X11 platforms. [Bug 220787] It's not a great solution, but it does
+ indicate the state of affairs that has existed for years anyway; not
+ much modern software uses stipples anyway.
+
+2006-03-02 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/tkMacOSXDraw.c (TkPutImage): Fix endian issue on OS X x86
+ displaying images. Bitmap images still have a black/white reversal
+ issue, appears to be a general OS X issue (as seen in frogger demo).
+
+2006-02-27 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tkBitmap.c (Tk_GetBitmapFromData): Improve thread-safety.
+ [Bug 470322]
+
+ * generic/tkImgBmap.c (ImgBmapConfigureInstance): Force creation of new
+ Pixmaps before deletion of old ones to prevent stupid caching problems.
+ [Bug 480862]
+
+2006-02-09 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tk.decls: fix signature of TkMacOSXInvalClipRgns
+ * generic/tkPlatDecls.h: to use Tk_Window instead of internal
+ * macosx/tkMacOSXSubwindows.c: type TkWindow (which led to any include
+ * macosx/tkMacOSXWindowEvent.c: of public header tkMacOSX.h requiring
+ * macosx/tkMacOSXWm.c: prior include of tkInt.h).
+
+ * generic/tk.h: move TkAqua specific REDO_KEYSYM_LOOKUP define
+ * macosx/tkMacOSXPort.h: out of tk.h into platform header.
+
+2006-01-31 Donal K. Fellows <dkf@users.sf.net>
+
+ * library/bgerror.tcl (::tk::dialog::error::bgerror): Finish the
+ internationalization of the error dialog. [Bug 1409264]
+
+2006-01-25 Don Porter <dgp@users.sourceforge.net>
+
+ * library/bgerror.tcl: Updates to use Tcl 8.4 features. [Patch 1237759]
+ * library/choosedir.tcl:
+ * library/comdlg.tcl:
+ * library/console.tcl:
+ * library/dialog.tcl:
+ * library/focus.tcl:
+ * library/msgbox.tcl:
+ * library/palette.tcl:
+ * library/tk.tcl:
+ * library/tkfbox.tcl:
+ * library/xmfbox.tcl:
+
+2006-01-23 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/configure: minor fix to Darwin specific code removing
+ * unix/configure.in: 64bit flags from CFLAGS for Tk build.
+
+2006-01-20 Joe English <jenglish@users.sourceforge.net>
+
+ * generic/tkEvent.c, unix/tkUnixEvent.c: XIM fixes [See 905830, patch
+ tk84-xim-fixes.patch], and revert 2005-12-05 patch disabling XIM when
+ SCIM in use, and make sure all X events get passed to XFilterEvent,
+ including those without a corresponding Tk window.
+
+2006-01-13 Anton Kovalenko <a_kovalenko@users.sourceforge.net>
+
+ * generic/tkUndo.c (TkUndoSetDepth): Don't free TkUndoSubAtoms for
+ separator entries that are deleted: there is some unpredictable garbage
+ instead of subatoms.
+
+ Free both 'apply' and 'revert' action chains for non-separator entries.
+
+2006-01-12 Donal K. Fellows <dkf@users.sf.net>
+
+ TIP #260 IMPLEMENTATION
+
+ * generic/tkCanvText.c (TextItem, CreateText, DisplayCanvText):
+ * doc/canvas.n: Code, docs and tests to implement an -underline
+ * tests/canvText.test: option for canvases' text items.
+
+2006-01-11 Peter Spjuth <peter.spjuth@space.se>
+
+ * generic/tkGrid.c: Removed a lingering error message from TIP#147
+ implementation.
+
+2006-01-10 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXDebug.c: add TkMacOSXGetNamedDebugSymbol() function
+ * macosx/tkMacOSXDebug.h: that finds unexported symbols in loaded
+ libraries by manually walking their symbol table; only to be used for
+ debugging purposes, may break unexpectedly in the future. Needed to get
+ access to private_extern internal debugging functions in HIToolbox.
+
+ * macosx/tkMacOSXCarbonEvents.c: fix debug event tracing on Tiger.
+ * macosx/tkMacOSXMenu.c: add debug menu printing during reconfigure.
+ * macosx/tkMacOSXInit.c: conditionalize 64bit-unsafe dyld code.
+ * macosx/GNUmakefile: add 'wish8.x' symlink to SYMROOT.
+
+ * macosx/Wish.xcode/project.pbxproj: fix copy to tktest resource
+ * macosx/Wish.xcodeproj/project.pbxproj: fork when zerolinked.
+
+ * macosx/Wish.xcode/default.pbxuser: add widget demo as argument to
+ * macosx/Wish.xcodeproj/default.pbxuser: executables (on by default).
+
+ * unix/configure: add caching, use AC_CACHE_CHECK instead of
+ * unix/configure.in: AC_CACHE_VAL where possible, consistent message
+ * unix/tcl.m4: quoting, sync relevant tclconfig/tcl.m4 changes
+ and gratuitous formatting differences, fix SC_CONFIG_MANPAGES with
+ default argument, Darwin improvements to SC_LOAD_*CONFIG.
+
+2005-12-28 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkUndo.c (TkUndoSetDepth): Apply [Patch 1391939] from Ludwig
+ Callewaert to fix [Bug 1380427].
+
+2005-12-14 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Wish.xcode/project.pbxproj:
+ * macosx/Wish.xcodeproj/project.pbxproj: add new tclTomMath* files.
+
+2005-12-13 Daniel Steffen <das@users.sourceforge.net>
+
+ * library/demos/cscroll.tcl: add MouseWheel bindings for aqua.
+
+ * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents):
+ * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent)
+ (GenerateMouseWheelEvent): add support for kEventMouseScroll events
+ (smooth mouse wheel scrolling from mighty mouse or scrolling trackpad)
+ by handling kEventMouseWheelMoved on application target as well as on
+ dispatcher, in order to pick up synthesized MouseWheel events from
+ HIObject handler (c.f. QA1453); add support for horizontal scrolling
+ events by generating MouseWheel XEvent with Shift modifier.
+
+2005-12-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tcl.m4, unix/configure: Fix sh quoting error reported in
+ bash-3.1+ [Bug 1377619] (schafer)
+
+2005-12-09 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWinWm.c (WinSetIcon): Don't check result of SetClassLong() or
+ SetClassLongPtr() since it was generating an incorrect error and the
+ MSDN docs indicate that the result need not be checked.
+
+2005-12-09 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/configure: Regen.
+ * win/tcl.m4 (SC_CONFIG_CFLAGS): Define MACHINE for gcc builds. The
+ lack of a definition of this variable in the manifest file was causing
+ a runtime error in wish built with gcc.
+
+2005-12-09 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkInt.decls: Move all platform test sources from tk lib into
+ * generic/tkTest.c: tktest directly, removes requirement to export
+ * macosx/tkMacOSXTest.c:TkplatformtestInit from internal stubs table.
+ * unix/Makefile.in:
+ * win/Makefile.in:
+ * win/makefile.vc:
+ * win/tkWinTest.c:
+
+ * generic/tkIntPlatDecls.h:
+ * generic/tkStubInit.c: regen.
+
+2005-12-08 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tcl.m4: Add build support for Windows-x64 builds.
+ * win/configure: --enable-64bit now accepts =amd64|ia64 for
+ * win/Makefile.in: Windows 64-bit build variants (default: amd64)
+ * win/makefile.vc: [Bug 1369597]
+ (TKOBJS): add tkWinTest.obj to regular Tk obj for TkplatformtestInit
+
+ * win/configure.in: Add CE build support (some C code fixes needed)
+ * win/wish.exe.manifest.in (new): manifest must map in MACHINE and
+ * win/rc/wish.exe.manifest (removed): VERSION to be correct.
+ * unix/Makefile.in: fix dist target for manifest dir change
+
+ * generic/tkTextTag.c (TkTextTagCmd): use correct arraySize for peered
+ text widgets in [$text tag names]. [Bugs 1375069, 1374935]
+
+2005-12-08 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXDraw.c: Remove inclusion of tclInt.h and use of tcl
+ * macosx/tkMacOSXFont.c: internals wherever possible in tk/macosx, the
+ * macosx/tkMacOSXInit.c: only remaining tcl internals in TkAqua are
+ * macosx/tkMacOSXNotify.c:TclServiceIdle() in tkMacOSXScrlbr.c and
+ * macosx/tkMacOSXScrlbr.c:Tcl_Get/SetStartupScript() in tkMacOSXInit.c
+ [RFE 1336531]
+
+ * macosx/tkMacOSXInt.h: sync comments with core-8-4-branch.
+
+2005-12-07 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tkUnixEvent.c (OpenIM): remove extraneous const
+
+2005-12-06 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * doc/ConfigWidg.3 (TK_CONFIG_OPTION_SPECIFIED): Mentioned that the
+ flag is deprecated because it is not thread-safe.
+
+2005-12-05 Reinhard Max <max@suse.de>
+
+ * unix/tkUnixEvent.c (OpenIM): Added a workaround to allow at least
+ ASCII and the Compose key when typing into text and entry widgets on a
+ system that uses SCIM. This has to be taken out again once the SCIM
+ problems have been fixed.
+
+2005-12-01 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/tcl.m4 (Darwin): fixed error when MACOSX_DEPLOYMENT_TARGET unset
+ * unix/configure: regen.
+
+2005-11-30 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinWm.c (WmAttributesCmd): set (no)topmost window aspect before
+ rewrapping. [Bug 1086049]
+
+ * macosx/tkMacOSXXStubs.c (TkpOpenDisplay, TkMacOSXDisplayChanged):
+ * macosx/tkMacOSXWindowEvent.c (TkMacOSXProcessApplicationEvent):
+ * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents):
+ * macosx/tkMacOSXEvent.h: Trap kEventAppAvailableWindowBoundsChanged
+ * macosx/tkMacOSXInt.h: event to watch for change in display size and
+ adjust internal state appropriately.
+
+ * doc/checkbutton.n: fix -selectcolor docs. [Bug 1083838]
+
+ * generic/tkImgGIF.c: cast calls to blockOut
+
+ * win/Makefile.in: place TCL_BIN_DIR first in PATH for targets to get
+ Tcl built dll first.
+ Add tkWinTest.obj to tk84.dll to handle some needed test functions
+ being defined in stubs (TkplatformtestInit).
+
+ * tests/scrollbar.test (6.22): fix rounding-error sensitive test
+
+2005-11-29 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/console.tcl (::tk::ConsoleInit): improve work-around to avoid
+ '% ' from tclMain.c. [Bug 1252259]
+
+2005-11-27 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/tcl.m4 (Darwin): add 64bit support, check for Tiger copyfile(),
+ add CFLAGS to SHLIB_LD to support passing -isysroot in env(CFLAGS) to
+ configure (flag can't be present twice, so can't be in both CFLAGS and
+ LDFLAGS during configure), don't use -prebind when deploying on 10.4,
+ define TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING (rdar://3171542).
+ (SC_ENABLE_LANGINFO, SC_TIME_HANDLER): add/fix caching, fix obsolete
+ autoconf macros. Sync with tcl/unix/tcl.m4.
+
+ * unix/configure.in: fix obsolete autoconf macros, sync gratuitous
+ formatting/ordering differences with tcl/unix/configure.in.
+
+ * unix/Makefile.in: add CFLAGS to wish/tktest link to make executable
+ linking the same as during configure (needed to avoid loosing any
+ linker relevant flags in CFLAGS, in particular flags that can't be in
+ LDFLAGS). Avoid concurrent linking of wish and compiling of
+ tkTestInit.o during parallel make, fix dependencies and flags for
+ building tkMacOSXInit.o
+ (checkstubs, checkexports): dependency and Darwin fixes
+ (dist): add new macosx files.
+
+ * macosx/tkMacOSXEvent.c (TkMacOSXProcessEvent):
+ * macosx/tkMacOSXEvent.h:
+ * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent):
+ * macosx/tkMacOSXCarbonEvents.c: install standard application event
+ handler, add & call functions to start and stop carbon even timer that
+ runs the tcl event loop periodically during a nested carbon event loop
+ in the toolbox (e.g. during menutracking) to ensure tcl timers etc.
+ continue to fire, register app event handler for menu tracking and HI
+ command carbon events, move menu event handling to new handlers for
+ those carbon events, no longer register for/handle appleevent carbon
+ event (now dealt with by standard application event handler), event
+ debugging code dynamically acquires carbon event debugging functions to
+ allow use on Tiger where they are no longer exported from HIToolbox.
+
+ * macosx/tkMacOSXFont.c (TkMacOSXUseAntialiasedText):
+ * macosx/tkMacOSXKeyEvent.c (GetKeyboardLayout):
+ * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents):
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXInt.h: abstract common code to dynamically acquire
+ address of a named symbol (from a loaded dynamic library) into new
+ function TkMacOSXGetNamedSymbol() and macro TkMacOSXInitNamedSymbol.
+
+ * macosx/tkMacOSXMenu.c (TkpNewMenu):
+ * macosx/tkMacOSXMenubutton.c (MenuButtonInitControl):
+ * macosx/tkMacOSXMenus.c (TkMacOSXHandleMenuSelect): switch to modern
+ utf-8 aware menu manager API, remove obsolete code, add error handling.
+
+ * macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXMenus.c:
+ * macosx/tkMacOSXMenubutton.c:
+ * macosx/tkMacOSXMouseEvent.c: define OSX 10.3 or later only constants
+ if necessary to allow compilation on OSX 10.2
+
+ * macosx/tkMacOSXWm.c (UpdateSizeHints): remove code that is never
+ executed.
+
+ * xlib/xgc.c (XCreateGC): sync with core-8-4-branch change.
+
+ * generic/tk.h: add/correct location of version numbers in macosx files
+
+ * generic/tkInt.h: clarify fat compile comment.
+
+ * macosx/Wish.pbproj/default.pbxuser (new):
+ * macosx/Wish.pbproj/jingham.pbxuser:
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/Wish.xcode/default.pbxuser:
+ * macosx/Wish.xcode/project.pbxproj:
+ * macosx/Wish.xcodeproj/default.pbxuser (new):
+ * macosx/Wish.xcodeproj/project.pbxproj (new): new/updated projects for
+ Xcode 2.2 on 10.4, Xcode 1.5 on 10.3 & ProjectBuilder on 10.2, with
+ native tktest targets and support for universal (fat) compiles.
+
+ * macosx/Tk-Info.plist (removed):
+ * macosx/Wish-Info.plist (removed):
+ * macosx/buildTkConfig.tcl (removed): remove obsolete build files.
+
+ * macosx/README: clarification/cleanup, document new Xcode projects and
+ universal (fat) builds via CFLAGS (i.e. ppc and i386 at the same time).
+
+ * unix/Makefile.in:
+ * unix/aclocal.m4:
+ * unix/configure.in:
+ * macosx/configure.ac (new): add support for inclusion of
+ unix/configure.in by macosx/configure.ac, allows generation of a
+ config headers enabled configure script in macosx (required by Xcode
+ projects).
+
+ * macosx/GNUmakefile: rename from Makefile to avoid overwriting by
+ configure run in tk/macosx, add support for reusing configure cache,
+ build target fixes.
+
+ * generic/tk3d.h:
+ * generic/tkButton.h:
+ * generic/tkCanvas.c:
+ * generic/tkCanvas.h:
+ * generic/tkColor.h:
+ * generic/tkEntry.h:
+ * generic/tkFileFilter.h:
+ * generic/tkFont.c:
+ * generic/tkFont.h:
+ * generic/tkImage.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkInt.h:
+ * generic/tkMenu.c:
+ * generic/tkMenu.h:
+ * generic/tkMenubutton.h:
+ * generic/tkScale.h:
+ * generic/tkScrollbar.h:
+ * generic/tkSelect.h:
+ * generic/tkStubInit.c:
+ * generic/tkStubLib.c:
+ * generic/tkText.h:
+ * generic/tkUndo.h:
+ * macosx/tkMacOSXButton.c:
+ * macosx/tkMacOSXDebug.c:
+ * macosx/tkMacOSXDebug.h:
+ * macosx/tkMacOSXDialog.c:
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXEntry.c:
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXMenubutton.c:
+ * macosx/tkMacOSXMouseEvent.c:
+ * macosx/tkMacOSXSend.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXXStubs.c:
+ * unix/tkUnixButton.c:
+ * unix/tkUnixMenu.c:
+ * xlib/xgc.c: ensure externally visible symbols not contained in stubs
+ table are declared as MODULE_SCOPE (or as static if not used outside of
+ own source file), #ifdef out a few Xlib and aqua functions that are
+ never called. These changes allow 'make checkstubs' to complete without
+ error on Darwin with gcc 4.
+
+ * macosx/tkMacOSXTest.c:
+ * macosx/tkMacOSXPort.h:
+ * win/tkWinTest.c:
+ * generic/tkInt.decls: add functions needed by tktest to internal stubs
+ table, correct signature of TkMacOSXHandleMenuSelect, add XSync to aqua
+ Xlib stubs.
+
+ * unix/tkUnixSend.c:
+ * generic/tkText.c:
+ * generic/tkTest.c: #ifdef unix only declarations.
+ (TestmetricsCmd): unify win and mac implementation.
+ (TestsendCmd): move to tkUnixSend.c to avoid access to global var.
+ (TesttextCmd): move to tkText.c to avoid having to put all the internal
+ text functions it uses into the stubs table.
+
+ * generic/tkTextDisp.c:
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXKeyEvent.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXXStubs.c: fix gcc 4 warnings.
+
+ * macosx/tkMacOSXNotify.c:
+ * macosx/tkMacOSXScrlbr.c: sync with core-8-4-branch.
+
+ * generic/tkIntDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkIntXlibDecls.h:
+ * generic/tkStubInit.c:
+ * unix/configure:
+ * unix/tkConfig.h.in: regen.
+
+2005-11-22 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/tkfbox.tcl: Remove all references to data(curItem), as it is
+ no longer used. [Bug 600313]
+ (::tk::IconList_CurSelection): Renamed for clarity.
+
+ * doc/GetFont.3: Revert previous fix; a NULL interp is now legal.
+ * generic/tkFont.c (ParseFontNameObj, GetAttributeInfoObj): Allow these
+ functions to work with a NULL interp by making them check when
+ generating error messages. [Bug 1151523]
+
+ * library/tkfbox.tcl (::tk::dialog::file::): Correct the quoting of the
+ script used in variable traces so that widget names with spaces in will
+ work. [Bug 1335485]
+
+2005-11-16 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * doc/text.n: clarify left to right interpretation of index modifiers,
+ including the fact that validation occurs after each step. [Bug
+ 1357575]
+
+2005-11-15 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixWm.c, tests/unixWm.test, doc/wm.n: Support for [wm
+ attributes] on X11. [TIP#231, Patch 1062022]
+
+2005-11-14 Joe English <jenglish@users.sourceforge.net>
+
+ * library/bgerror.tcl: Truncate error messages at 45 characters
+ instead of 30. [Bug 1224235]
+
+2005-11-14 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tkSelect.c (TkSelDefaultSelection): Test select-9.5
+ highlighted further brokenness in this function.
+
+2005-11-13 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * unix/tkUnixSelect.c (SelCvtToX): Arrange for the parsing code to use
+ Tcl's list parsing code, another simplification that enables testing
+ of the [Bug 1353414] fix.
+
+ * unix/tkUnixSelect.c (SelCvtFromX): Generate string forms of the
+ advanced selection types in a Tcl_DString. This makes fixing [Bug
+ 1353414] trivial, and simplifies the code at the same time.
+ * tests/select.test (select-9.5): Added test for [Bug 1353414]
+
+2005-11-10 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tkBind.c (ChangeScreen): More DString fixes from
+ * generic/tkTextWind.c (EmbWinLayoutProc): [Bug 1353022]
+ * win/tkWinMenu.c (SetDefaults):
+
+ * win/tkWinDialog.c (ConvertExternalFilename): Factored out the
+ encoding conversion and de-backslash-ing code that is used in many
+ places in this file.
+ (GetFileNameW, GetFileNameA, ChooseDirectoryValidateProc): Make sure
+ that data is freed correctly and that certain (hopefully impossible)
+ failure modes won't cause crashes. [Bug 1353022]
+
+2005-11-06 Pat Thoyts <pat@zsplat.freeserve.co.uk>
+
+ * unix/tcl.m4: Fix SHLIB_LD_LIBS for building tclkit on OpenBSD.
+ * unix/configure: regenerated
+
+2005-10-31 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.c
+ * tests/textDisp.test: fix and test for [Bug 1333951] in '.text count
+ -displaylines'.
+
+2005-10-18 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkMain.c: Rewrote code that sets the ::argv value to be sure
+ conversion from the system encoding is complete before any processing
+ sensitive to list-special characters is done. [Bug 1328926]
+
+2005-10-17 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/tkMacOSXScrlbr.c (UpdateControlValues): check geomMgrPtr is
+ valid before checking type
+
+2005-10-15 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/menu.tcl (::tk::MenuUnpost): remove leftover ] from string
+ equal mods of 2005-07-25. (sowadsky)
+
+2005-10-14 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinSend.c: Avoid using tcl internal headers and fix to
+ * win/tkWinSendCom.h: correctly link on all types of build (was
+ * win/tkWinSendCom.c: broken in static,msvcrt builds).
+
+2005-10-12 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * tests/canvPs.test, tests/canvPsBmap.tcl, tests/canvPsImg.tcl:
+ * tests/imgPhoto.test, tests/menu.test: Arrange for the test suite to
+ only ever refer to images in the same directory as the tests. This
+ makes it possible to package the test suite itself as a starkit. Thanks
+ to David Zolli for suggesting this.
+
+2005-10-10 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkConfig.c (Tk_DeleteOptionTable, Tk_CreateOptionTable):
+ properly alloc/delete one more option. [Bug 1319720] (melbardis)
+
+ * macosx/tkMacOSXInt.h: Move MODULE_SCOPE defn to tkInt.h and add
+ * generic/tkInt.h: WORDS_BIGENDIAN checks that will work with OS X
+ universal binary compiles. (steffen)
+
+ * generic/tkMenu.c (TkSetWindowMenuBar): do not call TkMenuInit if the
+ winPtr indicates TK_ALREADY_DEAD. This prevents reinit that creates a
+ Tk exit handler after all exit handlers should be called. [Bug 749908,
+ 1322294]
+
+2005-10-10 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ TIP #256 IMPLEMENTATION
+
+ * doc/text.n
+ * generic/tkText.c
+ * generic/tkText.h
+ * generic/tkTextBTree.c
+ * generic/tkTextDisp.c
+ * generic/tkTextImage.c
+ * generic/tkTextIndex.c
+ * generic/tkTextMark.c
+ * generic/tkTextTag.c
+ * generic/tkTextWind.c
+ * macosx/tkMacOSXDefault.h
+ * tests/text.test
+ * tests/textDisp.test
+ * unix/tkUnixDefault.h
+ * win/tkWinDefault.h: Implementation of TIP#256, adding a new text
+ widget configuration option '-tabstyle', with new tests and
+ documentation.
+
+ Also a fix for [Bug 1281228] (documentation and full implementation of
+ -strictlimits), and [Bug 1288677] (corrected elide behaviour), again
+ with more tests.
+
+2005-10-04 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/dialog.tcl (::tk_dialog): add tkwait visibility before grab.
+ [Bug 1216775]
+
+ * win/tkWinDialog.c (ChooseDirectoryValidateProc): reset stored path to
+ "" if it doesn't exist and -mustexist is true. [Bug 1309218] Remove
+ old-style dir chooser (no longer used).
+
+ * macosx/tkMacOSXInt.h: add MODULE_SCOPE definition check for extension
+ writers that access private headers on OS X and don't define it in
+ configure.
+
+2005-09-28 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/tkUnixPort.h: Disabled inclusion of the private Tcl header
+ * win/tkWinPort.h: file tclInt.h. Tk ought to have a tiny and
+ shrinking number of calls of private Tcl routines. Each Tk source file
+ doing this should follow the convention in the macosx port and have its
+ own #include "tclInt.h".
+
+ * generic/tkEvent.c: Disabled calls to private Tcl routine
+ TclInExit(). See comment in TkCreateExitHandler() for full rationale.
+
+2005-09-21 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tkEvent.c (TkCreateThreadExitHandler, TkFinalizeThread)
+ (TkDeleteThreadExitHandler): New internal API (from Joe Mistachkin) to
+ allow Tk to finalize itself correctly in a multi-threaded
+ environment. [Bug 749908]
+
+2005-09-14 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkOldConfig.c (GetCachedSpecs): Split out the code to
+ manipulate the cached writable specs so that it can be reused from all
+ the public Tk_Configure* functions.
+ (Tk_ConfigureInfo, Tk_ConfigureWidget, Tk_ConfigureValue): Use the
+ factored out code everywhere, so we always manipulate the cache
+ correctly. [Bug 1288128]
+
+2005-09-13 Don Porter <dgp@users.sourceforge.net>
+
+ * win/winMain.c (WishPanic): Replaced TCL_VARARGS* macros with direct
+ use of stdarg.h conventions.
+
+2005-09-11 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): check if
+ process is in front on MouseDown, otherwise request process activation
+ from BringWindowForward() via new isFrontProcess param.
+
+ * macosx/tkMacOSXCarbonEvents.c (TkMacOSXInitCarbonEvents): register
+ our event handler on the dispatcher target for all carbon events of
+ interest to TkAqua; this replaces event processing directly from the
+ event queue and thus allows to capture events that are syntesized by
+ Carbon and sent directly to the dispatcher and not to the event queue.
+
+ * macosx/tkMacOSXEvent.c: remove TkMacOSXCountAndProcessMacEvents(),
+ rename ReceiveAndProcessEvent() to TkMacOSXReceiveAndProcessEvent().
+ (TkMacOSXReceiveAndProcessEvent): remove tk event processing before
+ sending events to the dispatcher, all events of interest are now
+ processed in our dispatcher target event handler.
+
+ * macosx/tkMacOSXNotify.c (CarbonEventsCheckProc): dispatch events
+ directly via TkMacOSXReceiveAndProcessEvent(), but dispatch no more
+ than four carbon events at one time to avoid starving other event
+ sources.
+
+ * macosx/tkMacOSXEvent.c: formatting cleanup, move XSync() to XStubs,
+ * macosx/tkMacOSXEvent.h: removed obsolete kEventClassWish handling.
+ * macosx/tkMacOSXXStubs.c
+
+ * macosx/tkMacOSXEvent.h: declare macosx internal procs as MODULE_SCOPE
+ * macosx/tkMacOSXEvent.c:
+ * macosx/tkMacOSXKeyEvent.c:
+ * macosx/tkMacOSXMouseEvent.c:
+ * macosx/tkMacOSXWindowEvent.c:
+
+ * macosx/tkMacOSXButton.c: conditionalize all debug message printing to
+ * macosx/tkMacOSXCursor.c: stderr via TK_MAC_DEBUG define.
+ * macosx/tkMacOSXDebug.c:
+ * macosx/tkMacOSXDebug.h:
+ * macosx/tkMacOSXDialog.c:
+ * macosx/tkMacOSXEvent.c:
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXKeyEvent.c:
+ * macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXMenubutton.c:
+ * macosx/tkMacOSXScale.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c:
+
+ * unix/configure.in: define TK_MAC_DEBUG on aqua when symbols enabled.
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+
+ * library/listbox.tcl: synced aqua MouseWheel bindings with
+ * library/scrlbar.tcl: core-8-4-branch.
+ * library/text.tcl:
+
+ * xlib/xcolors.c: fixed warning
+
+2005-08-25 Daniel Steffen <das@users.sourceforge.net>
+
+ * unix/Makefile.in (html): reverted/amended changes of 2005-08-23 that
+ broke TkAqua 'make install'; added BUILD_HTML_FLAGS optional var like
+ in tcl/unix/Makefile.in.
+
+2005-08-24 Donal K. Fellows <dkf@users.sf.net>
+
+ * tests/text.test (text-8.18): Fix punctuation of error message to
+ match good practice (actual message already fixed). [Bug 1267484]
+
+2005-08-23 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/tkMacOSXDialog.c: make dialogs ignore -initialfile "" and
+ -initialdir "" instead of error.
+
+2005-08-23 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWin32Dll.c (DllMain): Replace old asm SEH approach with Kenny's
+ new SEH implementation. [Tcl Bug 1235544]
+
+2005-08-23 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * unix/Makefile.in: Subst BUILD_TCLSH and TCL_EXE.
+ * unix/configure: Regen.
+ * unix/configure.in: Update minimum autoconf version to 2.59. Invoke
+ SC_PROG_TCLSH and SC_BUILD_TCLSH.
+ * unix/tcl.m4 (SC_PROG_TCLSH, SC_BUILD_TCLSH):
+ * win/Makefile.in: Subst BUILD_TCLSH and TCL_EXE.
+ * win/configure: Regen.
+ * win/configure.in: Update minimum autoconf version to 2.59. Invoke
+ SC_BUILD_TCLSH.
+ * win/tcl.m4 (SC_PROG_TCLSH, SC_BUILD_TCLSH): Split confused search
+ for tclsh on PATH and build and install locations into two macros.
+ SC_PROG_TCLSH searches just the PATH. SC_BUILD_TCLSH determines the
+ name of the tclsh executable in the Tcl build directory. [Tcl Bug
+ 1160114] [Tcl Patch 1244153]
+
+2005-08-22 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXButton.c:
+ * macosx/tkMacOSXDialog.c: fix warnings.
+
+2005-08-20 Joe Mistachkin <joe@mistachkin.com>
+
+ * win/tkWinX.c: Fixed bad cast. [Bug 1216006]
+
+2005-08-18 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * doc/GetFont.3: Reworded to reflect the truth. [Bug 1151523]
+
+2005-08-16 George Peter Staplin <GeorgePS@XMission.com>
+
+ * doc/CrtItemType.3 prototypes were lacking [] after objv. Thus the man
+ page was wrong about the actual prototypes. This was verified by
+ studying tkCanvBmap.c.
+
+2005-08-13 Chengye Mao <chengye.geo@yahoo.com>
+
+ * generic/tkOldConfig.c: Fixed [Bug 1258604]. This bug was introduced
+ into the modfied Tk_ConfigureWidget. It failed to properly handle the
+ specFlags' bit TK_CONFIG_OPTION_SPECIFIED.
+
+2005-08-12 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tkOldConfig.c (Tk_ConfigureWidget): Stop storing per-thread
+ data in global data structures. Store it in per-interpreter data (i.e.
+ per-thread data) instead. [Bug 749908]
+
+2005-08-10 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkFrame.c (CreateFrame) and others: Don't use size_t when
+ working with Tcl_GetStringFromObj because it is not 64-bit clean. [Bug
+ 1252702]
+
+2005-08-04 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * doc/text.n: Clarify behaviour of tab stops (as per [Bug 1247835])
+
+2005-08-09 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXCarbonEvents.c (AppEventHandlerProc): handle carbon
+ events sent directly to application event target via the general
+ TkMacOSXProcessEvent() in the same way as events posted to the event
+ loop. Moved existing app event handlers to tkMacOSXWindowEvent.c.
+ (TkMacOSXInitCarbonEvents): register our application event handler for
+ kEventWindowExpanded events to deal with uncollapsing from the dock.
+
+ * macosx/tkMacOSXEvent.h: made TkMacOSXProcessEvent() non-static, added
+ * macosx/tkMacOSXEvent.c: new interp field to TkMacOSXEvent struct for
+ use by app event handler.
+
+ * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): retrieve
+ current window, partCode, modifiers and local cursor position from
+ carbon mouse event if possible. Use new static GenerateButtonEvent()
+ taking a MouseEventData struct instead of TkGenerateButtonEvent() to
+ avoid recomputing already known values. Move process activation on
+ MouseDown into BringWindowForward() to allow clicking on window
+ titlebar widgets without activating process. Move code dealing with
+ clicks in window titelbar into separate function
+ HandleWindowTitlebarMouseDown() to avoid code duplication. Avoid
+ repeated calls to TkMacOSXGetXWindow() by storing result in
+ MouseEventData struct.
+ (TkMacOSXButtonKeyState, XQueryPointer): try to get button and modifier
+ state from currently processed carbon event (to avoid unnecessary IPC
+ with the window server), otherwise use modern carbon API to get this
+ info instead of Button() and GetKeys(); only retrieve info caller asks
+ for (via non-NULL ptr passed to XQueryPointer).
+ (ButtonModifiers2State): new static function converting carbon button
+ and modifier state into tk state, allows detection of more than 3 mouse
+ buttons (tk supports up to 5) and of NumLock and Fn modifier keys
+ (NumLock is mapped to Mod3 and Fn to Mod4).
+
+ * macosx/tkMacOSXWindowEvent.c (TkMacOSXProcessApplicationEvent):
+ handle kEventWindowExpanded event to deal with window uncollapsing from
+ the dock by generating tk Map event, handle kEventAppHidden and
+ kEventAppShown events (moved here from tkMacOSXCarbonEvents.c).
+
+ * macosx/tkMacOSXSubwindows.c (XUnmapWindow): only hide window when it
+ is not iconified to avoid window flashing on collapse.
+
+ * macosx/tkMacOSXWm.c: replaced Tk_DoWhenIdle() by Tcl_DoWhenIdle().
+ (TkMacOSXZoomToplevel): remove call to TrackBox(), now done in
+ HandleWindowTitlebarMouseDown() in tkMacOSXMouseEvent.c.
+ (TkpWmSetState): avoid window flashing on collapse by unmapping after
+ calling CollapseWindow(); only uncollapse window if it is collapsed.
+
+ * generic/tkInt.decls: changed TkMacOSXZoomToplevel() signature.
+ * generic/tkIntPlatDecls.h:
+
+ * macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): only call
+ GetMenuItemCommandID() on KeyDown or KeyRepeat events.
+
+ * macosx/tkMacOSXMenu.c (ReconfigureMacintoshMenu): remove call to
+ obsolete AppendResMenu() API.
+
+ * macosx/tkMacOSXKeyEvent.c: replaced all direct uses of expensive
+ * macosx/tkMacOSXMenu.c: GetMouse() and TkMacOSXButtonKeyState()
+ * macosx/tkMacOSXMenus.c: APIs by calls to XQueryPointer()
+ * macosx/tkMacOSXMouseEvent.c:
+ * macosx/tkMacOSXScale.c:
+ * macosx/tkMacOSXScrlbr.c:
+ * macosx/tkMacOSXWm.c:
+
+ * macosx/tkMacOSXDialog.c: replaced use of FrontNonFloatingWindow()
+ * macosx/tkMacOSXKeyEvent.c: by ActiveNonFloatingWindow() as
+ * macosx/tkMacOSXMenu.c: recommended by Carbon docs.
+ * macosx/tkMacOSXMenus.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWm.c:
+
+ * macosx/tkMacOSXDialog.c: fixed warnings
+ * macosx/tkMacOSXTest.c:
+
+ * macosx/tkMacOSXCarbonEvents.c: added CVS Id line to file header.
+ * macosx/tkMacOSXDebug.c:
+ * macosx/tkMacOSXDebug.h:
+ * macosx/tkMacOSXEntry.c:
+ * macosx/tkMacOSXEvent.h:
+ * macosx/tkMacOSXKeyEvent.c:
+ * macosx/tkMacOSXMouseEvent.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.h:
+
+ * macosx/tkMacOSXInt.h: declare macosx internal procs as MODULE_SCOPE.
+ * macosx/tkMacOSXCarbonEvents.c:
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXHLEvents.c:
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXWindowEvent.c
+
+ * library/bgerror.tcl: sync with core-8-4-branch changes of 2005-07-28.
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXMouseEvent.c:
+
+ * generic/tkFrame.c: sync with core-8-4-branch changes of 2005-07-27.
+ * generic/tkIntDecls.h:
+ * generic/tkStubInit.c:
+ * generic/tkFrame.c:
+ * win/tkWinDraw.c:
+ * unix/tkUnixDraw.c:
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXSubwindows.c:
+
+ * macosx/tkMacOSXButton.c: sync with core-8-4-branch.
+ * macosx/tkMacOSXEntry.c:
+ * macosx/tkMacOSXScale.c:
+
+ * library/demos/menu.tcl: removed errant '}'.
+
+2005-08-04 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * doc/clipboard.n: Add example demonstrating custom types of clipboard
+ data.
+
+2005-07-25 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * library/*.tcl: Updated to use more 8.4 and 8.5 features as part of
+ resolving [Patch 1237759].
+
+2005-07-22 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * win/tkWinX.c: Define _WIN32_WINNT with NT SP 3 data to fix compiler
+ error because SendInput was not defined. The new msys_mingw7 release is
+ now needed to compile the HEAD with mingw gcc. [Bug 1210712]
+
+2005-07-21 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): corrected if
+ expression error (use of = instead of ==).
+
+2005-07-18 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTextMark.c: fix to segfault in "mark prev"
+ * tests/textIndex.test: [Bug 1240221]
+
+ * tests/textWind.test: make test more robust to avoid infinite loop
+
+2005-07-06 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/getOpenFile.n: correct -multiple docs (takes boolean)
+
+2005-07-05 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/Makefile.in: Purged use of TCLTESTARGS. [RFE 1161550]
+
+2005-06-23 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkConsole.c (TkConsolePrint): prevent potential NULL deref.
+
+ * macosx/tkMacOSXDefault.h: change ENTRY_BORDER defaults to from 5 to 2
+ to make default entry widgets in TkAqua look like in other aqua apps
+ (and have same border dimensions as other platforms). [Bug 1176610]
+
+2005-06-21 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/GetBitmap.3: Fix silly error in SYNOPSIS. [Bug 1224983]
+
+2005-06-19 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkImgGIF.c: Cleanse all static (i.e. non-thread-safe) data
+ at a miniscule performance hit.
+
+2005-06-18 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Makefile: for X11 build, add -X11 suffix to unversioned wish
+ symbolic link.
+
+ * unix/tcl.m4 (Darwin): add -headerpad_max_install_names to LDFLAGS to
+ ensure we can always relocate binaries with install_name_tool.
+
+ * unix/configure: autoconf-2.59
+
+2005-06-07 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ Bump patchlevel to a4 to distinguish from a3 release.
+
+2005-06-04 Jeff Hobbs <jeffh@ActiveState.com>
+
+ *** 8.5a3 TAGGED FOR RELEASE ***
+
+2005-06-02 Jim Ingham <jingham@apple.com>
+
+ * generic/tkEvent.c (InvokeFocusHandlers): On Mac OS X the scrollwheel
+ events are sent to the window under the mouse, not to the focus window
+
+ Another patch from M. Kirkham.
+
+ * macosx/tkMacOSXScrlbr.c (ThumbActionProc, ScrollBarBindProc): Record
+ the first mouse down point, and compute differences from that, rather
+ than getting the mouse down each time through the loop. The old method
+ would get fooled if you moved the mouse less than a text line height in
+ the text widget. [Bug 1083728]
+
+2005-06-03 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/Makefile: fixed 'embedded' target.
+
+2005-06-02 Reinhard Max <max@suse.de>
+
+ * unix/tkUnix.c (Tk_GetUserInactiveTime): Improvements to get it
+ working on Solaris, and panic if we run out of memory.
+ * unix/configure.in: Rework the searching for Xss, to make it work on
+ Solaris and provide more useful output. Use AC_HELP_STRING where
+ appropriate.
+ * unix/tcl.m4: synced from Tcl.
+ * unix/configure: regenerated with autoconf 2.59.
+
+2005-06-01 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinInt.h: added private decls of Tk_GetEmbeddedMenuHWND,
+ Tk_GetMenuHWND, TkWinCleanupContainerList, and TkpWmGetState to that
+ are used across source files.
+
+ * win/tkWinX.c (Tk_ResetUserInactiveTime): cast to squelch compiler
+ warning.
+
+2005-05-31 Reinhard Max <max@suse.de>
+
+ * doc/Inactive.3 (new file): C level API documentationn for
+ TIP#245 (Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime).
+ * tests/tk.test: Added tests for the TIP#245 implementation.
+
+2005-05-30 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkPanedWindow.c, tests/panedwindow.test: batch of fixes to
+ panedwindow from Daniel South. Improved auto-size to fit internal
+ windows, fixed sash placement at edge of pane, fixed calculation of
+ stretch amount for internal windows. [Bug 1124198, 1161543, 1054117,
+ 1010941, 795869, 690169, 1192323]
+
+ * generic/tkMenu.c (MenuCmd): create event handler earlier to ensure
+ proper destruction of menu through DestroyNotify. [Bug 1159367]
+
+ * library/console.tcl (::tk::ConsoleInit): print out first prompt and
+ swallow the extra "% " that comes once from Tcl on Windows.
+
+2005-05-29 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXFont.c: use Tcl_Panic instead of panic.
+
+ * unix/configure.in: added description of HAVE_XSS for autoheader.
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in: autoheader-2.59
+
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/Wish.xcode/project.pbxproj: added missing FRAMEWORK defines
+ introduced with configure/make based build.
+
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXNotify.c: fixed warnings.
+
+ * generic/tkDecls.h:
+ * generic/tkIntPlatDecls.h:
+ * generic/tkPlatDecls.h:
+ * generic/tkStubInit.c: ran missing 'make genstubs' for TIP245 changes
+ to tk.decls
+
+ * macosx/tkMacOSXXStubs.c (Tk_ResetUserInactiveTime): use symbolic
+ constant argument in call to UpdateSystemActivity();
+
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/Wish.xcode/project.pbxproj:
+ * unix/configure.in: added/corrected linking to IOKit.framework for
+ TIP245.
+
+ * unix/configure.in: skip X11 configure checks when building tk_aqua.
+ * unix/configure: autoconf-2.59
+
+2005-05-28 Donal K. Fellows <dkf@users.sf.net>
+
+ TIP #245 IMPLEMENTATION from Reinhard Max <max@suse.de>
+
+ * doc/tk.n: Documentation of [tk inactivity].
+ * win/tkWinX.c (Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime):
+ * unix/tkUnix.c (Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime):
+ * macosx/tkMacOSXXStubs.c: Implementations of the core API for
+ (Tk_GetUserInactiveTime): determining how long as user's left
+ (Tk_ResetUserInactiveTime): her machine alone.
+ * unix/configure.in: Test for XScreenSaver support.
+ * generic/tkCmds.c (Tk_TkObjCmd): Implementation of [tk inactivity].
+
+2005-05-27 Todd Helfter <tmh@users.sourceforge.net>
+
+ * library/menu.tcl: correct the sticky behavior of menus posted by
+ tk_popup so that they "stick" after the initial <ButtonRelease>
+ following the post, that is not over an active menu entry.
+
+2005-05-26 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXInit.c (TkpInit): fixed resource file extraction from
+ __tk_rsrc section to work with non-prebound .dylib and .bundle.
+
+ * macosx/Makefile: corrected EMBEDDED_BUILD check, use separate Tcl and
+ Tk version vars to properly support tk/x11 framework version
+ overriding, rewrite tkConfig.sh when overriding tk version, corrected
+ Wish.app symlink in tk build dir.
+
+ * unix/configure.in: corrected framework finalization to softlink stub
+ library to Versions/8.x subdir instead of Versions/Current.
+ * unix/configure: autoconf-2.59
+
+2005-05-25 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/Makefile.in (install-libraries): protect possible empty list in
+ for with list= trick for older shells.
+
+2005-05-23 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkFileFilter.c (FreeGlobPatterns): s/null/NULL/
+
+2005-05-24 Daniel Steffen <das@users.sourceforge.net>
+
+ * generic/tkTest.c: disable commands not available on TkAqua.
+
+ * macosx/Makefile:
+ * macosx/README:
+ * macosx/Tk-Info.plist.in (new file):
+ * macosx/Wish-Info.plist.in (new file):
+ * unix/Makefile.in:
+ * unix/configure.in:
+ * unix/tcl.m4:
+ * unix/tkUnixInit.c: moved all Darwin framework and TkAqua build
+ support from macosx/Wish.pbproj and macosx/Makefile into the standard
+ unix configure/make buildsystem, the project and macosx/Makefile are no
+ longer required to build Tk.framework and/or TkAqua. TkAqua is now
+ enabled by the --enable-aqua configure option, and static and
+ non-framework builds of TkAqua are now available via the standard
+ configure switches. Tk/X11 can also be built as a framework. The
+ macosx/Makefile now wraps the unix buildsystem and no longer uses the
+ projects, embedded builds are still only available via this Makefile,
+ but for other builds it is not longer required (but its current
+ functionality is still available for backwards compatibility). The
+ projects currently do not call through to the Makefile to build (unlike
+ Tcl.pbproj) so project builds may differ from makefile builds. Due to
+ issues with spaces in pathnames, 'Wish Shell.app' has been renamed to
+ 'Wish.app', the macosx/Makefile installs backwards compatibility
+ symlinks for the old name.
+ * macosx/tkMacOSXInit.c (TkpInit): added support for Tk resource file
+ in non-framework and static builds: the resource file is copied into a
+ __tk_rsrc MachO section of the library or executable at link time and
+ extracted into a temporary location at initialization.
+ * unix/configure: autoconf-2.59
+ * unix/tkConfig.h.in (new file): autoheader-2.59
+
+ * macosx/Wish.pbproj/project.pbxproj:
+ * macosx/Tk-Info.plist:
+ * macosx/Wish-Info.plist:
+ * macosx/tkAboutDlg.r: updated copyright years to 2005.
+
+2005-05-22 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkFileFilter.c (TkGetFileFilters): Add all filters, not just
+ the first one. [Bug 1206133]
+
+2005-05-15 Jim Ingham <jingham@apple.com>
+
+ Fixes from Michael Kirkham:
+
+ * macosx/tkMacOSXMenu.c (TkpConfigureMenuEntry): Thinko in clearing the
+ ENTRY_ACCEL_MASK before re-parsing it. [Bug 1012852]
+
+ * macosx/tkMacOSXScrlbr.c (UpdateControlValues): Don't set the control
+ value BEFORE setting the min and max or the control manager will reset
+ it for you. [Bug 1202181]
+
+ * macosx/tkMacOSXXStubs.c (TkMacOSXXGetPixel, TkMacOSXXPutPixel):
+ Restore the port to what it was before putting we were called. [Bug
+ 1202223]
+
+2005-05-14 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXScrlbr.c (ThumbActionProc): Missing Tcl_Release.
+
+2005-05-14 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXNotify.c: introduction of new tcl notifier based on
+ CFRunLoop allows replacement of the custom TkAqua notifier by a
+ standard tcl event source. Removes requirement of threaded tcl core
+ for TkAqua, allows to stub-link TkAqua against Tcl by removing use of
+ the unstubbed TclInitNotifier & TclFinalizeNotifier. [Tcl Patch
+ 1202052]
+
+ * macosx/Wish.xcode/project.pbxproj:
+ * macosx/Wish.pbproj/project.pbxproj: stub-link TkAqua: build with
+ USE_TCL_STUBS and link against libtclstub instead of Tcl.framework,
+ unexport libtclstub symbols from Tk to avoid duplicate symbol warnings
+ when linking with both Tcl and Tk, fixes for gcc4.0 warnings.
+
+ * macosx/Wish.xcode/project.pbxproj: sync with Wish.pbproj changes
+ since 2004-11-19.
+ NOTE: to use this project, need to uncomment the tclConfig.h settings
+ at the top of tcl/unix/configure.in, autoconf and rebuild tcl !
+
+ * macosx/tkMacOSXBitmap.c:
+ * macosx/tkMacOSXButton.c:
+ * macosx/tkMacOSXDialog.c:
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXHLEvents.c:
+ * macosx/tkMacOSXInit.c:
+ * macosx/tkMacOSXKeyboard.c:
+ * macosx/tkMacOSXMenu.c:
+ * macosx/tkMacOSXMenubutton.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXXStubs.c: fixed gcc 4.0 warnings.
+
+ * unix/tcl.m4: sync with tcl
+ * unix/configure: autoconf-2.59
+
+2005-05-10 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * library/text.tcl: test and fix to TextPrevPara to avoid infinite loop
+ * tests/textIndex.test: at start of widget. [Bug 1191895]
+
+ * generic/tkTextDisp.c: better synchronisation between explicit and
+ implicit pixel line-height calculations. [Bug 1186558]
+
+2005-05-10 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkTextDisp.c (GetXView): Improved numerical precision of
+ calculation of [.t xview] return values.
+ * tests/textDisp.test: Match greater precisions of [.t xview] and
+ [.t yview] values in tests.
+
+2005-05-06 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/configure: regen
+ * unix/configure.in: Add AC_C_BIGENDIAN check and pkg-config xft checks
+ to extend xft search.
+ * unix/tcl.m4: Correct Solaris 10 (5.10) check and add support for
+ x86_64 Solaris cc builds.
+
+2005-04-28 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * macosx/tkMacOSXNotify.c (TkMacOSXWaitForEvent): Fix for typo in
+ waitTime computation. [Bug 1191097]
+ (AlertNotifier): Factor out the core of the notifier alerting code.
+
+2005-04-25 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXNotify.c: sync with tclUnixNotfy.c changes since
+ 2004-06-22, added compile time check for threaded tcl core, removed
+ unthreaded code paths as they are never used anyway, fixed
+ TkMacOSXAlertNotifier() implementation.
+
+ * unix/Makefile.in: added TCL_STUB_LIB_FILE, needed for unexporting of
+ symbols from libtclstub to avoid duplicate symbol warnings.
+
+ * unix/tcl.m4 (Darwin): added configure checks for recently added
+ linker flags -single_module and -search_paths_first to allow building
+ with older tools (and on Mac OS X 10.1), use -single_module in SHLIB_LD
+ and not just T{CL,K}_SHLIB_LD_EXTRAS, added unexporting from Tk of
+ symbols from libtclstub to avoid duplicate symbol warnings, added
+ PLAT_SRCS definition for Mac OS X, defined MODULE_SCOPE to
+ __private_extern__.
+ (SC_MISSING_POSIX_HEADERS): added caching of dirent.h check.
+
+ * unix/configure: autoconf-2.59
+
+2005-04-22 George Peter Staplin <GeorgePS@XMission.com>
+
+ * doc/FontId.3: I fixed a typo. "linespace" was used instead of
+ "ascent". I also added a .PP before the paragraph to make the
+ formatting look better for the ascent paragraph.
+
+2003-04-18 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixRFont.c(Tk_MeasureChars): Use Tcl_UtfToUnichar() for lax
+ UTF-8 parsing instead of strict parsing with FcUtf8ToUcs4()
+ [fix/workaround for Bug 1185640]
+
+2003-04-18 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * library/text.tcl
+ * doc/text.n: corrected 'Home' and 'End' and Control-a/e handling to
+ work with display lines. This was an ommission of the previous tip155
+ patch. Clarified the documentation on this point.
+
+2005-04-14 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tkUnixFont.c (FontMapLoadPage): reorder char[] decls to avoid
+ possible segv. Minimal fix for [Bug 1122671]
+
+2005-04-12 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/tkfbox.tcl (::tk::dialog::file::): fix typeMenuLab ref. Add
+ undoc'd ::tk::dialog::file::showHiddenBtn var (default 0) that will add
+ a "Show Hidden" checkbutton to tk_get*File and tk_chooseDirectory if
+ set to true.
+ * library/choosedir.tcl (::tk::dialog::file::chooseDir::): fix
+ cancelBtn ref, add hiddenBtn ref for "Show Hidden" button.
+
+2005-04-09 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/README: updated requirements for OS & developer tool versions
+ + other small fixes/cleanup.
+
+ * macosx/tkMacOSXEntry.c (ComputeIncDecParameters): manually define
+ constants present only in 10.3 headers so that we can build on 10.2.
+
+ * macosx/Wish.pbproj/project.pbxproj: fixed absolute path to tkEntry.h
+ that confused 10.2 PBX.
+
+ * unix/tcl.m4 (Darwin): added -single_module linker flag to
+ TCL_SHLIB_LD_EXTRAS and TK_SHLIB_LD_EXTRAS.
+ * unix/configure: autoconf-2.59
+
+2005-04-07 Mo DeJong <mdejong@users.sourceforge.net>
+
+ * macosx/tkMacOSXWm.c (TkWmStackorderToplevelWrapperMap,
+ (TkWmStackorderToplevel):
+ * unix/tkUnixWm.c (TkWmStackorderToplevelWrapperMap,
+ (TkWmStackorderToplevel):
+ * win/tkWinWm.c (TkWmStackorderToplevelWrapperMap,
+ (TkWmStackorderToplevel):
+ Fix panic in wm stackorder when a toplevel is created on another
+ display. The code now ignores toplevels that have a display that does
+ not match the display of the parent window. [Bug 1152809]
+
+2005-04-06 Donal K. Fellows <dkf@users.sf.net>
+
+ * doc/wm.n, doc/winfo.n, doc/tk.n, doc/send.n, doc/selection.n:
+ * doc/radiobutton.n, doc/photo.n, doc/options.n, doc/menu.n:
+ * doc/listbox.n, doc/getOpenFile.n, doc/font.n, doc/event.n:
+ * doc/entry.n, doc/clipboard.n, doc/checkbutton.n, doc/canvas.n:
+ * doc/button.n, doc/bind.n, doc/TextLayout.3, doc/MeasureChar.3:
+ * doc/GetRelief.3, doc/GetPixels.3, doc/GetJustify.3, doc/GetFont.3:
+ * doc/GetCursor.3, doc/GetColor.3, doc/GetBitmap.3, doc/GetAnchor.3:
+ * doc/FontId.3, doc/CrtWindow.3, doc/CrtImgType.3, doc/ConfigWidg.3:
+ * doc/3DBorder.3: Purge old .VS/.VE macro instances.
+
+2005-04-04 Don Porter <dgp@users.sourceforge.net>
+
+ * library/comdlg.tcl: Added Macintosh file type validation to
+ [::tk::FDGetFileTypes]. [Bug 1083878] (Thanks, Vince Darley)
+
+2005-04-04 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.c:
+ * tests/text.test: fix to elide searching problems [Bug 1174269] and
+ disappearing cursor with insertofftime 0. [Bug 1169429]
+
+2005-04-03 Peter Spjuth <peter.spjuth@space.se>
+
+ * tests/grid.test:
+ * generic/tkGrid.c: Fixed bug in geometry calculations for widgets that
+ span multiple columns/row. Bug was introduced in 8.5a1 when fixing
+ 792387. [Bug 1175092]
+
+2005-03-29 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tcl.m4, win/configure: do not require cygpath in macros to allow
+ msys alone as an alternative.
+
+2005-03-27 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * tests/textDisp.test: added test for fix of 2005-03-15.
+
+2005-03-24 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXEntry.c (TkpDrawEntryBorderAndFocus): Dopey bug - do
+ not reset the width for entry widgets - we didn't change it for them.
+
+2005-03-23 Jim Ingham <jingham@apple.com>
+
+ These changes allow us to draw the Entry and Spinbox widget with a
+ native look and feel on Mac OS X.
+
+ * generic/tkEntry.h: New file, extracting the definitions of Entry and
+ Spinbox.
+ * generic/tkEntry.c (DisplayEntry): Call out to TkpDrawSpinboxButtons
+ and TkpDrawEntryBorderAndFocus. Also provide default implementations
+ for X11 & Win.
+ * macosx/tkMacOSXEntry.c: New file, implements the entry & focus and
+ spinbox button drawing.
+ * tkMacOSXDefaults.h: Change the Mac OS X defaults so they fit the
+ native widget shapes.
+
+ This is cleanup thanks to Neil Madden <nem@cs.nott.ac.uk>.
+
+ * macosx/tkMacOSXWm.c (TkMacOSXWinStyle) New function.
+ (TkUnsupported1ObjCmd): New function, replaces the un-objectified
+ version of the command.
+ * generic/tkInt.h: Swap TkUnsupported1Cmd for TkUnsupported1ObjCmd.
+ * generic/tkWindow.c (): Ditto.
+
+ This adds a "-notify" flag to "wm attributes" that will bounce the
+ dock icon on Mac OS X. This is from Revar Desmera <revarbat@gmail.com>
+
+ * macosx/tkMacOSXWm.c (WmAttrGetNotifyStatus, WmAttrSetNotifyStatus):
+ New functions.
+ (WmAttributesCmd): Add the -notify.
+ * doc/wm.n: Document -notify.
+
+2005-03-19 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tkConsole.c (Tk_CreateConsoleWindow,TkConsolePrint): Rewrite
+ so that TkConsolePrint cannot become detached from the console when the
+ [console] command is renamed. [Bug 1016385]
+
+2005-03-15 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTextDisp.c: fix for [Bug 1143776] in adjusting displayed
+ lines when running into the bottom of the window.
+
+2005-03-14 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXScrlbr.c (ThumbActionProc): No need to use "update
+ idletasks" here, TclServiceIdle will do as well and it is simpler.
+
+ These changes implement a change on the Mac OS X side. When we unmap a
+ window we mark all its children as unmapped (not following toplevels.
+ But we preserve whether they had been mapped before, and when the
+ parent is remapped, we remap the children as well. [Bug 940117]
+
+ * macosx/tkMacOSXInt.h: Added TK_MAPPED_IN_PARENT
+ * macosx/tkMacOSXSubwindows.c (FixMappingFlags): New function.
+ (XMapWindow): Call FixMappingFlags.
+ (XUnMapWindow): Ditto.
+
+ * macosx/tkMacOSXSubwindows.c (XMoveResizeWindow): Update the xOff &
+ yOff data in the Macdrawable even if the native window hasn't been
+ created yet. [Bug 700305]
+ (XMoveWindow): Ditto.
+ (XResizeWindow): Ditto.
+
+2005-03-15 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * unix/tcl.m4: Updated the OpenBSD configuration and regenerated the
+ * unix/configure: configure script.
+
+2005-03-14 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tkEvent.c (InvokeClientMessageHandlers): Ensure that client
+ messages are handled correctly. Thanks to George Petasis for tracking
+ this down. [Bug 1162356]
+
+2005-03-11 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXButton.c (TkpDisplayButton): Set the port to the
+ Button window's port BEFORE you set the clip, otherwise you are setting
+ the clip on the wrong window!
+ Also, a little cleanup - move x & y into the branches where they are
+ used, and don't compute the TextAnchor if we are using the native
+ button text, since we aren't going to use it.
+ (TkMacOSXDrawControl): Call ShowControl & SetControlVisibility in a
+ more logical order.
+
+ * tkMacOSXInt.h: Add TkMacOSXGenerateFocusEvent.
+ * tkMacOSXSubwindows.c (XDestroyWindow): We don't get Activate events
+ for the remaining windows when a Floating window is destroyed. This can
+ cause the focus to disappear. So catch this case when the window is
+ being destroyed and move the focus here.
+
+ * tkMacOSXWindowEvent.c (TkMacOSXGenerateFocusEvent): Make this public
+ (used to be GenerateFocusEvent) since we need it here and in
+ tkMacOSXSubwindows.c. Then change the name everywhere it is used. [Bug
+ 1124237]
+
+2005-03-10 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXMouseEvent.c (TkMacOSXProcessMouseEvent): In the
+ inDrag section, set the GrafPort to the drag window's GrafPort before
+ doing LocalToGlobal. [Bug 1160025]
+
+2005-03-09 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXInit.c (TkpInit): Check to see if the environment
+ variable XCNOSTDIN is set, and if so, close stdin & stdout. This is
+ necessary to make remote debugging under Xcode work properly.
+
+2005-03-08 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinWm.c (WinSetIcon): fix GCLP_ICONSM -> GCLP_HICONSM.
+
+ * win/makefile.vc: clarify necessary defined vars that can come from
+ MSVC or the Platform SDK.
+
+2005-02-28 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinX.c (GenerateXEvent): correct %A translation on MouseWheel.
+ [Bug 1118340]
+
+2005-02-24 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSX.h: fixed incorrect inclusion of internal header.
+ * macosx/tkMacOSXNotify.c: corrected included headers.
+
+2005-02-22 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXDialog.c (Tk_GetSaveFileObjCmd, NavServicesGetFile):
+ fixed encoding problems with -initialfile & -filetypes and corrected
+ potential buffer overrun with -initialdir/-initialfile. [Bug 1146057]
+
+2005-02-16 Mo DeJong <mdejong@users.sourceforge.net>
+
+ TIP#223 IMPLEMENTATION
+
+ * doc/wm.n: Add documentation for -fullscreen attribute.
+ * tests/winWm.test: Add -fullscreen to wm attribute usage message.
+ * tests/wm.test: Add -fullscreen to wm attribute usage message. Add
+ -fullscreen attribute test cases for Windows.
+ * win/tkWinWm.c (WmInfo, UpdateWrapper, TkpWmSetFullScreen)
+ (WmAttributesCmd, UpdateGeometryInfo):
+ Implement TIP 223 [wm attributes -fullscreen].
+
+2005-02-14 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkText.c:
+ * generic/tkText.h:
+ * generic/tkTextDisp.c:
+ * generic/tkTextIndex.c:
+ * generic/tkTextBTree.c:
+ * doc/text.n:
+ * tests/textDisp.test:
+ * tests/textIndex.test: fix of longstanding elide problem when eliding
+ a newline without eliding the entire logical line. [Bug 443848]
+
+2005-02-14 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * doc/options.n: note -cursor {} behavior. [Bug 965618]
+
+2005-02-14 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * tests/all.tcl: Add a [package require Tk] so that a missing display
+ causes an early failure and keeps the error trace short. Issue observed
+ in [FRQ 11122147], even though that's unrelated.
+
+2005-02-11 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * library/panedwindow.tcl (::tk::panedwindow::Cursor): check window
+ existence on delayed call. [Bug 949792]
+
+ * doc/text.n: note 'image' key in 'dump' command. [Bug 1115907]
+
+ * win/tkWinWm.c (TkWinGetIcon): fix toplevel retrieval for determining
+ icon ref (potential crash). [Bug 1105738]
+
+ * generic/tkCanvBmap.c (ConfigureBitmap, ComputeBitmapBbox): Fixed
+ possible crash with disabled bmap and bbox handling [Bug 1119460]
+ (BitmapToPostscript): made aware of various bitmap types
+
+ * unix/Makefile.in: remove SHLIB_LD_FLAGS (only for AIX, inlined into
+ * unix/tcl.m4: SHLIB_LD). Combine AIX-* and AIX-5 branches in
+ * unix/configure: SC_CONFIG_CFLAGS. Correct gcc builds for AIX-4+ and
+ HP-UX-11. autoconf-2.59 gen'd.
+
+2005-02-09 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * tests/wm.test: Convert to use more tcltest2 features.
+
+2005-02-07 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tkCanvas.c (CanvasWidgetCmd): Fix stupid mistake in variable
+ names, reported by Andreas Leitgeb.
+
+2005-02-03 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tkCanvas.c (GetStaticUids): New function to manage the
+ thread-specific data detailing the list of all uids in a thread.
+ (typeList): Protect this (the other piece of global data) with a mutex.
+ [Bug 1114977]
+
+2005-01-31 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * unix/tcl.m4, unix/configure: add solaris-64 gcc build support. [Bug
+ 1021871]
+
+2005-01-31 Donal K. Fellows <donal.k.fellows@manchester.ac.uk>
+
+ * generic/tkImgPhoto.c (PhotoFormatThreadExitProc): Made the comments
+ in the code more relevant to the function they were documenting! [Bug
+ 1110553]
+
+ * library/msgs/es_ES.msg: Added more localization for Spanish Spanish.
+ [Bug 1111213]
+
+2005-01-25 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXInit.c (TkpInit): set tcl_interactive to 1 to show
+ console at startup instead of directly calling [console show].
+
+ * unix/tcl.m4 (Darwin): fixed bug with static build linking to dynamic
+ library in /usr/lib etc instead of linking to static library earlier in
+ search path. [Tcl Bug 956908]
+ Removed obsolete references to Rhapsody.
+ * unix/configure: autoconf-2.57
+
+2005-01-18 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/demos/menu.tcl: Reworked to make dialogs children of the
+ demo widget so that they are properly visible. Issue reported by Keith
+ Nash <k.j.nash@usa.net>
+
+2005-01-13 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/tkfbox.tcl (IconList_Selection, IconList_Create):
+ (IconList_Arrange): Assorted tk_getOpenFile fixes. [part of Bug 600313]
+ (IconList_ShiftMotion1): Also fix shift-drag.
+
+2005-01-12 Don Porter <dgp@users.sourceforge.net>
+
+ * unix/tcl.m4: Sync'ed to Tcl's copy.
+ * unix/configure: autoconf-2.57
+
+2005-01-12 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/event.n: Added section on predefined virtual events. [Bug 608115]
+
+2005-01-11 Vince Darley <vincentdarley@users.sourceforge.net>
+
+ * generic/tkTextDisp.c: fix to scrollbar height calculations of text
+ widgets containing a single very long (wrapped) line. This fixes at
+ least part of [Bug 1093631].
+
+2005-01-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkObj.c (TkParsePadAmount):
+ * generic/tkPack.c: Moved function to tkObj.c and rewrote so that it
+ takes advantage of Tcl_Objs properly and cannot leave objects in an
+ inconsistent state. [Bug 1098779]
+
+2005-01-10 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/Makefile.in, unix/configure.in, unix/tkConfig.sh.in:
+ Remove ${DBGX}, ${TK_DBGX} from Tk build system. [Patch 1081595]
+ * unix/tcl.m4: re-synced with tcl/unix/tcl.m4
+ * unix/configure: Regenerated.
+
+2005-01-07 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * generic/tkWindow.c (GetScreen): Make sure the result is reset on all
+ error paths to stop strange errors. [Bug 697915]
+
+2005-01-05 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/loadTk.n, doc/toplevel.n: Convert to other form of emacs mode
+ control comment to prevent problems with old versions of man. [Bug
+ 1085127]
+
+2005-01-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * win/tkWinWm.c (TkWinWmCleanup): clean up layered window class. This
+ caused crash in reinit of Tk (as seen in plugin).
+
+ ******************************************************************
+ *** CHANGELOG ENTRIES FOR 2004 AND 2003 IN "ChangeLog.2004" ***
+ *** CHANGELOG ENTRIES FOR 2002 AND EARLIER IN "ChangeLog.2002" ***
+ ******************************************************************
diff --git a/README b/README
index bc2a001..ff13f01 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
README: Tk
- This is the Tk 8.5.11 source distribution.
+ This is the Tk 8.6b2 source distribution.
http://tcl.sourceforge.net/
You can get any source release of Tcl from the file distributions
link at the above URL.
@@ -11,9 +11,9 @@ This directory contains the sources and documentation for Tk, an X11
toolkit implemented with the Tcl scripting language.
For details on features, incompatibilities, and potential problems with
-this release, see the Tcl/Tk 8.5 Web page at
+this release, see the Tcl/Tk 8.6 Web page at
- http://www.tcl.tk/software/tcltk/8.5.html
+ http://www.tcl.tk/software/tcltk/8.6.html
or refer to the "changes" file in this directory, which contains a
historical record of all changes to Tk.
diff --git a/carbon/GNUmakefile b/carbon/GNUmakefile
new file mode 100644
index 0000000..6a4e9b8
--- /dev/null
+++ b/carbon/GNUmakefile
@@ -0,0 +1,314 @@
+########################################################################################################
+#
+# Makefile wrapper to build tk on Mac OS X in a way compatible with the tk/carbon Xcode buildsystem
+# uses the standard unix build system in tk/unix (which can be used directly instead of this
+# if you are not using the tk/carbon projects).
+#
+# Copyright (c) 2002-2008 Daniel A. Steffen <das@users.sourceforge.net>
+#
+# See the file "license.terms" for information on usage and redistribution of
+# this file, and for a DISCLAIMER OF ALL WARRANTIES.
+########################################################################################################
+
+#-------------------------------------------------------------------------------------------------------
+# customizable settings
+
+DESTDIR ?=
+INSTALL_ROOT ?= ${DESTDIR}
+
+BUILD_DIR ?= ${CURDIR}/../../build
+SYMROOT ?= ${BUILD_DIR}/${PROJECT}
+OBJROOT ?= ${SYMROOT}
+
+EXTRA_CONFIGURE_ARGS ?=
+EXTRA_MAKE_ARGS ?=
+
+INSTALL_PATH ?= /Library/Frameworks
+APPLICATION_INSTALL_PATH ?= /Applications/Utilities
+PREFIX ?= /usr/local
+BINDIR ?= ${PREFIX}/bin
+LIBDIR ?= ${INSTALL_PATH}
+MANDIR ?= ${PREFIX}/man
+
+# tcl build directory (containing tclConfig.sh and Makefile)
+TCL_BUILD_DIR ?= ${BUILD_DIR}/tcl/${BUILD_STYLE}
+# location of installed tcl, only used if tcl in TCL_BUILD_DIR can't be found
+TCL_FRAMEWORK_DIR ?= /Library/Frameworks
+TCLSH_DIR ?= ${PREFIX}
+
+# set to non-empty value to install manpages in addition to html help:
+INSTALL_MANPAGES ?=
+
+# set to non-empty value to build TkX11 instead of TkAqua:
+TK_X11 ?=
+
+#-------------------------------------------------------------------------------------------------------
+# meta targets
+
+meta := all install embedded install-embedded clean distclean test
+
+styles := develop deploy
+
+all := ${styles}
+all : ${all}
+
+install := ${styles:%=install-%}
+install : ${install}
+install-%: action := install-
+
+embedded := ${styles:%=embedded-%}
+embedded : embedded-deploy
+install-embedded := ${embedded:%=install-%}
+install-embedded : install-embedded-deploy
+
+clean := ${styles:%=clean-%}
+clean : ${clean}
+clean-%: action := clean-
+distclean := ${styles:%=distclean-%}
+distclean : ${distclean}
+distclean-%: action := distclean-
+
+test := ${styles:%=test-%}
+test : ${test}
+test-%: action := test-
+
+targets := $(foreach v,${meta},${$v})
+
+#-------------------------------------------------------------------------------------------------------
+# build styles
+
+BUILD_STYLE =
+CONFIGURE_ARGS =
+OBJ_DIR = ${OBJROOT}/${BUILD_STYLE}
+
+empty :=
+space := ${empty} ${empty}
+objdir = $(subst ${space},\ ,${OBJ_DIR})
+
+develop_make_args := BUILD_STYLE=Development CONFIGURE_ARGS=--enable-symbols
+deploy_make_args := BUILD_STYLE=Deployment INSTALL_TARGET=install-strip
+embedded_make_args := EMBEDDED_BUILD=1
+install_make_args := INSTALL_BUILD=1
+
+${targets}:
+ ${MAKE} ${action}${PROJECT} \
+ $(foreach s,${styles} embedded install,$(if $(findstring $s,$@),${${s}_make_args}))
+
+#-------------------------------------------------------------------------------------------------------
+# project specific settings
+
+PROJECT := tk
+PRODUCT_NAME := Tk
+
+UNIX_DIR := ${CURDIR}/../unix
+VERSION := $(shell awk -F= '/^TK_VERSION/ {print $$2; nextfile}' ${UNIX_DIR}/configure.in)
+TCL_VERSION := ${VERSION}
+wish := wish
+WISH = wish${VERSION}
+
+BUILD_TARGET := all tktest
+INSTALL_TARGET := install
+
+ifneq ($(wildcard $(subst ${space},\ ,${TCL_BUILD_DIR})/tclConfig.sh),)
+TCL_DIR := ${TCL_BUILD_DIR}
+TCL_FRAMEWORK_DIR := ${TCL_BUILD_DIR}/..
+MAKE_VARS :=
+else
+TCL_DIR := ${TCL_FRAMEWORK_DIR}/Tcl.framework
+TCL_EXE := ${TCLSH_DIR}/tclsh${TCL_VERSION}
+MAKE_VARS := TCL_EXE
+export DYLD_FRAMEWORK_PATH := ${TCL_FRAMEWORK_DIR}
+endif
+
+export CPPROG := cp -p
+
+ifeq (${TK_X11},)
+override CONFIGURE_ARGS := ${CONFIGURE_ARGS} --enable-aqua=carbon
+else
+override CONFIGURE_ARGS := ${CONFIGURE_ARGS} --enable-xft
+VERSION := ${VERSION}-X11
+wish := ${wish}-X11
+override EMBEDDED_BUILD :=
+endif
+
+INSTALL_TARGETS = install-binaries install-libraries
+ifeq (${EMBEDDED_BUILD},)
+INSTALL_TARGETS += install-private-headers install-demos
+endif
+ifeq (${INSTALL_BUILD}_${EMBEDDED_BUILD}_${BUILD_STYLE},1__Deployment)
+INSTALL_TARGETS += html-tk
+ifneq (${INSTALL_MANPAGES},)
+INSTALL_TARGETS += install-doc
+endif
+endif
+
+MAKE_VARS += INSTALL_ROOT INSTALL_TARGETS VERSION
+MAKE_ARGS_V = $(foreach v,${MAKE_VARS},$v='${$v}')
+
+build-${PROJECT}: target = ${BUILD_TARGET}
+install-${PROJECT}: target = ${INSTALL_TARGET}
+clean-${PROJECT} distclean-${PROJECT} test-${PROJECT}: \
+ target = $*
+
+DO_MAKE = +${MAKE} -C "${OBJ_DIR}" ${target} ${MAKE_ARGS_V} ${MAKE_ARGS} ${EXTRA_MAKE_ARGS}
+
+#-------------------------------------------------------------------------------------------------------
+# locations for custom tk install actions
+
+ifeq (${INSTALL_BUILD},1)
+TOP_DIR := ${INSTALL_ROOT}/
+APP_DIR := ${APPLICATION_INSTALL_PATH}
+FMWK_DIR := ${LIBDIR}
+else
+TOP_DIR := ${SYMROOT}
+APP_DIR := .
+FMWK_DIR := .
+endif
+
+TCL_FMWK_DIR := ${FMWK_DIR}/Tcl.framework/Versions/${TCL_VERSION}
+TK_FMWK_DIR := ${FMWK_DIR}/${PRODUCT_NAME}.framework/Versions/${VERSION}
+
+#-------------------------------------------------------------------------------------------------------
+# build rules
+
+${PROJECT}:
+ ${MAKE} install-${PROJECT} INSTALL_ROOT="${OBJ_DIR}/"
+
+${objdir}/Makefile: ${UNIX_DIR}/Makefile.in ${UNIX_DIR}/configure \
+ ${UNIX_DIR}/tkConfig.sh.in Tk-Info.plist.in Wish-Info.plist.in
+ mkdir -p "${OBJ_DIR}" && cd "${OBJ_DIR}" && \
+ if [ ${UNIX_DIR}/configure -nt config.status ]; then ${UNIX_DIR}/configure -C \
+ --prefix="${PREFIX}" --bindir="${BINDIR}" --libdir="${LIBDIR}" \
+ --mandir="${MANDIR}" --enable-threads --enable-framework \
+ --with-tcl="${TCL_DIR}" \
+ ${CONFIGURE_ARGS} ${EXTRA_CONFIGURE_ARGS}; else ./config.status; fi
+ifneq (${VERSION},${TCL_VERSION})
+ @cd "${OBJ_DIR}" && sed -e 's#/Versions/${TCL_VERSION}#/Versions/${VERSION}#' \
+ tkConfig.sh > tkConfig.sh.1 && mv -f tkConfig.sh.1 tkConfig.sh
+endif
+
+build-${PROJECT}: ${objdir}/Makefile
+ ${DO_MAKE}
+ifeq (${INSTALL_BUILD},)
+# symolic link hackery to trick
+# 'make install INSTALL_ROOT=${OBJ_DIR}'
+# into building Tk.framework and wish in ${SYMROOT}
+ @cd "${OBJ_DIR}" && mkdir -p $(dir $(subst ${space},\ ,./${LIBDIR})) $(dir $(subst ${space},\ ,./${BINDIR})) "${SYMROOT}" && \
+ rm -rf "./${LIBDIR}" "./${BINDIR}" && ln -fs "${SYMROOT}" "./${LIBDIR}" && \
+ ln -fs "${SYMROOT}" "./${BINDIR}" && ln -fs "${OBJ_DIR}/tktest" "${SYMROOT}"
+ifeq (${TK_X11},)
+ @rm -f "${OBJ_DIR}/${BINDIR}" && \
+ ln -fs Wish.app/Contents/MacOS/Wish "${SYMROOT}/${WISH}"
+endif
+# Create symbolic link to Tcl.framework in ${SYMROOT}if necessary
+ @cd "${SYMROOT}" && if [ ! -e Tcl.framework -o -L Tcl.framework ]; then \
+ rm -f Tcl.framework && ln -s "${TCL_FRAMEWORK_DIR}/Tcl.framework" . ; fi
+endif
+
+install-${PROJECT}: build-${PROJECT}
+ifeq (${EMBEDDED_BUILD}_${INSTALL_ROOT},1_)
+ @echo "Cannot install-embedded with empty INSTALL_ROOT !" && false
+endif
+ifeq (${EMBEDDED_BUILD},1)
+ @rm -rf "${INSTALL_ROOT}/${LIBDIR}/Tk.framework"
+endif
+ ${DO_MAKE}
+ifeq (${EMBEDDED_BUILD}_${TK_X11},1_)
+# workaround bug with 'cp -pRH' on Darwin 6 and earlier
+ @if [ "`uname -r | awk -F. '{print $$1}'`" -lt 7 ]; then \
+ mkdir -p "${TOP_DIR}"/{"${TCL_FMWK_DIR}","${TK_FMWK_DIR}"}/PrivateHeaders; fi
+endif
+ifeq (${INSTALL_BUILD},1)
+ifeq (${EMBEDDED_BUILD},1)
+# if we are embedding frameworks, don't install wish
+ @rm -f "${INSTALL_ROOT}${BINDIR}/${WISH}" && \
+ rmdir -p "${INSTALL_ROOT}${BINDIR}" 2>&- || true
+else
+# redo prebinding (when not building for Mac OS X 10.4 or later only)
+ @if [ "`echo "$${MACOSX_DEPLOYMENT_TARGET}" | \
+ awk -F '10\\.' '{print int($$2)}'`" -lt 4 -a "`echo "$${CFLAGS}" | \
+ awk -F '-mmacosx-version-min=10\\.' '{print int($$2)}'`" -lt 4 ]; \
+ then cd ${INSTALL_ROOT}/; \
+ if [ ! -d usr/lib ]; then mkdir -p usr && ln -fs /usr/lib usr/ && RM_USRLIB=1; fi; \
+ if [ -n "${TK_X11}" -a ! -d usr/X11R6 ]; then mkdir -p usr && ln -fs /usr/X11R6 usr/ && RM_USRX11=1; fi; \
+ if [ ! -d System ]; then ln -fs /System . && RM_SYSTEM=1; fi; \
+ if [ ! -d "./${LIBDIR}/Tcl.framework" ]; then ln -fs "${TCL_FRAMEWORK_DIR}/Tcl.framework" "./${LIBDIR}"; RM_TCL=1; fi; \
+ redo_prebinding -r . "./${TK_FMWK_DIR}/${PRODUCT_NAME}"; \
+ if [ -z "${TK_X11}" ]; then redo_prebinding -r . "./${TK_FMWK_DIR}/Resources/Wish.app/Contents/MacOS/Wish"; \
+ else redo_prebinding -r . "./${BINDIR}/${WISH}"; fi; \
+ if [ -n "$${RM_USRLIB:-}" ]; then rm -f usr/lib; rmdir -p usr 2>&-; fi; \
+ if [ -n "$${RM_USRX11:-}" ]; then rm -f usr/X11R6; rmdir -p usr 2>&-; fi; \
+ if [ -n "$${RM_SYSTEM:-}" ]; then rm -f System; fi; \
+ if [ -n "$${RM_TCL:-}" ]; then rm -f "./${LIBDIR}/Tcl.framework"; fi; fi
+# install wish symbolic link
+ @ln -fs ${WISH} "${INSTALL_ROOT}${BINDIR}/${wish}"
+endif
+endif
+ifeq (${BUILD_STYLE}_${EMBEDDED_BUILD},Development_)
+# keep copy of debug library around, so that
+# Deployment build can be installed on top
+# of Development build without overwriting
+# the debug library
+ @cd "${INSTALL_ROOT}${LIBDIR}/${PRODUCT_NAME}.framework/Versions/${VERSION}" && \
+ ln -f "${PRODUCT_NAME}" "${PRODUCT_NAME}_debug"
+endif
+ifeq (${TK_X11},)
+ifeq (${EMBEDDED_BUILD},)
+# install Wish.app link in APPLICATION_INSTALL_PATH and setup 'Wish Shell' compatibility links
+ @cd "${TOP_DIR}" && if [ -n "${APP_DIR}" ]; then mkdir -p "./${APP_DIR}" && rm -rf "./${APP_DIR}/Wish.app" && \
+ ln -fsh "./$$(echo "${APP_DIR}" | sed -e 's#/[^/][^/]*#/..#g')/${FMWK_DIR}/${PRODUCT_NAME}.framework/Resources/Wish.app" "./${APP_DIR}" && \
+ ln -fsh Wish.app "./${APP_DIR}/Wish Shell.app"; fi && \
+ ln -fsh Wish.app "./${TK_FMWK_DIR}/Resources/Wish Shell.app" && \
+ ln -fsh Wish "./${TK_FMWK_DIR}/Resources/Wish.app/Contents/MacOS/Wish Shell"
+else
+# if we are embedding frameworks, move them into the app and fix their install names
+ @cd "${TOP_DIR}" && \
+ rm -rf "./${APP_DIR}/Wish.app" && mkdir -p "./${APP_DIR}" && \
+ mv -f "./${TK_FMWK_DIR}/Resources/Wish.app" "./${APP_DIR}" && \
+ ln -fsh Wish.app "./${APP_DIR}/Wish Shell.app" && \
+ rm -rf "./${APP_DIR}/Wish.app/Contents/Frameworks" && \
+ mkdir -p "./${APP_DIR}/Wish.app/Contents/Frameworks" && \
+ ${CPPROG} -RH "./${FMWK_DIR}"/T{cl,k}.framework "./${APP_DIR}/Wish.app/Contents/Frameworks" && \
+ cd "./${APP_DIR}/Wish.app/Contents" && \
+ rm -rf Frameworks/Tcl.framework/{,/Versions/${TCL_VERSION}}/{Headers,PrivateHeaders,*_debug,lib*.a,*Config.sh} && \
+ rm -rf Frameworks/Tk.framework/{,/Versions/${VERSION}}/{Headers,PrivateHeaders,*_debug,lib*.a,*Config.sh} && \
+ fix_install_id ( ) { \
+ chmod -RH a+w "$$1"; \
+ install_name_tool -id $$(otool -L "$$1" | awk "/$$2\.framework.*[^:]\$$/ {sub(\"^.*/Frameworks\",\"@executable_path/../Frameworks\",\$$1); print \$$1}") "$$1"; \
+ chmod -RH a-w "$$1"; \
+ } && \
+ fix_install_name ( ) { \
+ chmod -RH a+w "$$1"; \
+ install_name_tool -change $$(otool -L "$$1" | awk "/$$2\.framework.*[^:]\$$/ {print \$$1; sub(\"^.*/Frameworks\",\"@executable_path/../Frameworks\",\$$1); print \$$1}") "$$1"; \
+ chmod -RH a-w "$$1"; \
+ } && \
+ fix_install_id Frameworks/Tcl.framework/Tcl Tcl && fix_install_id Frameworks/Tk.framework/Tk Tk && \
+ fix_install_name MacOS/Wish Tcl && fix_install_name MacOS/Wish Tk
+ifeq (${INSTALL_BUILD},1)
+ @cd "${TOP_DIR}" && rm -rf "./${FMWK_DIR}"/T{cl,k}.framework && rmdir -p "./${FMWK_DIR}" 2>&- || true
+endif
+endif
+endif
+
+clean-${PROJECT}: %-${PROJECT}:
+ ${DO_MAKE}
+ rm -rf "${SYMROOT}"/{${PRODUCT_NAME}.framework,${WISH},tktest}
+ rm -f "${OBJ_DIR}"{"${LIBDIR}","${BINDIR}"} && \
+ rmdir -p "${OBJ_DIR}"$(dir $(subst ${space},\ ,${LIBDIR})) 2>&- || true && \
+ rmdir -p "${OBJ_DIR}"$(dir $(subst ${space},\ ,${BINDIR})) 2>&- || true
+
+distclean-${PROJECT}: %-${PROJECT}: clean-${PROJECT}
+ ${DO_MAKE}
+ rm -rf "${OBJ_DIR}"
+
+test-${PROJECT}: %-${PROJECT}: build-${PROJECT}
+ ${DO_MAKE}
+
+#-------------------------------------------------------------------------------------------------------
+
+.PHONY: ${meta} ${targets} ${PROJECT} build-${PROJECT} install-${PROJECT} \
+ clean-${PROJECT} distclean-${PROJECT}
+
+.NOTPARALLEL:
+
+#-------------------------------------------------------------------------------------------------------
diff --git a/carbon/README b/carbon/README
new file mode 100644
index 0000000..85452c4
--- /dev/null
+++ b/carbon/README
@@ -0,0 +1,339 @@
+Tcl/TkAqua Carbon Mac OS X README
+---------------------------------
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+! This is the README for tk/carbon, the legacy version of TkAqua based on the !
+! Carbon API. This version of TkAqua is deprecated and no longer actively !
+! supported, it will be removed in a future release of Tk. It is only useful !
+! for users requiring support of Mac OS X releases older than 10.5. !
+! The supported version of TkAqua is located in tk/macosx and is based on the !
+! Cocoa API. It requires Mac OS X 10.5 or later. !
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+1. Where to go for support
+--------------------------
+
+- The tcl-mac mailing list on sourceforge is the best place to ask questions
+specific to Tcl & Tk on Mac OS X:
+ http://lists.sourceforge.net/lists/listinfo/tcl-mac
+(this page also has a link to searchable archives of the list, please check them
+before asking on the list, many questions have already been answered).
+
+- For general Tcl/Tk questions, the newsgroup comp.lang.tcl is your best bet:
+ http://groups.google.com/group/comp.lang.tcl/
+
+- The Tcl'ers Wiki also has many pages dealing with Tcl & Tk on Mac OS X, see
+ http://wiki.tcl.tk/references/3753!
+ http://wiki.tcl.tk/references/8361!
+
+- Please report bugs with Tcl or Tk on Mac OS X to the sourceforge bug trackers:
+ Tcl: http://sf.net/tracker/?func=add&group_id=10894&atid=110894
+ Tk: http://sf.net/tracker/?func=add&group_id=12997&atid=112997
+please make sure that your report Tk specific bugs to the tktoolkit project bug
+tracker rather than the tcl project bug tracker.
+Mac OS X specific bugs should usually be assigned to 'das' or 'wolfsuit'.
+
+
+2. Using Tcl/Tk on Mac OS X
+---------------------------
+
+- There are two versions of Tk available on Mac OS X: TkAqua using the native
+aqua widgets and look&feel, and TkX11 using the traditional unix X11 wigets.
+TkX11 requires an X11 server to be installed, such as Apple's X11 (which is
+available as an optional install on recent Mac OS X retail disks).
+TkAqua and TkX11 can be distinguished at runtime via [tk windowingsystem].
+
+- At a minimum, Mac OS X 10.1 is required to run Tcl and TkX11, and OS X 10.2 is
+required to run TkAqua. However OS X 10.3 or higher is recommended (certain
+[file] operations behave incorrectly on earlier releases).
+
+- Unless weak-linking is used, Tcl/Tk built on Mac OS X 10.x will not run on
+10.y with y < x; on the other hand Tcl/Tk built on 10.y will always run on 10.x
+with y <= x (but without any of the fixes and optimizations that would be
+available in a binary built on 10.x).
+Weak-linking is available on OS X 10.2 or later, it additionally allows Tcl/Tk
+built on 10.x to run on any 10.y with x > y >= z (for a chosen z >= 2).
+
+- Wish checks the Resources/Scripts directory in its application bundle for a
+file called AppMain.tcl, if found it is used as the startup script and the
+Scripts folder is added to the auto_path. This can be used to emulate the old
+OS9 TclTk droplets.
+
+- If standard input is a special file of zero length (e.g. /dev/null), Wish
+brings up the Tk console window at startup. This is the case when double
+clicking Wish in the Finder (or using 'open Wish.app' from the Terminal).
+
+- Tcl extensions can be installed in any of:
+ $HOME/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl
+ $HOME/Library/Frameworks /Library/Frameworks /Network/Library/Frameworks
+ /System/Library/Frameworks (searched in that order).
+Given a potential package directory $pkg, Tcl on OSX checks for the file
+$pkg/Resources/Scripts/pkgIndex.tcl as well as the usual $pkg/pkgIndex.tcl.
+This allows building extensions as frameworks with all script files contained in
+the Resources/Scripts directory of the framework.
+
+- [load]able binary extensions can linked as either ordinary shared libraries
+(.dylib) or as MachO bundles (since 8.4.10/8.5a3); only bundles can be unloaded,
+and bundles are also loaded more efficiently from VFS (no temporary copy to the
+native filesystem required).
+
+- The 'deploy' target of carbon/GNUmakefile installs the html manpages into the
+standard documentation location in the Tcl/Tk frameworks:
+ Tcl.framework/Resources/Documentation/Reference/Tcl
+ Tk.framework/Resources/Documentation/Reference/Tk
+No nroff manpages are installed by default by the GNUmakefiles.
+
+- The Tcl and Tk frameworks can be installed in any of the system's standard
+framework directories:
+ $HOME/Library/Frameworks /Library/Frameworks
+ /Network/Library/Frameworks /System/Library/Frameworks
+
+- /usr/bin/wish8.x is a script that calls a copy of 'Wish' contained in
+ Tk.framework/Resources
+
+- if 'Wish' is started from the Finder or via 'open', $argv contains a
+"-psn_XXXX" argument. This is the Wish's carbon process serial number, you may
+need to filter it out for cross platform compatibility of your scripts.
+
+- the env array is different when Wish is started from the Finder (i.e. via
+LaunchServices) than when it (or tclsh) is invoked from the Terminal, in
+particular PATH may not be what you expect. (Wish started by LaunchServices
+inherits loginwindow's environment variables, which are essentially those set in
+$HOME/.MacOSX/environment.plist, and are unrelated to those set in your shell).
+
+- As of Tk 8.4.7, TkAqua has a version of the low-level drawing primitives using
+the CoreGraphics routines - the code is primarily due to James Tittle. There
+were numerous problems with the QD version, mostly due to the different drawing
+model of QD & Tk. CG also trivially supports dashed lines, and the various end
+caps & miters. The old QD code is retained for now, just in case there are any
+compatibility problems. To switch back to the QD drawing, put
+ set tk::mac::useCGDrawing 0
+in your script before you do drawing.
+All CG drawing is antialiased by default, but (outline) linewidth can be used to
+control whether a line/shape is drawn antialiased. The antialiasing threshold is
+0 by default (i.e. antialias everything), it can be changed by setting
+ set tk::mac::CGAntialiasLimit <limit>
+in your script before drawing, in which case lines (or shapes with outlines)
+thinner than <limit> pixels will not be antialiased.
+
+- ATSUI text antialiasing by default uses the standard OS antialising settings.
+Setting the global variable '::tk::mac::antialiasedtext' allows to control text
+antialiasing from Tcl: a value of 1 enables AA, 0 disables AA and -1 restores
+the default behaviour of respecting the OS settings.
+
+- Scrollbars: There are two scrollbar variants in Aqua, normal & small. The
+normal scrollbar has a small dimension of 15, the small variant 11. Access to
+the small variant was added in Tk 8.4.2.
+
+- Cursors: You can now put up and spin the Classic MacOS spinner, and the
+counting hands and watch cursor. The way this is done is each of the spinners
+have a base name:
+ spinning: The circular B&W circular spinner
+ countinguphand: The counting up hand
+ countingdownhand: The counting down hand
+ countingupanddownhand: The counting up then down hand
+ watch: The watch cursor
+Then to get the sequential variants, add an integer to the end of the base name.
+So, for instance this code will spin the spinner:
+ proc spinCursor {widget count} {
+ $widget configure -cursor spinning$count
+ after 100 spinCursor [incr count]
+ }
+This was added in Tk 8.4.2
+
+- If you want to use Remote Debugging with Xcode 1.5 or 2.2, you need to set the
+environment variable XCNOSTDIN to 1 in the Executable editor for Wish. That will
+cause us to force closing stdin & stdout. Otherwise, given how Xcode launches
+Wish remotely, they will be left open and then Wish & gdb will fight for stdin.
+
+
+3. Building Tcl/Tk on Mac OS X
+------------------------------
+
+- At least Mac OS X 10.1 is required to build Tcl and TkX11 and OS X 10.2 is
+required to build TkAqua. Apple's Developer Tools need to be installed (only the
+most recent version matching your OS release is supported). The Developer Tools
+installer is available on Mac OS X retail disks or is present in
+/Applications/Installers on Macs that came with OS X preinstalled. The most
+recent version can be downloaded from the ADC website http://connect.apple.com
+(after you register for free ADC membership).
+
+- Tcl/Tk are most easily built as Mac OS X frameworks via GNUmakefile in
+tcl/macosx and tk/carbon (see below for details), but can also be built with the
+standard unix configure and make buildsystem in tcl/unix resp. tk/unix as on any
+other unix platform (indeed, the GNUmakefiles are just wrappers around the unix
+buildsystem).
+The Mac OS X specific configure flags are --enable-aqua, --enable-framework and
+--disable-corefoundation (which disables CF and notably reverts to the standard
+select based notifier). Note that --enable-aqua is incompatible with
+--disable-corefoundation (for both Tcl and Tk configure).
+
+- It is also possible to build with Apple's IDE via the projects in tk/carbon,
+take care to only use the project matching your DevTools and OS version:
+ * Wish.xcode for Xcode 2.4 on 10.4 and Xcode 2.5 on 10.4 and later, this has
+ a 'Tk' target that simply calls through to the tcl/macosx/GNUMakefile.
+ It requires a build of the 'Tcl' target of tcl/macosx/Tcl.xcode.
+ Additionally this has native 'tktest' and 'tktest-X11' targets for
+ debugging, these targets' 'Debug' build configuration has ZeroLink and
+ Fix&Continue enabled, use the 'DebugNoFixZL' build configuration if you
+ need a debug build without these features. The following build
+ configurations are available:
+ 'DebugUnthreaded': debug build with threading turned off.
+ 'DebugNoCF': debug build with corefoundation turned off
+ (for 'tktest-X11' only).
+ 'DebugNoCFUnthreaded': debug build with corefoundation turned off
+ (for 'tktest-X11' only) and with threading turned off.
+ 'DebugMemCompile': debug build with memory and bytecode debugging on.
+ 'DebugLeaks': debug build with PURIFY defined.
+ 'DebugGCov': debug build with generation of gcov data files enabled.
+ 'ReleaseUniversal': builds the targets as universal binaries for the
+ ppc and i386 architectures.
+ 'ReleaseUniversal10.4uSDK': same as 'ReleaseUniversal' but builds
+ against the 10.4u SDK, required to build universal binaries on
+ PowerPC Tiger (where the system libraries are not universal).
+ 'ReleasePPC10.3.9SDK': builds for PowerPC against the 10.3.9 SDK, useful
+ for verifying on Tiger that building on Panther would succeed.
+ 'ReleasePPC10.2.8SDK': builds for PowerPC with gcc-3.3 against the
+ 10.2.8 SDK, useful to verify on Tiger that building on Jaguar
+ would succeed.
+ * Wish.xcodeproj for Xcode 3.1 on 10.5 and later, which has the following
+ additional build configurations:
+ 'ReleaseUniversal10.5SDK': same as 'ReleaseUniversal' but builds
+ against the 10.5 SDK on Leopard (with 10.5 deployment target).
+ 'Debug gcc42': same as 'Debug' but builds with gcc 4.2.
+ 'Debug llvmgcc42': same as 'Debug' but builds with llvm-gcc 4.2.
+ 'ReleaseUniversal gcc42': same as 'ReleaseUniversal' but builds with
+ gcc 4.2.
+ 'ReleaseUniversal llvmgcc42': same as 'ReleaseUniversal' but builds
+ with llvm-gcc 4.2.
+ 'Debug64bit': builds the 'tktest-X11' target as 64bit with debugging
+ enabled (requires a 64bit capable processor).
+ Note that all non-SDK configurations have 10.5 deployment target and
+ that all Universal configurations build the 'tktest-X11' target
+ also for the ppc64 and x86_64 architectures.
+
+Notes about the native targets of the Xcode projects:
+ * the Xcode projects refer to the toplevel tcl and tk source dirs through
+ the TCL_SRCROOT and TK_SRCROOT user build settings, by default these are
+ set to the project-relative paths '../../tcl' and '../../tk', if your
+ source directories are named differently, e.g. '../../tcl8.5', you'll
+ need to manually change the TCL_SRCROOT and TK_SRCROOT settings by
+ editing your ${USER}.pbxuser file (located inside the Wish.xcodeproj
+ bundle directory) with a text editor.
+ * the native targets need a version of the unix configure scripts with config
+ headers enabled, this is automatically generated as tcl/macosx/configure
+ and tk/carbon/configure by the project but that requires 2.59 versions
+ of autoconf & autoheader. These are not available on Mac OS X 10.5 by
+ default and need to be installed manually. By default they are assumed
+ to be installed as /usr/local/bin/autoconf-2.59 and
+ /usr/local/bin/autoheader-2.59, set the AUTOCONF and AUTOHEADER build
+ settings in ${USER}.pbxuser to their true locations if necessary.
+
+- To build universal binaries outside of Wish.xcodeproj, set CFLAGS as follows:
+ export CFLAGS="-arch ppc -arch i386 \
+ -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4"
+This requires Mac OS X 10.4 and Xcode 2.2 (_not_ Xcode 2.1) and will work on any
+of the architectures (the -isysroot flag is only required on PowerPC Tiger).
+Note that configure requires CFLAGS to contain a least one architecture that can
+be run on the build machine (i.e. ppc on PowerPC, ppc or i386 on Intel).
+Universal builds of Tk TEA extensions are also possible with CFLAGS set as
+above, they will be [load]able by universal as well as thin binaries of Tk.
+Note that while Tcl can be built for 64-bit architectures, neither TkAqua nor
+TkX11 can be built for 64-bit as the corresponding GUI libraries are not
+available for 64bit at present. However, linking a universal 'ppc i386' Tk
+binary against a universal 'ppc ppc64 i386 x86_64' Tcl binary works just fine.
+The Tk configure script automatically removes the 64-bit -arch flags from CFLAGS
+to facilitate universal building of both Tcl and Tk with the same CFLAGS; the
+same happens with configure in Tk extensions based on TEA 3.5 or later.
+
+- To enable weak-linking, set the MACOSX_DEPLOYMENT_TARGET environment variable
+to the minimal OS version (>= 10.2) the binaries should be able to run on, e.g:
+ export MACOSX_DEPLOYMENT_TARGET=10.2
+This requires Mac OS X 10.2 and gcc 3.1; if you have gcc 4 or later you can set
+CFLAGS instead:
+ export CFLAGS="-mmacosx-version-min=10.2"
+The Wish.xcode project is setup to produce binaries that can run on 10.2 or
+later (except for the Universal and SDK configurations).
+Support for weak-linking was added to the code for 8.4.14/8.5a5.
+
+Detailed Instructions for building with carbon/GNUmakefile
+----------------------------------------------------------
+
+- Unpack the Tcl and Tk source release archives and place the tcl and tk source
+trees in a common parent directory.
+[ If you don't want have the two source trees in one directory, you'll need to ]
+[ create the following symbolic link for the build to work as setup by default ]
+[ ln -fs /path_to_tcl/build /path_to_tk/build ]
+[ (where /path_to_{tcl,tk} is the directory containing the tcl resp. tk tree) ]
+[ or you can pass an argument of BUILD_DIR=/somewhere to the tcl and tk make. ]
+
+- The following instructions assume the Tcl and Tk source trees are named
+"tcl${ver}" and "tk${ver}", respectively, where ${ver} is a shell variable
+containing the Tcl and Tk version number (for example '8.4.12').
+Setup the shell variable as follows:
+ set ver="8.4.12" ;: if your shell is csh
+ ver="8.4.12" ;: if your shell is sh
+The source trees will be named this way only if you are building from a release
+archive, if you are building from CVS, the version numbers will be missing; so
+set ${ver} to the empty string instead:
+ set ver="" ;: if your shell is csh
+ ver="" ;: if your shell is sh
+
+- The following steps will build Tcl and Tk from the Terminal, assuming you are
+located in the directory containing the tcl and tk source trees:
+ make -C tcl${ver}/macosx
+ make -C tk${ver}/carbon
+and the following will then install Tcl and Tk onto the root volume (admin
+password required):
+ sudo make -C tcl${ver}/macosx install
+ sudo make -C tk${ver}/carbon install
+if you don't have the admin password, you can install into your home directory,
+instead by passing an INSTALL_ROOT argument to make:
+ make -C tcl${ver}/macosx install INSTALL_ROOT="${HOME}/"
+ make -C tk${ver}/carbon install INSTALL_ROOT="${HOME}/"
+
+- The default GNUmakefile targets will build _both_ debug and optimized versions
+of the Tcl and Tk frameworks with the standard convention of naming the debug
+library Tcl.framework/Tcl_debug resp. Tk.framework/Tk_debug.
+This allows switching to the debug libraries at runtime by setting
+ export DYLD_IMAGE_SUFFIX=_debug
+(c.f. man dyld for more details)
+
+If you only want to build and install the debug or optimized build, use the
+'develop' or 'deploy' target variants of the GNUmakefiles, respectively.
+For example, to build and install only the optimized versions:
+ make -C tcl${ver}/macosx deploy
+ make -C tk${ver}/carbon deploy
+ sudo make -C tcl${ver}/macosx install-deploy
+ sudo make -C tk${ver}/carbon install-deploy
+
+- The GNUmakefiles can also build a version of 'Wish' that has the Tcl and Tk
+frameworks embedded in its application package. This allows for standalone
+deployment of the application with no installation required, e.g. from read-only
+media. To build & install in this manner, use the 'embedded' target variants of
+the GNUmakefiles. For example, to build a standalone 'Wish.app'
+in ./embedded/Applications/Utilities:
+ make -C tcl${ver}/macosx embedded
+ make -C tk${ver}/carbon embedded
+ sudo make -C tcl${ver}/macosx install-embedded INSTALL_ROOT=`pwd`/embedded/
+ sudo make -C tk${ver}/carbon install-embedded INSTALL_ROOT=`pwd`/embedded/
+Notes:
+ * if you've already built standard TclTkAqua, building embedded does not
+ require any new compiling or linking, so you can skip the first two makes.
+ (making relinking unnecessary was added in 8.4.2)
+ * the embedded frameworks include only optimized builds and no documentation.
+ * the standalone Wish has the directory Wish.app/Contents/lib in its
+ auto_path. Thus you can place tcl extensions in this directory (i.e. embed
+ them in the app package) and load them with [package require].
+
+- It is possible to build Tk against an installed Tcl.framework; but you will
+still need a tcl sourcetree in the location specified in TCL_SRC_DIR in
+Tcl.framework/tclConfig.sh. Also, linking with Tcl.framework has to work exactly
+as indicated in TCL_LIB_SPEC in Tcl.framework/tclConfig.sh.
+If you used non-default install locations for Tcl.framework, specify them as
+make overrides to the tk/carbon GNUmakefile, e.g.
+ make -C tk${ver}/carbon \
+ TCL_FRAMEWORK_DIR=$HOME/Library/Frameworks TCLSH_DIR=$HOME/usr/bin
+ sudo make -C tk${ver}/carbon install \
+ TCL_FRAMEWORK_DIR=$HOME/Library/Frameworks TCLSH_DIR=$HOME/usr/bin
+The Makefile variables TCL_FRAMEWORK_DIR and TCLSH_DIR were added in Tk 8.4.3.
diff --git a/carbon/Tk-Info.plist.in b/carbon/Tk-Info.plist.in
new file mode 100644
index 0000000..1705a98
--- /dev/null
+++ b/carbon/Tk-Info.plist.in
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!--
+ Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+
+ See the file "license.terms" for information on usage and redistribution of
+ this file, and for a DISCLAIMER OF ALL WARRANTIES.
+-->
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>@TK_LIB_FILE@</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Tk @TK_WINDOWINGSYSTEM@ @TK_VERSION@@TK_PATCH_LEVEL@,
+Copyright © 1989-@TK_YEAR@ Tcl Core Team,
+Copyright © 2002-@TK_YEAR@ Daniel A. Steffen,
+Copyright © 2001-2002 Apple Inc.,
+Copyright © 2001-2002 Jim Ingham &amp; Ian Reid</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.tcltk.tklibrary</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>Tk @TK_WINDOWINGSYSTEM@ @TK_VERSION@</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>@TK_VERSION@@TK_PATCH_LEVEL@</string>
+ <key>CFBundleSignature</key>
+ <string>Tk </string>
+ <key>CFBundleVersion</key>
+ <string>@TK_VERSION@@TK_PATCH_LEVEL@</string>
+</dict>
+</plist>
diff --git a/macosx/Wish-Common.xcconfig b/carbon/Wish-Common.xcconfig
index d9646a9..0c0ddc0 100644
--- a/macosx/Wish-Common.xcconfig
+++ b/carbon/Wish-Common.xcconfig
@@ -24,7 +24,7 @@ GCC = $(DEVELOPER_DIR)/usr/bin/gcc
GCC_VERSION = 4.0
CC = $(GCC)-$(GCC_VERSION)
LD = $(CC)
-WARNING_CFLAGS_GCC3 = -Wall -Wno-implicit-int -Wno-unused-parameter -Wno-deprecated-declarations
+WARNING_CFLAGS_GCC3 = -Wall -Wno-unused-parameter -Wno-deprecated-declarations
WARNING_CFLAGS = -Wextra -Wno-missing-field-initializers -Winit-self -Wpointer-arith -Wcast-align -Wdisabled-optimization -Winline $(WARNING_CFLAGS_GCC3) $(WARNING_CFLAGS)
REZ_RESOURCE_MAP_READ_ONLY = YES
APPLICATION_INSTALL_PATH = /Applications/Utilities
@@ -45,4 +45,4 @@ TCL_PACKAGE_PATH = "$(LIBDIR)"
TCL_DEFS = HAVE_TCL_CONFIG_H
TK_LIBRARY = $(LIBDIR)/tk$(VERSION)
TK_DEFS = HAVE_TK_CONFIG_H TCL_NO_DEPRECATED
-VERSION = 8.5
+VERSION = 8.6
diff --git a/macosx/Wish-Debug.xcconfig b/carbon/Wish-Debug.xcconfig
index 09def97..09def97 100644
--- a/macosx/Wish-Debug.xcconfig
+++ b/carbon/Wish-Debug.xcconfig
diff --git a/carbon/Wish-Info.plist.in b/carbon/Wish-Info.plist.in
new file mode 100644
index 0000000..85b0b08
--- /dev/null
+++ b/carbon/Wish-Info.plist.in
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!--
+ Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+
+ See the file "license.terms" for information on usage and redistribution of
+ this file, and for a DISCLAIMER OF ALL WARRANTIES.
+-->
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>tcl</string>
+ <string>TCL</string>
+ <string>*</string>
+ </array>
+ <key>CFBundleTypeMIMETypes</key>
+ <array>
+ <string>application/x-tcl</string>
+ <string>text/plain</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>NSStringPboardType</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>TEXT</string>
+ <string>****</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ </array>
+ <key>CFBundleExecutable</key>
+ <string>Wish</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Wish Shell @TK_VERSION@@TK_PATCH_LEVEL@,
+Copyright © 1989-@TK_YEAR@ Tcl Core Team,
+Copyright © 2002-@TK_YEAR@ Daniel A. Steffen,
+Copyright © 2001-2002 Apple Inc.,
+Copyright © 2001-2002 Jim Ingham &amp; Ian Reid</string>
+ <key>CFBundleIconFile</key>
+ <string>Wish.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.tcltk.wish</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleLocalizations</key>
+ <array>
+ @CFBUNDLELOCALIZATIONS@
+ </array>
+ <key>CFBundleName</key>
+ <string>Wish</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>@TK_VERSION@@TK_PATCH_LEVEL@</string>
+ <key>CFBundleSignature</key>
+ <string>WiSH</string>
+ <key>CFBundleVersion</key>
+ <string>@TK_VERSION@@TK_PATCH_LEVEL@</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>10.2.0</string>
+ <key>LSRequiresCarbon</key>
+ <true/>
+ <key>NSAppleScriptEnabled</key>
+ <true/>
+</dict>
+</plist>
diff --git a/macosx/Wish-Release.xcconfig b/carbon/Wish-Release.xcconfig
index d843341..d843341 100644
--- a/macosx/Wish-Release.xcconfig
+++ b/carbon/Wish-Release.xcconfig
diff --git a/macosx/Wish.icns b/carbon/Wish.icns
index 060bfbd..060bfbd 100644
--- a/macosx/Wish.icns
+++ b/carbon/Wish.icns
Binary files differ
diff --git a/macosx/Wish.xcode/default.pbxuser b/carbon/Wish.xcode/default.pbxuser
index c832f6b..c832f6b 100644
--- a/macosx/Wish.xcode/default.pbxuser
+++ b/carbon/Wish.xcode/default.pbxuser
diff --git a/macosx/Wish.xcode/project.pbxproj b/carbon/Wish.xcode/project.pbxproj
index 24c0a82..8fe9214 100644
--- a/macosx/Wish.xcode/project.pbxproj
+++ b/carbon/Wish.xcode/project.pbxproj
@@ -8,6 +8,23 @@
/* Begin PBXBuildFile section */
F9067BCD0BFBA2900074F726 /* tkOldTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFE08F27A39005CB29B /* tkOldTest.c */; };
+ F9152B090EAF8A5000CD5C7B /* tkBusy.c in Sources */ = {isa = PBXBuildFile; fileRef = F9152B080EAF8A5000CD5C7B /* tkBusy.c */; };
+ F9152B0A0EAF8A5700CD5C7B /* tkBusy.c in Sources */ = {isa = PBXBuildFile; fileRef = F9152B080EAF8A5000CD5C7B /* tkBusy.c */; };
+ F92EE8BF0E62F846001A6E80 /* tkImgPhInstance.c in Sources */ = {isa = PBXBuildFile; fileRef = F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */; };
+ F92EE8D30E62F939001A6E80 /* tkImgPhInstance.c in Sources */ = {isa = PBXBuildFile; fileRef = F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */; };
+ F93599B30DF1F75400E04F67 /* tclOO.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B20DF1F75400E04F67 /* tclOO.c */; };
+ F93599B70DF1F76100E04F67 /* tclOOBasic.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B60DF1F76100E04F67 /* tclOOBasic.c */; };
+ F93599B90DF1F76600E04F67 /* tclOOCall.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B80DF1F76600E04F67 /* tclOOCall.c */; };
+ F93599BC0DF1F77000E04F67 /* tclOODefineCmds.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599BB0DF1F77000E04F67 /* tclOODefineCmds.c */; };
+ F93599BE0DF1F77400E04F67 /* tclOOInfo.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599BD0DF1F77400E04F67 /* tclOOInfo.c */; };
+ F93599C20DF1F78300E04F67 /* tclOOMethod.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C10DF1F78300E04F67 /* tclOOMethod.c */; };
+ F93599C40DF1F78800E04F67 /* tclOOStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C30DF1F78800E04F67 /* tclOOStubInit.c */; };
+ F93599C60DF1F78D00E04F67 /* tclOOStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C50DF1F78D00E04F67 /* tclOOStubLib.c */; };
+ F95D77EA0DFD820D00A8BF6F /* tclIORTrans.c in Sources */ = {isa = PBXBuildFile; fileRef = F95D77E90DFD820D00A8BF6F /* tclIORTrans.c */; };
+ F96437CA0EF0D4B2003F468E /* tclZlib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96437C90EF0D4B2003F468E /* tclZlib.c */; };
+ F96437CB0EF0D4B2003F468E /* tclZlib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96437C90EF0D4B2003F468E /* tclZlib.c */; };
+ F96437E70EF0D652003F468E /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F96437E60EF0D652003F468E /* libz.dylib */; };
+ F96437E80EF0D652003F468E /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F96437E60EF0D652003F468E /* libz.dylib */; };
F966BDCF08F27A3F005CB29B /* tk3d.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAC08F27A39005CB29B /* tk3d.c */; };
F966BDD108F27A3F005CB29B /* tkArgv.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAE08F27A39005CB29B /* tkArgv.c */; };
F966BDD208F27A3F005CB29B /* tkAtom.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAF08F27A39005CB29B /* tkAtom.c */; };
@@ -591,22 +608,70 @@
F9FD349B0CC1BB0D0073837D /* libfreetype.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD34990CC1BB0D0073837D /* libfreetype.dylib */; };
F9FD349C0CC1BB0D0073837D /* libXft.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD349A0CC1BB0D0073837D /* libXft.dylib */; };
F9FD34C40CC1BBD70073837D /* libfontconfig.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD34C30CC1BBD70073837D /* libfontconfig.dylib */; };
+ F9FFAF1D0DFDDB26007F8A6A /* tclIORTrans.c in Sources */ = {isa = PBXBuildFile; fileRef = F95D77E90DFD820D00A8BF6F /* tclIORTrans.c */; };
+ F9FFAF1F0DFDDB2F007F8A6A /* tclOO.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B20DF1F75400E04F67 /* tclOO.c */; };
+ F9FFAF200DFDDB32007F8A6A /* tclOOBasic.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B60DF1F76100E04F67 /* tclOOBasic.c */; };
+ F9FFAF210DFDDB32007F8A6A /* tclOOCall.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B80DF1F76600E04F67 /* tclOOCall.c */; };
+ F9FFAF220DFDDB34007F8A6A /* tclOODefineCmds.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599BB0DF1F77000E04F67 /* tclOODefineCmds.c */; };
+ F9FFAF230DFDDB35007F8A6A /* tclOOInfo.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599BD0DF1F77400E04F67 /* tclOOInfo.c */; };
+ F9FFAF240DFDDB36007F8A6A /* tclOOMethod.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C10DF1F78300E04F67 /* tclOOMethod.c */; };
+ F9FFAF250DFDDB37007F8A6A /* tclOOStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C30DF1F78800E04F67 /* tclOOStubInit.c */; };
+ F9FFAF260DFDDB38007F8A6A /* tclOOStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C50DF1F78D00E04F67 /* tclOOStubLib.c */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
8DD76FB20486AB0100D96B5E /* tktest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = tktest; sourceTree = BUILT_PRODUCTS_DIR; };
F9099B8A0CC67D30005A9580 /* textpeer.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textpeer.tcl; sourceTree = "<group>"; };
F9099B8B0CC67D3E005A9580 /* ttkbut.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttkbut.tcl; sourceTree = "<group>"; };
+ F9152B080EAF8A5000CD5C7B /* tkBusy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkBusy.c; sourceTree = "<group>"; };
+ F91543270EF201A90032D1E8 /* fontchoose.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fontchoose.tcl; sourceTree = "<group>"; };
+ F915432A0EF201CF0032D1E8 /* zlib.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = zlib.test; sourceTree = "<group>"; };
+ F915432D0EF201EE0032D1E8 /* zlib.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = zlib.n; sourceTree = "<group>"; };
+ F9183E640EFC80CD0030B814 /* throw.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = throw.n; sourceTree = "<group>"; };
+ F9183E650EFC80D70030B814 /* try.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = try.n; sourceTree = "<group>"; };
+ F9183E6A0EFC81560030B814 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F9183E8F0EFC817B0030B814 /* tdbc */ = {isa = PBXFileReference; lastKnownFileType = folder; path = tdbc; sourceTree = "<group>"; };
+ F91DC23C0E44C51B002CB8D1 /* nre.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = nre.test; sourceTree = "<group>"; };
+ F91DC23D0E44C530002CB8D1 /* unsupported.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = unsupported.test; sourceTree = "<group>"; };
F91E62260C1AE686006C9D96 /* Tclsh-Info.plist.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Tclsh-Info.plist.in"; sourceTree = "<group>"; };
F92240290D7C620F005EC715 /* knightstour.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = knightstour.tcl; sourceTree = "<group>"; };
+ F92D7F100DE777240033A13A /* tsdPerf.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tsdPerf.tcl; sourceTree = "<group>"; };
+ F92D7F140DE777670033A13A /* tsdPerf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tsdPerf.c; sourceTree = "<group>"; };
+ F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImgPhInstance.c; sourceTree = "<group>"; };
+ F93599B20DF1F75400E04F67 /* tclOO.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOO.c; sourceTree = "<group>"; };
+ F93599B40DF1F75900E04F67 /* tclOO.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclOO.decls; sourceTree = "<group>"; };
+ F93599B50DF1F75D00E04F67 /* tclOO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclOO.h; sourceTree = "<group>"; };
+ F93599B60DF1F76100E04F67 /* tclOOBasic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOOBasic.c; sourceTree = "<group>"; };
+ F93599B80DF1F76600E04F67 /* tclOOCall.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOOCall.c; sourceTree = "<group>"; };
+ F93599BA0DF1F76A00E04F67 /* tclOODecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclOODecls.h; sourceTree = "<group>"; };
+ F93599BB0DF1F77000E04F67 /* tclOODefineCmds.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOODefineCmds.c; sourceTree = "<group>"; };
+ F93599BD0DF1F77400E04F67 /* tclOOInfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOOInfo.c; sourceTree = "<group>"; };
+ F93599BF0DF1F77900E04F67 /* tclOOInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclOOInt.h; sourceTree = "<group>"; };
+ F93599C00DF1F77D00E04F67 /* tclOOIntDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclOOIntDecls.h; sourceTree = "<group>"; };
+ F93599C10DF1F78300E04F67 /* tclOOMethod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOOMethod.c; sourceTree = "<group>"; };
+ F93599C30DF1F78800E04F67 /* tclOOStubInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOOStubInit.c; sourceTree = "<group>"; };
+ F93599C50DF1F78D00E04F67 /* tclOOStubLib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOOStubLib.c; sourceTree = "<group>"; };
+ F93599C80DF1F81900E04F67 /* oo.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = oo.test; sourceTree = "<group>"; };
+ F93599CF0DF1F87F00E04F67 /* Class.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Class.3; sourceTree = "<group>"; };
+ F93599D00DF1F89E00E04F67 /* class.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = class.n; sourceTree = "<group>"; };
+ F93599D20DF1F8DF00E04F67 /* copy.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = copy.n; sourceTree = "<group>"; };
+ F93599D30DF1F8F500E04F67 /* define.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = define.n; sourceTree = "<group>"; };
+ F93599D40DF1F91900E04F67 /* Method.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Method.3; sourceTree = "<group>"; };
+ F93599D50DF1F93700E04F67 /* my.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = my.n; sourceTree = "<group>"; };
+ F93599D60DF1F95000E04F67 /* next.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = next.n; sourceTree = "<group>"; };
+ F93599D70DF1F96800E04F67 /* object.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = object.n; sourceTree = "<group>"; };
+ F93599D80DF1F98300E04F67 /* self.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = self.n; sourceTree = "<group>"; };
F936FCD70CCD984500716967 /* ttkprogress.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttkprogress.tcl; sourceTree = "<group>"; };
F936FCD80CCD984600716967 /* tree.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tree.tcl; sourceTree = "<group>"; };
F936FCD90CCD984600716967 /* toolbar.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = toolbar.tcl; sourceTree = "<group>"; };
F936FCDA0CCD984600716967 /* ttknote.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttknote.tcl; sourceTree = "<group>"; };
F936FCDB0CCD984600716967 /* combo.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = combo.tcl; sourceTree = "<group>"; };
F93E5EFD09CF8711008FA367 /* tkMacOSXFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXFont.h; sourceTree = "<group>"; };
+ F95D77E90DFD820D00A8BF6F /* tclIORTrans.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIORTrans.c; sourceTree = "<group>"; };
F95FAFF90B34F1130072E431 /* macOSXLoad.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = macOSXLoad.test; sourceTree = "<group>"; };
F962F7C60DADC26200648DB8 /* vsapi.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = vsapi.test; sourceTree = "<group>"; };
+ F96437C90EF0D4B2003F468E /* tclZlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclZlib.c; sourceTree = "<group>"; };
+ F96437E60EF0D652003F468E /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
F966BA0408F27A37005CB29B /* error.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = error.xbm; sourceTree = "<group>"; };
F966BA0508F27A37005CB29B /* gray12.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray12.xbm; sourceTree = "<group>"; };
F966BA0608F27A37005CB29B /* gray25.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray25.xbm; sourceTree = "<group>"; };
@@ -768,7 +833,6 @@
F966BAA408F27A38005CB29B /* wm.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = wm.n; sourceTree = "<group>"; };
F966BAA608F27A38005CB29B /* default.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = default.h; sourceTree = "<group>"; };
F966BAA708F27A38005CB29B /* ks_names.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ks_names.h; sourceTree = "<group>"; };
- F966BAA808F27A38005CB29B /* prolog.ps */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = prolog.ps; sourceTree = "<group>"; };
F966BAA908F27A39005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
F966BAAA08F27A39005CB29B /* tk.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tk.decls; sourceTree = "<group>"; };
F966BAAB08F27A39005CB29B /* tk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tk.h; sourceTree = "<group>"; };
@@ -945,7 +1009,6 @@
F966BB8708F27A3A005CB29B /* optMenu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = optMenu.tcl; sourceTree = "<group>"; };
F966BB8808F27A3A005CB29B /* palette.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = palette.tcl; sourceTree = "<group>"; };
F966BB8908F27A3B005CB29B /* panedwindow.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.tcl; sourceTree = "<group>"; };
- F966BB8A08F27A3B005CB29B /* prolog.ps */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = prolog.ps; sourceTree = "<group>"; };
F966BB8B08F27A3B005CB29B /* safetk.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = safetk.tcl; sourceTree = "<group>"; };
F966BB8C08F27A3B005CB29B /* scale.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scale.tcl; sourceTree = "<group>"; };
F966BB8D08F27A3B005CB29B /* scrlbar.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scrlbar.tcl; sourceTree = "<group>"; };
@@ -1053,7 +1116,6 @@
F966BC2F08F27A3C005CB29B /* get.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = get.test; sourceTree = "<group>"; };
F966BC3008F27A3C005CB29B /* grab.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = grab.test; sourceTree = "<group>"; };
F966BC3108F27A3C005CB29B /* grid.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = grid.test; sourceTree = "<group>"; };
- F966BC3208F27A3C005CB29B /* id.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = id.test; sourceTree = "<group>"; };
F966BC3308F27A3C005CB29B /* image.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = image.test; sourceTree = "<group>"; };
F966BC3408F27A3C005CB29B /* imgBmap.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = imgBmap.test; sourceTree = "<group>"; };
F966BC3508F27A3C005CB29B /* imgPhoto.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = imgPhoto.test; sourceTree = "<group>"; };
@@ -1837,7 +1899,6 @@
F96D437B08F272B6004A47F5 /* io.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = io.test; sourceTree = "<group>"; };
F96D437C08F272B6004A47F5 /* ioCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ioCmd.test; sourceTree = "<group>"; };
F96D437D08F272B6004A47F5 /* iogt.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = iogt.test; sourceTree = "<group>"; };
- F96D437E08F272B6004A47F5 /* ioUtil.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ioUtil.test; sourceTree = "<group>"; };
F96D437F08F272B6004A47F5 /* join.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = join.test; sourceTree = "<group>"; };
F96D438008F272B6004A47F5 /* lindex.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lindex.test; sourceTree = "<group>"; };
F96D438108F272B6004A47F5 /* link.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = link.test; sourceTree = "<group>"; };
@@ -2029,16 +2090,21 @@
F96D449808F272BA004A47F5 /* tclWinThrd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinThrd.c; sourceTree = "<group>"; };
F96D449908F272BA004A47F5 /* tclWinThrd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclWinThrd.h; sourceTree = "<group>"; };
F96D449A08F272BA004A47F5 /* tclWinTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinTime.c; sourceTree = "<group>"; };
+ F973E5960EE99384001A648E /* vistaTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = vistaTheme.tcl; sourceTree = "<group>"; };
F976F6A70C325FB6005066D9 /* tkMacOSXPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXPrivate.h; sourceTree = "<group>"; };
F97AE7F10B65C1E900310EA2 /* Wish-Common.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Common.xcconfig"; sourceTree = "<group>"; };
F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Release.xcconfig"; sourceTree = "<group>"; };
F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Debug.xcconfig"; sourceTree = "<group>"; };
F9903CAF094FAADA004613E9 /* tclTomMath.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclTomMath.decls; sourceTree = "<group>"; };
F9903CB0094FAADA004613E9 /* tclTomMathDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclTomMathDecls.h; sourceTree = "<group>"; };
+ F99388380EE0114B0065FE6B /* fontchooser.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fontchooser.tcl; sourceTree = "<group>"; };
+ F99388950EE02D980065FE6B /* fontchooser.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fontchooser.test; sourceTree = "<group>"; };
+ F99D61180EF5573A00BBFE01 /* TclZlib.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = TclZlib.3; sourceTree = "<group>"; };
F9A3082D08F2D4AB00BAE1AB /* Tk.framework */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.framework; path = Tk.framework; sourceTree = BUILT_PRODUCTS_DIR; };
F9A3084B08F2D4CE00BAE1AB /* Wish.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Wish.app; sourceTree = BUILT_PRODUCTS_DIR; };
F9A3084E08F2D4F400BAE1AB /* Tcl.framework */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.framework; path = Tcl.framework; sourceTree = BUILT_PRODUCTS_DIR; };
F9A493240CEBF38300B78AE2 /* chanio.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = chanio.test; sourceTree = "<group>"; };
+ F9C888C20EEF6571003F63AD /* fontchooser.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = fontchooser.n; sourceTree = "<group>"; };
F9D1360A0CDC252C00DBE0B5 /* mclist.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = mclist.tcl; sourceTree = "<group>"; };
F9ECB1120B26521500A28025 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
F9ECB1130B26521500A28025 /* platform.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = platform.tcl; sourceTree = "<group>"; };
@@ -2065,6 +2131,7 @@
buildActionMask = 2147483647;
files = (
F966C07508F2820D005CB29B /* CoreFoundation.framework in Frameworks */,
+ F96437E70EF0D652003F468E /* libz.dylib in Frameworks */,
F966C07708F2821B005CB29B /* Carbon.framework in Frameworks */,
F966C07908F28233005CB29B /* IOKit.framework in Frameworks */,
);
@@ -2075,6 +2142,7 @@
buildActionMask = 2147483647;
files = (
F9FD31E40CC1AD070073837D /* CoreFoundation.framework in Frameworks */,
+ F96437E80EF0D652003F468E /* libz.dylib in Frameworks */,
F9FD32170CC1AF170073837D /* libX11.dylib in Frameworks */,
F9FD32180CC1AF170073837D /* libXext.dylib in Frameworks */,
F9FD32190CC1AF170073837D /* libXss.dylib in Frameworks */,
@@ -2113,6 +2181,15 @@
name = Products;
sourceTree = "<group>";
};
+ F9183E690EFC81560030B814 /* pkgs */ = {
+ isa = PBXGroup;
+ children = (
+ F9183E6A0EFC81560030B814 /* README */,
+ F9183E8F0EFC817B0030B814 /* tdbc */,
+ );
+ path = pkgs;
+ sourceTree = "<group>";
+ };
F966BA0308F27A37005CB29B /* bitmaps */ = {
isa = PBXGroup;
children = (
@@ -2176,6 +2253,7 @@
F966BA3908F27A37005CB29B /* focus.n */,
F966BA3A08F27A37005CB29B /* focusNext.n */,
F966BA3B08F27A37005CB29B /* font.n */,
+ F9C888C20EEF6571003F63AD /* fontchooser.n */,
F966BA3C08F27A37005CB29B /* FontId.3 */,
F966BA3D08F27A37005CB29B /* frame.n */,
F966BA3E08F27A37005CB29B /* FreeXId.3 */,
@@ -2311,7 +2389,6 @@
children = (
F966BAA608F27A38005CB29B /* default.h */,
F966BAA708F27A38005CB29B /* ks_names.h */,
- F966BAA808F27A38005CB29B /* prolog.ps */,
F966BAA908F27A39005CB29B /* README */,
F966BAAA08F27A39005CB29B /* tk.decls */,
F966BAAB08F27A39005CB29B /* tk.h */,
@@ -2321,6 +2398,7 @@
F966BAAF08F27A39005CB29B /* tkAtom.c */,
F966BAB008F27A39005CB29B /* tkBind.c */,
F966BAB108F27A39005CB29B /* tkBitmap.c */,
+ F9152B080EAF8A5000CD5C7B /* tkBusy.c */,
F966BAB208F27A39005CB29B /* tkButton.c */,
F966BAB308F27A39005CB29B /* tkButton.h */,
F966BAB408F27A39005CB29B /* tkCanvArc.c */,
@@ -2360,6 +2438,7 @@
F966BAD708F27A39005CB29B /* tkImage.c */,
F966BAD808F27A39005CB29B /* tkImgBmap.c */,
F966BAD908F27A39005CB29B /* tkImgGIF.c */,
+ F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */,
F966BADA08F27A39005CB29B /* tkImgPhoto.c */,
F966BADB08F27A39005CB29B /* tkImgPPM.c */,
F966BADC08F27A39005CB29B /* tkImgUtil.c */,
@@ -2432,6 +2511,7 @@
F966BB6208F27A3A005CB29B /* dialog.tcl */,
F966BB6308F27A3A005CB29B /* entry.tcl */,
F966BB6408F27A3A005CB29B /* focus.tcl */,
+ F99388380EE0114B0065FE6B /* fontchooser.tcl */,
F966BB7308F27A3A005CB29B /* listbox.tcl */,
F966BB7408F27A3A005CB29B /* menu.tcl */,
F966BB7508F27A3A005CB29B /* mkpsenc.tcl */,
@@ -2440,7 +2520,6 @@
F966BB8708F27A3A005CB29B /* optMenu.tcl */,
F966BB8808F27A3A005CB29B /* palette.tcl */,
F966BB8908F27A3B005CB29B /* panedwindow.tcl */,
- F966BB8A08F27A3B005CB29B /* prolog.ps */,
F966BB8B08F27A3B005CB29B /* safetk.tcl */,
F966BB8C08F27A3B005CB29B /* scale.tcl */,
F966BB8D08F27A3B005CB29B /* scrlbar.tcl */,
@@ -2480,6 +2559,7 @@
F966BB2C08F27A39005CB29B /* entry3.tcl */,
F966BB2D08F27A39005CB29B /* filebox.tcl */,
F966BB2E08F27A39005CB29B /* floor.tcl */,
+ F91543270EF201A90032D1E8 /* fontchoose.tcl */,
F966BB2F08F27A39005CB29B /* form.tcl */,
F966BB3008F27A39005CB29B /* goldberg.tcl */,
F966BB3108F27A39005CB29B /* hello */,
@@ -2532,7 +2612,7 @@
path = demos;
sourceTree = "<group>";
};
- F966BB9708F27A3B005CB29B /* macosx */ = {
+ F966BB9708F27A3B005CB29B /* carbon */ = {
isa = PBXGroup;
children = (
F966BBBA08F27A3B005CB29B /* configure.ac */,
@@ -2591,7 +2671,7 @@
F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */,
F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */,
);
- path = macosx;
+ path = carbon;
sourceTree = "<group>";
};
F966BC0408F27A3C005CB29B /* tests */ = {
@@ -2637,12 +2717,12 @@
F966BC2A08F27A3C005CB29B /* focus.test */,
F966BC2B08F27A3C005CB29B /* focusTcl.test */,
F966BC2C08F27A3C005CB29B /* font.test */,
+ F99388950EE02D980065FE6B /* fontchooser.test */,
F966BC2D08F27A3C005CB29B /* frame.test */,
F966BC2E08F27A3C005CB29B /* geometry.test */,
F966BC2F08F27A3C005CB29B /* get.test */,
F966BC3008F27A3C005CB29B /* grab.test */,
F966BC3108F27A3C005CB29B /* grid.test */,
- F966BC3208F27A3C005CB29B /* id.test */,
F966BC3308F27A3C005CB29B /* image.test */,
F966BC3408F27A3C005CB29B /* imgBmap.test */,
F966BC3508F27A3C005CB29B /* imgPhoto.test */,
@@ -2849,6 +2929,7 @@
isa = PBXGroup;
children = (
F966C07408F2820D005CB29B /* CoreFoundation.framework */,
+ F96437E60EF0D652003F468E /* libz.dylib */,
F966C07608F2821B005CB29B /* Carbon.framework */,
F966C07808F28233005CB29B /* IOKit.framework */,
F9FD32140CC1AF170073837D /* libX11.dylib */,
@@ -2929,6 +3010,7 @@
F968884C0AF787B3000797B5 /* ttk.tcl */,
F968884D0AF787B3000797B5 /* utils.tcl */,
F968884E0AF787B3000797B5 /* winTheme.tcl */,
+ F973E5960EE99384001A648E /* vistaTheme.tcl */,
F968884F0AF787B3000797B5 /* xpTheme.tcl */,
);
path = ttk;
@@ -2968,6 +3050,7 @@
F96D434408F272B5004A47F5 /* tests */,
F96D3DFC08F272A4004A47F5 /* doc */,
F96D43D008F272B8004A47F5 /* tools */,
+ F9183E690EFC81560030B814 /* pkgs */,
F96D3DFA08F272A4004A47F5 /* ChangeLog */,
F96D3DFB08F272A4004A47F5 /* changes */,
F96D434308F272B5004A47F5 /* README */,
@@ -2980,7 +3063,7 @@
isa = PBXGroup;
children = (
F966BAA508F27A38005CB29B /* generic */,
- F966BB9708F27A3B005CB29B /* macosx */,
+ F966BB9708F27A3B005CB29B /* carbon */,
F966BC6B08F27A3D005CB29B /* unix */,
F966BD1908F27A3F005CB29B /* xlib */,
F966BA0308F27A37005CB29B /* bitmaps */,
@@ -3022,12 +3105,15 @@
F96D3E1108F272A5004A47F5 /* cd.n */,
F96D3E1208F272A5004A47F5 /* chan.n */,
F96D3E1308F272A5004A47F5 /* ChnlStack.3 */,
+ F93599CF0DF1F87F00E04F67 /* Class.3 */,
+ F93599D00DF1F89E00E04F67 /* class.n */,
F96D3E1408F272A5004A47F5 /* clock.n */,
F96D3E1508F272A5004A47F5 /* close.n */,
F96D3E1608F272A5004A47F5 /* CmdCmplt.3 */,
F96D3E1708F272A5004A47F5 /* Concat.3 */,
F96D3E1808F272A5004A47F5 /* concat.n */,
F96D3E1908F272A5004A47F5 /* continue.n */,
+ F93599D20DF1F8DF00E04F67 /* copy.n */,
F96D3E1A08F272A5004A47F5 /* CrtChannel.3 */,
F96D3E1B08F272A5004A47F5 /* CrtChnlHdlr.3 */,
F96D3E1C08F272A5004A47F5 /* CrtCloseHdlr.3 */,
@@ -3040,6 +3126,7 @@
F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */,
F96D3E2408F272A5004A47F5 /* CrtTrace.3 */,
F96D3E2508F272A5004A47F5 /* dde.n */,
+ F93599D30DF1F8F500E04F67 /* define.n */,
F96D3E2608F272A5004A47F5 /* DetachPids.3 */,
F96D3E2708F272A5004A47F5 /* dict.n */,
F96D3E2808F272A5004A47F5 /* DictObj.3 */,
@@ -3117,11 +3204,15 @@
F96D3E7008F272A6004A47F5 /* man.macros */,
F96D3E7108F272A6004A47F5 /* mathfunc.n */,
F96D3E7208F272A6004A47F5 /* memory.n */,
+ F93599D40DF1F91900E04F67 /* Method.3 */,
F96D3E7308F272A6004A47F5 /* msgcat.n */,
+ F93599D50DF1F93700E04F67 /* my.n */,
F96D3E7408F272A6004A47F5 /* Namespace.3 */,
F96D3E7508F272A6004A47F5 /* namespace.n */,
+ F93599D60DF1F95000E04F67 /* next.n */,
F96D3E7608F272A6004A47F5 /* Notifier.3 */,
F96D3E7708F272A6004A47F5 /* Object.3 */,
+ F93599D70DF1F96800E04F67 /* object.n */,
F96D3E7808F272A6004A47F5 /* ObjectType.3 */,
F96D3E7908F272A6004A47F5 /* open.n */,
F96D3E7A08F272A6004A47F5 /* OpenFileChnl.3 */,
@@ -3155,6 +3246,7 @@
F96D3E9408F272A6004A47F5 /* SaveResult.3 */,
F96D3E9508F272A6004A47F5 /* scan.n */,
F96D3E9608F272A6004A47F5 /* seek.n */,
+ F93599D80DF1F98300E04F67 /* self.n */,
F96D3E9708F272A6004A47F5 /* set.n */,
F96D3E9808F272A6004A47F5 /* SetChanErr.3 */,
F96D3E9908F272A6004A47F5 /* SetErrno.3 */,
@@ -3178,6 +3270,7 @@
F96D3EAB08F272A7004A47F5 /* SubstObj.3 */,
F96D3EAC08F272A7004A47F5 /* switch.n */,
F96D3EAD08F272A7004A47F5 /* Tcl.n */,
+ F99D61180EF5573A00BBFE01 /* TclZlib.3 */,
F96D3EAE08F272A7004A47F5 /* Tcl_Main.3 */,
F96D3EAF08F272A7004A47F5 /* TCL_MEM_DEBUG.3 */,
F96D3EB008F272A7004A47F5 /* tclsh.1 */,
@@ -3185,6 +3278,7 @@
F96D3EB208F272A7004A47F5 /* tclvars.n */,
F96D3EB308F272A7004A47F5 /* tell.n */,
F96D3EB408F272A7004A47F5 /* Thread.3 */,
+ F9183E640EFC80CD0030B814 /* throw.n */,
F96D3EB508F272A7004A47F5 /* time.n */,
F96D3EB608F272A7004A47F5 /* tm.n */,
F96D3EB708F272A7004A47F5 /* ToUpper.3 */,
@@ -3192,6 +3286,7 @@
F96D3EB908F272A7004A47F5 /* TraceCmd.3 */,
F96D3EBA08F272A7004A47F5 /* TraceVar.3 */,
F96D3EBB08F272A7004A47F5 /* Translate.3 */,
+ F9183E650EFC80D70030B814 /* try.n */,
F96D3EBC08F272A7004A47F5 /* UniCharIsAlpha.3 */,
F96D3EBD08F272A7004A47F5 /* unknown.n */,
F96D3EBE08F272A7004A47F5 /* unload.n */,
@@ -3205,6 +3300,7 @@
F96D3EC608F272A7004A47F5 /* vwait.n */,
F96D3EC708F272A7004A47F5 /* while.n */,
F96D3EC808F272A7004A47F5 /* WrongNumArgs.3 */,
+ F915432D0EF201EE0032D1E8 /* zlib.n */,
);
path = doc;
sourceTree = "<group>";
@@ -3269,6 +3365,7 @@
F96D3F0008F272A7004A47F5 /* tclIOCmd.c */,
F96D3F0108F272A7004A47F5 /* tclIOGT.c */,
F96D3F0208F272A7004A47F5 /* tclIORChan.c */,
+ F95D77E90DFD820D00A8BF6F /* tclIORTrans.c */,
F96D3F0308F272A7004A47F5 /* tclIOSock.c */,
F96D3F0408F272A7004A47F5 /* tclIOUtil.c */,
F96D3F0508F272A7004A47F5 /* tclLink.c */,
@@ -3280,6 +3377,19 @@
F96D3F0B08F272A7004A47F5 /* tclNamesp.c */,
F96D3F0C08F272A7004A47F5 /* tclNotify.c */,
F96D3F0D08F272A7004A47F5 /* tclObj.c */,
+ F93599B20DF1F75400E04F67 /* tclOO.c */,
+ F93599B40DF1F75900E04F67 /* tclOO.decls */,
+ F93599B50DF1F75D00E04F67 /* tclOO.h */,
+ F93599B60DF1F76100E04F67 /* tclOOBasic.c */,
+ F93599B80DF1F76600E04F67 /* tclOOCall.c */,
+ F93599BA0DF1F76A00E04F67 /* tclOODecls.h */,
+ F93599BB0DF1F77000E04F67 /* tclOODefineCmds.c */,
+ F93599BD0DF1F77400E04F67 /* tclOOInfo.c */,
+ F93599BF0DF1F77900E04F67 /* tclOOInt.h */,
+ F93599C00DF1F77D00E04F67 /* tclOOIntDecls.h */,
+ F93599C10DF1F78300E04F67 /* tclOOMethod.c */,
+ F93599C30DF1F78800E04F67 /* tclOOStubInit.c */,
+ F93599C50DF1F78D00E04F67 /* tclOOStubLib.c */,
F96D3F0E08F272A7004A47F5 /* tclPanic.c */,
F96D3F0F08F272A7004A47F5 /* tclParse.c */,
F96D3F1108F272A7004A47F5 /* tclPathObj.c */,
@@ -3318,6 +3428,7 @@
F96D3F3408F272A7004A47F5 /* tclUtf.c */,
F96D3F3508F272A7004A47F5 /* tclUtil.c */,
F96D3F3608F272A7004A47F5 /* tclVar.c */,
+ F96437C90EF0D4B2003F468E /* tclZlib.c */,
F96D3F3708F272A7004A47F5 /* tommath.h */,
);
path = generic;
@@ -3618,7 +3729,6 @@
F96D437B08F272B6004A47F5 /* io.test */,
F96D437C08F272B6004A47F5 /* ioCmd.test */,
F96D437D08F272B6004A47F5 /* iogt.test */,
- F96D437E08F272B6004A47F5 /* ioUtil.test */,
F96D437F08F272B6004A47F5 /* join.test */,
F96D438008F272B6004A47F5 /* lindex.test */,
F96D438108F272B6004A47F5 /* link.test */,
@@ -3642,7 +3752,9 @@
F96D439108F272B6004A47F5 /* namespace-old.test */,
F96D439208F272B7004A47F5 /* namespace.test */,
F96D439308F272B7004A47F5 /* notify.test */,
+ F91DC23C0E44C51B002CB8D1 /* nre.test */,
F96D439408F272B7004A47F5 /* obj.test */,
+ F93599C80DF1F81900E04F67 /* oo.test */,
F96D439508F272B7004A47F5 /* opt.test */,
F96D439608F272B7004A47F5 /* package.test */,
F96D439708F272B7004A47F5 /* parse.test */,
@@ -3688,6 +3800,7 @@
F96D43BF08F272B7004A47F5 /* unixNotfy.test */,
F96D43C008F272B7004A47F5 /* unknown.test */,
F96D43C108F272B7004A47F5 /* unload.test */,
+ F91DC23D0E44C530002CB8D1 /* unsupported.test */,
F96D43C208F272B7004A47F5 /* uplevel.test */,
F96D43C308F272B7004A47F5 /* upvar.test */,
F96D43C408F272B7004A47F5 /* utf.test */,
@@ -3702,6 +3815,7 @@
F96D43CD08F272B7004A47F5 /* winNotify.test */,
F96D43CE08F272B7004A47F5 /* winPipe.test */,
F96D43CF08F272B7004A47F5 /* winTime.test */,
+ F915432A0EF201CF0032D1E8 /* zlib.test */,
);
path = tests;
sourceTree = "<group>";
@@ -3734,6 +3848,8 @@
F96D443708F272B9004A47F5 /* tclmin.wse */,
F96D443908F272B9004A47F5 /* tcltk-man2html.tcl */,
F96D443A08F272B9004A47F5 /* tclZIC.tcl */,
+ F92D7F140DE777670033A13A /* tsdPerf.c */,
+ F92D7F100DE777240033A13A /* tsdPerf.tcl */,
F96D443B08F272B9004A47F5 /* uniClass.tcl */,
F96D443C08F272B9004A47F5 /* uniParse.tcl */,
);
@@ -3976,7 +4092,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "gnumake -C \"${TK_SRCROOT}/macosx\" -j \"$(sysctl -n hw.activecpu)\" \"$(echo \"${ACTION}\" | sed -e s/build// -e s/clean/distclean/ -e s/..\\*/\\&-/)${MAKE_TARGET}\" CFLAGS_WARNING=\"${WARNING_CFLAGS}\" CFLAGS_OPTIMIZE=\"-O${GCC_OPTIMIZATION_LEVEL}\" SYMROOT=\"${BUILT_PRODUCTS_DIR}\" OBJ_DIR=\"${OBJECT_FILE_DIR}\" INSTALL_ROOT=\"${DSTROOT}\" PREFIX=\"${PREFIX}\" BINDIR=\"${BINDIR}\" LIBDIR=\"${FRAMEWORK_INSTALL_PATH}\" MANDIR=\"${MANDIR}\" EXTRA_CONFIGURE_ARGS=\"${CONFIGURE_ARGS}\" APPLICATION_INSTALL_PATH=\"${APPLICATION_INSTALL_PATH}\" TCL_BUILD_DIR=\"${TCL_BUILD_DIR}\" TCL_FRAMEWORK_DIR=\"${TCL_FRAMEWORK_DIR}\" ${EXTRA_MAKE_FLAGS}\nresult=$?\nif [ -e \"${BUILT_PRODUCTS_DIR}/tktest\" ]; then\n\trm -f \"${BUILT_PRODUCTS_DIR}/tktest\"\nfi\necho \"Done\"\nrm -f \"${SCRIPT_INPUT_FILE_0}\"\nexit ${result}\n";
+ shellScript = "gnumake -C \"${TK_SRCROOT}/carbon\" -j \"$(sysctl -n hw.activecpu)\" \"$(echo \"${ACTION}\" | sed -e s/build// -e s/clean/distclean/ -e s/..\\*/\\&-/)${MAKE_TARGET}\" CFLAGS_WARNING=\"${WARNING_CFLAGS}\" CFLAGS_OPTIMIZE=\"-O${GCC_OPTIMIZATION_LEVEL}\" SYMROOT=\"${BUILT_PRODUCTS_DIR}\" OBJ_DIR=\"${OBJECT_FILE_DIR}\" INSTALL_ROOT=\"${DSTROOT}\" PREFIX=\"${PREFIX}\" BINDIR=\"${BINDIR}\" LIBDIR=\"${FRAMEWORK_INSTALL_PATH}\" MANDIR=\"${MANDIR}\" EXTRA_CONFIGURE_ARGS=\"${CONFIGURE_ARGS}\" APPLICATION_INSTALL_PATH=\"${APPLICATION_INSTALL_PATH}\" TCL_BUILD_DIR=\"${TCL_BUILD_DIR}\" TCL_FRAMEWORK_DIR=\"${TCL_FRAMEWORK_DIR}\" ${EXTRA_MAKE_FLAGS}\nresult=$?\nif [ -e \"${BUILT_PRODUCTS_DIR}/tktest\" ]; then\n\trm -f \"${BUILT_PRODUCTS_DIR}/tktest\"\nfi\necho \"Done\"\nrm -f \"${SCRIPT_INPUT_FILE_0}\"\nexit ${result}\n";
};
F9A5C5F508F651A2008AE941 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@@ -4005,7 +4121,7 @@
files = (
);
inputPaths = (
- "$(TK_SRCROOT)/macosx/configure.ac",
+ "$(TK_SRCROOT)/carbon/configure.ac",
"$(TK_SRCROOT)/unix/configure.in",
"$(TK_SRCROOT)/unix/tcl.m4",
"$(TK_SRCROOT)/unix/aclocal.m4",
@@ -4016,7 +4132,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
+ shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/carbon &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/carbon\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/carbon/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n \"${TK_SRCROOT}\"/carbon/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua=carbon --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
};
F9FD30B40CC1AD070073837D /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@@ -4045,7 +4161,7 @@
files = (
);
inputPaths = (
- "$(TK_SRCROOT)/macosx/configure.ac",
+ "$(TK_SRCROOT)/carbon/configure.ac",
"$(TK_SRCROOT)/unix/configure.in",
"$(TK_SRCROOT)/unix/tcl.m4",
"$(TK_SRCROOT)/unix/aclocal.m4",
@@ -4056,7 +4172,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n PATH=\"${PATH}:/usr/X11R6/bin\" \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --disable-corefoundation --enable-xft --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
+ shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/carbon &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/carbon\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/carbon/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n PATH=\"${PATH}:/usr/X11R6/bin\" \"${TK_SRCROOT}\"/carbon/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --disable-corefoundation --enable-xft --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
};
/* End PBXShellScriptBuildPhase section */
@@ -4099,6 +4215,7 @@
F96D459F08F272BC004A47F5 /* tclIOCmd.c in Sources */,
F96D45A008F272BC004A47F5 /* tclIOGT.c in Sources */,
F96D45A108F272BC004A47F5 /* tclIORChan.c in Sources */,
+ F95D77EA0DFD820D00A8BF6F /* tclIORTrans.c in Sources */,
F96D45A208F272BC004A47F5 /* tclIOSock.c in Sources */,
F96D45A308F272BC004A47F5 /* tclIOUtil.c in Sources */,
F96D45A408F272BC004A47F5 /* tclLink.c in Sources */,
@@ -4109,6 +4226,14 @@
F96D45AA08F272BC004A47F5 /* tclNamesp.c in Sources */,
F96D45AB08F272BC004A47F5 /* tclNotify.c in Sources */,
F96D45AC08F272BC004A47F5 /* tclObj.c in Sources */,
+ F93599B30DF1F75400E04F67 /* tclOO.c in Sources */,
+ F93599B70DF1F76100E04F67 /* tclOOBasic.c in Sources */,
+ F93599B90DF1F76600E04F67 /* tclOOCall.c in Sources */,
+ F93599BC0DF1F77000E04F67 /* tclOODefineCmds.c in Sources */,
+ F93599BE0DF1F77400E04F67 /* tclOOInfo.c in Sources */,
+ F93599C20DF1F78300E04F67 /* tclOOMethod.c in Sources */,
+ F93599C40DF1F78800E04F67 /* tclOOStubInit.c in Sources */,
+ F93599C60DF1F78D00E04F67 /* tclOOStubLib.c in Sources */,
F96D45AD08F272BC004A47F5 /* tclPanic.c in Sources */,
F96D45AE08F272BC004A47F5 /* tclParse.c in Sources */,
F96D45B008F272BC004A47F5 /* tclPathObj.c in Sources */,
@@ -4136,6 +4261,7 @@
F96D45D308F272BC004A47F5 /* tclUtf.c in Sources */,
F96D45D408F272BC004A47F5 /* tclUtil.c in Sources */,
F96D45D508F272BC004A47F5 /* tclVar.c in Sources */,
+ F96437CA0EF0D4B2003F468E /* tclZlib.c in Sources */,
F96D48E208F272C3004A47F5 /* bn_fast_s_mp_mul_digs.c in Sources */,
F96D48E408F272C3004A47F5 /* bn_fast_s_mp_sqr.c in Sources */,
F96D48E708F272C3004A47F5 /* bn_mp_add.c in Sources */,
@@ -4217,6 +4343,7 @@
F966BDD208F27A3F005CB29B /* tkAtom.c in Sources */,
F966BDD308F27A3F005CB29B /* tkBind.c in Sources */,
F966BDD408F27A3F005CB29B /* tkBitmap.c in Sources */,
+ F9152B090EAF8A5000CD5C7B /* tkBusy.c in Sources */,
F966BDD508F27A3F005CB29B /* tkButton.c in Sources */,
F966BDD708F27A3F005CB29B /* tkCanvArc.c in Sources */,
F966BDD808F27A3F005CB29B /* tkCanvas.c in Sources */,
@@ -4249,6 +4376,7 @@
F966BDFA08F27A3F005CB29B /* tkImage.c in Sources */,
F966BDFB08F27A3F005CB29B /* tkImgBmap.c in Sources */,
F966BDFC08F27A3F005CB29B /* tkImgGIF.c in Sources */,
+ F92EE8BF0E62F846001A6E80 /* tkImgPhInstance.c in Sources */,
F966BDFD08F27A3F005CB29B /* tkImgPhoto.c in Sources */,
F966BDFE08F27A3F005CB29B /* tkImgPPM.c in Sources */,
F966BE0708F27A3F005CB29B /* tkListbox.c in Sources */,
@@ -4400,6 +4528,7 @@
F9FD30DB0CC1AD070073837D /* tclIOCmd.c in Sources */,
F9FD30DC0CC1AD070073837D /* tclIOGT.c in Sources */,
F9FD30DD0CC1AD070073837D /* tclIORChan.c in Sources */,
+ F9FFAF1D0DFDDB26007F8A6A /* tclIORTrans.c in Sources */,
F9FD30DE0CC1AD070073837D /* tclIOSock.c in Sources */,
F9FD30DF0CC1AD070073837D /* tclIOUtil.c in Sources */,
F9FD30E00CC1AD070073837D /* tclLink.c in Sources */,
@@ -4410,6 +4539,14 @@
F9FD30E50CC1AD070073837D /* tclNamesp.c in Sources */,
F9FD30E60CC1AD070073837D /* tclNotify.c in Sources */,
F9FD30E70CC1AD070073837D /* tclObj.c in Sources */,
+ F9FFAF1F0DFDDB2F007F8A6A /* tclOO.c in Sources */,
+ F9FFAF200DFDDB32007F8A6A /* tclOOBasic.c in Sources */,
+ F9FFAF210DFDDB32007F8A6A /* tclOOCall.c in Sources */,
+ F9FFAF220DFDDB34007F8A6A /* tclOODefineCmds.c in Sources */,
+ F9FFAF230DFDDB35007F8A6A /* tclOOInfo.c in Sources */,
+ F9FFAF240DFDDB36007F8A6A /* tclOOMethod.c in Sources */,
+ F9FFAF250DFDDB37007F8A6A /* tclOOStubInit.c in Sources */,
+ F9FFAF260DFDDB38007F8A6A /* tclOOStubLib.c in Sources */,
F9FD30E80CC1AD070073837D /* tclPanic.c in Sources */,
F9FD30E90CC1AD070073837D /* tclParse.c in Sources */,
F9FD30EA0CC1AD070073837D /* tclPathObj.c in Sources */,
@@ -4437,6 +4574,7 @@
F9FD31000CC1AD070073837D /* tclUtf.c in Sources */,
F9FD31010CC1AD070073837D /* tclUtil.c in Sources */,
F9FD31020CC1AD070073837D /* tclVar.c in Sources */,
+ F96437CB0EF0D4B2003F468E /* tclZlib.c in Sources */,
F9FD31030CC1AD070073837D /* bn_fast_s_mp_mul_digs.c in Sources */,
F9FD31040CC1AD070073837D /* bn_fast_s_mp_sqr.c in Sources */,
F9FD31050CC1AD070073837D /* bn_mp_add.c in Sources */,
@@ -4518,6 +4656,7 @@
F9FD31510CC1AD070073837D /* tkAtom.c in Sources */,
F9FD31520CC1AD070073837D /* tkBind.c in Sources */,
F9FD31530CC1AD070073837D /* tkBitmap.c in Sources */,
+ F9152B0A0EAF8A5700CD5C7B /* tkBusy.c in Sources */,
F9FD31540CC1AD070073837D /* tkButton.c in Sources */,
F9FD31550CC1AD070073837D /* tkCanvArc.c in Sources */,
F9FD31560CC1AD070073837D /* tkCanvas.c in Sources */,
@@ -4550,6 +4689,7 @@
F9FD31710CC1AD070073837D /* tkImage.c in Sources */,
F9FD31720CC1AD070073837D /* tkImgBmap.c in Sources */,
F9FD31730CC1AD070073837D /* tkImgGIF.c in Sources */,
+ F92EE8D30E62F939001A6E80 /* tkImgPhInstance.c in Sources */,
F9FD31740CC1AD070073837D /* tkImgPhoto.c in Sources */,
F9FD31750CC1AD070073837D /* tkImgPPM.c in Sources */,
F9FD31760CC1AD070073837D /* tkListbox.c in Sources */,
diff --git a/macosx/Wish.xcodeproj/default.pbxuser b/carbon/Wish.xcodeproj/default.pbxuser
index cd9a9a6..cd9a9a6 100644
--- a/macosx/Wish.xcodeproj/default.pbxuser
+++ b/carbon/Wish.xcodeproj/default.pbxuser
diff --git a/macosx/Wish.xcodeproj/project.pbxproj b/carbon/Wish.xcodeproj/project.pbxproj
index fe78b0b..9c0a84c 100644
--- a/macosx/Wish.xcodeproj/project.pbxproj
+++ b/carbon/Wish.xcodeproj/project.pbxproj
@@ -8,6 +8,23 @@
/* Begin PBXBuildFile section */
F9067BCD0BFBA2900074F726 /* tkOldTest.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAFE08F27A39005CB29B /* tkOldTest.c */; };
+ F9152B090EAF8A5000CD5C7B /* tkBusy.c in Sources */ = {isa = PBXBuildFile; fileRef = F9152B080EAF8A5000CD5C7B /* tkBusy.c */; };
+ F9152B0A0EAF8A5700CD5C7B /* tkBusy.c in Sources */ = {isa = PBXBuildFile; fileRef = F9152B080EAF8A5000CD5C7B /* tkBusy.c */; };
+ F92EE8BF0E62F846001A6E80 /* tkImgPhInstance.c in Sources */ = {isa = PBXBuildFile; fileRef = F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */; };
+ F92EE8D30E62F939001A6E80 /* tkImgPhInstance.c in Sources */ = {isa = PBXBuildFile; fileRef = F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */; };
+ F93599B30DF1F75400E04F67 /* tclOO.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B20DF1F75400E04F67 /* tclOO.c */; };
+ F93599B70DF1F76100E04F67 /* tclOOBasic.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B60DF1F76100E04F67 /* tclOOBasic.c */; };
+ F93599B90DF1F76600E04F67 /* tclOOCall.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B80DF1F76600E04F67 /* tclOOCall.c */; };
+ F93599BC0DF1F77000E04F67 /* tclOODefineCmds.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599BB0DF1F77000E04F67 /* tclOODefineCmds.c */; };
+ F93599BE0DF1F77400E04F67 /* tclOOInfo.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599BD0DF1F77400E04F67 /* tclOOInfo.c */; };
+ F93599C20DF1F78300E04F67 /* tclOOMethod.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C10DF1F78300E04F67 /* tclOOMethod.c */; };
+ F93599C40DF1F78800E04F67 /* tclOOStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C30DF1F78800E04F67 /* tclOOStubInit.c */; };
+ F93599C60DF1F78D00E04F67 /* tclOOStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C50DF1F78D00E04F67 /* tclOOStubLib.c */; };
+ F95D77EA0DFD820D00A8BF6F /* tclIORTrans.c in Sources */ = {isa = PBXBuildFile; fileRef = F95D77E90DFD820D00A8BF6F /* tclIORTrans.c */; };
+ F96437CA0EF0D4B2003F468E /* tclZlib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96437C90EF0D4B2003F468E /* tclZlib.c */; };
+ F96437CB0EF0D4B2003F468E /* tclZlib.c in Sources */ = {isa = PBXBuildFile; fileRef = F96437C90EF0D4B2003F468E /* tclZlib.c */; };
+ F96437E70EF0D652003F468E /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F96437E60EF0D652003F468E /* libz.dylib */; };
+ F96437E80EF0D652003F468E /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F96437E60EF0D652003F468E /* libz.dylib */; };
F966BDCF08F27A3F005CB29B /* tk3d.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAC08F27A39005CB29B /* tk3d.c */; };
F966BDD108F27A3F005CB29B /* tkArgv.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAE08F27A39005CB29B /* tkArgv.c */; };
F966BDD208F27A3F005CB29B /* tkAtom.c in Sources */ = {isa = PBXBuildFile; fileRef = F966BAAF08F27A39005CB29B /* tkAtom.c */; };
@@ -292,6 +309,8 @@
F96D4AD208F272CA004A47F5 /* tclUnixSock.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446708F272B9004A47F5 /* tclUnixSock.c */; };
F96D4AD408F272CA004A47F5 /* tclUnixThrd.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446908F272B9004A47F5 /* tclUnixThrd.c */; };
F96D4AD608F272CA004A47F5 /* tclUnixTime.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D446B08F272B9004A47F5 /* tclUnixTime.c */; };
+ F9DD99BD0F07DF850018B2E4 /* tkImgPNG.c in Sources */ = {isa = PBXBuildFile; fileRef = F9DD99BC0F07DF850018B2E4 /* tkImgPNG.c */; };
+ F9DD99BE0F07DF850018B2E4 /* tkImgPNG.c in Sources */ = {isa = PBXBuildFile; fileRef = F9DD99BC0F07DF850018B2E4 /* tkImgPNG.c */; };
F9E61D28090A481F002B3151 /* bn_mp_cmp_d.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D427108F272B3004A47F5 /* bn_mp_cmp_d.c */; };
F9E61D29090A486C002B3151 /* bn_mp_neg.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42A208F272B3004A47F5 /* bn_mp_neg.c */; };
F9E61D2A090A4891002B3151 /* bn_mp_sqrt.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42C008F272B3004A47F5 /* bn_mp_sqrt.c */; };
@@ -593,22 +612,70 @@
F9FD349B0CC1BB0D0073837D /* libfreetype.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD34990CC1BB0D0073837D /* libfreetype.dylib */; };
F9FD349C0CC1BB0D0073837D /* libXft.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD349A0CC1BB0D0073837D /* libXft.dylib */; };
F9FD34C40CC1BBD70073837D /* libfontconfig.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F9FD34C30CC1BBD70073837D /* libfontconfig.dylib */; };
+ F9FFAF1D0DFDDB26007F8A6A /* tclIORTrans.c in Sources */ = {isa = PBXBuildFile; fileRef = F95D77E90DFD820D00A8BF6F /* tclIORTrans.c */; };
+ F9FFAF1F0DFDDB2F007F8A6A /* tclOO.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B20DF1F75400E04F67 /* tclOO.c */; };
+ F9FFAF200DFDDB32007F8A6A /* tclOOBasic.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B60DF1F76100E04F67 /* tclOOBasic.c */; };
+ F9FFAF210DFDDB32007F8A6A /* tclOOCall.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599B80DF1F76600E04F67 /* tclOOCall.c */; };
+ F9FFAF220DFDDB34007F8A6A /* tclOODefineCmds.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599BB0DF1F77000E04F67 /* tclOODefineCmds.c */; };
+ F9FFAF230DFDDB35007F8A6A /* tclOOInfo.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599BD0DF1F77400E04F67 /* tclOOInfo.c */; };
+ F9FFAF240DFDDB36007F8A6A /* tclOOMethod.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C10DF1F78300E04F67 /* tclOOMethod.c */; };
+ F9FFAF250DFDDB37007F8A6A /* tclOOStubInit.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C30DF1F78800E04F67 /* tclOOStubInit.c */; };
+ F9FFAF260DFDDB38007F8A6A /* tclOOStubLib.c in Sources */ = {isa = PBXBuildFile; fileRef = F93599C50DF1F78D00E04F67 /* tclOOStubLib.c */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
8DD76FB20486AB0100D96B5E /* tktest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = tktest; sourceTree = BUILT_PRODUCTS_DIR; };
F9099B8A0CC67D30005A9580 /* textpeer.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = textpeer.tcl; sourceTree = "<group>"; };
F9099B8B0CC67D3E005A9580 /* ttkbut.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttkbut.tcl; sourceTree = "<group>"; };
+ F9152B080EAF8A5000CD5C7B /* tkBusy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkBusy.c; sourceTree = "<group>"; };
+ F91543270EF201A90032D1E8 /* fontchoose.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fontchoose.tcl; sourceTree = "<group>"; };
+ F915432A0EF201CF0032D1E8 /* zlib.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = zlib.test; sourceTree = "<group>"; };
+ F915432D0EF201EE0032D1E8 /* zlib.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = zlib.n; sourceTree = "<group>"; };
+ F9183E640EFC80CD0030B814 /* throw.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = throw.n; sourceTree = "<group>"; };
+ F9183E650EFC80D70030B814 /* try.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = try.n; sourceTree = "<group>"; };
+ F9183E6A0EFC81560030B814 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
+ F9183E8F0EFC817B0030B814 /* tdbc */ = {isa = PBXFileReference; lastKnownFileType = folder; path = tdbc; sourceTree = "<group>"; };
+ F91DC23C0E44C51B002CB8D1 /* nre.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = nre.test; sourceTree = "<group>"; };
+ F91DC23D0E44C530002CB8D1 /* unsupported.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = unsupported.test; sourceTree = "<group>"; };
F91E62260C1AE686006C9D96 /* Tclsh-Info.plist.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Tclsh-Info.plist.in"; sourceTree = "<group>"; };
F92240290D7C620F005EC715 /* knightstour.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = knightstour.tcl; sourceTree = "<group>"; };
+ F92D7F100DE777240033A13A /* tsdPerf.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tsdPerf.tcl; sourceTree = "<group>"; };
+ F92D7F140DE777670033A13A /* tsdPerf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tsdPerf.c; sourceTree = "<group>"; };
+ F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImgPhInstance.c; sourceTree = "<group>"; };
+ F93599B20DF1F75400E04F67 /* tclOO.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOO.c; sourceTree = "<group>"; };
+ F93599B40DF1F75900E04F67 /* tclOO.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclOO.decls; sourceTree = "<group>"; };
+ F93599B50DF1F75D00E04F67 /* tclOO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclOO.h; sourceTree = "<group>"; };
+ F93599B60DF1F76100E04F67 /* tclOOBasic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOOBasic.c; sourceTree = "<group>"; };
+ F93599B80DF1F76600E04F67 /* tclOOCall.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOOCall.c; sourceTree = "<group>"; };
+ F93599BA0DF1F76A00E04F67 /* tclOODecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclOODecls.h; sourceTree = "<group>"; };
+ F93599BB0DF1F77000E04F67 /* tclOODefineCmds.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOODefineCmds.c; sourceTree = "<group>"; };
+ F93599BD0DF1F77400E04F67 /* tclOOInfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOOInfo.c; sourceTree = "<group>"; };
+ F93599BF0DF1F77900E04F67 /* tclOOInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclOOInt.h; sourceTree = "<group>"; };
+ F93599C00DF1F77D00E04F67 /* tclOOIntDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclOOIntDecls.h; sourceTree = "<group>"; };
+ F93599C10DF1F78300E04F67 /* tclOOMethod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOOMethod.c; sourceTree = "<group>"; };
+ F93599C30DF1F78800E04F67 /* tclOOStubInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOOStubInit.c; sourceTree = "<group>"; };
+ F93599C50DF1F78D00E04F67 /* tclOOStubLib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclOOStubLib.c; sourceTree = "<group>"; };
+ F93599C80DF1F81900E04F67 /* oo.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = oo.test; sourceTree = "<group>"; };
+ F93599CF0DF1F87F00E04F67 /* Class.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Class.3; sourceTree = "<group>"; };
+ F93599D00DF1F89E00E04F67 /* class.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = class.n; sourceTree = "<group>"; };
+ F93599D20DF1F8DF00E04F67 /* copy.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = copy.n; sourceTree = "<group>"; };
+ F93599D30DF1F8F500E04F67 /* define.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = define.n; sourceTree = "<group>"; };
+ F93599D40DF1F91900E04F67 /* Method.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = Method.3; sourceTree = "<group>"; };
+ F93599D50DF1F93700E04F67 /* my.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = my.n; sourceTree = "<group>"; };
+ F93599D60DF1F95000E04F67 /* next.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = next.n; sourceTree = "<group>"; };
+ F93599D70DF1F96800E04F67 /* object.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = object.n; sourceTree = "<group>"; };
+ F93599D80DF1F98300E04F67 /* self.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = self.n; sourceTree = "<group>"; };
F936FCD70CCD984500716967 /* ttkprogress.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttkprogress.tcl; sourceTree = "<group>"; };
F936FCD80CCD984600716967 /* tree.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tree.tcl; sourceTree = "<group>"; };
F936FCD90CCD984600716967 /* toolbar.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = toolbar.tcl; sourceTree = "<group>"; };
F936FCDA0CCD984600716967 /* ttknote.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttknote.tcl; sourceTree = "<group>"; };
F936FCDB0CCD984600716967 /* combo.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = combo.tcl; sourceTree = "<group>"; };
F93E5EFD09CF8711008FA367 /* tkMacOSXFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXFont.h; sourceTree = "<group>"; };
+ F95D77E90DFD820D00A8BF6F /* tclIORTrans.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclIORTrans.c; sourceTree = "<group>"; };
F95FAFF90B34F1130072E431 /* macOSXLoad.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = macOSXLoad.test; sourceTree = "<group>"; };
F962F7C60DADC26200648DB8 /* vsapi.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = vsapi.test; sourceTree = "<group>"; };
+ F96437C90EF0D4B2003F468E /* tclZlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclZlib.c; sourceTree = "<group>"; };
+ F96437E60EF0D652003F468E /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
F966BA0408F27A37005CB29B /* error.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = error.xbm; sourceTree = "<group>"; };
F966BA0508F27A37005CB29B /* gray12.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray12.xbm; sourceTree = "<group>"; };
F966BA0608F27A37005CB29B /* gray25.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = gray25.xbm; sourceTree = "<group>"; };
@@ -770,7 +837,6 @@
F966BAA408F27A38005CB29B /* wm.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = wm.n; sourceTree = "<group>"; };
F966BAA608F27A38005CB29B /* default.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = default.h; sourceTree = "<group>"; };
F966BAA708F27A38005CB29B /* ks_names.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ks_names.h; sourceTree = "<group>"; };
- F966BAA808F27A38005CB29B /* prolog.ps */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = prolog.ps; sourceTree = "<group>"; };
F966BAA908F27A39005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
F966BAAA08F27A39005CB29B /* tk.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tk.decls; sourceTree = "<group>"; };
F966BAAB08F27A39005CB29B /* tk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tk.h; sourceTree = "<group>"; };
@@ -947,7 +1013,6 @@
F966BB8708F27A3A005CB29B /* optMenu.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = optMenu.tcl; sourceTree = "<group>"; };
F966BB8808F27A3A005CB29B /* palette.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = palette.tcl; sourceTree = "<group>"; };
F966BB8908F27A3B005CB29B /* panedwindow.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.tcl; sourceTree = "<group>"; };
- F966BB8A08F27A3B005CB29B /* prolog.ps */ = {isa = PBXFileReference; explicitFileType = text; fileEncoding = 4; path = prolog.ps; sourceTree = "<group>"; };
F966BB8B08F27A3B005CB29B /* safetk.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = safetk.tcl; sourceTree = "<group>"; };
F966BB8C08F27A3B005CB29B /* scale.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scale.tcl; sourceTree = "<group>"; };
F966BB8D08F27A3B005CB29B /* scrlbar.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = scrlbar.tcl; sourceTree = "<group>"; };
@@ -1055,7 +1120,6 @@
F966BC2F08F27A3C005CB29B /* get.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = get.test; sourceTree = "<group>"; };
F966BC3008F27A3C005CB29B /* grab.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = grab.test; sourceTree = "<group>"; };
F966BC3108F27A3C005CB29B /* grid.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = grid.test; sourceTree = "<group>"; };
- F966BC3208F27A3C005CB29B /* id.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = id.test; sourceTree = "<group>"; };
F966BC3308F27A3C005CB29B /* image.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = image.test; sourceTree = "<group>"; };
F966BC3408F27A3C005CB29B /* imgBmap.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = imgBmap.test; sourceTree = "<group>"; };
F966BC3508F27A3C005CB29B /* imgPhoto.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = imgPhoto.test; sourceTree = "<group>"; };
@@ -1839,7 +1903,6 @@
F96D437B08F272B6004A47F5 /* io.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = io.test; sourceTree = "<group>"; };
F96D437C08F272B6004A47F5 /* ioCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ioCmd.test; sourceTree = "<group>"; };
F96D437D08F272B6004A47F5 /* iogt.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = iogt.test; sourceTree = "<group>"; };
- F96D437E08F272B6004A47F5 /* ioUtil.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ioUtil.test; sourceTree = "<group>"; };
F96D437F08F272B6004A47F5 /* join.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = join.test; sourceTree = "<group>"; };
F96D438008F272B6004A47F5 /* lindex.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = lindex.test; sourceTree = "<group>"; };
F96D438108F272B6004A47F5 /* link.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = link.test; sourceTree = "<group>"; };
@@ -2031,17 +2094,26 @@
F96D449808F272BA004A47F5 /* tclWinThrd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinThrd.c; sourceTree = "<group>"; };
F96D449908F272BA004A47F5 /* tclWinThrd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclWinThrd.h; sourceTree = "<group>"; };
F96D449A08F272BA004A47F5 /* tclWinTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclWinTime.c; sourceTree = "<group>"; };
+ F973E5960EE99384001A648E /* vistaTheme.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = vistaTheme.tcl; sourceTree = "<group>"; };
F976F6A70C325FB6005066D9 /* tkMacOSXPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXPrivate.h; sourceTree = "<group>"; };
F97AE7F10B65C1E900310EA2 /* Wish-Common.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Common.xcconfig"; sourceTree = "<group>"; };
F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Release.xcconfig"; sourceTree = "<group>"; };
F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Wish-Debug.xcconfig"; sourceTree = "<group>"; };
+ F98383650F0FA43900171CA6 /* checkbutton.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = checkbutton.test; sourceTree = "<group>"; };
+ F98383680F0FA44700171CA6 /* radiobutton.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = radiobutton.test; sourceTree = "<group>"; };
F9903CAF094FAADA004613E9 /* tclTomMath.decls */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclTomMath.decls; sourceTree = "<group>"; };
F9903CB0094FAADA004613E9 /* tclTomMathDecls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tclTomMathDecls.h; sourceTree = "<group>"; };
+ F99388380EE0114B0065FE6B /* fontchooser.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fontchooser.tcl; sourceTree = "<group>"; };
+ F99388950EE02D980065FE6B /* fontchooser.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fontchooser.test; sourceTree = "<group>"; };
+ F99D61180EF5573A00BBFE01 /* TclZlib.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = TclZlib.3; sourceTree = "<group>"; };
F9A3082D08F2D4AB00BAE1AB /* Tk.framework */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.framework; path = Tk.framework; sourceTree = BUILT_PRODUCTS_DIR; };
F9A3084B08F2D4CE00BAE1AB /* Wish.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Wish.app; sourceTree = BUILT_PRODUCTS_DIR; };
F9A3084E08F2D4F400BAE1AB /* Tcl.framework */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.framework; path = Tcl.framework; sourceTree = BUILT_PRODUCTS_DIR; };
F9A493240CEBF38300B78AE2 /* chanio.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = chanio.test; sourceTree = "<group>"; };
+ F9C888C20EEF6571003F63AD /* fontchooser.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = fontchooser.n; sourceTree = "<group>"; };
F9D1360A0CDC252C00DBE0B5 /* mclist.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = mclist.tcl; sourceTree = "<group>"; };
+ F9DD99BC0F07DF850018B2E4 /* tkImgPNG.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkImgPNG.c; sourceTree = "<group>"; };
+ F9DD99BF0F07DFCD0018B2E4 /* imgPNG.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = imgPNG.test; sourceTree = "<group>"; };
F9ECB1120B26521500A28025 /* pkgIndex.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = pkgIndex.tcl; sourceTree = "<group>"; };
F9ECB1130B26521500A28025 /* platform.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = platform.tcl; sourceTree = "<group>"; };
F9ECB1140B26521500A28025 /* shell.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = shell.tcl; sourceTree = "<group>"; };
@@ -2068,6 +2140,7 @@
buildActionMask = 2147483647;
files = (
F966C07508F2820D005CB29B /* CoreFoundation.framework in Frameworks */,
+ F96437E70EF0D652003F468E /* libz.dylib in Frameworks */,
F966C07708F2821B005CB29B /* Carbon.framework in Frameworks */,
F966C07908F28233005CB29B /* IOKit.framework in Frameworks */,
);
@@ -2078,6 +2151,7 @@
buildActionMask = 2147483647;
files = (
F9FD31E40CC1AD070073837D /* CoreFoundation.framework in Frameworks */,
+ F96437E80EF0D652003F468E /* libz.dylib in Frameworks */,
F9FD32170CC1AF170073837D /* libX11.dylib in Frameworks */,
F9FD32180CC1AF170073837D /* libXext.dylib in Frameworks */,
F9FD32190CC1AF170073837D /* libXss.dylib in Frameworks */,
@@ -2116,6 +2190,15 @@
name = Products;
sourceTree = "<group>";
};
+ F9183E690EFC81560030B814 /* pkgs */ = {
+ isa = PBXGroup;
+ children = (
+ F9183E6A0EFC81560030B814 /* README */,
+ F9183E8F0EFC817B0030B814 /* tdbc */,
+ );
+ path = pkgs;
+ sourceTree = "<group>";
+ };
F966BA0308F27A37005CB29B /* bitmaps */ = {
isa = PBXGroup;
children = (
@@ -2179,6 +2262,7 @@
F966BA3908F27A37005CB29B /* focus.n */,
F966BA3A08F27A37005CB29B /* focusNext.n */,
F966BA3B08F27A37005CB29B /* font.n */,
+ F9C888C20EEF6571003F63AD /* fontchooser.n */,
F966BA3C08F27A37005CB29B /* FontId.3 */,
F966BA3D08F27A37005CB29B /* frame.n */,
F966BA3E08F27A37005CB29B /* FreeXId.3 */,
@@ -2314,7 +2398,6 @@
children = (
F966BAA608F27A38005CB29B /* default.h */,
F966BAA708F27A38005CB29B /* ks_names.h */,
- F966BAA808F27A38005CB29B /* prolog.ps */,
F966BAA908F27A39005CB29B /* README */,
F966BAAA08F27A39005CB29B /* tk.decls */,
F966BAAB08F27A39005CB29B /* tk.h */,
@@ -2324,6 +2407,7 @@
F966BAAF08F27A39005CB29B /* tkAtom.c */,
F966BAB008F27A39005CB29B /* tkBind.c */,
F966BAB108F27A39005CB29B /* tkBitmap.c */,
+ F9152B080EAF8A5000CD5C7B /* tkBusy.c */,
F966BAB208F27A39005CB29B /* tkButton.c */,
F966BAB308F27A39005CB29B /* tkButton.h */,
F966BAB408F27A39005CB29B /* tkCanvArc.c */,
@@ -2363,7 +2447,9 @@
F966BAD708F27A39005CB29B /* tkImage.c */,
F966BAD808F27A39005CB29B /* tkImgBmap.c */,
F966BAD908F27A39005CB29B /* tkImgGIF.c */,
+ F92EE8BE0E62F846001A6E80 /* tkImgPhInstance.c */,
F966BADA08F27A39005CB29B /* tkImgPhoto.c */,
+ F9DD99BC0F07DF850018B2E4 /* tkImgPNG.c */,
F966BADB08F27A39005CB29B /* tkImgPPM.c */,
F966BADC08F27A39005CB29B /* tkImgUtil.c */,
F966BADE08F27A39005CB29B /* tkInt.decls */,
@@ -2435,6 +2521,7 @@
F966BB6208F27A3A005CB29B /* dialog.tcl */,
F966BB6308F27A3A005CB29B /* entry.tcl */,
F966BB6408F27A3A005CB29B /* focus.tcl */,
+ F99388380EE0114B0065FE6B /* fontchooser.tcl */,
F966BB7308F27A3A005CB29B /* listbox.tcl */,
F966BB7408F27A3A005CB29B /* menu.tcl */,
F966BB7508F27A3A005CB29B /* mkpsenc.tcl */,
@@ -2443,7 +2530,6 @@
F966BB8708F27A3A005CB29B /* optMenu.tcl */,
F966BB8808F27A3A005CB29B /* palette.tcl */,
F966BB8908F27A3B005CB29B /* panedwindow.tcl */,
- F966BB8A08F27A3B005CB29B /* prolog.ps */,
F966BB8B08F27A3B005CB29B /* safetk.tcl */,
F966BB8C08F27A3B005CB29B /* scale.tcl */,
F966BB8D08F27A3B005CB29B /* scrlbar.tcl */,
@@ -2483,6 +2569,7 @@
F966BB2C08F27A39005CB29B /* entry3.tcl */,
F966BB2D08F27A39005CB29B /* filebox.tcl */,
F966BB2E08F27A39005CB29B /* floor.tcl */,
+ F91543270EF201A90032D1E8 /* fontchoose.tcl */,
F966BB2F08F27A39005CB29B /* form.tcl */,
F966BB3008F27A39005CB29B /* goldberg.tcl */,
F966BB3108F27A39005CB29B /* hello */,
@@ -2535,7 +2622,7 @@
path = demos;
sourceTree = "<group>";
};
- F966BB9708F27A3B005CB29B /* macosx */ = {
+ F966BB9708F27A3B005CB29B /* carbon */ = {
isa = PBXGroup;
children = (
F966BBBA08F27A3B005CB29B /* configure.ac */,
@@ -2594,7 +2681,7 @@
F97AE8330B65C87F00310EA2 /* Wish-Debug.xcconfig */,
F97AE82B0B65C69B00310EA2 /* Wish-Release.xcconfig */,
);
- path = macosx;
+ path = carbon;
sourceTree = "<group>";
};
F966BC0408F27A3C005CB29B /* tests */ = {
@@ -2640,15 +2727,16 @@
F966BC2A08F27A3C005CB29B /* focus.test */,
F966BC2B08F27A3C005CB29B /* focusTcl.test */,
F966BC2C08F27A3C005CB29B /* font.test */,
+ F99388950EE02D980065FE6B /* fontchooser.test */,
F966BC2D08F27A3C005CB29B /* frame.test */,
F966BC2E08F27A3C005CB29B /* geometry.test */,
F966BC2F08F27A3C005CB29B /* get.test */,
F966BC3008F27A3C005CB29B /* grab.test */,
F966BC3108F27A3C005CB29B /* grid.test */,
- F966BC3208F27A3C005CB29B /* id.test */,
F966BC3308F27A3C005CB29B /* image.test */,
F966BC3408F27A3C005CB29B /* imgBmap.test */,
F966BC3508F27A3C005CB29B /* imgPhoto.test */,
+ F9DD99BF0F07DFCD0018B2E4 /* imgPNG.test */,
F966BC3608F27A3C005CB29B /* imgPPM.test */,
F966BC3708F27A3C005CB29B /* listbox.test */,
F966BC3808F27A3C005CB29B /* main.test */,
@@ -2852,6 +2940,7 @@
isa = PBXGroup;
children = (
F966C07408F2820D005CB29B /* CoreFoundation.framework */,
+ F96437E60EF0D652003F468E /* libz.dylib */,
F966C07608F2821B005CB29B /* Carbon.framework */,
F966C07808F28233005CB29B /* IOKit.framework */,
F9FD32140CC1AF170073837D /* libX11.dylib */,
@@ -2932,6 +3021,7 @@
F968884C0AF787B3000797B5 /* ttk.tcl */,
F968884D0AF787B3000797B5 /* utils.tcl */,
F968884E0AF787B3000797B5 /* winTheme.tcl */,
+ F973E5960EE99384001A648E /* vistaTheme.tcl */,
F968884F0AF787B3000797B5 /* xpTheme.tcl */,
);
path = ttk;
@@ -2941,6 +3031,7 @@
isa = PBXGroup;
children = (
F96888540AF7880C000797B5 /* all.tcl */,
+ F98383650F0FA43900171CA6 /* checkbutton.test */,
F96888560AF7880C000797B5 /* combobox.test */,
F96888570AF7880C000797B5 /* entry.test */,
F96888580AF7880C000797B5 /* image.test */,
@@ -2949,6 +3040,7 @@
F968885C0AF7880C000797B5 /* notebook.test */,
F968885D0AF7880C000797B5 /* panedwindow.test */,
F968885E0AF7880C000797B5 /* progressbar.test */,
+ F98383680F0FA44700171CA6 /* radiobutton.test */,
F968885F0AF7880C000797B5 /* scrollbar.test */,
F96888600AF7880C000797B5 /* treetags.test */,
F96888610AF7880C000797B5 /* treeview.test */,
@@ -2971,6 +3063,7 @@
F96D434408F272B5004A47F5 /* tests */,
F96D3DFC08F272A4004A47F5 /* doc */,
F96D43D008F272B8004A47F5 /* tools */,
+ F9183E690EFC81560030B814 /* pkgs */,
F96D3DFA08F272A4004A47F5 /* ChangeLog */,
F96D3DFB08F272A4004A47F5 /* changes */,
F96D434308F272B5004A47F5 /* README */,
@@ -2983,7 +3076,7 @@
isa = PBXGroup;
children = (
F966BAA508F27A38005CB29B /* generic */,
- F966BB9708F27A3B005CB29B /* macosx */,
+ F966BB9708F27A3B005CB29B /* carbon */,
F966BC6B08F27A3D005CB29B /* unix */,
F966BD1908F27A3F005CB29B /* xlib */,
F966BA0308F27A37005CB29B /* bitmaps */,
@@ -3025,12 +3118,15 @@
F96D3E1108F272A5004A47F5 /* cd.n */,
F96D3E1208F272A5004A47F5 /* chan.n */,
F96D3E1308F272A5004A47F5 /* ChnlStack.3 */,
+ F93599CF0DF1F87F00E04F67 /* Class.3 */,
+ F93599D00DF1F89E00E04F67 /* class.n */,
F96D3E1408F272A5004A47F5 /* clock.n */,
F96D3E1508F272A5004A47F5 /* close.n */,
F96D3E1608F272A5004A47F5 /* CmdCmplt.3 */,
F96D3E1708F272A5004A47F5 /* Concat.3 */,
F96D3E1808F272A5004A47F5 /* concat.n */,
F96D3E1908F272A5004A47F5 /* continue.n */,
+ F93599D20DF1F8DF00E04F67 /* copy.n */,
F96D3E1A08F272A5004A47F5 /* CrtChannel.3 */,
F96D3E1B08F272A5004A47F5 /* CrtChnlHdlr.3 */,
F96D3E1C08F272A5004A47F5 /* CrtCloseHdlr.3 */,
@@ -3043,6 +3139,7 @@
F96D3E2308F272A5004A47F5 /* CrtTimerHdlr.3 */,
F96D3E2408F272A5004A47F5 /* CrtTrace.3 */,
F96D3E2508F272A5004A47F5 /* dde.n */,
+ F93599D30DF1F8F500E04F67 /* define.n */,
F96D3E2608F272A5004A47F5 /* DetachPids.3 */,
F96D3E2708F272A5004A47F5 /* dict.n */,
F96D3E2808F272A5004A47F5 /* DictObj.3 */,
@@ -3120,11 +3217,15 @@
F96D3E7008F272A6004A47F5 /* man.macros */,
F96D3E7108F272A6004A47F5 /* mathfunc.n */,
F96D3E7208F272A6004A47F5 /* memory.n */,
+ F93599D40DF1F91900E04F67 /* Method.3 */,
F96D3E7308F272A6004A47F5 /* msgcat.n */,
+ F93599D50DF1F93700E04F67 /* my.n */,
F96D3E7408F272A6004A47F5 /* Namespace.3 */,
F96D3E7508F272A6004A47F5 /* namespace.n */,
+ F93599D60DF1F95000E04F67 /* next.n */,
F96D3E7608F272A6004A47F5 /* Notifier.3 */,
F96D3E7708F272A6004A47F5 /* Object.3 */,
+ F93599D70DF1F96800E04F67 /* object.n */,
F96D3E7808F272A6004A47F5 /* ObjectType.3 */,
F96D3E7908F272A6004A47F5 /* open.n */,
F96D3E7A08F272A6004A47F5 /* OpenFileChnl.3 */,
@@ -3158,6 +3259,7 @@
F96D3E9408F272A6004A47F5 /* SaveResult.3 */,
F96D3E9508F272A6004A47F5 /* scan.n */,
F96D3E9608F272A6004A47F5 /* seek.n */,
+ F93599D80DF1F98300E04F67 /* self.n */,
F96D3E9708F272A6004A47F5 /* set.n */,
F96D3E9808F272A6004A47F5 /* SetChanErr.3 */,
F96D3E9908F272A6004A47F5 /* SetErrno.3 */,
@@ -3181,6 +3283,7 @@
F96D3EAB08F272A7004A47F5 /* SubstObj.3 */,
F96D3EAC08F272A7004A47F5 /* switch.n */,
F96D3EAD08F272A7004A47F5 /* Tcl.n */,
+ F99D61180EF5573A00BBFE01 /* TclZlib.3 */,
F96D3EAE08F272A7004A47F5 /* Tcl_Main.3 */,
F96D3EAF08F272A7004A47F5 /* TCL_MEM_DEBUG.3 */,
F96D3EB008F272A7004A47F5 /* tclsh.1 */,
@@ -3188,6 +3291,7 @@
F96D3EB208F272A7004A47F5 /* tclvars.n */,
F96D3EB308F272A7004A47F5 /* tell.n */,
F96D3EB408F272A7004A47F5 /* Thread.3 */,
+ F9183E640EFC80CD0030B814 /* throw.n */,
F96D3EB508F272A7004A47F5 /* time.n */,
F96D3EB608F272A7004A47F5 /* tm.n */,
F96D3EB708F272A7004A47F5 /* ToUpper.3 */,
@@ -3195,6 +3299,7 @@
F96D3EB908F272A7004A47F5 /* TraceCmd.3 */,
F96D3EBA08F272A7004A47F5 /* TraceVar.3 */,
F96D3EBB08F272A7004A47F5 /* Translate.3 */,
+ F9183E650EFC80D70030B814 /* try.n */,
F96D3EBC08F272A7004A47F5 /* UniCharIsAlpha.3 */,
F96D3EBD08F272A7004A47F5 /* unknown.n */,
F96D3EBE08F272A7004A47F5 /* unload.n */,
@@ -3208,6 +3313,7 @@
F96D3EC608F272A7004A47F5 /* vwait.n */,
F96D3EC708F272A7004A47F5 /* while.n */,
F96D3EC808F272A7004A47F5 /* WrongNumArgs.3 */,
+ F915432D0EF201EE0032D1E8 /* zlib.n */,
);
path = doc;
sourceTree = "<group>";
@@ -3273,6 +3379,7 @@
F96D3F0008F272A7004A47F5 /* tclIOCmd.c */,
F96D3F0108F272A7004A47F5 /* tclIOGT.c */,
F96D3F0208F272A7004A47F5 /* tclIORChan.c */,
+ F95D77E90DFD820D00A8BF6F /* tclIORTrans.c */,
F96D3F0308F272A7004A47F5 /* tclIOSock.c */,
F96D3F0408F272A7004A47F5 /* tclIOUtil.c */,
F96D3F0508F272A7004A47F5 /* tclLink.c */,
@@ -3284,6 +3391,19 @@
F96D3F0B08F272A7004A47F5 /* tclNamesp.c */,
F96D3F0C08F272A7004A47F5 /* tclNotify.c */,
F96D3F0D08F272A7004A47F5 /* tclObj.c */,
+ F93599B20DF1F75400E04F67 /* tclOO.c */,
+ F93599B40DF1F75900E04F67 /* tclOO.decls */,
+ F93599B50DF1F75D00E04F67 /* tclOO.h */,
+ F93599B60DF1F76100E04F67 /* tclOOBasic.c */,
+ F93599B80DF1F76600E04F67 /* tclOOCall.c */,
+ F93599BA0DF1F76A00E04F67 /* tclOODecls.h */,
+ F93599BB0DF1F77000E04F67 /* tclOODefineCmds.c */,
+ F93599BD0DF1F77400E04F67 /* tclOOInfo.c */,
+ F93599BF0DF1F77900E04F67 /* tclOOInt.h */,
+ F93599C00DF1F77D00E04F67 /* tclOOIntDecls.h */,
+ F93599C10DF1F78300E04F67 /* tclOOMethod.c */,
+ F93599C30DF1F78800E04F67 /* tclOOStubInit.c */,
+ F93599C50DF1F78D00E04F67 /* tclOOStubLib.c */,
F96D3F0E08F272A7004A47F5 /* tclPanic.c */,
F96D3F0F08F272A7004A47F5 /* tclParse.c */,
F96D3F1108F272A7004A47F5 /* tclPathObj.c */,
@@ -3322,6 +3442,7 @@
F96D3F3408F272A7004A47F5 /* tclUtf.c */,
F96D3F3508F272A7004A47F5 /* tclUtil.c */,
F96D3F3608F272A7004A47F5 /* tclVar.c */,
+ F96437C90EF0D4B2003F468E /* tclZlib.c */,
F96D3F3708F272A7004A47F5 /* tommath.h */,
);
path = generic;
@@ -3622,7 +3743,6 @@
F96D437B08F272B6004A47F5 /* io.test */,
F96D437C08F272B6004A47F5 /* ioCmd.test */,
F96D437D08F272B6004A47F5 /* iogt.test */,
- F96D437E08F272B6004A47F5 /* ioUtil.test */,
F96D437F08F272B6004A47F5 /* join.test */,
F96D438008F272B6004A47F5 /* lindex.test */,
F96D438108F272B6004A47F5 /* link.test */,
@@ -3646,7 +3766,9 @@
F96D439108F272B6004A47F5 /* namespace-old.test */,
F96D439208F272B7004A47F5 /* namespace.test */,
F96D439308F272B7004A47F5 /* notify.test */,
+ F91DC23C0E44C51B002CB8D1 /* nre.test */,
F96D439408F272B7004A47F5 /* obj.test */,
+ F93599C80DF1F81900E04F67 /* oo.test */,
F96D439508F272B7004A47F5 /* opt.test */,
F96D439608F272B7004A47F5 /* package.test */,
F96D439708F272B7004A47F5 /* parse.test */,
@@ -3692,6 +3814,7 @@
F96D43BF08F272B7004A47F5 /* unixNotfy.test */,
F96D43C008F272B7004A47F5 /* unknown.test */,
F96D43C108F272B7004A47F5 /* unload.test */,
+ F91DC23D0E44C530002CB8D1 /* unsupported.test */,
F96D43C208F272B7004A47F5 /* uplevel.test */,
F96D43C308F272B7004A47F5 /* upvar.test */,
F96D43C408F272B7004A47F5 /* utf.test */,
@@ -3706,6 +3829,7 @@
F96D43CD08F272B7004A47F5 /* winNotify.test */,
F96D43CE08F272B7004A47F5 /* winPipe.test */,
F96D43CF08F272B7004A47F5 /* winTime.test */,
+ F915432A0EF201CF0032D1E8 /* zlib.test */,
);
path = tests;
sourceTree = "<group>";
@@ -3738,6 +3862,8 @@
F96D443708F272B9004A47F5 /* tclmin.wse */,
F96D443908F272B9004A47F5 /* tcltk-man2html.tcl */,
F96D443A08F272B9004A47F5 /* tclZIC.tcl */,
+ F92D7F140DE777670033A13A /* tsdPerf.c */,
+ F92D7F100DE777240033A13A /* tsdPerf.tcl */,
F96D443B08F272B9004A47F5 /* uniClass.tcl */,
F96D443C08F272B9004A47F5 /* uniParse.tcl */,
);
@@ -3985,7 +4111,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "gnumake -C \"${TK_SRCROOT}/macosx\" -j \"$(sysctl -n hw.activecpu)\" \"$(echo \"${ACTION}\" | sed -e s/build// -e s/clean/distclean/ -e s/..\\*/\\&-/)${MAKE_TARGET}\" CFLAGS_WARNING=\"${WARNING_CFLAGS}\" CFLAGS_OPTIMIZE=\"-O${GCC_OPTIMIZATION_LEVEL}\" SYMROOT=\"${BUILT_PRODUCTS_DIR}\" OBJ_DIR=\"${OBJECT_FILE_DIR}\" INSTALL_ROOT=\"${DSTROOT}\" PREFIX=\"${PREFIX}\" BINDIR=\"${BINDIR}\" LIBDIR=\"${FRAMEWORK_INSTALL_PATH}\" MANDIR=\"${MANDIR}\" EXTRA_CONFIGURE_ARGS=\"${CONFIGURE_ARGS}\" APPLICATION_INSTALL_PATH=\"${APPLICATION_INSTALL_PATH}\" TCL_BUILD_DIR=\"${TCL_BUILD_DIR}\" TCL_FRAMEWORK_DIR=\"${TCL_FRAMEWORK_DIR}\" ${EXTRA_MAKE_FLAGS}\nresult=$?\nif [ -e \"${BUILT_PRODUCTS_DIR}/tktest\" ]; then\n\trm -f \"${BUILT_PRODUCTS_DIR}/tktest\"\nfi\necho \"Done\"\nrm -f \"${SCRIPT_INPUT_FILE_0}\"\nexit ${result}\n";
+ shellScript = "gnumake -C \"${TK_SRCROOT}/carbon\" -j \"$(sysctl -n hw.activecpu)\" \"$(echo \"${ACTION}\" | sed -e s/build// -e s/clean/distclean/ -e s/..\\*/\\&-/)${MAKE_TARGET}\" CFLAGS_WARNING=\"${WARNING_CFLAGS}\" CFLAGS_OPTIMIZE=\"-O${GCC_OPTIMIZATION_LEVEL}\" SYMROOT=\"${BUILT_PRODUCTS_DIR}\" OBJ_DIR=\"${OBJECT_FILE_DIR}\" INSTALL_ROOT=\"${DSTROOT}\" PREFIX=\"${PREFIX}\" BINDIR=\"${BINDIR}\" LIBDIR=\"${FRAMEWORK_INSTALL_PATH}\" MANDIR=\"${MANDIR}\" EXTRA_CONFIGURE_ARGS=\"${CONFIGURE_ARGS}\" APPLICATION_INSTALL_PATH=\"${APPLICATION_INSTALL_PATH}\" TCL_BUILD_DIR=\"${TCL_BUILD_DIR}\" TCL_FRAMEWORK_DIR=\"${TCL_FRAMEWORK_DIR}\" ${EXTRA_MAKE_FLAGS}\nresult=$?\nif [ -e \"${BUILT_PRODUCTS_DIR}/tktest\" ]; then\n\trm -f \"${BUILT_PRODUCTS_DIR}/tktest\"\nfi\necho \"Done\"\nrm -f \"${SCRIPT_INPUT_FILE_0}\"\nexit ${result}\n";
showEnvVarsInLog = 0;
};
F9A5C5F508F651A2008AE941 /* ShellScript */ = {
@@ -4016,7 +4142,7 @@
files = (
);
inputPaths = (
- "$(TK_SRCROOT)/macosx/configure.ac",
+ "$(TK_SRCROOT)/carbon/configure.ac",
"$(TK_SRCROOT)/unix/configure.in",
"$(TK_SRCROOT)/unix/tcl.m4",
"$(TK_SRCROOT)/unix/aclocal.m4",
@@ -4027,7 +4153,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
+ shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/carbon &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/carbon\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/carbon/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n \"${TK_SRCROOT}\"/carbon/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua=carbon --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
showEnvVarsInLog = 0;
};
F9FD30B40CC1AD070073837D /* ShellScript */ = {
@@ -4058,7 +4184,7 @@
files = (
);
inputPaths = (
- "$(TK_SRCROOT)/macosx/configure.ac",
+ "$(TK_SRCROOT)/carbon/configure.ac",
"$(TK_SRCROOT)/unix/configure.in",
"$(TK_SRCROOT)/unix/tcl.m4",
"$(TK_SRCROOT)/unix/aclocal.m4",
@@ -4069,7 +4195,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n PATH=\"${PATH}:/usr/X11R6/bin\" \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --disable-corefoundation --enable-xft --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
+ shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/carbon &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/carbon\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/carbon/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n PATH=\"${PATH}:/usr/X11R6/bin\" \"${TK_SRCROOT}\"/carbon/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --disable-corefoundation --enable-xft --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
@@ -4113,6 +4239,7 @@
F96D459F08F272BC004A47F5 /* tclIOCmd.c in Sources */,
F96D45A008F272BC004A47F5 /* tclIOGT.c in Sources */,
F96D45A108F272BC004A47F5 /* tclIORChan.c in Sources */,
+ F95D77EA0DFD820D00A8BF6F /* tclIORTrans.c in Sources */,
F96D45A208F272BC004A47F5 /* tclIOSock.c in Sources */,
F96D45A308F272BC004A47F5 /* tclIOUtil.c in Sources */,
F96D45A408F272BC004A47F5 /* tclLink.c in Sources */,
@@ -4123,6 +4250,14 @@
F96D45AA08F272BC004A47F5 /* tclNamesp.c in Sources */,
F96D45AB08F272BC004A47F5 /* tclNotify.c in Sources */,
F96D45AC08F272BC004A47F5 /* tclObj.c in Sources */,
+ F93599B30DF1F75400E04F67 /* tclOO.c in Sources */,
+ F93599B70DF1F76100E04F67 /* tclOOBasic.c in Sources */,
+ F93599B90DF1F76600E04F67 /* tclOOCall.c in Sources */,
+ F93599BC0DF1F77000E04F67 /* tclOODefineCmds.c in Sources */,
+ F93599BE0DF1F77400E04F67 /* tclOOInfo.c in Sources */,
+ F93599C20DF1F78300E04F67 /* tclOOMethod.c in Sources */,
+ F93599C40DF1F78800E04F67 /* tclOOStubInit.c in Sources */,
+ F93599C60DF1F78D00E04F67 /* tclOOStubLib.c in Sources */,
F96D45AD08F272BC004A47F5 /* tclPanic.c in Sources */,
F96D45AE08F272BC004A47F5 /* tclParse.c in Sources */,
F96D45B008F272BC004A47F5 /* tclPathObj.c in Sources */,
@@ -4150,6 +4285,7 @@
F96D45D308F272BC004A47F5 /* tclUtf.c in Sources */,
F96D45D408F272BC004A47F5 /* tclUtil.c in Sources */,
F96D45D508F272BC004A47F5 /* tclVar.c in Sources */,
+ F96437CA0EF0D4B2003F468E /* tclZlib.c in Sources */,
F96D48E208F272C3004A47F5 /* bn_fast_s_mp_mul_digs.c in Sources */,
F96D48E408F272C3004A47F5 /* bn_fast_s_mp_sqr.c in Sources */,
F96D48E708F272C3004A47F5 /* bn_mp_add.c in Sources */,
@@ -4232,6 +4368,7 @@
F966BDD208F27A3F005CB29B /* tkAtom.c in Sources */,
F966BDD308F27A3F005CB29B /* tkBind.c in Sources */,
F966BDD408F27A3F005CB29B /* tkBitmap.c in Sources */,
+ F9152B090EAF8A5000CD5C7B /* tkBusy.c in Sources */,
F966BDD508F27A3F005CB29B /* tkButton.c in Sources */,
F966BDD708F27A3F005CB29B /* tkCanvArc.c in Sources */,
F966BDD808F27A3F005CB29B /* tkCanvas.c in Sources */,
@@ -4264,7 +4401,9 @@
F966BDFA08F27A3F005CB29B /* tkImage.c in Sources */,
F966BDFB08F27A3F005CB29B /* tkImgBmap.c in Sources */,
F966BDFC08F27A3F005CB29B /* tkImgGIF.c in Sources */,
+ F92EE8BF0E62F846001A6E80 /* tkImgPhInstance.c in Sources */,
F966BDFD08F27A3F005CB29B /* tkImgPhoto.c in Sources */,
+ F9DD99BD0F07DF850018B2E4 /* tkImgPNG.c in Sources */,
F966BDFE08F27A3F005CB29B /* tkImgPPM.c in Sources */,
F966BE0708F27A3F005CB29B /* tkListbox.c in Sources */,
F966BE0808F27A3F005CB29B /* tkMacWinMenu.c in Sources */,
@@ -4415,6 +4554,7 @@
F9FD30DB0CC1AD070073837D /* tclIOCmd.c in Sources */,
F9FD30DC0CC1AD070073837D /* tclIOGT.c in Sources */,
F9FD30DD0CC1AD070073837D /* tclIORChan.c in Sources */,
+ F9FFAF1D0DFDDB26007F8A6A /* tclIORTrans.c in Sources */,
F9FD30DE0CC1AD070073837D /* tclIOSock.c in Sources */,
F9FD30DF0CC1AD070073837D /* tclIOUtil.c in Sources */,
F9FD30E00CC1AD070073837D /* tclLink.c in Sources */,
@@ -4425,6 +4565,14 @@
F9FD30E50CC1AD070073837D /* tclNamesp.c in Sources */,
F9FD30E60CC1AD070073837D /* tclNotify.c in Sources */,
F9FD30E70CC1AD070073837D /* tclObj.c in Sources */,
+ F9FFAF1F0DFDDB2F007F8A6A /* tclOO.c in Sources */,
+ F9FFAF200DFDDB32007F8A6A /* tclOOBasic.c in Sources */,
+ F9FFAF210DFDDB32007F8A6A /* tclOOCall.c in Sources */,
+ F9FFAF220DFDDB34007F8A6A /* tclOODefineCmds.c in Sources */,
+ F9FFAF230DFDDB35007F8A6A /* tclOOInfo.c in Sources */,
+ F9FFAF240DFDDB36007F8A6A /* tclOOMethod.c in Sources */,
+ F9FFAF250DFDDB37007F8A6A /* tclOOStubInit.c in Sources */,
+ F9FFAF260DFDDB38007F8A6A /* tclOOStubLib.c in Sources */,
F9FD30E80CC1AD070073837D /* tclPanic.c in Sources */,
F9FD30E90CC1AD070073837D /* tclParse.c in Sources */,
F9FD30EA0CC1AD070073837D /* tclPathObj.c in Sources */,
@@ -4452,6 +4600,7 @@
F9FD31000CC1AD070073837D /* tclUtf.c in Sources */,
F9FD31010CC1AD070073837D /* tclUtil.c in Sources */,
F9FD31020CC1AD070073837D /* tclVar.c in Sources */,
+ F96437CB0EF0D4B2003F468E /* tclZlib.c in Sources */,
F9FD31030CC1AD070073837D /* bn_fast_s_mp_mul_digs.c in Sources */,
F9FD31040CC1AD070073837D /* bn_fast_s_mp_sqr.c in Sources */,
F9FD31050CC1AD070073837D /* bn_mp_add.c in Sources */,
@@ -4534,6 +4683,7 @@
F9FD31510CC1AD070073837D /* tkAtom.c in Sources */,
F9FD31520CC1AD070073837D /* tkBind.c in Sources */,
F9FD31530CC1AD070073837D /* tkBitmap.c in Sources */,
+ F9152B0A0EAF8A5700CD5C7B /* tkBusy.c in Sources */,
F9FD31540CC1AD070073837D /* tkButton.c in Sources */,
F9FD31550CC1AD070073837D /* tkCanvArc.c in Sources */,
F9FD31560CC1AD070073837D /* tkCanvas.c in Sources */,
@@ -4566,7 +4716,9 @@
F9FD31710CC1AD070073837D /* tkImage.c in Sources */,
F9FD31720CC1AD070073837D /* tkImgBmap.c in Sources */,
F9FD31730CC1AD070073837D /* tkImgGIF.c in Sources */,
+ F92EE8D30E62F939001A6E80 /* tkImgPhInstance.c in Sources */,
F9FD31740CC1AD070073837D /* tkImgPhoto.c in Sources */,
+ F9DD99BE0F07DF850018B2E4 /* tkImgPNG.c in Sources */,
F9FD31750CC1AD070073837D /* tkImgPPM.c in Sources */,
F9FD31760CC1AD070073837D /* tkListbox.c in Sources */,
F9FD31770CC1AD070073837D /* tkMacWinMenu.c in Sources */,
diff --git a/carbon/configure.ac b/carbon/configure.ac
new file mode 100644
index 0000000..229af64
--- /dev/null
+++ b/carbon/configure.ac
@@ -0,0 +1,11 @@
+#! /bin/bash -norc
+dnl This file is an input file used by the GNU "autoconf" program to
+dnl generate the file "configure", which is run during Tk installation
+dnl to configure the system for the local environment.
+
+dnl Ensure that the config (auto)headers support is used, then just
+dnl include the configure sources from ../unix:
+
+m4_include(../unix/aclocal.m4)
+m4_define(SC_USE_CONFIG_HEADERS)
+m4_include(../unix/configure.in)
diff --git a/macosx/tkAboutDlg.r b/carbon/tkAboutDlg.r
index 1492b90..1492b90 100644
--- a/macosx/tkAboutDlg.r
+++ b/carbon/tkAboutDlg.r
diff --git a/carbon/tkMacOSX.h b/carbon/tkMacOSX.h
new file mode 100644
index 0000000..a2a35a5
--- /dev/null
+++ b/carbon/tkMacOSX.h
@@ -0,0 +1,36 @@
+/*
+ * tkMacOSX.h --
+ *
+ * Declarations of Macintosh specific exported variables and procedures.
+ *
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#ifndef _TKMAC
+#define _TKMAC
+
+#ifndef _TK
+#include "tk.h"
+#endif
+
+#include <Carbon/Carbon.h>
+
+/*
+ * Structures and function types for handling Netscape-type in process
+ * embedding where Tk does not control the top-level
+ */
+
+typedef int (Tk_MacOSXEmbedRegisterWinProc) (int winID, Tk_Window window);
+typedef GWorldPtr (Tk_MacOSXEmbedGetGrafPortProc) (Tk_Window window);
+typedef int (Tk_MacOSXEmbedMakeContainerExistProc) (Tk_Window window);
+typedef void (Tk_MacOSXEmbedGetClipProc) (Tk_Window window, RgnHandle rgn);
+typedef void (Tk_MacOSXEmbedGetOffsetInParentProc) (Tk_Window window, Point *ulCorner);
+
+#include "tkPlatDecls.h"
+
+#endif /* _TKMAC */
diff --git a/macosx/tkMacOSXAETE.r b/carbon/tkMacOSXAETE.r
index 54bb8cc..54bb8cc 100644
--- a/macosx/tkMacOSXAETE.r
+++ b/carbon/tkMacOSXAETE.r
diff --git a/carbon/tkMacOSXBitmap.c b/carbon/tkMacOSXBitmap.c
new file mode 100644
index 0000000..0f569f0
--- /dev/null
+++ b/carbon/tkMacOSXBitmap.c
@@ -0,0 +1,268 @@
+/*
+ * tkMacOSXBitmap.c --
+ *
+ * This file handles the implementation of native bitmaps.
+ *
+ * Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXInt.h"
+
+/*
+ * Depending on the resource type there are different ways to
+ * draw native icons.
+ */
+#define TYPE1 0 /* Family icon suite. */
+#define TYPE2 1 /* ICON resource. */
+#define TYPE3 2 /* cicn resource. */
+
+/*
+ * This data structure describes the id and type of a given icon.
+ * It is used as the source for native icons.
+ */
+typedef struct {
+ int id; /* Resource Id for Icon. */
+ long int type; /* Type of icon. */
+} NativeIcon;
+
+/*
+ * This structure holds information about native bitmaps.
+ */
+
+typedef struct {
+ const char *name; /* Name of icon. */
+ long int type; /* Type of icon. */
+ int id; /* Id of icon. */
+ int size; /* Size of icon. */
+} BuiltInIcon;
+
+/*
+ * This array mapps a string name to the supported builtin icons
+ * on the Macintosh.
+ */
+
+static BuiltInIcon builtInIcons[] = {
+ {"document", TYPE1, kGenericDocumentIconResource, 32},
+ {"stationery", TYPE1, kGenericStationeryIconResource, 32},
+ {"edition", TYPE1, kGenericEditionFileIconResource, 32},
+ {"application", TYPE1, kGenericApplicationIconResource, 32},
+ {"accessory", TYPE1, kGenericDeskAccessoryIconResource, 32},
+ {"folder", TYPE1, kGenericFolderIconResource, 32},
+ {"pfolder", TYPE1, kPrivateFolderIconResource, 32},
+ {"trash", TYPE1, kTrashIconResource, 32},
+ {"floppy", TYPE1, kFloppyIconResource, 32},
+ {"ramdisk", TYPE1, kGenericRAMDiskIconResource, 32},
+ {"cdrom", TYPE1, kGenericCDROMIconResource, 32},
+ {"preferences", TYPE1, kGenericPreferencesIconResource, 32},
+ {"querydoc", TYPE1, kGenericQueryDocumentIconResource, 32},
+ {"stop", TYPE2, kStopIcon, 32},
+ {"note", TYPE2, kNoteIcon, 32},
+ {"caution", TYPE2, kCautionIcon, 32},
+ {NULL, 0, 0, 0}
+};
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDefineNativeBitmaps --
+ *
+ * Add native bitmaps.
+ *
+ * Results:
+ * A standard Tcl result. If an error occurs then TCL_ERROR is
+ * returned and a message is left in the interp's result.
+ *
+ * Side effects:
+ * "Name" is entered into the bitmap table and may be used from
+ * here on to refer to the given bitmap.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDefineNativeBitmaps(void)
+{
+ Tcl_HashTable *tablePtr = TkGetBitmapPredefTable();
+ BuiltInIcon *builtInPtr;
+
+ for (builtInPtr = builtInIcons; builtInPtr->name != NULL; builtInPtr++) {
+ Tcl_HashEntry *predefHashPtr;
+ const char * name;
+ int isNew;
+
+ name = Tk_GetUid(builtInPtr->name);
+ predefHashPtr = Tcl_CreateHashEntry(tablePtr, name, &isNew);
+ if (isNew) {
+ TkPredefBitmap *predefPtr = ckalloc(sizeof(TkPredefBitmap));
+ NativeIcon *nativeIconPtr = ckalloc(sizeof(NativeIcon));
+
+ nativeIconPtr->id = builtInPtr->id;
+ nativeIconPtr->type = builtInPtr->type;
+ predefPtr->source = nativeIconPtr;
+ predefPtr->width = builtInPtr->size;
+ predefPtr->height = builtInPtr->size;
+ predefPtr->native = 1;
+ Tcl_SetHashValue(predefHashPtr, predefPtr);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpCreateNativeBitmap --
+ *
+ * Add native bitmaps.
+ *
+ * Results:
+ * A standard Tcl result. If an error occurs then TCL_ERROR is
+ * returned and a message is left in the interp's result.
+ *
+ * Side effects:
+ * "Name" is entered into the bitmap table and may be used from
+ * here on to refer to the given bitmap.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Pixmap
+TkpCreateNativeBitmap(
+ Display *display,
+ const void *source) /* Info about the icon to build. */
+{
+ Pixmap pix;
+ Rect destRect;
+ CGrafPtr savePort;
+ Boolean portChanged;
+ const NativeIcon *nativeIconPtr;
+
+ pix = Tk_GetPixmap(display, None, 32, 32, 0);
+ portChanged = QDSwapPort(TkMacOSXGetDrawablePort(pix), &savePort);
+
+ nativeIconPtr = (const NativeIcon *) source;
+ SetRect(&destRect, 0, 0, 32, 32);
+ if (nativeIconPtr->type == TYPE1) {
+ RGBColor white = {0xFFFF, 0xFFFF, 0xFFFF};
+
+ RGBForeColor(&white);
+ PaintRect(&destRect);
+ PlotIconID(&destRect, atAbsoluteCenter, ttNone, nativeIconPtr->id);
+ } else if (nativeIconPtr->type == TYPE2) {
+ Handle icon = GetIcon(nativeIconPtr->id);
+
+ if (icon != NULL) {
+ RGBColor black = {0, 0, 0};
+
+ RGBForeColor(&black);
+ PlotIcon(&destRect, icon);
+ ReleaseResource(icon);
+ }
+ }
+
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+ return pix;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetNativeAppBitmap --
+ *
+ * Add native bitmaps.
+ *
+ * Results:
+ * A standard Tcl result. If an error occurs then TCL_ERROR is
+ * returned and a message is left in the interp's result.
+ *
+ * Side effects:
+ * "Name" is entered into the bitmap table and may be used from
+ * here on to refer to the given bitmap.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Pixmap
+TkpGetNativeAppBitmap(
+ Display *display, /* The display. */
+ const char *name, /* The name of the bitmap. */
+ int *width, /* The width & height of the bitmap. */
+ int *height)
+{
+ Pixmap pix;
+ CGrafPtr savePort;
+ Boolean portChanged;
+ Rect destRect;
+ Handle resource;
+ int type = -1, destWrote;
+ Str255 nativeName;
+ Tcl_Encoding encoding;
+
+ /*
+ * macRoman is the encoding that the resource fork uses.
+ */
+
+ encoding = Tcl_GetEncoding(NULL, "macRoman");
+ Tcl_UtfToExternal(NULL, encoding, name, strlen(name), 0, NULL,
+ (char *) &nativeName[1], 255, NULL, &destWrote, NULL);
+ nativeName[0] = destWrote;
+ Tcl_FreeEncoding(encoding);
+
+ resource = GetNamedResource('cicn', nativeName);
+ if (resource != NULL) {
+ type = TYPE3;
+ } else {
+ resource = GetNamedResource('ICON', nativeName);
+ if (resource != NULL) {
+ type = TYPE2;
+ }
+ }
+
+ if (resource == NULL) {
+ return (Pixmap) NULL;
+ }
+
+ pix = Tk_GetPixmap(display, None, 32, 32, 0);
+ portChanged = QDSwapPort(TkMacOSXGetDrawablePort(pix), &savePort);
+
+ SetRect(&destRect, 0, 0, 32, 32);
+ if (type == TYPE2) {
+ RGBColor black = {0, 0, 0};
+
+ RGBForeColor(&black);
+ PlotIcon(&destRect, resource);
+ ReleaseResource(resource);
+ } else if (type == TYPE3) {
+ RGBColor white = {0xFFFF, 0xFFFF, 0xFFFF};
+ short id;
+ ResType theType;
+ Str255 dummy;
+
+ /*
+ * We need to first paint the background white. Also, for some reason
+ * we *must* use GetCIcon instead of GetNamedResource for PlotCIcon to
+ * work - so we use GetResInfo to get the id.
+ */
+
+ RGBForeColor(&white);
+ PaintRect(&destRect);
+ GetResInfo(resource, &id, &theType, dummy);
+ ReleaseResource(resource);
+ resource = (Handle) GetCIcon(id);
+ PlotCIcon(&destRect, (CIconHandle) resource);
+ DisposeCIcon((CIconHandle) resource);
+ }
+
+ *width = 32;
+ *height = 32;
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+ return pix;
+}
diff --git a/carbon/tkMacOSXButton.c b/carbon/tkMacOSXButton.c
new file mode 100644
index 0000000..b39696d
--- /dev/null
+++ b/carbon/tkMacOSXButton.c
@@ -0,0 +1,1621 @@
+/*
+ * tkMacOSXButton.c --
+ *
+ * This file implements the Macintosh specific portion of the
+ * button widgets.
+ *
+ * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkButton.h"
+#include "tkMacOSXFont.h"
+#include "tkMacOSXDebug.h"
+
+#define DEFAULT_USE_TK_TEXT 0
+
+#define CONTROL_INITIALIZED 1
+#define FIRST_DRAW 2
+#define ACTIVE 4
+
+#define MAX_VALUE 2
+
+/*
+ * Default insets for controls
+ */
+
+#define DEF_INSET_LEFT 2
+#define DEF_INSET_RIGHT 2
+#define DEF_INSET_TOP 2
+#define DEF_INSET_BOTTOM 4
+
+/*
+ * Some defines used to control what type of control is drawn.
+ */
+
+#define DRAW_LABEL 0 /* Labels are treated genericly. */
+#define DRAW_CONTROL 1 /* Draw using the Native control. */
+#define DRAW_CUSTOM 2 /* Make our own button drawing. */
+#define DRAW_BEVEL 3
+
+/*
+ * Declaration of Mac specific button structure.
+ */
+
+typedef struct {
+ SInt16 initialValue;
+ SInt16 minValue;
+ SInt16 maxValue;
+ SInt16 procID;
+ int isBevel;
+} MacControlParams;
+
+typedef struct {
+ int drawType;
+ Tk_3DBorder border;
+ int relief;
+ int offset; /* 0 means this is a normal widget. 1 means
+ * it is an image button, so we offset the
+ * image to make the button appear to move
+ * up and down as the relief changes. */
+ GC gc;
+ int hasImageOrBitmap;
+} DrawParams;
+
+typedef struct {
+ TkButton info; /* Generic button info */
+ int id;
+ int usingControl;
+ int useTkText;
+ int flags; /* Initialisation status */
+ MacControlParams params;
+ WindowRef windowRef;
+ unsigned long userPaneBackground;
+ ControlRef userPane; /* Carbon control */
+ ControlRef control; /* Carbon control */
+ Str255 controlTitle;
+ ControlFontStyleRec fontStyle;
+ /*
+ * The following are used to store the image content for
+ * beveled buttons, i.e. buttons with images.
+ */
+ ControlButtonContentInfo bevelButtonContent;
+ OpenCPicParams picParams;
+} MacButton;
+
+/*
+ * Forward declarations for procedures defined later in this file:
+ */
+
+static OSStatus SetUserPaneDrawProc(ControlRef control,
+ ControlUserPaneDrawProcPtr upp);
+static OSStatus SetUserPaneSetUpSpecialBackgroundProc(ControlRef control,
+ ControlUserPaneBackgroundProcPtr upp);
+static void UserPaneDraw(ControlRef control, ControlPartCode cpc);
+static void UserPaneBackgroundProc(ControlHandle,
+ ControlBackgroundPtr info);
+
+static void ButtonEventProc(ClientData clientData, XEvent *eventPtr);
+static int UpdateControlColors(MacButton *mbPtr);
+static void TkMacOSXComputeControlParams(TkButton *butPtr,
+ MacControlParams *paramsPtr);
+static int TkMacOSXComputeDrawParams(TkButton *butPtr, DrawParams *dpPtr);
+static void TkMacOSXDrawControl(MacButton *butPtr, GWorldPtr destPort, GC gc,
+ Pixmap pixmap);
+static void SetupBevelButton(MacButton *butPtr, ControlRef controlHandle,
+ GWorldPtr destPort, GC gc, Pixmap pixmap);
+
+/*
+ * The class procedure table for the button widgets.
+ */
+
+const Tk_ClassProcs tkpButtonProcs = {
+ sizeof(Tk_ClassProcs), /* size */
+ TkButtonWorldChanged, /* worldChangedProc */
+ NULL, /* createProc */
+ NULL /* modalProc */
+};
+
+static int bCount;
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpCreateButton --
+ *
+ * Allocate a new TkButton structure.
+ *
+ * Results:
+ * Returns a newly allocated TkButton structure.
+ *
+ * Side effects:
+ * Registers an event handler for the widget.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkButton *
+TkpCreateButton(
+ Tk_Window tkwin)
+{
+ MacButton *macButtonPtr = ckalloc(sizeof(MacButton));
+
+ Tk_CreateEventHandler(tkwin, ActivateMask,
+ ButtonEventProc, (ClientData) macButtonPtr);
+ macButtonPtr->id = bCount++;
+ macButtonPtr->usingControl = 0;
+ macButtonPtr->flags = 0;
+ macButtonPtr->userPaneBackground = PIXEL_MAGIC << 24;
+ macButtonPtr->userPane = NULL;
+ macButtonPtr->control = NULL;
+ macButtonPtr->controlTitle[0] = 0;
+ macButtonPtr->controlTitle[1] = 0;
+ bzero(&macButtonPtr->params, sizeof(macButtonPtr->params));
+ bzero(&macButtonPtr->fontStyle, sizeof(macButtonPtr->fontStyle));
+
+ return (TkButton *)macButtonPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDisplayButton --
+ *
+ * This procedure is invoked to display a button widget. It is
+ * normally invoked as an idle handler.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Commands are output to X to display the button in its
+ * current mode. The REDRAW_PENDING flag is cleared.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDisplayButton(
+ ClientData clientData) /* Information about widget. */
+{
+ MacButton *macButtonPtr = (MacButton *) clientData;
+ TkButton *butPtr = (TkButton *) clientData;
+ Tk_Window tkwin = butPtr->tkwin;
+ CGrafPtr destPort, savePort;
+ Boolean portChanged;
+ Pixmap pixmap;
+ int width, height, fullWidth, fullHeight, textXOffset, textYOffset;
+ int borderWidth = 0, wasUsingControl;
+ int haveImage = 0, haveText = 0, imageWidth = 0, imageHeight = 0;
+ int imageXOffset = 0, imageYOffset = 0; /* image information that will
+ * be used to restrict disabled
+ * pixmap as well */
+ DrawParams drawParams, *dpPtr = &drawParams;
+
+ butPtr->flags &= ~REDRAW_PENDING;
+ if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
+ return;
+ }
+ pixmap = (Pixmap) Tk_WindowId(tkwin);
+ wasUsingControl = macButtonPtr->usingControl;
+
+ if (TkMacOSXComputeDrawParams(butPtr, &drawParams) ) {
+ macButtonPtr->usingControl = 1;
+ if (butPtr->type == TYPE_BUTTON) {
+ macButtonPtr->useTkText = 0;
+ } else {
+ macButtonPtr->useTkText = 1;
+ }
+ } else {
+ macButtonPtr->usingControl = 0;
+ macButtonPtr->useTkText = 1;
+ }
+
+ /*
+ * See the comment in UpdateControlColors as to why we use the
+ * highlightbackground for the border of Macintosh buttons.
+ */
+
+ if (macButtonPtr->useTkText) {
+ if (butPtr->type == TYPE_BUTTON) {
+ Tk_Fill3DRectangle(tkwin, pixmap, butPtr->highlightBorder, 0, 0,
+ Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);
+ } else {
+ Tk_Fill3DRectangle(tkwin, pixmap, butPtr->normalBorder, 0, 0,
+ Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);
+ }
+ }
+
+ /*
+ * Set up clipping region. Make sure the we are using the port
+ * for this button, or we will set the wrong window's clip.
+ */
+
+ destPort = TkMacOSXGetDrawablePort(pixmap);
+ portChanged = QDSwapPort(destPort, &savePort);
+ TkMacOSXSetUpClippingRgn(pixmap);
+
+ /*
+ * Draw the native portion of the buttons. Start by creating the control
+ * if it doesn't already exist. Then configure the Macintosh control from
+ * the Tk info. Finally, we call Draw1Control to draw to the screen.
+ */
+
+ if (macButtonPtr->usingControl) {
+ borderWidth = 0;
+ TkMacOSXDrawControl(macButtonPtr, destPort, dpPtr->gc, pixmap);
+ } else if (wasUsingControl && macButtonPtr->userPane) {
+ DisposeControl(macButtonPtr->userPane);
+ macButtonPtr->userPane = NULL;
+ macButtonPtr->control = NULL;
+ macButtonPtr->flags = 0;
+ }
+
+ if ((dpPtr->drawType == DRAW_CUSTOM) || (dpPtr->drawType == DRAW_LABEL)) {
+ borderWidth = butPtr->borderWidth;
+ }
+
+ /*
+ * Display image or bitmap or text for button. This has
+ * already been done under Appearance with the Bevel
+ * button types.
+ */
+
+ if (dpPtr->drawType == DRAW_BEVEL) {
+ goto applyStipple;
+ }
+
+ if (butPtr->image != None) {
+ Tk_SizeOfImage(butPtr->image, &width, &height);
+ haveImage = 1;
+ } else if (butPtr->bitmap != None) {
+ Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
+ haveImage = 1;
+ }
+ imageWidth = width;
+ imageHeight = height;
+
+ haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0);
+ if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) {
+ int x, y;
+
+ textXOffset = 0;
+ textYOffset = 0;
+ fullWidth = 0;
+ fullHeight = 0;
+
+ switch ((enum compound) butPtr->compound) {
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ /*
+ * Image is above or below text.
+ */
+ if (butPtr->compound == COMPOUND_TOP) {
+ textYOffset = height + butPtr->padY;
+ } else {
+ imageYOffset = butPtr->textHeight + butPtr->padY;
+ }
+ fullHeight = height + butPtr->textHeight + butPtr->padY;
+ fullWidth = (width > butPtr->textWidth ? width :
+ butPtr->textWidth);
+ textXOffset = (fullWidth - butPtr->textWidth)/2;
+ imageXOffset = (fullWidth - width)/2;
+ break;
+
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ /*
+ * Image is left or right of text.
+ */
+
+ if (butPtr->compound == COMPOUND_LEFT) {
+ textXOffset = width + butPtr->padX;
+ } else {
+ imageXOffset = butPtr->textWidth + butPtr->padX;
+ }
+ fullWidth = butPtr->textWidth + butPtr->padX + width;
+ fullHeight = (height > butPtr->textHeight ? height :
+ butPtr->textHeight);
+ textYOffset = (fullHeight - butPtr->textHeight)/2;
+ imageYOffset = (fullHeight - height)/2;
+ break;
+
+ case COMPOUND_CENTER:
+ /*
+ * Image and text are superimposed.
+ */
+
+ fullWidth = (width > butPtr->textWidth ? width :
+ butPtr->textWidth);
+ fullHeight = (height > butPtr->textHeight ? height :
+ butPtr->textHeight);
+ textXOffset = (fullWidth - butPtr->textWidth)/2;
+ imageXOffset = (fullWidth - width)/2;
+ textYOffset = (fullHeight - butPtr->textHeight)/2;
+ imageYOffset = (fullHeight - height)/2;
+ break;
+
+ case COMPOUND_NONE:
+ break;
+ }
+
+ TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY,
+ butPtr->indicatorSpace + fullWidth, fullHeight, &x, &y);
+
+ x += butPtr->indicatorSpace;
+
+ x += dpPtr->offset;
+ y += dpPtr->offset;
+ if (dpPtr->relief == TK_RELIEF_RAISED) {
+ x -= dpPtr->offset;
+ y -= dpPtr->offset;
+ } else if (dpPtr->relief == TK_RELIEF_SUNKEN) {
+ x += dpPtr->offset;
+ y += dpPtr->offset;
+ }
+ imageXOffset += x;
+ imageYOffset += y;
+ if (butPtr->image != NULL) {
+ if ((butPtr->selectImage != NULL) && (butPtr->flags & SELECTED)) {
+ Tk_RedrawImage(butPtr->selectImage, 0, 0, width, height,
+ pixmap, imageXOffset, imageYOffset);
+ } else if ((butPtr->tristateImage != NULL) &&
+ (butPtr->flags & TRISTATED)) {
+ Tk_RedrawImage(butPtr->tristateImage, 0, 0, width, height,
+ pixmap, imageXOffset, imageYOffset);
+ } else {
+ Tk_RedrawImage(butPtr->image, 0, 0, width, height,
+ pixmap, imageXOffset, imageYOffset);
+ }
+ } else {
+ XSetClipOrigin(butPtr->display, dpPtr->gc, imageXOffset,
+ imageYOffset);
+ XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, dpPtr->gc,
+ 0, 0, width, height, imageXOffset, imageYOffset, 1);
+ XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0);
+ }
+
+ if (macButtonPtr->useTkText) {
+ Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc,
+ butPtr->textLayout, x + textXOffset, y + textYOffset, 0,
+ -1);
+ Tk_UnderlineTextLayout(butPtr->display, pixmap, dpPtr->gc,
+ butPtr->textLayout, x + textXOffset, y + textYOffset,
+ butPtr->underline);
+ }
+ y += fullHeight/2;
+ } else if (haveImage) {
+ int x = 0, y;
+
+ TkComputeAnchor(butPtr->anchor, tkwin, 0, 0,
+ butPtr->indicatorSpace + width, height, &x, &y);
+ x += butPtr->indicatorSpace;
+
+ x += dpPtr->offset;
+ y += dpPtr->offset;
+ if (dpPtr->relief == TK_RELIEF_RAISED) {
+ x -= dpPtr->offset;
+ y -= dpPtr->offset;
+ } else if (dpPtr->relief == TK_RELIEF_SUNKEN) {
+ x += dpPtr->offset;
+ y += dpPtr->offset;
+ }
+ imageXOffset += x;
+ imageYOffset += y;
+ if (butPtr->image != NULL) {
+ if ((butPtr->selectImage != NULL) && (butPtr->flags & SELECTED)) {
+ Tk_RedrawImage(butPtr->selectImage, 0, 0, width, height,
+ pixmap, imageXOffset, imageYOffset);
+ } else if ((butPtr->tristateImage != NULL) &&
+ (butPtr->flags & TRISTATED)) {
+ Tk_RedrawImage(butPtr->tristateImage, 0, 0, width, height,
+ pixmap, imageXOffset, imageYOffset);
+ } else {
+ Tk_RedrawImage(butPtr->image, 0, 0, width, height,
+ pixmap, imageXOffset, imageYOffset);
+ }
+ } else {
+ XSetClipOrigin(butPtr->display, dpPtr->gc, x, y);
+ XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, dpPtr->gc,
+ 0, 0, width, height, x, y, 1);
+ XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0);
+ }
+ y += height/2;
+ } else if (macButtonPtr->useTkText) {
+ int x = 0, y;
+
+ TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY,
+ butPtr->indicatorSpace + butPtr->textWidth,
+ butPtr->textHeight, &x, &y);
+ x += butPtr->indicatorSpace;
+ Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc,
+ butPtr->textLayout, x, y, 0, -1);
+ }
+
+ /*
+ * If the button is disabled with a stipple rather than a special
+ * foreground color, generate the stippled effect. If the widget
+ * is selected and we use a different background color when selected,
+ * must temporarily modify the GC so the stippling is the right color.
+ */
+
+ applyStipple:
+ if (macButtonPtr->useTkText) {
+ if ((butPtr->state == STATE_DISABLED)
+ && ((butPtr->disabledFg == NULL) || (butPtr->image != NULL))) {
+ if ((butPtr->flags & SELECTED) && !butPtr->indicatorOn
+ && (butPtr->selectBorder != NULL)) {
+ XSetForeground(butPtr->display, butPtr->stippleGC,
+ Tk_3DBorderColor(butPtr->selectBorder)->pixel);
+ }
+
+ /*
+ * Stipple the whole button if no disabledFg was specified,
+ * otherwise restrict stippling only to displayed image
+ */
+
+ if (butPtr->disabledFg == NULL) {
+ XFillRectangle(butPtr->display, pixmap, butPtr->stippleGC,
+ 0, 0, (unsigned) Tk_Width(tkwin),
+ (unsigned) Tk_Height(tkwin));
+ } else {
+ XFillRectangle(butPtr->display, pixmap, butPtr->stippleGC,
+ imageXOffset, imageYOffset,
+ (unsigned) imageWidth, (unsigned) imageHeight);
+ }
+ if ((butPtr->flags & SELECTED) && !butPtr->indicatorOn
+ && (butPtr->selectBorder != NULL)) {
+ XSetForeground(butPtr->display, butPtr->stippleGC,
+ Tk_3DBorderColor(butPtr->normalBorder)->pixel);
+ }
+ }
+
+ /*
+ * Draw the border and traversal highlight last. This way, if the
+ * button's contents overflow they'll be covered up by the border.
+ */
+
+ if (dpPtr->relief != TK_RELIEF_FLAT) {
+ int inset = butPtr->highlightWidth;
+
+ Tk_Draw3DRectangle(tkwin, pixmap, dpPtr->border, inset, inset,
+ Tk_Width(tkwin) - 2*inset, Tk_Height(tkwin) - 2*inset,
+ borderWidth, dpPtr->relief);
+ }
+ }
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpComputeButtonGeometry --
+ *
+ * After changes in a button's text or bitmap, this procedure
+ * recomputes the button's geometry and passes this information
+ * along to the geometry manager for the window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The button's window may change size.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpComputeButtonGeometry(
+ TkButton *butPtr) /* Button whose geometry may have changed. */
+{
+ int width, height, avgWidth, haveImage = 0, haveText = 0;
+ int xInset, yInset, txtWidth, txtHeight;
+ Tk_FontMetrics fm;
+ DrawParams drawParams;
+
+ /*
+ * First figure out the size of the contents of the button.
+ */
+
+ width = 0;
+ height = 0;
+ txtWidth = 0;
+ txtHeight = 0;
+ avgWidth = 0;
+
+ butPtr->indicatorSpace = 0;
+ if (butPtr->image != NULL) {
+ Tk_SizeOfImage(butPtr->image, &width, &height);
+ haveImage = 1;
+ } else if (butPtr->bitmap != None) {
+ Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
+ haveImage = 1;
+ }
+
+ if (haveImage == 0 || butPtr->compound != COMPOUND_NONE) {
+ Tk_FreeTextLayout(butPtr->textLayout);
+ butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont,
+ Tcl_GetString(butPtr->textPtr), -1, butPtr->wrapLength,
+ butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight);
+
+ txtWidth = butPtr->textWidth;
+ txtHeight = butPtr->textHeight;
+ avgWidth = Tk_TextWidth(butPtr->tkfont, "0", 1);
+ Tk_GetFontMetrics(butPtr->tkfont, &fm);
+ haveText = (txtWidth != 0 && txtHeight != 0);
+ }
+
+ /*
+ * If the button is compound (ie, it shows both an image and text),
+ * the new geometry is a combination of the image and text geometry.
+ * We only honor the compound bit if the button has both text and an
+ * image, because otherwise it is not really a compound button.
+ */
+
+ if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) {
+ switch ((enum compound) butPtr->compound) {
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ /*
+ * Image is above or below text.
+ */
+
+ height += txtHeight + butPtr->padY;
+ width = (width > txtWidth ? width : txtWidth);
+ break;
+ case COMPOUND_LEFT:
+ case COMPOUND_RIGHT:
+ /*
+ * Image is left or right of text.
+ */
+
+ width += txtWidth + butPtr->padX;
+ height = (height > txtHeight ? height : txtHeight);
+ break;
+ case COMPOUND_CENTER:
+ /*
+ * Image and text are superimposed.
+ */
+
+ width = (width > txtWidth ? width : txtWidth);
+ height = (height > txtHeight ? height : txtHeight);
+ break;
+ case COMPOUND_NONE:
+ break;
+ }
+ if (butPtr->width > 0) {
+ width = butPtr->width;
+ }
+ if (butPtr->height > 0) {
+ height = butPtr->height;
+ }
+
+ if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn) {
+ butPtr->indicatorSpace = height;
+ if (butPtr->type == TYPE_CHECK_BUTTON) {
+ butPtr->indicatorDiameter = (65 * height)/100;
+ } else {
+ butPtr->indicatorDiameter = (75 * height)/100;
+ }
+ }
+
+ width += 2 * butPtr->padX;
+ height += 2 * butPtr->padY;
+ } else if (haveImage) {
+ if (butPtr->width > 0) {
+ width = butPtr->width;
+ }
+ if (butPtr->height > 0) {
+ height = butPtr->height;
+ }
+ if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn) {
+ butPtr->indicatorSpace = height;
+ if (butPtr->type == TYPE_CHECK_BUTTON) {
+ butPtr->indicatorDiameter = (65 * height)/100;
+ } else {
+ butPtr->indicatorDiameter = (75 * height)/100;
+ }
+ }
+ } else {
+ width = txtWidth;
+ height = txtHeight;
+ if (butPtr->width > 0) {
+ width = butPtr->width * avgWidth;
+ }
+ if (butPtr->height > 0) {
+ height = butPtr->height * fm.linespace;
+ }
+ if ((butPtr->type >= TYPE_CHECK_BUTTON) && butPtr->indicatorOn) {
+ butPtr->indicatorDiameter = fm.linespace;
+ if (butPtr->type == TYPE_CHECK_BUTTON) {
+ butPtr->indicatorDiameter =
+ (80 * butPtr->indicatorDiameter)/100;
+ }
+ butPtr->indicatorSpace = butPtr->indicatorDiameter + avgWidth;
+ }
+ }
+
+ /*
+ * Now figure out the size of the border decorations for the button.
+ */
+
+ if (butPtr->highlightWidth < 0) {
+ butPtr->highlightWidth = 0;
+ }
+
+ /*
+ * The width and height calculation for Appearance buttons with images &
+ * non-Appearance buttons with images is different. In the latter case,
+ * we add the borderwidth to the inset, since we are going to stamp a
+ * 3-D border over the image. In the former, we add it to the height,
+ * directly, since Appearance will draw the border as part of our control.
+ *
+ * When issuing the geometry request, add extra space for the indicator,
+ * if any, and for the border and padding, plus if this is an image two
+ * extra pixels so the display can be offset by 1 pixel in either
+ * direction for the raised or lowered effect.
+ *
+ * The highlight width corresponds to the default ring on the Macintosh.
+ * As such, the highlight width is only added if the button is the default
+ * button. The actual width of the default ring is one less than the
+ * highlight width as there is also one pixel of spacing.
+ * Appearance buttons with images do not have a highlight ring, because the
+ * Bevel button type does not support one.
+ */
+
+ if ((butPtr->image == None) && (butPtr->bitmap == None)) {
+ width += 2*butPtr->padX;
+ height += 2*butPtr->padY;
+ }
+
+ if ((butPtr->type == TYPE_BUTTON)) {
+ if ((butPtr->image == None) && (butPtr->bitmap == None)) {
+ butPtr->inset = 0;
+ if (butPtr->defaultState != STATE_DISABLED) {
+ butPtr->inset += butPtr->highlightWidth;
+ }
+ } else {
+ butPtr->inset = 0;
+ width += (2 * butPtr->borderWidth + 4);
+ height += (2 * butPtr->borderWidth + 4);
+ }
+ } else if (butPtr->type == TYPE_LABEL) {
+ butPtr->inset = butPtr->borderWidth;
+ } else if (butPtr->indicatorOn) {
+ butPtr->inset = 0;
+ } else {
+ /*
+ * Under Appearance, the Checkbutton or radiobutton with an image
+ * is represented by a BevelButton with the Sticky defProc...
+ * So we must set its height in the same way as the Button
+ * with an image or bitmap.
+ */
+
+ if (butPtr->image != None || butPtr->bitmap != None) {
+ int border;
+
+ butPtr->inset = 0;
+ if (butPtr->borderWidth <= 2) {
+ border = 6;
+ } else {
+ border = 2 * butPtr->borderWidth + 2;
+ }
+ width += border;
+ height += border;
+ } else {
+ butPtr->inset = butPtr->borderWidth;
+ }
+ }
+
+ if (TkMacOSXComputeDrawParams(butPtr, &drawParams)) {
+ xInset = butPtr->indicatorSpace + DEF_INSET_LEFT + DEF_INSET_RIGHT;
+ yInset = DEF_INSET_TOP + DEF_INSET_BOTTOM;
+ } else {
+ xInset = butPtr->indicatorSpace+butPtr->inset*2;
+ yInset = butPtr->inset*2;
+ }
+ Tk_GeometryRequest(butPtr->tkwin, width + xInset, height + yInset);
+ Tk_SetInternalBorder(butPtr->tkwin, butPtr->inset);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDestroyButton --
+ *
+ * Free data structures associated with the button control.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Restores the default control state.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDestroyButton(
+ TkButton *butPtr)
+{
+ MacButton *mbPtr = (MacButton *) butPtr; /* Mac button. */
+
+ if (mbPtr->userPane) {
+ DisposeControl(mbPtr->userPane);
+ mbPtr->userPane = NULL;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXInitControl --
+ *
+ * This procedure initialises a Carbon control.
+ *
+ * Results:
+ * 0 on success, 1 on failure.
+ *
+ * Side effects:
+ * A background pane control and the control itself is created
+ * The contol is embedded in the background control
+ * The background control is embedded in the root control
+ * of the containing window
+ * The creation parameters for the control are also computed
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TkMacOSXInitControl(
+ MacButton *mbPtr, /* Mac button. */
+ GWorldPtr destPort,
+ GC gc,
+ Pixmap pixmap,
+ Rect *paneRect,
+ Rect *cntrRect)
+{
+ TkButton *butPtr = (TkButton *) mbPtr;
+ ControlRef rootControl;
+ SInt16 procID, initialValue, minValue, maxValue;
+ Boolean initiallyVisible;
+ SInt32 controlReference;
+
+ rootControl = TkMacOSXGetRootControl(Tk_WindowId(butPtr->tkwin));
+ mbPtr->windowRef = TkMacOSXDrawableWindow(Tk_WindowId(butPtr->tkwin));
+
+ /*
+ * Set up the user pane.
+ */
+
+ initiallyVisible = false;
+ initialValue = kControlSupportsEmbedding|kControlHasSpecialBackground;
+ minValue = 0;
+ maxValue = 1;
+ procID = kControlUserPaneProc;
+ controlReference = (SInt32)mbPtr;
+ mbPtr->userPane = NewControl(mbPtr->windowRef, paneRect, "\p",
+ initiallyVisible, initialValue, minValue, maxValue, procID,
+ controlReference);
+
+ if (!mbPtr->userPane) {
+ TkMacOSXDbgMsg("Failed to create user pane control");
+ return 1;
+ }
+ if (ChkErr(EmbedControl, mbPtr->userPane,rootControl) != noErr) {
+ return 1;
+ }
+
+ SetUserPaneSetUpSpecialBackgroundProc(mbPtr->userPane,
+ UserPaneBackgroundProc);
+ SetUserPaneDrawProc(mbPtr->userPane,UserPaneDraw);
+ initiallyVisible = false;
+ TkMacOSXComputeControlParams(butPtr,&mbPtr->params);
+ mbPtr->control = NewControl(mbPtr->windowRef, cntrRect, "\p",
+ initiallyVisible, mbPtr->params.initialValue,
+ mbPtr->params.minValue, mbPtr->params.maxValue,
+ mbPtr->params.procID, controlReference);
+
+ if (!mbPtr->control) {
+ TkMacOSXDbgMsg("Failed to create control of type %d\n", procID);
+ return 1;
+ }
+ if (ChkErr(EmbedControl, mbPtr->control,mbPtr->userPane) != noErr ) {
+ return 1;
+ }
+
+ mbPtr->flags |= (CONTROL_INITIALIZED | FIRST_DRAW);
+ if (IsWindowActive(mbPtr->windowRef)) {
+ mbPtr->flags |= ACTIVE;
+ }
+ return 0;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkMacOSXDrawControl --
+ *
+ * This function draws the tk button using Mac controls
+ * In addition, this code may apply custom colors passed
+ * in the TkButton.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The control is created, or reinitialised as needed.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+TkMacOSXDrawControl(
+ MacButton *mbPtr, /* Mac button. */
+ GWorldPtr destPort, /* Off screen GWorld. */
+ GC gc, /* The GC we are drawing into - needed for the
+ * bevel button */
+ Pixmap pixmap) /* The pixmap we are drawing into - needed for
+ * the bevel button */
+{
+ TkButton *butPtr = (TkButton *) mbPtr;
+ TkWindow *winPtr;
+ Rect paneRect, cntrRect;
+ int active, enabled;
+ int rebuild;
+
+ winPtr = (TkWindow *) butPtr->tkwin;
+
+ paneRect.left = winPtr->privatePtr->xOff;
+ paneRect.top = winPtr->privatePtr->yOff;
+ paneRect.right = paneRect.left + Tk_Width(butPtr->tkwin);
+ paneRect.bottom = paneRect.top + Tk_Height(butPtr->tkwin);
+
+ cntrRect = paneRect;
+
+/*
+ cntrRect.left += butPtr->inset;
+ cntrRect.top += butPtr->inset;
+ cntrRect.right -= butPtr->inset;
+ cntrRect.bottom -= butPtr->inset;
+*/
+ cntrRect.left += DEF_INSET_LEFT;
+ cntrRect.top += DEF_INSET_TOP;
+ cntrRect.right -= DEF_INSET_RIGHT;
+ cntrRect.bottom -= DEF_INSET_BOTTOM;
+
+ /*
+ * The control has been previously initialised.
+ * It may need to be re-initialised
+ */
+#ifdef TK_REBUILD_TOPLEVEL
+ rebuild = (winPtr->flags & TK_REBUILD_TOPLEVEL);
+ winPtr->flags &= ~TK_REBUILD_TOPLEVEL;
+#else
+ rebuild = 0;
+#endif
+ if (mbPtr->flags) {
+ MacControlParams params;
+
+ TkMacOSXComputeControlParams(butPtr, &params);
+ if (rebuild || bcmp(&params, &mbPtr->params, sizeof(params))) {
+ /*
+ * The type of control has changed.
+ * Clean it up and clear the flag.
+ */
+
+ if (mbPtr->userPane) {
+ DisposeControl(mbPtr->userPane);
+ mbPtr->userPane = NULL;
+ mbPtr->control = NULL;
+ }
+ mbPtr->flags = 0;
+ }
+ }
+ if (!(mbPtr->flags & CONTROL_INITIALIZED)) {
+ if (TkMacOSXInitControl(mbPtr, destPort, gc, pixmap, &paneRect,
+ &cntrRect)) {
+ return;
+ }
+ }
+ SetControlBounds(mbPtr->userPane, &paneRect);
+ SetControlBounds(mbPtr->control, &cntrRect);
+
+ if (!mbPtr->useTkText) {
+ Str255 controlTitle;
+ ControlFontStyleRec fontStyle;
+ Tk_Font font;
+ int len;
+
+ if (((mbPtr->info.image == NULL) && (mbPtr->info.bitmap == None))
+ || (mbPtr->info.compound != COMPOUND_NONE)) {
+ len = TkFontGetFirstTextLayout(butPtr->textLayout,
+ &font, (char*) controlTitle);
+ controlTitle[len] = 0;
+ } else {
+ len = 0;
+ controlTitle[0] = 0;
+ }
+ if (rebuild || bcmp(mbPtr->controlTitle, controlTitle, len+1)) {
+ CFStringRef cf = CFStringCreateWithCString(NULL,
+ (char*) controlTitle, kCFStringEncodingUTF8);
+
+ if (cf != NULL) {
+ SetControlTitleWithCFString(mbPtr->control, cf);
+ CFRelease(cf);
+ }
+ bcopy(controlTitle, mbPtr->controlTitle, len+1);
+ }
+ if (len) {
+ TkMacOSXInitControlFontStyle(font, &fontStyle);
+ if (bcmp(&mbPtr->fontStyle, &fontStyle, sizeof(fontStyle)) ) {
+ ChkErr(SetControlFontStyle, mbPtr->control, &fontStyle);
+ bcopy(&fontStyle, &mbPtr->fontStyle, sizeof(fontStyle));
+ }
+ }
+ }
+ if (mbPtr->params.isBevel) {
+ /*
+ * Initialiase the image/button parameters.
+ */
+
+ SetupBevelButton(mbPtr, mbPtr->control, destPort, gc, pixmap);
+ }
+
+ if (butPtr->flags & SELECTED) {
+ SetControlValue(mbPtr->control, 1);
+ } else if (butPtr->flags & TRISTATED) {
+ SetControlValue(mbPtr->control, 2);
+ } else {
+ SetControlValue(mbPtr->control, 0);
+ }
+
+ active = ((mbPtr->flags & ACTIVE) != 0);
+ if (active != IsControlActive(mbPtr->control)) {
+ if (active) {
+ ChkErr(ActivateControl, mbPtr->control);
+ } else {
+ ChkErr(DeactivateControl, mbPtr->control);
+ }
+ }
+ enabled = !(butPtr->state == STATE_DISABLED);
+ if (enabled != IsControlEnabled(mbPtr->control)) {
+ if (enabled) {
+ ChkErr(EnableControl, mbPtr->control);
+ } else {
+ ChkErr(DisableControl, mbPtr->control);
+ }
+ }
+ if (active && enabled) {
+ if (butPtr->state == STATE_ACTIVE) {
+ if (mbPtr->params.isBevel) {
+ HiliteControl(mbPtr->control, kControlButtonPart);
+ } else {
+ switch (butPtr->type) {
+ case TYPE_BUTTON:
+ HiliteControl(mbPtr->control, kControlButtonPart);
+ break;
+ case TYPE_RADIO_BUTTON:
+ HiliteControl(mbPtr->control, kControlRadioButtonPart);
+ break;
+ case TYPE_CHECK_BUTTON:
+ HiliteControl(mbPtr->control, kControlCheckBoxPart);
+ break;
+ }
+ }
+ } else {
+ HiliteControl(mbPtr->control, kControlNoPart);
+ }
+ }
+ UpdateControlColors(mbPtr);
+
+ if (butPtr->type == TYPE_BUTTON && !mbPtr->params.isBevel) {
+ Boolean isDefault;
+
+ if (butPtr->defaultState == STATE_ACTIVE) {
+ isDefault = true;
+ } else {
+ isDefault = false;
+ }
+ ChkErr(SetControlData, mbPtr->control, kControlNoPart,
+ kControlPushButtonDefaultTag, sizeof(isDefault), &isDefault);
+ }
+
+ if (mbPtr->flags & FIRST_DRAW) {
+ ShowControl(mbPtr->userPane);
+ ShowControl(mbPtr->control);
+ mbPtr->flags ^= FIRST_DRAW;
+ } else {
+ SetControlVisibility(mbPtr->control, true, true);
+ Draw1Control(mbPtr->userPane);
+ }
+
+ if (mbPtr->params.isBevel) {
+ if (mbPtr->bevelButtonContent.contentType ==
+ kControlContentPictHandle) {
+ KillPicture(mbPtr->bevelButtonContent.u.picture);
+ }
+ }
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * SetupBevelButton --
+ *
+ * Sets up the Bevel Button with image by copying the
+ * source image onto the PicHandle for the button.
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * The image or bitmap for the button is copied over to a picture.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+SetupBevelButton(
+ MacButton *mbPtr, /* Mac button. */
+ ControlRef controlHandle, /* The control to set this picture to. */
+ GWorldPtr destPort, /* Off screen GWorld. */
+ GC gc, /* The GC we are drawing into - needed for the
+ * bevel button. */
+ Pixmap pixmap) /* The pixmap we are drawing into - needed for
+ * the bevel button. */
+{
+ TkButton *butPtr = (TkButton *) mbPtr;
+ int height, width;
+ ControlButtonGraphicAlignment theAlignment;
+ CGrafPtr savePort;
+ Boolean portChanged = false;
+
+ if (butPtr->image != None) {
+ Tk_SizeOfImage(butPtr->image, &width, &height);
+ } else {
+ Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
+ }
+
+ if ((butPtr->width > 0) && (butPtr->width < width)) {
+ width = butPtr->width;
+ }
+ if ((butPtr->height > 0) && (butPtr->height < height)) {
+ height = butPtr->height;
+ }
+
+ {
+ portChanged = QDSwapPort(destPort, &savePort);
+ mbPtr->picParams.version = -2;
+ mbPtr->picParams.hRes = 0x00480000;
+ mbPtr->picParams.vRes = 0x00480000;
+ mbPtr->picParams.srcRect.top = 0;
+ mbPtr->picParams.srcRect.left = 0;
+ mbPtr->picParams.srcRect.bottom = height;
+ mbPtr->picParams.srcRect.right = width;
+ mbPtr->picParams.reserved1 = 0;
+ mbPtr->picParams.reserved2 = 0;
+ mbPtr->bevelButtonContent.contentType = kControlContentPictHandle;
+ mbPtr->bevelButtonContent.u.picture = OpenCPicture(&mbPtr->picParams);
+ if (!mbPtr->bevelButtonContent.u.picture) {
+ TkMacOSXDbgMsg("OpenCPicture failed");
+ }
+ tkPictureIsOpen = 1;
+
+ /*
+ * TO DO - There is one case where XCopyPlane calls CopyDeepMask,
+ * which does not get recorded in the picture. So the bitmap code
+ * will fail in that case.
+ */
+ }
+
+ if (butPtr->selectImage != NULL && (butPtr->flags & SELECTED)) {
+ Tk_RedrawImage(butPtr->selectImage, 0, 0, width, height, pixmap, 0, 0);
+ } else if (butPtr->tristateImage != NULL && (butPtr->flags & TRISTATED)) {
+ Tk_RedrawImage(butPtr->tristateImage, 0, 0, width, height, pixmap, 0,
+ 0);
+ } else if (butPtr->image != NULL) {
+ Tk_RedrawImage(butPtr->image, 0, 0, width, height, pixmap, 0, 0);
+ } else {
+ XSetClipOrigin(butPtr->display, gc, 0, 0);
+ XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, gc, 0, 0, width,
+ height, 0, 0, 1);
+ }
+
+ {
+ ClosePicture();
+ tkPictureIsOpen = 0;
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+ }
+ ChkErr(SetControlData, controlHandle, kControlButtonPart,
+ kControlBevelButtonContentTag,
+ sizeof(ControlButtonContentInfo),
+ (char *) &mbPtr->bevelButtonContent);
+
+ if (butPtr->anchor == TK_ANCHOR_N) {
+ theAlignment = kControlBevelButtonAlignTop;
+ } else if (butPtr->anchor == TK_ANCHOR_NE) {
+ theAlignment = kControlBevelButtonAlignTopRight;
+ } else if (butPtr->anchor == TK_ANCHOR_E) {
+ theAlignment = kControlBevelButtonAlignRight;
+ } else if (butPtr->anchor == TK_ANCHOR_SE) {
+ theAlignment = kControlBevelButtonAlignBottomRight;
+ } else if (butPtr->anchor == TK_ANCHOR_S) {
+ theAlignment = kControlBevelButtonAlignBottom;
+ } else if (butPtr->anchor == TK_ANCHOR_SW) {
+ theAlignment = kControlBevelButtonAlignBottomLeft;
+ } else if (butPtr->anchor == TK_ANCHOR_W) {
+ theAlignment = kControlBevelButtonAlignLeft;
+ } else if (butPtr->anchor == TK_ANCHOR_NW) {
+ theAlignment = kControlBevelButtonAlignTopLeft;
+ } else if (butPtr->anchor == TK_ANCHOR_CENTER) {
+ theAlignment = kControlBevelButtonAlignCenter;
+ }
+ ChkErr(SetControlData, controlHandle, kControlButtonPart,
+ kControlBevelButtonGraphicAlignTag,
+ sizeof(ControlButtonGraphicAlignment), (char *) &theAlignment);
+
+ if (butPtr->compound != COMPOUND_NONE) {
+ ControlButtonTextPlacement thePlacement =
+ kControlBevelButtonPlaceNormally;
+
+ if (butPtr->compound == COMPOUND_TOP) {
+ thePlacement = kControlBevelButtonPlaceBelowGraphic;
+ } else if (butPtr->compound == COMPOUND_BOTTOM) {
+ thePlacement = kControlBevelButtonPlaceAboveGraphic;
+ } else if (butPtr->compound == COMPOUND_LEFT) {
+ thePlacement = kControlBevelButtonPlaceToRightOfGraphic;
+ } else if (butPtr->compound == COMPOUND_RIGHT) {
+ thePlacement = kControlBevelButtonPlaceToLeftOfGraphic;
+ }
+ ChkErr(SetControlData, controlHandle, kControlButtonPart,
+ kControlBevelButtonTextPlaceTag,
+ sizeof(ControlButtonTextPlacement), (char *) &thePlacement);
+ }
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * SetUserPaneDrawProc --
+ *
+ * Utility function to add a UserPaneDrawProc
+ * to a userPane control. From MoreControls code
+ * from Apple DTS.
+ *
+ * Results:
+ * MacOS system error.
+ *
+ * Side effects:
+ * The user pane gets a new UserPaneDrawProc.
+ *
+ *--------------------------------------------------------------
+ */
+
+OSStatus
+SetUserPaneDrawProc(
+ ControlRef control,
+ ControlUserPaneDrawProcPtr upp)
+{
+ ControlUserPaneDrawUPP myControlUserPaneDrawUPP;
+
+ myControlUserPaneDrawUPP = NewControlUserPaneDrawUPP(upp);
+ return SetControlData(control, kControlNoPart,
+ kControlUserPaneDrawProcTag, sizeof(myControlUserPaneDrawUPP),
+ (Ptr) &myControlUserPaneDrawUPP);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * SetUserPaneSetUpSpecialBackgroundProc --
+ *
+ * Utility function to add a UserPaneBackgroundProc
+ * to a userPane control
+ *
+ * Results:
+ * MacOS system error.
+ *
+ * Side effects:
+ * The user pane gets a new UserPaneBackgroundProc.
+ *
+ *--------------------------------------------------------------
+ */
+
+OSStatus
+SetUserPaneSetUpSpecialBackgroundProc(
+ ControlRef control,
+ ControlUserPaneBackgroundProcPtr upp)
+{
+ ControlUserPaneBackgroundUPP myControlUserPaneBackgroundUPP;
+
+ myControlUserPaneBackgroundUPP = NewControlUserPaneBackgroundUPP(upp);
+ return SetControlData(control, kControlNoPart,
+ kControlUserPaneBackgroundProcTag,
+ sizeof(myControlUserPaneBackgroundUPP),
+ (Ptr) &myControlUserPaneBackgroundUPP);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * UserPaneDraw --
+ *
+ * This function draws the background of the user pane that will
+ * lie under checkboxes and radiobuttons.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The user pane gets updated to the current color.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+UserPaneDraw(
+ ControlRef control,
+ ControlPartCode cpc)
+{
+ MacButton *mbPtr = (MacButton *)(intptr_t)GetControlReference(control);
+ Rect contrlRect;
+ CGrafPtr port;
+
+ GetPort(&port);
+ GetControlBounds(control,&contrlRect);
+ TkMacOSXSetColorInPort(mbPtr->userPaneBackground, 0, NULL, port);
+ EraseRect(&contrlRect);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * UserPaneBackgroundProc --
+ *
+ * This function sets up the background of the user pane that will
+ * lie under checkboxes and radiobuttons.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The user pane background gets set to the current color.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+UserPaneBackgroundProc(
+ ControlHandle control,
+ ControlBackgroundPtr info)
+{
+ MacButton * mbPtr = (MacButton *)(intptr_t)GetControlReference(control);
+
+ if (info->colorDevice) {
+ CGrafPtr port;
+
+ GetPort(&port);
+ TkMacOSXSetColorInPort(mbPtr->userPaneBackground, 0, NULL, port);
+ }
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * UpdateControlColors --
+ *
+ * This function will review the colors used to display
+ * a Macintosh button. If any non-standard colors are
+ * used we create a custom palette for the button, populate
+ * with the colors for the button and install the palette.
+ *
+ * Under Appearance, we just set the pointer that will be
+ * used by the UserPaneDrawProc.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The Macintosh control may get a custom palette installed.
+ *
+ *--------------------------------------------------------------
+ */
+
+static int
+UpdateControlColors(
+ MacButton *mbPtr)
+{
+ XColor *xcolor;
+ TkButton *butPtr = (TkButton *) mbPtr;
+
+ /*
+ * Under Appearance we cannot change the background of the
+ * button itself. However, the color we are setting is the color
+ * of the containing userPane. This will be the color that peeks
+ * around the rounded corners of the button.
+ * We make this the highlightbackground rather than the background,
+ * because if you color the background of a frame containing a
+ * button, you usually also color the highlightbackground as well,
+ * or you will get a thin grey ring around the button.
+ */
+
+ if (butPtr->type == TYPE_BUTTON) {
+ xcolor = Tk_3DBorderColor(butPtr->highlightBorder);
+ } else {
+ xcolor = Tk_3DBorderColor(butPtr->normalBorder);
+ }
+ mbPtr->userPaneBackground = xcolor->pixel;
+
+ return false;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * ButtonEventProc --
+ *
+ * This procedure is invoked by the Tk dispatcher for various
+ * events on buttons.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * When it gets exposed, it is redisplayed.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+ButtonEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
+{
+ TkButton *buttonPtr = (TkButton *) clientData;
+ MacButton *mbPtr = (MacButton *) clientData;
+
+ if (eventPtr->type == ActivateNotify
+ || eventPtr->type == DeactivateNotify) {
+ if ((buttonPtr->tkwin == NULL) || (!Tk_IsMapped(buttonPtr->tkwin))) {
+ return;
+ }
+ if (eventPtr->type == ActivateNotify) {
+ mbPtr->flags |= ACTIVE;
+ } else {
+ mbPtr->flags &= ~ACTIVE;
+ }
+ if ((buttonPtr->flags & REDRAW_PENDING) == 0) {
+ Tcl_DoWhenIdle(TkpDisplayButton, (ClientData) buttonPtr);
+ buttonPtr->flags |= REDRAW_PENDING;
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXComputeControlParams --
+ *
+ * This procedure computes the various parameters used
+ * when creating a Carbon control (NewControl).
+ * These are determined by the various tk button parameters
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Sets the control initialisation parameters
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TkMacOSXComputeControlParams(
+ TkButton *butPtr,
+ MacControlParams *paramsPtr)
+{
+ paramsPtr->isBevel = 0;
+
+ /*
+ * Determine ProcID based on button type and dimensions.
+ */
+
+ switch (butPtr->type) {
+ case TYPE_BUTTON:
+ if ((butPtr->image == None) && (butPtr->bitmap == None)) {
+ paramsPtr->initialValue = 1;
+ paramsPtr->minValue = 0;
+ paramsPtr->maxValue = 1;
+ paramsPtr->procID = kControlPushButtonProc;
+ } else {
+ paramsPtr->initialValue = 0;
+ paramsPtr->minValue = kControlBehaviorOffsetContents |
+ kControlContentPictHandle;
+ paramsPtr->maxValue = 1;
+ if (butPtr->borderWidth <= 2) {
+ paramsPtr->procID = kControlBevelButtonSmallBevelProc;
+ } else if (butPtr->borderWidth == 3) {
+ paramsPtr->procID = kControlBevelButtonNormalBevelProc;
+ } else {
+ paramsPtr->procID = kControlBevelButtonLargeBevelProc;
+ }
+ paramsPtr->isBevel = 1;
+ }
+ break;
+ case TYPE_RADIO_BUTTON:
+ if (((butPtr->image == None) && (butPtr->bitmap == None))
+ || (butPtr->indicatorOn)) {
+ paramsPtr->initialValue = 1;
+ paramsPtr->minValue = 0;
+ paramsPtr->maxValue = MAX_VALUE;
+ paramsPtr->procID = kControlRadioButtonProc;
+ } else {
+ paramsPtr->initialValue = 0;
+ paramsPtr->minValue = kControlBehaviorOffsetContents |
+ kControlBehaviorSticky | kControlContentPictHandle;
+ paramsPtr->maxValue = MAX_VALUE;
+ if (butPtr->borderWidth <= 2) {
+ paramsPtr->procID = kControlBevelButtonSmallBevelProc;
+ } else if (butPtr->borderWidth == 3) {
+ paramsPtr->procID = kControlBevelButtonNormalBevelProc;
+ } else {
+ paramsPtr->procID = kControlBevelButtonLargeBevelProc;
+ }
+ paramsPtr->isBevel = 1;
+ }
+ break;
+ case TYPE_CHECK_BUTTON:
+ if (((butPtr->image == None) && (butPtr->bitmap == None))
+ || (butPtr->indicatorOn)) {
+ paramsPtr->initialValue = 1;
+ paramsPtr->minValue = 0;
+ paramsPtr->maxValue = MAX_VALUE;
+ paramsPtr->procID = kControlCheckBoxProc;
+ } else {
+ paramsPtr->initialValue = 0;
+ paramsPtr->minValue = kControlBehaviorOffsetContents |
+ kControlBehaviorSticky | kControlContentPictHandle;
+ paramsPtr->maxValue = MAX_VALUE;
+ if (butPtr->borderWidth <= 2) {
+ paramsPtr->procID = kControlBevelButtonSmallBevelProc;
+ } else if (butPtr->borderWidth == 3) {
+ paramsPtr->procID = kControlBevelButtonNormalBevelProc;
+ } else {
+ paramsPtr->procID = kControlBevelButtonLargeBevelProc;
+ }
+ paramsPtr->isBevel = 1;
+ }
+ break;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXComputeDrawParams --
+ *
+ * This procedure computes the various parameters used
+ * when drawing a button
+ * These are determined by the various tk button parameters
+ *
+ * Results:
+ * 1 if control will be used, 0 otherwise.
+ *
+ * Side effects:
+ * Sets the button draw parameters
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+TkMacOSXComputeDrawParams(
+ TkButton *butPtr,
+ DrawParams *dpPtr)
+{
+ dpPtr->hasImageOrBitmap = ((butPtr->image != NULL)
+ || (butPtr->bitmap != None));
+ dpPtr->offset = (butPtr->type == TYPE_BUTTON)
+ && dpPtr->hasImageOrBitmap;
+ dpPtr->border = butPtr->normalBorder;
+ if ((butPtr->state == STATE_DISABLED) && (butPtr->disabledFg != NULL)) {
+ dpPtr->gc = butPtr->disabledGC;
+ } else if (butPtr->type == TYPE_BUTTON && butPtr->state == STATE_ACTIVE) {
+ dpPtr->gc = butPtr->activeTextGC;
+ dpPtr->border = butPtr->activeBorder;
+ } else {
+ dpPtr->gc = butPtr->normalTextGC;
+ }
+
+ if ((butPtr->flags & SELECTED) && (butPtr->state != STATE_ACTIVE)
+ && (butPtr->selectBorder != NULL) && !butPtr->indicatorOn) {
+ dpPtr->border = butPtr->selectBorder;
+ }
+
+ /*
+ * Override the relief specified for the button if this is a
+ * checkbutton or radiobutton and there's no indicator.
+ * However, don't do this in the presence of Appearance, since
+ * then the bevel button will take care of the relief.
+ */
+
+ dpPtr->relief = butPtr->relief;
+
+ if ((butPtr->type >= TYPE_CHECK_BUTTON) && !butPtr->indicatorOn) {
+ if (!dpPtr->hasImageOrBitmap) {
+ dpPtr->relief = (butPtr->flags & SELECTED) ? TK_RELIEF_SUNKEN
+ : TK_RELIEF_RAISED;
+ }
+ }
+
+ /*
+ * Determine the draw type
+ */
+
+ if (butPtr->type == TYPE_LABEL) {
+ dpPtr->drawType = DRAW_LABEL;
+ } else if (butPtr->type == TYPE_BUTTON) {
+ if (!dpPtr->hasImageOrBitmap) {
+ dpPtr->drawType = DRAW_CONTROL;
+ } else if (butPtr->image != None) {
+ dpPtr->drawType = DRAW_BEVEL;
+ } else {
+ /*
+ * TO DO - The current way the we draw bitmaps (XCopyPlane)
+ * uses CopyDeepMask in this one case. The Picture recording
+ * does not record this call, and so we can't use the
+ * Appearance bevel button here. The only case that would
+ * exercise this is if you use a bitmap, with
+ * -data & -mask specified. We should probably draw the
+ * appearance button and overprint the image in this case.
+ * This just punts and draws the old-style, ugly, button.
+ */
+
+ if (dpPtr->gc->clip_mask == 0) {
+ dpPtr->drawType = DRAW_BEVEL;
+ } else {
+ TkpClipMask *clipPtr = (TkpClipMask *) dpPtr->gc->clip_mask;
+
+ if ((clipPtr->type == TKP_CLIP_PIXMAP) &&
+ (clipPtr->value.pixmap != butPtr->bitmap)) {
+ dpPtr->drawType = DRAW_CUSTOM;
+ } else {
+ dpPtr->drawType = DRAW_BEVEL;
+ }
+ }
+ }
+ } else if (butPtr->indicatorOn) {
+ dpPtr->drawType = DRAW_CONTROL;
+ } else if (dpPtr->hasImageOrBitmap) {
+ if (dpPtr->gc->clip_mask == 0) {
+ dpPtr->drawType = DRAW_BEVEL;
+ } else {
+ TkpClipMask *clipPtr = (TkpClipMask*) dpPtr->gc->clip_mask;
+
+ if ((clipPtr->type == TKP_CLIP_PIXMAP) &&
+ (clipPtr->value.pixmap != butPtr->bitmap)) {
+ dpPtr->drawType = DRAW_CUSTOM;
+ } else {
+ dpPtr->drawType = DRAW_BEVEL;
+ }
+ }
+ } else {
+ dpPtr->drawType = DRAW_CUSTOM;
+ }
+
+ if ((dpPtr->drawType == DRAW_CONTROL) || (dpPtr->drawType == DRAW_BEVEL)) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
diff --git a/macosx/tkMacOSXCarbonEvents.c b/carbon/tkMacOSXCarbonEvents.c
index 1a71cbb..1f60eaf 100644
--- a/macosx/tkMacOSXCarbonEvents.c
+++ b/carbon/tkMacOSXCarbonEvents.c
@@ -209,6 +209,8 @@ TkMacOSXInitCarbonEvents(
{kEventClassApplication, kEventAppShown},
{kEventClassApplication, kEventAppAvailableWindowBoundsChanged},
{kEventClassAppearance, kEventAppearanceScrollBarVariantChanged},
+ {kEventClassFont, kEventFontPanelClosed},
+ {kEventClassFont, kEventFontSelection},
};
carbonEventHandlerUPP = NewEventHandlerUPP(CarbonEventHandlerProc);
@@ -586,7 +588,8 @@ TkMacOSXStopTclEventLoopCarbonTimer(void)
*/
MODULE_SCOPE void
-TkMacOSXTrackingLoop(int tracking)
+TkMacOSXTrackingLoop(
+ int tracking)
{
static int previousServiceMode = TCL_SERVICE_NONE;
diff --git a/carbon/tkMacOSXClipboard.c b/carbon/tkMacOSXClipboard.c
new file mode 100644
index 0000000..07fc925
--- /dev/null
+++ b/carbon/tkMacOSXClipboard.c
@@ -0,0 +1,371 @@
+/*
+ * tkMacOSXClipboard.c --
+ *
+ * This file manages the clipboard for the Tk toolkit.
+ *
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkSelect.h"
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkSelGetSelection --
+ *
+ * Retrieve the specified selection from another process. For now, only
+ * fetching XA_STRING from CLIPBOARD is supported. Eventually other types
+ * should be allowed.
+ *
+ * Results:
+ * The return value is a standard Tcl return value. If an error occurs
+ * (such as no selection exists) then an error message is left in the
+ * interp's result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkSelGetSelection(
+ Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
+ Tk_Window tkwin, /* Window on whose behalf to retrieve the
+ * selection (determines display from which to
+ * retrieve). */
+ Atom selection, /* Selection to retrieve. */
+ Atom target, /* Desired form in which selection is to be
+ * returned. */
+ Tk_GetSelProc *proc, /* Procedure to call to process the selection,
+ * once it has been retrieved. */
+ ClientData clientData) /* Arbitrary value to pass to proc. */
+{
+ int result;
+ OSStatus err;
+ long length;
+ ScrapRef scrapRef;
+ char *buf;
+
+ if ((selection == Tk_InternAtom(tkwin, "CLIPBOARD"))
+ && (target == XA_STRING)) {
+ /*
+ * Get the scrap from the Macintosh global clipboard.
+ */
+
+ err = ChkErr(GetCurrentScrap, &scrapRef);
+ if (err != noErr) {
+ Tcl_AppendResult(interp, Tk_GetAtomName(tkwin, selection),
+ " GetCurrentScrap failed.", NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Try UNICODE first
+ */
+
+ err = ChkErr(GetScrapFlavorSize, scrapRef, kScrapFlavorTypeUnicode,
+ &length);
+ if (err == noErr && length > 0) {
+ Tcl_DString ds;
+ char *data;
+
+ buf = ckalloc(length + 2);
+ buf[length] = 0;
+ buf[length+1] = 0; /* 2-byte unicode null */
+ err = ChkErr(GetScrapFlavorData, scrapRef, kScrapFlavorTypeUnicode,
+ &length, buf);
+ if (err == noErr) {
+ Tcl_DStringInit(&ds);
+ Tcl_UniCharToUtfDString((Tcl_UniChar *) buf,
+ Tcl_UniCharLen((Tcl_UniChar *) buf), &ds);
+ for (data = Tcl_DStringValue(&ds); *data != '\0'; data++) {
+ if (*data == '\r') {
+ *data = '\n';
+ }
+ }
+ result = proc(clientData, interp, Tcl_DStringValue(&ds));
+ Tcl_DStringFree(&ds);
+ ckfree(buf);
+ return result;
+ }
+ }
+
+ err = ChkErr(GetScrapFlavorSize, scrapRef, 'TEXT', &length);
+ if (err != noErr) {
+ Tcl_AppendResult(interp, Tk_GetAtomName(tkwin, selection),
+ " GetScrapFlavorSize failed.", NULL);
+ return TCL_ERROR;
+ }
+ if (length > 0) {
+ Tcl_DString encodedText;
+ char *data;
+
+ buf = ckalloc(length + 1);
+ buf[length] = 0;
+ err = ChkErr(GetScrapFlavorData, scrapRef, 'TEXT', &length, buf);
+ if (err != noErr) {
+ Tcl_AppendResult(interp, Tk_GetAtomName(tkwin, selection),
+ " GetScrapFlavorData failed.", NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Tcl expects '\n' not '\r' as the line break character.
+ */
+
+ for (data = buf; *data != '\0'; data++) {
+ if (*data == '\r') {
+ *data = '\n';
+ }
+ }
+
+ Tcl_ExternalToUtfDString(TkMacOSXCarbonEncoding, buf, length,
+ &encodedText);
+ result = proc(clientData, interp, Tcl_DStringValue(&encodedText));
+ Tcl_DStringFree(&encodedText);
+
+ ckfree(buf);
+ return result;
+ }
+ }
+
+ Tcl_AppendResult(interp, Tk_GetAtomName(tkwin, selection),
+ " selection doesn't exist or form \"",
+ Tk_GetAtomName(tkwin, target), "\" not defined", NULL);
+ return TCL_ERROR;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkSetSelectionOwner --
+ *
+ * This function claims ownership of the specified selection. If the
+ * selection is CLIPBOARD, then we empty the system clipboard.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XSetSelectionOwner(
+ Display *display, /* X Display. */
+ Atom selection, /* What selection to own. */
+ Window owner, /* Window to be the owner. */
+ Time time) /* The current time? */
+{
+ Tk_Window tkwin;
+ TkDisplay *dispPtr;
+
+ /*
+ * This is a gross hack because the Tk_InternAtom interface is broken. It
+ * expects a Tk_Window, even though it only needs a Tk_Display.
+ */
+
+ tkwin = (Tk_Window) TkGetMainInfoList()->winPtr;
+
+ if (selection == Tk_InternAtom(tkwin, "CLIPBOARD")) {
+ /*
+ * Only claim and empty the clipboard if we aren't already the owner
+ * of the clipboard.
+ */
+
+ dispPtr = TkGetMainInfoList()->winPtr->dispPtr;
+ if (dispPtr->clipboardActive) {
+ return;
+ }
+ ClearCurrentScrap();
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkSelUpdateClipboard --
+ *
+ * This function is called to force the clipboard to be updated after new
+ * data is added. On the Mac we don't need to do anything.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkSelUpdateClipboard(
+ TkWindow *winPtr, /* Window associated with clipboard. */
+ TkClipboardTarget *targetPtr)
+ /* Info about the content. */
+{
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkSelEventProc --
+ *
+ * This procedure is invoked whenever a selection-related event occurs.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Lots: depends on the type of event.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+TkSelEventProc(
+ Tk_Window tkwin, /* Window for which event was targeted. */
+ register XEvent *eventPtr) /* X event: either SelectionClear,
+ * SelectionRequest, or SelectionNotify. */
+{
+ if (eventPtr->type == SelectionClear) {
+ TkSelClearSelection(tkwin, eventPtr);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkSelPropProc --
+ *
+ * This procedure is invoked when property-change events occur on windows
+ * not known to the toolkit. This is a stub function under Windows.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkSelPropProc(
+ register XEvent *eventPtr) /* X PropertyChange event. */
+{
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkSuspendClipboard --
+ *
+ * Handle clipboard conversion as required by the suppend event. This
+ * function is also called on exit.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The local scrap is moved to the global scrap.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkSuspendClipboard(void)
+{
+ TkClipboardTarget *targetPtr;
+ TkClipboardBuffer *cbPtr;
+ TkDisplay *dispPtr;
+ char *buffer, *p, *endPtr, *buffPtr;
+ long length;
+ ScrapRef scrapRef;
+
+ dispPtr = TkGetDisplayList();
+ if ((dispPtr == NULL) || !dispPtr->clipboardActive) {
+ return;
+ }
+
+ for (targetPtr = dispPtr->clipTargetPtr; targetPtr != NULL;
+ targetPtr = targetPtr->nextPtr) {
+ if (targetPtr->type == XA_STRING) {
+ break;
+ }
+ }
+ if (targetPtr != NULL) {
+ Tcl_DString encodedText, unicodedText;
+
+ length = 0;
+ for (cbPtr = targetPtr->firstBufferPtr; cbPtr != NULL;
+ cbPtr = cbPtr->nextPtr) {
+ length += cbPtr->length;
+ }
+
+ buffer = ckalloc(length);
+ buffPtr = buffer;
+ for (cbPtr = targetPtr->firstBufferPtr; cbPtr != NULL;
+ cbPtr = cbPtr->nextPtr) {
+ for (p = cbPtr->buffer, endPtr = p + cbPtr->length;
+ p < endPtr; p++) {
+ if (*p == '\n') {
+ *buffPtr++ = '\r';
+ } else {
+ *buffPtr++ = *p;
+ }
+ }
+ }
+
+ ClearCurrentScrap();
+ GetCurrentScrap(&scrapRef);
+ Tcl_UtfToExternalDString(TkMacOSXCarbonEncoding, buffer, length,
+ &encodedText);
+ PutScrapFlavor(scrapRef, 'TEXT', 0, Tcl_DStringLength(&encodedText),
+ Tcl_DStringValue(&encodedText));
+ Tcl_DStringFree(&encodedText);
+
+ /*
+ * Also put unicode data on scrap.
+ */
+
+ Tcl_DStringInit(&unicodedText);
+ Tcl_UtfToUniCharDString(buffer, length, &unicodedText);
+ PutScrapFlavor(scrapRef, kScrapFlavorTypeUnicode, 0,
+ Tcl_DStringLength(&unicodedText),
+ Tcl_DStringValue(&unicodedText));
+ Tcl_DStringFree(&unicodedText);
+
+ ckfree(buffer);
+ }
+
+ /*
+ * The system now owns the scrap. We tell Tk that it has lost the
+ * selection so that it will look for it the next time it needs it.
+ * (Window list NULL if quiting.)
+ */
+
+ if (TkGetMainInfoList() != NULL) {
+ Tk_ClearSelection((Tk_Window) TkGetMainInfoList()->winPtr,
+ Tk_InternAtom((Tk_Window) TkGetMainInfoList()->winPtr,
+ "CLIPBOARD"));
+ }
+
+ return;
+}
+
+/*
+ * Local Variables:
+ * fill-column: 78
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/carbon/tkMacOSXColor.c b/carbon/tkMacOSXColor.c
new file mode 100644
index 0000000..2c9100d
--- /dev/null
+++ b/carbon/tkMacOSXColor.c
@@ -0,0 +1,736 @@
+/*
+ * tkMacOSXColor.c --
+ *
+ * This file maintains a database of color values for the Tk
+ * toolkit, in order to avoid round-trips to the server to
+ * map color names to pixel values.
+ *
+ * Copyright (c) 1990-1994 The Regents of the University of California.
+ * Copyright (c) 1994-1996 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkColor.h"
+
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
+/* Undocumented CG API for creating CGPattern from CGImage */
+extern CGPatternRef CGPatternCreateWithImage(CGImageRef img, int i) WEAK_IMPORT_ATTRIBUTE;
+#endif
+
+struct SystemColorMapEntry {
+ const char *name;
+ ThemeBrush brush;
+ ThemeTextColor textColor;
+ ThemeBackgroundKind background;
+}; /* unsigned char pixelCode; */
+
+/*
+ * Array of system color definitions: the array index is required to equal the
+ * color's (pixelCode - MIN_PIXELCODE), i.e. the array order needs to be kept
+ * in sync with the public pixel code values in tkMacOSXPort.h !
+ */
+
+#define MIN_PIXELCODE 30
+static const struct SystemColorMapEntry systemColorMap[] = {
+ { "Transparent", 0, 0, 0 }, /* 30: TRANSPARENT_PIXEL */
+ { "Highlight", kThemeBrushPrimaryHighlightColor, 0, 0 }, /* 31: HIGHLIGHT_PIXEL */
+ { "HighlightSecondary", kThemeBrushSecondaryHighlightColor, 0, 0 }, /* 32: HIGHLIGHT_SECONDARY_PIXEL */
+ { "HighlightText", kThemeBrushBlack, 0, 0 }, /* 33: HIGHLIGHT_TEXT_PIXEL */
+ { "HighlightAlternate", kThemeBrushAlternatePrimaryHighlightColor, 0, 0 }, /* 34: HIGHLIGHT_ALTERNATE_PIXEL */
+ { "ButtonText", 0, kThemeTextColorPushButtonActive, 0 }, /* 35: CONTROL_TEXT_PIXEL */
+ { "PrimaryHighlightColor", kThemeBrushPrimaryHighlightColor, 0, 0 }, /* 36 */
+ { "ButtonFace", kThemeBrushButtonFaceActive, 0, 0 }, /* 37: CONTROL_BODY_PIXEL */
+ { "SecondaryHighlightColor", kThemeBrushSecondaryHighlightColor, 0, 0 }, /* 38 */
+ { "ButtonFrame", kThemeBrushButtonFrameActive, 0, 0 }, /* 39: CONTROL_FRAME_PIXEL */
+ { "AlternatePrimaryHighlightColor", kThemeBrushAlternatePrimaryHighlightColor, 0, 0 }, /* 40 */
+ { "WindowBody", kThemeBrushDocumentWindowBackground, 0, 0 }, /* 41: WINDOW_BODY_PIXEL */
+ { "SheetBackground", kThemeBrushSheetBackground, 0, 0 }, /* 42 */
+ { "MenuActive", kThemeBrushMenuBackgroundSelected, 0, 0 }, /* 43: MENU_ACTIVE_PIXEL */
+ { "Black", kThemeBrushBlack, 0, 0 }, /* 44 */
+ { "MenuActiveText", 0, kThemeTextColorMenuItemSelected, 0 }, /* 45: MENU_ACTIVE_TEXT_PIXEL */
+ { "White", kThemeBrushWhite, 0, 0 }, /* 46 */
+ { "Menu", kThemeBrushMenuBackground, 0, 0 }, /* 47: MENU_BACKGROUND_PIXEL */
+ { "DialogBackgroundActive", kThemeBrushDialogBackgroundActive, 0, 0 }, /* 48 */
+ { "MenuDisabled", 0, kThemeTextColorMenuItemDisabled, 0 }, /* 49: MENU_DISABLED_PIXEL */
+ { "DialogBackgroundInactive", kThemeBrushDialogBackgroundInactive, 0, 0 }, /* 50 */
+ { "MenuText", 0, kThemeTextColorMenuItemActive, 0 }, /* 51: MENU_TEXT_PIXEL */
+ { "AppearanceColor", 0, 0, 0 }, /* 52: APPEARANCE_PIXEL */
+ { "AlertBackgroundActive", kThemeBrushAlertBackgroundActive, 0, 0 }, /* 53 */
+ { "AlertBackgroundInactive", kThemeBrushAlertBackgroundInactive, 0, 0 }, /* 54 */
+ { "ModelessDialogBackgroundActive", kThemeBrushModelessDialogBackgroundActive, 0, 0 }, /* 55 */
+ { "ModelessDialogBackgroundInactive", kThemeBrushModelessDialogBackgroundInactive, 0, 0 }, /* 56 */
+ { "UtilityWindowBackgroundActive", kThemeBrushUtilityWindowBackgroundActive, 0, 0 }, /* 57 */
+ { "UtilityWindowBackgroundInactive", kThemeBrushUtilityWindowBackgroundInactive, 0, 0 }, /* 58 */
+ { "ListViewSortColumnBackground", kThemeBrushListViewSortColumnBackground, 0, 0 }, /* 59 */
+ { "ListViewBackground", kThemeBrushListViewBackground, 0, 0 }, /* 60 */
+ { "IconLabelBackground", kThemeBrushIconLabelBackground, 0, 0 }, /* 61 */
+ { "ListViewSeparator", kThemeBrushListViewSeparator, 0, 0 }, /* 62 */
+ { "ChasingArrows", kThemeBrushChasingArrows, 0, 0 }, /* 63 */
+ { "DragHilite", kThemeBrushDragHilite, 0, 0 }, /* 64 */
+ { "DocumentWindowBackground", kThemeBrushDocumentWindowBackground, 0, 0 }, /* 65 */
+ { "FinderWindowBackground", kThemeBrushFinderWindowBackground, 0, 0 }, /* 66 */
+ { "ScrollBarDelimiterActive", kThemeBrushScrollBarDelimiterActive, 0, 0 }, /* 67 */
+ { "ScrollBarDelimiterInactive", kThemeBrushScrollBarDelimiterInactive, 0, 0 }, /* 68 */
+ { "FocusHighlight", kThemeBrushFocusHighlight, 0, 0 }, /* 69 */
+ { "PopupArrowActive", kThemeBrushPopupArrowActive, 0, 0 }, /* 70 */
+ { "PopupArrowPressed", kThemeBrushPopupArrowPressed, 0, 0 }, /* 71 */
+ { "PopupArrowInactive", kThemeBrushPopupArrowInactive, 0, 0 }, /* 72 */
+ { "AppleGuideCoachmark", kThemeBrushAppleGuideCoachmark, 0, 0 }, /* 73 */
+ { "IconLabelBackgroundSelected", kThemeBrushIconLabelBackgroundSelected, 0, 0 }, /* 74 */
+ { "StaticAreaFill", kThemeBrushStaticAreaFill, 0, 0 }, /* 75 */
+ { "ActiveAreaFill", kThemeBrushActiveAreaFill, 0, 0 }, /* 76 */
+ { "ButtonFrameActive", kThemeBrushButtonFrameActive, 0, 0 }, /* 77 */
+ { "ButtonFrameInactive", kThemeBrushButtonFrameInactive, 0, 0 }, /* 78 */
+ { "ButtonFaceActive", kThemeBrushButtonFaceActive, 0, 0 }, /* 79 */
+ { "ButtonFaceInactive", kThemeBrushButtonFaceInactive, 0, 0 }, /* 80 */
+ { "ButtonFacePressed", kThemeBrushButtonFacePressed, 0, 0 }, /* 81 */
+ { "ButtonActiveDarkShadow", kThemeBrushButtonActiveDarkShadow, 0, 0 }, /* 82 */
+ { "ButtonActiveDarkHighlight", kThemeBrushButtonActiveDarkHighlight, 0, 0 }, /* 83 */
+ { "ButtonActiveLightShadow", kThemeBrushButtonActiveLightShadow, 0, 0 }, /* 84 */
+ { "ButtonActiveLightHighlight", kThemeBrushButtonActiveLightHighlight, 0, 0 }, /* 85 */
+ { "ButtonInactiveDarkShadow", kThemeBrushButtonInactiveDarkShadow, 0, 0 }, /* 86 */
+ { "ButtonInactiveDarkHighlight", kThemeBrushButtonInactiveDarkHighlight, 0, 0 }, /* 87 */
+ { "ButtonInactiveLightShadow", kThemeBrushButtonInactiveLightShadow, 0, 0 }, /* 88 */
+ { "ButtonInactiveLightHighlight", kThemeBrushButtonInactiveLightHighlight, 0, 0 }, /* 89 */
+ { "ButtonPressedDarkShadow", kThemeBrushButtonPressedDarkShadow, 0, 0 }, /* 90 */
+ { "ButtonPressedDarkHighlight", kThemeBrushButtonPressedDarkHighlight, 0, 0 }, /* 91 */
+ { "ButtonPressedLightShadow", kThemeBrushButtonPressedLightShadow, 0, 0 }, /* 92 */
+ { "ButtonPressedLightHighlight", kThemeBrushButtonPressedLightHighlight, 0, 0 }, /* 93 */
+ { "BevelActiveLight", kThemeBrushBevelActiveLight, 0, 0 }, /* 94 */
+ { "BevelActiveDark", kThemeBrushBevelActiveDark, 0, 0 }, /* 95 */
+ { "BevelInactiveLight", kThemeBrushBevelInactiveLight, 0, 0 }, /* 96 */
+ { "BevelInactiveDark", kThemeBrushBevelInactiveDark, 0, 0 }, /* 97 */
+ { "NotificationWindowBackground", kThemeBrushNotificationWindowBackground, 0, 0 }, /* 98 */
+ { "MovableModalBackground", kThemeBrushMovableModalBackground, 0, 0 }, /* 99 */
+ { "SheetBackgroundOpaque", kThemeBrushSheetBackgroundOpaque, 0, 0 }, /* 100 */
+ { "DrawerBackground", kThemeBrushDrawerBackground, 0, 0 }, /* 101 */
+ { "ToolbarBackground", kThemeBrushToolbarBackground, 0, 0 }, /* 102 */
+ { "SheetBackgroundTransparent", kThemeBrushSheetBackgroundTransparent, 0, 0 }, /* 103 */
+ { "MenuBackground", kThemeBrushMenuBackground, 0, 0 }, /* 104 */
+ { "Pixel", 0, 0, 0 }, /* 105: PIXEL_MAGIC */
+ { "MenuBackgroundSelected", kThemeBrushMenuBackgroundSelected, 0, 0 }, /* 106 */
+ { "ListViewOddRowBackground", kThemeBrushListViewOddRowBackground, 0, 0 }, /* 107 */
+ { "ListViewEvenRowBackground", kThemeBrushListViewEvenRowBackground, 0, 0 }, /* 108 */
+ { "ListViewColumnDivider", kThemeBrushListViewColumnDivider, 0, 0 }, /* 109 */
+ { "BlackText", 0, kThemeTextColorBlack, 0 }, /* 110 */
+ { "DialogActiveText", 0, kThemeTextColorDialogActive, 0 }, /* 111 */
+ { "DialogInactiveText", 0, kThemeTextColorDialogInactive, 0 }, /* 112 */
+ { "AlertActiveText", 0, kThemeTextColorAlertActive, 0 }, /* 113 */
+ { "AlertInactiveText", 0, kThemeTextColorAlertInactive, 0 }, /* 114 */
+ { "ModelessDialogActiveText", 0, kThemeTextColorModelessDialogActive, 0 }, /* 115 */
+ { "ModelessDialogInactiveText", 0, kThemeTextColorModelessDialogInactive, 0 }, /* 116 */
+ { "WindowHeaderActiveText", 0, kThemeTextColorWindowHeaderActive, 0 }, /* 117 */
+ { "WindowHeaderInactiveText", 0, kThemeTextColorWindowHeaderInactive, 0 }, /* 118 */
+ { "PlacardActiveText", 0, kThemeTextColorPlacardActive, 0 }, /* 119 */
+ { "PlacardInactiveText", 0, kThemeTextColorPlacardInactive, 0 }, /* 120 */
+ { "PlacardPressedText", 0, kThemeTextColorPlacardPressed, 0 }, /* 121 */
+ { "PushButtonActiveText", 0, kThemeTextColorPushButtonActive, 0 }, /* 122 */
+ { "PushButtonInactiveText", 0, kThemeTextColorPushButtonInactive, 0 }, /* 123 */
+ { "PushButtonPressedText", 0, kThemeTextColorPushButtonPressed, 0 }, /* 124 */
+ { "BevelButtonActiveText", 0, kThemeTextColorBevelButtonActive, 0 }, /* 125 */
+ { "BevelButtonInactiveText", 0, kThemeTextColorBevelButtonInactive, 0 }, /* 126 */
+ { "BevelButtonPressedText", 0, kThemeTextColorBevelButtonPressed, 0 }, /* 127 */
+ { "PopupButtonActiveText", 0, kThemeTextColorPopupButtonActive, 0 }, /* 128 */
+ { "PopupButtonInactiveText", 0, kThemeTextColorPopupButtonInactive, 0 }, /* 129 */
+ { "PopupButtonPressedText", 0, kThemeTextColorPopupButtonPressed, 0 }, /* 130 */
+ { "IconLabelText", 0, kThemeTextColorIconLabel, 0 }, /* 131 */
+ { "ListViewText", 0, kThemeTextColorListView, 0 }, /* 132 */
+ { "DocumentWindowTitleActiveText", 0, kThemeTextColorDocumentWindowTitleActive, 0 }, /* 133 */
+ { "DocumentWindowTitleInactiveText", 0, kThemeTextColorDocumentWindowTitleInactive, 0 }, /* 134 */
+ { "MovableModalWindowTitleActiveText", 0, kThemeTextColorMovableModalWindowTitleActive, 0 }, /* 135 */
+ { "MovableModalWindowTitleInactiveText",0, kThemeTextColorMovableModalWindowTitleInactive, 0 }, /* 136 */
+ { "UtilityWindowTitleActiveText", 0, kThemeTextColorUtilityWindowTitleActive, 0 }, /* 137 */
+ { "UtilityWindowTitleInactiveText", 0, kThemeTextColorUtilityWindowTitleInactive, 0 }, /* 138 */
+ { "PopupWindowTitleActiveText", 0, kThemeTextColorPopupWindowTitleActive, 0 }, /* 139 */
+ { "PopupWindowTitleInactiveText", 0, kThemeTextColorPopupWindowTitleInactive, 0 }, /* 140 */
+ { "RootMenuActiveText", 0, kThemeTextColorRootMenuActive, 0 }, /* 141 */
+ { "RootMenuSelectedText", 0, kThemeTextColorRootMenuSelected, 0 }, /* 142 */
+ { "RootMenuDisabledText", 0, kThemeTextColorRootMenuDisabled, 0 }, /* 143 */
+ { "MenuItemActiveText", 0, kThemeTextColorMenuItemActive, 0 }, /* 144 */
+ { "MenuItemSelectedText", 0, kThemeTextColorMenuItemSelected, 0 }, /* 145 */
+ { "MenuItemDisabledText", 0, kThemeTextColorMenuItemDisabled, 0 }, /* 146 */
+ { "PopupLabelActiveText", 0, kThemeTextColorPopupLabelActive, 0 }, /* 147 */
+ { "PopupLabelInactiveText", 0, kThemeTextColorPopupLabelInactive, 0 }, /* 148 */
+ { "TabFrontActiveText", 0, kThemeTextColorTabFrontActive, 0 }, /* 149 */
+ { "TabNonFrontActiveText", 0, kThemeTextColorTabNonFrontActive, 0 }, /* 150 */
+ { "TabNonFrontPressedText", 0, kThemeTextColorTabNonFrontPressed, 0 }, /* 151 */
+ { "TabFrontInactiveText", 0, kThemeTextColorTabFrontInactive, 0 }, /* 152 */
+ { "TabNonFrontInactiveText", 0, kThemeTextColorTabNonFrontInactive, 0 }, /* 153 */
+ { "IconLabelSelectedText", 0, kThemeTextColorIconLabelSelected, 0 }, /* 154 */
+ { "BevelButtonStickyActiveText", 0, kThemeTextColorBevelButtonStickyActive, 0 }, /* 155 */
+ { "BevelButtonStickyInactiveText", 0, kThemeTextColorBevelButtonStickyInactive, 0 }, /* 156 */
+ { "NotificationText", 0, kThemeTextColorNotification, 0 }, /* 157 */
+ { "SystemDetailText", 0, kThemeTextColorSystemDetail, 0 }, /* 158 */
+ { "WhiteText", 0, kThemeTextColorWhite, 0 }, /* 159 */
+ { "TabPaneBackground", 0, 0, kThemeBackgroundTabPane }, /* 160 */
+ { "PlacardBackground", 0, 0, kThemeBackgroundPlacard }, /* 161 */
+ { "WindowHeaderBackground", 0, 0, kThemeBackgroundWindowHeader }, /* 162 */
+ { "ListViewWindowHeaderBackground", 0, 0, kThemeBackgroundListViewWindowHeader }, /* 163 */
+ { "SecondaryGroupBoxBackground", 0, 0, kThemeBackgroundSecondaryGroupBox }, /* 164 */
+ { "MetalBackground", 0, 0, kThemeBackgroundMetal }, /* 165 */
+ { NULL, 0, 0, 0 }
+};
+#define MAX_PIXELCODE 165
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetThemeFromPixelCode --
+ *
+ * When given a pixel code corresponding to a theme system color,
+ * set one of brush, textColor or background to the corresponding
+ * Appearance Mgr theme constant.
+ *
+ * Results:
+ * Returns false if not a real pixel, true otherwise.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GetThemeFromPixelCode(
+ unsigned char code,
+ ThemeBrush *brush,
+ ThemeTextColor *textColor,
+ ThemeBackgroundKind *background)
+{
+ if (code >= MIN_PIXELCODE && code <= MAX_PIXELCODE && code != PIXEL_MAGIC) {
+ *brush = systemColorMap[code - MIN_PIXELCODE].brush;
+ *textColor = systemColorMap[code - MIN_PIXELCODE].textColor;
+ *background = systemColorMap[code - MIN_PIXELCODE].background;
+ } else {
+ *brush = 0;
+ *textColor = 0;
+ *background = 0;
+ }
+ if (!*brush && !*textColor && !*background && code != PIXEL_MAGIC) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetThemeColor --
+ *
+ * Get RGB color for a given system color or pixel value.
+ *
+ * Results:
+ * OSStatus
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static OSStatus
+GetThemeColor(
+ unsigned long pixel,
+ ThemeBrush brush,
+ ThemeTextColor textColor,
+ ThemeBackgroundKind background,
+ RGBColor *c)
+{
+ OSStatus err = noErr;
+
+ if (brush) {
+ err = ChkErr(GetThemeBrushAsColor,
+ brush == kThemeBrushMenuBackgroundSelected ?
+ kThemeBrushFocusHighlight : brush, 32, true, c);
+ } else if (textColor) {
+ err = ChkErr(GetThemeTextColor, textColor, 32, true, c);
+ } else {
+ c->red = (pixel >> 16) & 0xff;
+ c->green = (pixel >> 8) & 0xff;
+ c->blue = (pixel ) & 0xff;
+ c->red |= c->red << 8;
+ c->green |= c->green << 8;
+ c->blue |= c->blue << 8;
+ }
+ return err;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkSetMacColor --
+ *
+ * Populates a Macintosh RGBColor structure from a X style
+ * pixel value.
+ *
+ * Results:
+ * Returns false if not a real pixel, true otherwise.
+ *
+ * Side effects:
+ * The variable macColor is updated to the pixels value.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkSetMacColor(
+ unsigned long pixel, /* Pixel value to convert. */
+ void *macColor) /* Mac color struct to modify. */
+{
+ OSStatus err = -1;
+ ThemeBrush brush;
+ ThemeTextColor textColor;
+ ThemeBackgroundKind background;
+
+ if (GetThemeFromPixelCode((pixel >> 24) & 0xff, &brush, &textColor,
+ &background)) {
+ err = ChkErr(GetThemeColor, pixel, brush, textColor, background,
+ macColor);
+ }
+ return (err == noErr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXSetColorInPort --
+ *
+ * Sets fore or back color in the given QD port from an X pixel
+ * value, and if the pixel code indicates a system color, sets
+ * the corresponding brush, textColor or background via
+ * Appearance mgr APIs.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * If penPat is non-NULL it is set to the forground color/pattern.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXSetColorInPort(
+ unsigned long pixel,
+ int fg,
+ PixPatHandle penPat,
+ CGrafPtr port)
+{
+ OSStatus err;
+ RGBColor c;
+ ThemeBrush brush;
+ ThemeTextColor textColor;
+ ThemeBackgroundKind background;
+ int setPenPat = 0;
+
+ if (GetThemeFromPixelCode((pixel >> 24) & 0xff, &brush, &textColor,
+ &background)) {
+ CGrafPtr savePort;
+ Boolean portChanged;
+
+ portChanged = QDSwapPort(port, &savePort);
+ err = ChkErr(GetThemeColor, pixel, brush, textColor, background, &c);
+ if (err == noErr) {
+ if (fg) {
+ RGBForeColor(&c);
+ if (penPat) {
+ MakeRGBPat(penPat, &c);
+ setPenPat = 1;
+ }
+ } else {
+ RGBBackColor(&c);
+ }
+ }
+ err = -1;
+ if (brush) {
+ err = ChkErr(SetThemeBackground,
+ brush == kThemeBrushMenuBackgroundSelected ?
+ kThemeBrushFocusHighlight : brush, 32, true);
+ } else if (textColor && fg) {
+ err = ChkErr(SetThemeTextColor, textColor, 32, true);
+ } else if (background) {
+ Rect bounds;
+
+ GetPortBounds(port, &bounds);
+ err = ChkErr(ApplyThemeBackground, background, &bounds,
+ kThemeStateActive, 32, true);
+ }
+ if (penPat && err == noErr && (brush || background)) {
+ GetPortBackPixPat(port, penPat);
+ setPenPat = 1;
+ }
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+ } else {
+ TkMacOSXDbgMsg("Ignored unknown pixel value 0x%lx", pixel);
+ }
+ if (penPat && !setPenPat) {
+ GetPortBackPixPat(port, penPat);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXSetColorInContext --
+ *
+ * Sets fill and stroke color in the given CG context from an X
+ * pixel value, or if the pixel code indicates a system color,
+ * sets the corresponding brush, textColor or background via
+ * HITheme APIs if available or Appearance mgr APIs.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXSetColorInContext(
+ unsigned long pixel,
+ CGContextRef context)
+{
+ OSStatus err = -1;
+ RGBColor c;
+ ThemeBrush brush;
+ ThemeTextColor textColor;
+ ThemeBackgroundKind background;
+
+ if (GetThemeFromPixelCode((pixel >> 24) & 0xff, &brush, &textColor,
+ &background)) {
+ if (brush) {
+ TK_IF_MAC_OS_X_API (4, HIThemeSetFill,
+ err = ChkErr(HIThemeSetFill, brush, NULL, context,
+ kHIThemeOrientationNormal);
+ TK_IF_MAC_OS_X_API_COND (4, HIThemeSetFill, err == noErr,
+ err = ChkErr(HIThemeSetStroke, brush, NULL, context,
+ kHIThemeOrientationNormal);
+ ) TK_ENDIF
+ ) TK_ENDIF
+ } else if (textColor) {
+ TK_IF_MAC_OS_X_API (4, HIThemeSetTextFill,
+ err = ChkErr(HIThemeSetTextFill, textColor, NULL, context,
+ kHIThemeOrientationNormal);
+ ) TK_ENDIF
+ } else if (background) {
+ TK_IF_MAC_OS_X_API (3, CGContextGetClipBoundingBox,
+ CGRect rect = CGContextGetClipBoundingBox(context);
+ HIThemeBackgroundDrawInfo info = { 0, kThemeStateActive,
+ background };
+
+ TK_IF_MAC_OS_X_API (3, HIThemeApplyBackground,
+ TK_IF_HI_TOOLBOX (3, /* c.f. QA1377 */
+ err = ChkErr(HIThemeApplyBackground, &rect, &info,
+ context, kHIThemeOrientationNormal);
+ ) TK_ENDIF
+ ) TK_ENDIF
+ ) TK_ENDIF
+ }
+ if (err == noErr) {
+ return;
+ }
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
+ /*
+ * Convert Appearance theme pattern to CGPattern:
+ */
+ if ((brush || background) && CGPatternCreateWithImage != NULL) {
+ static PixPatHandle pixpat = NULL;
+ static GWorldPtr patGWorld = NULL;
+ static uint32_t bitmapInfo = 0;
+ const short patDim = 16;
+ const Rect bounds = {0, 0, patDim, patDim};
+ CGrafPtr savePort;
+ Boolean portChanged;
+ PixMapHandle pixmap;
+ long rowbytes;
+ CGImageRef img;
+ CGColorSpaceRef rgbCspace;
+ CGDataProviderRef provider;
+
+ if (!pixpat) {
+ pixpat = NewPixPat();
+ err = ChkErr(NewGWorld, &patGWorld, 32, &bounds, NULL, NULL, 0
+#ifdef __LITTLE_ENDIAN__
+ | kNativeEndianPixMap
+#endif
+ );
+ if (!pixpat || err != noErr || !patGWorld) {
+ Tcl_Panic("TkMacOSXSetColorInContext(): "
+ "pattern initialization failed !");
+ }
+ TK_IF_HI_TOOLBOX (4,
+ bitmapInfo = kCGBitmapByteOrder32Host;
+ ) TK_ENDIF
+ }
+ portChanged = QDSwapPort(patGWorld, &savePort);
+ TkMacOSXSetColorInPort(pixel, 1, pixpat, patGWorld);
+#ifdef TK_MAC_DEBUG
+ Rect patBounds;
+ GetPixBounds((**pixpat).patMap, &patBounds);
+ if (patBounds.right > patDim || patBounds.bottom > patDim) {
+ Tcl_Panic("TkMacOSXSetColorInContext(): "
+ "pattern larger than expected !");
+ }
+#endif /* TK_MAC_DEBUG */
+ FillCRect(&bounds, pixpat);
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+ pixmap = GetPortPixMap(patGWorld);
+ rowbytes = GetPixRowBytes(pixmap);
+ provider = CGDataProviderCreateWithData(&patGWorld,
+ GetPixBaseAddr(pixmap), rowbytes * patDim, NULL);
+ rgbCspace = CGColorSpaceCreateDeviceRGB();
+ img = CGImageCreate(patDim, patDim, 8, 32,
+ rowbytes, rgbCspace, kCGImageAlphaFirst | bitmapInfo,
+ provider, NULL, 0, kCGRenderingIntentDefault);
+ CGColorSpaceRelease(rgbCspace);
+ CGDataProviderRelease(provider);
+ if (img) {
+ CGPatternRef pat = CGPatternCreateWithImage(img, 2);
+ CGColorSpaceRef patCSpace = CGColorSpaceCreatePattern(NULL);
+ const float alpha = 1;
+
+ CGContextSetFillColorSpace(context, patCSpace);
+ CGContextSetFillPattern(context, pat, &alpha);
+ CGContextSetStrokeColorSpace(context, patCSpace);
+ CGContextSetStrokePattern(context, pat, &alpha);
+ CGColorSpaceRelease(patCSpace);
+ CGPatternRelease(pat);
+ CGImageRelease(img);
+ return;
+ }
+ }
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1040 */
+ err = ChkErr(GetThemeColor, pixel, brush, textColor, background, &c);
+ if (err == noErr) {
+ double r = c.red / 65535.0;
+ double g = c.green / 65535.0;
+ double b = c.blue / 65535.0;
+
+ CGContextSetRGBFillColor(context, r, g, b, 1.0);
+ CGContextSetRGBStrokeColor(context, r, g, b, 1.0);
+ }
+ } else if (((pixel >> 24) & 0xff) == TRANSPARENT_PIXEL) {
+ CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 0.0);
+ CGContextSetRGBStrokeColor(context, 0.0, 0.0, 0.0, 0.0);
+ } else {
+ TkMacOSXDbgMsg("Ignored unknown pixel value 0x%lx", pixel);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetColor --
+ *
+ * Allocate a new TkColor for the color with the given name.
+ *
+ * Results:
+ * Returns a newly allocated TkColor, or NULL on failure.
+ *
+ * Side effects:
+ * May invalidate the colormap cache associated with tkwin upon
+ * allocating a new colormap entry. Allocates a new TkColor
+ * structure.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkColor *
+TkpGetColor(
+ Tk_Window tkwin, /* Window in which color will be used. */
+ Tk_Uid name) /* Name of color to allocated (in form
+ * suitable for passing to XParseColor). */
+{
+ Display *display = Tk_Display(tkwin);
+ Colormap colormap = Tk_Colormap(tkwin);
+ TkColor *tkColPtr;
+ XColor color;
+
+ /*
+ * Check to see if this is a system color. Otherwise, XParseColor
+ * will do all the work.
+ */
+ if (strncasecmp(name, "system", 6) == 0) {
+ Tcl_Obj *strPtr = Tcl_NewStringObj(name+6, -1);
+ int idx, result;
+
+ result = Tcl_GetIndexFromObjStruct(NULL, strPtr, systemColorMap,
+ sizeof(struct SystemColorMapEntry), NULL, TCL_EXACT, &idx);
+ Tcl_DecrRefCount(strPtr);
+ if (result == TCL_OK) {
+ OSStatus err;
+ RGBColor c;
+ unsigned char pixelCode = idx + MIN_PIXELCODE;
+ ThemeBrush brush = systemColorMap[idx].brush;
+ ThemeTextColor textColor = systemColorMap[idx].textColor;
+ ThemeBackgroundKind background = systemColorMap[idx].background;
+
+ err = ChkErr(GetThemeColor, 0, brush, textColor, background, &c);
+ if (err == noErr) {
+ color.red = c.red;
+ color.green = c.green;
+ color.blue = c.blue;
+ color.pixel = ((((((pixelCode << 8)
+ | ((color.red >> 8) & 0xff)) << 8)
+ | ((color.green >> 8) & 0xff)) << 8)
+ | ((color.blue >> 8) & 0xff));
+ goto validXColor;
+ }
+ }
+ }
+
+ if (TkParseColor(display, colormap, name, &color) == 0) {
+ return NULL;
+ }
+
+ validXColor:
+ tkColPtr = ckalloc(sizeof(TkColor));
+ tkColPtr->color = color;
+
+ return tkColPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetColorByValue --
+ *
+ * Given a desired set of red-green-blue intensities for a color,
+ * locate a pixel value to use to draw that color in a given
+ * window.
+ *
+ * Results:
+ * The return value is a pointer to an TkColor structure that
+ * indicates the closest red, blue, and green intensities available
+ * to those specified in colorPtr, and also specifies a pixel
+ * value to use to draw in that color.
+ *
+ * Side effects:
+ * May invalidate the colormap cache for the specified window.
+ * Allocates a new TkColor structure.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkColor *
+TkpGetColorByValue(
+ Tk_Window tkwin, /* Window in which color will be used. */
+ XColor *colorPtr) /* Red, green, and blue fields indicate
+ * desired color. */
+{
+ TkColor *tkColPtr = ckalloc(sizeof(TkColor));
+
+ tkColPtr->color.red = colorPtr->red;
+ tkColPtr->color.green = colorPtr->green;
+ tkColPtr->color.blue = colorPtr->blue;
+ tkColPtr->color.pixel = TkpGetPixel(&tkColPtr->color);
+ return tkColPtr;
+}
+
+#if !TK_DRAW_IN_CONTEXT
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXCompareColors --
+ *
+ * On Mac, color codes may specify symbolic values like "highlight
+ * foreground", but we really need the actual values to compare.
+ * Maybe see also: "TIP #154: Add Named Colors to Tk".
+ *
+ * Results:
+ * Returns true if both colors are the same, false otherwise.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkMacOSXCompareColors(
+ unsigned long c1,
+ unsigned long c2)
+{
+ RGBColor col1, col2;
+ return TkSetMacColor(c1,&col1) &&
+ TkSetMacColor(c1,&col2) &&
+ !memcmp(&col1,&col2,sizeof(col1));
+}
+#endif /* !TK_DRAW_IN_CONTEXT */
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Stub functions --
+ *
+ * These functions are just stubs for functions that either
+ * don't make sense on the Mac or have yet to be implemented.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * These calls do nothing - which may not be expected.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Status
+XAllocColor(
+ Display *display, /* Display. */
+ Colormap map, /* Not used. */
+ XColor *colorPtr) /* XColor struct to modify. */
+{
+ display->request++;
+ colorPtr->pixel = TkpGetPixel(colorPtr);
+ return 1;
+}
+
+Colormap
+XCreateColormap(
+ Display *display, /* Display. */
+ Window window, /* X window. */
+ Visual *visual, /* Not used. */
+ int alloc) /* Not used. */
+{
+ static Colormap index = 1;
+
+ /*
+ * Just return a new value each time.
+ */
+ return index++;
+}
+
+void
+XFreeColormap(
+ Display* display, /* Display. */
+ Colormap colormap) /* Colormap. */
+{
+}
+
+void
+XFreeColors(
+ Display* display, /* Display. */
+ Colormap colormap, /* Colormap. */
+ unsigned long* pixels, /* Array of pixels. */
+ int npixels, /* Number of pixels. */
+ unsigned long planes) /* Number of pixel planes. */
+{
+ /*
+ * The Macintosh version of Tk uses TrueColor. Nothing
+ * needs to be done to release colors as there really is
+ * no colormap in the Tk sense.
+ */
+}
diff --git a/carbon/tkMacOSXConfig.c b/carbon/tkMacOSXConfig.c
new file mode 100644
index 0000000..82d3104
--- /dev/null
+++ b/carbon/tkMacOSXConfig.c
@@ -0,0 +1,43 @@
+/*
+ * tkMacOSXConfig.c --
+ *
+ * This module implements the Macintosh system defaults for
+ * the configuration package.
+ *
+ * Copyright (c) 1997 by 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.
+ */
+
+#include "tkInt.h"
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetSystemDefault --
+ *
+ * Given a dbName and className for a configuration option,
+ * return a string representation of the option.
+ *
+ * Results:
+ * Returns a Tk_Uid that is the string identifier that identifies
+ * this option. Returns NULL if there are no system defaults
+ * that match this pair.
+ *
+ * Side effects:
+ * None, once the package is initialized.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Tcl_Obj *
+TkpGetSystemDefault(
+ Tk_Window tkwin, /* A window to use. */
+ const char *dbName, /* The option database name. */
+ const char *className) /* The name of the option class. */
+{
+ return NULL;
+}
diff --git a/carbon/tkMacOSXCursor.c b/carbon/tkMacOSXCursor.c
new file mode 100644
index 0000000..c465764
--- /dev/null
+++ b/carbon/tkMacOSXCursor.c
@@ -0,0 +1,487 @@
+/*
+ * tkMacOSXCursor.c --
+ *
+ * This file contains Macintosh specific cursor related routines.
+ *
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+
+/*
+ * There are three different ways to set the cursor on the Mac. The default
+ * theme cursors (listed in cursorNames below), color resource cursors, &
+ * normal cursors.
+ */
+
+#define NONE -1 /* Hidden cursor */
+#define THEME 0 /* Theme cursors */
+#define ANIMATED 1 /* Animated theme cursors */
+#define COLOR 2 /* Cursors of type crsr. */
+#define NORMAL 3 /* Cursors of type CURS. */
+
+/*
+ * The following data structure contains the system specific data necessary to
+ * control Windows cursors.
+ */
+
+typedef struct {
+ TkCursor info; /* Generic cursor info used by tkCursor.c */
+ Handle macCursor; /* Resource containing Macintosh cursor. For
+ * theme cursors, this is -1. */
+ int type; /* Type of Mac cursor: for theme cursors this
+ * is the theme cursor constant, otherwise one
+ * of crsr or CURS. */
+ int count; /* For animating cursors, the count for the
+ * cursor. */
+} TkMacOSXCursor;
+
+/*
+ * The table below is used to map from the name of a predefined cursor
+ * to its resource identifier.
+ */
+
+struct CursorName {
+ const char *name;
+ int id;
+};
+
+static struct CursorName noneCursorName = {"none", 0};
+
+static struct CursorName themeCursorNames[] = {
+ {"arrow", kThemeArrowCursor},
+ {"copyarrow", kThemeCopyArrowCursor},
+ {"aliasarrow", kThemeAliasArrowCursor},
+ {"contextualmenuarrow", kThemeContextualMenuArrowCursor},
+ {"ibeam", kThemeIBeamCursor},
+ {"text", kThemeIBeamCursor},
+ {"xterm", kThemeIBeamCursor},
+ {"cross", kThemeCrossCursor},
+ {"crosshair", kThemeCrossCursor},
+ {"cross-hair", kThemeCrossCursor},
+ {"plus", kThemePlusCursor},
+ {"closedhand", kThemeClosedHandCursor},
+ {"openhand", kThemeOpenHandCursor},
+ {"pointinghand", kThemePointingHandCursor},
+ {"resizeleft", kThemeResizeLeftCursor},
+ {"resizeright", kThemeResizeRightCursor},
+ {"resizeleftright", kThemeResizeLeftRightCursor},
+ {"resizeup", kThemeResizeUpCursor},
+ {"resizedown", kThemeResizeDownCursor},
+ {"resizeupdown", kThemeResizeUpDownCursor},
+ {"notallowed", kThemeNotAllowedCursor},
+ {"poof", kThemePoofCursor},
+ {NULL, 0}
+};
+
+static struct CursorName animatedThemeCursorNames[] = {
+ {"watch", kThemeWatchCursor},
+ {"countinguphand", kThemeCountingUpHandCursor},
+ {"countingdownhand", kThemeCountingDownHandCursor},
+ {"countingupanddownhand", kThemeCountingUpAndDownHandCursor},
+ {"spinning", kThemeSpinningCursor},
+ {NULL, 0}
+};
+
+/*
+ * Declarations of static variables used in this file.
+ */
+
+static TkMacOSXCursor * gCurrentCursor = NULL;
+ /* A pointer to the current cursor. */
+static int gResizeOverride = false;
+ /* A boolean indicating whether we should use
+ * the resize cursor during installations. */
+static int gTkOwnsCursor = true;/* A boolean indicating whether Tk owns the
+ * cursor. If not (for instance, in the case
+ * where a Tk window is embedded in another
+ * app's window, and the cursor is out of the
+ * tk window, we will not attempt to adjust
+ * the cursor. */
+
+/*
+ * Declarations of procedures local to this file
+ */
+
+static void FindCursorByName(TkMacOSXCursor *macCursorPtr, const char *string);
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * FindCursorByName --
+ *
+ * Retrieve a system cursor by name, and fill the macCursorPtr
+ * structure. If the cursor cannot be found, the macCursor field will be
+ * NULL. The function first attempts to load a color cursor. If that
+ * fails it will attempt to load a black & white cursor.
+ *
+ * Results:
+ * Fills the macCursorPtr record.
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+FindCursorByName(
+ TkMacOSXCursor *macCursorPtr,
+ const char *string)
+{
+ Handle resource;
+ Str255 curName;
+ int destWrote, inCurLen;
+ Tcl_Encoding encoding;
+
+ inCurLen = strlen(string);
+ if (inCurLen > 255) {
+ return;
+ }
+
+ /*
+ * macRoman is the encoding that the resource fork uses.
+ */
+
+ encoding = Tcl_GetEncoding(NULL, "macRoman");
+ Tcl_UtfToExternal(NULL, encoding, string, inCurLen, 0, NULL,
+ (char *) &curName[1], 255, NULL, &destWrote, NULL);
+ curName[0] = destWrote;
+ Tcl_FreeEncoding(encoding);
+
+ resource = GetNamedResource('crsr', curName);
+ if (resource) {
+ short id;
+ Str255 theName;
+ ResType theType;
+
+ GetResInfo(resource, &id, &theType, theName);
+ macCursorPtr->macCursor = (Handle) GetCCursor(id);
+ macCursorPtr->type = COLOR;
+ } else {
+ macCursorPtr->macCursor = GetNamedResource('CURS', curName);
+ macCursorPtr->type = NORMAL;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkGetCursorByName --
+ *
+ * Retrieve a system cursor by name.
+ *
+ * Results:
+ * Returns a new cursor, or NULL on errors.
+ *
+ * Side effects:
+ * Allocates a new cursor.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkCursor *
+TkGetCursorByName(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ Tk_Uid string) /* Description of cursor. See manual entry
+ * for details on legal syntax. */
+{
+ struct CursorName *namePtr;
+ TkMacOSXCursor *macCursorPtr;
+ int count = -1;
+
+ macCursorPtr = ckalloc(sizeof(TkMacOSXCursor));
+ macCursorPtr->info.cursor = (Tk_Cursor) macCursorPtr;
+
+ /*
+ * To find a cursor we must first determine if it is one of the builtin
+ * cursors or the standard arrow cursor. Otherwise, we attempt to load the
+ * cursor as a named Mac resource.
+ */
+
+ if (strcmp(noneCursorName.name, string) == 0) {
+ namePtr = &noneCursorName;
+ macCursorPtr->type = NONE;
+ } else {
+ for (namePtr = themeCursorNames; namePtr->name != NULL; namePtr++) {
+ if (strcmp(namePtr->name, string) == 0) {
+ macCursorPtr->type = THEME;
+ break;
+ }
+ }
+ }
+
+ if (namePtr->name == NULL) {
+ for (namePtr = animatedThemeCursorNames;
+ namePtr->name != NULL; namePtr++) {
+ int namelen = strlen(namePtr->name);
+
+ if (strncmp(namePtr->name, string, namelen) == 0) {
+ const char *numPtr = string + namelen;
+
+ if (*numPtr) {
+ int result = Tcl_GetInt(NULL, numPtr, &count);
+
+ if (result != TCL_OK) {
+ continue;
+ }
+ }
+ macCursorPtr->type = ANIMATED;
+ break;
+ }
+ }
+ }
+
+ if (namePtr->name != NULL) {
+ macCursorPtr->macCursor = (Handle) namePtr;
+ macCursorPtr->count = count;
+ } else {
+ FindCursorByName(macCursorPtr, string);
+
+ if (macCursorPtr->macCursor == NULL) {
+ const char **argv;
+ int argc;
+
+ /*
+ * The user may be trying to specify an XCursor with fore & back
+ * colors. We don't want this to be an error, so pick off the
+ * first word, and try again.
+ */
+
+ if (Tcl_SplitList(interp, string, &argc, &argv) == TCL_OK ) {
+ if (argc > 1) {
+ FindCursorByName(macCursorPtr, argv[0]);
+ }
+ ckfree(argv);
+ }
+ }
+ }
+
+ if (macCursorPtr->macCursor == NULL) {
+ ckfree(macCursorPtr);
+ Tcl_AppendResult(interp, "bad cursor spec \"", string, "\"", NULL);
+ return NULL;
+ }
+ return (TkCursor *) macCursorPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkCreateCursorFromData --
+ *
+ * Creates a cursor from the source and mask bits.
+ *
+ * Results:
+ * Returns a new cursor, or NULL on errors.
+ *
+ * Side effects:
+ * Allocates a new cursor.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkCursor *
+TkCreateCursorFromData(
+ Tk_Window tkwin, /* Window in which cursor will be used. */
+ const char *source, /* Bitmap data for cursor shape. */
+ const char *mask, /* Bitmap data for cursor mask. */
+ int width, int height, /* Dimensions of cursor. */
+ int xHot, int yHot, /* Location of hot-spot in cursor. */
+ XColor fgColor, /* Foreground color for cursor. */
+ XColor bgColor) /* Background color for cursor. */
+{
+ return NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpFreeCursor --
+ *
+ * This procedure is called to release a cursor allocated by
+ * TkGetCursorByName.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The cursor data structure is deallocated.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpFreeCursor(
+ TkCursor *cursorPtr)
+{
+ TkMacOSXCursor *macCursorPtr = (TkMacOSXCursor *) cursorPtr;
+
+ switch (macCursorPtr->type) {
+ case COLOR:
+ DisposeCCursor((CCrsrHandle) macCursorPtr->macCursor);
+ break;
+ case NORMAL:
+ ReleaseResource(macCursorPtr->macCursor);
+ break;
+ }
+
+ if (macCursorPtr == gCurrentCursor) {
+ gCurrentCursor = NULL;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXInstallCursor --
+ *
+ * Installs either the current cursor as defined by TkpSetCursor or a
+ * resize cursor as the cursor the Macintosh should currently display.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Changes the Macintosh mouse cursor.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXInstallCursor(
+ int resizeOverride)
+{
+ TkMacOSXCursor *macCursorPtr = gCurrentCursor;
+ CCrsrHandle ccursor;
+ CursHandle cursor;
+ static unsigned int cursorStep = 0;
+ static int cursorHidden = 0;
+ int cursorNone = 0;
+
+ gResizeOverride = resizeOverride;
+
+ if (resizeOverride) {
+ cursor = (CursHandle) GetNamedResource('CURS', "\presize");
+ if (cursor) {
+ SetCursor(*cursor);
+ } else {
+ TkMacOSXDbgMsg("Resize cursor failed: %d", ResError());
+ }
+ } else if (macCursorPtr == NULL) {
+ SetThemeCursor(kThemeArrowCursor);
+ } else {
+ struct CursorName *namePtr;
+
+ switch (macCursorPtr->type) {
+ case NONE:
+ if (!cursorHidden) {
+ cursorHidden = 1;
+ HideCursor();
+ }
+ cursorNone = 1;
+ break;
+ case THEME:
+ namePtr = (struct CursorName *) macCursorPtr->macCursor;
+ SetThemeCursor(namePtr->id);
+ break;
+ case ANIMATED:
+ namePtr = (struct CursorName *) macCursorPtr->macCursor;
+ if (macCursorPtr->count == -1) {
+ SetAnimatedThemeCursor(namePtr->id, cursorStep++);
+ } else {
+ SetAnimatedThemeCursor(namePtr->id, macCursorPtr->count);
+ }
+ break;
+ case COLOR:
+ ccursor = (CCrsrHandle) macCursorPtr->macCursor;
+ SetCCursor(ccursor);
+ break;
+ case NORMAL:
+ cursor = (CursHandle) macCursorPtr->macCursor;
+ SetCursor(*cursor);
+ break;
+ }
+ }
+ if (cursorHidden && !cursorNone) {
+ cursorHidden = 0;
+ ShowCursor();
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpSetCursor --
+ *
+ * Set the current cursor and install it.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Changes the current cursor.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpSetCursor(
+ TkpCursor cursor)
+{
+ int cursorChanged = 1;
+
+ if (!gTkOwnsCursor) {
+ return;
+ }
+
+ if (cursor == None) {
+ /*
+ * This is a little tricky. We can't really tell whether
+ * gCurrentCursor is NULL because it was NULL last time around or
+ * because we just freed the current cursor. So if the input cursor is
+ * NULL, we always need to reset it, we can't trust the cursorChanged
+ * logic.
+ */
+
+ gCurrentCursor = NULL;
+ } else {
+ if (gCurrentCursor == (TkMacOSXCursor *) cursor) {
+ cursorChanged = 0;
+ }
+ gCurrentCursor = (TkMacOSXCursor *) cursor;
+ }
+
+ if (Tk_MacOSXIsAppInFront() && cursorChanged) {
+ TkMacOSXInstallCursor(gResizeOverride);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_MacOSXTkOwnsCursor --
+ *
+ * Sets whether Tk has the right to adjust the cursor.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * May keep Tk from changing the cursor.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_MacOSXTkOwnsCursor(
+ int tkOwnsIt)
+{
+ gTkOwnsCursor = tkOwnsIt;
+}
diff --git a/macosx/tkMacOSXCursors.r b/carbon/tkMacOSXCursors.r
index f947ddf..f947ddf 100644
--- a/macosx/tkMacOSXCursors.r
+++ b/carbon/tkMacOSXCursors.r
diff --git a/carbon/tkMacOSXDebug.c b/carbon/tkMacOSXDebug.c
new file mode 100644
index 0000000..e007a01
--- /dev/null
+++ b/carbon/tkMacOSXDebug.c
@@ -0,0 +1,643 @@
+/*
+ * tkMacOSXDebug.c --
+ *
+ * Implementation of Macintosh specific functions for debugging MacOS
+ * events, regions, etc...
+ *
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * The following terms apply to all files originating from Apple
+ * Computer, Inc. ("Apple") and associated with the software
+ * unless explicitly disclaimed in individual files.
+ *
+ *
+ * Apple hereby grants permission to use, copy, modify,
+ * distribute, and license this software and its documentation
+ * for any purpose, provided that existing copyright notices are
+ * retained in all copies and that this notice is included
+ * verbatim in any distributions. No written agreement, license,
+ * or royalty fee is required for any of the authorized
+ * uses. Modifications to this software may be copyrighted by
+ * their authors and need not follow the licensing terms
+ * described here, provided that the new terms are clearly
+ * indicated on the first page of each file where they apply.
+ *
+ *
+ * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE
+ * SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
+ * INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
+ * THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
+ * EVEN IF APPLE OR THE AUTHORS HAVE BEEN ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE. APPLE, THE AUTHORS AND
+ * DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS
+ * SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND APPLE,THE
+ * AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
+ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * GOVERNMENT USE: If you are acquiring this software on behalf
+ * of the U.S. government, the Government shall have only
+ * "Restricted Rights" in the software and related documentation
+ * as defined in the Federal Acquisition Regulations (FARs) in
+ * Clause 52.227.19 (c) (2). If you are acquiring the software
+ * on behalf of the Department of Defense, the software shall be
+ * classified as "Commercial Computer Software" and the
+ * 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.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkMacOSXDebug.h"
+
+#ifdef TK_MAC_DEBUG
+
+typedef struct {
+ EventKind kind;
+ const char * name;
+} MyEventName;
+
+typedef struct {
+ EventClass c;
+ MyEventName * names;
+} MyEventNameList;
+
+static MyEventName windowEventNames [] = {
+ { kEventWindowUpdate,"Update"},
+ { kEventWindowDrawContent,"DrawContent"},
+ { kEventWindowActivated,"Activated"},
+ { kEventWindowDeactivated,"Deactivated"},
+ { kEventWindowGetClickActivation,"GetClickActivation"},
+ { kEventWindowShowing,"Showing"},
+ { kEventWindowHiding,"Hiding"},
+ { kEventWindowShown,"Shown"},
+ { kEventWindowHidden,"Hidden"},
+ { kEventWindowBoundsChanging,"BoundsChanging"},
+ { kEventWindowBoundsChanged,"BoundsChanged"},
+ { kEventWindowResizeStarted,"ResizeStarted"},
+ { kEventWindowResizeCompleted,"ResizeCompleted"},
+ { kEventWindowDragStarted,"DragStarted"},
+ { kEventWindowDragCompleted,"DragCompleted"},
+ { kEventWindowClickDragRgn,"ClickDragRgn"},
+ { kEventWindowClickResizeRgn,"ClickResizeRgn"},
+ { kEventWindowClickCollapseRgn,"ClickCollapseRgn"},
+ { kEventWindowClickCloseRgn,"ClickCloseRgn"},
+ { kEventWindowClickZoomRgn,"ClickZoomRgn"},
+ { kEventWindowClickContentRgn,"ClickContentRgn"},
+ { kEventWindowClickProxyIconRgn,"ClickProxyIconRgn"},
+ { kEventWindowCursorChange,"CursorChange" },
+ { kEventWindowCollapse,"Collapse"},
+ { kEventWindowCollapsed,"Collapsed"},
+ { kEventWindowCollapseAll,"CollapseAll"},
+ { kEventWindowExpand,"Expand"},
+ { kEventWindowExpanded,"Expanded"},
+ { kEventWindowExpandAll,"ExpandAll"},
+ { kEventWindowCollapse,"Collapse"},
+ { kEventWindowClose,"Close"},
+ { kEventWindowClosed,"Closed"},
+ { kEventWindowCloseAll,"CloseAll"},
+ { kEventWindowZoom,"Zoom"},
+ { kEventWindowZoomed,"Zoomed"},
+ { kEventWindowZoomAll,"ZoomAll"},
+ { kEventWindowContextualMenuSelect,"ContextualMenuSelect"},
+ { kEventWindowPathSelect,"PathSelect"},
+ { kEventWindowGetIdealSize,"GetIdealSize"},
+ { kEventWindowGetMinimumSize,"GetMinimumSize"},
+ { kEventWindowGetMaximumSize,"GetMaximumSize"},
+ { kEventWindowConstrain,"Constrain"},
+ { kEventWindowHandleContentClick,"HandleContentClick"},
+ { kEventWindowProxyBeginDrag,"ProxyBeginDra}"},
+ { kEventWindowProxyEndDrag,"ProxyEndDrag"},
+ { kEventWindowFocusAcquired,"FocusAcquired"},
+ { kEventWindowFocusRelinquish,"FocusRelinquish"},
+ { kEventWindowDrawFrame,"DrawFrame"},
+ { kEventWindowDrawPart,"DrawPart"},
+ { kEventWindowGetRegion,"GetRegion"},
+ { kEventWindowHitTest,"HitTest"},
+ { kEventWindowInit,"Init"},
+ { kEventWindowDispose,"Dispose"},
+ { kEventWindowDragHilite,"DragHilite"},
+ { kEventWindowModified,"Modified"},
+ { kEventWindowSetupProxyDragImage,"SetupProxyDragImage"},
+ { kEventWindowStateChanged,"StateChanged"},
+ { kEventWindowMeasureTitle,"MeasureTitle"},
+ { kEventWindowDrawGrowBox,"DrawGrowBox"},
+ { kEventWindowGetGrowImageRegion,"GetGrowImageRegion"},
+ { kEventWindowPaint,"Paint"},
+ { 0, NULL },
+};
+
+static MyEventName mouseEventNames [] = {
+ { kEventMouseMoved, "Moved"},
+ { kEventMouseUp, "Up"},
+ { kEventMouseDown, "Down"},
+ { kEventMouseDragged, "Dragged"},
+ { kEventMouseWheelMoved, "WheelMoved"},
+ { 0, NULL}
+};
+
+static MyEventName keyboardEventNames [] = {
+ { kEventRawKeyDown, "Down"},
+ { kEventRawKeyRepeat, "Repeat"},
+ { kEventRawKeyUp, "Up"},
+ { kEventRawKeyModifiersChanged, "ModifiersChanged"},
+ { kEventHotKeyPressed, "HotKeyPressed"},
+ { kEventHotKeyReleased, "HotKeyReleased"},
+ { 0, NULL}
+};
+
+static MyEventName appEventNames [] = {
+ { kEventAppActivated, "Activated"},
+ { kEventAppDeactivated, "Deactivated"},
+ { kEventAppQuit, "Quit"},
+ { kEventAppLaunchNotification, "LaunchNotification"},
+ { kEventAppLaunched, "Launched"},
+ { kEventAppTerminated, "Terminated"},
+ { kEventAppFrontSwitched, "FrontSwitched"},
+ { 0, NULL}
+};
+
+static MyEventName menuEventNames [] = {
+ { kEventMenuBeginTracking, "BeginTracking"},
+ { kEventMenuEndTracking, "EndTracking"},
+ { kEventMenuChangeTrackingMode, "ChangeTrackingMode"},
+ { kEventMenuOpening, "Opening"},
+ { kEventMenuClosed, "Closed"},
+ { kEventMenuTargetItem, "TargetItem"},
+ { kEventMenuMatchKey, "MatchKey"},
+ { kEventMenuEnableItems, "EnableItems"},
+ { kEventMenuDispose, "Dispose"},
+ { 0, NULL }
+};
+
+static MyEventName controlEventNames [] = {
+ { kEventControlInitialize, "Initialize" },
+ { kEventControlDispose, "Dispose" },
+ { kEventControlGetOptimalBounds, "GetOptimalBounds" },
+ { kEventControlHit, "Hit" },
+ { kEventControlSimulateHit, "SimulateHit" },
+ { kEventControlHitTest, "HitTest" },
+ { kEventControlDraw, "Draw" },
+ { kEventControlApplyBackground, "ApplyBackground" },
+ { kEventControlApplyTextColor, "ApplyTextColor" },
+ { kEventControlSetFocusPart, "SetFocusPart" },
+ { kEventControlGetFocusPart, "GetFocusPart" },
+ { kEventControlActivate, "Activate" },
+ { kEventControlDeactivate, "Deactivate" },
+ { kEventControlSetCursor, "SetCursor" },
+ { kEventControlContextualMenuClick, "ContextualMenuClick" },
+ { kEventControlClick, "Click" },
+ { kEventControlTrack, "Track" },
+ { kEventControlGetScrollToHereStartPoint, "GetScrollToHereStartPoint" },
+ { kEventControlGetIndicatorDragConstraint, "GetIndicatorDragConstraint" },
+ { kEventControlIndicatorMoved, "IndicatorMoved" },
+ { kEventControlGhostingFinished, "GhostingFinished" },
+ { kEventControlGetActionProcPart, "GetActionProcPart" },
+ { kEventControlGetPartRegion, "GetPartRegion" },
+ { kEventControlGetPartBounds, "GetPartBounds" },
+ { kEventControlSetData, "SetData" },
+ { kEventControlGetData, "GetData" },
+ { kEventControlValueFieldChanged, "ValueFieldChanged" },
+ { kEventControlAddedSubControl, "AddedSubControl" },
+ { kEventControlRemovingSubControl, "RemovingSubControl" },
+ { kEventControlBoundsChanged, "BoundsChanged" },
+ { kEventControlOwningWindowChanged, "OwningWindowChanged" },
+ { kEventControlArbitraryMessage, "ArbitraryMessage" },
+ { 0, NULL }
+};
+
+static MyEventName commandEventNames [] = {
+ { kEventCommandProcess, "Process" },
+ { kEventCommandUpdateStatus, "UpdateStatus" },
+ { 0, NULL }
+};
+
+static MyEventNameList eventNameList [] = {
+ { kEventClassWindow, windowEventNames },
+ { kEventClassMouse, mouseEventNames },
+ { kEventClassKeyboard, keyboardEventNames },
+ { kEventClassApplication, appEventNames },
+ { kEventClassMenu, menuEventNames },
+ { kEventClassControl, controlEventNames },
+ { kEventClassCommand, commandEventNames },
+ { 0, NULL}
+};
+
+#ifdef TK_MACOSXDEBUG_UNUSED
+static MyEventName classicEventNames [] = {
+ { nullEvent,"nullEvent" },
+ { mouseDown,"mouseDown" },
+ { mouseUp,"mouseUp" },
+ { keyDown,"keyDown" },
+ { keyUp,"keyUp" },
+ { autoKey,"autoKey" },
+ { updateEvt,"updateEvt" },
+ { diskEvt,"diskEvt" },
+ { activateEvt,"activateEvt" },
+ { osEvt,"osEvt" },
+ { kHighLevelEvent,"kHighLevelEvent" },
+ { 0, NULL }
+};
+#endif /* TK_MACOSXDEBUG_UNUSED */
+
+MODULE_SCOPE char *
+TkMacOSXCarbonEventToAscii(
+ EventRef eventRef)
+{
+ EventClass eventClass;
+ EventKind eventKind;
+ MyEventNameList * list = eventNameList;
+ MyEventName * names = NULL;
+ static char str[256];
+ char *buf = str;
+ int *iPtr = (int*)str;
+ int found = 0;
+
+ eventClass = GetEventClass(eventRef);
+ eventKind = GetEventKind(eventRef);
+
+ *iPtr = eventClass;
+ buf[4] = 0;
+ strcat(buf, " ");
+ buf += strlen(buf);
+ while (list->names && (!names) ) {
+ if (eventClass == list->c) {
+ names = list -> names;
+ } else {
+ list++;
+ }
+ }
+ while (names && names->name) {
+ if (eventKind == names->kind) {
+ snprintf(buf, 250, "%-20s", names->name);
+ break;
+ } else {
+ names++;
+ }
+ }
+ if (!found) {
+ snprintf(buf, 250, "%-20d", eventKind);
+ }
+ return str;
+}
+
+#ifdef TK_MACOSXDEBUG_UNUSED
+MODULE_SCOPE char *
+TkMacOSXCarbonEventKindToAscii(
+ EventRef eventRef,
+ char *buf)
+{
+ EventClass eventClass;
+ EventKind eventKind;
+ MyEventNameList *list = eventNameList;
+ MyEventName *names = NULL;
+ int found = 0;
+
+ eventClass = GetEventClass(eventRef);
+ eventKind = GetEventKind(eventRef);
+ while (list->names && (!names) ) {
+ if (eventClass == list -> c) {
+ names = list -> names;
+ } else {
+ list++;
+ }
+ }
+ if (names) {
+ found = 0;
+ while (names->name && !found) {
+ if (eventKind == names->kind) {
+ sprintf(buf,"%s",names->name);
+ found = 1;
+ } else {
+ names++;
+ }
+ }
+ }
+ if (!found) {
+ sprintf(buf,"%d", eventKind);
+ } else {
+ sprintf(buf,"%d", eventKind);
+ }
+ return buf;
+}
+
+MODULE_SCOPE char *
+TkMacOSXClassicEventToAscii(
+ EventRecord *eventPtr,
+ char *buf)
+{
+ MyEventName *names = NULL;
+ int found = 0;
+ names = classicEventNames;
+ while (names -> name && !found) {
+ if (eventPtr->what == names->kind) {
+ int *iPtr;
+ char cBuf[8];
+
+ iPtr = (int *) &cBuf;
+ *iPtr = eventPtr->message;
+ cBuf[4] = 0;
+ sprintf(buf, "%-16s %08x %04x %s", names->name,
+ (int) eventPtr->message, eventPtr->modifiers, cBuf);
+ found = 1;
+ } else {
+ names++;
+ }
+ }
+ if (!found) {
+ sprintf(buf,"%-16d %08x %08x, %s", eventPtr->what,
+ (int) eventPtr->message, eventPtr->modifiers, buf);
+ }
+ return buf;
+}
+
+MODULE_SCOPE void
+TkMacOSXPrintPoint(
+ char *tag,
+ Point *p)
+{
+ TkMacOSXDbgMsg("%s %4d %4d", tag,p->h,p->v );
+}
+
+MODULE_SCOPE void
+TkMacOSXPrintRect(
+ char *tag,
+ Rect *r)
+{
+ TkMacOSXDbgMsg("%s %4d %4d %4d %4d (%dx%d)",
+ tag, r->left, r->top, r->right, r->bottom,
+ r->right - r->left + 1, r->bottom - r->top + 1);
+}
+
+MODULE_SCOPE void
+TkMacOSXPrintRegion(
+ char *tag,
+ RgnHandle rgn)
+{
+ Rect r;
+
+ GetRegionBounds(rgn,&r);
+ TkMacOSXPrintRect(tag,&r);
+}
+
+MODULE_SCOPE void
+TkMacOSXPrintWindowTitle(
+ char *tag,
+ WindowRef window)
+{
+ Str255 title;
+
+ GetWTitle(window, title);
+ title[title[0] + 1] = 0;
+ TkMacOSXDbgMsg("%s %s", tag, title+1);
+}
+
+typedef struct {
+ int msg;
+ char *name;
+} MsgName;
+
+static MsgName msgNames [] = {
+ { kMenuDrawMsg, "Draw"},
+ { kMenuSizeMsg, "Size"},
+ { kMenuPopUpMsg, "PopUp"},
+ { kMenuCalcItemMsg, "CalcItem" },
+ { kMenuThemeSavvyMsg, "ThemeSavvy"},
+ { kMenuInitMsg, "Init" },
+ { kMenuDisposeMsg, "Dispose" },
+ { kMenuFindItemMsg, "FindItem" },
+ { kMenuHiliteItemMsg, "HiliteItem" },
+ { kMenuDrawItemsMsg, "DrawItems" },
+ { -1, NULL }
+};
+
+MODULE_SCOPE char *
+TkMacOSXMenuMessageToAscii(
+ int msg,
+ char *s)
+{
+ MsgName *msgNamePtr;
+
+ for (msgNamePtr=msgNames ; msgNamePtr->name ; msgNamePtr++) {
+ if (msgNamePtr->msg == msg) {
+ strcpy(s,msgNamePtr->name);
+ return s;
+ }
+ }
+ sprintf(s, "unknown : %d", msg);
+ return s;
+}
+
+static MsgName trackingNames [] = {
+ { kMouseTrackingMousePressed , "MousePressed " },
+ { kMouseTrackingMouseReleased , "MouseReleased " },
+ { kMouseTrackingMouseExited , "MouseExited " },
+ { kMouseTrackingMouseEntered , "MouseEntered " },
+ { kMouseTrackingMouseMoved , "MouseMoved " },
+ { kMouseTrackingKeyModifiersChanged, "KeyModifiersChanged" },
+ { kMouseTrackingUserCancelled , "UserCancelled " },
+ { kMouseTrackingTimedOut , "TimedOut " },
+ { -1, NULL }
+};
+
+MODULE_SCOPE char *
+TkMacOSXMouseTrackingResultToAscii(
+ MouseTrackingResult r,
+ char *buf)
+{
+ MsgName *namePtr;
+
+ for (namePtr = trackingNames; namePtr->name; namePtr++) {
+ if (namePtr->msg == r) {
+ strcpy(buf, namePtr->name);
+ return buf;
+ }
+ }
+ sprintf(buf, "Unknown mouse tracking result : %d", r);
+ return buf;
+}
+#endif /* TK_MACOSXDEBUG_UNUSED */
+
+MODULE_SCOPE void
+TkMacOSXDebugFlashRegion(
+ Drawable d,
+ HIShapeRef rgn)
+{
+ TkMacOSXInitNamedDebugSymbol(HIToolbox, int, QDDebugFlashRegion,
+ CGrafPtr port, RgnHandle region);
+ CFShow(rgn);
+ if (d && rgn && QDDebugFlashRegion && !HIShapeIsEmpty(rgn)) {
+ CGrafPtr port = TkMacOSXGetDrawablePort(d);
+
+ if (port) {
+ static RgnHandle qdRgn = NULL;
+
+ if (!qdRgn) {
+ qdRgn = NewRgn();
+ }
+ ChkErr(HIShapeGetAsQDRgn, rgn, qdRgn);
+
+ /*
+ * Carbon-internal region flashing SPI (c.f. Technote 2124)
+ */
+
+ QDDebugFlashRegion(port, qdRgn);
+ SetEmptyRgn(qdRgn);
+ }
+ }
+}
+
+#include <mach-o/dyld.h>
+#include <mach-o/nlist.h>
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetNamedDebugSymbol --
+ *
+ * Dynamically acquire address of a named symbol from a loaded dynamic
+ * library, so that we can use API that may not be available on all OS
+ * versions. For debugging purposes, if we cannot find the symbol with
+ * the usual dynamic library APIs, we manually walk the symbol table of
+ * the loaded library. This allows access to unexported symbols such as
+ * private_extern internal debugging functions. If module is NULL or the
+ * empty string, search all loaded libraries (could be very expensive and
+ * should be avoided).
+ *
+ * THIS FUCTION IS ONLY TO BE USED FOR DEBUGGING PURPOSES, IT MAY BREAK
+ * UNEXPECTEDLY IN THE FUTURE!
+ *
+ * Results:
+ * Address of given symbol or NULL if unavailable.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE void *
+TkMacOSXGetNamedDebugSymbol(
+ const char *module,
+ const char *symbol)
+{
+ void *addr = TkMacOSXGetNamedSymbol(module, symbol);
+
+#ifndef __LP64__
+ if (!addr) {
+ const struct mach_header *mh = NULL;
+ uint32_t i, n = _dyld_image_count();
+ size_t module_len = 0;
+
+ if (module && *module) {
+ module_len = strlen(module);
+ }
+ for (i = 0; i < n; i++) {
+ if (module && *module) {
+ /* Find image with given module name */
+ char *name;
+ const char *path = _dyld_get_image_name(i);
+
+ if (!path) {
+ continue;
+ }
+ name = strrchr(path, '/') + 1;
+ if (strncmp(name, module, module_len) != 0) {
+ continue;
+ }
+ }
+ mh = _dyld_get_image_header(i);
+ if (mh) {
+ struct load_command *lc;
+ struct symtab_command *st = NULL;
+ struct segment_command *sg = NULL;
+ uint32_t j, m, nsect = 0, txtsectx = 0;
+
+ lc = (struct load_command*)((const char*) mh +
+ sizeof(struct mach_header));
+ m = mh->ncmds;
+ for (j = 0; j < m; j++) {
+ /* Find symbol table and index of __text section */
+ if (lc->cmd == LC_SEGMENT) {
+ /* Find last segment before symbol table */
+ sg = (struct segment_command*) lc;
+ if (!txtsectx) {
+ /* Count total sections until (__TEXT, __text) */
+ uint32_t k, ns = sg->nsects;
+
+ if (strcmp(sg->segname, SEG_TEXT) == 0) {
+ struct section *s = (struct section *)(
+ (char *)sg +
+ sizeof(struct segment_command));
+
+ for(k = 0; k < ns; k++) {
+ if (strcmp(s->sectname, SECT_TEXT) == 0) {
+ txtsectx = nsect+k+1;
+ break;
+ }
+ s++;
+ }
+ }
+ nsect += ns;
+ }
+ } else if (!st && lc->cmd == LC_SYMTAB) {
+ st = (struct symtab_command *) lc;
+ break;
+ }
+ lc = (struct load_command *)((char *) lc + lc->cmdsize);
+ }
+ if (st && sg && txtsectx) {
+ intptr_t base, slide = _dyld_get_image_vmaddr_slide(i);
+ char *strings;
+ struct nlist *sym;
+ uint32_t strsize = st->strsize;
+ int32_t strx;
+
+ /*
+ * Offset file positions by difference to actual position
+ * in memory of last segment before symbol table:
+ */
+
+ base = (intptr_t) sg->vmaddr + slide - sg->fileoff;
+ strings = (char *) (base + st->stroff);
+ sym = (struct nlist *) (base + st->symoff);
+ m = st->nsyms;
+ for (j = 0; j < m; j++) {
+ /* Find symbol with given name in __text section */
+ strx = sym->n_un.n_strx;
+ if ((sym->n_type & N_TYPE) == N_SECT &&
+ sym->n_sect == txtsectx &&
+ strx > 0 && (uint32_t) strx < strsize &&
+ strcmp(strings + strx, symbol) == 0) {
+ addr = (char*) sym->n_value + slide;
+ break;
+ }
+ sym++;
+ }
+ }
+ }
+ if (module && *module) {
+ /* If given a module name, only search corresponding image */
+ break;
+ }
+ }
+ }
+#endif /* __LP64__ */
+ return addr;
+}
+#endif /* TK_MAC_DEBUG */
+
+/*
+ * Local Variables:
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/carbon/tkMacOSXDebug.h b/carbon/tkMacOSXDebug.h
new file mode 100644
index 0000000..8dc8109
--- /dev/null
+++ b/carbon/tkMacOSXDebug.h
@@ -0,0 +1,96 @@
+/*
+ * tkMacOSXDebug.h --
+ *
+ * Declarations of Macintosh specific functions for debugging MacOS events,
+ * regions, etc...
+ *
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * The following terms apply to all files originating from Apple
+ * Computer, Inc. ("Apple") and associated with the software
+ * unless explicitly disclaimed in individual files.
+ *
+ *
+ * Apple hereby grants permission to use, copy, modify,
+ * distribute, and license this software and its documentation
+ * for any purpose, provided that existing copyright notices are
+ * retained in all copies and that this notice is included
+ * verbatim in any distributions. No written agreement, license,
+ * or royalty fee is required for any of the authorized
+ * uses. Modifications to this software may be copyrighted by
+ * their authors and need not follow the licensing terms
+ * described here, provided that the new terms are clearly
+ * indicated on the first page of each file where they apply.
+ *
+ *
+ * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE
+ * SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
+ * INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
+ * THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
+ * EVEN IF APPLE OR THE AUTHORS HAVE BEEN ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE. APPLE, THE AUTHORS AND
+ * DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS
+ * SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND APPLE,THE
+ * AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
+ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * GOVERNMENT USE: If you are acquiring this software on behalf
+ * of the U.S. government, the Government shall have only
+ * "Restricted Rights" in the software and related documentation
+ * as defined in the Federal Acquisition Regulations (FARs) in
+ * Clause 52.227.19 (c) (2). If you are acquiring the software
+ * on behalf of the Department of Defense, the software shall be
+ * classified as "Commercial Computer Software" and the
+ * 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.
+ */
+
+#ifndef _TKMACDEBUG
+#define _TKMACDEBUG
+
+#ifndef _TKMACINT
+#include "tkMacOSXInt.h"
+#endif
+
+#ifdef TK_MAC_DEBUG
+
+MODULE_SCOPE char* TkMacOSXCarbonEventToAscii(EventRef eventRef);
+
+#ifdef TK_MACOSXDEBUG_UNUSED
+MODULE_SCOPE char* TkMacOSXCarbonEventKindToAscii(EventRef eventRef, char * buf );
+MODULE_SCOPE char* TkMacOSXClassicEventToAscii(EventRecord * eventPtr, char * buf );
+
+MODULE_SCOPE void TkMacOSXPrintRect(char * tag, Rect * r );
+MODULE_SCOPE void TkMacOSXPrintPoint(char * tag, Point * p );
+
+MODULE_SCOPE void TkMacOSXPrintRegion(char * tag, RgnHandle rgn );
+MODULE_SCOPE void TkMacOSXPrintWindowTitle(char * tag, WindowRef window );
+MODULE_SCOPE char* TkMacOSXMenuMessageToAscii(int msg, char * s);
+
+MODULE_SCOPE char* TkMacOSXMouseTrackingResultToAscii(MouseTrackingResult r, char * buf );
+#endif
+
+MODULE_SCOPE void TkMacOSXDebugFlashRegion(Drawable d, HIShapeRef rgn);
+
+MODULE_SCOPE void* TkMacOSXGetNamedDebugSymbol(const char* module, const char* symbol);
+
+/* Macro to abstract common use of TkMacOSXGetNamedDebugSymbol to initialize named symbols */
+#define TkMacOSXInitNamedDebugSymbol(module, ret, symbol, ...) \
+ static ret (* symbol)(__VA_ARGS__) = (void*)(-1L); \
+ if (symbol == (void*)(-1L)) { \
+ symbol = TkMacOSXGetNamedDebugSymbol(STRINGIFY(module), STRINGIFY(_##symbol));\
+ }
+
+#endif /* TK_MAC_DEBUG */
+
+#endif
diff --git a/carbon/tkMacOSXDefault.h b/carbon/tkMacOSXDefault.h
new file mode 100644
index 0000000..0cb57da
--- /dev/null
+++ b/carbon/tkMacOSXDefault.h
@@ -0,0 +1,555 @@
+/*
+ * tkMacOSXDefault.h --
+ *
+ * This file defines the defaults for all options for all of
+ * the Tk widgets.
+ *
+ * Copyright (c) 1991-1994 The Regents of the University of California.
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#ifndef _TKMACDEFAULT
+#define _TKMACDEFAULT
+
+/*
+ * The definitions below provide symbolic names for the default colors.
+ * NORMAL_BG - Normal background color.
+ * ACTIVE_BG - Background color when widget is active.
+ * SELECT_BG - Background color for selected text.
+ * SELECT_FG - Foreground color for selected text.
+ * TROUGH - Background color for troughs in scales and scrollbars.
+ * INDICATOR - Color for indicator when button is selected.
+ * DISABLED - Foreground color when widget is disabled.
+ */
+
+#define BLACK "Black"
+#define WHITE "White"
+#define NORMAL_BG "systemWindowBody"
+#define ACTIVE_BG "systemButtonFacePressed"
+#define ACTIVE_FG "systemPushButtonPressedText"
+#define SELECT_BG "systemHighlight"
+#define SELECT_FG None
+#define INACTIVE_SELECT_BG "systemHighlightSecondary"
+#define TROUGH "#c3c3c3"
+#define INDICATOR "#b03060"
+#define DISABLED "#a3a3a3"
+
+/*
+ * Defaults for labels, buttons, checkbuttons, and radiobuttons:
+ */
+
+#define DEF_BUTTON_ANCHOR "center"
+#define DEF_BUTTON_ACTIVE_BG_COLOR ACTIVE_BG
+#define DEF_BUTTON_ACTIVE_BG_MONO BLACK
+#define DEF_BUTTON_ACTIVE_FG_COLOR ACTIVE_FG
+#define DEF_CHKRAD_ACTIVE_FG_COLOR DEF_BUTTON_ACTIVE_FG_COLOR
+#define DEF_BUTTON_ACTIVE_FG_MONO WHITE
+/* #define DEF_BUTTON_BG_COLOR "systemButtonFace"*/
+#define DEF_BUTTON_BG_COLOR WHITE
+#define DEF_BUTTON_BG_MONO WHITE
+#define DEF_BUTTON_BITMAP ""
+#define DEF_BUTTON_BORDER_WIDTH "2"
+#define DEF_BUTTON_CURSOR ""
+#define DEF_BUTTON_COMMAND ""
+#define DEF_BUTTON_COMPOUND "none"
+#define DEF_BUTTON_DEFAULT "disabled"
+#define DEF_BUTTON_DISABLED_FG_COLOR DISABLED
+#define DEF_BUTTON_DISABLED_FG_MONO ""
+#define DEF_BUTTON_FG "systemButtonText"
+#define DEF_CHKRAD_FG DEF_BUTTON_FG
+#define DEF_BUTTON_FONT "TkDefaultFont"
+#define DEF_BUTTON_HEIGHT "0"
+#define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR
+#define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO
+#define DEF_BUTTON_HIGHLIGHT "systemButtonFrame"
+#define DEF_LABEL_HIGHLIGHT_WIDTH "0"
+#define DEF_BUTTON_HIGHLIGHT_WIDTH "4"
+#define DEF_BUTTON_IMAGE ((char *) NULL)
+#define DEF_BUTTON_INDICATOR "1"
+#define DEF_BUTTON_JUSTIFY "center"
+#define DEF_BUTTON_OFF_VALUE "0"
+#define DEF_BUTTON_ON_VALUE "1"
+#define DEF_BUTTON_TRISTATE_VALUE ""
+#define DEF_BUTTON_OVER_RELIEF ""
+#define DEF_BUTTON_PADX "12"
+#define DEF_LABCHKRAD_PADX "1"
+#define DEF_BUTTON_PADY "3"
+#define DEF_LABCHKRAD_PADY "1"
+#define DEF_BUTTON_RELIEF "flat"
+#define DEF_LABCHKRAD_RELIEF "flat"
+#define DEF_BUTTON_REPEAT_DELAY "0"
+#define DEF_BUTTON_REPEAT_INTERVAL "0"
+#define DEF_BUTTON_SELECT_COLOR INDICATOR
+#define DEF_BUTTON_SELECT_MONO BLACK
+#define DEF_BUTTON_SELECT_IMAGE ((char *) NULL)
+#define DEF_BUTTON_STATE "normal"
+#define DEF_LABEL_TAKE_FOCUS "0"
+#define DEF_BUTTON_TAKE_FOCUS ((char *) NULL)
+#define DEF_BUTTON_TEXT ""
+#define DEF_BUTTON_TEXT_VARIABLE ""
+#define DEF_BUTTON_UNDERLINE "-1"
+#define DEF_BUTTON_VALUE ""
+#define DEF_BUTTON_WIDTH "0"
+#define DEF_BUTTON_WRAP_LENGTH "0"
+#define DEF_RADIOBUTTON_VARIABLE "selectedButton"
+#define DEF_CHECKBUTTON_VARIABLE ""
+
+/*
+ * Defaults for canvases:
+ */
+
+#define DEF_CANVAS_BG_COLOR NORMAL_BG
+#define DEF_CANVAS_BG_MONO WHITE
+#define DEF_CANVAS_BORDER_WIDTH "0"
+#define DEF_CANVAS_CLOSE_ENOUGH "1"
+#define DEF_CANVAS_CONFINE "1"
+#define DEF_CANVAS_CURSOR ""
+#define DEF_CANVAS_HEIGHT "7c"
+#define DEF_CANVAS_HIGHLIGHT_BG NORMAL_BG
+#define DEF_CANVAS_HIGHLIGHT BLACK
+#define DEF_CANVAS_HIGHLIGHT_WIDTH "3"
+#define DEF_CANVAS_INSERT_BG BLACK
+#define DEF_CANVAS_INSERT_BD_COLOR "0"
+#define DEF_CANVAS_INSERT_BD_MONO "0"
+#define DEF_CANVAS_INSERT_OFF_TIME "300"
+#define DEF_CANVAS_INSERT_ON_TIME "600"
+#define DEF_CANVAS_INSERT_WIDTH "2"
+#define DEF_CANVAS_RELIEF "flat"
+#define DEF_CANVAS_SCROLL_REGION ""
+#define DEF_CANVAS_SELECT_COLOR SELECT_BG
+#define DEF_CANVAS_SELECT_MONO BLACK
+#define DEF_CANVAS_SELECT_BD_COLOR "1"
+#define DEF_CANVAS_SELECT_BD_MONO "0"
+#define DEF_CANVAS_SELECT_FG_COLOR SELECT_FG
+#define DEF_CANVAS_SELECT_FG_MONO WHITE
+#define DEF_CANVAS_TAKE_FOCUS ((char *) NULL)
+#define DEF_CANVAS_WIDTH "10c"
+#define DEF_CANVAS_X_SCROLL_CMD ""
+#define DEF_CANVAS_X_SCROLL_INCREMENT "0"
+#define DEF_CANVAS_Y_SCROLL_CMD ""
+#define DEF_CANVAS_Y_SCROLL_INCREMENT "0"
+
+/*
+ * Defaults for entries:
+ */
+
+/*
+ * I test the following two values in TkpDrawEntryBorderAndFocus
+ * to determine whether to use the native entry widget. So if
+ * you change the defaults to be different from these, then you
+ * won't get the native widget by default.
+ */
+
+#define MAC_OSX_FOCUS_WIDTH 3
+#define MAC_OSX_ENTRY_BORDER 2
+#define MAC_OSX_ENTRY_RELIEF TK_RELIEF_SUNKEN
+#define MAC_OSX_ENTRY_SELECT_RELIEF TK_RELIEF_FLAT
+
+#define DEF_ENTRY_BG_COLOR NORMAL_BG
+#define DEF_ENTRY_BG_MONO WHITE
+#define DEF_ENTRY_BORDER_WIDTH "2"
+#define DEF_ENTRY_CURSOR "xterm"
+#define DEF_ENTRY_DISABLED_BG_COLOR NORMAL_BG
+#define DEF_ENTRY_DISABLED_BG_MONO WHITE
+#define DEF_ENTRY_DISABLED_FG DISABLED
+#define DEF_ENTRY_EXPORT_SELECTION "1"
+#define DEF_ENTRY_FONT "TkTextFont"
+#define DEF_ENTRY_FG BLACK
+#define DEF_ENTRY_HIGHLIGHT_BG NORMAL_BG
+#define DEF_ENTRY_HIGHLIGHT BLACK
+/* #define DEF_ENTRY_HIGHLIGHT_WIDTH "3" */
+#define DEF_ENTRY_HIGHLIGHT_WIDTH "3"
+#define DEF_ENTRY_INSERT_BG BLACK
+#define DEF_ENTRY_INSERT_BD_COLOR "0"
+#define DEF_ENTRY_INSERT_BD_MONO "0"
+#define DEF_ENTRY_INSERT_OFF_TIME "300"
+#define DEF_ENTRY_INSERT_ON_TIME "600"
+/* #define DEF_ENTRY_INSERT_WIDTH "2" */
+#define DEF_ENTRY_INSERT_WIDTH "1"
+#define DEF_ENTRY_JUSTIFY "left"
+#define DEF_ENTRY_READONLY_BG_COLOR NORMAL_BG
+#define DEF_ENTRY_READONLY_BG_MONO WHITE
+#define DEF_ENTRY_RELIEF "sunken"
+/* #define DEF_ENTRY_RELIEF "solid" */
+#define DEF_ENTRY_SCROLL_COMMAND ""
+#define DEF_ENTRY_SELECT_COLOR SELECT_BG
+#define DEF_ENTRY_SELECT_MONO BLACK
+#define DEF_ENTRY_SELECT_BD_COLOR "1"
+#define DEF_ENTRY_SELECT_BD_MONO "0"
+#define DEF_ENTRY_SELECT_FG_COLOR SELECT_FG
+#define DEF_ENTRY_SELECT_FG_MONO WHITE
+#define DEF_ENTRY_SHOW ((char *) NULL)
+#define DEF_ENTRY_STATE "normal"
+#define DEF_ENTRY_TAKE_FOCUS ((char *) NULL)
+#define DEF_ENTRY_TEXT_VARIABLE ""
+#define DEF_ENTRY_WIDTH "20"
+
+/*
+ * Defaults for frames:
+ */
+
+#define DEF_FRAME_BG_COLOR NORMAL_BG
+#define DEF_FRAME_BG_MONO WHITE
+#define DEF_FRAME_BORDER_WIDTH "0"
+#define DEF_FRAME_CLASS "Frame"
+#define DEF_FRAME_COLORMAP ""
+#define DEF_FRAME_CONTAINER "0"
+#define DEF_FRAME_CURSOR ""
+#define DEF_FRAME_HEIGHT "0"
+#define DEF_FRAME_HIGHLIGHT_BG NORMAL_BG
+#define DEF_FRAME_HIGHLIGHT BLACK
+#define DEF_FRAME_HIGHLIGHT_WIDTH "0"
+#define DEF_FRAME_PADX "0"
+#define DEF_FRAME_PADY "0"
+#define DEF_FRAME_RELIEF "flat"
+#define DEF_FRAME_TAKE_FOCUS "0"
+#define DEF_FRAME_VISUAL ""
+#define DEF_FRAME_WIDTH "0"
+
+/*
+ * Defaults for labelframes:
+ */
+
+#define DEF_LABELFRAME_BORDER_WIDTH "2"
+#define DEF_LABELFRAME_CLASS "Labelframe"
+#define DEF_LABELFRAME_RELIEF "groove"
+#define DEF_LABELFRAME_FG "systemButtonText"
+#define DEF_LABELFRAME_FONT "TkDefaultFont"
+#define DEF_LABELFRAME_TEXT ""
+#define DEF_LABELFRAME_LABELANCHOR "nw"
+
+/*
+ * Defaults for listboxes:
+ */
+
+#define DEF_LISTBOX_ACTIVE_STYLE "dotbox"
+#define DEF_LISTBOX_BG_COLOR WHITE
+#define DEF_LISTBOX_BG_MONO WHITE
+#define DEF_LISTBOX_BORDER_WIDTH "1"
+#define DEF_LISTBOX_CURSOR ""
+#define DEF_LISTBOX_DISABLED_FG DISABLED
+#define DEF_LISTBOX_EXPORT_SELECTION "1"
+#define DEF_LISTBOX_FONT "TkTextFont"
+#define DEF_LISTBOX_FG BLACK
+#define DEF_LISTBOX_HEIGHT "10"
+#define DEF_LISTBOX_HIGHLIGHT_BG NORMAL_BG
+#define DEF_LISTBOX_HIGHLIGHT BLACK
+#define DEF_LISTBOX_HIGHLIGHT_WIDTH "0"
+#define DEF_LISTBOX_RELIEF "solid"
+#define DEF_LISTBOX_SCROLL_COMMAND ""
+#define DEF_LISTBOX_LIST_VARIABLE ""
+#define DEF_LISTBOX_SELECT_COLOR SELECT_BG
+#define DEF_LISTBOX_SELECT_MONO BLACK
+#define DEF_LISTBOX_SELECT_BD "0"
+#define DEF_LISTBOX_SELECT_FG_COLOR SELECT_FG
+#define DEF_LISTBOX_SELECT_FG_MONO WHITE
+#define DEF_LISTBOX_SELECT_MODE "browse"
+#define DEF_LISTBOX_SET_GRID "0"
+#define DEF_LISTBOX_STATE "normal"
+#define DEF_LISTBOX_TAKE_FOCUS ((char *) NULL)
+#define DEF_LISTBOX_WIDTH "20"
+
+/*
+ * Defaults for individual entries of menus:
+ */
+
+#define DEF_MENU_ENTRY_ACTIVE_BG ((char *) NULL)
+#define DEF_MENU_ENTRY_ACTIVE_FG ((char *) NULL)
+#define DEF_MENU_ENTRY_ACCELERATOR ((char *) NULL)
+#define DEF_MENU_ENTRY_BG ((char *) NULL)
+#define DEF_MENU_ENTRY_BITMAP None
+#define DEF_MENU_ENTRY_COLUMN_BREAK "0"
+#define DEF_MENU_ENTRY_COMMAND ((char *) NULL)
+#define DEF_MENU_ENTRY_COMPOUND "none"
+#define DEF_MENU_ENTRY_FG ((char *) NULL)
+#define DEF_MENU_ENTRY_FONT ((char *) NULL)
+#define DEF_MENU_ENTRY_HIDE_MARGIN "0"
+#define DEF_MENU_ENTRY_IMAGE ((char *) NULL)
+#define DEF_MENU_ENTRY_INDICATOR "1"
+#define DEF_MENU_ENTRY_LABEL ((char *) NULL)
+#define DEF_MENU_ENTRY_MENU ((char *) NULL)
+#define DEF_MENU_ENTRY_OFF_VALUE "0"
+#define DEF_MENU_ENTRY_ON_VALUE "1"
+#define DEF_MENU_ENTRY_SELECT_IMAGE ((char *) NULL)
+#define DEF_MENU_ENTRY_STATE "normal"
+#define DEF_MENU_ENTRY_VALUE ((char *) NULL)
+#define DEF_MENU_ENTRY_CHECK_VARIABLE ((char *) NULL)
+#define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton"
+#define DEF_MENU_ENTRY_SELECT ((char *) NULL)
+#define DEF_MENU_ENTRY_UNDERLINE "-1"
+
+/*
+ * Defaults for menus overall:
+ */
+
+#define DEF_MENU_ACTIVE_BG_COLOR "systemMenuActive"
+#define DEF_MENU_ACTIVE_BG_MONO BLACK
+#define DEF_MENU_ACTIVE_BORDER_WIDTH "0"
+#define DEF_MENU_ACTIVE_FG_COLOR "systemMenuActiveText"
+#define DEF_MENU_ACTIVE_FG_MONO WHITE
+#define DEF_MENU_BG_COLOR "systemMenu"
+#define DEF_MENU_BG_MONO WHITE
+#define DEF_MENU_BORDER_WIDTH "0"
+#define DEF_MENU_CURSOR "arrow"
+#define DEF_MENU_DISABLED_FG_COLOR "systemMenuDisabled"
+#define DEF_MENU_DISABLED_FG_MONO ""
+#define DEF_MENU_FONT "menu" /* special: see tkMacOSXMenu.c */
+#define DEF_MENU_FG "systemMenuText"
+#define DEF_MENU_POST_COMMAND ""
+#define DEF_MENU_RELIEF "flat"
+#define DEF_MENU_SELECT_COLOR "systemMenuActive"
+#define DEF_MENU_SELECT_MONO BLACK
+#define DEF_MENU_TAKE_FOCUS "0"
+
+/*
+ * FIXME: Turn the default back to 1 when we make tearoff menus work again.
+ */
+
+#define DEF_MENU_TEAROFF "0"
+#define DEF_MENU_TEAROFF_CMD ((char *) NULL)
+#define DEF_MENU_TITLE ""
+#define DEF_MENU_TYPE "normal"
+
+/*
+ * Defaults for menubuttons:
+ */
+
+#define DEF_MENUBUTTON_ANCHOR "center"
+#define DEF_MENUBUTTON_ACTIVE_BG_COLOR ACTIVE_BG
+#define DEF_MENUBUTTON_ACTIVE_BG_MONO BLACK
+#define DEF_MENUBUTTON_ACTIVE_FG_COLOR ACTIVE_FG
+#define DEF_MENUBUTTON_ACTIVE_FG_MONO WHITE
+#define DEF_MENUBUTTON_BG_COLOR NORMAL_BG
+#define DEF_MENUBUTTON_BG_MONO WHITE
+#define DEF_MENUBUTTON_BITMAP ""
+#define DEF_MENUBUTTON_BORDER_WIDTH "2"
+#define DEF_MENUBUTTON_CURSOR ""
+#define DEF_MENUBUTTON_DIRECTION "below"
+#define DEF_MENUBUTTON_DISABLED_FG_COLOR DISABLED
+#define DEF_MENUBUTTON_DISABLED_FG_MONO ""
+#define DEF_MENUBUTTON_FONT "TkDefaultFont"
+#define DEF_MENUBUTTON_FG BLACK
+#define DEF_MENUBUTTON_HEIGHT "0"
+#define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR
+#define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO
+#define DEF_MENUBUTTON_HIGHLIGHT BLACK
+#define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0"
+#define DEF_MENUBUTTON_IMAGE ((char *) NULL)
+#define DEF_MENUBUTTON_INDICATOR "0"
+/* #define DEF_MENUBUTTON_JUSTIFY "center" */
+#define DEF_MENUBUTTON_JUSTIFY "left"
+#define DEF_MENUBUTTON_MENU ""
+#define DEF_MENUBUTTON_PADX "4p"
+#define DEF_MENUBUTTON_PADY "3p"
+#define DEF_MENUBUTTON_RELIEF "flat"
+#define DEF_MENUBUTTON_STATE "normal"
+#define DEF_MENUBUTTON_TAKE_FOCUS "0"
+#define DEF_MENUBUTTON_TEXT ""
+#define DEF_MENUBUTTON_TEXT_VARIABLE ""
+#define DEF_MENUBUTTON_UNDERLINE "-1"
+#define DEF_MENUBUTTON_WIDTH "0"
+#define DEF_MENUBUTTON_WRAP_LENGTH "0"
+
+/*
+ * Defaults for messages:
+ */
+
+#define DEF_MESSAGE_ANCHOR "center"
+#define DEF_MESSAGE_ASPECT "150"
+#define DEF_MESSAGE_BG_COLOR NORMAL_BG
+#define DEF_MESSAGE_BG_MONO WHITE
+#define DEF_MESSAGE_BORDER_WIDTH "1"
+#define DEF_MESSAGE_CURSOR ""
+#define DEF_MESSAGE_FG BLACK
+#define DEF_MESSAGE_FONT "TkDefaultFont"
+#define DEF_MESSAGE_HIGHLIGHT_BG NORMAL_BG
+#define DEF_MESSAGE_HIGHLIGHT BLACK
+#define DEF_MESSAGE_HIGHLIGHT_WIDTH "0"
+#define DEF_MESSAGE_JUSTIFY "left"
+#define DEF_MESSAGE_PADX "-1"
+#define DEF_MESSAGE_PADY "-1"
+#define DEF_MESSAGE_RELIEF "flat"
+#define DEF_MESSAGE_TAKE_FOCUS "0"
+#define DEF_MESSAGE_TEXT ""
+#define DEF_MESSAGE_TEXT_VARIABLE ""
+#define DEF_MESSAGE_WIDTH "0"
+/*
+ * Defaults for panedwindows
+ */
+
+#define DEF_PANEDWINDOW_BG_COLOR NORMAL_BG
+#define DEF_PANEDWINDOW_BG_MONO WHITE
+#define DEF_PANEDWINDOW_BORDERWIDTH "1"
+#define DEF_PANEDWINDOW_CURSOR ""
+#define DEF_PANEDWINDOW_HANDLEPAD "8"
+#define DEF_PANEDWINDOW_HANDLESIZE "8"
+#define DEF_PANEDWINDOW_HEIGHT ""
+#define DEF_PANEDWINDOW_OPAQUERESIZE "1"
+#define DEF_PANEDWINDOW_ORIENT "horizontal"
+#define DEF_PANEDWINDOW_RELIEF "flat"
+#define DEF_PANEDWINDOW_SASHCURSOR ""
+#define DEF_PANEDWINDOW_SASHPAD "0"
+#define DEF_PANEDWINDOW_SASHRELIEF "flat"
+#define DEF_PANEDWINDOW_SASHWIDTH "3"
+#define DEF_PANEDWINDOW_SHOWHANDLE "0"
+#define DEF_PANEDWINDOW_WIDTH ""
+
+/*
+ * Defaults for panedwindow panes
+ */
+
+#define DEF_PANEDWINDOW_PANE_AFTER ""
+#define DEF_PANEDWINDOW_PANE_BEFORE ""
+#define DEF_PANEDWINDOW_PANE_HEIGHT ""
+#define DEF_PANEDWINDOW_PANE_MINSIZE "0"
+#define DEF_PANEDWINDOW_PANE_PADX "0"
+#define DEF_PANEDWINDOW_PANE_PADY "0"
+#define DEF_PANEDWINDOW_PANE_STICKY "nsew"
+#define DEF_PANEDWINDOW_PANE_WIDTH ""
+#define DEF_PANEDWINDOW_PANE_HIDE "0"
+#define DEF_PANEDWINDOW_PANE_STRETCH "last"
+
+/*
+ * Defaults for scales:
+ */
+
+#define DEF_SCALE_ACTIVE_BG_COLOR ACTIVE_BG
+#define DEF_SCALE_ACTIVE_BG_MONO BLACK
+#define DEF_SCALE_BG_COLOR NORMAL_BG
+#define DEF_SCALE_BG_MONO WHITE
+#define DEF_SCALE_BIG_INCREMENT "0"
+#define DEF_SCALE_BORDER_WIDTH "1"
+#define DEF_SCALE_COMMAND ""
+#define DEF_SCALE_CURSOR ""
+#define DEF_SCALE_DIGITS "0"
+#define DEF_SCALE_FONT "TkDefaultFont"
+#define DEF_SCALE_FG_COLOR BLACK
+#define DEF_SCALE_FG_MONO BLACK
+#define DEF_SCALE_FROM "0"
+#define DEF_SCALE_HIGHLIGHT_BG_COLOR DEF_SCALE_BG_COLOR
+#define DEF_SCALE_HIGHLIGHT_BG_MONO DEF_SCALE_BG_MONO
+#define DEF_SCALE_HIGHLIGHT BLACK
+#define DEF_SCALE_HIGHLIGHT_WIDTH "0"
+#define DEF_SCALE_LABEL ""
+#define DEF_SCALE_LENGTH "100"
+#define DEF_SCALE_ORIENT "vertical"
+#define DEF_SCALE_RELIEF "flat"
+#define DEF_SCALE_REPEAT_DELAY "300"
+#define DEF_SCALE_REPEAT_INTERVAL "100"
+#define DEF_SCALE_RESOLUTION "1"
+#define DEF_SCALE_TROUGH_COLOR TROUGH
+#define DEF_SCALE_TROUGH_MONO WHITE
+#define DEF_SCALE_SHOW_VALUE "1"
+#define DEF_SCALE_SLIDER_LENGTH "30"
+#define DEF_SCALE_SLIDER_RELIEF "raised"
+#define DEF_SCALE_STATE "normal"
+#define DEF_SCALE_TAKE_FOCUS ((char *) NULL)
+#define DEF_SCALE_TICK_INTERVAL "0"
+#define DEF_SCALE_TO "100"
+#define DEF_SCALE_VARIABLE ""
+#define DEF_SCALE_WIDTH "15"
+
+/*
+ * Defaults for scrollbars:
+ */
+
+#define DEF_SCROLLBAR_ACTIVE_BG_COLOR ACTIVE_BG
+#define DEF_SCROLLBAR_ACTIVE_BG_MONO BLACK
+#define DEF_SCROLLBAR_ACTIVE_RELIEF "raised"
+#define DEF_SCROLLBAR_BG_COLOR NORMAL_BG
+#define DEF_SCROLLBAR_BG_MONO WHITE
+#define DEF_SCROLLBAR_BORDER_WIDTH "0"
+#define DEF_SCROLLBAR_COMMAND ""
+#define DEF_SCROLLBAR_CURSOR ""
+#define DEF_SCROLLBAR_EL_BORDER_WIDTH "-1"
+#define DEF_SCROLLBAR_HIGHLIGHT_BG NORMAL_BG
+#define DEF_SCROLLBAR_HIGHLIGHT BLACK
+#define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0"
+#define DEF_SCROLLBAR_JUMP "0"
+#define DEF_SCROLLBAR_ORIENT "vertical"
+#define DEF_SCROLLBAR_RELIEF "flat"
+#define DEF_SCROLLBAR_REPEAT_DELAY "300"
+#define DEF_SCROLLBAR_REPEAT_INTERVAL "100"
+#define DEF_SCROLLBAR_TAKE_FOCUS ((char *) NULL)
+#define DEF_SCROLLBAR_TROUGH_COLOR TROUGH
+#define DEF_SCROLLBAR_TROUGH_MONO WHITE
+#define DEF_SCROLLBAR_WIDTH "15"
+
+/*
+ * Defaults for texts:
+ */
+
+#define DEF_TEXT_AUTO_SEPARATORS "1"
+#define DEF_TEXT_BG_COLOR NORMAL_BG
+#define DEF_TEXT_BG_MONO WHITE
+#define DEF_TEXT_BLOCK_CURSOR "0"
+#define DEF_TEXT_BORDER_WIDTH "0"
+#define DEF_TEXT_CURSOR "xterm"
+#define DEF_TEXT_FG BLACK
+#define DEF_TEXT_EXPORT_SELECTION "1"
+#define DEF_TEXT_FONT "TkFixedFont"
+#define DEF_TEXT_HEIGHT "24"
+#define DEF_TEXT_HIGHLIGHT_BG NORMAL_BG
+#define DEF_TEXT_HIGHLIGHT BLACK
+#define DEF_TEXT_HIGHLIGHT_WIDTH "3"
+#define DEF_TEXT_INSERT_BG BLACK
+#define DEF_TEXT_INSERT_BD_COLOR "0"
+#define DEF_TEXT_INSERT_BD_MONO "0"
+#define DEF_TEXT_INSERT_OFF_TIME "300"
+#define DEF_TEXT_INSERT_ON_TIME "600"
+#define DEF_TEXT_INSERT_UNFOCUSSED "none"
+#define DEF_TEXT_INSERT_WIDTH "1"
+#define DEF_TEXT_MAX_UNDO "0"
+#define DEF_TEXT_PADX "1"
+#define DEF_TEXT_PADY "1"
+#define DEF_TEXT_RELIEF "flat"
+#define DEF_TEXT_INACTIVE_SELECT_COLOR INACTIVE_SELECT_BG
+#define DEF_TEXT_SELECT_COLOR SELECT_BG
+#define DEF_TEXT_SELECT_MONO BLACK
+#define DEF_TEXT_SELECT_BD_COLOR "1"
+#define DEF_TEXT_SELECT_BD_MONO "0"
+#define DEF_TEXT_SELECT_FG_COLOR SELECT_FG
+#define DEF_TEXT_SELECT_FG_MONO WHITE
+#define DEF_TEXT_SELECT_RELIEF "flat"
+#define DEF_TEXT_SET_GRID "0"
+#define DEF_TEXT_SPACING1 "0"
+#define DEF_TEXT_SPACING2 "0"
+#define DEF_TEXT_SPACING3 "0"
+#define DEF_TEXT_STATE "normal"
+#define DEF_TEXT_TABS ""
+#define DEF_TEXT_TABSTYLE "tabular"
+#define DEF_TEXT_TAKE_FOCUS ((char *) NULL)
+#define DEF_TEXT_UNDO "0"
+#define DEF_TEXT_WIDTH "80"
+#define DEF_TEXT_WRAP "char"
+#define DEF_TEXT_XSCROLL_COMMAND ""
+#define DEF_TEXT_YSCROLL_COMMAND ""
+
+/*
+ * Defaults for canvas text:
+ */
+
+#define DEF_CANVTEXT_FONT "TkDefaultFont"
+
+/*
+ * Defaults for toplevels (most of the defaults for frames also apply
+ * to toplevels):
+ */
+
+#define DEF_TOPLEVEL_CLASS "Toplevel"
+#define DEF_TOPLEVEL_MENU ""
+#define DEF_TOPLEVEL_SCREEN ""
+#define DEF_TOPLEVEL_USE ""
+
+/*
+ * Defaults for busy windows (not really used yet):
+ */
+
+#define DEF_BUSY_CURSOR "watch"
+
+#endif /* _TKMACDEFAULT */
diff --git a/carbon/tkMacOSXDialog.c b/carbon/tkMacOSXDialog.c
new file mode 100644
index 0000000..8097f2c
--- /dev/null
+++ b/carbon/tkMacOSXDialog.c
@@ -0,0 +1,2316 @@
+/*
+ * tkMacOSXDialog.c --
+ *
+ * Contains the Mac implementation of the common dialog boxes.
+ *
+ * Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2008 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkFileFilter.h"
+
+#ifndef StrLength
+#define StrLength(s) (*((unsigned char *) (s)))
+#endif
+#ifndef StrBody
+#define StrBody(s) ((char *) (s) + 1)
+#endif
+
+#define OPEN_POPUP_ITEM 10
+
+#define SAVE_FILE 0
+#define OPEN_FILE 1
+#define CHOOSE_FOLDER 2
+
+#define MATCHED 0
+#define UNMATCHED 1
+
+#define TK_DEFAULT_ABOUT 128
+
+/*
+ * The following structures are used in the GetFileName() function. They store
+ * information about the file dialog and the file filters.
+ */
+
+typedef struct _OpenFileData {
+ FileFilterList fl; /* List of file filters. */
+ SInt16 curType; /* The filetype currently being listed. */
+ short initialType; /* Type to use initially */
+ short popupItem; /* Item number of the popup in the dialog. */
+ short usePopup; /* True if we show the popup menu (this */
+ /* is an open operation and the */
+ /* -filetypes option is set). */
+} OpenFileData;
+
+typedef struct NavHandlerUserData {
+ OpenFileData *ofdPtr;
+ NavReplyRecord reply;
+ OSStatus err;
+ CFStringRef saveNameRef;
+ int sheet;
+ WindowRef dialogWindow, origUnavailWindow;
+ WindowModality origModality;
+} NavHandlerUserData;
+
+/*
+ * The following structure is used in the tk_messageBox implementation.
+ */
+
+typedef struct {
+ int buttonIndex;
+ WindowRef dialogWindow, origUnavailWindow;
+ WindowModality origModality;
+ EventHandlerRef handlerRef;
+} AlertHandlerUserData;
+
+
+static OSStatus AlertHandler(EventHandlerCallRef callRef,
+ EventRef eventRef, void *userData);
+static Boolean MatchOneType(StringPtr fileNamePtr, OSType fileType,
+ OpenFileData *myofdPtr, FileFilter *filterPtr);
+static pascal Boolean OpenFileFilterProc(AEDesc* theItem, void* info,
+ NavCallBackUserData callBackUD,
+ NavFilterModes filterMode);
+static pascal void OpenEventProc(NavEventCallbackMessage callBackSelector,
+ NavCBRecPtr callBackParms,
+ NavCallBackUserData callBackUD);
+static void InitFileDialogs(void);
+static int NavServicesGetFile(Tcl_Interp *interp,
+ OpenFileData *ofd, AEDesc *initialDescPtr,
+ char *initialFile, AEDescList *selectDescPtr,
+ CFStringRef title, CFStringRef message,
+ const char *initialType, int multiple,
+ int confirmOverwrite, int isOpen,
+ Tk_Window parent);
+static int HandleInitialDirectory(Tcl_Interp *interp,
+ char *initialFile, char *initialDir, FSRef *dirRef,
+ AEDescList *selectDescPtr, AEDesc *dirDescPtr);
+
+/*
+ * Have we initialized the file dialog subsystem
+ */
+
+static int fileDlgInited = 0;
+
+/*
+ * Filter and hook functions used by the tk_getOpenFile and tk_getSaveFile
+ * commands.
+ */
+
+static NavObjectFilterUPP openFileFilterUPP;
+static NavEventUPP openFileEventUPP;
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_ChooseColorObjCmd --
+ *
+ * This procedure implements the color dialog box for the Mac platform.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+Tk_ChooseColorObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+{
+ OSStatus err;
+ int result = TCL_ERROR;
+ Tk_Window parent, tkwin = clientData;
+ const char *title;
+ int i, srcRead, dstWrote;
+ CMProfileRef prof;
+ NColorPickerInfo cpinfo;
+ static RGBColor color = {0xffff, 0xffff, 0xffff};
+ static const char *const optionStrings[] = {
+ "-initialcolor", "-parent", "-title", NULL
+ };
+ enum options {
+ COLOR_INITIAL, COLOR_PARENT, COLOR_TITLE
+ };
+
+ title = "Choose a color:";
+ bzero(&cpinfo, sizeof(cpinfo));
+ cpinfo.theColor.color.rgb.red = color.red;
+ cpinfo.theColor.color.rgb.green = color.green;
+ cpinfo.theColor.color.rgb.blue = color.blue;
+
+ for (i = 1; i < objc; i += 2) {
+ int index;
+ const char *option, *value;
+
+ if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option",
+ TCL_EXACT, &index) != TCL_OK) {
+ goto end;
+ }
+ if (i + 1 == objc) {
+ option = Tcl_GetString(objv[i]);
+ Tcl_AppendResult(interp, "value for \"", option, "\" missing",
+ NULL);
+ goto end;
+ }
+ value = Tcl_GetString(objv[i + 1]);
+
+ switch ((enum options) index) {
+ case COLOR_INITIAL: {
+ XColor *colorPtr;
+
+ colorPtr = Tk_GetColor(interp, tkwin, value);
+ if (colorPtr == NULL) {
+ goto end;
+ }
+ cpinfo.theColor.color.rgb.red = colorPtr->red;
+ cpinfo.theColor.color.rgb.green = colorPtr->green;
+ cpinfo.theColor.color.rgb.blue = colorPtr->blue;
+ Tk_FreeColor(colorPtr);
+ break;
+ }
+ case COLOR_PARENT: {
+ parent = Tk_NameToWindow(interp, value, tkwin);
+ if (parent == NULL) {
+ goto end;
+ }
+ break;
+ }
+ case COLOR_TITLE: {
+ title = value;
+ break;
+ }
+ }
+ }
+
+ ChkErr(CMGetDefaultProfileBySpace, cmRGBData, &prof);
+ cpinfo.theColor.profile = prof;
+ cpinfo.dstProfile = prof;
+ cpinfo.flags = kColorPickerDialogIsMoveable | kColorPickerDialogIsModal;
+ cpinfo.placeWhere = kCenterOnMainScreen;
+ /* Currently, this does not actually change the colorpicker title */
+ Tcl_UtfToExternal(NULL, TkMacOSXCarbonEncoding, title, -1, 0, NULL,
+ StrBody(cpinfo.prompt), 255, &srcRead, &dstWrote, NULL);
+ StrLength(cpinfo.prompt) = (unsigned char) dstWrote;
+
+ TkMacOSXTrackingLoop(1);
+ err = ChkErr(NPickColor, &cpinfo);
+ TkMacOSXTrackingLoop(0);
+ ChkErr(CMCloseProfile, prof);
+ if ((err == noErr) && (cpinfo.newColorChosen != 0)) {
+ char colorstr[8];
+
+ color.red = cpinfo.theColor.color.rgb.red;
+ color.green = cpinfo.theColor.color.rgb.green;
+ color.blue = cpinfo.theColor.color.rgb.blue;
+ snprintf(colorstr, 8, "#%02x%02x%02x", color.red >> 8,
+ color.green >> 8, color.blue >> 8);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(colorstr, 7));
+ } else {
+ Tcl_ResetResult(interp);
+ }
+ result = TCL_OK;
+
+ end:
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_GetOpenFileObjCmd --
+ *
+ * This procedure implements the "open file" dialog box for the Mac
+ * platform. See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See user documentation.
+ *----------------------------------------------------------------------
+ */
+
+int
+Tk_GetOpenFileObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+{
+ int i, result = TCL_ERROR, multiple = 0;
+ OpenFileData ofd;
+ Tk_Window parent = NULL;
+ CFStringRef message = NULL, title = NULL;
+ AEDesc initialDesc = {typeNull, NULL};
+ FSRef dirRef;
+ AEDesc *initialPtr = NULL;
+ AEDescList selectDesc = {typeNull, NULL};
+ char *initialFile = NULL, *initialDir = NULL;
+ Tcl_Obj *typeVariablePtr = NULL;
+ const char *initialtype = NULL;
+ static const char *const openOptionStrings[] = {
+ "-defaultextension", "-filetypes", "-initialdir", "-initialfile",
+ "-message", "-multiple", "-parent", "-title", "-typevariable", NULL
+ };
+ enum openOptions {
+ OPEN_DEFAULT, OPEN_FILETYPES, OPEN_INITDIR, OPEN_INITFILE,
+ OPEN_MESSAGE, OPEN_MULTIPLE, OPEN_PARENT, OPEN_TITLE,
+ OPEN_TYPEVARIABLE,
+ };
+
+ if (!fileDlgInited) {
+ InitFileDialogs();
+ }
+ TkInitFileFilters(&ofd.fl);
+ ofd.curType = 0;
+ ofd.initialType = -1;
+ ofd.popupItem = OPEN_POPUP_ITEM;
+ ofd.usePopup = 1;
+
+ for (i = 1; i < objc; i += 2) {
+ char *choice;
+ int index, choiceLen;
+ char *string;
+ Tcl_Obj *types;
+
+ if (Tcl_GetIndexFromObj(interp, objv[i], openOptionStrings, "option",
+ TCL_EXACT, &index) != TCL_OK) {
+ goto end;
+ }
+ if (i + 1 == objc) {
+ string = Tcl_GetString(objv[i]);
+ Tcl_AppendResult(interp, "value for \"", string, "\" missing",
+ NULL);
+ goto end;
+ }
+
+ switch (index) {
+ case OPEN_DEFAULT:
+ break;
+ case OPEN_FILETYPES:
+ types = objv[i + 1];
+ if (TkGetFileFilters(interp, &ofd.fl, types, 0) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case OPEN_INITDIR:
+ initialDir = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ /* empty strings should be like no selection given */
+ if (choiceLen == 0) {
+ initialDir = NULL;
+ }
+ break;
+ case OPEN_INITFILE:
+ initialFile = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ /* empty strings should be like no selection given */
+ if (choiceLen == 0) {
+ initialFile = NULL;
+ }
+ break;
+ case OPEN_MESSAGE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (message) {
+ CFRelease(message);
+ }
+ message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ case OPEN_MULTIPLE:
+ if (Tcl_GetBooleanFromObj(interp, objv[i + 1],
+ &multiple) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case OPEN_PARENT:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ parent = Tk_NameToWindow(interp, choice, clientData);
+ if (parent == NULL) {
+ goto end;
+ }
+ break;
+ case OPEN_TITLE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (title) {
+ CFRelease(title);
+ }
+ title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ case OPEN_TYPEVARIABLE:
+ typeVariablePtr = objv[i + 1];
+ break;
+ }
+ }
+
+ if (HandleInitialDirectory(interp, initialFile, initialDir, &dirRef,
+ &selectDesc, &initialDesc) != TCL_OK) {
+ goto end;
+ }
+ if (initialDesc.descriptorType == typeFSRef) {
+ initialPtr = &initialDesc;
+ }
+ if (typeVariablePtr) {
+ initialtype = Tcl_GetVar(interp, Tcl_GetString(typeVariablePtr), 0);
+ }
+ result = NavServicesGetFile(interp, &ofd, initialPtr, NULL, &selectDesc,
+ title, message, initialtype, multiple, false, OPEN_FILE, parent);
+
+ if (typeVariablePtr) {
+ FileFilter *filterPtr = ofd.fl.filters;
+ int i = ofd.curType;
+
+ while (filterPtr && i-- > 0) {
+ filterPtr = filterPtr->next;
+ }
+ Tcl_SetVar(interp, Tcl_GetString(typeVariablePtr), filterPtr ?
+ filterPtr->name : "", 0);
+ }
+
+ end:
+ TkFreeFileFilters(&ofd.fl);
+ if (initialDesc.dataHandle) {
+ ChkErr(AEDisposeDesc, &initialDesc);
+ }
+ if (selectDesc.dataHandle) {
+ ChkErr(AEDisposeDesc, &selectDesc);
+ }
+ if (title) {
+ CFRelease(title);
+ }
+ if (message) {
+ CFRelease(message);
+ }
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_GetSaveFileObjCmd --
+ *
+ * Same as Tk_GetOpenFileCmd but opens a "save file" dialog box instead.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See user documentation.
+ *----------------------------------------------------------------------
+ */
+
+int
+Tk_GetSaveFileObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+{
+ int i, result = TCL_ERROR;
+ int confirmOverwrite = 1;
+ char *initialFile = NULL;
+ Tk_Window parent = NULL;
+ AEDesc initialDesc = {typeNull, NULL};
+ AEDesc *initialPtr = NULL;
+ FSRef dirRef;
+ CFStringRef title = NULL, message = NULL;
+ OpenFileData ofd;
+ static const char *const saveOptionStrings[] = {
+ "-defaultextension", "-filetypes", "-initialdir", "-initialfile",
+ "-message", "-parent", "-title", "-typevariable",
+ "-confirmoverwrite", NULL
+ };
+ enum saveOptions {
+ SAVE_DEFAULT, SAVE_FILETYPES, SAVE_INITDIR, SAVE_INITFILE,
+ SAVE_MESSAGE, SAVE_PARENT, SAVE_TITLE, SAVE_TYPEVARIABLE,
+ SAVE_CONFIRMOW
+ };
+
+ if (!fileDlgInited) {
+ InitFileDialogs();
+ }
+
+ TkInitFileFilters(&ofd.fl);
+ ofd.curType = 0;
+ ofd.usePopup = 0;
+
+ for (i = 1; i < objc; i += 2) {
+ char *choice, *string;
+ int index, choiceLen;
+ Tcl_Obj *types;
+
+ if (Tcl_GetIndexFromObj(interp, objv[i], saveOptionStrings, "option",
+ TCL_EXACT, &index) != TCL_OK) {
+ goto end;
+ }
+ if (i + 1 == objc) {
+ string = Tcl_GetString(objv[i]);
+ Tcl_AppendResult(interp, "value for \"", string, "\" missing",
+ NULL);
+ goto end;
+ }
+ switch (index) {
+ case SAVE_DEFAULT:
+ break;
+ case SAVE_FILETYPES:
+ types = objv[i + 1];
+ if (TkGetFileFilters(interp, &ofd.fl, types, 0) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case SAVE_INITDIR:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ /* empty strings should be like no selection given */
+ if (choiceLen && HandleInitialDirectory(interp, NULL, choice,
+ &dirRef, NULL, &initialDesc) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case SAVE_INITFILE:
+ initialFile = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ /* empty strings should be like no selection given */
+ if (choiceLen == 0) {
+ initialFile = NULL;
+ }
+ break;
+ case SAVE_MESSAGE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (message) {
+ CFRelease(message);
+ }
+ message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ case SAVE_PARENT:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ parent = Tk_NameToWindow(interp, choice, (Tk_Window) clientData);
+ if (parent == NULL) {
+ goto end;
+ }
+ break;
+ case SAVE_TITLE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (title) {
+ CFRelease(title);
+ }
+ title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ case SAVE_CONFIRMOW:
+ if (Tcl_GetBooleanFromObj(interp, objv[i + 1], &confirmOverwrite)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ }
+ }
+
+ if (initialDesc.descriptorType == typeFSRef) {
+ initialPtr = &initialDesc;
+ }
+ result = NavServicesGetFile(interp, &ofd, initialPtr, initialFile, NULL,
+ title, message, NULL, false, confirmOverwrite, SAVE_FILE, parent);
+ TkFreeFileFilters(&ofd.fl);
+ end:
+ if (initialDesc.dataHandle) {
+ ChkErr(AEDisposeDesc, &initialDesc);
+ }
+ if (title) {
+ CFRelease(title);
+ }
+ if (message) {
+ CFRelease(message);
+ }
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_ChooseDirectoryObjCmd --
+ *
+ * This procedure implements the "tk_chooseDirectory" dialog box for the
+ * MacOS X platform. See the user documentation for details on what it
+ * does.
+ *
+ * Results:
+ * See user documentation.
+ *
+ * Side effects:
+ * A modal dialog window is created.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+Tk_ChooseDirectoryObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+{
+ int i, result = TCL_ERROR;
+ Tk_Window parent = NULL;
+ AEDesc initialDesc = {typeNull, NULL}, *initialPtr = NULL;
+ FSRef dirRef;
+ CFStringRef message = NULL, title = NULL;
+ OpenFileData ofd;
+ static const char *const chooseOptionStrings[] = {
+ "-initialdir", "-message", "-mustexist", "-parent", "-title", NULL
+ };
+ enum chooseOptions {
+ CHOOSE_INITDIR, CHOOSE_MESSAGE, CHOOSE_MUSTEXIST, CHOOSE_PARENT,
+ CHOOSE_TITLE
+ };
+
+ if (!fileDlgInited) {
+ InitFileDialogs();
+ }
+
+ for (i = 1; i < objc; i += 2) {
+ char *string, *choice;
+ int index, choiceLen;
+
+ if (Tcl_GetIndexFromObj(interp, objv[i], chooseOptionStrings, "option",
+ TCL_EXACT, &index) != TCL_OK) {
+ goto end;
+ }
+ if (i + 1 == objc) {
+ string = Tcl_GetString(objv[i]);
+ Tcl_AppendResult(interp, "value for \"", string, "\" missing",
+ NULL);
+ goto end;
+ }
+ switch (index) {
+ case CHOOSE_INITDIR:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (choiceLen && HandleInitialDirectory(interp, NULL, choice,
+ &dirRef, NULL, &initialDesc) != TCL_OK) {
+ goto end;
+ }
+ break;
+ case CHOOSE_MESSAGE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (message) {
+ CFRelease(message);
+ }
+ message = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ case CHOOSE_PARENT:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ parent = Tk_NameToWindow(interp, choice, clientData);
+ if (parent == NULL) {
+ goto end;
+ }
+ break;
+ case CHOOSE_TITLE:
+ choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
+ if (title) {
+ CFRelease(title);
+ }
+ title = CFStringCreateWithBytes(NULL, (unsigned char *) choice,
+ choiceLen, kCFStringEncodingUTF8, false);
+ break;
+ }
+ }
+
+ TkInitFileFilters(&ofd.fl);
+ ofd.usePopup = 0;
+ if (initialDesc.descriptorType == typeFSRef) {
+ initialPtr = &initialDesc;
+ }
+ result = NavServicesGetFile(interp, &ofd, initialPtr, NULL, NULL, title,
+ message, NULL, false, false, CHOOSE_FOLDER, parent);
+ TkFreeFileFilters(&ofd.fl);
+ end:
+ if (initialDesc.dataHandle) {
+ ChkErr(AEDisposeDesc, &initialDesc);
+ }
+ if (title) {
+ CFRelease(title);
+ }
+ if (message) {
+ CFRelease(message);
+ }
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * HandleInitialDirectory --
+ *
+ * Helper for -initialdir setup.
+ *
+ * Results:
+ * Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+HandleInitialDirectory(
+ Tcl_Interp *interp,
+ char *initialFile,
+ char *initialDir,
+ FSRef *dirRef,
+ AEDescList *selectDescPtr,
+ AEDesc *dirDescPtr)
+{
+ Tcl_DString ds;
+ OSStatus err;
+ Boolean isDirectory;
+ char *dirName = NULL;
+ int result = TCL_ERROR;
+
+ if (initialDir) {
+ dirName = Tcl_TranslateFileName(interp, initialDir, &ds);
+ if (dirName == NULL) {
+ goto end;
+ }
+ err = ChkErr(FSPathMakeRef, (unsigned char *) dirName, dirRef,
+ &isDirectory);
+ if (err != noErr) {
+ Tcl_AppendResult(interp, "bad directory \"", initialDir, "\"",
+ NULL);
+ goto end;
+ }
+ if (!isDirectory) {
+ Tcl_AppendResult(interp, "-intialdir \"", initialDir, "\""
+ " is a file, not a directory.", NULL);
+ goto end;
+ }
+ ChkErr(AECreateDesc, typeFSRef, dirRef, sizeof(*dirRef), dirDescPtr);
+ }
+
+ if (initialFile && selectDescPtr) {
+ FSRef fileRef;
+ AEDesc fileDesc;
+ char *namePtr;
+
+ if (initialDir) {
+ Tcl_DStringAppend(&ds, "/", 1);
+ Tcl_DStringAppend(&ds, initialFile, -1);
+ namePtr = Tcl_DStringValue(&ds);
+ } else {
+ namePtr = initialFile;
+ }
+
+ ChkErr(AECreateList, NULL, 0, false, selectDescPtr);
+
+ err = ChkErr(FSPathMakeRef, (unsigned char *) namePtr, &fileRef,
+ &isDirectory);
+ if (err != noErr) {
+ Tcl_AppendResult(interp, "bad initialfile \"", initialFile,
+ "\" file does not exist.", NULL);
+ goto end;
+ }
+ ChkErr(AECreateDesc, typeFSRef, &fileRef, sizeof(fileRef), &fileDesc);
+ ChkErr(AEPutDesc, selectDescPtr, 1, &fileDesc);
+ ChkErr(AEDisposeDesc, &fileDesc);
+ }
+ result = TCL_OK;
+ end:
+ if (dirName) {
+ Tcl_DStringFree(&ds);
+ }
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * InitFileDialogs --
+ *
+ * Initialize file dialog subsystem.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+InitFileDialogs(void)
+{
+ fileDlgInited = 1;
+ openFileFilterUPP = NewNavObjectFilterUPP(OpenFileFilterProc);
+ openFileEventUPP = NewNavEventUPP(OpenEventProc);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * NavServicesGetFile --
+ *
+ * Common wrapper for NavServices API.
+ *
+ * Results:
+ * Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+NavServicesGetFile(
+ Tcl_Interp *interp,
+ OpenFileData *ofdPtr,
+ AEDesc *initialDescPtr,
+ char *initialFile,
+ AEDescList *selectDescPtr,
+ CFStringRef title,
+ CFStringRef message,
+ const char *initialtype,
+ int multiple,
+ int confirmOverwrite,
+ int isOpen,
+ Tk_Window parent)
+{
+ NavHandlerUserData data;
+ NavDialogCreationOptions options;
+ NavDialogRef dialogRef = NULL;
+ CFStringRef *menuItemNames = NULL;
+ OSStatus err;
+ Tcl_Obj *theResult = NULL;
+ int result = TCL_ERROR;
+
+ bzero(&data, sizeof(data));
+ err = NavGetDefaultDialogCreationOptions(&options);
+ if (err != noErr) {
+ return result;
+ }
+ options.optionFlags = kNavDontAutoTranslate | kNavDontAddTranslateItems
+ | kNavSupportPackages | kNavAllFilesInPopup;
+ if (multiple) {
+ options.optionFlags |= kNavAllowMultipleFiles;
+ }
+ if (!confirmOverwrite) {
+ options.optionFlags |= kNavDontConfirmReplacement;
+ }
+ options.modality = kWindowModalityAppModal;
+ if (parent && ((TkWindow *) parent)->window != None &&
+ TkMacOSXHostToplevelExists(parent)) {
+ options.parentWindow = TkMacOSXDrawableWindow(Tk_WindowId(parent));
+ TK_IF_HI_TOOLBOX (5,
+ /*
+ * Impossible to modify dialog modality with the Cocoa-based
+ * NavServices implementation.
+ */
+ ) TK_ELSE_HI_TOOLBOX (5,
+ if (options.parentWindow) {
+ options.modality = kWindowModalityWindowModal;
+ data.sheet = 1;
+ }
+ ) TK_ENDIF
+ }
+
+ /*
+ * Now process the selection list. We have to use the popupExtension
+ * to fill the menu.
+ */
+
+ if (ofdPtr && ofdPtr->usePopup) {
+ FileFilter *filterPtr = ofdPtr->fl.filters;
+
+ if (filterPtr == NULL) {
+ ofdPtr->usePopup = 0;
+ }
+ }
+ if (ofdPtr && ofdPtr->usePopup) {
+ FileFilter *filterPtr;
+ int index = 0;
+ ofdPtr->curType = 0;
+
+ menuItemNames =
+ ckalloc(ofdPtr->fl.numFilters * sizeof(CFStringRef));
+
+ for (filterPtr = ofdPtr->fl.filters; filterPtr != NULL;
+ filterPtr = filterPtr->next, index++) {
+ menuItemNames[index] = CFStringCreateWithCString(NULL,
+ filterPtr->name, kCFStringEncodingUTF8);
+ if (initialtype && strcmp(filterPtr->name, initialtype) == 0) {
+ ofdPtr->initialType = index;
+ }
+ }
+ options.popupExtension = CFArrayCreate(NULL,
+ (const void **) menuItemNames, ofdPtr->fl.numFilters, NULL);
+ } else {
+ options.optionFlags |= kNavNoTypePopup;
+ options.popupExtension = NULL;
+ }
+ options.clientName = CFSTR("Wish");
+ options.message = message;
+ options.windowTitle = title;
+ if (initialFile) {
+ options.saveFileName = CFStringCreateWithCString(NULL, initialFile,
+ kCFStringEncodingUTF8);
+ } else {
+ options.saveFileName = NULL;
+ }
+ if (isOpen == OPEN_FILE) {
+ data.ofdPtr = ofdPtr;
+ err = ChkErr(NavCreateGetFileDialog, &options, NULL,
+ openFileEventUPP, NULL, openFileFilterUPP, &data, &dialogRef);
+ } else if (isOpen == SAVE_FILE) {
+ err = ChkErr(NavCreatePutFileDialog, &options, 'TEXT', 'WIsH',
+ openFileEventUPP, &data, &dialogRef);
+ } else if (isOpen == CHOOSE_FOLDER) {
+ err = ChkErr(NavCreateChooseFolderDialog, &options,
+ openFileEventUPP, openFileFilterUPP, &data, &dialogRef);
+ }
+ if (err == noErr && dialogRef) {
+ if (initialDescPtr) {
+ ChkErr(NavCustomControl, dialogRef, kNavCtlSetLocation,
+ initialDescPtr);
+ }
+ if (selectDescPtr && selectDescPtr->descriptorType != typeNull) {
+ ChkErr(NavCustomControl, dialogRef, kNavCtlSetSelection,
+ selectDescPtr);
+ }
+ TkMacOSXTrackingLoop(1);
+ err = ChkErr(NavDialogRun, dialogRef);
+ if (err == noErr) {
+ if (data.sheet) {
+ data.dialogWindow = NavDialogGetWindow(dialogRef);
+ ChkErr(GetWindowModality, data.dialogWindow,
+ &data.origModality, &data.origUnavailWindow);
+ ChkErr(SetWindowModality, data.dialogWindow,
+ kWindowModalityAppModal, NULL);
+ ChkErr(RunAppModalLoopForWindow, data.dialogWindow);
+ }
+ err = data.err;
+ }
+ TkMacOSXTrackingLoop(0);
+ }
+
+ /*
+ * Most commands assume that the file dialogs return a single item, not a
+ * list. So only build a list if multiple is true...
+ */
+
+ if (err == noErr) {
+ if (multiple) {
+ theResult = Tcl_NewListObj(0, NULL);
+ } else {
+ theResult = Tcl_NewObj();
+ }
+ if (!theResult) {
+ err = memFullErr;
+ }
+ }
+ if (err == noErr && data.reply.validRecord) {
+ AEDesc resultDesc;
+ long count, i;
+ FSRef fsRef;
+ char pathPtr[PATH_MAX + 1];
+ char saveName[PATH_MAX + 1];
+
+ err = ChkErr(AECountItems, &data.reply.selection, &count);
+ if (err != noErr) {
+ /*
+ * There was an error when counting the items? Treat as if no
+ * items were chosen.
+ */
+
+ goto installResult;
+ }
+
+ /*
+ * Process the chosen files. This will be one unless -multiple was
+ * specified.
+ */
+
+ for (i = 1; i <= count; i++) {
+ /*
+ * Get the name of the selected file.
+ */
+
+ err = ChkErr(AEGetNthDesc, &data.reply.selection, i,
+ typeFSRef, NULL, &resultDesc);
+ if (err != noErr) {
+ continue;
+ }
+ err = ChkErr(AEGetDescData, &resultDesc, &fsRef, sizeof(fsRef));
+ if (err != noErr) {
+ goto nextFilename;
+ }
+ err = ChkErr(FSRefMakePath, &fsRef, (unsigned char *) pathPtr,
+ PATH_MAX + 1);
+ if (err != noErr) {
+ goto nextFilename;
+ }
+
+ /*
+ * If we're saving the file, we're creating a new filename and
+ * must therefore check whether it is a legal filename (not
+ * exceeding path length limits, etc.)
+ */
+
+ if (isOpen == SAVE_FILE) {
+ if (!data.saveNameRef) {
+ TkMacOSXDbgMsg("NavDialogGetSaveFileName failed");
+ goto nextFilename;
+ }
+
+ if (!CFStringGetCString(data.saveNameRef, saveName,
+ PATH_MAX + 1, kCFStringEncodingUTF8)) {
+ TkMacOSXDbgMsg("CFStringGetCString failed");
+ goto nextFilename;
+ }
+
+ if (strlen(pathPtr) + strlen(saveName) >= PATH_MAX) {
+ TkMacOSXDbgMsg("Path name too long");
+ goto nextFilename;
+ }
+
+ strcat(pathPtr, "/");
+ strcat(pathPtr, saveName);
+ }
+
+ /*
+ * Got a valid file name; put it in the result object.
+ */
+
+ if (multiple) {
+ Tcl_ListObjAppendElement(interp, theResult,
+ Tcl_NewStringObj(pathPtr, -1));
+ } else {
+ Tcl_SetStringObj(theResult, pathPtr, -1);
+ }
+
+ nextFilename:
+ ChkErr(AEDisposeDesc, &resultDesc);
+ }
+
+ installResult:
+ Tcl_SetObjResult(interp, theResult);
+ result = TCL_OK;
+ } else if (err == userCanceledErr) {
+ Tcl_ResetResult(interp);
+ result = TCL_OK;
+ }
+
+ /*
+ * Clean up any allocated memory.
+ */
+
+ if (data.reply.validRecord) {
+ ChkErr(NavDisposeReply, &data.reply);
+ }
+ if (data.saveNameRef) {
+ CFRelease(data.saveNameRef);
+ }
+ if (options.saveFileName) {
+ CFRelease(options.saveFileName);
+ }
+ if (options.clientName) {
+ CFRelease(options.clientName);
+ }
+ if (menuItemNames) {
+ int i;
+
+ for (i = 0; i < ofdPtr->fl.numFilters; i++) {
+ CFRelease(menuItemNames[i]);
+ }
+ ckfree(menuItemNames);
+ }
+ if (options.popupExtension) {
+ CFRelease(options.popupExtension);
+ }
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * OpenEventProc --
+ *
+ * NavServices event handling callback.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+pascal void
+OpenEventProc(
+ NavEventCallbackMessage callBackSelector,
+ NavCBRecPtr callBackParams,
+ NavCallBackUserData callBackUD)
+{
+ NavHandlerUserData *data = (NavHandlerUserData*) callBackUD;
+ OpenFileData *ofd = data->ofdPtr;
+
+ switch (callBackSelector) {
+ case kNavCBStart:
+ if (ofd && ofd->initialType >= 0) {
+ /* Select initial filter */
+ FileFilter *filterPtr = ofd->fl.filters;
+ int i = ofd->initialType;
+
+ while (filterPtr && i-- > 0) {
+ filterPtr = filterPtr->next;
+ }
+ if (filterPtr) {
+ NavMenuItemSpec selectItem;
+
+ selectItem.version = kNavMenuItemSpecVersion;
+ selectItem.menuCreator = 0;
+ selectItem.menuType = ofd->initialType;
+ selectItem.menuItemName[0] = strlen(filterPtr->name);
+ strncpy((char *) &selectItem.menuItemName[1],
+ filterPtr->name, 255);
+ ChkErr(NavCustomControl, callBackParams->context,
+ kNavCtlSelectCustomType, &selectItem);
+ }
+ }
+ break;
+ case kNavCBPopupMenuSelect:
+ ofd->curType = ((NavMenuItemSpec *)
+ callBackParams->eventData.eventDataParms.param)->menuType;
+ break;
+ case kNavCBAccept:
+ case kNavCBCancel:
+ if (data->sheet) {
+ ChkErr(QuitAppModalLoopForWindow, data->dialogWindow);
+ ChkErr(SetWindowModality, data->dialogWindow,
+ data->origModality, data->origUnavailWindow);
+ }
+ break;
+ case kNavCBUserAction:
+ if (data->reply.validRecord) {
+ ChkErr(NavDisposeReply, &data->reply);
+ data->reply.validRecord = 0;
+ }
+ data->err = NavDialogGetReply(callBackParams->context,
+ &data->reply);
+ if (callBackParams->userAction == kNavUserActionSaveAs) {
+ data->saveNameRef = NavDialogGetSaveFileName(
+ callBackParams->context);
+ if (data->saveNameRef) {
+ CFRetain(data->saveNameRef);
+ }
+ }
+ break;
+ case kNavCBTerminate:
+ NavDialogDispose(callBackParams->context);
+ break;
+ case kNavCBEvent:
+ TkMacOSXRunTclEventLoop();
+ break;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * OpenFileFilterProc --
+ *
+ * NavServices file filter callback.
+ *
+ * Results:
+ * Whether to use the file in question.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+pascal Boolean
+OpenFileFilterProc(
+ AEDesc *theItem,
+ void *info,
+ NavCallBackUserData callBackUD,
+ NavFilterModes filterMode)
+{
+ OpenFileData *ofdPtr = ((NavHandlerUserData *) callBackUD)->ofdPtr;
+ int result = MATCHED;
+
+ if (ofdPtr && ofdPtr->usePopup && ofdPtr->fl.numFilters > 0 &&
+ ((theItem->descriptorType == typeFSS)
+ || (theItem->descriptorType == typeFSRef))) {
+ NavFileOrFolderInfo *theInfo = info;
+ char fileName[256];
+ OSType fileType;
+ StringPtr fileNamePtr = NULL;
+ Tcl_DString fileNameDString;
+ int i;
+ FileFilter *filterPtr;
+
+ if (!theInfo->isFolder) {
+ fileType = theInfo->fileAndFolder.fileInfo.finderInfo.fdType;
+ Tcl_DStringInit(&fileNameDString);
+
+ if (theItem->descriptorType == typeFSS) {
+ int len;
+
+ fileNamePtr = ((FSSpec *) *theItem->dataHandle)->name;
+ len = fileNamePtr[0];
+ strncpy(fileName, (char *) fileNamePtr + 1, len);
+ fileName[len] = '\0';
+ fileNamePtr = (unsigned char *) fileName;
+ } else if ((theItem->descriptorType == typeFSRef)) {
+ OSStatus err;
+ FSRef *theRef = (FSRef *) *theItem->dataHandle;
+ HFSUniStr255 uniFileName;
+
+ err = ChkErr(FSGetCatalogInfo, theRef, kFSCatInfoNone,
+ NULL, &uniFileName, NULL, NULL);
+
+ if (err == noErr) {
+ Tcl_UniCharToUtfDString((Tcl_UniChar *)uniFileName.unicode,
+ uniFileName.length, &fileNameDString);
+ fileNamePtr = (unsigned char *)
+ Tcl_DStringValue(&fileNameDString);
+ }
+ }
+ if (ofdPtr->usePopup) {
+ i = ofdPtr->curType;
+ for (filterPtr = ofdPtr->fl.filters; filterPtr && i>0; i--) {
+ filterPtr = filterPtr->next;
+ }
+ if (filterPtr) {
+ result = MatchOneType(fileNamePtr, fileType, ofdPtr,
+ filterPtr);
+ } else {
+ result = UNMATCHED;
+ }
+ } else {
+ /*
+ * We are not using the popup menu. In this case, the file is
+ * considered matched if it matches any of the file filters.
+ */
+
+ result = UNMATCHED;
+ for (filterPtr = ofdPtr->fl.filters; filterPtr;
+ filterPtr = filterPtr->next) {
+ if (MatchOneType(fileNamePtr, fileType, ofdPtr,
+ filterPtr) == MATCHED) {
+ result = MATCHED;
+ break;
+ }
+ }
+ }
+ Tcl_DStringFree(&fileNameDString);
+ }
+ }
+ return (result == MATCHED);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MatchOneType --
+ *
+ * Match a file with one file type in the list of file types.
+ *
+ * Results:
+ * Returns MATCHED if the file matches with the file type; returns
+ * UNMATCHED otherwise.
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+Boolean
+MatchOneType(
+ StringPtr fileNamePtr, /* Name of the file */
+ OSType fileType, /* Type of the file, 0 means there was no
+ * specified type. */
+ OpenFileData *ofdPtr, /* Information about this file dialog */
+ FileFilter *filterPtr) /* Match the file described by pb against this
+ * filter */
+{
+ FileFilterClause *clausePtr;
+
+ /*
+ * A file matches with a file type if it matches with at least one clause
+ * of the type.
+ *
+ * If the clause has both glob patterns and ostypes, the file must match
+ * with at least one pattern AND at least one ostype.
+ *
+ * If the clause has glob patterns only, the file must match with at least
+ * one pattern.
+ *
+ * If the clause has mac types only, the file must match with at least one
+ * mac type.
+ *
+ * If the clause has neither glob patterns nor mac types, it's considered
+ * an error.
+ */
+
+ for (clausePtr = filterPtr->clauses; clausePtr;
+ clausePtr = clausePtr->next) {
+ int macMatched = 0;
+ int globMatched = 0;
+ GlobPattern *globPtr;
+ MacFileType *mfPtr;
+
+ if (clausePtr->patterns == NULL) {
+ globMatched = 1;
+ }
+ if (clausePtr->macTypes == NULL) {
+ macMatched = 1;
+ }
+
+ for (globPtr = clausePtr->patterns; globPtr;
+ globPtr = globPtr->next) {
+ char *q, *ext;
+
+ if (fileNamePtr == NULL) {
+ continue;
+ }
+ ext = globPtr->pattern;
+
+ if (ext[0] == '\0') {
+ /*
+ * We don't want any extensions: OK if the filename doesn't
+ * have "." in it
+ */
+
+ for (q = (char*) fileNamePtr; *q; q++) {
+ if (*q == '.') {
+ goto glob_unmatched;
+ }
+ }
+ goto glob_matched;
+ }
+
+ if (Tcl_StringMatch((char*) fileNamePtr, ext)) {
+ goto glob_matched;
+ }
+ glob_unmatched:
+ continue;
+
+ glob_matched:
+ globMatched = 1;
+ break;
+ }
+
+ for (mfPtr = clausePtr->macTypes; mfPtr; mfPtr = mfPtr->next) {
+ if (fileType == mfPtr->type) {
+ macMatched = 1;
+ break;
+ }
+ }
+
+ /*
+ * On Mac OS X, it is not uncommon for files to have NO file type. But
+ * folks with Tcl code on Classic MacOS pretty much assume that a
+ * generic file will have type TEXT. So if we were strict about
+ * matching types when the source file had NO type set, they would
+ * have to add another rule always with no fileType. To avoid that, we
+ * pass the macMatch side of the test if no fileType is set.
+ */
+
+ if (globMatched && (macMatched || (fileType == 0))) {
+ return MATCHED;
+ }
+ }
+
+ return UNMATCHED;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkAboutDlg --
+ *
+ * Displays the default Tk About box. This code uses Macintosh resources
+ * to define the content of the About Box.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkAboutDlg(void)
+{
+ DialogPtr aboutDlog;
+ WindowRef windowRef;
+ short itemHit = -9;
+
+ aboutDlog = GetNewDialog(TK_DEFAULT_ABOUT, NULL, (void *) (-1));
+ if (!aboutDlog) {
+ return;
+ }
+ windowRef = GetDialogWindow(aboutDlog);
+ SelectWindow(windowRef);
+ TkMacOSXTrackingLoop(1);
+ while (itemHit != 1) {
+ ModalDialog(NULL, &itemHit);
+ }
+ TkMacOSXTrackingLoop(0);
+ DisposeDialog(aboutDlog);
+ SelectWindow(ActiveNonFloatingWindow());
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_MessageBoxObjCmd --
+ *
+ * Implements the tk_messageBox in native Mac OS X style.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * none
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+Tk_MessageBoxObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+{
+ Tk_Window tkwin = clientData;
+ AlertStdCFStringAlertParamRec paramCFStringRec;
+ AlertType alertType;
+ DialogRef dialogRef;
+ CFStringRef messageTextCF = NULL, finemessageTextCF = NULL;
+ OSStatus err;
+ SInt16 itemHit;
+ Boolean haveDefaultOption = false, haveParentOption = false;
+ char *str;
+ int index, defaultButtonIndex;
+ int defaultNativeButtonIndex; /* 1, 2, 3: right to left */
+ int typeIndex, i, indexDefaultOption = 0, result = TCL_ERROR;
+
+ static const char *const movableAlertStrings[] = {
+ "-default", "-detail", "-icon", "-message", "-parent", "-title",
+ "-type", NULL
+ };
+ static const char *const movableTypeStrings[] = {
+ "abortretryignore", "ok", "okcancel", "retrycancel", "yesno",
+ "yesnocancel", NULL
+ };
+ static const char *const movableButtonStrings[] = {
+ "abort", "retry", "ignore", "ok", "cancel", "yes", "no", NULL
+ };
+ static const char *const movableIconStrings[] = {
+ "error", "info", "question", "warning", NULL
+ };
+ enum movableAlertOptions {
+ ALERT_DEFAULT, ALERT_DETAIL, ALERT_ICON, ALERT_MESSAGE, ALERT_PARENT,
+ ALERT_TITLE, ALERT_TYPE
+ };
+ enum movableTypeOptions {
+ TYPE_ABORTRETRYIGNORE, TYPE_OK, TYPE_OKCANCEL, TYPE_RETRYCANCEL,
+ TYPE_YESNO, TYPE_YESNOCANCEL
+ };
+ enum movableButtonOptions {
+ TEXT_ABORT, TEXT_RETRY, TEXT_IGNORE, TEXT_OK, TEXT_CANCEL, TEXT_YES,
+ TEXT_NO
+ };
+ enum movableIconOptions {
+ ICON_ERROR, ICON_INFO, ICON_QUESTION, ICON_WARNING
+ };
+
+ /*
+ * Need to map from 'movableButtonStrings' and its corresponding integer,
+ * index to the native button index, which is 1, 2, 3, from right to left.
+ * This is necessary to do for each separate '-type' of button sets.
+ */
+
+ short buttonIndexAndTypeToNativeButtonIndex[][7] = {
+ /* abort retry ignore ok cancel yes no */
+ {1, 2, 3, 0, 0, 0, 0}, /* abortretryignore */
+ {0, 0, 0, 1, 0, 0, 0}, /* ok */
+ {0, 0, 0, 1, 2, 0, 0}, /* okcancel */
+ {0, 1, 0, 0, 2, 0, 0}, /* retrycancel */
+ {0, 0, 0, 0, 0, 1, 2}, /* yesno */
+ {0, 0, 0, 0, 3, 1, 2}, /* yesnocancel */
+ };
+
+ /*
+ * Need also the inverse mapping, from native button (1, 2, 3) to the
+ * descriptive button text string index.
+ */
+
+ short nativeButtonIndexAndTypeToButtonIndex[][4] = {
+ {-1, 0, 1, 2}, /* abortretryignore */
+ {-1, 3, 0, 0}, /* ok */
+ {-1, 3, 4, 0}, /* okcancel */
+ {-1, 1, 4, 0}, /* retrycancel */
+ {-1, 5, 6, 0}, /* yesno */
+ {-1, 5, 6, 4}, /* yesnocancel */
+ };
+
+ alertType = kAlertPlainAlert;
+ typeIndex = TYPE_OK;
+
+ ChkErr(GetStandardAlertDefaultParams, &paramCFStringRec,
+ kStdCFStringAlertVersionOne);
+ paramCFStringRec.movable = true;
+ paramCFStringRec.helpButton = false;
+ paramCFStringRec.defaultButton = kAlertStdAlertOKButton;
+ paramCFStringRec.cancelButton = kAlertStdAlertCancelButton;
+
+ for (i = 1; i < objc; i += 2) {
+ int iconIndex;
+ char *string;
+
+ if (Tcl_GetIndexFromObj(interp, objv[i], movableAlertStrings, "option",
+ TCL_EXACT, &index) != TCL_OK) {
+ goto end;
+ }
+ if (i + 1 == objc) {
+ string = Tcl_GetString(objv[i]);
+ Tcl_AppendResult(interp, "value for \"", string, "\" missing",
+ NULL);
+ goto end;
+ }
+
+ switch (index) {
+ case ALERT_DEFAULT:
+ /*
+ * Need to postpone processing of this option until we are sure to
+ * know the '-type' as well.
+ */
+
+ haveDefaultOption = true;
+ indexDefaultOption = i;
+ break;
+
+ case ALERT_DETAIL:
+ str = Tcl_GetString(objv[i + 1]);
+ if (finemessageTextCF) {
+ CFRelease(finemessageTextCF);
+ }
+ finemessageTextCF = CFStringCreateWithCString(NULL, str,
+ kCFStringEncodingUTF8);
+ break;
+
+ case ALERT_ICON:
+ if (Tcl_GetIndexFromObj(interp, objv[i + 1], movableIconStrings,
+ "value", TCL_EXACT, &iconIndex) != TCL_OK) {
+ goto end;
+ }
+ switch (iconIndex) {
+ case ICON_ERROR:
+ alertType = kAlertStopAlert;
+ break;
+ case ICON_INFO:
+ alertType = kAlertNoteAlert;
+ break;
+ case ICON_QUESTION:
+ alertType = kAlertCautionAlert;
+ break;
+ case ICON_WARNING:
+ alertType = kAlertCautionAlert;
+ break;
+ }
+ break;
+
+ case ALERT_MESSAGE:
+ str = Tcl_GetString(objv[i + 1]);
+ if (messageTextCF) {
+ CFRelease(messageTextCF);
+ }
+ messageTextCF = CFStringCreateWithCString(NULL, str,
+ kCFStringEncodingUTF8);
+ break;
+
+ case ALERT_PARENT:
+ str = Tcl_GetString(objv[i + 1]);
+ tkwin = Tk_NameToWindow(interp, str, tkwin);
+ if (tkwin == NULL) {
+ goto end;
+ }
+ if (((TkWindow *) tkwin)->window != None &&
+ TkMacOSXHostToplevelExists(tkwin)) {
+ haveParentOption = true;
+ }
+ break;
+
+ case ALERT_TITLE:
+ /* TODO: message box title missing? */
+ break;
+
+ case ALERT_TYPE:
+ if (Tcl_GetIndexFromObj(interp, objv[i + 1], movableTypeStrings,
+ "value", TCL_EXACT, &typeIndex) != TCL_OK) {
+ goto end;
+ }
+ switch (typeIndex) {
+ case TYPE_ABORTRETRYIGNORE:
+ paramCFStringRec.defaultText = CFSTR("Abort");
+ paramCFStringRec.cancelText = CFSTR("Retry");
+ paramCFStringRec.otherText = CFSTR("Ignore");
+ paramCFStringRec.cancelButton = kAlertStdAlertOtherButton;
+ break;
+ case TYPE_OK:
+ paramCFStringRec.defaultText = CFSTR("OK");
+ break;
+ case TYPE_OKCANCEL:
+ paramCFStringRec.defaultText = CFSTR("OK");
+ paramCFStringRec.cancelText = CFSTR("Cancel");
+ break;
+ case TYPE_RETRYCANCEL:
+ paramCFStringRec.defaultText = CFSTR("Retry");
+ paramCFStringRec.cancelText = CFSTR("Cancel");
+ break;
+ case TYPE_YESNO:
+ paramCFStringRec.defaultText = CFSTR("Yes");
+ paramCFStringRec.cancelText = CFSTR("No");
+ break;
+ case TYPE_YESNOCANCEL:
+ paramCFStringRec.defaultText = CFSTR("Yes");
+ paramCFStringRec.cancelText = CFSTR("No");
+ paramCFStringRec.otherText = CFSTR("Cancel");
+ paramCFStringRec.cancelButton = kAlertStdAlertOtherButton;
+ break;
+ }
+ break;
+ }
+ }
+
+ if (haveDefaultOption) {
+ /*
+ * Any '-default' option needs to know the '-type' option, which is why
+ * we do this here.
+ */
+
+ if (Tcl_GetIndexFromObj(interp, objv[indexDefaultOption + 1],
+ movableButtonStrings, "value", TCL_EXACT, &defaultButtonIndex)
+ != TCL_OK) {
+ goto end;
+ }
+
+ /*
+ * Need to map from "ok" etc. to 1, 2, 3, right to left.
+ */
+
+ defaultNativeButtonIndex =
+ buttonIndexAndTypeToNativeButtonIndex[typeIndex][defaultButtonIndex];
+ if (defaultNativeButtonIndex == 0) {
+ Tcl_SetObjResult(interp,
+ Tcl_NewStringObj("Illegal default option", -1));
+ goto end;
+ }
+ paramCFStringRec.defaultButton = defaultNativeButtonIndex;
+ if (paramCFStringRec.cancelButton == defaultNativeButtonIndex) {
+ paramCFStringRec.cancelButton = 0;
+ }
+ }
+ ChkErr(SetThemeCursor, kThemeArrowCursor);
+
+ if (haveParentOption) {
+ AlertHandlerUserData data;
+ static EventHandlerUPP handler = NULL;
+ WindowRef windowRef;
+ const EventTypeSpec kEvents[] = {
+ {kEventClassCommand, kEventProcessCommand}
+ };
+
+ bzero(&data, sizeof(data));
+ if (!handler) {
+ handler = NewEventHandlerUPP(AlertHandler);
+ }
+ windowRef = TkMacOSXDrawableWindow(Tk_WindowId(tkwin));
+ if (!windowRef) {
+ goto end;
+ }
+ err = ChkErr(CreateStandardSheet, alertType, messageTextCF,
+ finemessageTextCF, &paramCFStringRec, NULL, &dialogRef);
+ if(err != noErr) {
+ goto end;
+ }
+ data.dialogWindow = GetDialogWindow(dialogRef);
+ err = ChkErr(ShowSheetWindow, data.dialogWindow, windowRef);
+ if(err != noErr) {
+ DisposeDialog(dialogRef);
+ goto end;
+ }
+ ChkErr(GetWindowModality, data.dialogWindow, &data.origModality,
+ &data.origUnavailWindow);
+ ChkErr(SetWindowModality, data.dialogWindow, kWindowModalityAppModal,
+ NULL);
+ ChkErr(InstallEventHandler, GetWindowEventTarget(data.dialogWindow),
+ handler, GetEventTypeCount(kEvents), kEvents, &data,
+ &data.handlerRef);
+ TkMacOSXTrackingLoop(1);
+ ChkErr(RunAppModalLoopForWindow, data.dialogWindow);
+ TkMacOSXTrackingLoop(0);
+ itemHit = data.buttonIndex;
+ } else {
+ err = ChkErr(CreateStandardAlert, alertType, messageTextCF,
+ finemessageTextCF, &paramCFStringRec, &dialogRef);
+ if(err != noErr) {
+ goto end;
+ }
+ TkMacOSXTrackingLoop(1);
+ err = ChkErr(RunStandardAlert, dialogRef, NULL, &itemHit);
+ TkMacOSXTrackingLoop(0);
+ if (err != noErr) {
+ goto end;
+ }
+ }
+ if (err == noErr) {
+ /*
+ * Map 'itemHit' (1, 2, 3) to descriptive text string.
+ */
+
+ int ind = nativeButtonIndexAndTypeToButtonIndex[typeIndex][itemHit];
+
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(movableButtonStrings[ind],
+ -1));
+ result = TCL_OK;
+ }
+
+ end:
+ if (finemessageTextCF) {
+ CFRelease(finemessageTextCF);
+ }
+ if (messageTextCF) {
+ CFRelease(messageTextCF);
+ }
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * AlertHandler --
+ *
+ * Carbon event handler for the Standard Sheet dialog.
+ *
+ * Results:
+ * OSStatus if event handled or not.
+ *
+ * Side effects:
+ * May set userData.
+ *
+ *----------------------------------------------------------------------
+ */
+
+OSStatus
+AlertHandler(
+ EventHandlerCallRef callRef,
+ EventRef eventRef,
+ void *userData)
+{
+ AlertHandlerUserData *data = userData;
+ HICommand cmd;
+
+ ChkErr(GetEventParameter,eventRef, kEventParamDirectObject, typeHICommand,
+ NULL, sizeof(cmd), NULL, &cmd);
+ switch (cmd.commandID) {
+ case kHICommandOK:
+ data->buttonIndex = 1;
+ break;
+ case kHICommandCancel:
+ data->buttonIndex = 2;
+ break;
+ case kHICommandOther:
+ data->buttonIndex = 3;
+ break;
+ }
+ if (data->buttonIndex) {
+ ChkErr(QuitAppModalLoopForWindow, data->dialogWindow);
+ ChkErr(RemoveEventHandler, data->handlerRef);
+ ChkErr(SetWindowModality, data->dialogWindow,
+ data->origModality, data->origUnavailWindow);
+ }
+ return eventNotHandledErr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ */
+#pragma mark [tk fontchooser] implementation (TIP 324)
+/*
+ *----------------------------------------------------------------------
+ */
+
+#include "tkMacOSXEvent.h"
+#include "tkMacOSXFont.h"
+
+typedef struct FontchooserData {
+ Tcl_Obj *titleObj;
+ Tcl_Obj *cmdObj;
+ Tk_Window parent;
+} FontchooserData;
+
+static Tcl_Obj *FontchooserCget(FontchooserData *fcdPtr, int optionIndex);
+static int FontchooserConfigureCmd(ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
+static int FontchooserShowCmd(ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
+static int FontchooserHideCmd(ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *const objv[]);
+static void FontchooserParentEventHandler(ClientData clientData,
+ XEvent *eventPtr);
+static void DeleteFontchooserData(ClientData clientData, Tcl_Interp *interp);
+
+MODULE_SCOPE const TkEnsemble tkFontchooserEnsemble[];
+const TkEnsemble tkFontchooserEnsemble[] = {
+ { "configure", FontchooserConfigureCmd, NULL },
+ { "show", FontchooserShowCmd, NULL },
+ { "hide", FontchooserHideCmd, NULL },
+ { NULL, NULL, NULL }
+};
+
+static Tcl_Interp *fontchooserInterp = NULL;
+static FMFontFamily fontPanelFontFamily = kInvalidFontFamily;
+static FMFontStyle fontPanelFontStyle = -1;
+static FMFontSize fontPanelFontSize = 0;
+static FMFont fontPanelFontID = kInvalidFont;
+
+static const char *const fontchooserOptionStrings[] = {
+ "-parent", "-title", "-font", "-command",
+ "-visible", NULL
+};
+enum FontchooserOption {
+ FontchooserParent, FontchooserTitle, FontchooserFont, FontchooserCmd,
+ FontchooserVisible
+};
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXProcessFontEvent --
+ *
+ * This processes events generated by user interaction with the
+ * font panel.
+ *
+ * Results:
+ * True if Tk events are generated - false otherwise.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkMacOSXProcessFontEvent(
+ TkMacOSXEvent * eventPtr,
+ MacEventStatus * statusPtr)
+{
+ OSStatus err;
+ int eventGenerated = 0;
+ FontchooserData *fcdPtr;
+
+ switch (eventPtr->eKind) {
+ case kEventFontPanelClosed:
+ case kEventFontSelection:
+ break;
+ default:
+ goto done;
+ }
+ if (!fontchooserInterp) {
+ goto done;
+ }
+ fcdPtr = Tcl_GetAssocData(fontchooserInterp, "::tk::fontchooser", NULL);
+ switch (eventPtr->eKind) {
+ case kEventFontPanelClosed:
+ if (!FPIsFontPanelVisible() && fcdPtr->parent != None) {
+ TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility");
+ fontchooserInterp = NULL;
+ eventGenerated = 1;
+ }
+ break;
+ case kEventFontSelection: {
+ Tcl_Obj *fontObj = NULL;
+
+ fontPanelFontFamily = kInvalidFontFamily;
+ fontPanelFontStyle = -1;
+ fontPanelFontSize = 0;
+ fontPanelFontID = kInvalidFont;
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamFMFontFamily, typeFMFontFamily, NULL,
+ sizeof(FMFontFamily), NULL, &fontPanelFontFamily);
+ err |= ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamFMFontStyle, typeFMFontStyle, NULL,
+ sizeof(FMFontStyle), NULL, &fontPanelFontStyle);
+ err |= ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamFMFontSize, typeFMFontSize, NULL,
+ sizeof(FMFontSize), NULL, &fontPanelFontSize);
+ if (err != noErr) {
+ /*
+ * No/incomplete QD font spec, use ATSUI font ID
+ */
+ Fixed fontFixedSize;
+
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamATSUFontID, typeATSUFontID, NULL,
+ sizeof(ATSUFontID), NULL, &fontPanelFontID);
+ if (err == noErr) {
+ ChkErr(FMGetFontFamilyInstanceFromFont, fontPanelFontID,
+ &fontPanelFontFamily, &fontPanelFontStyle);
+ }
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamATSUFontSize, typeATSUSize, NULL,
+ sizeof(Fixed), NULL, &fontFixedSize);
+ if (err == noErr) {
+ fontPanelFontSize = FixedToInt(fontFixedSize);
+ }
+ }
+ fontObj = TkMacOSXFontDescriptionForFMFontInfo(
+ fontPanelFontFamily, fontPanelFontStyle,
+ fontPanelFontSize, fontPanelFontID);
+ if (fontObj) {
+ if (fcdPtr->cmdObj) {
+ int objc, result;
+ Tcl_Obj **objv, **tmpv;
+
+ result = Tcl_ListObjGetElements(fontchooserInterp,
+ fcdPtr->cmdObj, &objc, &objv);
+ if (result == TCL_OK) {
+ tmpv = ckalloc(sizeof(Tcl_Obj *) * (objc + 2));
+ memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc);
+ tmpv[objc] = fontObj;
+ result = TkBackgroundEvalObjv(fontchooserInterp,
+ objc + 1, tmpv, TCL_EVAL_GLOBAL);
+ ckfree(tmpv);
+ }
+ }
+ TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserFontChanged");
+ }
+ break;
+ }
+ }
+done:
+ return eventGenerated;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * FontchooserCget --
+ *
+ * Helper for the FontchooserConfigure command to return the
+ * current value of any of the options (which may be NULL in
+ * the structure)
+ *
+ * Results:
+ * Tcl object of option value.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static Tcl_Obj *
+FontchooserCget(
+ FontchooserData *fcdPtr,
+ int optionIndex)
+{
+ Tcl_Obj *resObj = NULL;
+
+ switch(optionIndex) {
+ case FontchooserParent: {
+ if (fcdPtr->parent != None) {
+ resObj = Tcl_NewStringObj(
+ ((TkWindow*)fcdPtr->parent)->pathName, -1);
+ } else {
+ resObj = Tcl_NewStringObj(".", 1);
+ }
+ break;
+ }
+ case FontchooserTitle: {
+ if (fcdPtr->titleObj) {
+ resObj = fcdPtr->titleObj;
+ } else {
+ resObj = Tcl_NewObj();
+ }
+ break;
+ }
+ case FontchooserFont: {
+ resObj = TkMacOSXFontDescriptionForFMFontInfo(
+ fontPanelFontFamily, fontPanelFontStyle,
+ fontPanelFontSize, fontPanelFontID);
+ if (!resObj) {
+ resObj = Tcl_NewObj();
+ }
+ break;
+ }
+ case FontchooserCmd: {
+ if (fcdPtr->cmdObj) {
+ resObj = fcdPtr->cmdObj;
+ } else {
+ resObj = Tcl_NewObj();
+ }
+ break;
+ }
+ case FontchooserVisible: {
+ resObj = Tcl_NewBooleanObj(FPIsFontPanelVisible());
+ break;
+ }
+ default: {
+ resObj = Tcl_NewObj();
+ }
+ }
+ return resObj;
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * FontchooserConfigureCmd --
+ *
+ * Implementation of the 'tk fontchooser configure' ensemble command.
+ * See the user documentation for what it does.
+ *
+ * Results:
+ * See the user documentation.
+ *
+ * Side effects:
+ * Per-interp data structure may be modified
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static int
+FontchooserConfigureCmd(
+ ClientData clientData, /* Main window */
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ Tk_Window tkwin = (Tk_Window)clientData;
+ FontchooserData *fcdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser",
+ NULL);
+ int i, r = TCL_OK;
+
+ /*
+ * With no arguments we return all the options in a dict
+ */
+
+ if (objc == 1) {
+ Tcl_Obj *keyObj, *valueObj;
+ Tcl_Obj *dictObj = Tcl_NewDictObj();
+ for (i = 0; r == TCL_OK && fontchooserOptionStrings[i] != NULL; ++i) {
+ keyObj = Tcl_NewStringObj(fontchooserOptionStrings[i], -1);
+ valueObj = FontchooserCget(fcdPtr, i);
+ r = Tcl_DictObjPut(interp, dictObj, keyObj, valueObj);
+ }
+ if (r == TCL_OK) {
+ Tcl_SetObjResult(interp, dictObj);
+ }
+ return r;
+ }
+
+ for (i = 1; i < objc; i += 2) {
+ int optionIndex, len;
+ if (Tcl_GetIndexFromObj(interp, objv[i], fontchooserOptionStrings,
+ "option", 0, &optionIndex) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (objc == 2) {
+ /* With one option and no arg, return the current value */
+ Tcl_SetObjResult(interp, FontchooserCget(fcdPtr, optionIndex));
+ return TCL_OK;
+ }
+ if (i + 1 == objc) {
+ Tcl_AppendResult(interp, "value for \"",
+ Tcl_GetString(objv[i]), "\" missing", NULL);
+ return TCL_ERROR;
+ }
+ switch (optionIndex) {
+ case FontchooserVisible: {
+ const char *msg = "cannot change read-only option "
+ "\"-visible\": use the show or hide command";
+
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, sizeof(msg)-1));
+ return TCL_ERROR;
+ }
+ case FontchooserParent: {
+ Tk_Window parent = Tk_NameToWindow(interp,
+ Tcl_GetString(objv[i+1]), tkwin);
+ if (parent == None) {
+ return TCL_ERROR;
+ }
+ if (fcdPtr->parent) {
+ Tk_DeleteEventHandler(fcdPtr->parent, StructureNotifyMask,
+ FontchooserParentEventHandler, fcdPtr);
+ }
+ fcdPtr->parent = parent;
+ Tk_CreateEventHandler(fcdPtr->parent, StructureNotifyMask,
+ FontchooserParentEventHandler, fcdPtr);
+ break;
+ }
+ case FontchooserTitle:
+ if (fcdPtr->titleObj) {
+ Tcl_DecrRefCount(fcdPtr->titleObj);
+ }
+ Tcl_GetStringFromObj(objv[i+1], &len);
+ if (len) {
+ fcdPtr->titleObj = objv[i+1];
+ if (Tcl_IsShared(fcdPtr->titleObj)) {
+ fcdPtr->titleObj = Tcl_DuplicateObj(fcdPtr->titleObj);
+ }
+ Tcl_IncrRefCount(fcdPtr->titleObj);
+ } else {
+ fcdPtr->titleObj = NULL;
+ }
+ break;
+ case FontchooserFont: {
+
+ Tcl_GetStringFromObj(objv[i+1], &len);
+ if (len) {
+ Tk_Font f = Tk_AllocFontFromObj(interp, tkwin, objv[i+1]);
+ if (f) {
+ ATSUStyle atsuStyle;
+
+ TkMacOSXFMFontInfoForFont(f, &fontPanelFontFamily,
+ &fontPanelFontStyle, &fontPanelFontSize,
+ &atsuStyle);
+ ChkErr(SetFontInfoForSelection,
+ kFontSelectionATSUIType, 1, &atsuStyle, NULL);
+ Tk_FreeFont(f);
+ } else {
+ return TCL_ERROR;
+ }
+ } else {
+ fontPanelFontFamily = kInvalidFontFamily;
+ ChkErr(SetFontInfoForSelection,
+ kFontSelectionATSUIType, 0, NULL, NULL);
+ }
+ if (FPIsFontPanelVisible()) {
+ TkSendVirtualEvent(fcdPtr->parent,
+ "TkFontchooserFontChanged");
+ }
+ break;
+ }
+ case FontchooserCmd:
+ if (fcdPtr->cmdObj) {
+ Tcl_DecrRefCount(fcdPtr->cmdObj);
+ }
+ Tcl_GetStringFromObj(objv[i+1], &len);
+ if (len) {
+ fcdPtr->cmdObj = objv[i+1];
+ if (Tcl_IsShared(fcdPtr->cmdObj)) {
+ fcdPtr->cmdObj = Tcl_DuplicateObj(fcdPtr->cmdObj);
+ }
+ Tcl_IncrRefCount(fcdPtr->cmdObj);
+ } else {
+ fcdPtr->cmdObj = NULL;
+ }
+ break;
+ }
+ }
+ return TCL_OK;
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * FontchooserShowCmd --
+ *
+ * Implements the 'tk fontchooser show' ensemble command. The
+ * per-interp configuration data for the dialog is held in an interp
+ * associated structure.
+ *
+ * Results:
+ * See the user documentation.
+ *
+ * Side effects:
+ * Font Panel may be shown.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static int
+FontchooserShowCmd(
+ ClientData clientData, /* Main window */
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ FontchooserData *fcdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser",
+ NULL);
+
+ if (fcdPtr->parent == None) {
+ fcdPtr->parent = (Tk_Window) clientData;
+ Tk_CreateEventHandler(fcdPtr->parent, StructureNotifyMask,
+ FontchooserParentEventHandler, fcdPtr);
+ }
+ if (!FPIsFontPanelVisible()) {
+ ChkErr(FPShowHideFontPanel);
+ TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility");
+ }
+ fontchooserInterp = interp;
+
+ return TCL_OK;
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * FontchooserHideCmd --
+ *
+ * Implementation of the 'tk fontchooser hide' ensemble. See the
+ * user documentation for details.
+ *
+ * Results:
+ * See the user documentation.
+ *
+ * Side effects:
+ * Font Panel may be hidden.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static int
+FontchooserHideCmd(
+ ClientData clientData, /* Main window */
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ if (FPIsFontPanelVisible()) {
+ ChkErr(FPShowHideFontPanel);
+ }
+ return TCL_OK;
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * FontchooserParentEventHandler --
+ *
+ * Event handler for StructureNotify events on the font chooser's
+ * parent window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Font chooser parent info is cleared and font panel is hidden.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static void
+FontchooserParentEventHandler(
+ ClientData clientData,
+ XEvent *eventPtr)
+{
+ FontchooserData *fcdPtr = clientData;
+
+ if (eventPtr->type == DestroyNotify) {
+ Tk_DeleteEventHandler(fcdPtr->parent, StructureNotifyMask,
+ FontchooserParentEventHandler, fcdPtr);
+ fcdPtr->parent = None;
+ if (FPIsFontPanelVisible()) {
+ ChkErr(FPShowHideFontPanel);
+ }
+ }
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * DeleteFontchooserData --
+ *
+ * Clean up the font chooser configuration data when the interp
+ * is destroyed.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * per-interp configuration data is destroyed.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+static void
+DeleteFontchooserData(
+ ClientData clientData,
+ Tcl_Interp *interp)
+{
+ FontchooserData *fcdPtr = clientData;
+
+ if (fcdPtr->titleObj) {
+ Tcl_DecrRefCount(fcdPtr->titleObj);
+ }
+ if (fcdPtr->cmdObj) {
+ Tcl_DecrRefCount(fcdPtr->cmdObj);
+ }
+ ckfree(fcdPtr);
+
+ if (fontchooserInterp == interp) {
+ fontchooserInterp = NULL;
+ }
+}
+
+/*
+ * ----------------------------------------------------------------------
+ *
+ * TkInitFontchooser --
+ *
+ * Associate the font chooser configuration data with the Tcl
+ * interpreter. There is one font chooser per interp.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * per-interp configuration data is destroyed.
+ *
+ * ----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkInitFontchooser(
+ Tcl_Interp *interp,
+ ClientData clientData)
+{
+ FontchooserData *fcdPtr = ckalloc(sizeof(FontchooserData));
+
+ bzero(fcdPtr, sizeof(FontchooserData));
+ Tcl_SetAssocData(interp, "::tk::fontchooser", DeleteFontchooserData,
+ fcdPtr);
+ return TCL_OK;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/carbon/tkMacOSXDraw.c b/carbon/tkMacOSXDraw.c
new file mode 100644
index 0000000..e028e45
--- /dev/null
+++ b/carbon/tkMacOSXDraw.c
@@ -0,0 +1,2118 @@
+/*
+ * tkMacOSXDraw.c --
+ *
+ * This file contains functions that perform drawing to
+ * Xlib windows. Most of the functions simple emulate
+ * Xlib functions.
+ *
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkMacOSXDebug.h"
+#include "xbytes.h"
+
+/*
+#ifdef TK_MAC_DEBUG
+#define TK_MAC_DEBUG_DRAWING
+#endif
+*/
+
+#define radians(d) ((d) * (M_PI/180.0))
+
+/*
+ * Non-antialiased CG drawing looks better and more like X11 drawing when using
+ * very fine lines, so decrease all linewidths by the following constant.
+ */
+#define NON_AA_CG_OFFSET .999
+
+/*
+ * Temporary region that can be reused.
+ */
+
+RgnHandle tkMacOSXtmpQdRgn = NULL;
+
+int tkMacOSXUseCGDrawing = 1;
+
+int tkPictureIsOpen;
+
+static PixPatHandle penPat = NULL, tmpPixPat = NULL;
+
+static int cgAntiAliasLimit = 0;
+#define notAA(w) ((w) < cgAntiAliasLimit)
+
+static int useThemedToplevel = 0;
+static int useThemedFrame = 0;
+
+/*
+ * Prototypes for functions used only in this file.
+ */
+
+static void ClipToGC(Drawable d, GC gc, HIShapeRef *clipRgnPtr);
+static void NoQDClip(CGrafPtr port);
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXInitCGDrawing --
+ *
+ * Initializes link vars that control CG drawing.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkMacOSXInitCGDrawing(
+ Tcl_Interp *interp,
+ int enable,
+ int limit)
+{
+ static Boolean initialized = FALSE;
+
+ if (!initialized) {
+ initialized = TRUE;
+
+ if (Tcl_CreateNamespace(interp, "::tk::mac", NULL, NULL) == NULL) {
+ Tcl_ResetResult(interp);
+ }
+ if (Tcl_LinkVar(interp, "::tk::mac::useCGDrawing",
+ (char *) &tkMacOSXUseCGDrawing, TCL_LINK_BOOLEAN) != TCL_OK) {
+ Tcl_ResetResult(interp);
+ }
+ tkMacOSXUseCGDrawing = enable;
+
+ if (Tcl_LinkVar(interp, "::tk::mac::CGAntialiasLimit",
+ (char *) &cgAntiAliasLimit, TCL_LINK_INT) != TCL_OK) {
+ Tcl_ResetResult(interp);
+ }
+ cgAntiAliasLimit = limit;
+
+ /*
+ * Piggy-back the themed drawing var init here.
+ */
+
+ if (Tcl_LinkVar(interp, "::tk::mac::useThemedToplevel",
+ (char *) &useThemedToplevel, TCL_LINK_BOOLEAN) != TCL_OK) {
+ Tcl_ResetResult(interp);
+ }
+ if (Tcl_LinkVar(interp, "::tk::mac::useThemedFrame",
+ (char *) &useThemedFrame, TCL_LINK_BOOLEAN) != TCL_OK) {
+ Tcl_ResetResult(interp);
+ }
+
+ if (tkMacOSXtmpQdRgn == NULL) {
+ tkMacOSXtmpQdRgn = NewRgn();
+ }
+ }
+#ifdef TK_MAC_DEBUG_DRAWING
+ TkMacOSXInitNamedDebugSymbol(QD, void, QD_DebugPrint, char*);
+ if (QD_DebugPrint) {
+ ; /* gdb: b *QD_DebugPrint */
+ }
+#endif /* TK_MAC_DEBUG_WINDOWS */
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XCopyArea --
+ *
+ * Copies data from one drawable to another using block transfer
+ * routines.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Data is moved from a window or bitmap to a second window or
+ * bitmap.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XCopyArea(
+ Display *display, /* Display. */
+ Drawable src, /* Source drawable. */
+ Drawable dst, /* Destination drawable. */
+ GC gc, /* GC to use. */
+ int src_x, /* X & Y, width & height */
+ int src_y, /* define the source rectangle */
+ unsigned int width, /* that will be copied. */
+ unsigned int height,
+ int dest_x, /* Dest X & Y on dest rect. */
+ int dest_y)
+{
+ TkMacOSXDrawingContext dc;
+ MacDrawable *srcDraw = (MacDrawable *) src, *dstDraw = (MacDrawable *) dst;
+
+ display->request++;
+ if (!width || !height) {
+ /* TkMacOSXDbgMsg("Drawing of emtpy area requested"); */
+ return;
+ }
+ {
+ CGrafPtr srcPort;
+
+ srcPort = TkMacOSXGetDrawablePort(src);
+ if (srcPort) {
+ Rect srcRect, dstRect, *srcPtr = &srcRect, *dstPtr = &dstRect;
+ const BitMap *srcBit, *dstBit;
+ RGBColor black = {0, 0, 0}, white = {0xffff, 0xffff, 0xffff};
+
+ if (!TkMacOSXSetupDrawingContext(dst, gc, 0, &dc)) {
+ return;
+ }
+ if (dc.context) {
+ TkMacOSXDbgMsg("Ignored CG drawing of QD drawable");
+ goto end;
+ }
+ if (!dc.port) {
+ TkMacOSXDbgMsg("Invalid destination drawable");
+ goto end;
+ }
+ srcBit = GetPortBitMapForCopyBits(srcPort);
+ dstBit = GetPortBitMapForCopyBits(dc.port);
+ SetRect(srcPtr, srcDraw->xOff + src_x, srcDraw->yOff + src_y,
+ srcDraw->xOff + src_x + width,
+ srcDraw->yOff + src_y + height);
+ if (tkPictureIsOpen) {
+ dstPtr = srcPtr;
+ } else {
+ SetRect(dstPtr, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
+ dstDraw->xOff + dest_x + width,
+ dstDraw->yOff + dest_y + height);
+ }
+ RGBForeColor(&black);
+ RGBBackColor(&white);
+ CopyBits(srcBit, dstBit, srcPtr, dstPtr, srcCopy, NULL);
+end:
+ TkMacOSXRestoreDrawingContext(&dc);
+ } else {
+ TkMacOSXDbgMsg("Invalid source drawable");
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XCopyPlane --
+ *
+ * Copies a bitmap from a source drawable to a destination
+ * drawable. The plane argument specifies which bit plane of
+ * the source contains the bitmap. Note that this implementation
+ * ignores the gc->function.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Changes the destination drawable.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XCopyPlane(
+ Display *display, /* Display. */
+ Drawable src, /* Source drawable. */
+ Drawable dst, /* Destination drawable. */
+ GC gc, /* GC to use. */
+ int src_x, /* X & Y, width & height */
+ int src_y, /* define the source rectangle */
+ unsigned int width, /* that will be copied. */
+ unsigned int height,
+ int dest_x, /* Dest X & Y on dest rect. */
+ int dest_y,
+ unsigned long plane) /* Which plane to copy. */
+{
+ TkMacOSXDrawingContext dc;
+ MacDrawable *srcDraw = (MacDrawable *) src, *dstDraw = (MacDrawable *) dst;
+
+ display->request++;
+ if (!width || !height) {
+ /* TkMacOSXDbgMsg("Drawing of emtpy area requested"); */
+ return;
+ }
+ if (plane != 1) {
+ Tcl_Panic("Unexpected plane specified for XCopyPlane");
+ }
+ {
+ CGrafPtr srcPort;
+
+ srcPort = TkMacOSXGetDrawablePort(src);
+ if (srcPort) {
+ Rect srcRect, dstRect, *srcPtr = &srcRect, *dstPtr = &dstRect;
+ const BitMap *srcBit, *dstBit;
+ TkpClipMask *clipPtr = (TkpClipMask *) gc->clip_mask;
+
+ if (!TkMacOSXSetupDrawingContext(dst, gc, 0, &dc)) {
+ return;
+ }
+ if (dc.context) {
+ TkMacOSXDbgMsg("Ignored CG drawing of QD drawable");
+ goto end;
+ }
+ if (!dc.port) {
+ TkMacOSXDbgMsg("Invalid destination drawable");
+ goto end;
+ }
+ srcBit = GetPortBitMapForCopyBits(srcPort);
+ dstBit = GetPortBitMapForCopyBits(dc.port);
+ SetRect(srcPtr, srcDraw->xOff + src_x, srcDraw->yOff + src_y,
+ srcDraw->xOff + src_x + width,
+ srcDraw->yOff + src_y + height);
+ if (tkPictureIsOpen) {
+ dstPtr = srcPtr;
+ } else {
+ SetRect(dstPtr, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
+ dstDraw->xOff + dest_x + width,
+ dstDraw->yOff + dest_y + height);
+ }
+ TkMacOSXSetColorInPort(gc->foreground, 1, NULL, dc.port);
+ if (!clipPtr || clipPtr->type == TKP_CLIP_REGION) {
+ /*
+ * Opaque bitmaps.
+ */
+
+ TkMacOSXSetColorInPort(gc->background, 0, NULL, dc.port);
+ CopyBits(srcBit, dstBit, srcPtr, dstPtr, srcCopy, NULL);
+ } else if (clipPtr->type == TKP_CLIP_PIXMAP) {
+ if (clipPtr->value.pixmap == src) {
+ /*
+ * Transparent bitmaps. If it's color ignore the forecolor.
+ */
+ short tmode = GetPixDepth(GetPortPixMap(srcPort)) == 1 ?
+ srcOr : transparent;
+
+ CopyBits(srcBit, dstBit, srcPtr, dstPtr, tmode, NULL);
+ } else {
+ /*
+ * Two arbitrary bitmaps.
+ */
+
+ CGrafPtr mskPort = TkMacOSXGetDrawablePort(
+ clipPtr->value.pixmap);
+ const BitMap *mskBit = GetPortBitMapForCopyBits(mskPort);
+
+ CopyDeepMask(srcBit, mskBit, dstBit, srcPtr, srcPtr,
+ dstPtr, srcCopy, NULL);
+ }
+ }
+end:
+ TkMacOSXRestoreDrawingContext(&dc);
+ } else {
+ TkMacOSXDbgMsg("Invalid source drawable");
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkPutImage --
+ *
+ * Copies a subimage from an in-memory image to a rectangle of
+ * of the specified drawable.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws the image on the specified drawable.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkPutImage(
+ unsigned long *colors, /* Unused on Macintosh. */
+ int ncolors, /* Unused on Macintosh. */
+ Display* display, /* Display. */
+ Drawable d, /* Drawable to place image on. */
+ GC gc, /* GC to use. */
+ XImage* image, /* Image to place. */
+ int src_x, /* Source X & Y. */
+ int src_y,
+ int dest_x, /* Destination X & Y. */
+ int dest_y,
+ unsigned int width, /* Same width & height for both */
+ unsigned int height) /* distination and source. */
+{
+ TkMacOSXDrawingContext dc;
+ MacDrawable *dstDraw = (MacDrawable *) d;
+
+ display->request++;
+ if (!TkMacOSXSetupDrawingContext(d, gc, 0, &dc)) {
+ return;
+ }
+ if (dc.context) {
+ TkMacOSXDbgMsg("Ignored CG drawing of XImage");
+ } else {
+ Rect srcRect, dstRect, *srcPtr = &srcRect, *dstPtr = &dstRect;
+ const BitMap *dstBit;
+ RGBColor black = {0, 0, 0}, white = {0xffff, 0xffff, 0xffff};
+ int i, j;
+ char *newData = NULL;
+ char *dataPtr, *newPtr, *oldPtr;
+ int rowBytes = image->bytes_per_line, sliceRowBytes, lastSliceRowBytes;
+ int slices, sliceWidth, lastSliceWidth;
+
+ dstBit = GetPortBitMapForCopyBits(dc.port);
+ SetRect(srcPtr, src_x, src_y, src_x + width, src_y + height);
+ if (tkPictureIsOpen) {
+ dstPtr = srcPtr;
+ } else {
+ SetRect(dstPtr, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
+ dstDraw->xOff + dest_x + width,
+ dstDraw->yOff + dest_y + height);
+ }
+ RGBForeColor(&black);
+ RGBBackColor(&white);
+ if (image->obdata) {
+ /*
+ * Image from XGetImage, copy from containing GWorld directly.
+ */
+
+ CopyBits(GetPortBitMapForCopyBits(TkMacOSXGetDrawablePort(
+ (Drawable)image->obdata)), dstBit,
+ srcPtr, dstPtr, srcCopy, NULL);
+ } else if (image->depth == 1) {
+ /*
+ * BW image
+ */
+
+ const int maxRowBytes = 0x3ffe;
+ BitMap bitmap;
+ int odd;
+
+ if (rowBytes > maxRowBytes) {
+ slices = rowBytes / maxRowBytes;
+ sliceRowBytes = maxRowBytes;
+ lastSliceRowBytes = rowBytes - (slices * maxRowBytes);
+ if (!lastSliceRowBytes) {
+ slices--;
+ lastSliceRowBytes = maxRowBytes;
+ }
+ sliceWidth = (long) image->width * maxRowBytes / rowBytes;
+ lastSliceWidth = image->width - (sliceWidth * slices);
+ } else {
+ slices = 0;
+ sliceRowBytes = lastSliceRowBytes = rowBytes;
+ sliceWidth = lastSliceWidth = image->width;
+ }
+ bitmap.bounds.top = bitmap.bounds.left = 0;
+ bitmap.bounds.bottom = (short) image->height;
+ dataPtr = image->data + image->xoffset;
+ do {
+ if (slices) {
+ bitmap.bounds.right = bitmap.bounds.left + sliceWidth;
+ } else {
+ sliceRowBytes = lastSliceRowBytes;
+ bitmap.bounds.right = bitmap.bounds.left + lastSliceWidth;
+ }
+ oldPtr = dataPtr;
+ odd = sliceRowBytes % 2;
+ if (!newData) {
+ newData = ckalloc(image->height * (sliceRowBytes+odd));
+ }
+ newPtr = newData;
+ if (image->bitmap_bit_order != MSBFirst) {
+ for (i = 0; i < image->height; i++) {
+ for (j = 0; j < sliceRowBytes; j++) {
+ *newPtr = xBitReverseTable[(unsigned char)*oldPtr];
+ newPtr++; oldPtr++;
+ }
+ if (odd) {
+ *newPtr++ = 0;
+ }
+ oldPtr += rowBytes - sliceRowBytes;
+ }
+ } else {
+ for (i = 0; i < image->height; i++) {
+ memcpy(newPtr, oldPtr, sliceRowBytes);
+ newPtr += sliceRowBytes;
+ if (odd) {
+ *newPtr++ = 0;
+ }
+ oldPtr += rowBytes;
+ }
+ }
+ bitmap.baseAddr = newData;
+ bitmap.rowBytes = sliceRowBytes + odd;
+ CopyBits(&bitmap, dstBit, srcPtr, dstPtr, srcCopy, NULL);
+ if (slices) {
+ bitmap.bounds.left = bitmap.bounds.right;
+ dataPtr += sliceRowBytes;
+ }
+ } while (slices--);
+ ckfree(newData);
+ } else {
+ /*
+ * Color image
+ */
+
+ const int maxRowBytes = 0x3ffc;
+ PixMap pixmap;
+
+ pixmap.bounds.left = 0;
+ pixmap.bounds.top = 0;
+ pixmap.bounds.bottom = (short) image->height;
+ pixmap.pixelType = RGBDirect;
+ pixmap.pmVersion = baseAddr32; /* 32bit clean */
+ pixmap.packType = 0;
+ pixmap.packSize = 0;
+ pixmap.hRes = 0x00480000;
+ pixmap.vRes = 0x00480000;
+ pixmap.pixelSize = 32;
+ pixmap.cmpCount = 3;
+ pixmap.cmpSize = 8;
+ pixmap.pixelFormat = image->byte_order == MSBFirst ?
+ k32ARGBPixelFormat : k32BGRAPixelFormat;
+ pixmap.pmTable = NULL;
+ pixmap.pmExt = 0;
+ if (rowBytes > maxRowBytes) {
+ slices = rowBytes / maxRowBytes;
+ sliceRowBytes = maxRowBytes;
+ lastSliceRowBytes = rowBytes - (slices * maxRowBytes);
+ if (!lastSliceRowBytes) {
+ slices--;
+ lastSliceRowBytes = maxRowBytes;
+ }
+ sliceWidth = (long) image->width * maxRowBytes / rowBytes;
+ lastSliceWidth = image->width - (sliceWidth * slices);
+ dataPtr = image->data + image->xoffset;
+ newData = ckalloc(image->height * sliceRowBytes);
+ do {
+ if (slices) {
+ pixmap.bounds.right = pixmap.bounds.left + sliceWidth;
+ } else {
+ sliceRowBytes = lastSliceRowBytes;
+ pixmap.bounds.right = pixmap.bounds.left + lastSliceWidth;
+ }
+ oldPtr = dataPtr;
+ newPtr = newData;
+ for (i = 0; i < image->height; i++) {
+ memcpy(newPtr, oldPtr, sliceRowBytes);
+ oldPtr += rowBytes;
+ newPtr += sliceRowBytes;
+ }
+ pixmap.baseAddr = newData;
+ pixmap.rowBytes = sliceRowBytes | 0x8000;
+ CopyBits((BitMap*) &pixmap, dstBit, srcPtr, dstPtr, srcCopy,
+ NULL);
+ if (slices) {
+ pixmap.bounds.left = pixmap.bounds.right;
+ dataPtr += sliceRowBytes;
+ }
+ } while (slices--);
+ ckfree(newData);
+ } else {
+ pixmap.bounds.right = (short) image->width;
+ pixmap.baseAddr = image->data + image->xoffset;
+ pixmap.rowBytes = rowBytes | 0x8000;
+ CopyBits((BitMap*) &pixmap, dstBit, srcPtr, dstPtr, srcCopy, NULL);
+ }
+ }
+ }
+ TkMacOSXRestoreDrawingContext(&dc);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XDrawLines --
+ *
+ * Draw connected lines.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Renders a series of connected lines.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XDrawLines(
+ Display *display, /* Display. */
+ Drawable d, /* Draw on this. */
+ GC gc, /* Use this GC. */
+ XPoint *points, /* Array of points. */
+ int npoints, /* Number of points. */
+ int mode) /* Line drawing mode. */
+{
+ MacDrawable *macWin = (MacDrawable *) d;
+ TkMacOSXDrawingContext dc;
+ int i, lw = gc->line_width;
+
+ if (npoints < 2) {
+ /*
+ * TODO: generate BadValue error.
+ */
+
+ return;
+ }
+
+ display->request++;
+ if (!TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
+ return;
+ }
+ if (dc.context) {
+ double prevx, prevy;
+ double o = (lw % 2) ? .5 : 0;
+
+ CGContextBeginPath(dc.context);
+ prevx = macWin->xOff + points[0].x + o;
+ prevy = macWin->yOff + points[0].y + o;
+ CGContextMoveToPoint(dc.context, prevx, prevy);
+ for (i = 1; i < npoints; i++) {
+ if (mode == CoordModeOrigin) {
+ CGContextAddLineToPoint(dc.context,
+ macWin->xOff + points[i].x + o,
+ macWin->yOff + points[i].y + o);
+ } else {
+ prevx += points[i].x;
+ prevy += points[i].y;
+ CGContextAddLineToPoint(dc.context, prevx, prevy);
+ }
+ }
+ CGContextStrokePath(dc.context);
+ } else {
+ int o = -lw/2;
+
+ /* This is broken for fat lines, it is not possible to correctly
+ * imitate X11 drawing of oblique fat lines with QD line drawing,
+ * we should draw a filled polygon instead. */
+
+ MoveTo((short) (macWin->xOff + points[0].x + o),
+ (short) (macWin->yOff + points[0].y + o));
+ for (i = 1; i < npoints; i++) {
+ if (mode == CoordModeOrigin) {
+ LineTo((short) (macWin->xOff + points[i].x + o),
+ (short) (macWin->yOff + points[i].y + o));
+ } else {
+ Line((short) points[i].x, (short) points[i].y);
+ }
+ }
+ }
+ TkMacOSXRestoreDrawingContext(&dc);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XDrawSegments --
+ *
+ * Draw unconnected lines.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Renders a series of unconnected lines.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XDrawSegments(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XSegment *segments,
+ int nsegments)
+{
+ MacDrawable *macWin = (MacDrawable *) d;
+ TkMacOSXDrawingContext dc;
+ int i, lw = gc->line_width;
+
+ display->request++;
+ if (!TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
+ return;
+ }
+ if (dc.context) {
+ double o = (lw % 2) ? .5 : 0;
+
+ for (i = 0; i < nsegments; i++) {
+ CGContextBeginPath(dc.context);
+ CGContextMoveToPoint(dc.context,
+ macWin->xOff + segments[i].x1 + o,
+ macWin->yOff + segments[i].y1 + o);
+ CGContextAddLineToPoint(dc.context,
+ macWin->xOff + segments[i].x2 + o,
+ macWin->yOff + segments[i].y2 + o);
+ CGContextStrokePath(dc.context);
+ }
+ } else {
+ int o = -lw/2;
+
+ /* This is broken for fat lines, it is not possible to correctly
+ * imitate X11 drawing of oblique fat lines with QD line drawing,
+ * we should draw a filled polygon instead. */
+
+ for (i = 0; i < nsegments; i++) {
+ MoveTo((short) (macWin->xOff + segments[i].x1 + o),
+ (short) (macWin->yOff + segments[i].y1 + o));
+ LineTo((short) (macWin->xOff + segments[i].x2 + o),
+ (short) (macWin->yOff + segments[i].y2 + o));
+ }
+ }
+ TkMacOSXRestoreDrawingContext(&dc);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XFillPolygon --
+ *
+ * Draws a filled polygon.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws a filled polygon on the specified drawable.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XFillPolygon(
+ Display* display, /* Display. */
+ Drawable d, /* Draw on this. */
+ GC gc, /* Use this GC. */
+ XPoint* points, /* Array of points. */
+ int npoints, /* Number of points. */
+ int shape, /* Shape to draw. */
+ int mode) /* Drawing mode. */
+{
+ MacDrawable *macWin = (MacDrawable *) d;
+ TkMacOSXDrawingContext dc;
+ int i;
+
+ display->request++;
+ if (!TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
+ return;
+ }
+ if (dc.context) {
+ double prevx, prevy;
+ double o = (gc->line_width % 2) ? .5 : 0;
+
+ CGContextBeginPath(dc.context);
+ prevx = macWin->xOff + points[0].x + o;
+ prevy = macWin->yOff + points[0].y + o;
+ CGContextMoveToPoint(dc.context, prevx, prevy);
+ for (i = 1; i < npoints; i++) {
+ if (mode == CoordModeOrigin) {
+ CGContextAddLineToPoint(dc.context,
+ macWin->xOff + points[i].x + o,
+ macWin->yOff + points[i].y + o);
+ } else {
+ prevx += points[i].x;
+ prevy += points[i].y;
+ CGContextAddLineToPoint(dc.context, prevx, prevy);
+ }
+ }
+ CGContextEOFillPath(dc.context);
+ } else {
+ PolyHandle polygon;
+
+ polygon = OpenPoly();
+ MoveTo((short) (macWin->xOff + points[0].x),
+ (short) (macWin->yOff + points[0].y));
+ for (i = 1; i < npoints; i++) {
+ if (mode == CoordModeOrigin) {
+ LineTo((short) (macWin->xOff + points[i].x),
+ (short) (macWin->yOff + points[i].y));
+ } else {
+ Line((short) points[i].x, (short) points[i].y);
+ }
+ }
+ ClosePoly();
+ FillCPoly(polygon, dc.penPat);
+ KillPoly(polygon);
+ }
+ TkMacOSXRestoreDrawingContext(&dc);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XDrawRectangle --
+ *
+ * Draws a rectangle.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws a rectangle on the specified drawable.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XDrawRectangle(
+ Display *display, /* Display. */
+ Drawable d, /* Draw on this. */
+ GC gc, /* Use this GC. */
+ int x, int y, /* Upper left corner. */
+ unsigned int width, /* Width & height of rect. */
+ unsigned int height)
+{
+ MacDrawable *macWin = (MacDrawable *) d;
+ TkMacOSXDrawingContext dc;
+ int lw = gc->line_width;
+
+ if (width == 0 || height == 0) {
+ return;
+ }
+
+ display->request++;
+ if (!TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
+ return;
+ }
+ if (dc.context) {
+ CGRect rect;
+ double o = (lw % 2) ? .5 : 0;
+
+ rect = CGRectMake(
+ macWin->xOff + x + o,
+ macWin->yOff + y + o,
+ width, height);
+ CGContextStrokeRect(dc.context, rect);
+ } else {
+ Rect theRect;
+ int o = -lw/2;
+
+ theRect.left = (short) (macWin->xOff + x + o);
+ theRect.top = (short) (macWin->yOff + y + o);
+ theRect.right = (short) (theRect.left + width + lw);
+ theRect.bottom = (short) (theRect.top + height + lw);
+ FrameRect(&theRect);
+ }
+ TkMacOSXRestoreDrawingContext(&dc);
+}
+
+#ifdef TK_MACOSXDRAW_UNUSED
+/*
+ *----------------------------------------------------------------------
+ *
+ * XDrawRectangles --
+ *
+ * Draws the outlines of the specified rectangles as if a
+ * five-point PolyLine protocol request were specified for each
+ * rectangle:
+ *
+ * [x,y] [x+width,y] [x+width,y+height] [x,y+height] [x,y]
+ *
+ * For the specified rectangles, these functions do not draw a
+ * pixel more than once. XDrawRectangles draws the rectangles in
+ * the order listed in the array. If rectangles intersect, the
+ * intersecting pixels are drawn multiple times. Draws a
+ * rectangle.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws rectangles on the specified drawable.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XDrawRectangles(
+ Display *display,
+ Drawable drawable,
+ GC gc,
+ XRectangle *rectArr,
+ int nRects)
+{
+ MacDrawable *macWin = (MacDrawable *) drawable;
+ TkMacOSXDrawingContext dc;
+ XRectangle * rectPtr;
+ int i, lw = gc->line_width;
+
+ display->request++;
+ if (!TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
+ return;
+ }
+ if (dc.context) {
+ CGRect rect;
+ double o = (lw % 2) ? .5 : 0;
+
+ for (i = 0, rectPtr = rectArr; i < nRects; i++, rectPtr++) {
+ if (rectPtr->width == 0 || rectPtr->height == 0) {
+ continue;
+ }
+ rect = CGRectMake(
+ macWin->xOff + rectPtr->x + o,
+ macWin->yOff + rectPtr->y + o,
+ rectPtr->width, rectPtr->height);
+ CGContextStrokeRect(dc.context, rect);
+ }
+ } else {
+ Rect theRect;
+ int o = -lw/2;
+
+ for (i = 0, rectPtr = rectArr; i < nRects;i++, rectPtr++) {
+ theRect.left = (short) (macWin->xOff + rectPtr->x + o);
+ theRect.top = (short) (macWin->yOff + rectPtr->y + o);
+ theRect.right = (short) (theRect.left + rectPtr->width + lw);
+ theRect.bottom = (short) (theRect.top + rectPtr->height + lw);
+ FrameRect(&theRect);
+ }
+ }
+ TkMacOSXRestoreDrawingContext(&dc);
+}
+#endif
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XFillRectangles --
+ *
+ * Fill multiple rectangular areas in the given drawable.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws onto the specified drawable.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XFillRectangles(
+ Display* display, /* Display. */
+ Drawable d, /* Draw on this. */
+ GC gc, /* Use this GC. */
+ XRectangle *rectangles, /* Rectangle array. */
+ int n_rectangles) /* Number of rectangles. */
+{
+ MacDrawable *macWin = (MacDrawable *) d;
+ TkMacOSXDrawingContext dc;
+ XRectangle * rectPtr;
+ int i;
+
+ display->request++;
+ if (!TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
+ return;
+ }
+ if (dc.context) {
+ CGRect rect;
+
+ for (i = 0, rectPtr = rectangles; i < n_rectangles; i++, rectPtr++) {
+ if (rectPtr->width == 0 || rectPtr->height == 0) {
+ continue;
+ }
+ rect = CGRectMake(
+ macWin->xOff + rectPtr->x,
+ macWin->yOff + rectPtr->y,
+ rectPtr->width, rectPtr->height);
+ CGContextFillRect(dc.context, rect);
+ }
+ } else {
+ Rect theRect;
+
+ for (i = 0, rectPtr = rectangles; i < n_rectangles; i++, rectPtr++) {
+ theRect.left = (short) (macWin->xOff + rectPtr->x);
+ theRect.top = (short) (macWin->yOff + rectPtr->y);
+ theRect.right = (short) (theRect.left + rectPtr->width);
+ theRect.bottom = (short) (theRect.top + rectPtr->height);
+ FillCRect(&theRect, dc.penPat);
+ }
+ }
+ TkMacOSXRestoreDrawingContext(&dc);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XDrawArc --
+ *
+ * Draw an arc.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws an arc on the specified drawable.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XDrawArc(
+ Display* display, /* Display. */
+ Drawable d, /* Draw on this. */
+ GC gc, /* Use this GC. */
+ int x, int y, /* Upper left of bounding rect. */
+ unsigned int width, /* Width & height. */
+ unsigned int height,
+ int angle1, /* Staring angle of arc. */
+ int angle2) /* Extent of arc. */
+{
+ MacDrawable *macWin = (MacDrawable *) d;
+ TkMacOSXDrawingContext dc;
+ int lw = gc->line_width;
+
+ if (width == 0 || height == 0 || angle2 == 0) {
+ return;
+ }
+
+ display->request++;
+ if (!TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
+ return;
+ }
+ if (dc.context) {
+ CGRect rect;
+ double o = (lw % 2) ? .5 : 0;
+
+ rect = CGRectMake(
+ macWin->xOff + x + o,
+ macWin->yOff + y + o,
+ width, height);
+ TK_IF_MAC_OS_X_API_COND (4, CGContextStrokeEllipseInRect,
+ angle1 == 0 && angle2 == 23040,
+ CGContextStrokeEllipseInRect(dc.context, rect);
+ ) TK_ELSE (
+ CGMutablePathRef p = CGPathCreateMutable();
+ CGAffineTransform t = CGAffineTransformIdentity;
+ CGPoint c = CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect));
+ double w = CGRectGetWidth(rect);
+
+ if (width != height) {
+ t = CGAffineTransformMakeScale(1.0, CGRectGetHeight(rect)/w);
+ c = CGPointApplyAffineTransform(c, CGAffineTransformInvert(t));
+ }
+ CGPathAddArc(p, &t, c.x, c.y, w/2, radians(-angle1/64.0),
+ radians(-(angle1 + angle2)/64.0), angle2 > 0);
+ CGContextAddPath(dc.context, p);
+ CGPathRelease(p);
+ CGContextStrokePath(dc.context);
+ ) TK_ENDIF
+ } else {
+ Rect theRect;
+ short start, extent;
+ int o = -lw/2;
+
+ theRect.left = (short) (macWin->xOff + x + o);
+ theRect.top = (short) (macWin->yOff + y + o);
+ theRect.right = (short) (theRect.left + width + lw);
+ theRect.bottom = (short) (theRect.top + height + lw);
+ start = (short) (90 - (angle1/64));
+ extent = (short) (-(angle2/64));
+ FrameArc(&theRect, start, extent);
+ }
+ TkMacOSXRestoreDrawingContext(&dc);
+}
+
+#ifdef TK_MACOSXDRAW_UNUSED
+/*
+ *----------------------------------------------------------------------
+ *
+ * XDrawArcs --
+ *
+ * Draws multiple circular or elliptical arcs. Each arc is
+ * specified by a rectangle and two angles. The center of the
+ * circle or ellipse is the center of the rect- angle, and the
+ * major and minor axes are specified by the width and height.
+ * Positive angles indicate counterclock- wise motion, and
+ * negative angles indicate clockwise motion. If the magnitude
+ * of angle2 is greater than 360 degrees, XDrawArcs truncates it
+ * to 360 degrees.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws an arc for each array element on the specified drawable.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XDrawArcs(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XArc *arcArr,
+ int nArcs)
+{
+
+ MacDrawable *macWin = (MacDrawable *) d;
+ TkMacOSXDrawingContext dc;
+ XArc *arcPtr;
+ int i, lw = gc->line_width;
+
+ display->request++;
+ if (!TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
+ return;
+ }
+ if (dc.context) {
+ CGRect rect;
+ double o = (lw % 2) ? .5 : 0;
+
+ for (i=0, arcPtr = arcArr; i < nArcs; i++, arcPtr++) {
+ if (arcPtr->width == 0 || arcPtr->height == 0
+ || arcPtr->angle2 == 0) {
+ continue;
+ }
+ rect = CGRectMake(
+ macWin->xOff + arcPtr->x + o,
+ macWin->yOff + arcPtr->y + o,
+ arcPtr->width, arcPtr->height);
+
+ TK_IF_MAC_OS_X_API_COND (4, CGContextStrokeEllipseInRect,
+ arcPtr->angle1 == 0 && arcPtr->angle2 == 23040,
+ CGContextStrokeEllipseInRect(dc.context, rect);
+ ) TK_ELSE (
+ CGMutablePathRef p = CGPathCreateMutable();
+ CGAffineTransform t = CGAffineTransformIdentity;
+ CGPoint c = CGPointMake(CGRectGetMidX(rect),
+ CGRectGetMidY(rect));
+ double w = CGRectGetWidth(rect);
+
+ if (arcPtr->width != arcPtr->height) {
+ t = CGAffineTransformMakeScale(1, CGRectGetHeight(rect)/w);
+ c = CGPointApplyAffineTransform(c,
+ CGAffineTransformInvert(t));
+ }
+ CGPathAddArc(p, &t, c.x, c.y, w/2,
+ radians(-arcPtr->angle1/64.0),
+ radians(-(arcPtr->angle1 + arcPtr->angle2)/64.0),
+ arcPtr->angle2 > 0);
+ CGContextAddPath(dc.context, p);
+ CGPathRelease(p);
+ CGContextStrokePath(dc.context);
+ ) TK_ENDIF
+ }
+ } else {
+ Rect theRect;
+ short start, extent;
+ int o = -lw/2;
+
+ for (i = 0, arcPtr = arcArr;i < nArcs;i++, arcPtr++) {
+ theRect.left = (short) (macWin->xOff + arcPtr->x + o);
+ theRect.top = (short) (macWin->yOff + arcPtr->y + o);
+ theRect.right = (short) (theRect.left + arcPtr->width + lw);
+ theRect.bottom = (short) (theRect.top + arcPtr->height + lw);
+ start = (short) (90 - (arcPtr->angle1/64));
+ extent = (short) (-(arcPtr->angle2/64));
+ FrameArc(&theRect, start, extent);
+ }
+ }
+ TkMacOSXRestoreDrawingContext(&dc);
+}
+#endif
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XFillArc --
+ *
+ * Draw a filled arc.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws a filled arc on the specified drawable.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XFillArc(
+ Display* display, /* Display. */
+ Drawable d, /* Draw on this. */
+ GC gc, /* Use this GC. */
+ int x, int y, /* Upper left of bounding rect. */
+ unsigned int width, /* Width & height. */
+ unsigned int height,
+ int angle1, /* Staring angle of arc. */
+ int angle2) /* Extent of arc. */
+{
+ MacDrawable *macWin = (MacDrawable *) d;
+ TkMacOSXDrawingContext dc;
+ int lw = gc->line_width;
+
+ if (width == 0 || height == 0 || angle2 == 0) {
+ return;
+ }
+
+ display->request++;
+ if (!TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
+ return;
+ }
+ if (dc.context) {
+ CGRect rect;
+ double o = (lw % 2) ? .5 : 0, u = 0;
+
+ if (notAA(lw)) {
+ o += NON_AA_CG_OFFSET/2;
+ u += NON_AA_CG_OFFSET;
+ }
+ rect = CGRectMake(
+ macWin->xOff + x + o,
+ macWin->yOff + y + o,
+ width - u, height - u);
+
+ TK_IF_MAC_OS_X_API_COND (4, CGContextFillEllipseInRect,
+ angle1 == 0 && angle2 == 23040,
+ CGContextFillEllipseInRect(dc.context, rect);
+ ) TK_ELSE (
+ CGMutablePathRef p = CGPathCreateMutable();
+ CGAffineTransform t = CGAffineTransformIdentity;
+ CGPoint c = CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect));
+ double w = CGRectGetWidth(rect);
+
+ if (width != height) {
+ t = CGAffineTransformMakeScale(1, CGRectGetHeight(rect)/w);
+ c = CGPointApplyAffineTransform(c, CGAffineTransformInvert(t));
+ }
+ if (gc->arc_mode == ArcPieSlice) {
+ CGPathMoveToPoint(p, &t, c.x, c.y);
+ }
+ CGPathAddArc(p, &t, c.x, c.y, w/2, radians(-angle1/64.0),
+ radians(-(angle1 + angle2)/64.0), angle2 > 0);
+ CGPathCloseSubpath(p);
+ CGContextAddPath(dc.context, p);
+ CGPathRelease(p);
+ CGContextFillPath(dc.context);
+ ) TK_ENDIF
+ } else {
+ Rect theRect;
+ short start, extent;
+ int o = -lw/2;
+ PolyHandle polygon;
+ double sin1, cos1, sin2, cos2, angle;
+ double boxWidth, boxHeight;
+ double vertex[2], center1[2], center2[2];
+
+ theRect.left = (short) (macWin->xOff + x + o);
+ theRect.top = (short) (macWin->yOff + y + o);
+ theRect.right = (short) (theRect.left + width + lw);
+ theRect.bottom = (short) (theRect.top + height + lw);
+ start = (short) (90 - (angle1/64));
+ extent = (short) (-(angle2/64));
+ if (gc->arc_mode == ArcChord) {
+ boxWidth = theRect.right - theRect.left;
+ boxHeight = theRect.bottom - theRect.top;
+ angle = radians(-angle1/64.0);
+ sin1 = sin(angle);
+ cos1 = cos(angle);
+ angle -= radians(angle2/64.0);
+ sin2 = sin(angle);
+ cos2 = cos(angle);
+ vertex[0] = (theRect.left + theRect.right)/2.0;
+ vertex[1] = (theRect.top + theRect.bottom)/2.0;
+ center1[0] = vertex[0] + cos1*boxWidth/2.0;
+ center1[1] = vertex[1] + sin1*boxHeight/2.0;
+ center2[0] = vertex[0] + cos2*boxWidth/2.0;
+ center2[1] = vertex[1] + sin2*boxHeight/2.0;
+
+ polygon = OpenPoly();
+ MoveTo((short) ((theRect.left + theRect.right)/2),
+ (short) ((theRect.top + theRect.bottom)/2));
+ LineTo((short) (center1[0] + .5), (short) (center1[1] + .5));
+ LineTo((short) (center2[0] + .5), (short) (center2[1] + .5));
+ ClosePoly();
+ FillCArc(&theRect, start, extent, dc.penPat);
+ FillCPoly(polygon, dc.penPat);
+ KillPoly(polygon);
+ } else {
+ FillCArc(&theRect, start, extent, dc.penPat);
+ }
+ }
+ TkMacOSXRestoreDrawingContext(&dc);
+}
+
+#ifdef TK_MACOSXDRAW_UNUSED
+/*
+ *----------------------------------------------------------------------
+ *
+ * XFillArcs --
+ *
+ * Draw a filled arc.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws a filled arc for each array element on the specified drawable.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XFillArcs(
+ Display *display,
+ Drawable d,
+ GC gc,
+ XArc *arcArr,
+ int nArcs)
+{
+ MacDrawable *macWin = (MacDrawable *) d;
+ TkMacOSXDrawingContext dc;
+ XArc * arcPtr;
+ int i, lw = gc->line_width;
+
+ display->request++;
+ if (!TkMacOSXSetupDrawingContext(d, gc, tkMacOSXUseCGDrawing, &dc)) {
+ return;
+ }
+ if (dc.context) {
+ CGRect rect;
+ double o = (lw % 2) ? .5 : 0, u = 0;
+
+ if (notAA(lw)) {
+ o += NON_AA_CG_OFFSET/2;
+ u += NON_AA_CG_OFFSET;
+ }
+ for (i = 0, arcPtr = arcArr; i < nArcs; i++, arcPtr++) {
+ if (arcPtr->width == 0 || arcPtr->height == 0
+ || arcPtr->angle2 == 0) {
+ continue;
+ }
+ rect = CGRectMake(
+ macWin->xOff + arcPtr->x + o,
+ macWin->yOff + arcPtr->y + o,
+ arcPtr->width - u, arcPtr->height - u);
+ TK_IF_MAC_OS_X_API_COND (4, CGContextFillEllipseInRect,
+ arcPtr->angle1 == 0 && arcPtr->angle2 == 23040,
+ CGContextFillEllipseInRect(dc.context, rect);
+ ) TK_ELSE (
+ CGMutablePathRef p = CGPathCreateMutable();
+ CGAffineTransform t = CGAffineTransformIdentity;
+ CGPoint c = CGPointMake(CGRectGetMidX(rect),
+ CGRectGetMidY(rect));
+ double w = CGRectGetWidth(rect);
+
+ if (arcPtr->width != arcPtr->height) {
+ t = CGAffineTransformMakeScale(1, CGRectGetHeight(rect)/w);
+ c = CGPointApplyAffineTransform(c,
+ CGAffineTransformInvert(t));
+ }
+ if (gc->arc_mode == ArcPieSlice) {
+ CGPathMoveToPoint(p, &t, c.x, c.y);
+ }
+ CGPathAddArc(p, &t, c.x, c.y, w/2,
+ radians(-arcPtr->angle1/64.0),
+ radians(-(arcPtr->angle1 + arcPtr->angle2)/64.0),
+ arcPtr->angle2 > 0);
+ CGPathCloseSubpath(p);
+ CGContextAddPath(dc.context, p);
+ CGPathRelease(p);
+ CGContextFillPath(dc.context);
+ ) TK_ENDIF
+ }
+ } else {
+ Rect theRect;
+ short start, extent;
+ int o = -lw/2;
+ PolyHandle polygon;
+ double sin1, cos1, sin2, cos2, angle;
+ double boxWidth, boxHeight;
+ double vertex[2], center1[2], center2[2];
+
+ for (i = 0, arcPtr = arcArr;i<nArcs;i++, arcPtr++) {
+ theRect.left = (short) (macWin->xOff + arcPtr->x + o);
+ theRect.top = (short) (macWin->yOff + arcPtr->y + o);
+ theRect.right = (short) (theRect.left + arcPtr->width + lw);
+ theRect.bottom = (short) (theRect.top + arcPtr->height + lw);
+ start = (short) (90 - (arcPtr->angle1/64));
+ extent = (short) (- (arcPtr->angle2/64));
+
+ if (gc->arc_mode == ArcChord) {
+ boxWidth = theRect.right - theRect.left;
+ boxHeight = theRect.bottom - theRect.top;
+ angle = radians(-arcPtr->angle1/64.0);
+ sin1 = sin(angle);
+ cos1 = cos(angle);
+ angle -= radians(arcPtr->angle2/64.0);
+ sin2 = sin(angle);
+ cos2 = cos(angle);
+ vertex[0] = (theRect.left + theRect.right)/2.0;
+ vertex[1] = (theRect.top + theRect.bottom)/2.0;
+ center1[0] = vertex[0] + cos1*boxWidth/2.0;
+ center1[1] = vertex[1] + sin1*boxHeight/2.0;
+ center2[0] = vertex[0] + cos2*boxWidth/2.0;
+ center2[1] = vertex[1] + sin2*boxHeight/2.0;
+
+ polygon = OpenPoly();
+ MoveTo((short) ((theRect.left + theRect.right)/2),
+ (short) ((theRect.top + theRect.bottom)/2));
+ LineTo((short) (center1[0] + .5), (short) (center1[1] + .5));
+ LineTo((short) (center2[0] + .5), (short) (center2[1] + .5));
+ ClosePoly();
+ FillCArc(&theRect, start, extent, dc.penPat);
+ FillCPoly(polygon, dc.penPat);
+ KillPoly(polygon);
+ } else {
+ FillCArc(&theRect, start, extent, dc.penPat);
+ }
+ }
+ }
+ TkMacOSXRestoreDrawingContext(&dc);
+}
+#endif
+
+#ifdef TK_MACOSXDRAW_UNUSED
+/*
+ *----------------------------------------------------------------------
+ *
+ * XMaxRequestSize --
+ *
+ *----------------------------------------------------------------------
+ */
+
+long
+XMaxRequestSize(
+ Display *display)
+{
+ return (SHRT_MAX / 4);
+}
+#endif
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkScrollWindow --
+ *
+ * Scroll a rectangle of the specified window and accumulate
+ * a damage region.
+ *
+ * Results:
+ * Returns 0 if the scroll genereated no additional damage.
+ * Otherwise, sets the region that needs to be repainted after
+ * scrolling and returns 1.
+ *
+ * Side effects:
+ * Scrolls the bits in the window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkScrollWindow(
+ Tk_Window tkwin, /* The window to be scrolled. */
+ GC gc, /* GC for window to be scrolled. */
+ int x, int y, /* Position rectangle to be scrolled. */
+ int width, int height,
+ int dx, int dy, /* Distance rectangle should be moved. */
+ TkRegion damageRgn) /* Region to accumulate damage in. */
+{
+ MacDrawable *destDraw = (MacDrawable *) Tk_WindowId(tkwin);
+ CGrafPtr destPort, savePort;
+ Boolean portChanged;
+ Rect scrollRect;
+ int result;
+ HIShapeRef dmgRgn;
+
+ /*
+ * Due to the implementation below the behavior may be differnt
+ * than X in certain cases that should never occur in Tk. The
+ * scrollRect is the source rect extended by the offset (the union
+ * of the source rect and the offset rect). Everything
+ * in the extended scrollRect is scrolled. On X, it's possible
+ * to "skip" over an area if the offset makes the source and
+ * destination rects disjoint and non-aligned.
+ */
+
+ scrollRect.left = destDraw->xOff + x;
+ scrollRect.top = destDraw->yOff + y;
+ scrollRect.right = scrollRect.left + width;
+ scrollRect.bottom = scrollRect.top + height;
+ if (dx < 0) {
+ scrollRect.left += dx;
+ } else {
+ scrollRect.right += dx;
+ }
+ if (dy < 0) {
+ scrollRect.top += dy;
+ } else {
+ scrollRect.bottom += dy;
+ }
+
+ destPort = TkMacOSXGetDrawablePort(Tk_WindowId(tkwin));
+ TkMacOSXSetUpClippingRgn(Tk_WindowId(tkwin));
+ TkMacOSXCheckTmpQdRgnEmpty();
+ portChanged = QDSwapPort(destPort, &savePort);
+ ScrollRect(&scrollRect, dx, dy, tkMacOSXtmpQdRgn);
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+
+ /*
+ * Fortunately, the region returned by ScrollRect is semantically
+ * the same as what we need to return in this function. If the
+ * region is empty we return zero to denote that no damage was
+ * created.
+ */
+
+ dmgRgn = HIShapeCreateWithQDRgn(tkMacOSXtmpQdRgn);
+ SetEmptyRgn(tkMacOSXtmpQdRgn);
+ TkMacOSXSetWithNativeRegion(damageRgn, dmgRgn);
+ result = HIShapeIsEmpty(dmgRgn) ? 0 : 1;
+ CFRelease(dmgRgn);
+
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXSetUpGraphicsPort --
+ *
+ * Set up the graphics port from the given GC.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The current port is adjusted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXSetUpGraphicsPort(
+ GC gc, /* GC to apply to current port. */
+ void *destPort)
+{
+ CGrafPtr savePort;
+ Boolean portChanged;
+
+ portChanged = QDSwapPort(destPort, &savePort);
+ PenNormal();
+ if (gc) {
+ if (!penPat) {
+ if (!tmpPixPat) {
+ penPat = NewPixPat();
+ } else {
+ penPat = tmpPixPat;
+ tmpPixPat = NULL;
+ }
+ }
+ TkMacOSXSetColorInPort(gc->foreground, 1, penPat, destPort);
+ PenPixPat(penPat);
+ if(gc->function == GXxor) {
+ PenMode(patXor);
+ }
+ if (gc->line_width > 1) {
+ PenSize(gc->line_width, gc->line_width);
+ }
+ if (gc->line_style != LineSolid) {
+ /*
+ * FIXME: Here the dash pattern should be set in the drawing
+ * environment. This is not possible with QuickDraw line drawing.
+ */
+ }
+ }
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXSetUpDrawingContext --
+ *
+ * Set up a drawing context for the given drawable and GC.
+ *
+ * Results:
+ * Boolean indicating whether it is ok to draw; if false, drawing
+ * context was not setup, so do not attempt to draw and do not call
+ * TkMacOSXRestoreDrawingContext().
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkMacOSXSetupDrawingContext(
+ Drawable d,
+ GC gc,
+ int useCG, /* advisory only ! */
+ TkMacOSXDrawingContext *dcPtr)
+{
+ MacDrawable *macDraw = ((MacDrawable*)d);
+ int dontDraw = 0;
+ TkMacOSXDrawingContext dc = {NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ {SHRT_MIN, SHRT_MIN, SHRT_MAX, SHRT_MAX}, false};
+
+ if (tkPictureIsOpen) {
+ if (useCG) {
+ TkMacOSXDbgMsg("Ignored CG Drawing with QD Picture open");
+ dontDraw = 1;
+ }
+ } else {
+ dc.clipRgn = TkMacOSXGetClipRgn(d);
+ }
+ if (!dontDraw) {
+ ClipToGC(d, gc, &dc.clipRgn);
+ dontDraw = dc.clipRgn ? HIShapeIsEmpty(dc.clipRgn) : 0;
+ }
+ if (dontDraw) {
+ if (dc.clipRgn) {
+ CFRelease(dc.clipRgn);
+ dc.clipRgn = NULL;
+ }
+ goto end;
+ }
+ if (useCG) {
+ dc.context = macDraw->context;
+ }
+ if (!dc.context || !(macDraw->flags & TK_IS_PIXMAP)) {
+ dc.port = TkMacOSXGetDrawablePort(d);
+ if (dc.port) {
+ GetPortBounds(dc.port, &dc.portBounds);
+ }
+ }
+ if (dc.context) {
+ if (!dc.port) {
+ CGRect r;
+
+ TK_IF_MAC_OS_X_API (3, CGContextGetClipBoundingBox,
+ r = CGContextGetClipBoundingBox(dc.context);
+ ) TK_ELSE_MAC_OS_X (3,
+ r.origin = CGPointZero;
+ r.size = macDraw->size;
+ ) TK_ENDIF
+ SetRect(&dc.portBounds, r.origin.x + macDraw->xOff,
+ r.origin.y + macDraw->yOff,
+ r.origin.x + r.size.width + macDraw->xOff,
+ r.origin.y + r.size.height + macDraw->yOff);
+ }
+ CGContextSaveGState(dc.context);
+ dc.saveState = (void*)1;
+ dc.port = NULL;
+ } else if (dc.port) {
+ dc.portChanged = QDSwapPort(dc.port, &dc.savePort);
+ if (useCG && ChkErr(QDBeginCGContext, dc.port, &dc.context) == noErr) {
+ SyncCGContextOriginWithPort(dc.context, dc.port);
+ } else {
+ dc.context = NULL;
+ }
+ } else {
+ Tcl_Panic("TkMacOSXSetupDrawingContext(): "
+ "no port or context to draw into !");
+ }
+ if (dc.context) {
+ CGContextConcatCTM(dc.context, CGAffineTransformMake(1.0, 0.0, 0.0,
+ -1.0, 0.0, dc.portBounds.bottom - dc.portBounds.top));
+ if (dc.clipRgn) {
+#ifdef TK_MAC_DEBUG_DRAWING
+ CGContextSaveGState(dc.context);
+ ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context);
+ CGContextSetRGBFillColor(dc.context, 1.0, 0.0, 0.0, 0.2);
+ CGContextEOFillPath(dc.context);
+ CGContextRestoreGState(dc.context);
+#endif /* TK_MAC_DEBUG_DRAWING */
+ ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context);
+ CGContextEOClip(dc.context);
+ }
+ if (gc) {
+ static const CGLineCap cgCap[] = {
+ [CapNotLast] = kCGLineCapButt,
+ [CapButt] = kCGLineCapButt,
+ [CapRound] = kCGLineCapRound,
+ [CapProjecting] = kCGLineCapSquare,
+ };
+ static const CGLineJoin cgJoin[] = {
+ [JoinMiter] = kCGLineJoinMiter,
+ [JoinRound] = kCGLineJoinRound,
+ [JoinBevel] = kCGLineJoinBevel,
+ };
+ bool shouldAntialias;
+ double w = gc->line_width;
+
+ TkMacOSXSetColorInContext(gc->foreground, dc.context);
+ if (dc.port) {
+ CGContextSetPatternPhase(dc.context, CGSizeMake(
+ dc.portBounds.right - dc.portBounds.left,
+ dc.portBounds.bottom - dc.portBounds.top));
+ }
+ if(gc->function != GXcopy) {
+ TkMacOSXDbgMsg("Logical functions other than GXcopy are "
+ "not supported for CG drawing!");
+ }
+ /* When should we antialias? */
+ shouldAntialias = !notAA(gc->line_width);
+ if (!shouldAntialias) {
+ /* Make non-antialiased CG drawing look more like X11 */
+ w -= (gc->line_width ? NON_AA_CG_OFFSET : 0);
+ }
+ CGContextSetShouldAntialias(dc.context, shouldAntialias);
+ CGContextSetLineWidth(dc.context, w);
+ if (gc->line_style != LineSolid) {
+ int num = 0;
+ char *p = &(gc->dashes);
+ double dashOffset = gc->dash_offset;
+ float lengths[10];
+
+ while (p[num] != '\0' && num < 10) {
+ lengths[num] = p[num];
+ num++;
+ }
+ CGContextSetLineDash(dc.context, dashOffset, lengths, num);
+ }
+ if ((unsigned)gc->cap_style < sizeof(cgCap)/sizeof(CGLineCap)) {
+ CGContextSetLineCap(dc.context,
+ cgCap[(unsigned)gc->cap_style]);
+ }
+ if ((unsigned)gc->join_style < sizeof(cgJoin)/sizeof(CGLineJoin)) {
+ CGContextSetLineJoin(dc.context,
+ cgJoin[(unsigned)gc->join_style]);
+ }
+ }
+ } else if (dc.port) {
+ PixPatHandle savePat = penPat;
+
+ ChkErr(GetThemeDrawingState, &dc.saveState);
+ penPat = NULL;
+ TkMacOSXSetUpGraphicsPort(gc, dc.port);
+ dc.penPat = penPat;
+ penPat = savePat;
+ dc.saveClip = NewRgn();
+ GetPortClipRegion(dc.port, dc.saveClip);
+ if (dc.clipRgn) {
+ ChkErr(HIShapeSetQDClip, dc.clipRgn, dc.port);
+ } else {
+ NoQDClip(dc.port);
+ }
+ if (!tkPictureIsOpen) {
+ ShowPen();
+ }
+ }
+end:
+ *dcPtr = dc;
+ return !dontDraw;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXRestoreDrawingContext --
+ *
+ * Restore drawing context.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXRestoreDrawingContext(
+ TkMacOSXDrawingContext *dcPtr)
+{
+ if (dcPtr->context) {
+ CGContextSynchronize(dcPtr->context);
+ if (dcPtr->saveState) {
+ CGContextRestoreGState(dcPtr->context);
+ }
+ if (dcPtr->port) {
+ ChkErr(QDEndCGContext, dcPtr->port, &(dcPtr->context));
+ }
+ } else if (dcPtr->port) {
+ if (!tkPictureIsOpen) {
+ HidePen();
+ }
+ PenNormal();
+ if (dcPtr->saveClip) {
+ SetPortClipRegion(dcPtr->port, dcPtr->saveClip);
+ DisposeRgn(dcPtr->saveClip);
+ }
+ if (dcPtr->penPat) {
+ if (!tmpPixPat) {
+ tmpPixPat = dcPtr->penPat;
+ } else {
+ DisposePixPat(dcPtr->penPat);
+ }
+ }
+ if (dcPtr->saveState) {
+ ChkErr(SetThemeDrawingState, dcPtr->saveState, true);
+ }
+ }
+ if (dcPtr->clipRgn) {
+ CFRelease(dcPtr->clipRgn);
+ }
+ if (dcPtr->portChanged) {
+ QDSwapPort(dcPtr->savePort, NULL);
+ }
+#ifdef TK_MAC_DEBUG
+ bzero(dcPtr, sizeof(TkMacOSXDrawingContext));
+#endif /* TK_MAC_DEBUG */
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetClipRgn --
+ *
+ * Get the clipping region needed to restrict drawing to the given
+ * drawable.
+ *
+ * Results:
+ * Clipping region. If non-NULL, CFRelease it when done.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+HIShapeRef
+TkMacOSXGetClipRgn(
+ Drawable drawable) /* Drawable. */
+{
+ MacDrawable *macDraw = (MacDrawable *) drawable;
+ HIShapeRef clipRgn = NULL;
+ CGRect r;
+
+ if (macDraw->winPtr && macDraw->flags & TK_CLIP_INVALID) {
+ TkMacOSXUpdateClipRgn(macDraw->winPtr);
+#ifdef TK_MAC_DEBUG_DRAWING
+ TkMacOSXDbgMsg("%s visRgn ", macDraw->winPtr->pathName);
+ TkMacOSXDebugFlashRegion(drawable, macDraw->visRgn);
+#endif /* TK_MAC_DEBUG_DRAWING */
+ }
+
+ if (macDraw->flags & TK_CLIPPED_DRAW) {
+ r = CGRectOffset(macDraw->drawRect, macDraw->xOff, macDraw->yOff);
+ }
+ if (macDraw->visRgn) {
+ if (macDraw->flags & TK_CLIPPED_DRAW) {
+ HIShapeRef rgn = HIShapeCreateWithRect(&r);
+
+ clipRgn = HIShapeCreateIntersection(macDraw->visRgn, rgn);
+ CFRelease(rgn);
+ } else {
+ clipRgn = HIShapeCreateCopy(macDraw->visRgn);
+ }
+ } else if (macDraw->flags & TK_CLIPPED_DRAW) {
+ clipRgn = HIShapeCreateWithRect(&r);
+ }
+#ifdef TK_MAC_DEBUG_DRAWING
+ TkMacOSXDbgMsg("%s clipRgn ", macDraw->winPtr->pathName);
+ TkMacOSXDebugFlashRegion(drawable, clipRgn);
+#endif /* TK_MAC_DEBUG_DRAWING */
+
+ return clipRgn;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXSetUpClippingRgn --
+ *
+ * Set up the clipping region so that drawing only occurs on the
+ * specified X subwindow.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The clipping region in the current port is changed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXSetUpClippingRgn(
+ Drawable drawable) /* Drawable to update. */
+{
+ CGrafPtr port = TkMacOSXGetDrawablePort(drawable);
+
+ if (port) {
+ HIShapeRef clipRgn = TkMacOSXGetClipRgn(drawable);
+
+ if (clipRgn) {
+ ChkErr(HIShapeSetQDClip, clipRgn, port);
+ CFRelease(clipRgn);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpClipDrawableToRect --
+ *
+ * Clip all drawing into the drawable d to the given rectangle.
+ * If width and height are negative, reset to no clipping.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Subsequent drawing into d is offset and clipped as specified.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpClipDrawableToRect(
+ Display *display,
+ Drawable d,
+ int x, int y,
+ int width, int height)
+{
+ MacDrawable *macDraw = (MacDrawable *) d;
+
+ if (width < 0 && height < 0) {
+ macDraw->drawRect = CGRectNull;
+ macDraw->flags &= ~TK_CLIPPED_DRAW;
+ } else {
+ macDraw->drawRect = CGRectMake(x, y, width, height);
+ macDraw->flags |= TK_CLIPPED_DRAW;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ClipToGC --
+ *
+ * Helper function to intersect given region with gc clip region.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ClipToGC(
+ Drawable d,
+ GC gc,
+ HIShapeRef *clipRgnPtr) /* must point to initialized variable */
+{
+ if (gc && gc->clip_mask &&
+ ((TkpClipMask*)gc->clip_mask)->type == TKP_CLIP_REGION) {
+ TkRegion gcClip = ((TkpClipMask*)gc->clip_mask)->value.region;
+ int xOffset = ((MacDrawable *) d)->xOff + gc->clip_x_origin;
+ int yOffset = ((MacDrawable *) d)->yOff + gc->clip_y_origin;
+ HIShapeRef clipRgn = *clipRgnPtr, gcClipRgn;
+
+ if (!tkPictureIsOpen) {
+ TkMacOSXOffsetRegion(gcClip, xOffset, yOffset);
+ }
+ gcClipRgn = TkMacOSXGetNativeRegion(gcClip);
+ if (clipRgn) {
+ *clipRgnPtr = HIShapeCreateIntersection(gcClipRgn, clipRgn);
+ CFRelease(clipRgn);
+ } else {
+ *clipRgnPtr = HIShapeCreateCopy(gcClipRgn);
+ }
+ CFRelease(gcClipRgn);
+ if (!tkPictureIsOpen) {
+ TkMacOSXOffsetRegion(gcClip, -xOffset, -yOffset);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * NoQDClip --
+ *
+ * Helper function to setup a QD port to not clip anything.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+NoQDClip(
+ CGrafPtr port)
+{
+ static RgnHandle noClipRgn = NULL;
+
+ if (!noClipRgn) {
+ noClipRgn = NewRgn();
+ SetRectRgn(noClipRgn, SHRT_MIN, SHRT_MIN, SHRT_MAX, SHRT_MAX);
+ }
+ SetPortClipRegion(port, noClipRgn);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXMakeStippleMap --
+ *
+ * Given a drawable and a stipple pattern this function draws the
+ * pattern repeatedly over the drawable. The drawable can then
+ * be used as a mask for bit-bliting a stipple pattern over an
+ * object.
+ *
+ * Results:
+ * A BitMap data structure.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void *
+TkMacOSXMakeStippleMap(
+ Drawable drawable, /* Window to apply stipple. */
+ Drawable stipple) /* The stipple pattern. */
+{
+ CGrafPtr stipplePort;
+ BitMapPtr bitmapPtr;
+ const BitMap *stippleBitmap;
+ Rect portRect;
+ int width, height, stippleHeight, stippleWidth, i, j;
+ Rect bounds;
+
+ GetPortBounds(TkMacOSXGetDrawablePort(drawable), &portRect);
+ width = portRect.right - portRect.left;
+ height = portRect.bottom - portRect.top;
+ bitmapPtr = ckalloc(sizeof(BitMap));
+ bitmapPtr->bounds.top = bitmapPtr->bounds.left = 0;
+ bitmapPtr->bounds.right = (short) width;
+ bitmapPtr->bounds.bottom = (short) height;
+ bitmapPtr->rowBytes = (width / 8) + 1;
+ bitmapPtr->baseAddr = ckalloc(height * bitmapPtr->rowBytes);
+
+ stipplePort = TkMacOSXGetDrawablePort(stipple);
+ stippleBitmap = GetPortBitMapForCopyBits(stipplePort);
+ GetPortBounds(stipplePort, &portRect);
+ stippleWidth = portRect.right - portRect.left;
+ stippleHeight = portRect.bottom - portRect.top;
+
+ for (i = 0; i < height; i += stippleHeight) {
+ for (j = 0; j < width; j += stippleWidth) {
+ bounds.left = j;
+ bounds.top = i;
+ bounds.right = j + stippleWidth;
+ bounds.bottom = i + stippleHeight;
+ CopyBits(stippleBitmap, bitmapPtr, &portRect, &bounds, srcCopy,
+ NULL);
+ }
+ }
+ return bitmapPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDrawHighlightBorder --
+ *
+ * This procedure draws a rectangular ring around the outside of
+ * a widget to indicate that it has received the input focus.
+ *
+ * On the Macintosh, this puts a 1 pixel border in the bgGC color
+ * between the widget and the focus ring, except in the case where
+ * highlightWidth is 1, in which case the border is left out.
+ *
+ * For proper Mac L&F, use highlightWidth of 3.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A rectangle "width" pixels wide is drawn in "drawable",
+ * corresponding to the outer area of "tkwin".
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDrawHighlightBorder (
+ Tk_Window tkwin,
+ GC fgGC,
+ GC bgGC,
+ int highlightWidth,
+ Drawable drawable)
+{
+ if (highlightWidth == 1) {
+ TkDrawInsetFocusHighlight (tkwin, fgGC, highlightWidth, drawable, 0);
+ } else {
+ TkDrawInsetFocusHighlight (tkwin, bgGC, highlightWidth, drawable, 0);
+ if (fgGC != bgGC) {
+ TkDrawInsetFocusHighlight (tkwin, fgGC, highlightWidth - 1,
+ drawable, 0);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDrawFrame --
+ *
+ * This procedure draws the rectangular frame area. If the user
+ * has request themeing, it draws with a the background theme.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Draws inside the tkwin area.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDrawFrame(
+ Tk_Window tkwin,
+ Tk_3DBorder border,
+ int highlightWidth,
+ int borderWidth,
+ int relief)
+{
+ if (useThemedToplevel && Tk_IsTopLevel(tkwin)) {
+ static Tk_3DBorder themedBorder = NULL;
+
+ if (!themedBorder) {
+ themedBorder = Tk_Get3DBorder(NULL, tkwin,
+ "systemWindowHeaderBackground");
+ }
+ if (themedBorder) {
+ border = themedBorder;
+ }
+ }
+ Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin),
+ border, highlightWidth, highlightWidth,
+ Tk_Width(tkwin) - 2 * highlightWidth,
+ Tk_Height(tkwin) - 2 * highlightWidth,
+ borderWidth, relief);
+}
diff --git a/carbon/tkMacOSXEmbed.c b/carbon/tkMacOSXEmbed.c
new file mode 100644
index 0000000..ad9e3da
--- /dev/null
+++ b/carbon/tkMacOSXEmbed.c
@@ -0,0 +1,1181 @@
+/*
+ * tkMacOSXEmbed.c --
+ *
+ * This file contains platform-specific procedures for theMac to provide
+ * basic operations needed for application embedding (where one
+ * application can use as its main window an internal window from some
+ * other application). Currently only Toplevel embedding within the same
+ * Tk application is allowed on the Macintosh.
+ *
+ * Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2008 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXInt.h"
+#include "tkBusy.h"
+
+/*
+ * One of the following structures exists for each container in this
+ * application. It keeps track of the container window and its associated
+ * embedded window.
+ */
+
+typedef struct Container {
+ Window parent; /* The Mac Drawable for the parent of the pair
+ * (the container). */
+ TkWindow *parentPtr; /* Tk's information about the container, or
+ * NULL if the container isn't in this
+ * process. */
+ Window embedded; /* The MacDrawable for the embedded window.
+ * Starts off as None, but gets filled in when
+ * the window is eventually created. */
+ TkWindow *embeddedPtr; /* Tk's information about the embedded window,
+ * or NULL if the embedded application isn't
+ * in this process. */
+ struct Container *nextPtr; /* Next in list of all containers in this
+ * process. */
+} Container;
+
+static Container *firstContainerPtr = NULL;
+ /* First in list of all containers managed by
+ * this process. */
+/*
+ * Globals defined in this file:
+ */
+
+TkMacOSXEmbedHandler *tkMacOSXEmbedHandler = NULL;
+
+/*
+ * Prototypes for static procedures defined in this file:
+ */
+
+static void ContainerEventProc(ClientData clientData, XEvent *eventPtr);
+static void EmbeddedEventProc(ClientData clientData, XEvent *eventPtr);
+static void EmbedActivateProc(ClientData clientData, XEvent *eventPtr);
+static void EmbedFocusProc(ClientData clientData, XEvent *eventPtr);
+static void EmbedGeometryRequest(Container *containerPtr, int width,
+ int height);
+static void EmbedSendConfigure(Container *containerPtr);
+static void EmbedStructureProc(ClientData clientData, XEvent *eventPtr);
+static void EmbedWindowDeleted(TkWindow *winPtr);
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_MacOSXSetEmbedHandler --
+ *
+ * Registers a handler for an in process form of embedding, like Netscape
+ * plugins, where Tk is loaded into the process, but does not control the
+ * main window
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * The embed handler is set.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_MacOSXSetEmbedHandler(
+ Tk_MacOSXEmbedRegisterWinProc *registerWinProc,
+ Tk_MacOSXEmbedGetGrafPortProc *getPortProc,
+ Tk_MacOSXEmbedMakeContainerExistProc *containerExistProc,
+ Tk_MacOSXEmbedGetClipProc *getClipProc,
+ Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc)
+{
+ if (tkMacOSXEmbedHandler == NULL) {
+ tkMacOSXEmbedHandler = ckalloc(sizeof(TkMacOSXEmbedHandler));
+ }
+ tkMacOSXEmbedHandler->registerWinProc = registerWinProc;
+ tkMacOSXEmbedHandler->getPortProc = getPortProc;
+ tkMacOSXEmbedHandler->containerExistProc = containerExistProc;
+ tkMacOSXEmbedHandler->getClipProc = getClipProc;
+ tkMacOSXEmbedHandler->getOffsetProc = getOffsetProc;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpMakeWindow --
+ *
+ * Creates an X Window (Mac subwindow).
+ *
+ * Results:
+ * The window id is returned.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Window
+TkpMakeWindow(
+ TkWindow *winPtr,
+ Window parent)
+{
+ MacDrawable *macWin;
+
+ /*
+ * If this window is marked as embedded then the window structure should
+ * have already been created in the TkpUseWindow function.
+ */
+
+ if (Tk_IsEmbedded(winPtr)) {
+ macWin = winPtr->privatePtr;
+ } else {
+ /*
+ * Allocate sub window
+ */
+
+ macWin = ckalloc(sizeof(MacDrawable));
+ if (macWin == NULL) {
+ winPtr->privatePtr = NULL;
+ return None;
+ }
+ macWin->winPtr = winPtr;
+ winPtr->privatePtr = macWin;
+ macWin->visRgn = NULL;
+ macWin->aboveVisRgn = NULL;
+ macWin->drawRect = CGRectNull;
+ macWin->referenceCount = 0;
+ macWin->flags = TK_CLIP_INVALID;
+ macWin->grafPtr = NULL;
+ macWin->context = NULL;
+ macWin->size = CGSizeZero;
+ if (Tk_IsTopLevel(macWin->winPtr)) {
+ /*
+ * This will be set when we are mapped.
+ */
+
+ macWin->xOff = 0;
+ macWin->yOff = 0;
+ macWin->toplevel = macWin;
+ } else {
+ macWin->xOff = winPtr->parentPtr->privatePtr->xOff +
+ winPtr->parentPtr->changes.border_width +
+ winPtr->changes.x;
+ macWin->yOff = winPtr->parentPtr->privatePtr->yOff +
+ winPtr->parentPtr->changes.border_width +
+ winPtr->changes.y;
+ macWin->toplevel = winPtr->parentPtr->privatePtr->toplevel;
+ }
+ macWin->toplevel->referenceCount++;
+ }
+ return (Window) macWin;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpUseWindow --
+ *
+ * This procedure causes a Tk window to use a given X window as its
+ * parent window, rather than the root window for the screen. It is
+ * invoked by an embedded application to specify the window in which it
+ * is embedded.
+ *
+ * Results:
+ * The return value is normally TCL_OK. If an error occurs (such as
+ * string not being a valid window spec), then the return value is
+ * TCL_ERROR and an error message is left in the interp's result if
+ * interp is non-NULL.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpUseWindow(
+ Tcl_Interp *interp, /* If not NULL, used for error reporting if
+ * string is bogus. */
+ Tk_Window tkwin, /* Tk window that does not yet have an
+ * associated X window. */
+ const char *string) /* String identifying an X window to use for
+ * tkwin; must be an integer value. */
+{
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *usePtr;
+ MacDrawable *parent, *macWin;
+ Container *containerPtr;
+
+ if (winPtr->window != None) {
+ Tcl_AppendResult(interp, "can't modify container after widget is "
+ "created", NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Decode the container pointer, and look for it among the list of
+ * available containers.
+ *
+ * N.B. For now, we are limiting the containers to be in the same Tk
+ * application as tkwin, since otherwise they would not be in our list of
+ * containers.
+ */
+
+ if (Tcl_GetInt(interp, string, (int*) &parent) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ usePtr = (TkWindow *) Tk_IdToWindow(winPtr->display, (Window) parent);
+ if (usePtr != NULL) {
+ if (!(usePtr->flags & TK_CONTAINER)) {
+ Tcl_AppendResult(interp, "window \"", usePtr->pathName,
+ "\" doesn't have -container option set", NULL);
+ return TCL_ERROR;
+ }
+ }
+
+ /*
+ * The code below can probably be simplified given we have already
+ * discovered 'usePtr' above.
+ */
+
+ /*
+ * Save information about the container and the embedded window in a
+ * Container structure. Currently, there must already be an existing
+ * Container structure, since we only allow the case where both container
+ * and embedded app. are in the same process.
+ */
+
+ for (containerPtr = firstContainerPtr; containerPtr != NULL;
+ containerPtr = containerPtr->nextPtr) {
+ if (containerPtr->parent == (Window) parent) {
+ winPtr->flags |= TK_BOTH_HALVES;
+ containerPtr->parentPtr->flags |= TK_BOTH_HALVES;
+ break;
+ }
+ }
+
+ /*
+ * Make the embedded window.
+ */
+
+ macWin = ckalloc(sizeof(MacDrawable));
+ if (macWin == NULL) {
+ winPtr->privatePtr = NULL;
+ return TCL_ERROR;
+ }
+
+ macWin->winPtr = winPtr;
+ winPtr->privatePtr = macWin;
+
+ /*
+ * The grafPtr will be NULL for a Tk in Tk embedded window. It is none of
+ * our business what it is for a Tk not in Tk embedded window, but we will
+ * initialize it to NULL, and let the registerWinProc set it. In any case,
+ * you must always use TkMacOSXGetDrawablePort to get the portPtr. It will
+ * correctly find the container's port.
+ */
+
+ macWin->grafPtr = NULL;
+ macWin->context = NULL;
+ macWin->size = CGSizeZero;
+ macWin->visRgn = NULL;
+ macWin->aboveVisRgn = NULL;
+ macWin->drawRect = CGRectNull;
+ macWin->referenceCount = 0;
+ macWin->flags = TK_CLIP_INVALID;
+ macWin->toplevel = macWin;
+ macWin->toplevel->referenceCount++;
+
+ winPtr->flags |= TK_EMBEDDED;
+
+ /*
+ * Make a copy of the TK_EMBEDDED flag, since sometimes we need this to
+ * get the port after the TkWindow structure has been freed.
+ */
+
+ macWin->flags |= TK_EMBEDDED;
+
+ /*
+ * Now check whether it is embedded in another Tk widget. If not (the
+ * first case below) we see if there is an in-process embedding handler
+ * registered, and if so, let that fill in the rest of the macWin.
+ */
+
+ if (containerPtr == NULL) {
+ /*
+ * If someone has registered an in process embedding handler, then
+ * see if it can handle this window...
+ */
+
+ if (tkMacOSXEmbedHandler == NULL ||
+ tkMacOSXEmbedHandler->registerWinProc((int) parent,
+ (Tk_Window) winPtr) != TCL_OK) {
+ Tcl_AppendResult(interp, "The window ID ", string,
+ " does not correspond to a valid Tk Window.", NULL);
+ return TCL_ERROR;
+ } else {
+ containerPtr = ckalloc(sizeof(Container));
+
+ containerPtr->parentPtr = NULL;
+ containerPtr->embedded = (Window) macWin;
+ containerPtr->embeddedPtr = macWin->winPtr;
+ containerPtr->nextPtr = firstContainerPtr;
+ firstContainerPtr = containerPtr;
+ }
+ } else {
+ /*
+ * The window is embedded in another Tk window.
+ */
+
+ macWin->xOff = parent->winPtr->privatePtr->xOff +
+ parent->winPtr->changes.border_width +
+ winPtr->changes.x;
+ macWin->yOff = parent->winPtr->privatePtr->yOff +
+ parent->winPtr->changes.border_width +
+ winPtr->changes.y;
+
+ /*
+ * Finish filling up the container structure with the embedded
+ * window's information.
+ */
+
+ containerPtr->embedded = (Window) macWin;
+ containerPtr->embeddedPtr = macWin->winPtr;
+
+ /*
+ * Create an event handler to clean up the Container structure when
+ * tkwin is eventually deleted.
+ */
+
+ Tk_CreateEventHandler(tkwin, StructureNotifyMask, EmbeddedEventProc,
+ winPtr);
+ }
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpMakeContainer --
+ *
+ * This procedure is called to indicate that a particular window will be
+ * a container for an embedded application. This changes certain aspects
+ * of the window's behavior, such as whether it will receive events
+ * anymore.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpMakeContainer(
+ Tk_Window tkwin) /* Token for a window that is about to become
+ * a container. */
+{
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ Container *containerPtr;
+
+ /*
+ * Register the window as a container so that, for example, we can make
+ * sure the argument to -use is valid.
+ */
+
+ Tk_MakeWindowExist(tkwin);
+ containerPtr = ckalloc(sizeof(Container));
+ containerPtr->parent = Tk_WindowId(tkwin);
+ containerPtr->parentPtr = winPtr;
+ containerPtr->embedded = None;
+ containerPtr->embeddedPtr = NULL;
+ containerPtr->nextPtr = firstContainerPtr;
+ firstContainerPtr = containerPtr;
+ winPtr->flags |= TK_CONTAINER;
+
+ /*
+ * Request SubstructureNotify events so that we can find out when the
+ * embedded application creates its window or attempts to resize it. Also
+ * watch Configure events on the container so that we can resize the child
+ * to match. Also, pass activate events from the container down to the
+ * embedded toplevel.
+ */
+
+ Tk_CreateEventHandler(tkwin,
+ SubstructureNotifyMask|SubstructureRedirectMask,
+ ContainerEventProc, winPtr);
+ Tk_CreateEventHandler(tkwin, StructureNotifyMask, EmbedStructureProc,
+ containerPtr);
+ Tk_CreateEventHandler(tkwin, ActivateMask, EmbedActivateProc,
+ containerPtr);
+ Tk_CreateEventHandler(tkwin, FocusChangeMask, EmbedFocusProc,
+ containerPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXContainerId --
+ *
+ * Given an embedded window, this procedure returns the MacDrawable
+ * identifier for the associated container window.
+ *
+ * Results:
+ * The return value is the MacDrawable for winPtr's container window.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MacDrawable *
+TkMacOSXContainerId(
+ TkWindow *winPtr) /* Tk's structure for an embedded window. */
+{
+ Container *containerPtr;
+
+ for (containerPtr = firstContainerPtr; containerPtr != NULL;
+ containerPtr = containerPtr->nextPtr) {
+ if (containerPtr->embeddedPtr == winPtr) {
+ return (MacDrawable *) containerPtr->parent;
+ }
+ }
+ Tcl_Panic("TkMacOSXContainerId couldn't find window");
+ return None;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetHostToplevel --
+ *
+ * Given the TkWindow, return the MacDrawable for the outermost toplevel
+ * containing it. This will be a real Macintosh window.
+ *
+ * Results:
+ * Returns a MacDrawable corresponding to a Macintosh Toplevel
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MacDrawable *
+TkMacOSXGetHostToplevel(
+ TkWindow *winPtr) /* Tk's structure for a window. */
+{
+ TkWindow *contWinPtr, *topWinPtr;
+
+ topWinPtr = winPtr->privatePtr->toplevel->winPtr;
+ if (!Tk_IsEmbedded(topWinPtr)) {
+ return winPtr->privatePtr->toplevel;
+ }
+ contWinPtr = TkpGetOtherWindow(topWinPtr);
+
+ /*
+ * TODO: Here we should handle out of process embedding.
+ */
+
+ if (contWinPtr == NULL) {
+ return None;
+ }
+ return TkMacOSXGetHostToplevel(contWinPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpClaimFocus --
+ *
+ * This procedure is invoked when someone asks for the input focus to be
+ * put on a window in an embedded application, but the application
+ * doesn't currently have the focus. It requests the input focus from the
+ * container application.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The input focus may change.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpClaimFocus(
+ TkWindow *topLevelPtr, /* Top-level window containing desired focus
+ * window; should be embedded. */
+ int force) /* One means that the container should claim
+ * the focus if it doesn't currently have
+ * it. */
+{
+ XEvent event;
+ Container *containerPtr;
+
+ if (!(topLevelPtr->flags & TK_EMBEDDED)) {
+ return;
+ }
+
+ for (containerPtr = firstContainerPtr;
+ containerPtr->embeddedPtr != topLevelPtr;
+ containerPtr = containerPtr->nextPtr) {
+ /* Empty loop body. */
+ }
+
+ event.xfocus.type = FocusIn;
+ event.xfocus.serial = LastKnownRequestProcessed(topLevelPtr->display);
+ event.xfocus.send_event = 1;
+ event.xfocus.display = topLevelPtr->display;
+ event.xfocus.window = containerPtr->parent;
+ event.xfocus.mode = EMBEDDED_APP_WANTS_FOCUS;
+ event.xfocus.detail = force;
+ Tk_QueueWindowEvent(&event,TCL_QUEUE_TAIL);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpTestembedCmd --
+ *
+ * This procedure implements the "testembed" command. It returns some or
+ * all of the information in the list pointed to by firstContainerPtr.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpTestembedCmd(
+ ClientData clientData, /* Main window for application. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int argc, /* Number of arguments. */
+ const char **argv) /* Argument strings. */
+{
+ int all;
+ Container *containerPtr;
+ Tcl_DString dString;
+ char buffer[50];
+
+ if ((argc > 1) && (strcmp(argv[1], "all") == 0)) {
+ all = 1;
+ } else {
+ all = 0;
+ }
+ Tcl_DStringInit(&dString);
+ for (containerPtr = firstContainerPtr; containerPtr != NULL;
+ containerPtr = containerPtr->nextPtr) {
+ Tcl_DStringStartSublist(&dString);
+ if (containerPtr->parent == None) {
+ Tcl_DStringAppendElement(&dString, "");
+ } else if (all) {
+ sprintf(buffer, "0x%x", (int) containerPtr->parent);
+ Tcl_DStringAppendElement(&dString, buffer);
+ } else {
+ Tcl_DStringAppendElement(&dString, "XXX");
+ }
+ if (containerPtr->parentPtr == NULL) {
+ Tcl_DStringAppendElement(&dString, "");
+ } else {
+ Tcl_DStringAppendElement(&dString,
+ containerPtr->parentPtr->pathName);
+ }
+ if (containerPtr->embedded == None) {
+ Tcl_DStringAppendElement(&dString, "");
+ } else if (all) {
+ sprintf(buffer, "0x%x", (int) containerPtr->embedded);
+ Tcl_DStringAppendElement(&dString, buffer);
+ } else {
+ Tcl_DStringAppendElement(&dString, "XXX");
+ }
+ if (containerPtr->embeddedPtr == NULL) {
+ Tcl_DStringAppendElement(&dString, "");
+ } else {
+ Tcl_DStringAppendElement(&dString,
+ containerPtr->embeddedPtr->pathName);
+ }
+ Tcl_DStringEndSublist(&dString);
+ }
+ Tcl_DStringResult(interp, &dString);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpRedirectKeyEvent --
+ *
+ * This procedure is invoked when a key press or release event arrives
+ * for an application that does not believe it owns the input focus. This
+ * can happen because of embedding; for example, X can send an event to
+ * an embedded application when the real focus window is in the container
+ * application and is an ancestor of the container. This procedure's job
+ * is to forward the event back to the application where it really
+ * belongs.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The event may get sent to a different application.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpRedirectKeyEvent(
+ TkWindow *winPtr, /* Window to which the event was originally
+ * reported. */
+ XEvent *eventPtr) /* X event to redirect (should be KeyPress or
+ * KeyRelease). */
+{
+ /* TODO: Implement this or decide it definitely needs no implementation */
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetOtherWindow --
+ *
+ * If both the container and embedded window are in the same process,
+ * this procedure will return either one, given the other.
+ *
+ * Results:
+ * If winPtr is a container, the return value is the token for the
+ * embedded window, and vice versa. If the "other" window isn't in this
+ * process, NULL is returned.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkWindow *
+TkpGetOtherWindow(
+ TkWindow *winPtr) /* Tk's structure for a container or embedded
+ * window. */
+{
+ Container *containerPtr;
+
+ /*
+ * TkpGetOtherWindow returns NULL if both windows are not in the same
+ * process...
+ */
+
+ if (!(winPtr->flags & TK_BOTH_HALVES)) {
+ return NULL;
+ }
+
+ for (containerPtr = firstContainerPtr; containerPtr != NULL;
+ containerPtr = containerPtr->nextPtr) {
+ if (containerPtr->embeddedPtr == winPtr) {
+ return containerPtr->parentPtr;
+ } else if (containerPtr->parentPtr == winPtr) {
+ return containerPtr->embeddedPtr;
+ }
+ }
+ return NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * EmbeddedEventProc --
+ *
+ * This procedure is invoked by the Tk event dispatcher when various
+ * useful events are received for a window that is embedded in
+ * another application.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Our internal state gets cleaned up when an embedded window is
+ * destroyed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+EmbeddedEventProc(
+ ClientData clientData, /* Token for container window. */
+ XEvent *eventPtr) /* ResizeRequest event. */
+{
+ TkWindow *winPtr = clientData;
+
+ if (eventPtr->type == DestroyNotify) {
+ EmbedWindowDeleted(winPtr);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ContainerEventProc --
+ *
+ * This procedure is invoked by the Tk event dispatcher when various
+ * useful events are received for the children of a container window. It
+ * forwards relevant information, such as geometry requests, from the
+ * events into the container's application.
+ *
+ * NOTE: on the Mac, only the DestroyNotify branch is ever taken. We
+ * don't synthesize the other events.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Depends on the event. For example, when ConfigureRequest events occur,
+ * geometry information gets set for the container window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ContainerEventProc(
+ ClientData clientData, /* Token for container window. */
+ XEvent *eventPtr) /* ResizeRequest event. */
+{
+ TkWindow *winPtr = clientData;
+ Container *containerPtr;
+ Tk_ErrorHandler errHandler;
+
+ /*
+ * Ignore any X protocol errors that happen in this procedure (almost any
+ * operation could fail, for example, if the embedded application has
+ * deleted its window).
+ */
+
+ errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
+ -1, -1, NULL, NULL);
+
+ /*
+ * Find the Container structure associated with the parent window.
+ */
+
+ for (containerPtr = firstContainerPtr;
+ containerPtr->parent != eventPtr->xmaprequest.parent;
+ containerPtr = containerPtr->nextPtr) {
+ if (containerPtr == NULL) {
+ Tcl_Panic("ContainerEventProc couldn't find Container record");
+ }
+ }
+
+ if (eventPtr->type == CreateNotify) {
+ /*
+ * A new child window has been created in the container. Record its id
+ * in the Container structure (if more than one child is created, just
+ * remember the last one and ignore the earlier ones).
+ */
+
+ containerPtr->embedded = eventPtr->xcreatewindow.window;
+ } else if (eventPtr->type == ConfigureRequest) {
+ if ((eventPtr->xconfigurerequest.x != 0)
+ || (eventPtr->xconfigurerequest.y != 0)) {
+ /*
+ * The embedded application is trying to move itself, which isn't
+ * legal. At this point, the window hasn't actually moved, but we
+ * need to send it a ConfigureNotify event to let it know that its
+ * request has been denied. If the embedded application was also
+ * trying to resize itself, a ConfigureNotify will be sent by the
+ * geometry management code below, so we don't need to do
+ * anything. Otherwise, generate a synthetic event.
+ */
+
+ if ((eventPtr->xconfigurerequest.width == winPtr->changes.width)
+ && (eventPtr->xconfigurerequest.height
+ == winPtr->changes.height)) {
+ EmbedSendConfigure(containerPtr);
+ }
+ }
+ EmbedGeometryRequest(containerPtr,
+ eventPtr->xconfigurerequest.width,
+ eventPtr->xconfigurerequest.height);
+ } else if (eventPtr->type == MapRequest) {
+ /*
+ * The embedded application's map request was ignored and simply
+ * passed on to us, so we have to map the window for it to appear on
+ * the screen.
+ */
+
+ XMapWindow(eventPtr->xmaprequest.display,
+ eventPtr->xmaprequest.window);
+ } else if (eventPtr->type == DestroyNotify) {
+ /*
+ * The embedded application is gone. Destroy the container window.
+ */
+
+ Tk_DestroyWindow((Tk_Window) winPtr);
+ }
+ Tk_DeleteErrorHandler(errHandler);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * EmbedStructureProc --
+ *
+ * This procedure is invoked by the Tk event dispatcher when a container
+ * window owned by this application gets resized (and also at several
+ * other times that we don't care about). This procedure reflects the
+ * size change in the embedded window that corresponds to the container.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The embedded window gets resized to match the container.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+EmbedStructureProc(
+ ClientData clientData, /* Token for container window. */
+ XEvent *eventPtr) /* ResizeRequest event. */
+{
+ Container *containerPtr = clientData;
+ Tk_ErrorHandler errHandler;
+
+ if (eventPtr->type == ConfigureNotify) {
+ if (containerPtr->embedded != None) {
+ /*
+ * Ignore errors, since the embedded application could have
+ * deleted its window.
+ */
+
+ errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1,
+ -1, -1, NULL, NULL);
+ Tk_MoveResizeWindow((Tk_Window) containerPtr->embeddedPtr, 0, 0,
+ (unsigned) Tk_Width((Tk_Window) containerPtr->parentPtr),
+ (unsigned) Tk_Height((Tk_Window)containerPtr->parentPtr));
+ Tk_DeleteErrorHandler(errHandler);
+ }
+ } else if (eventPtr->type == DestroyNotify) {
+ EmbedWindowDeleted(containerPtr->parentPtr);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * EmbedActivateProc --
+ *
+ * This procedure is invoked by the Tk event dispatcher when Activate and
+ * Deactivate events occur for a container window owned by this
+ * application. It is responsible for forwarding an activate event down
+ * into the embedded toplevel.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The X focus may change.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+EmbedActivateProc(
+ ClientData clientData, /* Token for container window. */
+ XEvent *eventPtr) /* ResizeRequest event. */
+{
+ Container *containerPtr = clientData;
+
+ if (containerPtr->embeddedPtr != NULL) {
+ if (eventPtr->type == ActivateNotify) {
+ TkGenerateActivateEvents(containerPtr->embeddedPtr,1);
+ } else if (eventPtr->type == DeactivateNotify) {
+ TkGenerateActivateEvents(containerPtr->embeddedPtr,0);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * EmbedFocusProc --
+ *
+ * This procedure is invoked by the Tk event dispatcher when FocusIn and
+ * FocusOut events occur for a container window owned by this
+ * application. It is responsible for moving the focus back and forth
+ * between a container application and an embedded application.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The X focus may change.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+EmbedFocusProc(
+ ClientData clientData, /* Token for container window. */
+ XEvent *eventPtr) /* ResizeRequest event. */
+{
+ Container *containerPtr = clientData;
+ Display *display;
+ XEvent event;
+
+ if (containerPtr->embeddedPtr != NULL) {
+ display = Tk_Display(containerPtr->parentPtr);
+ event.xfocus.serial = LastKnownRequestProcessed(display);
+ event.xfocus.send_event = false;
+ event.xfocus.display = display;
+ event.xfocus.mode = NotifyNormal;
+ event.xfocus.window = containerPtr->embedded;
+
+ if (eventPtr->type == FocusIn) {
+ /*
+ * The focus just arrived at the container. Change the X focus to
+ * move it to the embedded application, if there is one. Ignore X
+ * errors that occur during this operation (it's possible that the
+ * new focus window isn't mapped).
+ */
+
+ event.xfocus.detail = NotifyNonlinear;
+ event.xfocus.type = FocusIn;
+ } else if (eventPtr->type == FocusOut) {
+ /*
+ * When the container gets a FocusOut event, it has to tell the
+ * embedded app that it has lost the focus.
+ */
+
+ event.xfocus.type = FocusOut;
+ event.xfocus.detail = NotifyNonlinear;
+ }
+
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_MARK);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * EmbedGeometryRequest --
+ *
+ * This procedure is invoked when an embedded application requests a
+ * particular size. It processes the request (which may or may not
+ * actually honor the request) and reflects the results back to the
+ * embedded application.
+ *
+ * NOTE: On the Mac, this is a stub, since we don't synthesize
+ * ConfigureRequest events.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * If we deny the child's size change request, a Configure event is
+ * synthesized to let the child know how big it ought to be. Events get
+ * processed while we're waiting for the geometry managers to do their
+ * thing.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+EmbedGeometryRequest(
+ Container *containerPtr, /* Information about the embedding. */
+ int width, int height) /* Size that the child has requested. */
+{
+ TkWindow *winPtr = containerPtr->parentPtr;
+
+ /*
+ * Forward the requested size into our geometry management hierarchy via
+ * the container window. We need to send a Configure event back to the
+ * embedded application if we decide not to honor its request; to make
+ * this happen, process all idle event handlers synchronously here (so
+ * that the geometry managers have had a chance to do whatever they want
+ * to do), and if the window's size didn't change then generate a
+ * configure event.
+ */
+
+ Tk_GeometryRequest((Tk_Window) winPtr, width, height);
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {
+ /* Empty loop body. */
+ }
+ if ((winPtr->changes.width != width)
+ || (winPtr->changes.height != height)) {
+ EmbedSendConfigure(containerPtr);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * EmbedSendConfigure --
+ *
+ * This is currently a stub. It is called to notify an embedded
+ * application of its current size and location. This procedure is called
+ * when the embedded application made a geometry request that we did not
+ * grant, so that the embedded application knows that its geometry didn't
+ * change after all. It is a response to ConfigureRequest events, which
+ * we do not currently synthesize on the Mac
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+EmbedSendConfigure(
+ Container *containerPtr) /* Information about the embedding. */
+{
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * EmbedWindowDeleted --
+ *
+ * This procedure is invoked when a window involved in embedding (as
+ * either the container or the embedded application) is destroyed. It
+ * cleans up the Container structure for the window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A Container structure may be freed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+EmbedWindowDeleted(
+ TkWindow *winPtr) /* Tk's information about window that
+ * was deleted. */
+{
+ Container *containerPtr, *prevPtr;
+
+ /*
+ * Find the Container structure for this window. Delete the information
+ * about the embedded application and free the container's record.
+ */
+
+ prevPtr = NULL;
+ containerPtr = firstContainerPtr;
+ while (1) {
+ if (containerPtr->embeddedPtr == winPtr) {
+ /*
+ * We also have to destroy our parent, to clean up the container.
+ * Fabricate an event to do this.
+ */
+
+ if (containerPtr->parentPtr != NULL &&
+ containerPtr->parentPtr->flags & TK_BOTH_HALVES) {
+ XEvent event;
+
+ event.xany.serial =
+ Tk_Display(containerPtr->parentPtr)->request;
+ event.xany.send_event = False;
+ event.xany.display = Tk_Display(containerPtr->parentPtr);
+
+ event.xany.type = DestroyNotify;
+ event.xany.window = containerPtr->parent;
+ event.xdestroywindow.event = containerPtr->parent;
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_HEAD);
+ }
+
+ containerPtr->embedded = None;
+ containerPtr->embeddedPtr = NULL;
+ break;
+ }
+ if (containerPtr->parentPtr == winPtr) {
+ containerPtr->parentPtr = NULL;
+ break;
+ }
+ prevPtr = containerPtr;
+ containerPtr = containerPtr->nextPtr;
+ }
+ if ((containerPtr->embeddedPtr == NULL)
+ && (containerPtr->parentPtr == NULL)) {
+ if (prevPtr == NULL) {
+ firstContainerPtr = containerPtr->nextPtr;
+ } else {
+ prevPtr->nextPtr = containerPtr->nextPtr;
+ }
+ ckfree(containerPtr);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpShowBusyWindow, TkpHideBusyWindow, TkpMakeTransparentWindowExist,
+ * TkpCreateBusy --
+ *
+ * Portability layer for busy windows. Holds platform-specific gunk for
+ * the [tk busy] command, which is currently a dummy implementation for
+ * OSX/Aqua. The individual functions are supposed to do the following:
+ *
+ * TkpShowBusyWindow --
+ * Make the busy window appear.
+ *
+ * TkpHideBusyWindow --
+ * Make the busy window go away.
+ *
+ * TkpMakeTransparentWindowExist --
+ * Actually make a transparent window.
+ *
+ * TkpCreateBusy --
+ * Creates the platform-specific part of a busy window structure.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpShowBusyWindow(
+ TkBusy busy)
+{
+}
+
+void
+TkpHideBusyWindow(
+ TkBusy busy)
+{
+}
+
+void
+TkpMakeTransparentWindowExist(
+ Tk_Window tkwin, /* Token for window. */
+ Window parent) /* Parent window. */
+{
+}
+
+void
+TkpCreateBusy(
+ Tk_FakeWin *winPtr,
+ Tk_Window tkRef,
+ Window* parentPtr,
+ Tk_Window tkParent,
+ TkBusy busy)
+{
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/carbon/tkMacOSXEntry.c b/carbon/tkMacOSXEntry.c
new file mode 100644
index 0000000..0c4211e
--- /dev/null
+++ b/carbon/tkMacOSXEntry.c
@@ -0,0 +1,324 @@
+/*
+ * tkMacOSXEntry.c --
+ *
+ * This file implements the native aqua entry widget.
+ *
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * The following terms apply to all files originating from Apple
+ * Computer, Inc. ("Apple") and associated with the software
+ * unless explicitly disclaimed in individual files.
+ *
+ *
+ * Apple hereby grants permission to use, copy, modify,
+ * distribute, and license this software and its documentation
+ * for any purpose, provided that existing copyright notices are
+ * retained in all copies and that this notice is included
+ * verbatim in any distributions. No written agreement, license,
+ * or royalty fee is required for any of the authorized
+ * uses. Modifications to this software may be copyrighted by
+ * their authors and need not follow the licensing terms
+ * described here, provided that the new terms are clearly
+ * indicated on the first page of each file where they apply.
+ *
+ *
+ * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE
+ * SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
+ * INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
+ * THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
+ * EVEN IF APPLE OR THE AUTHORS HAVE BEEN ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE. APPLE, THE AUTHORS AND
+ * DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS
+ * SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND APPLE,THE
+ * AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
+ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * GOVERNMENT USE: If you are acquiring this software on behalf
+ * of the U.S. government, the Government shall have only
+ * "Restricted Rights" in the software and related documentation
+ * as defined in the Federal Acquisition Regulations (FARs) in
+ * Clause 52.227.19 (c) (2). If you are acquiring the software
+ * on behalf of the Department of Defense, the software shall be
+ * classified as "Commercial Computer Software" and the
+ * 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.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkMacOSXDefault.h"
+#include "tkEntry.h"
+
+static ThemeButtonKind ComputeIncDecParameters(int height, int *width);
+
+/*
+ *--------------------------------------------------------------
+ *
+ * ComputeIncDecParameters --
+ *
+ * This procedure figures out which of the kThemeIncDec buttons to use.
+ * It also sets width to the width of the IncDec button.
+ *
+ * Results:
+ * The ThemeButtonKind of the button we should use.
+ *
+ * Side effects:
+ * May draw the entry border into pixmap.
+ *
+ *--------------------------------------------------------------
+ */
+
+static ThemeButtonKind
+ComputeIncDecParameters(
+ int height,
+ int *width)
+{
+ ThemeButtonKind kind;
+
+ TK_IF_HI_TOOLBOX (3,
+ if (height < 11 || height > 28) {
+ *width = 0;
+ kind = (ThemeButtonKind) 0;
+ } else {
+ if (height >= 21) {
+ *width = 13;
+ kind = kThemeIncDecButton;
+ } else if (height >= 18) {
+ *width = 12;
+ kind = kThemeIncDecButtonSmall;
+ } else {
+ *width = 11;
+ kind = kThemeIncDecButtonMini;
+ }
+ }
+ ) TK_ELSE_HI_TOOLBOX (3,
+ if (height < 21 || height > 28) {
+ *width = 0;
+ kind = (ThemeButtonKind) 0;
+ } else {
+ *width = 13;
+ kind = kThemeIncDecButton;
+ }
+ ) TK_ENDIF
+
+ return kind;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkpDrawEntryBorderAndFocus --
+ *
+ * This procedure redraws the border of an entry window. It overrides the
+ * generic border drawing code if the entry widget parameters are such
+ * that the native widget drawing is a good fit. This version just
+ * returns 1, so platforms that don't do special native drawing don't
+ * have to implement it.
+ *
+ * Results:
+ * 1 if it has drawn the border, 0 if not.
+ *
+ * Side effects:
+ * May draw the entry border into pixmap.
+ *
+ *--------------------------------------------------------------
+ */
+
+int
+TkpDrawEntryBorderAndFocus(
+ Entry *entryPtr,
+ Drawable d,
+ int isSpinbox)
+{
+ Rect bounds;
+ TkMacOSXDrawingContext dc;
+ GC bgGC;
+ Tk_Window tkwin = entryPtr->tkwin;
+ ThemeDrawState drawState;
+ int oldWidth = 0;
+ MacDrawable *macDraw = (MacDrawable *) d;
+
+ /*
+ * I use 6 as the borderwidth. 2 of the 5 go into the actual frame the 3
+ * are because the Mac OS Entry widgets leave more space around the Text
+ * than Tk does on X11.
+ */
+
+ if (entryPtr->borderWidth != MAC_OSX_ENTRY_BORDER
+ || entryPtr->highlightWidth != MAC_OSX_FOCUS_WIDTH
+ || entryPtr->relief != MAC_OSX_ENTRY_RELIEF) {
+ return 0;
+ }
+
+ /*
+ * For the spinbox, we have to make the entry part smaller by the size of
+ * the buttons. We also leave 2 pixels to the left (as per the HIG) and
+ * space for one pixel to the right, 'cause it makes the buttons look
+ * nicer.
+ */
+
+ if (isSpinbox) {
+ ThemeButtonKind buttonKind;
+ int incDecWidth;
+
+ oldWidth = Tk_Width(tkwin);
+
+ buttonKind = ComputeIncDecParameters(Tk_Height(tkwin)
+ - 2 * MAC_OSX_FOCUS_WIDTH, &incDecWidth);
+ Tk_Width(tkwin) -= incDecWidth + 1;
+ }
+
+ /*
+ * The focus ring is drawn with an Alpha at the outside part of the ring,
+ * so we have to draw over the edges of the ring before drawing the focus
+ * or the text will peep through.
+ */
+
+ bgGC = Tk_GCForColor(entryPtr->highlightBgColorPtr, d);
+ TkDrawInsetFocusHighlight(entryPtr->tkwin, bgGC, MAC_OSX_FOCUS_WIDTH, d, 0);
+
+ /*
+ * Inset the entry Frame by the maximum width of the focus rect, which is
+ * 3 according to the Carbon docs.
+ */
+
+ bounds.left = macDraw->xOff + MAC_OSX_FOCUS_WIDTH;
+ bounds.top = macDraw->yOff + MAC_OSX_FOCUS_WIDTH;
+ bounds.right = macDraw->xOff + Tk_Width(tkwin) - MAC_OSX_FOCUS_WIDTH;
+ bounds.bottom = macDraw->yOff + Tk_Height(tkwin) - MAC_OSX_FOCUS_WIDTH;
+ if (entryPtr->state == STATE_DISABLED) {
+ drawState = kThemeStateInactive;
+ } else {
+ drawState = kThemeStateActive;
+ }
+ if (!TkMacOSXSetupDrawingContext(d, NULL, 0, &dc)) {
+ return 0;
+ }
+ DrawThemeEditTextFrame(&bounds, drawState);
+ if (entryPtr->flags & GOT_FOCUS) {
+ /*
+ * Don't call this if we don't have the focus, because then it erases
+ * the focus rect to white, but we've already drawn the
+ * highlightbackground above.
+ */
+
+ DrawThemeFocusRect(&bounds, (entryPtr->flags & GOT_FOCUS) != 0);
+ }
+ if (isSpinbox) {
+ Tk_Width(tkwin) = oldWidth;
+ }
+ TkMacOSXRestoreDrawingContext(&dc);
+ return 1;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkpDrawSpinboxButtons --
+ *
+ * This procedure redraws the buttons of an spinbox widget. It overrides
+ * the generic button drawing code if the spinbox widget parameters are
+ * such that the native widget drawing is a good fit. This version just
+ * returns 0, so platforms that don't do special native drawing don't
+ * have to implement it.
+ *
+ * Results:
+ * 1 if it has drawn the border, 0 if not.
+ *
+ * Side effects:
+ * May draw the entry border into pixmap.
+ *
+ *--------------------------------------------------------------
+ */
+
+int
+TkpDrawSpinboxButtons(
+ Spinbox *sbPtr,
+ Drawable d)
+{
+ Rect inBounds;
+ ThemeButtonKind inKind;
+ ThemeButtonDrawInfo inNewInfo;
+ ThemeButtonDrawInfo * inPrevInfo = NULL;
+ ThemeEraseUPP inEraseProc = NULL;
+ ThemeButtonDrawUPP inLabelProc = NULL;
+ UInt32 inUserData = 0;
+ Tk_Window tkwin = sbPtr->entry.tkwin;
+ int height = Tk_Height(tkwin);
+ int buttonHeight = height - 2 * MAC_OSX_FOCUS_WIDTH;
+ int incDecWidth;
+ TkMacOSXDrawingContext dc;
+ XRectangle rects[1];
+ GC bgGC;
+ MacDrawable *macDraw = (MacDrawable *) d;
+
+ /*
+ * FIXME: RAISED really makes more sense
+ */
+
+ if (sbPtr->buRelief != TK_RELIEF_FLAT) {
+ return 0;
+ }
+
+ /*
+ * The actual sizes of the IncDec button are 21 for the normal, 18 for the
+ * small and 15 for the mini. But the spinbox still looks okay if the
+ * entry is a little bigger than this, so we give it a little slop.
+ */
+
+ inKind = ComputeIncDecParameters(buttonHeight, &incDecWidth);
+ if (inKind == (ThemeButtonKind) 0) {
+ return 0;
+ }
+
+ if (sbPtr->entry.state == STATE_DISABLED) {
+ inNewInfo.state = kThemeStateInactive;
+ inNewInfo.value = kThemeButtonOff;
+ } else if (sbPtr->selElement == SEL_BUTTONUP) {
+ inNewInfo.state = kThemeStatePressedUp;
+ inNewInfo.value = kThemeButtonOn;
+ } else if (sbPtr->selElement == SEL_BUTTONDOWN) {
+ inNewInfo.state = kThemeStatePressedDown;
+ inNewInfo.value = kThemeButtonOn;
+ } else {
+ inNewInfo.state = kThemeStateActive;
+ inNewInfo.value = kThemeButtonOff;
+ }
+
+ inNewInfo.adornment = kThemeAdornmentNone;
+
+ inBounds.left = macDraw->xOff + Tk_Width(tkwin) - incDecWidth - 1;
+ inBounds.right = macDraw->xOff + Tk_Width(tkwin) - 1;
+ inBounds.top = macDraw->yOff + MAC_OSX_FOCUS_WIDTH;
+ inBounds.bottom = macDraw->yOff + Tk_Height(tkwin) - MAC_OSX_FOCUS_WIDTH;
+
+ /*
+ * We had to make the entry part of the window smaller so that we wouldn't
+ * overdraw the spin buttons with the focus highlight. So now we have to
+ * draw the highlightbackground.
+ */
+
+ bgGC = Tk_GCForColor(sbPtr->entry.highlightBgColorPtr, d);
+ rects[0].x = inBounds.left;
+ rects[0].y = 0;
+ rects[0].width = Tk_Width(tkwin);
+ rects[0].height = Tk_Height(tkwin);
+ XFillRectangles(Tk_Display(tkwin), d, bgGC, rects, 1);
+
+ if (!TkMacOSXSetupDrawingContext(d, NULL, 0, &dc)) {
+ return 0;
+ }
+ ChkErr(DrawThemeButton, &inBounds, inKind, &inNewInfo, inPrevInfo,
+ inEraseProc, inLabelProc, inUserData);
+ TkMacOSXRestoreDrawingContext(&dc);
+ return 1;
+}
diff --git a/carbon/tkMacOSXEvent.c b/carbon/tkMacOSXEvent.c
new file mode 100644
index 0000000..d39a347
--- /dev/null
+++ b/carbon/tkMacOSXEvent.c
@@ -0,0 +1,294 @@
+/*
+ * tkMacOSXEvent.c --
+ *
+ * This file contains the basic Mac OS X Event handling routines.
+ *
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkMacOSXEvent.h"
+#include "tkMacOSXDebug.h"
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXFlushWindows --
+ *
+ * This routine flushes all the Carbon windows of the application. It is
+ * called by XSync().
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Flushes all Carbon windows
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE void
+TkMacOSXFlushWindows(void)
+{
+ WindowRef wRef = GetWindowList();
+
+ while (wRef) {
+ TK_IF_MAC_OS_X_API (3, HIWindowFlush,
+ ChkErr(HIWindowFlush, wRef);
+ ) TK_ELSE_MAC_OS_X (3,
+ CGrafPtr portPtr = GetWindowPort(wRef);
+
+ if (QDIsPortBuffered(portPtr)) {
+ QDFlushPortBuffer(portPtr, NULL);
+ }
+ ) TK_ENDIF
+ wRef = GetNextWindow(wRef);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXProcessEvent --
+ *
+ * This dispatches a filtered Carbon event to the appropriate handler
+ *
+ * Note on MacEventStatus.stopProcessing: Please be conservative in the
+ * individual handlers and don't assume the event is fully handled unless
+ * you *really* need to ensure that other handlers don't see the event
+ * anymore. Some OS manager or library might be interested in events even
+ * after they are already handled on the Tk level.
+ *
+ * Results:
+ * 0 on success
+ * -1 on failure
+ *
+ * Side effects:
+ * Converts a Carbon event to a Tk event
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkMacOSXProcessEvent(
+ TkMacOSXEvent *eventPtr,
+ MacEventStatus *statusPtr)
+{
+ switch (eventPtr->eClass) {
+ case kEventClassMouse:
+ TkMacOSXProcessMouseEvent(eventPtr, statusPtr);
+ break;
+ case kEventClassWindow:
+ TkMacOSXProcessWindowEvent(eventPtr, statusPtr);
+ break;
+ case kEventClassKeyboard:
+ TkMacOSXProcessKeyboardEvent(eventPtr, statusPtr);
+ break;
+ case kEventClassApplication:
+ TkMacOSXProcessApplicationEvent(eventPtr, statusPtr);
+ break;
+ case kEventClassAppearance:
+ TkMacOSXProcessAppearanceEvent(eventPtr, statusPtr);
+ break;
+ case kEventClassMenu:
+ TkMacOSXProcessMenuEvent(eventPtr, statusPtr);
+ break;
+ case kEventClassCommand:
+ TkMacOSXProcessCommandEvent(eventPtr, statusPtr);
+ break;
+ case kEventClassFont:
+ TkMacOSXProcessFontEvent(eventPtr, statusPtr);
+ break;
+ default: {
+ TkMacOSXDbgMsg("Unrecognised event: %s",
+ TkMacOSXCarbonEventToAscii(eventPtr->eventRef));
+ break;
+ }
+ }
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXProcessMenuEvent --
+ *
+ * This routine processes the event in eventPtr, and generates the
+ * appropriate Tk events from it.
+ *
+ * Results:
+ * True if event(s) are generated - false otherwise.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkMacOSXProcessMenuEvent(
+ TkMacOSXEvent *eventPtr,
+ MacEventStatus *statusPtr)
+{
+ int menuContext;
+ OSStatus err;
+ MenuRef menu;
+ MenuItemIndex index;
+
+ switch (eventPtr->eKind) {
+ case kEventMenuBeginTracking:
+ case kEventMenuEndTracking:
+ case kEventMenuOpening:
+ case kEventMenuTargetItem:
+ break;
+ default:
+ return 0;
+ }
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamMenuContext, typeUInt32, NULL, sizeof(menuContext),
+ NULL, &menuContext);
+ if (err != noErr) {
+ return 0;
+ }
+
+ if ((menuContext & kMenuContextMenuBarTracking) ||
+ (menuContext & kMenuContextPopUpTracking)) {
+ switch (eventPtr->eKind) {
+ case kEventMenuBeginTracking:
+ TkMacOSXClearMenubarActive();
+
+ /*
+ * Handle -postcommand
+ */
+
+ TkMacOSXPreprocessMenu();
+ TkMacOSXTrackingLoop(1);
+ break;
+ case kEventMenuEndTracking:
+ TkMacOSXTrackingLoop(0);
+ break;
+ case kEventMenuOpening:
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamDirectObject, typeMenuRef, NULL, sizeof(menu),
+ NULL, &menu);
+ if (err != noErr) {
+ return 0;
+ }
+ TkMacOSXClearActiveMenu(menu);
+ return TkMacOSXGenerateParentMenuSelectEvent(menu);
+ case kEventMenuTargetItem:
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamDirectObject, typeMenuRef, NULL, sizeof(menu),
+ NULL, &menu);
+ if (err != noErr) {
+ return 0;
+ }
+
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamMenuItemIndex, typeMenuItemIndex, NULL,
+ sizeof(index), NULL, &index);
+ if (err != noErr) {
+ return 0;
+ }
+ return TkMacOSXGenerateMenuSelectEvent(menu, index);
+ }
+ }
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXProcessCommandEvent --
+ *
+ * This routine processes the event in eventPtr, and generates the
+ * appropriate Tk events from it.
+ *
+ * Results:
+ * True if event(s) are generated - false otherwise.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkMacOSXProcessCommandEvent(
+ TkMacOSXEvent *eventPtr,
+ MacEventStatus *statusPtr)
+{
+ HICommand command;
+ int menuContext;
+ OSStatus err;
+
+ switch (eventPtr->eKind) {
+ case kEventCommandProcess:
+ case kEventCommandUpdateStatus:
+ break;
+ default:
+ return 0;
+ }
+
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamDirectObject, typeHICommand, NULL, sizeof(command),
+ NULL, &command);
+ if (err != noErr) {
+ return 0;
+ }
+
+ if (command.attributes & kHICommandFromMenu) {
+ if (eventPtr->eKind == kEventCommandProcess) {
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamMenuContext, typeUInt32, NULL,
+ sizeof(menuContext), NULL, &menuContext);
+ if (err != noErr) {
+ return 0;
+ }
+
+ if ((menuContext & kMenuContextMenuBar) &&
+ (menuContext & kMenuContextMenuBarTracking)) {
+ TkMacOSXHandleMenuSelect(GetMenuID(command.menu.menuRef),
+ command.menu.menuItemIndex,
+ (GetCurrentEventKeyModifiers() & optionKey) != 0);
+ return 1;
+ }
+ } else {
+ Tcl_CmdInfo dummy;
+
+ if (command.commandID == kHICommandPreferences
+ && eventPtr->interp != NULL) {
+ if (Tcl_GetCommandInfo(eventPtr->interp,
+ "::tk::mac::ShowPreferences", &dummy)) {
+ if (!IsMenuItemEnabled(command.menu.menuRef,
+ command.menu.menuItemIndex)) {
+ EnableMenuItem(command.menu.menuRef,
+ command.menu.menuItemIndex);
+ }
+ } else {
+ if (IsMenuItemEnabled(command.menu.menuRef,
+ command.menu.menuItemIndex)) {
+ DisableMenuItem(command.menu.menuRef,
+ command.menu.menuItemIndex);
+ }
+ }
+ statusPtr->stopProcessing = 1;
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/carbon/tkMacOSXEvent.h b/carbon/tkMacOSXEvent.h
new file mode 100644
index 0000000..dc87b5f
--- /dev/null
+++ b/carbon/tkMacOSXEvent.h
@@ -0,0 +1,107 @@
+/*
+ * tkMacOSXEvent.h --
+ *
+ * Declarations of Macintosh specific functions for implementing the
+ * Mac OS X Notifier.
+ *
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * The following terms apply to all files originating from Apple
+ * Computer, Inc. ("Apple") and associated with the software
+ * unless explicitly disclaimed in individual files.
+ *
+ *
+ * Apple hereby grants permission to use, copy, modify,
+ * distribute, and license this software and its documentation
+ * for any purpose, provided that existing copyright notices are
+ * retained in all copies and that this notice is included
+ * verbatim in any distributions. No written agreement, license,
+ * or royalty fee is required for any of the authorized
+ * uses. Modifications to this software may be copyrighted by
+ * their authors and need not follow the licensing terms
+ * described here, provided that the new terms are clearly
+ * indicated on the first page of each file where they apply.
+ *
+ *
+ * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE
+ * SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
+ * INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
+ * THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
+ * EVEN IF APPLE OR THE AUTHORS HAVE BEEN ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE. APPLE, THE AUTHORS AND
+ * DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS
+ * SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND APPLE,THE
+ * AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
+ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * GOVERNMENT USE: If you are acquiring this software on behalf
+ * of the U.S. government, the Government shall have only
+ * "Restricted Rights" in the software and related documentation
+ * as defined in the Federal Acquisition Regulations (FARs) in
+ * Clause 52.227.19 (c) (2). If you are acquiring the software
+ * on behalf of the Department of Defense, the software shall be
+ * classified as "Commercial Computer Software" and the
+ * 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.
+ */
+
+#ifndef _TKMACEVENT
+#define _TKMACEVENT
+
+#ifndef _TKMACINT
+#include "tkMacOSXInt.h"
+#endif
+
+typedef struct {
+ int stopProcessing;
+ int err;
+ char errMsg[1024];
+} MacEventStatus;
+
+/*
+ * The event information in passed in the following structures
+ */
+typedef struct {
+ EventRef eventRef;
+ UInt32 eClass; /* Defines the class of event : see CarbonEvents.h */
+ UInt32 eKind; /* Defines the kind of the event : see CarbonEvents.h */
+ Tcl_Interp *interp; /* Interp to handle events in */
+ EventHandlerCallRef callRef;
+} TkMacOSXEvent;
+
+MODULE_SCOPE void TkMacOSXFlushWindows(void);
+MODULE_SCOPE int TkMacOSXProcessEvent(TkMacOSXEvent *eventPtr,
+ MacEventStatus *statusPtr);
+MODULE_SCOPE int TkMacOSXProcessMouseEvent(TkMacOSXEvent *e,
+ MacEventStatus *statusPtr);
+MODULE_SCOPE int TkMacOSXProcessWindowEvent(TkMacOSXEvent *e,
+ MacEventStatus *statusPtr);
+MODULE_SCOPE int TkMacOSXProcessKeyboardEvent(TkMacOSXEvent *e,
+ MacEventStatus *statusPtr);
+MODULE_SCOPE int TkMacOSXProcessApplicationEvent(TkMacOSXEvent *e,
+ MacEventStatus *statusPtr);
+MODULE_SCOPE int TkMacOSXProcessAppearanceEvent(TkMacOSXEvent *e,
+ MacEventStatus *statusPtr);
+MODULE_SCOPE int TkMacOSXProcessMenuEvent(TkMacOSXEvent *e,
+ MacEventStatus *statusPtr);
+MODULE_SCOPE int TkMacOSXProcessCommandEvent(TkMacOSXEvent *e,
+ MacEventStatus *statusPtr);
+MODULE_SCOPE int TkMacOSXProcessFontEvent(TkMacOSXEvent *e,
+ MacEventStatus *statusPtr);
+MODULE_SCOPE int TkMacOSXKeycodeToUnicode(
+ UniChar * uniChars, int maxChars,
+ EventKind eKind,
+ UInt32 keycode, UInt32 modifiers,
+ UInt32 * deadKeyStatePtr);
+
+#endif
diff --git a/carbon/tkMacOSXFont.c b/carbon/tkMacOSXFont.c
new file mode 100644
index 0000000..7933fe3
--- /dev/null
+++ b/carbon/tkMacOSXFont.c
@@ -0,0 +1,2678 @@
+/*
+ * tkMacOSXFont.c --
+ *
+ * Contains the Macintosh implementation of the platform-independant
+ * font package interface. This version uses ATSU instead of Quickdraw.
+ *
+ * Copyright 2002-2004 Benjamin Riefenstahl, Benjamin.Riefenstahl@epost.de
+ * Copyright (c) 2006-2008 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * Some functions were originally copied verbatim from the QuickDraw version
+ * of tkMacOSXFont.c, which had these copyright notices:
+ *
+ * Copyright (c) 1990-1994 The Regents of the University of California.
+ * 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.
+ *
+ * Todos:
+ *
+ * - Get away from Font Manager and Quickdraw functions as much as possible,
+ * replace with ATS functions instead.
+ *
+ * - Use Font Manager functions to translate ids from ATS to Font Manager
+ * instead of just assuming that they are the same.
+ *
+ * - Get a second font register going for fonts that are not assigned to a
+ * font family by the OS. On my system I have 27 fonts of that type,
+ * Hebrew, Arabic and Hindi fonts that actually come with the system.
+ * FMGetFontFamilyInstanceFromFont() returns -981 (kFMInvalidFontFamilyErr)
+ * for these and they are not listed when enumerating families, but they
+ * are when enumerating fonts directly. The problem that the OS sees may
+ * be that at least some of them do not contain any Latin characters. Note
+ * that such fonts can not be used for controls, because controls
+ * definitely require a family id (this assertion needs testing).
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkMacOSXFont.h"
+
+/*
+#ifdef TK_MAC_DEBUG
+#define TK_MAC_DEBUG_FONTS
+#endif
+*/
+
+/*
+ * Problem: The sum of two parts is not the same as the whole. In particular
+ * the width of two separately measured strings will usually be larger than
+ * the width of them pasted together. Tk has a design bug here, because it
+ * generally assumes that this kind of arithmetic works.
+ * To workaround this, #define TK_MAC_COALESCE_LINE to 1 below, we then avoid
+ * lines that tremble and shiver while the cursor passes through them by
+ * undercutting the system and behind the scenes pasting strings together that
+ * look like they are on the same line and adjacent and that are drawn with
+ * the same font. To do this we need some global data.
+ */
+#define TK_MAC_COALESCE_LINE 0
+
+/*
+ * The following structure represents our Macintosh-specific implementation
+ * of a font object.
+ */
+
+typedef struct {
+ TkFont font; /* Stuff used by generic font package. Must
+ * be first in structure. */
+
+ /*
+ * The ATSU view of the font and other text properties. Used for drawing
+ * and measuring.
+ */
+
+ ATSUFontID atsuFontId; /* == FMFont. */
+ ATSUTextLayout atsuLayout; /* ATSU layout object, representing the whole
+ * text that ATSU sees with some option
+ * bits. */
+ ATSUStyle atsuStyle; /* ATSU style object, representing a run of
+ * text with the same properties. */
+
+ /*
+ * The QuickDraw view of the font. Used to configure controls.
+ */
+
+ FMFontFamily qdFont; /* == FMFontFamilyId, Carbon replacement for
+ * QD face numbers. */
+ short qdSize; /* Font size in points. */
+ short qdStyle; /* QuickDraw style bits. */
+} MacFont;
+
+/*
+ * Information about font families, initialized at startup time. Font
+ * families are described by a mapping from UTF-8 names to MacOS font family
+ * IDs. The whole list is kept as the sorted array "familyList", allocated
+ * with ckrealloc().
+ *
+ * Note: This would have been easier, if we could just have used Tcl hash
+ * arrays. Unfortunately there seems to be no pre-packaged
+ * non-case-sensitive version of that available.
+ */
+
+typedef struct {
+ const char * name;
+ FMFontFamily familyId;
+} MacFontFamily;
+
+static MacFontFamily * familyList = NULL;
+static int
+ familyListNextFree = 0, /* The next free slot in familyList. */
+ familyListMaxValid = 0, /* The top of the sorted area. */
+ familyListSize = 0; /* The size of the whole array. */
+
+/*
+ * A simple one-shot sub-allocator for fast and efficient allocation of
+ * strings. Used by the familyList array for the names. These strings are
+ * only allocated once at startup and never freed. If you ever need to
+ * re-initialize this, you can just ckfree() all the StringBlocks in the list
+ * and start over.
+ */
+
+#define STRING_BLOCK_MAX (1024-8) /* Make sizeof(StringBlock) ==
+ * 1024. */
+typedef struct StringBlock {
+ struct StringBlock *next; /* Starting from "stringMemory" these
+ * blocks form a linked list. */
+ int nextFree; /* Top of the used area in the
+ * "strings" member. */
+ char strings[STRING_BLOCK_MAX]; /* The actual memory managed here. */
+} StringBlock;
+
+static StringBlock *stringMemory = NULL;
+
+#if TK_MAC_COALESCE_LINE
+static Tcl_DString currentLine; /* The current line as seen so far. This
+ * contains a Tcl_UniChar DString. */
+static int
+ currentY = -1, /* The Y position (row in pixels) of the
+ * current line. */
+ currentLeft = -1, /* The left edge (pixels) of the current
+ * line. */
+ currentRight = -1; /* The right edge (pixels) of the current
+ * line. */
+static const MacFont *currentFontPtr = NULL;
+ /* The font of the current line. */
+#endif /* TK_MAC_COALESCE_LINE */
+
+static int antialiasedTextEnabled;
+
+/*
+ * The names for our "native" fonts.
+ */
+
+#define SYSTEMFONT_NAME "system"
+#define APPLFONT_NAME "application"
+#define MENUITEMFONT_NAME "menu"
+
+struct SystemFontMapEntry {
+ const ThemeFontID id;
+ const char *systemName;
+ const char *tkName;
+ const char *tkName1;
+};
+
+#define ThemeFont(n, ...) { kTheme##n##Font, "system" #n "Font", ##__VA_ARGS__ }
+static const struct SystemFontMapEntry systemFontMap[] = {
+ ThemeFont(System, "TkDefaultFont", "TkIconFont"),
+ ThemeFont(EmphasizedSystem, "TkCaptionFont"),
+ ThemeFont(SmallSystem, "TkHeadingFont", "TkTooltipFont"),
+ ThemeFont(SmallEmphasizedSystem),
+ ThemeFont(Application, "TkTextFont"),
+ ThemeFont(Label, "TkSmallCaptionFont"),
+ ThemeFont(Views),
+ ThemeFont(MenuTitle),
+ ThemeFont(MenuItem, "TkMenuFont"),
+ ThemeFont(MenuItemMark),
+ ThemeFont(MenuItemCmdKey),
+ ThemeFont(WindowTitle),
+ ThemeFont(PushButton),
+ ThemeFont(UtilityWindowTitle),
+ ThemeFont(AlertHeader),
+ ThemeFont(Toolbar),
+ ThemeFont(MiniSystem),
+ { kThemeSystemFontDetail, "systemDetailSystemFont" },
+ { kThemeSystemFontDetailEmphasized, "systemDetailEmphasizedSystemFont" },
+ { -1, NULL }
+};
+#undef ThemeFont
+
+/*
+ * Procedures used only in this file.
+ */
+
+static void LayoutSetString(const MacFont *fontPtr,
+ const TkMacOSXDrawingContext *drawingContextPtr,
+ const UniChar * uchars, int ulen);
+
+/*
+ * The actual workers.
+ */
+
+static int MeasureStringWidth(const MacFont *fontPtr, int start, int end);
+
+#if TK_MAC_COALESCE_LINE
+static const Tcl_UniChar *UpdateLineBuffer(const MacFont *fontPtr,
+ const TkMacOSXDrawingContext *drawingContextPtr, const char *source,
+ int numBytes, int x, int y, int * offset);
+#endif /* TK_MAC_COALESCE_LINE */
+
+/*
+ * Initialization and setup of a font data structure.
+ */
+
+static const char *FamilyNameForFamilyID(FMFontFamily familyId);
+static void InitFont(FMFontFamily familyId, const char *familyName,
+ int size, int qdStyle, MacFont *fontPtr);
+static void InitATSUObjects(FMFontFamily familyId, short qdsize, short qdStyle,
+ ATSUFontID *fontIdPtr, ATSUTextLayout *layoutPtr, ATSUStyle *stylePtr);
+static void InitATSUStyle(ATSUFontID fontId, short ptSize, short qdStyle,
+ ATSUStyle style);
+static void SetFontFeatures(ATSUFontID fontId, int fixed, short size,
+ ATSUStyle style);
+static void AdjustFontHeight(MacFont *fontPtr);
+static void InitATSULayout(const TkMacOSXDrawingContext *drawingContextPtr,
+ ATSUTextLayout layout, int fixed);
+static void ReleaseFont(MacFont *fontPtr);
+
+/*
+ * Finding fonts by name.
+ */
+
+static const MacFontFamily *FindFontFamilyOrAlias(const char *name);
+static const MacFontFamily *FindFontFamilyOrAliasOrFallback(const char *name);
+
+/*
+ * Doing interesting things with font families and fonts.
+ */
+
+static void InitFontFamilies(void);
+static OSStatus GetFontFamilyName(FMFontFamily fontFamily, char *name,
+ int numBytes);
+
+/*
+ * Accessor functions and internal utilities for the font family list.
+ */
+
+static const MacFontFamily *AddFontFamily(const char *name,
+ FMFontFamily familyId);
+static const MacFontFamily *FindFontFamily(const char *name);
+static Tcl_Obj *EnumFontFamilies(void);
+
+static OSStatus FontFamilyEnumCallback(ATSFontFamilyRef family, void *refCon);
+static void SortFontFamilies(void);
+static int CompareFontFamilies(const void *vp1, const void *vp2);
+static const char *AddString(const char *in);
+
+static OSStatus GetThemeFontAndFamily(const ThemeFontID themeFontId,
+ FMFontFamily *fontFamily, unsigned char *fontName, SInt16 *fontSize,
+ Style *fontStyle);
+static void InitSystemFonts(TkMainInfo *mainPtr);
+static int CreateNamedSystemFont(Tcl_Interp *interp, Tk_Window tkwin,
+ const char* name, TkFontAttributes *faPtr);
+static void DrawCharsInContext(Display *display,
+ Drawable drawable, GC gc, Tk_Font tkfont,
+ const char *source, int numBytes, int rangeStart,
+ int rangeLength, int x, int y, double angle);
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * TkpFontPkgInit --
+ *
+ * This procedure is called when an application is created. It
+ * initializes all the structures that are used by the
+ * platform-dependant code on a per application basis.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Initialization of variables local to this file.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+TkpFontPkgInit(
+ TkMainInfo *mainPtr) /* The application being created. */
+{
+ InitFontFamilies();
+ InitSystemFonts(mainPtr);
+
+#if TK_MAC_COALESCE_LINE
+ Tcl_DStringInit(&currentLine);
+#endif
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * InitSystemFonts --
+ *
+ * Initialize named system fonts.
+ *
+ * Results:
+ *
+ * None.
+ *
+ * Side effects:
+ *
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void
+InitSystemFonts(
+ TkMainInfo *mainPtr)
+{
+ Tcl_Interp *interp = mainPtr->interp;
+ Tk_Window tkwin = (Tk_Window) mainPtr->winPtr;
+ const struct SystemFontMapEntry *systemFont = systemFontMap;
+ TkFontAttributes fa;
+
+ /* force this for now */
+ if (!mainPtr->winPtr->mainPtr) {
+ mainPtr->winPtr->mainPtr = mainPtr;
+ }
+ TkInitFontAttributes(&fa);
+ while (systemFont->systemName) {
+ Str255 fontName;
+ SInt16 fontSize;
+ Style fontStyle;
+
+ if (GetThemeFont(systemFont->id, smSystemScript, fontName,
+ &fontSize, &fontStyle) == noErr) {
+ CopyPascalStringToC(fontName, (char*)fontName);
+ fa.family = Tk_GetUid((char*)fontName);
+ fa.size = fontSize;
+ fa.weight = (fontStyle & bold) ? TK_FW_BOLD : TK_FW_NORMAL;
+ fa.slant = (fontStyle & italic) ? TK_FS_ITALIC : TK_FS_ROMAN;
+ fa.underline = ((fontStyle & underline) != 0);
+ CreateNamedSystemFont(interp, tkwin, systemFont->systemName, &fa);
+ if (systemFont->tkName) {
+ CreateNamedSystemFont(interp, tkwin, systemFont->tkName, &fa);
+ }
+ if (systemFont->tkName1) {
+ CreateNamedSystemFont(interp, tkwin, systemFont->tkName1, &fa);
+ }
+ }
+ systemFont++;
+ }
+ fa.family = Tk_GetUid("monaco");
+ fa.size = 11;
+ fa.weight = TK_FW_NORMAL;
+ fa.slant = TK_FS_ROMAN;
+ fa.underline = 0;
+ CreateNamedSystemFont(interp, tkwin, "TkFixedFont", &fa);
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * CreateNamedSystemFont --
+ *
+ * Register a system font with the Tk named font mechanism.
+ *
+ * Results:
+ *
+ * Result from TkCreateNamedFont().
+ *
+ * Side effects:
+ *
+ * A new named font is added to the Tk font registry.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static int
+CreateNamedSystemFont(
+ Tcl_Interp *interp,
+ Tk_Window tkwin,
+ const char* name,
+ TkFontAttributes *faPtr)
+{
+ TkDeleteNamedFont(NULL, tkwin, name);
+ return TkCreateNamedFont(interp, tkwin, name, faPtr);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * GetThemeFontAndFamily --
+ *
+ * Wrapper around the GetThemeFont and FMGetFontFamilyFromName APIs.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+OSStatus
+GetThemeFontAndFamily(
+ const ThemeFontID themeFontId,
+ FMFontFamily* fontFamily,
+ unsigned char *fontName,
+ SInt16 *fontSize,
+ Style *fontStyle)
+{
+ OSStatus err = ChkErr(GetThemeFont, themeFontId, smSystemScript, fontName,
+ fontSize, fontStyle);
+
+ if (err == noErr) {
+ *fontFamily = FMGetFontFamilyFromName(fontName);
+ if (*fontFamily == kInvalidFontFamily) {
+ err = kFMInvalidFontFamilyErr;
+ TkMacOSXDbgMsg("FMGetFontFamilyFromName failed.");
+ }
+ }
+
+ return err;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkpGetNativeFont --
+ *
+ * Map a platform-specific native font name to a TkFont.
+ *
+ * Results:
+ * The return value is a pointer to a TkFont that represents the
+ * native font. If a native font by the given name could not be
+ * found, the return value is NULL.
+ *
+ * Every call to this procedure returns a new TkFont structure, even
+ * if the name has already been seen before. The caller should call
+ * TkpDeleteFont() when the font is no longer needed.
+ *
+ * The caller is responsible for initializing the memory associated
+ * with the generic TkFont when this function returns and releasing
+ * the contents of the generics TkFont before calling TkpDeleteFont().
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+TkFont *
+TkpGetNativeFont(
+ Tk_Window tkwin, /* For display where font will be used. */
+ const char *name) /* Platform-specific font name. */
+{
+ ThemeFontID themeFontId;
+ FMFontFamily fontFamily;
+ Str255 fontName;
+ SInt16 fontSize;
+ Style fontStyle;
+ MacFont *fontPtr;
+
+ if (strcmp(name, SYSTEMFONT_NAME) == 0) {
+ themeFontId = kThemeSystemFont;
+ } else if (strcmp(name, APPLFONT_NAME) == 0) {
+ themeFontId = kThemeApplicationFont;
+ } else if (strcmp(name, MENUITEMFONT_NAME) == 0) {
+ themeFontId = kThemeMenuItemFont;
+ } else {
+ return NULL;
+ }
+ if (GetThemeFontAndFamily(themeFontId, &fontFamily, fontName, &fontSize,
+ &fontStyle) != noErr) {
+ return NULL;
+ }
+ CopyPascalStringToC(fontName, (char*)fontName);
+
+ fontPtr = ckalloc(sizeof(MacFont));
+ InitFont(fontFamily, (char*)fontName, fontSize, fontStyle, fontPtr);
+
+ return (TkFont *) fontPtr;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkpGetFontFromAttributes --
+ *
+ * Given a desired set of attributes for a font, find a font with the
+ * closest matching attributes.
+ *
+ * Results:
+ * The return value is a pointer to a TkFont that represents the font
+ * with the desired attributes. If a font with the desired attributes
+ * could not be constructed, some other font will be substituted
+ * automatically.
+ *
+ * Every call to this procedure returns a new TkFont structure, even
+ * if the specified attributes have already been seen before. The
+ * caller should call TkpDeleteFont() to free the platform- specific
+ * data when the font is no longer needed.
+ *
+ * The caller is responsible for initializing the memory associated
+ * with the generic TkFont when this function returns and releasing
+ * the contents of the generic TkFont before calling TkpDeleteFont().
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+TkFont *
+TkpGetFontFromAttributes(
+ TkFont *tkFontPtr, /* If non-NULL, store the information in this
+ * existing TkFont structure, rather than
+ * allocating a new structure to hold the
+ * font; the existing contents of the font
+ * will be released. If NULL, a new TkFont
+ * structure is allocated. */
+ Tk_Window tkwin, /* For display where font will be used. */
+ const TkFontAttributes *faPtr)
+ /* Set of attributes to match. */
+{
+ short qdStyle;
+ FMFontFamily familyId;
+ const char *name;
+ const MacFontFamily *familyPtr;
+ MacFont *fontPtr;
+
+ familyId = GetAppFont();
+ name = NULL;
+ qdStyle = 0;
+
+ if (faPtr->family != NULL) {
+ familyPtr = FindFontFamilyOrAliasOrFallback(faPtr->family);
+ if (familyPtr != NULL) {
+ name = familyPtr->name;
+ familyId = familyPtr->familyId;
+ }
+ }
+
+ if (faPtr->weight != TK_FW_NORMAL) {
+ qdStyle |= bold;
+ }
+ if (faPtr->slant != TK_FS_ROMAN) {
+ qdStyle |= italic;
+ }
+ if (faPtr->underline) {
+ qdStyle |= underline;
+ }
+ if (tkFontPtr == NULL) {
+ fontPtr = ckalloc(sizeof(MacFont));
+ } else {
+ fontPtr = (MacFont *) tkFontPtr;
+ ReleaseFont(fontPtr);
+ }
+ InitFont(familyId, name, TkFontGetPoints(tkwin, faPtr->size),
+ qdStyle, fontPtr);
+
+ return (TkFont *) fontPtr;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkpDeleteFont --
+ *
+ * Called to release a font allocated by TkpGetNativeFont() or
+ * TkpGetFontFromAttributes(). The caller should have already
+ * released the fields of the TkFont that are used exclusively by the
+ * generic TkFont code.
+ *
+ * Results:
+ * TkFont is deallocated.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+void
+TkpDeleteFont(
+ TkFont *tkFontPtr) /* Token of font to be deleted. */
+{
+ ReleaseFont((MacFont *) tkFontPtr);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkpGetFontFamilies --
+ *
+ * Return information about the font families that are available on
+ * the display of the given window.
+ *
+ * Results:
+ * Modifies interp's result object to hold a list of all the available
+ * font families.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+void
+TkpGetFontFamilies(
+ Tcl_Interp *interp, /* Interp to hold result. */
+ Tk_Window tkwin) /* For display to query. */
+{
+ Tcl_SetObjResult(interp, EnumFontFamilies());
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * TkpGetSubFonts --
+ *
+ * A function used by the testing package for querying the actual
+ * screen fonts that make up a font object.
+ *
+ * Results:
+ * Modifies interp's result object to hold a list containing the names
+ * of the screen fonts that make up the given font object.
+ *
+ * Side effects:
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+TkpGetSubFonts(
+ Tcl_Interp *interp, /* Interp to hold result. */
+ Tk_Font tkfont) /* Font object to query. */
+{
+ /* We don't know much about our fallback fonts, ATSU does all that for
+ * us. We could use ATSUMatchFont to implement this function. But as
+ * the information is only used for testing, such an effort seems not
+ * very useful. */
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetFontAttrsForChar --
+ *
+ * Retrieve the font attributes of the actual font used to render a
+ * given character.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The font attributes are stored in *faPtr.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpGetFontAttrsForChar(
+ Tk_Window tkwin, /* Window on the font's display */
+ Tk_Font tkfont, /* Font to query */
+ Tcl_UniChar c, /* Character of interest */
+ TkFontAttributes* faPtr) /* Output: Font attributes */
+{
+ const MacFont * fontPtr = (const MacFont *) tkfont;
+ UniChar uchar = c;
+ TkMacOSXDrawingContext drawingContext;
+ OSStatus err;
+ ATSUFontID fontId;
+ UniCharArrayOffset changedOffset;
+ UniCharCount changedLength;
+
+ /*
+ * Most of the attributes are just copied from the base font. This
+ * assumes that all fonts can have all attributes.
+ */
+
+ *faPtr = fontPtr->font.fa;
+
+ /*
+ * But the name of the actual font may still differ, so we activate the
+ * string as an ATSU layout and ask ATSU about the fallback.
+ */
+ if (!TkMacOSXSetupDrawingContext(Tk_WindowId(tkwin), NULL, 1,
+ &drawingContext)) {
+ Tcl_Panic("TkpGetFontAttrsForChar: drawingContext not setup");
+ }
+
+ LayoutSetString(fontPtr, &drawingContext, &uchar, 1);
+
+ fontId = fontPtr->atsuFontId;
+ err = ATSUMatchFontsToText(
+ fontPtr->atsuLayout, 0, 1,
+ &fontId, &changedOffset, &changedLength);
+ if (err != kATSUFontsMatched && err != noErr) {
+ TkMacOSXDbgMsg("Can't match \\u%04X", (unsigned) c);
+ }
+
+ if (err == kATSUFontsMatched) {
+ /*
+ * A fallback was used and the actual font is in fontId. Determine
+ * the name.
+ */
+
+ FMFontFamily fontFamilyId;
+ FMFontStyle fontStyle;
+ int i;
+
+ err = ChkErr(FMGetFontFamilyInstanceFromFont, fontId, &fontFamilyId,
+ &fontStyle);
+ if (err == noErr) {
+ /*
+ * Find the canonical name in our global list.
+ */
+
+ for (i=0; i<familyListMaxValid; ++i) {
+ if (fontFamilyId == familyList[i].familyId) {
+ faPtr->family = familyList[i].name;
+ break;
+ }
+ }
+ if (i >= familyListMaxValid) {
+ TkMacOSXDbgMsg("Can't find font %d for \\u%04X", fontFamilyId,
+ (unsigned) c);
+ }
+ }
+ }
+
+ TkMacOSXRestoreDrawingContext(&drawingContext);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * Tk_MeasureChars --
+ *
+ * Determine the number of characters from the string that will fit in
+ * the given horizontal span. The measurement is done under the
+ * assumption that Tk_DrawChars() will be used to actually display the
+ * characters.
+ *
+ * With ATSUI we need the line context to do this right, so we have the
+ * actual implementation in TkpMeasureCharsInContext().
+ *
+ * Results:
+ * The return value is the number of bytes from source that fit into the
+ * span that extends from 0 to maxLength. *lengthPtr is filled with the
+ * x-coordinate of the right edge of the last character that did fit.
+ *
+ * Side effects:
+ * None.
+ *
+ * Todo:
+ * Effects of the "flags" parameter are untested.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int
+Tk_MeasureChars(
+ Tk_Font tkfont, /* Font in which characters will be drawn. */
+ const char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. */
+ int numBytes, /* Maximum number of bytes to consider from
+ * source string. */
+ int maxLength, /* If >= 0, maxLength specifies the longest
+ * permissible line length; don't consider any
+ * character that would cross this x-position.
+ * If < 0, then line length is unbounded and
+ * the flags argument is ignored. */
+ int flags, /* Various flag bits OR-ed together:
+ * TK_PARTIAL_OK means include the last char
+ * which only partially fit on this line.
+ * TK_WHOLE_WORDS means stop on a word
+ * boundary, if possible. TK_AT_LEAST_ONE
+ * means return at least one character even if
+ * no characters fit. */
+ int *lengthPtr) /* Filled with x-location just after the
+ * terminating character. */
+{
+ return TkpMeasureCharsInContext(tkfont, source, numBytes, 0, numBytes,
+ maxLength, flags, lengthPtr);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkpMeasureCharsInContext --
+ *
+ * Determine the number of bytes from the string that will fit in the
+ * given horizontal span. The measurement is done under the assumption
+ * that TkpDrawCharsInContext() will be used to actually display the
+ * characters.
+ *
+ * This one is almost the same as Tk_MeasureChars(), but with access to
+ * all the characters on the line for context.
+ *
+ * Results:
+ * The return value is the number of bytes from source that
+ * fit into the span that extends from 0 to maxLength. *lengthPtr is
+ * filled with the x-coordinate of the right edge of the last
+ * character that did fit.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int
+TkpMeasureCharsInContext(
+ Tk_Font tkfont, /* Font in which characters will be drawn. */
+ const char * source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. */
+ int numBytes, /* Maximum number of bytes to consider from
+ * source string in all. */
+ int rangeStart, /* Index of first byte to measure. */
+ int rangeLength, /* Length of range to measure in bytes. */
+ int maxLength, /* If >= 0, maxLength specifies the longest
+ * permissible line length; don't consider any
+ * character that would cross this x-position.
+ * If < 0, then line length is unbounded and
+ * the flags argument is ignored. */
+ int flags, /* Various flag bits OR-ed together:
+ * TK_PARTIAL_OK means include the last char
+ * which only partially fits on this line.
+ * TK_WHOLE_WORDS means stop on a word
+ * boundary, if possible. TK_AT_LEAST_ONE
+ * means return at least one character even
+ * if no characters fit. If TK_WHOLE_WORDS
+ * and TK_AT_LEAST_ONE are set and the first
+ * word doesn't fit, we return at least one
+ * character or whatever characters fit into
+ * maxLength. TK_ISOLATE_END means that the
+ * last character should not be considered in
+ * context with the rest of the string (used
+ * for breaking lines). */
+ int *lengthPtr) /* Filled with x-location just after the
+ * terminating character. */
+{
+ const MacFont *fontPtr = (const MacFont *) tkfont;
+ int curX = -1, curByte = 0;
+ UniChar *uchars;
+ int ulen;
+ UniCharArrayOffset urstart, urlen, urend;
+ Tcl_DString ucharBuffer;
+ int forceCharacterMode = 0;
+
+ /*
+ * Sanity checks.
+ */
+
+ if (rangeStart < 0 || (rangeStart+rangeLength) > numBytes) {
+ TkMacOSXDbgMsg("Bad parameters");
+ *lengthPtr = 0;
+ return 0;
+ }
+
+ /*
+ * Get simple no-brainers out of the way.
+ */
+
+ if (rangeLength == 0 || (maxLength == 0 && !(flags & TK_AT_LEAST_ONE))) {
+ *lengthPtr = 0;
+ return 0;
+ }
+
+ Tcl_DStringInit(&ucharBuffer);
+ uchars = Tcl_UtfToUniCharDString(source, numBytes, &ucharBuffer);
+ ulen = Tcl_DStringLength(&ucharBuffer) / sizeof(Tcl_UniChar);
+ LayoutSetString(fontPtr, NULL, uchars, ulen);
+
+ urstart = Tcl_NumUtfChars(source, rangeStart);
+ urlen = Tcl_NumUtfChars(source+rangeStart,rangeLength);
+ urend = urstart + urlen;
+
+ if (maxLength < 0) {
+ curX = MeasureStringWidth(fontPtr, urstart, urend);
+ curByte = rangeLength;
+ } else {
+ UniCharArrayOffset offset = 0;
+ OSStatus err;
+
+ /*
+ * Have some upper limit on the size actually used.
+ */
+
+ if (maxLength > 32767) {
+ maxLength = 32767;
+ }
+
+ offset = urstart;
+ err = noErr;
+
+ if (maxLength > 1) {
+ /*
+ * Let the system do some work by calculating a line break.
+ *
+ * Somehow ATSUBreakLine seems to assume that it needs at least
+ * one pixel padding. So we add one to the limit. Note also
+ * that ATSUBreakLine sometimes runs into an endless loop when
+ * the third parameter is equal or less than IntToFixed(2), so we
+ * need at least IntToFixed(3) (at least that's the current state
+ * of my knowledge).
+ */
+
+ err = ATSUBreakLine(fontPtr->atsuLayout, urstart,
+ IntToFixed(maxLength+1), false, /* !iUseAsSoftLineBreak */
+ &offset);
+
+ /*
+ * There is no way to signal an error from this routine, so we
+ * use predefined offset=urstart and otherwise ignore the
+ * possibility.
+ */
+
+ if ((err != noErr) && (err != kATSULineBreakInWord)) {
+ TkMacOSXDbgMsg("ATSUBreakLine failed: %ld for '%.*s'", err,
+ rangeLength, source+rangeStart);
+ }
+
+#ifdef TK_MAC_DEBUG_FONTS
+ TkMacOSXDbgMsg("measure: '%.*s', break offset=%ld, errcode=%ld",
+ rangeLength, source+rangeStart, offset, err);
+#endif
+
+ /*
+ * ATSUBreakLine includes the whitespace that separates words,
+ * but we don't want that. Besides, ATSUBreakLine thinks that
+ * spaces don't occupy pixels at the end of the break, which is
+ * also something we like to decide for ourself.
+ */
+
+ while ((offset > urstart) && (uchars[offset-1] == ' ')) {
+ offset--;
+ }
+ }
+
+ /*
+ * Fix up left-overs for the TK_WHOLE_WORDS case.
+ */
+
+ if (flags & TK_WHOLE_WORDS) {
+ if ((flags & TK_AT_LEAST_ONE) && ((offset == urstart)
+ || ((offset != urend) && (uchars[offset] != ' ')))) {
+ /*
+ * With TK_AT_LEAST_ONE, if we are the the start of the
+ * range, we need to add at least one character. If we are
+ * not at the end of a word, we must be in the middle of the
+ * first word still and we want to just use what we have so
+ * far. In both cases we still need to find the right
+ * character boundary, so we set a flag that gets us into the
+ * code for character mode below.
+ */
+
+ forceCharacterMode = 1;
+
+ } else {
+ /*
+ * If we are not at the end of a word, we must be in the
+ * middle of the first word still. Return 0.
+ */
+
+ if ((offset != urend) && (uchars[offset] != ' ')) {
+ offset = urstart;
+ curX = 0;
+ }
+ }
+ }
+
+ if (offset > urend) {
+ offset = urend;
+ }
+
+ /*
+ * If "flags" says that we don't actually want a word break, we need
+ * to find the next character break ourself, as ATSUBreakLine will
+ * only give us word breaks. Do a simple linear search.
+ *
+ * Even do this, if ATSUBreakLine returned kATSULineBreakInWord,
+ * because we have not accounted correctly for all of the flags yet,
+ * like TK_AT_LEAST_ONE.
+ */
+
+ if ((!(flags & TK_WHOLE_WORDS) || forceCharacterMode) && (offset <= urend)) {
+ UniCharArrayOffset lastOffset = offset;
+ UniCharArrayOffset nextoffset;
+ int lastX = -1;
+ int wantonemorechar = -1; /* undecided */
+
+ while (offset <= urend) {
+ if (flags & TK_ISOLATE_END) {
+ LayoutSetString(fontPtr, NULL, uchars, offset);
+ }
+ curX = MeasureStringWidth(fontPtr, urstart, offset);
+
+#ifdef TK_MAC_DEBUG_FONTS
+ TkMacOSXDbgMsg("measure: '%.*s', try until=%ld, width=%d",
+ rangeLength, source+rangeStart, offset, curX);
+#endif
+
+ if (curX > maxLength) {
+ /*
+ * Even if we are over the limit, we may want another
+ * character in some situations. Than we keep looking
+ * for one more character.
+ */
+
+ if (wantonemorechar == -1) {
+ wantonemorechar = ((flags & TK_AT_LEAST_ONE) &&
+ (lastOffset == urstart)) ||
+ ((flags & TK_PARTIAL_OK) &&
+ (lastX != maxLength));
+ if (!wantonemorechar) {
+ break;
+ }
+ lastX = curX;
+ }
+
+ /*
+ * There may belong combining marks to this character.
+ * Wait for a new curX to collect them all.
+ */
+
+ if (lastX != curX) {
+ break;
+ }
+ }
+
+ /*
+ * Save this position, so we can come back to it.
+ */
+
+ lastX = curX;
+ lastOffset = offset;
+
+ /*
+ * Increment offset by one character, taking combining marks
+ * into account.
+ */
+
+ if (offset >= urend) {
+ break;
+ }
+ nextoffset = 0;
+ if (flags & TK_ISOLATE_END) {
+ LayoutSetString(fontPtr, NULL, uchars, ulen);
+ }
+ err = ChkErr(ATSUNextCursorPosition, fontPtr->atsuLayout,
+ offset, kATSUByCluster, &nextoffset);
+ if (err != noErr) {
+ break;
+ }
+ if (nextoffset <= offset) {
+#ifdef TK_MAC_DEBUG_FONTS
+ TkMacOSXDbgMsg("ATSUNextCursorPosition: Can't move further"
+ " (shouldn't happen, bad data?)");
+#endif
+ break;
+ }
+
+ offset = nextoffset;
+ }
+
+ /*
+ * We have overshot one character, so backup one position.
+ */
+
+ curX = lastX;
+ offset = lastOffset;
+ }
+
+ if (curX < 0) {
+ if (flags & TK_ISOLATE_END) {
+ LayoutSetString(fontPtr, NULL, uchars, offset);
+ }
+ curX = MeasureStringWidth(fontPtr, urstart, offset);
+ }
+
+ curByte = Tcl_UtfAtIndex(source, offset) - source;
+ curByte -= rangeStart;
+ }
+
+ Tcl_DStringFree(&ucharBuffer);
+
+#ifdef TK_MAC_DEBUG_FONTS
+ TkMacOSXDbgMsg("measure: '%.*s', maxLength=%d, flags=%s%s%s%s "
+ "-> width=%d, bytes=%d",
+ rangeLength, source+rangeStart, maxLength,
+ flags & TK_PARTIAL_OK ? "partialOk " : "",
+ flags & TK_WHOLE_WORDS ? "wholeWords " : "",
+ flags & TK_AT_LEAST_ONE ? "atLeastOne " : "",
+ flags & TK_ISOLATE_END ? "isolateEnd " : "",
+ curX, curByte);
+#endif
+
+ *lengthPtr = curX;
+ return curByte;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * Tk_DrawChars --
+ *
+ * Draw a string of characters on the screen.
+ *
+ * With ATSUI we need the line context to do this right, so we have the
+ * actual implementation in TkpDrawCharsInContext().
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Information gets drawn on the screen.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+void
+Tk_DrawChars(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for drawing characters. */
+ Tk_Font tkfont, /* Font in which characters will be drawn; must
+ * be the same as font used in GC. */
+ const char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
+ * (tabs, control characters, and newlines)
+ * should be stripped out of the string that
+ * is passed to this function. If they are not
+ * stripped out, they will be displayed as
+ * regular printing characters. */
+ int numBytes, /* Number of bytes in string. */
+ int x, int y) /* Coordinates at which to place origin of the
+ * string when drawing. */
+{
+ DrawCharsInContext(display, drawable, gc, tkfont, source, numBytes,
+ 0, numBytes, x, y, 0.0);
+}
+
+void
+TkDrawAngledChars(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for drawing characters. */
+ Tk_Font tkfont, /* Font in which characters will be drawn;
+ * must be the same as font used in GC. */
+ const char *source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
+ * (tabs, control characters, and newlines)
+ * should be stripped out of the string that
+ * is passed to this function. If they are not
+ * stripped out, they will be displayed as
+ * regular printing characters. */
+ int numBytes, /* Number of bytes in string. */
+ double x, double y, /* Coordinates at which to place origin of
+ * string when drawing. */
+ double angle) /* What angle to put text at, in degrees. */
+{
+ DrawCharsInContext(display, drawable, gc, tkfont, source, numBytes,
+ 0, numBytes, x, y, angle);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkpDrawCharsInContext --
+ *
+ * Draw a string of characters on the screen like Tk_DrawChars(), with
+ * access to all the characters on the line for context.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Information gets drawn on the screen.
+ *
+ * Todo:
+ * Stippled text drawing.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+void
+TkpDrawCharsInContext(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for drawing characters. */
+ Tk_Font tkfont, /* Font in which characters will be drawn; must
+ * be the same as font used in GC. */
+ const char * source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
+ * (tabs, control characters, and newlines)
+ * should be stripped out of the string that
+ * is passed to this function. If they are not
+ * stripped out, they will be displayed as
+ * regular printing characters. */
+ int numBytes, /* Number of bytes in string. */
+ int rangeStart, /* Index of first byte to draw. */
+ int rangeLength, /* Length of range to draw in bytes. */
+ int x, int y) /* Coordinates at which to place origin of the
+ * whole (not just the range) string when
+ * drawing. */
+{
+ DrawCharsInContext(display, drawable, gc, tkfont, source, numBytes,
+ rangeStart, rangeLength, x, y, 0.0);
+}
+
+static void
+DrawCharsInContext(
+ Display *display, /* Display on which to draw. */
+ Drawable drawable, /* Window or pixmap in which to draw. */
+ GC gc, /* Graphics context for drawing characters. */
+ Tk_Font tkfont, /* Font in which characters will be drawn; must
+ * be the same as font used in GC. */
+ const char * source, /* UTF-8 string to be displayed. Need not be
+ * '\0' terminated. All Tk meta-characters
+ * (tabs, control characters, and newlines)
+ * should be stripped out of the string that
+ * is passed to this function. If they are not
+ * stripped out, they will be displayed as
+ * regular printing characters. */
+ int numBytes, /* Number of bytes in string. */
+ int rangeStart, /* Index of first byte to draw. */
+ int rangeLength, /* Length of range to draw in bytes. */
+ int x, int y, /* Coordinates at which to place origin of the
+ * whole (not just the range) string when
+ * drawing. */
+ double angle)
+{
+ const MacFont * fontPtr = (const MacFont *) tkfont;
+ MacDrawable *macWin = (MacDrawable *) drawable;
+ Fixed fx, fy;
+ int ulen, urstart, urlen;
+ const UniChar * uchars;
+ int lineOffset;
+ TkMacOSXDrawingContext drawingContext;
+#if !TK_MAC_COALESCE_LINE
+ Tcl_DString runString;
+#endif
+
+ if (!TkMacOSXSetupDrawingContext(drawable, gc, tkMacOSXUseCGDrawing,
+ &drawingContext)) {
+ return;
+ }
+
+#if 0
+ /*
+ * TODO: implement stippled text drawing
+ */
+
+ if ((gc->fill_style == FillStippled
+ || gc->fill_style == FillOpaqueStippled)
+ && gc->stipple != None) {
+ #error Stippling not implemented
+ }
+#endif
+
+ x += macWin->xOff;
+ y += macWin->yOff;
+ /* Turn the y coordinate upside-down for Quarz drawing. */
+ if (drawingContext.context) {
+ CGContextConcatCTM(drawingContext.context, CGAffineTransformMake(1.0,
+ 0.0, 0.0, -1.0, 0.0, drawingContext.portBounds.bottom -
+ drawingContext.portBounds.top));
+ y = drawingContext.portBounds.bottom -
+ drawingContext.portBounds.top - y;
+ }
+ fy = IntToFixed(y);
+
+#if TK_MAC_COALESCE_LINE
+ UpdateLineBuffer(
+ fontPtr, &drawingContext, source, numBytes, x, y, &lineOffset);
+
+ fx = IntToFixed(currentLeft);
+
+ uchars = (const Tcl_UniChar*) Tcl_DStringValue(&currentLine);
+ ulen = Tcl_DStringLength(&currentLine) / sizeof(uchars[0]);
+#else
+ lineOffset = 0;
+ fx = IntToFixed(x);
+
+ Tcl_DStringInit(&runString);
+ uchars = Tcl_UtfToUniCharDString(source, numBytes, &runString);
+ ulen = Tcl_DStringLength(&runString) / sizeof(uchars[0]);
+
+ LayoutSetString(fontPtr, &drawingContext, uchars, ulen);
+#endif
+
+ urstart = Tcl_NumUtfChars(source, rangeStart);
+ urlen = Tcl_NumUtfChars(source+rangeStart,rangeLength);
+
+ /*
+ * Rotate the coordinate system for Quarz drawing.
+ */
+
+ if (drawingContext.context && angle != 0.0) {
+ CGContextConcatCTM(drawingContext.context, CGAffineTransformTranslate(
+ CGAffineTransformRotate(CGAffineTransformMakeTranslation(
+ x, y), angle * PI/180.0), -x, -y));
+ }
+
+ ChkErr(ATSUDrawText, fontPtr->atsuLayout, lineOffset+urstart, urlen, fx,
+ fy);
+
+#if !TK_MAC_COALESCE_LINE
+ Tcl_DStringFree(&runString);
+#endif
+
+ TkMacOSXRestoreDrawingContext(&drawingContext);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * MeasureStringWidth --
+ *
+ * Low-level measuring of strings.
+ *
+ * Results:
+ * The width of the string in pixels.
+ *
+ * Side effects:
+ * None.
+ *
+ * Assumptions:
+ * fontPtr->atsuLayout is setup with the actual string data to measure.
+ *
+ *---------------------------------------------------------------------------
+ */
+static int
+MeasureStringWidth(
+ const MacFont *fontPtr, /* Contains font, ATSU layout and string data
+ * to measure. */
+ int start, int end) /* Start and end positions to measure in that
+ * string. */
+{
+ /*
+ * This implementation of measuring via ATSUGetGlyphBounds() does not
+ * quite conform with the specification given for [font measure]:
+ *
+ * The return value is the total width in pixels of text, not
+ * including the extra pixels used by highly exagerrated characters
+ * such as cursive "f".
+ *
+ * Instead the result of ATSUGetGlyphBounds() *does* include these
+ * "extra pixels".
+ */
+
+ ATSTrapezoid bounds;
+ ItemCount numBounds;
+
+ if (end <= start) {
+ return 0;
+ }
+
+ bounds.upperRight.x = bounds.upperLeft.x = 0;
+ ChkErr(ATSUGetGlyphBounds, fontPtr->atsuLayout, 0, 0, start, end-start,
+ kATSUseFractionalOrigins, 1, &bounds, &numBounds);
+#ifdef TK_MAC_DEBUG_FONTS
+ if (numBounds < 1 || numBounds > 1) {
+ TkMacOSXDbgMsg("ATSUGetGlyphBounds: %s output",
+ numBounds < 1 ? "No " : "More");
+ }
+#endif
+
+ return FixedToInt(bounds.upperRight.x - bounds.upperLeft.x);
+}
+
+#if TK_MAC_COALESCE_LINE
+/*
+ *-------------------------------------------------------------------------
+ *
+ * UpdateLineBuffer --
+ *
+ * See the general dicussion of TK_MAC_COALESCE_LINE on the header
+ * pages. This function maintains the data for this feature.
+ *
+ * Results:
+ *
+ * The Tcl_UniChar string of the whole line as seen so far.
+ *
+ * Side effects:
+ * "*offset" is filled with the index of the first new character in
+ * "currentLine". The globals currentLine, currentY, currentLeft,
+ * currentRight and currentFontPtr are updated as necessary.
+ *
+ * The currentLine string is set as the current text in
+ * fontPtr->atsuLayout (see LayoutSetString()).
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static const Tcl_UniChar *
+UpdateLineBuffer(
+ const MacFont *fontPtr, /* The font to be used for the new piece of
+ * text. */
+ const TkMacOSXDrawingContext *drawingContextPtr,
+ /* The Quarz drawing parameters. Needed for
+ * measuring the new piece. */
+ const char *source, /* A new piece of line to be added. */
+ int numBytes, /* Length of the new piece. */
+ int x, int y, /* Position of the new piece in the window. */
+ int *offset) /* Filled with the offset of the new piece in
+ * currentLine. */
+{
+ const Tcl_UniChar * uchars;
+ int ulen;
+
+ if (y != currentY
+ || x < currentRight-1 || x > currentRight+2
+ || currentFontPtr != fontPtr) {
+ Tcl_DStringFree(&currentLine);
+ Tcl_DStringInit(&currentLine);
+ currentY = y;
+ currentLeft = x;
+ currentFontPtr = fontPtr;
+ *offset = 0;
+ } else {
+ *offset = Tcl_DStringLength(&currentLine) / 2;
+ }
+
+ Tcl_UtfToUniCharDString(source, numBytes, &currentLine);
+ uchars = (const Tcl_UniChar*) Tcl_DStringValue(&currentLine);
+ ulen = Tcl_DStringLength(&currentLine) / sizeof(*uchars);
+ LayoutSetString(fontPtr, drawingContextPtr, uchars, ulen);
+ currentRight = x + MeasureStringWidth(fontPtr, *offset, ulen);
+
+ return uchars;
+}
+#endif /* TK_MAC_COALESCE_LINE */
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * FamilyNameForFamilyID --
+ *
+ * Helper for InitFont() and TkMacOSXFontDescriptionForFMFontInfo().
+ * Retrieves font family names for a given font family ID.
+ *
+ * Results:
+ * Font family name or NULL.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static const char *
+FamilyNameForFamilyID(
+ FMFontFamily familyId)
+{
+ OSStatus err;
+ char name[256] = "";
+ const MacFontFamily * familyPtr = NULL;
+
+ err = ChkErr(GetFontFamilyName, familyId, name, sizeof(name));
+ if (err == noErr) {
+ /*
+ * We find the canonical font name, so we can avoid unnecessary
+ * memory management.
+ */
+
+ familyPtr = FindFontFamily(name);
+#ifdef TK_MAC_DEBUG_FONTS
+ if (!familyPtr) {
+ TkMacOSXDbgMsg("Font family '%s' not found", name);
+ }
+#endif
+ }
+ return familyPtr ? familyPtr->name : NULL;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * InitFont --
+ *
+ * Helper for TkpGetNativeFont() and TkpGetFontFromAttributes().
+ * Initializes the memory for a MacFont that wraps the
+ * platform-specific data.
+ *
+ * The caller is responsible for initializing the fields of the TkFont
+ * that are used exclusively by the generic TkFont code, and for
+ * releasing those fields before calling TkpDeleteFont().
+ *
+ * Results:
+ * Fills the MacFont structure.
+ *
+ * Side effects:
+ * Memory allocated.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static void
+InitFont(
+ FMFontFamily familyId, /* The font family to initialize for. */
+ const char * familyName, /* The font family name, if known. Otherwise
+ * this can be NULL. */
+ int size, /* Point size for the font. */
+ int qdStyle, /* QuickDraw style bits. */
+ MacFont * fontPtr) /* Filled with information constructed from the
+ * above arguments. */
+{
+ FontInfo fi;
+ TkFontAttributes * faPtr;
+ TkFontMetrics * fmPtr;
+ int periodWidth, wWidth;
+
+ if (size == 0) {
+ size = GetDefFontSize();
+ }
+ ChkErr(FetchFontInfo, familyId, size, qdStyle, &fi);
+ if (!familyName) {
+ familyName = FamilyNameForFamilyID(familyId);
+ }
+
+ fontPtr->font.fid = (Font) fontPtr;
+
+ faPtr = &fontPtr->font.fa;
+ faPtr->family = familyName;
+ faPtr->size = size;
+ faPtr->weight = (qdStyle & bold) ? TK_FW_BOLD : TK_FW_NORMAL;
+ faPtr->slant = (qdStyle & italic) ? TK_FS_ITALIC : TK_FS_ROMAN;
+ faPtr->underline = ((qdStyle & underline) != 0);
+ faPtr->overstrike = 0;
+
+ fmPtr = &fontPtr->font.fm;
+
+ /*
+ * Note: Macs measure the line height as ascent + descent +
+ * leading. Leading as a separate entity does not exist in X11
+ * and Tk. We add it to the ascent at the moment, because adding
+ * it to the descent, as the Mac docs would indicate, would change
+ * the position of self-drawn underlines.
+ */
+
+ fmPtr->ascent = fi.ascent + fi.leading;
+ fmPtr->descent = fi.descent;
+ fmPtr->maxWidth = fi.widMax;
+
+ fontPtr->qdFont = familyId;
+ fontPtr->qdSize = size;
+ fontPtr->qdStyle = (short) qdStyle;
+
+ InitATSUObjects(familyId, size, qdStyle, &fontPtr->atsuFontId,
+ &fontPtr->atsuLayout, &fontPtr->atsuStyle);
+
+ Tk_MeasureChars((Tk_Font)fontPtr, ".", 1, -1, 0, &periodWidth);
+ Tk_MeasureChars((Tk_Font)fontPtr, "W", 1, -1, 0, &wWidth);
+ fmPtr->fixed = periodWidth == wWidth;
+
+ SetFontFeatures(fontPtr->atsuFontId, fmPtr->fixed, size,
+ fontPtr->atsuStyle);
+
+ AdjustFontHeight(fontPtr);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * InitATSUObjects --
+ *
+ * Helper for InitFont(). Initializes the ATSU data handles for a
+ * MacFont.
+ *
+ * Results:
+ * Sets up all we know and can do at this point in time in fontIdPtr,
+ * layoutPtr and stylePtr.
+ *
+ * Side effects:
+ * Allocates data structures inside of ATSU.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static void
+InitATSUObjects(
+ FMFontFamily familyId, /* The font family to use. */
+ short ptSize, short qdStyles,
+ /* The additional font parameters. */
+ ATSUFontID *fontIdPtr, /* Filled with the font id. */
+ ATSUTextLayout *layoutPtr, /* Filled with the ATSU layout handle. */
+ ATSUStyle *stylePtr) /* Filled with the ATSU style handle,
+ * configured with all parameters. */
+{
+ FMFontStyle stylesDone, stylesLeft;
+
+ /*
+ * Defaults in case of error.
+ */
+
+ *fontIdPtr = GetAppFont();
+ *stylePtr = 0;
+ *layoutPtr = 0;
+
+ /*
+ * Generate a font id from family id and QD style bits.
+ */
+
+ ChkErr(FMGetFontFromFontFamilyInstance, familyId, qdStyles, fontIdPtr,
+ &stylesDone);
+
+ /*
+ * We see what style bits are left and tell ATSU to synthesize what's
+ * left like QD does it.
+ */
+
+ stylesLeft = qdStyles & ~(unsigned)stylesDone;
+
+ /*
+ * Create the style and set its attributes.
+ */
+
+ ChkErr(ATSUCreateStyle, stylePtr);
+ InitATSUStyle(*fontIdPtr, ptSize, stylesLeft, *stylePtr);
+
+ /*
+ * Create the layout. Note: We can't set the layout attributes here,
+ * because the text and the style must be set first.
+ */
+
+ ChkErr(ATSUCreateTextLayout, layoutPtr);
+ /*InitATSULayout(*layoutPtr);*/
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * InitATSUStyle --
+ *
+ * Helper for InitATSUObjects(). Initializes the ATSU style for a
+ * MacFont.
+ *
+ * Results:
+ * Sets up all parameters needed for an ATSU style.
+ *
+ * Side effects:
+ * Allocates data structures for the style inside of ATSU.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static void
+InitATSUStyle(
+ ATSUFontID fontId, /* The font id to use. */
+ short ptSize, short qdStyles,
+ /* Additional font parameters. */
+ ATSUStyle style) /* The style handle to configure. */
+{
+ /*
+ * Attributes for the style.
+ */
+
+ Fixed fsize = IntToFixed(ptSize);
+ Boolean
+ isBold = (qdStyles&bold) != 0,
+ isUnderline = (qdStyles&underline) != 0,
+ isItalic = (qdStyles&italic) != 0;
+
+ ATSStyleRenderingOptions options =
+ antialiasedTextEnabled == -1 ? kATSStyleNoOptions :
+ antialiasedTextEnabled == 0 ? kATSStyleNoAntiAliasing :
+ kATSStyleApplyAntiAliasing;
+
+ static const ATSUAttributeTag styleTags[] = {
+ kATSUFontTag, kATSUSizeTag,
+ kATSUQDBoldfaceTag, kATSUQDItalicTag, kATSUQDUnderlineTag,
+ kATSUStyleRenderingOptionsTag,
+ };
+ static const ByteCount styleSizes[] = {
+ sizeof(ATSUFontID), sizeof(Fixed),
+ sizeof(Boolean), sizeof(Boolean), sizeof(Boolean),
+ sizeof(ATSStyleRenderingOptions),
+ };
+ const ATSUAttributeValuePtr styleValues[] = {
+ &fontId, &fsize,
+ &isBold, &isItalic, &isUnderline,
+ &options,
+ };
+
+ ChkErr(ATSUSetAttributes, style, sizeof(styleTags)/sizeof(styleTags[0]),
+ styleTags, styleSizes, styleValues);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * SetFontFeatures --
+ *
+ * Helper for InitFont(). Request specific font features of the ATSU
+ * style object for a MacFont.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Specific font features are enabled on the ATSU style object.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static void
+SetFontFeatures(
+ ATSUFontID fontId, /* The font id to use. */
+ int fixed, /* Is this a fixed font? */
+ short size, /* Size of the font */
+ ATSUStyle style) /* The style handle to configure. */
+{
+ /*
+ * Don't use the standard latin ligatures, if this is determined to be a
+ * fixed-width font.
+ */
+
+ static const ATSUFontFeatureType fixed_featureTypes[] = {
+ kLigaturesType, kLigaturesType
+ };
+ static const ATSUFontFeatureSelector fixed_featureSelectors[] = {
+ kCommonLigaturesOffSelector, kRareLigaturesOffSelector
+ };
+
+ if (fixed) {
+ ChkErr(ATSUSetFontFeatures, style, sizeof(fixed_featureTypes) /
+ sizeof(fixed_featureTypes[0]), fixed_featureTypes,
+ fixed_featureSelectors);
+ if (size <= 10) {
+ /*
+ * Disable antialiasing of fixed-width fonts with sizes <= 10
+ */
+
+ const ATSStyleRenderingOptions options = kATSStyleNoAntiAliasing;
+ const ATSUAttributeTag styleTag = kATSUStyleRenderingOptionsTag;
+ const ByteCount styleSize = sizeof(ATSStyleRenderingOptions);
+ const ConstATSUAttributeValuePtr styleValue = &options;
+
+ ChkErr(ATSUSetAttributes, style, 1, &styleTag, &styleSize,
+ (ATSUAttributeValuePtr*) &styleValue);
+ }
+ }
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * AdjustFontHeight --
+ *
+ * Helper for InitFont(). Check font height against some real world
+ * examples.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The metrics in fontPtr->font.fm are adjusted so that typical combined
+ * characters fit into ascent+descent.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static void
+AdjustFontHeight(
+ MacFont * fontPtr)
+{
+ /*
+ * The standard values for ascent, descent and leading as determined in
+ * InitFont do not take composition into account, they are designed for
+ * plain ASCII characters. This code measures the actual size of some
+ * typical composed characters from the Latin-1 range and corrects these
+ * factors, especially the ascent.
+ *
+ * A font requested with a pixel size may thus have a larger line height
+ * than requested.
+ *
+ * An alternative would be to instruct ATSU to shrink oversized combined
+ * characters. I think I have seen that feature somewhere, but I can't
+ * find it now [BR].
+ */
+
+ static const UniChar chars[]
+ /* Auml, Aacute, Acirc, Atilde, Ccedilla */
+ = {0x00C4, 0x00C1, 0x00C2, 0x00C3, 0x00C7};
+ static const int charslen = sizeof(chars) / sizeof(chars[0]);
+ Rect size;
+ OSStatus err;
+
+ LayoutSetString(fontPtr, NULL, chars, charslen);
+
+ size.top = size.bottom = 0;
+ err = ChkErr(ATSUMeasureTextImage, fontPtr->atsuLayout, 0, charslen, 0, 0,
+ &size);
+
+ if (err == noErr) {
+ TkFontMetrics * fmPtr = &fontPtr->font.fm;
+ int ascent = -size.top;
+ int descent = size.bottom;
+
+ if (ascent > fmPtr->ascent) {
+ fmPtr->ascent = ascent;
+ }
+ if (descent > fmPtr->descent) {
+ fmPtr->descent = descent;
+ }
+ }
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * InitATSULayout --
+ *
+ * Helper for LayoutSetString(). Initializes the ATSU layout
+ * object for a MacFont and a specific string.
+ *
+ * Results:
+ * Sets up all parameters needed for an ATSU layout object.
+ *
+ * Side effects:
+ * Allocates data structures for the layout object inside of ATSU.
+ *
+ * Assumptions:
+ * The actual string data and style information is already set by
+ * ATSUSetTextPointerLocation() and ATSUSetRunStyle() (see
+ * LayoutSetString()).
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static void
+InitATSULayout(
+ const TkMacOSXDrawingContext *drawingContextPtr,
+ /* Specifies the CGContext to use. */
+ ATSUTextLayout layout, /* The layout object to configure. */
+ int fixed) /* Is this a fixed font? */
+{
+ /*
+ * Attributes for the layout.
+ */
+
+ ATSLineLayoutOptions layoutOptions = 0
+#if TK_MAC_COALESCE_LINE
+ /*
+ * Options to use unconditionally when we try to do coalescing.
+ */
+ | kATSLineDisableAllLayoutOperations
+ | kATSLineFractDisable
+ | kATSLineUseDeviceMetrics
+#endif
+ ;
+ CGContextRef context = drawingContextPtr ?
+ drawingContextPtr->context : NULL;
+
+ static const ATSUAttributeTag layoutTags[] = {
+ kATSUCGContextTag,
+ kATSULineLayoutOptionsTag,
+ };
+ static const ByteCount layoutSizes[] = {
+ sizeof(CGContextRef),
+ sizeof(ATSLineLayoutOptions),
+ };
+ const ATSUAttributeValuePtr layoutValues[] = {
+ &context,
+ &layoutOptions,
+ };
+
+ /*
+ * Ensure W(abcdefg) == W(a)*7 for fixed fonts (Latin scripts only).
+ */
+
+ if (fixed) {
+ layoutOptions |= kATSLineFractDisable | kATSLineUseDeviceMetrics;
+ }
+
+ ChkErr(ATSUSetLayoutControls, layout, sizeof(layoutTags) /
+ sizeof(layoutTags[0]), layoutTags, layoutSizes, layoutValues);
+ ChkErr(ATSUSetTransientFontMatching, layout, true);
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * LayoutSetString --
+ *
+ * Setup the MacFont for a specific string.
+ *
+ * Results:
+ * Sets up all parameters so that ATSU can work with the objects in
+ * MacFont.
+ *
+ * Side effects:
+ * Sets parameters on the layout object fontPtr->atsuLayout.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+void
+LayoutSetString(
+ const MacFont *fontPtr, /* The fontPtr to configure. */
+ const TkMacOSXDrawingContext *drawingContextPtr,
+ /* For the CGContext to be used.*/
+ const UniChar *uchars, int ulen)
+ /* The UniChar string to set into
+ * fontPtr->atsuLayout. */
+{
+ ChkErr(ATSUSetTextPointerLocation, fontPtr->atsuLayout, uchars,
+ kATSUFromTextBeginning, ulen, ulen);
+
+ /*
+ * Styles can only be set after the text is set.
+ */
+
+ ChkErr(ATSUSetRunStyle, fontPtr->atsuLayout, fontPtr->atsuStyle,
+ kATSUFromTextBeginning, kATSUToTextEnd);
+
+ /*
+ * Layout attributes can only be set after the styles are set.
+ */
+
+ InitATSULayout(drawingContextPtr, fontPtr->atsuLayout,
+ fontPtr->font.fm.fixed);
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * ReleaseFont --
+ *
+ * Called to release the Macintosh-specific contents of a TkFont. The
+ * caller is responsible for freeing the memory used by the font
+ * itself.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Memory is freed.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+static void
+ReleaseFont(
+ MacFont *fontPtr) /* The font to delete. */
+{
+ ATSUDisposeTextLayout(fontPtr->atsuLayout);
+ ATSUDisposeStyle(fontPtr->atsuStyle);
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * FindFontFamilyOrAlias, FindFontFamilyOrAliasOrFallback --
+ *
+ * Determine if any physical screen font exists on the system with the
+ * given family name. If the family exists, then it should be possible
+ * to construct some physical screen font with that family name.
+ *
+ * FindFontFamilyOrAlias also considers font aliases as determined by
+ * TkFontGetAliasList().
+ *
+ * FindFontFamilyOrAliasOrFallback also considers font aliases as
+ * determined by TkFontGetFallbacks().
+ *
+ * The overall algorithm to get the closest font to the one requested is
+ * this:
+ *
+ * try fontname
+ * try all aliases for fontname
+ * foreach fallback for fontname
+ * try the fallback
+ * try all aliases for the fallback
+ *
+ * Results:
+ *
+ * The return value is NULL if the specified font family does not exist,
+ * a valid MacFontFamily* otherwise.
+ *
+ * Side effects:
+ *
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static const MacFontFamily *
+FindFontFamilyOrAlias(
+ const char *name) /* Name or alias name of the font to find. */
+{
+ const MacFontFamily * familyPtr;
+ const char *const * aliases;
+ int i;
+
+ familyPtr = FindFontFamily(name);
+ if (familyPtr != NULL) {
+ return familyPtr;
+ }
+
+ aliases = TkFontGetAliasList(name);
+ if (aliases != NULL) {
+ for (i = 0; aliases[i] != NULL; i++) {
+ familyPtr = FindFontFamily(aliases[i]);
+ if (familyPtr != NULL) {
+ return familyPtr;
+ }
+ }
+ }
+ return NULL;
+}
+
+static const MacFontFamily *
+FindFontFamilyOrAliasOrFallback(
+ const char *name) /* Name or alias name of the font to find. */
+{
+ const MacFontFamily * familyPtr;
+ const char * fallback;
+ const char *const *const * fallbacks;
+ int i, j;
+
+ familyPtr = FindFontFamilyOrAlias(name);
+ if (familyPtr != NULL) {
+ return familyPtr;
+ }
+ fallbacks = TkFontGetFallbacks();
+ for (i = 0; fallbacks[i] != NULL; i++) {
+ for (j = 0; (fallback = fallbacks[i][j]) != NULL; j++) {
+ if (strcasecmp(name, fallback) == 0) {
+ for (j = 0; (fallback = fallbacks[i][j]) != NULL; j++) {
+ familyPtr = FindFontFamilyOrAlias(fallback);
+ if (familyPtr != NULL) {
+ return familyPtr;
+ }
+ }
+ }
+ break; /* benny: This "break" is a carry-over from
+ * tkMacOSXFont.c, but what is actually its purpose
+ * ???? */
+ }
+ }
+
+
+ /*
+ * FIXME: We would have liked to recover by re-enumerating fonts. But
+ * that doesn't work, because Carbon seems to cache the inital list of
+ * fonts. Fonts newly installed don't show up with
+ * FMCreateFontFamilyIterator()/FMGetNextFontFamily() without a restart
+ * of the app. Similar problem with fonts removed.
+ */
+
+#ifdef TK_MAC_DEBUG_FONTS
+ TkMacOSXDbgMsg("Font family '%s' not found", name);
+#endif
+
+ return NULL;
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * InitFontFamilies --
+ *
+ * Helper to TkpFontPkgInit. Use the Font Manager to fill in the
+ * familyList global array.
+ *
+ * Results:
+ *
+ * None.
+ *
+ * Side effects:
+ *
+ * Allocates memory.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void
+InitFontFamilies(void)
+{
+ FMFontFamily fontFamily;
+ Str255 fontName;
+ SInt16 fontSize;
+ Style fontStyle;
+
+ /*
+ * Has this been called before?
+ */
+
+ if (familyListNextFree > 0) {
+ return;
+ }
+
+ ChkErr(ATSFontFamilyApplyFunction, FontFamilyEnumCallback,NULL);
+
+ if (GetThemeFontAndFamily(kThemeSystemFont, &fontFamily, fontName,
+ &fontSize, &fontStyle) == noErr) {
+ AddFontFamily(SYSTEMFONT_NAME, fontFamily);
+ }
+ if (GetThemeFontAndFamily(kThemeApplicationFont, &fontFamily, fontName,
+ &fontSize, &fontStyle) == noErr) {
+ AddFontFamily(APPLFONT_NAME, fontFamily);
+ }
+ if (GetThemeFontAndFamily(kThemeMenuItemFont, &fontFamily, fontName,
+ &fontSize, &fontStyle) == noErr) {
+ AddFontFamily(MENUITEMFONT_NAME, fontFamily);
+ }
+
+ SortFontFamilies();
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * FontFamilyEnumCallback --
+ *
+ * Callback for ATSFontFamilyApplyFunction().
+ *
+ * Results:
+ *
+ * noErr.
+ *
+ * Side effects:
+ *
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static OSStatus
+FontFamilyEnumCallback(
+ ATSFontFamilyRef family,
+ void *refCon)
+{
+ OSStatus err;
+ char name[260] = "";
+
+ (void) refCon;
+
+ err = ChkErr(GetFontFamilyName, family, name, sizeof(name));
+ if (err == noErr) {
+ AddFontFamily(name, family);
+ }
+
+ return noErr;
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * GetFontFamilyName --
+ *
+ * Use the Font Manager to get the name of a given FMFontfamily. This
+ * currently gets the standard, non-localized QuickDraw name. Other
+ * names would be possible, see docs for ATSUFindFontName for a
+ * selection. The MacOSX font selector seems to use the localized
+ * family name given by ATSUFindFontName(kFontFamilyName), but that API
+ * doesn't give us a name at all for some fonts.
+ *
+ * Results:
+ * An OS error code, noErr on success. name is filled with the
+ * resulting name.
+ *
+ * Side effects:
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static OSStatus
+GetFontFamilyName(
+ FMFontFamily fontFamily, /* The font family for which to find the
+ * name. */
+ char * name, int numBytes) /* Filled with the result. */
+{
+ OSStatus err;
+ Str255 nativeName;
+ CFStringRef cfString;
+ TextEncoding encoding;
+ ScriptCode nameencoding;
+
+ nativeName[0] = 0;
+ name[0] = 0;
+ err = ChkErr(FMGetFontFamilyName, fontFamily, nativeName);
+ if (err != noErr) {
+ return err;
+ }
+
+ /*
+ * QuickDraw font names are encoded with the script that the font uses.
+ * So we determine that encoding and than we reencode the name. We
+ * pre-set the encoding with the default value, so we do not need to
+ * check result codes here.
+ */
+
+ encoding = kTextEncodingMacRoman;
+ ChkErr(FMGetFontFamilyTextEncoding, fontFamily, &encoding);
+ nameencoding = encoding;
+ ChkErr(RevertTextEncodingToScriptInfo, encoding, &nameencoding, NULL,
+ NULL);
+
+ /*
+ * Note: We could use Tcl facilities to do the re-encoding here. We'd
+ * have to maintain tables to map OS encoding codes to Tcl encoding names
+ * like tkMacOSXFont.c did. Using native re-encoding directly instead is
+ * a lot easier and future-proof than that. There is one snag, though: I
+ * have seen CFStringGetCString() crash with invalid encoding ids. But
+ * than if that happens it would be a bug in
+ * FMGetFontFamilyTextEncoding() or RevertTextEncodingToScriptInfo().
+ * Another problem is that users have seen CFStringCreate return null
+ * (Bug #2548661). This is due to font names with a bad encoding.
+ */
+
+ cfString = CFStringCreateWithPascalStringNoCopy(
+ NULL, nativeName, nameencoding, kCFAllocatorNull);
+ if (cfString == NULL) {
+ TkMacOSXDbgMsg("CFStringCreate: "
+ "'%.*s' could not be decoded with encoding %d",
+ nativeName[0], nativeName+1, (int) nameencoding);
+ return kTextMalformedInputErr;
+ }
+
+ CFStringGetCString(cfString, name, numBytes, kCFStringEncodingUTF8);
+ CFRelease(cfString);
+
+ return noErr;
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * FindFontFamily --
+ *
+ * Find the font family with the given name in the global familyList.
+ * Uses bsearch() for convenient access. Comparision is done
+ * non-case-sensitively with CompareFontFamilies() which see.
+ *
+ * Results:
+ *
+ * MacFontFamily: A pair of family id and the actual name registered for
+ * the font.
+ *
+ * Side effects:
+ *
+ * None.
+ *
+ * Assumption:
+ *
+ * Requires the familyList array to be sorted.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static const MacFontFamily *
+FindFontFamily(
+ const char *name) /* The family name. Note: Names are compared
+ * non-case-sensitive. */
+{
+ const MacFontFamily key = {name,-1};
+
+ if(familyListMaxValid <= 0) {
+ return NULL;
+ }
+
+ return bsearch(&key, familyList, familyListMaxValid, sizeof(*familyList),
+ CompareFontFamilies);
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * EnumFontFamilies --
+ *
+ * Create a Tcl list with the registered names in the global familyList.
+ *
+ * Results:
+ * A Tcl list of names.
+ *
+ * Side effects:
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static Tcl_Obj *
+EnumFontFamilies(void)
+{
+ int i;
+ Tcl_Obj * tclList;
+
+ tclList = Tcl_NewListObj(0, NULL);
+ for (i=0; i<familyListMaxValid; ++i) {
+ Tcl_ListObjAppendElement(NULL, tclList,
+ Tcl_NewStringObj(familyList[i].name, -1));
+ }
+
+ return tclList;
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * AddFontFamily --
+ *
+ * Register a font family in familyList. Until SortFontFamilies() is
+ * called, this is not actually available for FindFontFamily().
+ *
+ * Results:
+ *
+ * MacFontFamily: The new pair of family id and the actual name
+ * registered for the font.
+ *
+ * Side effects:
+ *
+ * New entry in familyList and familyListNextFree updated.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static const MacFontFamily *
+AddFontFamily(
+ const char *name, /* Font family name to register. */
+ FMFontFamily familyId) /* Font family id to register. */
+{
+ MacFontFamily * familyPtr;
+
+ if (familyListNextFree >= familyListSize) {
+ familyListSize += 100;
+ familyList = ckrealloc(familyList,
+ familyListSize * sizeof(*familyList));
+ }
+
+ familyPtr = familyList + familyListNextFree;
+ ++familyListNextFree;
+
+ familyPtr->name = AddString(name);
+ familyPtr->familyId = familyId;
+
+ return familyPtr;
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * SortFontFamilies --
+ *
+ * Sort the entries in familyList. Only after calling
+ * SortFontFamilies(), the new families registered with AddFontFamily()
+ * are actually available for FindFontFamily(), because FindFontFamily()
+ * requires the array to be sorted.
+ *
+ * Results:
+ *
+ * None.
+ *
+ * Side effects:
+ *
+ * familyList is sorted and familyListMaxValid is updated.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static void
+SortFontFamilies(void)
+{
+ if (familyListNextFree > 0) {
+ qsort(familyList, familyListNextFree, sizeof(*familyList),
+ CompareFontFamilies);
+ }
+ familyListMaxValid = familyListNextFree;
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * CompareFontFamilies --
+ *
+ * Comparison function used by SortFontFamilies() and FindFontFamily().
+ *
+ * Results:
+ * Result as required to generate a stable sort order for bsearch() and
+ * qsort(). The ordering is not case-sensitive as far as
+ * Tcl_UtfNcasecmp() (which see) can provide that.
+ *
+ * Note: It would be faster to compare first the length and the actual
+ * strings only as a tie-breaker, but than the ordering wouldn't look so
+ * pretty in [font families] ;-).
+ *
+ * Side effects:
+ * None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static int
+CompareFontFamilies(
+ const void * vp1,
+ const void * vp2)
+{
+ const char * name1;
+ const char * name2;
+ int len1, len2, diff;
+
+ name1 = ((const MacFontFamily *) vp1)->name;
+ name2 = ((const MacFontFamily *) vp2)->name;
+
+ len1 = Tcl_NumUtfChars(name1, -1);
+ len2 = Tcl_NumUtfChars(name2, -1);
+
+ diff = Tcl_UtfNcasecmp(name1, name2, len1<len2 ? len1 : len2);
+
+ return diff == 0 ? len1-len2 : diff;
+}
+
+/*
+ *-------------------------------------------------------------------------
+ *
+ * AddString --
+ *
+ * Helper for AddFontFamily(). Allocates a string in the one-shot
+ * allocator.
+ *
+ * Results:
+ * A duplicated string in the one-shot allocator.
+ *
+ * Side effects:
+ * May allocate a new memory block.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+static const char *
+AddString(
+ const char *in) /* String to add, zero-terminated. */
+{
+ int len;
+ char *result;
+
+ len = strlen(in) +1;
+
+ if (stringMemory == NULL
+ || (stringMemory->nextFree+len) > STRING_BLOCK_MAX) {
+ StringBlock *newblock = ckalloc(sizeof(StringBlock));
+
+ newblock->next = stringMemory;
+ newblock->nextFree = 0;
+ stringMemory = newblock;
+ }
+
+ result = stringMemory->strings + stringMemory->nextFree;
+ stringMemory->nextFree += len;
+
+ memcpy(result, in, len);
+
+ return result;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * TkMacOSXIsCharacterMissing --
+ *
+ * Given a tkFont and a character determine whether the character has
+ * a glyph defined in the font or not.
+ *
+ * Results:
+ * Returns a 1 if the character is missing, a 0 if it is not.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+int
+TkMacOSXIsCharacterMissing(
+ Tk_Font tkfont, /* The font we are looking in. */
+ unsigned int searchChar) /* The character we are looking for. */
+{
+ /* Background: This function is private and only used in
+ * tkMacOSXMenu.c:FindMarkCharacter().
+ *
+ * We could use ATSUMatchFont() to implement. We'd have to change the
+ * definition of the encoding of the parameter searchChar from MacRoman
+ * to UniChar for that.
+ *
+ * The system uses font fallback for controls, so we don't really need
+ * this. */
+
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXInitControlFontStyle --
+ *
+ * This procedure sets up the appropriate ControlFontStyleRec
+ * for a Mac control.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXInitControlFontStyle(
+ Tk_Font tkfont, /* Tk font object to use for the control. */
+ ControlFontStylePtr fsPtr) /* The style object to configure. */
+{
+ const MacFont * fontPtr = (MacFont *) tkfont;
+
+ fsPtr->flags = kControlUseFontMask | kControlUseSizeMask |
+ kControlUseFaceMask | kControlUseJustMask;
+ fsPtr->font = fontPtr->qdFont;
+ fsPtr->size = fontPtr->qdSize;
+ fsPtr->style = fontPtr->qdStyle;
+ fsPtr->just = teCenter;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXFMFontInfoForFont --
+ *
+ * Retrieve FontManager/ATSUI font information for a Tk font.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE void
+TkMacOSXFMFontInfoForFont(
+ Tk_Font tkfont,
+ FMFontFamily *fontFamilyPtr,
+ FMFontStyle *fontStylePtr,
+ FMFontSize *fontSizePtr,
+ ATSUStyle *fontATSUStylePtr)
+{
+ const MacFont * fontPtr = (MacFont *) tkfont;
+
+ if (fontFamilyPtr) {
+ *fontFamilyPtr = fontPtr->qdFont;
+ }
+ if (fontStylePtr) {
+ *fontStylePtr = fontPtr->qdStyle;
+ }
+ if (fontSizePtr) {
+ *fontSizePtr = fontPtr->qdSize;
+ }
+ if (fontATSUStylePtr) {
+ *fontATSUStylePtr = fontPtr->atsuStyle;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXFontDescriptionForFMFontInfo --
+ *
+ * Get text description of a font specified by FontManager info.
+ *
+ * Results:
+ * List object or NULL.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE Tcl_Obj *
+TkMacOSXFontDescriptionForFMFontInfo(
+ FMFontFamily fontFamily,
+ FMFontStyle fontStyle,
+ FMFontSize fontSize,
+ FMFont fontID)
+{
+ Tcl_Obj *objv[6];
+ int i = 0;
+
+ if (fontFamily != kInvalidFontFamily && fontStyle != -1) {
+ const char *familyName = FamilyNameForFamilyID(fontFamily);
+
+ if (familyName) {
+ objv[i++] = Tcl_NewStringObj(familyName, -1);
+ objv[i++] = Tcl_NewIntObj(fontSize);
+#define S(s) Tcl_NewStringObj(STRINGIFY(s),(int)(sizeof(STRINGIFY(s))-1))
+ objv[i++] = (fontStyle & bold) ? S(bold) : S(normal);
+ objv[i++] = (fontStyle & italic) ? S(italic) : S(roman);
+ if (fontStyle & underline) objv[i++] = S(underline);
+ /*if (fontStyle & overstrike) objv[i++] = S(overstrike);*/
+#undef S
+ }
+ } else if (fontID != kInvalidFont) {
+ CFStringRef fontName = NULL;
+ Tcl_Obj *fontNameObj = NULL;
+
+ ChkErr(ATSFontGetName, FMGetATSFontRefFromFont(fontID),
+ kATSOptionFlagsDefault, &fontName);
+ if (fontName) {
+ fontNameObj = TkMacOSXGetStringObjFromCFString(fontName);
+ CFRelease(fontName);
+ }
+ if (fontNameObj) {
+ objv[i++] = fontNameObj;
+ objv[i++] = Tcl_NewIntObj(fontSize);
+ }
+ }
+ return i ? Tcl_NewListObj(i, objv) : NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXUseAntialiasedText --
+ *
+ * Enables or disables application-wide use of antialiased text (where
+ * available). Sets up a linked Tcl global variable to allow
+ * disabling of antialiased text from tcl.
+ * The possible values for this variable are:
+ *
+ * -1 - Use system default as configurable in "System Prefs" -> "General".
+ * 0 - Unconditionally disable antialiasing.
+ * 1 - Unconditionally enable antialiasing.
+ *
+ * Results:
+ *
+ * TCL_OK.
+ *
+ * Side effects:
+ *
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkMacOSXUseAntialiasedText(
+ Tcl_Interp * interp, /* The Tcl interpreter to receive the
+ * variable.*/
+ int enable) /* Initial value. */
+{
+ static Boolean initialized = FALSE;
+
+ if (!initialized) {
+ initialized = TRUE;
+
+ if (Tcl_CreateNamespace(interp, "::tk::mac", NULL, NULL) == NULL) {
+ Tcl_ResetResult(interp);
+ }
+ if (Tcl_LinkVar(interp, "::tk::mac::antialiasedtext",
+ (char *) &antialiasedTextEnabled,
+ TCL_LINK_INT) != TCL_OK) {
+ Tcl_ResetResult(interp);
+ }
+ }
+ antialiasedTextEnabled = enable;
+ return TCL_OK;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/carbon/tkMacOSXFont.h b/carbon/tkMacOSXFont.h
new file mode 100644
index 0000000..e932fb7
--- /dev/null
+++ b/carbon/tkMacOSXFont.h
@@ -0,0 +1,38 @@
+/*
+ * tkMacOSXFont.h --
+ *
+ * Contains the Macintosh implementation of the platform-independant
+ * font package interface.
+ *
+ * Copyright (c) 1990-1994 The Regents of the University of California.
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#ifndef TKMACOSXFONT_H
+#define TKMACOSXFONT_H 1
+
+#include "tkFont.h"
+
+#ifndef _TKMACINT
+#include "tkMacOSXInt.h"
+#endif
+
+/*
+ * Function prototypes
+ */
+
+MODULE_SCOPE void TkMacOSXInitControlFontStyle(Tk_Font tkfont,
+ ControlFontStylePtr fsPtr);
+MODULE_SCOPE void TkMacOSXFMFontInfoForFont(Tk_Font tkfont,
+ FMFontFamily *fontFamilyPtr, FMFontStyle *fontStylePtr,
+ FMFontSize *fontSizePtr, ATSUStyle *fontATSUStylePtr);
+MODULE_SCOPE Tcl_Obj * TkMacOSXFontDescriptionForFMFontInfo(
+ FMFontFamily fontFamily, FMFontStyle fontStyle, FMFontSize fontSize,
+ FMFont fontID);
+
+#endif /*TKMACOSXFONT_H*/
diff --git a/carbon/tkMacOSXHLEvents.c b/carbon/tkMacOSXHLEvents.c
new file mode 100644
index 0000000..1ab050f
--- /dev/null
+++ b/carbon/tkMacOSXHLEvents.c
@@ -0,0 +1,691 @@
+/*
+ * tkMacOSXHLEvents.c --
+ *
+ * Implements high level event support for the Macintosh. Currently, the
+ * only event that really does anything is the Quit event.
+ *
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+
+/*
+ * This is a Tcl_Event structure that the Quit AppleEvent handler uses to
+ * schedule the ReallyKillMe function.
+ */
+
+typedef struct KillEvent {
+ Tcl_Event header; /* Information that is standard for all
+ * events. */
+ Tcl_Interp *interp; /* Interp that was passed to the Quit
+ * AppleEvent */
+} KillEvent;
+
+/*
+ * Static functions used only in this file.
+ */
+
+static OSErr QuitHandler(const AppleEvent *event,
+ AppleEvent *reply, long handlerRefcon);
+static OSErr OappHandler(const AppleEvent *event,
+ AppleEvent *reply, long handlerRefcon);
+static OSErr RappHandler(const AppleEvent *event,
+ AppleEvent *reply, long handlerRefcon);
+static OSErr OdocHandler(const AppleEvent *event,
+ AppleEvent *reply, long handlerRefcon);
+static OSErr PrintHandler(const AppleEvent *event,
+ AppleEvent *reply, long handlerRefcon);
+static OSErr ScriptHandler(const AppleEvent *event,
+ AppleEvent *reply, long handlerRefcon);
+static OSErr PrefsHandler(const AppleEvent *event,
+ AppleEvent *reply, long handlerRefcon);
+static int MissedAnyParameters(const AppleEvent *theEvent);
+static int ReallyKillMe(Tcl_Event *eventPtr, int flags);
+static OSStatus FSRefToDString(const FSRef *fsref, Tcl_DString *ds);
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXInitAppleEvents --
+ *
+ * Initilize the Apple Events on the Macintosh. This registers the core
+ * event handlers.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXInitAppleEvents(
+ Tcl_Interp *interp) /* Interp to handle basic events. */
+{
+ AEEventHandlerUPP OappHandlerUPP, RappHandlerUPP, OdocHandlerUPP;
+ AEEventHandlerUPP PrintHandlerUPP, QuitHandlerUPP, ScriptHandlerUPP;
+ AEEventHandlerUPP PrefsHandlerUPP;
+ static Boolean initialized = FALSE;
+
+ if (!initialized) {
+ initialized = TRUE;
+
+ /*
+ * Install event handlers for the core apple events.
+ */
+
+ QuitHandlerUPP = NewAEEventHandlerUPP(QuitHandler);
+ ChkErr(AEInstallEventHandler, kCoreEventClass, kAEQuitApplication,
+ QuitHandlerUPP, (long) interp, false);
+
+ OappHandlerUPP = NewAEEventHandlerUPP(OappHandler);
+ ChkErr(AEInstallEventHandler, kCoreEventClass, kAEOpenApplication,
+ OappHandlerUPP, (long) interp, false);
+
+ RappHandlerUPP = NewAEEventHandlerUPP(RappHandler);
+ ChkErr(AEInstallEventHandler, kCoreEventClass, kAEReopenApplication,
+ RappHandlerUPP, (long) interp, false);
+
+ OdocHandlerUPP = NewAEEventHandlerUPP(OdocHandler);
+ ChkErr(AEInstallEventHandler, kCoreEventClass, kAEOpenDocuments,
+ OdocHandlerUPP, (long) interp, false);
+
+ PrintHandlerUPP = NewAEEventHandlerUPP(PrintHandler);
+ ChkErr(AEInstallEventHandler, kCoreEventClass, kAEPrintDocuments,
+ PrintHandlerUPP, (long) interp, false);
+
+ PrefsHandlerUPP = NewAEEventHandlerUPP(PrefsHandler);
+ ChkErr(AEInstallEventHandler, kCoreEventClass, kAEShowPreferences,
+ PrefsHandlerUPP, (long) interp, false);
+
+ if (interp) {
+ ScriptHandlerUPP = NewAEEventHandlerUPP(ScriptHandler);
+ ChkErr(AEInstallEventHandler, kAEMiscStandards, kAEDoScript,
+ ScriptHandlerUPP, (long) interp, false);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXDoHLEvent --
+ *
+ * Dispatch incomming highlevel events.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Depends on the incoming event.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkMacOSXDoHLEvent(
+ void *theEvent)
+{
+ return AEProcessAppleEvent(theEvent);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * QuitHandler --
+ *
+ * This is the 'quit' core Apple event handler.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static OSErr
+QuitHandler(
+ const AppleEvent *event,
+ AppleEvent *reply,
+ long handlerRefcon)
+{
+ Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
+ KillEvent *eventPtr;
+
+ if (interp) {
+ /*
+ * Call the exit command from the event loop, since you are not
+ * supposed to call ExitToShell in an Apple Event Handler. We put this
+ * at the head of Tcl's event queue because this message usually comes
+ * when the Mac is shutting down, and we want to kill the shell as
+ * quickly as possible.
+ */
+
+ eventPtr = ckalloc(sizeof(KillEvent));
+ eventPtr->header.proc = ReallyKillMe;
+ eventPtr->interp = interp;
+
+ Tcl_QueueEvent((Tcl_Event *) eventPtr, TCL_QUEUE_HEAD);
+ }
+ return noErr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * OappHandler --
+ *
+ * This is the 'oapp' core Apple event handler.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static OSErr
+OappHandler(
+ const AppleEvent *event,
+ AppleEvent *reply,
+ long handlerRefcon)
+{
+ Tcl_CmdInfo dummy;
+ Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
+
+ if (interp &&
+ Tcl_GetCommandInfo(interp, "::tk::mac::OpenApplication", &dummy)){
+ int code = Tcl_GlobalEval(interp, "::tk::mac::OpenApplication");
+ if (code != TCL_OK) {
+ Tcl_BackgroundException(interp, code);
+ }
+ }
+ return noErr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RappHandler --
+ *
+ * This is the 'rapp' core Apple event handler.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static OSErr
+RappHandler(
+ const AppleEvent *event,
+ AppleEvent *reply,
+ long handlerRefcon)
+{
+ Tcl_CmdInfo dummy;
+ Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
+ ProcessSerialNumber thePSN = {0, kCurrentProcess};
+ OSStatus err = ChkErr(SetFrontProcess, &thePSN);
+
+ if (interp && Tcl_GetCommandInfo(interp,
+ "::tk::mac::ReopenApplication", &dummy)) {
+ int code = Tcl_GlobalEval(interp, "::tk::mac::ReopenApplication");
+ if (code != TCL_OK){
+ Tcl_BackgroundException(interp, code);
+ }
+ }
+ return err;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * PrefsHandler --
+ *
+ * This is the 'pref' core Apple event handler. Called when the user
+ * selects 'Preferences...' in MacOS X
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static OSErr
+PrefsHandler(
+ const AppleEvent *event,
+ AppleEvent *reply,
+ long handlerRefcon)
+{
+ Tcl_CmdInfo dummy;
+ Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
+
+ if (interp &&
+ Tcl_GetCommandInfo(interp, "::tk::mac::ShowPreferences", &dummy)){
+ int code = Tcl_GlobalEval(interp, "::tk::mac::ShowPreferences");
+ if (code != TCL_OK) {
+ Tcl_BackgroundException(interp, code);
+ }
+ }
+ return noErr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * OdocHandler --
+ *
+ * This is the 'odoc' core Apple event handler.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static OSErr
+OdocHandler(
+ const AppleEvent *event,
+ AppleEvent *reply,
+ long handlerRefcon)
+{
+ Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
+ AEDescList fileSpecList;
+ FSRef file;
+ DescType type;
+ Size actual;
+ long count, index;
+ AEKeyword keyword;
+ Tcl_DString command, pathName;
+ Tcl_CmdInfo dummy;
+ int code;
+
+ /*
+ * Don't bother if we don't have an interp or the open document procedure
+ * doesn't exist.
+ */
+
+ if (!interp ||
+ !Tcl_GetCommandInfo(interp, "::tk::mac::OpenDocument", &dummy)) {
+ return noErr;
+ }
+
+ /*
+ * If we get any errors while retrieving our parameters we just return with
+ * no error.
+ */
+
+ if (ChkErr(AEGetParamDesc, event, keyDirectObject, typeAEList,
+ &fileSpecList) != noErr) {
+ return noErr;
+ }
+ if (MissedAnyParameters(event) != noErr) {
+ return noErr;
+ }
+ if (ChkErr(AECountItems, &fileSpecList, &count) != noErr) {
+ return noErr;
+ }
+
+ /*
+ * Convert our parameters into a script to evaluate, skipping things that
+ * we can't handle right.
+ */
+
+ Tcl_DStringInit(&command);
+ Tcl_DStringAppend(&command, "::tk::mac::OpenDocument", -1);
+ for (index = 1; index <= count; index++) {
+ if (ChkErr(AEGetNthPtr, &fileSpecList, index, typeFSRef, &keyword,
+ &type, (Ptr) &file, sizeof(FSRef), &actual) != noErr) {
+ continue;
+ }
+
+ if (ChkErr(FSRefToDString, &file, &pathName) == noErr) {
+ Tcl_DStringAppendElement(&command, Tcl_DStringValue(&pathName));
+ Tcl_DStringFree(&pathName);
+ }
+ }
+
+ /*
+ * Now handle the event by evaluating a script.
+ */
+
+ code = Tcl_EvalEx(interp, Tcl_DStringValue(&command),
+ Tcl_DStringLength(&command), TCL_EVAL_GLOBAL);
+ if (code != TCL_OK) {
+ Tcl_BackgroundException(interp, code);
+ }
+ Tcl_DStringFree(&command);
+ return noErr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * PrintHandler --
+ *
+ * This is the 'pdoc' core Apple event handler.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static OSErr
+PrintHandler(
+ const AppleEvent * event,
+ AppleEvent * reply,
+ long handlerRefcon)
+{
+ Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
+ AEDescList fileSpecList;
+ FSRef file;
+ DescType type;
+ Size actual;
+ long count, index;
+ AEKeyword keyword;
+ Tcl_DString command, pathName;
+ Tcl_CmdInfo dummy;
+ int code;
+
+ /*
+ * Don't bother if we don't have an interp or the print document procedure
+ * doesn't exist.
+ */
+
+ if (!interp ||
+ !Tcl_GetCommandInfo(interp, "::tk::mac::PrintDocument", &dummy)) {
+ return noErr;
+ }
+
+ /*
+ * If we get any errors while retrieving our parameters we just return with
+ * no error.
+ */
+
+ if (ChkErr(AEGetParamDesc, event, keyDirectObject, typeAEList,
+ &fileSpecList) != noErr) {
+ return noErr;
+ }
+ if (ChkErr(MissedAnyParameters, event) != noErr) {
+ return noErr;
+ }
+ if (ChkErr(AECountItems, &fileSpecList, &count) != noErr) {
+ return noErr;
+ }
+
+ Tcl_DStringInit(&command);
+ Tcl_DStringAppend(&command, "::tk::mac::PrintDocument", -1);
+ for (index = 1; index <= count; index++) {
+ if (ChkErr(AEGetNthPtr, &fileSpecList, index, typeFSRef, &keyword,
+ &type, (Ptr) &file, sizeof(FSRef), &actual) != noErr) {
+ continue;
+ }
+
+ if (ChkErr(FSRefToDString, &file, &pathName) == noErr) {
+ Tcl_DStringAppendElement(&command, Tcl_DStringValue(&pathName));
+ Tcl_DStringFree(&pathName);
+ }
+ }
+
+ /*
+ * Now handle the event by evaluating a script.
+ */
+
+ code = Tcl_EvalEx(interp, Tcl_DStringValue(&command),
+ Tcl_DStringLength(&command), TCL_EVAL_GLOBAL);
+ if (code != TCL_OK) {
+ Tcl_BackgroundException(interp, code);
+ }
+ Tcl_DStringFree(&command);
+ return noErr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ScriptHandler --
+ *
+ * This handler process the script event.
+ *
+ * Results:
+ * Schedules the given event to be processed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static OSErr
+ScriptHandler(
+ const AppleEvent *event,
+ AppleEvent *reply,
+ long handlerRefcon)
+{
+ OSStatus theErr;
+ AEDescList theDesc;
+ Size size;
+ int tclErr = -1;
+ Tcl_Interp *interp = (Tcl_Interp *) handlerRefcon;
+ char errString[128];
+
+ /*
+ * The do script event receives one parameter that should be data or a
+ * file.
+ */
+
+ theErr = AEGetParamDesc(event, keyDirectObject, typeWildCard,
+ &theDesc);
+ if (theErr != noErr) {
+ sprintf(errString, "AEDoScriptHandler: GetParamDesc error %d",
+ (int)theErr);
+ theErr = AEPutParamPtr(reply, keyErrorString, typeChar, errString,
+ strlen(errString));
+ } else if (MissedAnyParameters(event)) {
+ /*
+ * Return error if parameter is missing.
+ */
+
+ sprintf(errString, "AEDoScriptHandler: extra parameters");
+ AEPutParamPtr(reply, keyErrorString, typeChar, errString,
+ strlen(errString));
+ theErr = -1771;
+ } else if (theDesc.descriptorType == (DescType) typeAlias &&
+ AEGetParamPtr(event, keyDirectObject, typeFSRef, NULL, NULL,
+ 0, &size) == noErr && size == sizeof(FSRef)) {
+ /*
+ * We've had a file sent to us. Source it.
+ */
+
+ FSRef file;
+ theErr = AEGetParamPtr(event, keyDirectObject, typeFSRef, NULL, &file,
+ size, NULL);
+ if (theErr == noErr) {
+ Tcl_DString scriptName;
+
+ theErr = FSRefToDString(&file, &scriptName);
+ if (theErr == noErr) {
+ tclErr = Tcl_EvalFile(interp, Tcl_DStringValue(&scriptName));
+ Tcl_DStringFree(&scriptName);
+ } else {
+ sprintf(errString, "AEDoScriptHandler: file not found");
+ AEPutParamPtr(reply, keyErrorString, typeChar, errString,
+ strlen(errString));
+ }
+ }
+ } else if (AEGetParamPtr(event, keyDirectObject, typeUTF8Text, NULL, NULL,
+ 0, &size) == noErr && size) {
+ /*
+ * We've had some data sent to us. Evaluate it.
+ */
+
+ char *data = ckalloc(size + 1);
+ theErr = AEGetParamPtr(event, keyDirectObject, typeUTF8Text, NULL, data,
+ size, NULL);
+ if (theErr == noErr) {
+ tclErr = Tcl_EvalEx(interp, data, size, TCL_EVAL_GLOBAL);
+ }
+ } else {
+ /*
+ * Umm, don't recognize what we've got...
+ */
+
+ sprintf(errString, "AEDoScriptHandler: invalid script type '%-4.4s', "
+ "must be 'alis' or coercable to 'utf8'",
+ (char*) &theDesc.descriptorType);
+ AEPutParamPtr(reply, keyErrorString, typeChar, errString,
+ strlen(errString));
+ theErr = -1770;
+ }
+
+ /*
+ * If we actually go to run Tcl code - put the result in the reply.
+ */
+
+ if (tclErr >= 0) {
+ int reslen;
+ const char *result =
+ Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &reslen);
+
+ if (tclErr == TCL_OK) {
+ AEPutParamPtr(reply, keyDirectObject, typeChar, result, reslen);
+ } else {
+ AEPutParamPtr(reply, keyErrorString, typeChar, result, reslen);
+ AEPutParamPtr(reply, keyErrorNumber, typeSInt32, (Ptr) &tclErr,
+ sizeof(int));
+ }
+ }
+
+ AEDisposeDesc(&theDesc);
+ return theErr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ReallyKillMe --
+ *
+ * This proc tries to kill the shell by running exit, called from an
+ * event scheduled by the "Quit" AppleEvent handler.
+ *
+ * Results:
+ * Runs the "exit" command which might kill the shell.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+ReallyKillMe(
+ Tcl_Event *eventPtr,
+ int flags)
+{
+ Tcl_Interp *interp = ((KillEvent *) eventPtr)->interp;
+ Tcl_CmdInfo dummy;
+ int quit = Tcl_GetCommandInfo(interp, "::tk::mac::Quit", &dummy);
+ int code = Tcl_GlobalEval(interp, quit ? "::tk::mac::Quit" : "exit");
+
+ if (code != TCL_OK) {
+ /*
+ * Should be never reached...
+ */
+
+ Tcl_BackgroundException(interp, code);
+ }
+ return 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MissedAnyParameters --
+ *
+ * Checks to see if parameters are still left in the event.
+ *
+ * Results:
+ * True or false.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+MissedAnyParameters(
+ const AppleEvent *theEvent)
+{
+ DescType returnedType;
+ Size actualSize;
+ OSStatus err;
+
+ err = AEGetAttributePtr(theEvent, keyMissedKeywordAttr,
+ typeWildCard, &returnedType, NULL, 0, &actualSize);
+
+ return (err != errAEDescNotFound);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * FSRefToDString --
+ *
+ * Get a POSIX path from an FSRef.
+ *
+ * Results:
+ * In the parameter ds.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static OSStatus
+FSRefToDString(
+ const FSRef *fsref,
+ Tcl_DString *ds)
+{
+ UInt8 fileName[PATH_MAX+1];
+ OSStatus err;
+
+ err = ChkErr(FSRefMakePath, fsref, fileName, sizeof(fileName));
+ if (err == noErr) {
+ Tcl_ExternalToUtfDString(NULL, (char*) fileName, -1, ds);
+ }
+ return err;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/carbon/tkMacOSXInit.c b/carbon/tkMacOSXInit.c
new file mode 100644
index 0000000..7e5803d
--- /dev/null
+++ b/carbon/tkMacOSXInit.c
@@ -0,0 +1,599 @@
+/*
+ * tkMacOSXInit.c --
+ *
+ * This file contains Mac OS X -specific interpreter initialization
+ * functions.
+ *
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2008 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+
+#include <sys/stat.h>
+#include <sys/utsname.h>
+#include <mach-o/dyld.h>
+#include <mach-o/getsect.h>
+
+/*
+ * Define the following to 0 to not attempt to use an undocumented SPI to
+ * notify the window server that an unbundled executable is a full GUI
+ * application after loading Tk.
+ */
+
+#ifndef MAC_OSX_TK_USE_CPS_SPI
+#define MAC_OSX_TK_USE_CPS_SPI 1
+#endif
+
+/*
+ * The following structures are used to map the script/language codes of a
+ * font to the name that should be passed to Tcl_GetEncoding() to obtain the
+ * encoding for that font. The set of numeric constants is fixed and defined
+ * by Apple.
+ */
+
+typedef struct Map {
+ CFStringEncoding numKey;
+ const char *strKey;
+} Map;
+
+static Map scriptMap[] = {
+ {smRoman, "macRoman"},
+ {smJapanese, "macJapan"},
+ {smTradChinese, "macChinese"},
+ {smKorean, "macKorean"},
+ {smArabic, "macArabic"},
+ {smHebrew, "macHebrew"},
+ {smGreek, "macGreek"},
+ {smCyrillic, "macCyrillic"},
+ {smRSymbol, "macRSymbol"},
+ {smDevanagari, "macDevanagari"},
+ {smGurmukhi, "macGurmukhi"},
+ {smGujarati, "macGujarati"},
+ {smOriya, "macOriya"},
+ {smBengali, "macBengali"},
+ {smTamil, "macTamil"},
+ {smTelugu, "macTelugu"},
+ {smKannada, "macKannada"},
+ {smMalayalam, "macMalayalam"},
+ {smSinhalese, "macSinhalese"},
+ {smBurmese, "macBurmese"},
+ {smKhmer, "macKhmer"},
+ {smThai, "macThailand"},
+ {smLaotian, "macLaos"},
+ {smGeorgian, "macGeorgia"},
+ {smArmenian, "macArmenia"},
+ {smSimpChinese, "macSimpChinese"},
+ {smTibetan, "macTIbet"},
+ {smMongolian, "macMongolia"},
+ {smGeez, "macEthiopia"},
+ {smEastEurRoman, "macCentEuro"},
+ {smVietnamese, "macVietnam"},
+ {smExtArabic, "macSindhi"},
+ {0, NULL}
+};
+
+Tcl_Encoding TkMacOSXCarbonEncoding = NULL;
+
+/*
+ * If the App is in an App package, then we want to add the Scripts directory
+ * to the auto_path.
+ */
+
+static char scriptPath[PATH_MAX + 1] = "";
+
+float tkMacOSXToolboxVersionNumber = 0;
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpInit --
+ *
+ * Performs Mac-specific interpreter initialization related to the
+ * tk_library variable.
+ *
+ * Results:
+ * Returns a standard Tcl result. Leaves an error message or result in
+ * the interp's result.
+ *
+ * Side effects:
+ * Sets "tk_library" Tcl variable, runs "tk.tcl" script.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpInit(
+ Tcl_Interp *interp)
+{
+ static char tkLibPath[PATH_MAX + 1];
+ static int initialized = 0;
+
+ Tk_MacOSXSetupTkNotifier();
+
+ /*
+ * Since it is possible for TkInit to be called multiple times and we
+ * don't want to do the following initialization multiple times we protect
+ * against doing it more than once.
+ */
+
+ if (!initialized) {
+ int bundledExecutable = 0;
+ CFBundleRef bundleRef;
+ CFURLRef bundleUrl = NULL;
+ CFStringEncoding encoding;
+ const char *encodingStr = NULL;
+ int i;
+ struct utsname name;
+ long osVersion = 0;
+ struct stat st;
+
+ initialized = 1;
+
+ /*
+ * Initialize/check OS version variable for runtime checks.
+ */
+
+ if (!uname(&name)) {
+ osVersion = strtol(name.release, NULL, 10) - 4;
+ }
+ if (osVersion && osVersion < (MAC_OS_X_VERSION_MIN_REQUIRED-1000)/10) {
+ Tcl_Panic("Mac OS X 10.%d or later required !",
+ (MAC_OS_X_VERSION_MIN_REQUIRED-1000)/10);
+ }
+ TK_IF_MAC_OS_X_API (3, &kHIToolboxVersionNumber,
+ tkMacOSXToolboxVersionNumber = kHIToolboxVersionNumber;
+ ) TK_ELSE_MAC_OS_X (3,
+ if (osVersion > 5) {
+ tkMacOSXToolboxVersionNumber = INFINITY;
+ } else if (osVersion >= 3) {
+ static const float tbVersions[3] = {
+ kHIToolboxVersionNumber10_3,
+ kHIToolboxVersionNumber10_4,
+ kHIToolboxVersionNumber10_5,
+ };
+
+ tkMacOSXToolboxVersionNumber = tbVersions[osVersion-3];
+ }
+ ) TK_ENDIF
+
+ /*
+ * When Tk is in a framework, force tcl_findLibrary to look in the
+ * framework scripts directory.
+ * FIXME: Should we come up with a more generic way of doing this?
+ */
+
+#ifdef TK_FRAMEWORK
+ if (Tcl_MacOSXOpenVersionedBundleResources(interp,
+ "com.tcltk.tklibrary", TK_FRAMEWORK_VERSION, 1, PATH_MAX,
+ tkLibPath) != TCL_OK)
+#endif
+ {
+ /* Tk.framework not found, check if resource file is open */
+ Handle rsrc = Get1NamedResource('CURS', "\phand");
+ if (rsrc) {
+ ReleaseResource(rsrc);
+ } else {
+#ifndef __LP64__
+ const struct mach_header *image;
+ char *data = NULL;
+ uint32_t size;
+ int fd = -1;
+ char fileName[L_tmpnam + 15];
+ uint32_t i, n;
+
+ /* Get resource data from __tk_rsrc section of tk dylib file*/
+ n = _dyld_image_count();
+ for (i = 0; i < n; i++) {
+ image = _dyld_get_image_header(i);
+ if (image) {
+ data = getsectdatafromheader(image, SEG_TEXT,
+ "__tk_rsrc", (void *) &size);
+ if (data) {
+ data += _dyld_get_image_vmaddr_slide(i);
+ break;
+ }
+ }
+ }
+ while (data) {
+ FSRef ref;
+ SInt16 refNum;
+
+ /*
+ * Write resource data to temporary file and open it.
+ */
+
+ strcpy(fileName, P_tmpdir);
+ if (fileName[strlen(fileName) - 1] != '/') {
+ strcat(fileName, "/");
+ }
+ strcat(fileName, "tkMacOSX_XXXXXX");
+ fd = mkstemp(fileName);
+ if (fd == -1) {
+ break;
+ }
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
+ if (write(fd, data, size) == -1) {
+ break;
+ }
+ if(ChkErr(FSPathMakeRef, (unsigned char *) fileName, &ref,
+ NULL) != noErr) {
+ break;
+ }
+ ChkErr(FSOpenResourceFile, &ref, 0, NULL, fsRdPerm,
+ &refNum);
+ break;
+ }
+ if (fd != -1) {
+ unlink(fileName);
+ close(fd);
+ }
+#endif /* __LP64__ */
+ }
+ }
+
+ /*
+ * If we are loaded into an executable that is not a bundled
+ * application, the window server does not let us come to the
+ * foreground. For such an executable, notify the window server that
+ * we are now a full GUI application.
+ */
+
+ /* Check whether we are a bundled executable: */
+ bundleRef = CFBundleGetMainBundle();
+ if (bundleRef) {
+ bundleUrl = CFBundleCopyBundleURL(bundleRef);
+ }
+ if (bundleUrl) {
+ /*
+ * A bundled executable is two levels down from its main bundle
+ * directory (e.g. Wish.app/Contents/MacOS/Wish), whereas an
+ * unbundled executable's main bundle directory is just the
+ * directory containing the executable. So to check whether we are
+ * bundled, we delete the last three path components of the
+ * executable's url and compare the resulting url with the main
+ * bundle url.
+ */
+
+ int j = 3;
+ CFURLRef url = CFBundleCopyExecutableURL(bundleRef);
+
+ while (url && j--) {
+ CFURLRef parent =
+ CFURLCreateCopyDeletingLastPathComponent(NULL, url);
+
+ CFRelease(url);
+ url = parent;
+ }
+ if (url) {
+ bundledExecutable = CFEqual(bundleUrl, url);
+ CFRelease(url);
+ }
+ CFRelease(bundleUrl);
+ }
+
+ /*
+ * If we are not a bundled executable, notify the window server that
+ * we are a foregroundable app.
+ */
+
+ if (!bundledExecutable) {
+ OSStatus err = procNotFound;
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+
+ TK_IF_MAC_OS_X_API (3, TransformProcessType,
+ err = ChkErr(TransformProcessType, &psn,
+ kProcessTransformToForegroundApplication);
+ ) TK_ENDIF
+#if MAC_OSX_TK_USE_CPS_SPI
+ if (err != noErr) {
+ /*
+ * When building or running on 10.2 or when the above fails,
+ * attempt to use undocumented CPS SPI to notify the window
+ * server. Load the SPI symbol dynamically, so that we don't
+ * break if it ever disappears or changes its name.
+ */
+
+ TkMacOSXInitNamedSymbol(CoreGraphics, OSStatus,
+ CPSEnableForegroundOperation, ProcessSerialNumberPtr);
+ if (CPSEnableForegroundOperation) {
+ ChkErr(CPSEnableForegroundOperation, &psn);
+ }
+ }
+#endif /* MAC_OSX_TK_USE_CPS_SPI */
+ }
+
+ TkMacOSXInitAppleEvents(interp);
+ TkMacOSXInitCarbonEvents(interp);
+ TkMacOSXInitMenus(interp);
+ TkMacOSXUseAntialiasedText(interp, -1);
+ TkMacOSXInitCGDrawing(interp, TRUE, 0);
+ TkMacOSXInitKeyboard(interp);
+
+ encoding = CFStringGetSystemEncoding();
+
+ for (i = 0; scriptMap[i].strKey != NULL; i++) {
+ if (scriptMap[i].numKey == encoding) {
+ encodingStr = scriptMap[i].strKey;
+ break;
+ }
+ }
+ if (encodingStr == NULL) {
+ encodingStr = "macRoman";
+ }
+
+ TkMacOSXCarbonEncoding = Tcl_GetEncoding(NULL, encodingStr);
+ if (TkMacOSXCarbonEncoding == NULL) {
+ TkMacOSXCarbonEncoding = Tcl_GetEncoding(NULL, NULL);
+ }
+
+ /*
+ * FIXME: Close stdin & stdout for remote debugging otherwise we will
+ * fight with gdb for stdin & stdout
+ */
+
+ if (getenv("XCNOSTDIN") != NULL) {
+ close(0);
+ close(1);
+ }
+
+ /*
+ * If we don't have a TTY and stdin is a special character file of
+ * length 0, (e.g. /dev/null, which is what Finder sets when double
+ * clicking Wish) then use the Tk based console interpreter.
+ */
+
+ if (getenv("TK_CONSOLE") ||
+ (!isatty(0) && (fstat(0, &st) ||
+ (S_ISCHR(st.st_mode) && st.st_blocks == 0)))) {
+ Tk_InitConsoleChannels(interp);
+ Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN));
+ Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT));
+ Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR));
+
+ /*
+ * Only show the console if we don't have a startup script
+ * and tcl_interactive hasn't been set already.
+ */
+
+ if (Tcl_GetStartupScript(NULL) == NULL) {
+ const char *intvar = Tcl_GetVar(interp,
+ "tcl_interactive", TCL_GLOBAL_ONLY);
+
+ if (intvar == NULL) {
+ Tcl_SetVar(interp, "tcl_interactive", "1",
+ TCL_GLOBAL_ONLY);
+ }
+ }
+ if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ }
+ }
+
+ if (tkLibPath[0] != '\0') {
+ Tcl_SetVar(interp, "tk_library", tkLibPath, TCL_GLOBAL_ONLY);
+ }
+
+ if (scriptPath[0] != '\0') {
+ Tcl_SetVar(interp, "auto_path", scriptPath,
+ TCL_GLOBAL_ONLY|TCL_LIST_ELEMENT|TCL_APPEND_VALUE);
+ }
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetAppName --
+ *
+ * Retrieves the name of the current application from a platform specific
+ * location. For Unix, the application name is the tail of the path
+ * contained in the tcl variable argv0.
+ *
+ * Results:
+ * Returns the application name in the given Tcl_DString.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpGetAppName(
+ Tcl_Interp *interp,
+ Tcl_DString *namePtr) /* A previously initialized Tcl_DString. */
+{
+ const char *p, *name;
+
+ name = Tcl_GetVar(interp, "argv0", TCL_GLOBAL_ONLY);
+ if ((name == NULL) || (*name == 0)) {
+ name = "tk";
+ } else {
+ p = strrchr(name, '/');
+ if (p != NULL) {
+ name = p+1;
+ }
+ }
+ Tcl_DStringAppend(namePtr, name, -1);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDisplayWarning --
+ *
+ * This routines is called from Tk_Main to display warning messages that
+ * occur during startup.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Generates messages on stdout.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDisplayWarning(
+ const char *msg, /* Message to be displayed. */
+ const char *title) /* Title of warning. */
+{
+ Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR);
+
+ if (errChannel) {
+ Tcl_WriteChars(errChannel, title, -1);
+ Tcl_WriteChars(errChannel, ": ", 2);
+ Tcl_WriteChars(errChannel, msg, -1);
+ Tcl_WriteChars(errChannel, "\n", 1);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXDefaultStartupScript --
+ *
+ * On MacOS X, we look for a file in the Resources/Scripts directory
+ * called AppMain.tcl and if found, we set argv[1] to that, so that the
+ * rest of the code will find it, and add the Scripts folder to the
+ * auto_path. If we don't find the startup script, we just bag it,
+ * assuming the user is starting up some other way.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Tcl_SetStartupScript() called when AppMain.tcl found.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE void
+TkMacOSXDefaultStartupScript(void)
+{
+ CFBundleRef bundleRef;
+
+ bundleRef = CFBundleGetMainBundle();
+
+ if (bundleRef != NULL) {
+ CFURLRef appMainURL = CFBundleCopyResourceURL(bundleRef,
+ CFSTR("AppMain"), CFSTR("tcl"), CFSTR("Scripts"));
+
+ if (appMainURL != NULL) {
+ CFURLRef scriptFldrURL;
+ char startupScript[PATH_MAX + 1];
+
+ if (CFURLGetFileSystemRepresentation (appMainURL, true,
+ (unsigned char *) startupScript, PATH_MAX)) {
+ Tcl_SetStartupScript(Tcl_NewStringObj(startupScript,-1), NULL);
+ scriptFldrURL = CFURLCreateCopyDeletingLastPathComponent(NULL,
+ appMainURL);
+ if (scriptFldrURL != NULL) {
+ CFURLGetFileSystemRepresentation(scriptFldrURL, true,
+ (unsigned char *) scriptPath, PATH_MAX);
+ CFRelease(scriptFldrURL);
+ }
+ }
+ CFRelease(appMainURL);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetNamedSymbol --
+ *
+ * Dynamically acquire address of a named symbol from a loaded dynamic
+ * library, so that we can use API that may not be available on all OS
+ * versions. If module is non-NULL and not the empty string, use twolevel
+ * namespace lookup.
+ *
+ * Results:
+ * Address of given symbol or NULL if unavailable.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE void*
+TkMacOSXGetNamedSymbol(
+ const char* module,
+ const char* symbol)
+{
+ NSSymbol nsSymbol = NULL;
+
+ if (module && *module) {
+ if (NSIsSymbolNameDefinedWithHint(symbol, module)) {
+ nsSymbol = NSLookupAndBindSymbolWithHint(symbol, module);
+ }
+ } else {
+ if (NSIsSymbolNameDefined(symbol)) {
+ nsSymbol = NSLookupAndBindSymbol(symbol);
+ }
+ }
+
+ if (!nsSymbol) {
+ return NULL;
+ }
+ return NSAddressOfSymbol(nsSymbol);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetStringObjFromCFString --
+ *
+ * Get a string object from a CFString as efficiently as possible.
+ *
+ * Results:
+ * New string object or NULL if conversion failed.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE Tcl_Obj*
+TkMacOSXGetStringObjFromCFString(
+ CFStringRef str)
+{
+ Tcl_Obj *obj = NULL;
+ const char *c = CFStringGetCStringPtr(str, kCFStringEncodingUTF8);
+
+ if (c) {
+ obj = Tcl_NewStringObj(c, -1);
+ } else {
+ CFRange all = CFRangeMake(0, CFStringGetLength(str));
+ CFIndex len;
+
+ if (CFStringGetBytes(str, all, kCFStringEncodingUTF8, 0, false, NULL,
+ 0, &len) > 0 && len < INT_MAX) {
+ obj = Tcl_NewObj();
+ Tcl_SetObjLength(obj, len);
+ CFStringGetBytes(str, all, kCFStringEncodingUTF8, 0, false,
+ (UInt8*) obj->bytes, len, NULL);
+ }
+ }
+ return obj;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/carbon/tkMacOSXInt.h b/carbon/tkMacOSXInt.h
new file mode 100644
index 0000000..48635c8
--- /dev/null
+++ b/carbon/tkMacOSXInt.h
@@ -0,0 +1,186 @@
+/*
+ * tkMacOSXInt.h --
+ *
+ * Declarations of Macintosh specific shared variables and procedures.
+ *
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#ifndef _TKMACINT
+#define _TKMACINT
+
+#ifndef _TKINT
+#include "tkInt.h"
+#endif
+
+#define TextStyle MacTextStyle
+#include <Carbon/Carbon.h>
+#undef TextStyle
+
+/*
+ * Include platform specific public interfaces.
+ */
+
+#ifndef _TKMAC
+#include "tkMacOSX.h"
+#endif
+
+struct TkWindowPrivate {
+ TkWindow *winPtr; /* Ptr to tk window or NULL if Pixmap */
+ CGrafPtr grafPtr;
+ CGContextRef context;
+ ControlRef rootControl;
+ int xOff; /* X offset from toplevel window */
+ int yOff; /* Y offset from toplevel window */
+ CGSize size;
+ HIShapeRef visRgn; /* Visible region of window */
+ HIShapeRef aboveVisRgn; /* Visible region of window & its children */
+ CGRect drawRect; /* Clipped drawing rect */
+ int referenceCount; /* Don't delete toplevel until children are
+ * gone. */
+ struct TkWindowPrivate *toplevel;
+ /* Pointer to the toplevel datastruct. */
+ int flags; /* Various state see defines below. */
+};
+typedef struct TkWindowPrivate MacDrawable;
+
+/*
+ * This list is used to keep track of toplevel windows that have a Mac
+ * window attached. This is useful for several things, not the least
+ * of which is maintaining floating windows.
+ */
+
+typedef struct TkMacOSXWindowList {
+ struct TkMacOSXWindowList *nextPtr;
+ /* The next window in the list. */
+ TkWindow *winPtr; /* This window */
+} TkMacOSXWindowList;
+
+/*
+ * Defines use for the flags field of the MacDrawable data structure.
+ */
+
+#define TK_SCROLLBAR_GROW 0x01
+#define TK_CLIP_INVALID 0x02
+#define TK_HOST_EXISTS 0x04
+#define TK_DRAWN_UNDER_MENU 0x08
+#define TK_CLIPPED_DRAW 0x10
+#define TK_IS_PIXMAP 0x20
+#define TK_IS_BW_PIXMAP 0x40
+
+/*
+ * I am reserving TK_EMBEDDED = 0x100 in the MacDrawable flags
+ * This is defined in tk.h. We need to duplicate the TK_EMBEDDED flag in the
+ * TkWindow structure for the window, but in the MacWin. This way we can
+ * still tell what the correct port is after the TKWindow structure has been
+ * freed. This actually happens when you bind destroy of a toplevel to
+ * Destroy of a child.
+ */
+
+/*
+ * This structure is for handling Netscape-type in process
+ * embedding where Tk does not control the top-level. It contains
+ * various functions that are needed by Mac specific routines, like
+ * TkMacOSXGetDrawablePort. The definitions of the function types
+ * are in tkMacOSX.h.
+ */
+
+typedef struct {
+ Tk_MacOSXEmbedRegisterWinProc *registerWinProc;
+ Tk_MacOSXEmbedGetGrafPortProc *getPortProc;
+ Tk_MacOSXEmbedMakeContainerExistProc *containerExistProc;
+ Tk_MacOSXEmbedGetClipProc *getClipProc;
+ Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc;
+} TkMacOSXEmbedHandler;
+
+MODULE_SCOPE TkMacOSXEmbedHandler *tkMacOSXEmbedHandler;
+
+/*
+ * Defines for zero-sized GC cache
+ */
+
+typedef struct {} TkpGCCache;
+#define TkpInitGCCache(gc)
+#define TkpFreeGCCache(gc)
+
+/*
+ * Defines used for TkMacOSXInvalidateWindow
+ */
+
+#define TK_WINDOW_ONLY 0
+#define TK_PARENT_WINDOW 1
+
+/*
+ * Accessor for the privatePtr flags field for the TK_HOST_EXISTS field
+ */
+
+#define TkMacOSXHostToplevelExists(tkwin) \
+ (((TkWindow *) (tkwin))->privatePtr->toplevel->flags & TK_HOST_EXISTS)
+
+/*
+ * Defines use for the flags argument to TkGenWMConfigureEvent.
+ */
+
+#define TK_LOCATION_CHANGED 1
+#define TK_SIZE_CHANGED 2
+#define TK_BOTH_CHANGED 3
+
+/*
+ * Defines for tkTextDisp.c
+ */
+
+#define TK_LAYOUT_WITH_BASE_CHUNKS 1
+#define TK_DRAW_IN_CONTEXT 1
+
+#if !TK_DRAW_IN_CONTEXT
+MODULE_SCOPE int TkMacOSXCompareColors(unsigned long c1, unsigned long c2);
+#endif
+
+/*
+ * Globals shared among TkAqua.
+ */
+
+MODULE_SCOPE MenuHandle tkCurrentAppleMenu; /* Handle to current Apple Menu */
+MODULE_SCOPE MenuHandle tkAppleMenu; /* Handle to default Apple Menu */
+MODULE_SCOPE MenuHandle tkFileMenu; /* Handles to menus */
+MODULE_SCOPE MenuHandle tkEditMenu; /* Handles to menus */
+MODULE_SCOPE int tkPictureIsOpen; /* If this is 1, we are drawing to a
+ * picture The clipping should then be
+ * done relative to the bounds of the
+ * picture rather than the window. As
+ * of OS X.0.4, something is seriously
+ * wrong: The clipping bounds only
+ * seem to work if the top,left values
+ * are 0,0 The destination rectangle
+ * for CopyBits should also have
+ * top,left values of 0,0
+ */
+MODULE_SCOPE TkMacOSXWindowList *tkMacOSXWindowListPtr; /* List of toplevels */
+MODULE_SCOPE Tcl_Encoding TkMacOSXCarbonEncoding;
+
+/*
+ * Prototypes of internal procs not in the stubs table.
+ */
+
+MODULE_SCOPE void TkMacOSXDefaultStartupScript(void);
+#if 0
+MODULE_SCOPE int XSetClipRectangles(Display *d, GC gc, int clip_x_origin,
+ int clip_y_origin, XRectangle* rectangles, int n, int ordering);
+#endif
+MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x,
+ int y, int width, int height);
+MODULE_SCOPE void TkpRetainRegion(TkRegion r);
+MODULE_SCOPE void TkpReleaseRegion(TkRegion r);
+
+/*
+ * Include the stubbed internal platform-specific API.
+ */
+
+#include "tkIntPlatDecls.h"
+
+#endif /* _TKMACINT */
diff --git a/carbon/tkMacOSXKeyEvent.c b/carbon/tkMacOSXKeyEvent.c
new file mode 100644
index 0000000..d801f68
--- /dev/null
+++ b/carbon/tkMacOSXKeyEvent.c
@@ -0,0 +1,1168 @@
+/*
+ * tkMacOSXKeyEvent.c --
+ *
+ * This file implements functions that decode & handle keyboard events on
+ * MacOS X.
+ *
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * The following terms apply to all files originating from Apple Computer,
+ * Inc. ("Apple") and associated with the software unless explicitly
+ * disclaimed in individual files.
+ *
+ * Apple hereby grants permission to use, copy, modify, distribute, and
+ * license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that
+ * this notice is included verbatim in any distributions. No written
+ * agreement, license, or royalty fee is required for any of the
+ * authorized uses. Modifications to this software may be copyrighted by
+ * their authors and need not follow the licensing terms described here,
+ * provided that the new terms are clearly indicated on the first page of
+ * each file where they apply.
+ *
+ * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE SOFTWARE BE
+ * LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
+ * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS
+ * DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF APPLE OR THE AUTHORS
+ * HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. APPLE, THE AUTHORS
+ * AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
+ * A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED
+ * ON AN "AS IS" BASIS, AND APPLE,THE AUTHORS AND DISTRIBUTORS HAVE NO
+ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+ * MODIFICATIONS.
+ *
+ * GOVERNMENT USE: If you are acquiring this software on behalf of the
+ * U.S. government, the Government shall have only "Restricted Rights" in
+ * the software and related documentation as defined in the Federal
+ * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you are
+ * acquiring the software on behalf of the Department of Defense, the
+ * software shall be classified as "Commercial Computer Software" and the
+ * 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.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkMacOSXEvent.h"
+
+/*
+#ifdef TK_MAC_DEBUG
+#define TK_MAC_DEBUG_KEYBOARD
+#endif
+*/
+
+typedef struct {
+ WindowRef whichWindow;
+ int global_x, global_y;
+ int local_x, local_y;
+ unsigned int state;
+ UInt32 keyCode;
+ UInt32 keyModifiers;
+ UInt32 message;
+ unsigned char ch;
+} KeyEventData;
+
+static Tk_Window grabWinPtr = NULL;
+ /* Current grab window, NULL if no grab. */
+static Tk_Window keyboardGrabWinPtr = NULL;
+ /* Current keyboard grab window. */
+static UInt32 deadKeyStateUp = 0;
+ /* The deadkey state for the current sequence
+ * of keyup events or 0 if not in a deadkey
+ * sequence */
+static UInt32 deadKeyStateDown = 0;
+ /* Ditto for keydown */
+
+/*
+ * Declarations for functions used only in this file.
+ */
+
+static int GenerateKeyEvent(UInt32 eKind, KeyEventData *e,
+ UInt32 savedKeyCode, UInt32 savedModifiers,
+ const UniChar *chars, int numChars);
+static TextEncoding GetKCHREncoding(ScriptCode script, SInt32 layoutid);
+static int GetKeyboardLayout(Ptr *resourcePtr,
+ TextEncoding *encodingPtr);
+static int InitKeyData(KeyEventData *keyEventDataPtr);
+static int InitKeyEvent(XEvent *eventPtr, KeyEventData *e,
+ UInt32 savedKeyCode, UInt32 savedModifiers);
+static int KeycodeToUnicodeViaKCHRResource(UniChar *uniChars,
+ int maxChars, Ptr kchr, TextEncoding encoding,
+ EventKind eKind, UInt32 keycode, UInt32 modifiers,
+ UInt32 *deadKeyStatePtr);
+static int KeycodeToUnicodeViaUnicodeResource(UniChar *uniChars,
+ int maxChars, Ptr uchr, EventKind eKind,
+ UInt32 keycode, UInt32 modifiers,
+ UInt32 *deadKeyStatePtr);
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXProcessKeyboardEvent --
+ *
+ * This routine processes the event in eventPtr, and generates the
+ * appropriate Tk events from it.
+ *
+ * Results:
+ * True if event(s) are generated - false otherwise.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkMacOSXProcessKeyboardEvent(
+ TkMacOSXEvent *eventPtr,
+ MacEventStatus *statusPtr)
+{
+ static UInt32 savedKeyCode = 0;
+ static UInt32 savedModifiers = 0;
+ static UniChar savedChar = 0;
+ OSStatus err;
+ KeyEventData keyEventData;
+ MenuRef menuRef;
+ MenuItemIndex menuItemIndex;
+ int eventGenerated;
+ UniChar uniChars[5]; /* make this larger, if needed */
+ UInt32 uniCharsLen = 0;
+
+ if (!InitKeyData(&keyEventData)) {
+ statusPtr->err = 1;
+ return false;
+ }
+
+ /*
+ * Because of the way that Tk operates, we can't in general funnel menu
+ * accelerators through IsMenuKeyEvent. Tk treats accelerators as mere
+ * decoration, and the user has to install bindings to get them to fire.
+ *
+ * However, the only way to trigger the Hide & Hide Others functions is by
+ * invoking the Menu command for Hide. So there is no nice way to provide a
+ * Tk command to hide the app which would be available for a binding. So I
+ * am going to hijack Command-H and Command-Shift-H here, and run the menu
+ * commands. Since the HI Guidelines explicitly reserve these for Hide,
+ * this isn't such a bad thing. Also, if you do rebind Command-H to another
+ * menu item, Hide will lose its binding.
+ *
+ * Note that I don't really do anything at this point, I just mark
+ * stopProcessing as 0 and return, and then the RecieveAndProcessEvent code
+ * will dispatch the event to the default handler.
+ */
+
+ if ((eventPtr->eKind == kEventRawKeyDown
+ || eventPtr->eKind == kEventRawKeyRepeat)
+ && IsMenuKeyEvent(tkCurrentAppleMenu, eventPtr->eventRef,
+ kMenuEventQueryOnly, &menuRef, &menuItemIndex)) {
+ MenuCommand menuCmd;
+
+ GetMenuItemCommandID (menuRef, menuItemIndex, &menuCmd);
+ switch (menuCmd) {
+ case kHICommandHide:
+ case kHICommandHideOthers:
+ case kHICommandShowAll:
+ case kHICommandPreferences:
+ case kHICommandQuit:
+ statusPtr->stopProcessing = 0;
+
+ /*
+ * TODO: may not be on event on queue.
+ */
+
+ return 0;
+ default:
+ break;
+ }
+ }
+
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamKeyMacCharCodes, typeChar, NULL,
+ sizeof(keyEventData.ch), NULL, &keyEventData.ch);
+ if (err != noErr) {
+ statusPtr->err = 1;
+ return false;
+ }
+ err = ChkErr(GetEventParameter, eventPtr->eventRef, kEventParamKeyCode,
+ typeUInt32, NULL, sizeof(keyEventData.keyCode), NULL,
+ &keyEventData.keyCode);
+ if (err != noErr) {
+ statusPtr->err = 1;
+ return false;
+ }
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamKeyModifiers, typeUInt32, NULL,
+ sizeof(keyEventData.keyModifiers), NULL,
+ &keyEventData.keyModifiers);
+ if (err != noErr) {
+ statusPtr->err = 1;
+ return false;
+ }
+
+ switch (eventPtr->eKind) {
+ case kEventRawKeyUp:
+ case kEventRawKeyDown:
+ case kEventRawKeyRepeat: {
+ UInt32 *deadKeyStatePtr;
+
+ if (kEventRawKeyDown == eventPtr->eKind) {
+ deadKeyStatePtr = &deadKeyStateDown;
+ } else {
+ deadKeyStatePtr = &deadKeyStateUp;
+ }
+
+ uniCharsLen = TkMacOSXKeycodeToUnicode(uniChars,
+ sizeof(uniChars)/sizeof(*uniChars), eventPtr->eKind,
+ keyEventData.keyCode, keyEventData.keyModifiers,
+ deadKeyStatePtr);
+ break;
+ }
+ }
+
+ if (kEventRawKeyUp == eventPtr->eKind) {
+ /*
+ * For some reason the deadkey processing for KeyUp doesn't work
+ * sometimes, so we fudge and use the last detected KeyDown.
+ */
+
+ if ((0 == uniCharsLen) && (0 != savedChar)) {
+ uniChars[0] = savedChar;
+ uniCharsLen = 1;
+ }
+
+ /*
+ * Suppress keyup events while we have a deadkey sequence on keydown.
+ * We still *do* want to collect deadkey state in this situation if
+ * the system provides it, that's why we do this only after
+ * TkMacOSXKeycodeToUnicode().
+ */
+
+ if (0 != deadKeyStateDown) {
+ uniCharsLen = 0;
+ }
+ }
+
+ keyEventData.message = keyEventData.ch|(keyEventData.keyCode << 8);
+
+ eventGenerated = GenerateKeyEvent(eventPtr->eKind, &keyEventData,
+ savedKeyCode, savedModifiers, uniChars, uniCharsLen);
+
+ savedModifiers = keyEventData.keyModifiers;
+
+ if ((kEventRawKeyDown == eventPtr->eKind) && (uniCharsLen > 0)) {
+ savedChar = uniChars[0];
+ } else {
+ savedChar = 0;
+ }
+
+ statusPtr->stopProcessing = 1;
+
+ if (eventGenerated == 0) {
+ savedKeyCode = keyEventData.message;
+ return false;
+ }
+ if (eventGenerated == -1) {
+ savedKeyCode = 0;
+ statusPtr->stopProcessing = 0;
+ return false;
+ }
+ savedKeyCode = 0;
+ return true;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GenerateKeyEvent --
+ *
+ * Given Macintosh keyUp, keyDown & autoKey events (in their "raw" form)
+ * and a list of unicode characters this function generates the
+ * appropriate X key events.
+ *
+ * Parameter eKind is a raw keyboard event. e contains the data sent with
+ * the event. savedKeyCode and savedModifiers contain the values from the
+ * last event that came before (see TkMacOSXProcessKeyboardEvent()).
+ * chars/numChars has the Unicode characters for which we want to create
+ * events.
+ *
+ * Results:
+ * 1 if an event was generated, -1 for any error.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GenerateKeyEvent(
+ UInt32 eKind,
+ KeyEventData * e,
+ UInt32 savedKeyCode,
+ UInt32 savedModifiers,
+ const UniChar * chars,
+ int numChars)
+{
+ XEvent event;
+ int i;
+
+ if (-1 == InitKeyEvent(&event, e, savedKeyCode, savedModifiers)) {
+ return -1;
+ }
+
+ if (kEventRawKeyModifiersChanged == eKind) {
+ if (savedModifiers > e->keyModifiers) {
+ event.xany.type = KeyRelease;
+ } else {
+ event.xany.type = KeyPress;
+ }
+
+ /*
+ * Use special '-1' to signify a special keycode to our platform
+ * specific code in tkMacOSXKeyboard.c. This is rather like what
+ * happens on Windows.
+ */
+
+ event.xany.send_event = -1;
+
+ /*
+ * Set keycode (which was zero) to the changed modifier
+ */
+
+ event.xkey.keycode = (e->keyModifiers ^ savedModifiers);
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ } else {
+ for (i = 0; i < numChars; ++i) {
+ /*
+ * Encode one char in the trans_chars array that was already
+ * introduced for MS Windows. Don't encode the string, if it is a
+ * control character but was not generated with a real control
+ * modifier. Such control characters get generated by KeyTrans()
+ * for special keys, but we rather want to identify those by their
+ * KeySyms.
+ */
+
+ event.xkey.trans_chars[0] = 0;
+ if ((controlKey & e->keyModifiers) || (chars[i] >= ' ')) {
+ int done = Tcl_UniCharToUtf(chars[i],event.xkey.trans_chars);
+
+ event.xkey.trans_chars[done] = 0;
+ }
+
+ switch(eKind) {
+ case kEventRawKeyDown:
+ event.xany.type = KeyPress;
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ break;
+ case kEventRawKeyUp:
+ event.xany.type = KeyRelease;
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ break;
+ case kEventRawKeyRepeat:
+ event.xany.type = KeyRelease;
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ event.xany.type = KeyPress;
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ break;
+ default:
+ TkMacOSXDbgMsg("Invalid parameter eKind %ld", eKind);
+ return -1;
+ }
+ }
+ }
+
+ return 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * InitKeyData --
+ *
+ * This routine initializes a KeyEventData structure by asking the OS and
+ * Tk for all the global information needed here.
+ *
+ * Results:
+ * True if the current front window can be found in Tk data structures,
+ * false otherwise.
+ *
+ * Side Effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+InitKeyData(
+ KeyEventData *keyEventDataPtr)
+{
+ memset(keyEventDataPtr, 0, sizeof(*keyEventDataPtr));
+
+ keyEventDataPtr->whichWindow = ActiveNonFloatingWindow();
+ if (keyEventDataPtr->whichWindow == NULL) {
+ return false;
+ }
+
+ XQueryPointer(NULL, None, NULL, NULL, &keyEventDataPtr->global_x,
+ &keyEventDataPtr->global_y, &keyEventDataPtr->local_x,
+ &keyEventDataPtr->local_y, &keyEventDataPtr->state);
+ return true;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * InitKeyEvent --
+ *
+ * Initialize an XEvent structure by asking Tk for global information.
+ * Also uses a KeyEventData structure and other current state.
+ *
+ * Results:
+ * 1 on success, -1 for any error.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+/*
+ * We have a general problem here. How do we handle 'Option-char' keypresses?
+ * The problem is that we might want to bind to some of these (e.g. Cmd-Opt-d
+ * is 'uncomment' in Alpha). OTOH Option-d actually produces a real character
+ * on MacOS, namely a mathematical delta.
+ *
+ * The current behaviour is that a binding goes by the combinations of
+ * modifiers and base keysym, that is Option-d. The string value of the event
+ * is the mathematical delta character, so if no binding calls [break], the
+ * text widget will insert that character.
+ *
+ * Note that this is similar to control combinations on all platforms. They
+ * also generate events that have the base character as keysym and a real
+ * control character as character value. So Ctrl+C gets us the keysym XK_C, the
+ * modifier Control (so you can bind <Control-C>) and a string value as
+ * "\u0003".
+ *
+ * For a different solutions we may want for the event to contain keysyms for
+ * *both* the 'Opt-d' side of things and the mathematical delta. Then a binding
+ * on Opt-d will trigger, but a binding on mathematical delta would also
+ * trigger. This would require changes in the core, though.
+ */
+
+static int
+InitKeyEvent(
+ XEvent * eventPtr,
+ KeyEventData * e,
+ UInt32 savedKeyCode,
+ UInt32 savedModifiers)
+{
+ Window window;
+ Tk_Window tkwin;
+ TkDisplay *dispPtr;
+
+ /*
+ * The focus must be in the FrontWindow on the Macintosh. We then query Tk
+ * to determine the exact Tk window that owns the focus.
+ */
+
+ window = TkMacOSXGetXWindow(e->whichWindow);
+ dispPtr = TkGetDisplayList();
+ tkwin = Tk_IdToWindow(dispPtr->display, window);
+
+ if (!tkwin) {
+ TkMacOSXDbgMsg("tkwin == NULL");
+ return -1;
+ }
+
+ tkwin = (Tk_Window) ((TkWindow *) tkwin)->dispPtr->focusPtr;
+ if (!tkwin) {
+ TkMacOSXDbgMsg("tkwin == NULL");
+ return -1;
+ }
+
+ memset(eventPtr, 0, sizeof(XEvent));
+ eventPtr->xany.send_event = false;
+ eventPtr->xany.serial = Tk_Display(tkwin)->request;
+
+ eventPtr->xkey.same_screen = true;
+ eventPtr->xkey.subwindow = None;
+ eventPtr->xkey.time = TkpGetMS();
+ eventPtr->xkey.x_root = e->global_x;
+ eventPtr->xkey.y_root = e->global_y;
+ eventPtr->xkey.window = Tk_WindowId(tkwin);
+ eventPtr->xkey.display = Tk_Display(tkwin);
+ eventPtr->xkey.root = XRootWindow(Tk_Display(tkwin), 0);
+ eventPtr->xkey.state = e->state;
+ eventPtr->xkey.trans_chars[0] = 0;
+
+ Tk_TopCoordsToWindow(tkwin, e->local_x, e->local_y, &eventPtr->xkey.x,
+ &eventPtr->xkey.y);
+
+ eventPtr->xkey.keycode = e->ch | ((savedKeyCode & charCodeMask) << 8) |
+ ((e->message&keyCodeMask) << 8);
+ return 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetKeyboardLayout --
+ *
+ * Queries the OS for a pointer to a keyboard resource.
+ *
+ * This function works with the keyboard layout switch menu. It uses
+ * Keyboard Layout Services, where available.
+ *
+ * Results:
+ * 1 if there is returned a Unicode 'uchr' resource in *resourcePtr, 0 if
+ * it is a classic 'KCHR' resource. A pointer to the actual resource data
+ * goes into *resourcePtr. If the resource is a 'KCHR' resource, the
+ * corresponding Mac encoding goes into *encodingPtr.
+ *
+ * Side effects:
+ * Sets some internal static variables.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GetKeyboardLayout(
+ Ptr *resourcePtr,
+ TextEncoding *encodingPtr)
+{
+ static KeyboardLayoutRef lastLayout = NULL;
+ static SInt32 lastLayoutId;
+ static TextEncoding lastEncoding = kTextEncodingMacRoman;
+ static Ptr uchr = NULL;
+ static Ptr KCHR = NULL;
+ int hasLayoutChanged = false;
+ KeyboardLayoutRef currentLayout = NULL;
+ SInt32 currentLayoutId = 0;
+ ScriptCode currentKeyScript;
+
+ currentKeyScript = GetScriptManagerVariable(smKeyScript);
+
+ /*
+ * Use the Keyboard Layout Services.
+ */
+
+ KLGetCurrentKeyboardLayout(&currentLayout);
+
+ if (currentLayout != NULL) {
+ /*
+ * The layout pointer could in theory be the same for different
+ * layouts, only the id gives us the information that the
+ * keyboard has actually changed. OTOH the layout object can
+ * also change and it could still be the same layoutid.
+ */
+
+ KLGetKeyboardLayoutProperty(currentLayout, kKLIdentifier,
+ (const void **) &currentLayoutId);
+
+ if ((lastLayout != currentLayout)
+ || (lastLayoutId != currentLayoutId)) {
+#ifdef TK_MAC_DEBUG_KEYBOARD
+ TkMacOSXDbgMsg("Use KLS");
+#endif
+ hasLayoutChanged = true;
+
+ /*
+ * Reinitialize all relevant variables.
+ */
+
+ lastLayout = currentLayout;
+ lastLayoutId = currentLayoutId;
+ uchr = NULL;
+ KCHR = NULL;
+
+ if ((KLGetKeyboardLayoutProperty(currentLayout,
+ kKLuchrData, (const void **) &uchr) == noErr)
+ && (uchr != NULL)) {
+ /* done */
+ } else if ((KLGetKeyboardLayoutProperty(currentLayout,
+ kKLKCHRData, (const void**)&KCHR) == noErr)
+ && (KCHR != NULL)) {
+ /* done */
+ }
+ }
+ }
+
+ if (hasLayoutChanged) {
+#ifdef TK_MAC_DEBUG_KEYBOARD
+ if (KCHR) {
+ TkMacOSXDbgMsg("New 'KCHR' layout %ld", currentLayoutId);
+ } else if (uchr) {
+ TkMacOSXDbgMsg("New 'uchr' layout %ld", currentLayoutId);
+ } else {
+ TkMacOSXDbgMsg("Use cached layout (should have been %ld)",
+ currentLayoutId);
+ }
+#endif
+
+ deadKeyStateUp = deadKeyStateDown = 0;
+
+ /*
+ * If we did get a new 'KCHR', compute its encoding and put it into
+ * lastEncoding.
+ *
+ * If we didn't get a new 'KCHR' and if we have no 'uchr' either, get
+ * some 'KCHR' from the OS cache and leave lastEncoding at its current
+ * value. This should better not happen, it doesn't really work.
+ */
+
+ if (KCHR) {
+ lastEncoding = GetKCHREncoding(currentKeyScript, currentLayoutId);
+#ifdef TK_MAC_DEBUG_KEYBOARD
+ TkMacOSXDbgMsg("New 'KCHR' encoding %lu (%lu + 0x%lX)",
+ lastEncoding, lastEncoding & 0xFFFFL,
+ lastEncoding & ~0xFFFFL);
+#endif
+ } else if (!uchr) {
+ KCHR = (Ptr)(intptr_t) GetScriptManagerVariable(smKCHRCache);
+ }
+ }
+
+ if (uchr) {
+ *resourcePtr = uchr;
+ return 1;
+ }
+ *resourcePtr = KCHR;
+ *encodingPtr = lastEncoding;
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetKCHREncoding --
+ *
+ * Upgrade a WorldScript code to a TEC encoding based on the keyboard
+ * layout id.
+ *
+ * Results:
+ * The TEC code that corresponds best to the combination of WorldScript
+ * code and 'KCHR' id.
+ *
+ * Side effects:
+ * None.
+ *
+ * Rationale and Notes:
+ * WorldScript codes are sometimes not unique encodings. E.g. Icelandic
+ * uses script smRoman (0), but the actual encoding is
+ * kTextEncodingMacIcelandic (37). ftp://ftp.unicode.org/Public
+ * /MAPPINGS/VENDORS/APPLE/README.TXT has a good summary of these
+ * variants. So we need to upgrade the script to an encoding with
+ * GetTextEncodingFromScriptInfo().
+ *
+ * 'KCHR' ids are usually region codes (see the comments in Script.h).
+ * Where they are not, we get a paramErr from the OS function and have
+ * appropriate fallbacks.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static TextEncoding
+GetKCHREncoding(
+ ScriptCode script,
+ SInt32 layoutid)
+{
+ RegionCode region = layoutid;
+ TextEncoding encoding = script;
+
+ if (GetTextEncodingFromScriptInfo(script, kTextLanguageDontCare, region,
+ &encoding) == noErr) {
+ return encoding;
+ }
+
+ /*
+ * GetTextEncodingFromScriptInfo() doesn't know about more exotic layouts.
+ * This provides a fallback for good measure. In an ideal world, exotic
+ * layouts would always provide a 'uchr' resource anyway, so we wouldn't
+ * need this.
+ *
+ * We can add more keyboard layouts, if we get actual complaints. Farsi or
+ * other Celtic/Gaelic layouts would be candidates.
+ */
+
+ switch (layoutid) {
+ /*
+ * Icelandic and Faroese (planned). These layouts are sold by Apple
+ * Iceland for legacy applications.
+ */
+
+ case 1800: case 1821:
+ return kTextEncodingMacIcelandic;
+
+ /*
+ * Irish and Welsh. These layouts are mentioned in <Script.h>.
+ *
+ * FIXME: This may have to be kTextEncodingMacGaelic instead, but I
+ * can't locate layouts of this type for testing.
+ */
+
+ case 581: case 779:
+ return kTextEncodingMacCeltic;
+ }
+
+ /*
+ * The valid script codes are also the valid default encoding codes, so if
+ * nothing else helps, fall back on those.
+ */
+
+ return script;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * KeycodeToUnicodeViaUnicodeResource --
+ *
+ * Given MacOS key event data this function generates the Unicode
+ * characters. It does this using a 'uchr' and the UCKeyTranslate API.
+ *
+ * The parameter deadKeyStatePtr can be NULL, if no deadkey handling is
+ * needed.
+ *
+ * Tested and known to work with US, Hebrew, Greek and Russian layouts as
+ * well as "Unicode Hex Input".
+ *
+ * Results:
+ * The number of characters generated if any, 0 if we are waiting for
+ * another byte of a dead-key sequence. Fills in the uniChars array with a
+ * Unicode string.
+ *
+ * Side Effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+KeycodeToUnicodeViaUnicodeResource(
+ UniChar *uniChars,
+ int maxChars,
+ Ptr uchr,
+ EventKind eKind,
+ UInt32 keycode,
+ UInt32 modifiers,
+ UInt32 *deadKeyStatePtr)
+{
+ int action;
+ unsigned long keyboardType;
+ OptionBits options = 0;
+ UInt32 dummy_state;
+ UniCharCount actuallength;
+ OSStatus err;
+
+ keycode &= 0xFF;
+ modifiers = (modifiers >> 8) & 0xFF;
+ keyboardType = LMGetKbdType();
+
+ if (NULL==deadKeyStatePtr) {
+ options = kUCKeyTranslateNoDeadKeysMask;
+ dummy_state = 0;
+ deadKeyStatePtr = &dummy_state;
+ }
+
+ switch(eKind) {
+ case kEventRawKeyDown:
+ action = kUCKeyActionDown;
+ break;
+ case kEventRawKeyUp:
+ action = kUCKeyActionUp;
+ break;
+ case kEventRawKeyRepeat:
+ action = kUCKeyActionAutoKey;
+ break;
+ default:
+ TkMacOSXDbgMsg("Invalid parameter eKind %d", eKind);
+ return 0;
+ }
+
+ err = ChkErr(UCKeyTranslate, (const UCKeyboardLayout *) uchr, keycode,
+ action, modifiers, keyboardType, options, deadKeyStatePtr,
+ maxChars, &actuallength, uniChars);
+
+ if ((0 == actuallength) && (0 != *deadKeyStatePtr)) {
+ /*
+ * More data later
+ */
+
+ return 0;
+ }
+
+ /*
+ * Some IMEs leave residue. :-(
+ */
+
+ *deadKeyStatePtr = 0;
+
+ if (err != noErr) {
+ actuallength = 0;
+ }
+
+ return actuallength;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * KeycodeToUnicodeViaKCHRResource --
+ *
+ * Given MacOS key event data this function generates the Unicode
+ * characters. It does this using a 'KCHR' and the KeyTranslate API.
+ *
+ * The parameter deadKeyStatePtr can be NULL, if no deadkey handling is
+ * needed.
+ *
+ * Results:
+ * The number of characters generated if any, 0 if we are waiting for
+ * another byte of a dead-key sequence. Fills in the uniChars array with a
+ * Unicode string.
+ *
+ * Side Effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+KeycodeToUnicodeViaKCHRResource(
+ UniChar *uniChars,
+ int maxChars,
+ Ptr kchr,
+ TextEncoding encoding,
+ EventKind eKind,
+ UInt32 keycode,
+ UInt32 modifiers,
+ UInt32 *deadKeyStatePtr)
+{
+ UInt32 result;
+ char macBuff[3];
+ char *macStr;
+ int macStrLen, uniStrLen;
+ UInt32 dummy_state = 0;
+ CFStringRef cfString;
+
+ if (NULL == deadKeyStatePtr) {
+ deadKeyStatePtr = &dummy_state;
+ }
+
+ keycode |= modifiers;
+ result = KeyTranslate(kchr, keycode, deadKeyStatePtr);
+
+ if ((0 == result) && (0 != dummy_state)) {
+ /*
+ * 'dummy_state' gets only filled if the caller did not want deadkey
+ * processing (deadKeyStatePtr was NULL originally), but we still have
+ * a deadkey. We just push the keycode for the space bar to get the
+ * real key value.
+ */
+
+ result = KeyTranslate(kchr, 0x31, deadKeyStatePtr);
+ *deadKeyStatePtr = 0;
+ }
+
+ if ((0 == result) && (0 != *deadKeyStatePtr)) {
+ /*
+ * More data later
+ */
+
+ return 0;
+ }
+
+ macBuff[0] = (char) (result >> 16);
+ macBuff[1] = (char) result;
+ macBuff[2] = 0;
+
+ if (0 != macBuff[0]) {
+ /*
+ * If the first byte is valid, the second is too.
+ */
+
+ macStr = macBuff;
+ macStrLen = 2;
+ } else if (0 != macBuff[1]) {
+ /*
+ * Only the second is valid.
+ */
+
+ macStr = macBuff+1;
+ macStrLen = 1;
+ } else {
+ /*
+ * No valid bytes at all -- shouldn't happen.
+ */
+
+ macStr = NULL;
+ macStrLen = 0;
+ }
+
+ if (macStrLen <= 0) {
+ return 0;
+ }
+
+ /*
+ * Use the CFString conversion routines. This is the easiest and most
+ * compatible way to get from an 8-bit string and a MacOS script code to a
+ * Unicode string.
+ *
+ * FIXME: The system ships with an Irish 'KCHR' but without the
+ * corresponding macCeltic encoding, which triggers the error below. Tcl
+ * doesn't have the macCeltic encoding either right now, so until we get
+ * that, we can just as well stick to this code. The right fix would be to
+ * use the Tcl encodings and add macCeltic and probably others
+ * there. Suitable Unicode data files for the missing encodings are
+ * available from www.evertype.com.
+ */
+
+ cfString = CFStringCreateWithCStringNoCopy(NULL, macStr, encoding,
+ kCFAllocatorNull);
+ if (cfString == NULL) {
+ TkMacOSXDbgMsg("CFString: Can't convert with encoding %ld", encoding);
+ return 0;
+ }
+
+ uniStrLen = CFStringGetLength(cfString);
+ if (uniStrLen > maxChars) {
+ uniStrLen = maxChars;
+ }
+ CFStringGetCharacters(cfString, CFRangeMake(0,uniStrLen), uniChars);
+ CFRelease(cfString);
+
+ return uniStrLen;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXKeycodeToUnicode --
+ *
+ * Given MacOS key event data this function generates the Unicode
+ * characters. It does this using OS resources and APIs.
+ *
+ * The parameter deadKeyStatePtr can be NULL, if no deadkey handling is
+ * needed.
+ *
+ * This function is called from XKeycodeToKeysym() in tkMacOSKeyboard.c.
+ *
+ * Results:
+ * The number of characters generated if any, 0 if we are waiting for
+ * another byte of a dead-key sequence. Fills in the uniChars array with a
+ * Unicode string.
+ *
+ * Side Effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkMacOSXKeycodeToUnicode(
+ UniChar *uniChars,
+ int maxChars,
+ EventKind eKind,
+ UInt32 keycode,
+ UInt32 modifiers,
+ UInt32 *deadKeyStatePtr)
+{
+ Ptr resource = NULL;
+ TextEncoding encoding;
+
+ if (GetKeyboardLayout(&resource, &encoding)) {
+ return KeycodeToUnicodeViaUnicodeResource(uniChars, maxChars,
+ resource, eKind, keycode, modifiers, deadKeyStatePtr);
+ } else {
+ return KeycodeToUnicodeViaKCHRResource(uniChars, maxChars, resource,
+ encoding, eKind, keycode, modifiers, deadKeyStatePtr);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XGrabKeyboard --
+ *
+ * Simulates a keyboard grab by setting the focus.
+ *
+ * Results:
+ * Always returns GrabSuccess.
+ *
+ * Side effects:
+ * Sets the keyboard focus to the specified window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+XGrabKeyboard(
+ Display* display,
+ Window grab_window,
+ Bool owner_events,
+ int pointer_mode,
+ int keyboard_mode,
+ Time time)
+{
+ keyboardGrabWinPtr = Tk_IdToWindow(display, grab_window);
+
+ return GrabSuccess;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XUngrabKeyboard --
+ *
+ * Releases the simulated keyboard grab.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Sets the keyboard focus back to the value before the grab.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XUngrabKeyboard(
+ Display* display,
+ Time time)
+{
+ keyboardGrabWinPtr = NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetCapture --
+ *
+ * Results:
+ * Returns the current grab window
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Tk_Window
+TkMacOSXGetCapture(void)
+{
+ return grabWinPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpSetCapture --
+ *
+ * This function captures the mouse so that all future events will be
+ * reported to this window, even if the mouse is outside the window. If
+ * the specified window is NULL, then the mouse is released.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Sets the capture flag and captures the mouse.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpSetCapture(
+ TkWindow *winPtr) /* Capture window, or NULL. */
+{
+ while (winPtr && !Tk_IsTopLevel(winPtr)) {
+ winPtr = winPtr->parentPtr;
+ }
+#if 0
+ {
+ TkWindow *w = NULL;
+ WindowModality m;
+
+ if (winPtr) {
+ w = winPtr;
+ m = kWindowModalityAppModal;
+ } else if (grabWinPtr) {
+ w = (TkWindow *) grabWinPtr;
+ m = kWindowModalityNone;
+ }
+
+ if (w && w->window != None && TkMacOSXHostToplevelExists(w)) {
+ ChkErr(SetWindowModality, TkMacOSXDrawableWindow(w->window), m,
+ NULL);
+ }
+ }
+#endif
+ grabWinPtr = (Tk_Window) winPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_SetCaretPos --
+ *
+ * This enables correct placement of the XIM caret. This is called by
+ * widgets to indicate their cursor placement, and the caret location is
+ * used by TkpGetString to place the XIM caret.
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_SetCaretPos(
+ Tk_Window tkwin,
+ int x,
+ int y,
+ int height)
+{
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXInitKeyboard --
+ *
+ * This procedure initializes the keyboard layout.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE void
+TkMacOSXInitKeyboard(
+ Tcl_Interp *interp)
+{
+ Ptr resource;
+ TextEncoding encoding;
+
+ GetKeyboardLayout(&resource, &encoding);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/carbon/tkMacOSXKeyboard.c b/carbon/tkMacOSXKeyboard.c
new file mode 100644
index 0000000..4e35db6
--- /dev/null
+++ b/carbon/tkMacOSXKeyboard.c
@@ -0,0 +1,840 @@
+/*
+ * tkMacOSXKeyboard.c --
+ *
+ * Routines to support keyboard events on the Macintosh.
+ *
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXInt.h"
+#include "tkMacOSXEvent.h" /* for TkMacOSXKeycodeToUnicode()
+ * FIXME: That function should probably move
+ * here. */
+
+/*
+ * A couple of simple definitions to make code a bit more self-explaining.
+ *
+ * For the assignments of Mod1==meta==command and Mod2==alt==option, see also
+ * tkMacOSXMouseEvent.c.
+ */
+
+#define LATIN1_MAX 255
+#define MAC_KEYCODE_MAX 0x7F
+#define MAC_KEYCODE_MASK 0x7F
+#define COMMAND_MASK Mod1Mask
+#define OPTION_MASK Mod2Mask
+
+
+/*
+ * Tables enumerating the special keys defined on Mac keyboards. These are
+ * necessary for correct keysym mappings for all keys where the keysyms are
+ * not identical with their ASCII or Latin-1 code points.
+ */
+
+typedef struct {
+ int keycode; /* Macintosh keycode. */
+ KeySym keysym; /* X windows keysym. */
+} KeyInfo;
+
+/*
+ * Notes on keyArray:
+ *
+ * 0x34, XK_Return - Powerbooks use this and some keymaps define it.
+ *
+ * 0x4C, XK_Return - XFree86 and Apple's X11 call this one XK_KP_Enter.
+ *
+ * 0x47, XK_Clear - This key is NumLock when used on PCs, but Mac
+ * applications don't use it like that, nor does Apple's X11.
+ *
+ * All other keycodes are taken from the published ADB keyboard layouts.
+ */
+
+static KeyInfo keyArray[] = {
+ {0x24, XK_Return},
+ {0x30, XK_Tab},
+ {0x33, XK_BackSpace},
+ {0x34, XK_Return},
+ {0x35, XK_Escape},
+
+ {0x47, XK_Clear},
+ {0x4C, XK_KP_Enter},
+
+ {0x72, XK_Help},
+ {0x73, XK_Home},
+ {0x74, XK_Page_Up},
+ {0x75, XK_Delete},
+ {0x77, XK_End},
+ {0x79, XK_Page_Down},
+
+ {0x7B, XK_Left},
+ {0x7C, XK_Right},
+ {0x7D, XK_Down},
+ {0x7E, XK_Up},
+
+ {0, 0}
+};
+
+static KeyInfo virtualkeyArray[] = {
+ {122, XK_F1},
+ {120, XK_F2},
+ {99, XK_F3},
+ {118, XK_F4},
+ {96, XK_F5},
+ {97, XK_F6},
+ {98, XK_F7},
+ {100, XK_F8},
+ {101, XK_F9},
+ {109, XK_F10},
+ {103, XK_F11},
+ {111, XK_F12},
+ {105, XK_F13},
+ {107, XK_F14},
+ {113, XK_F15},
+ {0, 0}
+};
+
+static int initialized = 0;
+static Tcl_HashTable keycodeTable; /* keyArray hashed by keycode value. */
+static Tcl_HashTable vkeyTable; /* virtualkeyArray hashed by virtual
+ * keycode value. */
+
+static int latin1Table[LATIN1_MAX+1]; /* Reverse mapping table for
+ * controls, ASCII and Latin-1. */
+
+/*
+ * Prototypes for static functions used in this file.
+ */
+
+static void InitKeyMaps (void);
+static void InitLatin1Table(Display *display);
+static int XKeysymToMacKeycode(Display *display, KeySym keysym);
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * InitKeyMaps --
+ *
+ * Creates hash tables used by some of the functions in this file.
+ *
+ * FIXME: As keycodes are defined to be in the limited range 0-127, it
+ * would be easier and more efficient to use directly initialized plain
+ * arrays and drop this function.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Allocates memory & creates some hash tables.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+InitKeyMaps(void)
+{
+ Tcl_HashEntry *hPtr;
+ KeyInfo *kPtr;
+ int dummy;
+
+ Tcl_InitHashTable(&keycodeTable, TCL_ONE_WORD_KEYS);
+ for (kPtr = keyArray; kPtr->keycode != 0; kPtr++) {
+ hPtr = Tcl_CreateHashEntry(&keycodeTable, (char *) kPtr->keycode,
+ &dummy);
+ Tcl_SetHashValue(hPtr, kPtr->keysym);
+ }
+ Tcl_InitHashTable(&vkeyTable, TCL_ONE_WORD_KEYS);
+ for (kPtr = virtualkeyArray; kPtr->keycode != 0; kPtr++) {
+ hPtr = Tcl_CreateHashEntry(&vkeyTable, (char *) kPtr->keycode,
+ &dummy);
+ Tcl_SetHashValue(hPtr, kPtr->keysym);
+ }
+ initialized = 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * InitLatin1Table --
+ *
+ * Creates a simple table to be used for mapping from keysyms to keycodes.
+ * Always needs to be called before using latin1Table, because the
+ * keyboard layout may have changed, and than the table must be
+ * re-computed.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Sets the global latin1Table.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+InitLatin1Table(
+ Display *display)
+{
+ static Boolean latin1_initialized = false;
+ static SInt16 lastKeyLayoutID = -1;
+
+ SInt16 keyScript;
+ SInt16 keyLayoutID;
+
+ keyScript = GetScriptManagerVariable(smKeyScript);
+ keyLayoutID = GetScriptVariable(keyScript,smScriptKeys);
+
+ if (!latin1_initialized || (lastKeyLayoutID != keyLayoutID)) {
+ int keycode;
+ KeySym keysym;
+ int state;
+ int modifiers;
+
+ latin1_initialized = true;
+ lastKeyLayoutID = keyLayoutID;
+
+ memset(latin1Table, 0, sizeof(latin1Table));
+
+ /*
+ * In the common X11 implementations, a keymap has four columns
+ * "plain", "Shift", "Mode_switch" and "Mode_switch + Shift". We don't
+ * use "Mode_switch", but we use "Option" instead. (This is similar to
+ * Apple's X11 implementation, where "Mode_switch" is used as an alias
+ * for "Option".)
+ *
+ * So here we go through all 4 columns of the keymap and find all
+ * Latin-1 compatible keycodes. We go through the columns back-to-front
+ * from the more exotic columns to the more simple, so that simple
+ * keycode-modifier combinations are preferred in the resulting table.
+ */
+
+ for (state = 3; state >= 0; state--) {
+ modifiers = 0;
+ if (state & 1) {
+ modifiers |= shiftKey;
+ }
+ if (state & 2) {
+ modifiers |= optionKey;
+ }
+
+ for (keycode = 0; keycode <= MAC_KEYCODE_MAX; keycode++) {
+ keysym = XKeycodeToKeysym(display,keycode<<16,state);
+ if (keysym <= LATIN1_MAX) {
+ latin1Table[keysym] = keycode | modifiers;
+ }
+ }
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XKeycodeToKeysym --
+ *
+ * Translate from a system-dependent keycode to a system-independent
+ * keysym.
+ *
+ * Results:
+ * Returns the translated keysym, or NoSymbol on failure.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+KeySym
+XKeycodeToKeysym(
+ Display* display,
+ KeyCode keycode,
+ int index)
+{
+ register Tcl_HashEntry *hPtr;
+ int newKeycode;
+ UniChar newChar;
+
+ (void) display; /*unused*/
+
+ if (!initialized) {
+ InitKeyMaps();
+ }
+
+ /*
+ * When determining what keysym to produce we first check to see if the key
+ * is a function key. We then check to see if the character is another
+ * non-printing key. Finally, we return the key syms for all ASCII and
+ * Latin-1 chars.
+ */
+
+ newKeycode = keycode >> 16;
+
+ if ((keycode & 0xFFFF) == 0x10) {
+ hPtr = Tcl_FindHashEntry(&vkeyTable, (char *) newKeycode);
+ if (hPtr != NULL) {
+ return (KeySym) Tcl_GetHashValue(hPtr);
+ }
+ }
+ hPtr = Tcl_FindHashEntry(&keycodeTable, (char *) newKeycode);
+ if (hPtr != NULL) {
+ return (KeySym) Tcl_GetHashValue(hPtr);
+ }
+
+ /*
+ * Add in the Mac modifier flags for shift and option.
+ */
+
+ if (index & 1) {
+ newKeycode |= shiftKey;
+ }
+ if (index & 2) {
+ newKeycode |= optionKey;
+ }
+
+ newChar = 0;
+ TkMacOSXKeycodeToUnicode(&newChar, 1, kEventRawKeyDown,
+ newKeycode & 0x00FF, newKeycode & 0xFF00, NULL);
+
+ /*
+ * X11 keysyms are identical to Unicode for ASCII and Latin-1. Give up for
+ * other characters for now.
+ */
+
+ if ((newChar >= XK_space) && (newChar <= LATIN1_MAX)) {
+ return newChar;
+ }
+
+ return NoSymbol;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetString --
+ *
+ * Retrieve the string equivalent for the given keyboard event.
+ *
+ * Results:
+ * Returns the UTF string.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+const char *
+TkpGetString(
+ TkWindow *winPtr, /* Window where event occurred: Needed to get
+ * input context. */
+ XEvent *eventPtr, /* X keyboard event. */
+ Tcl_DString *dsPtr) /* Uninitialized or empty string to hold
+ * result. */
+{
+ (void) winPtr; /*unused*/
+ Tcl_DStringInit(dsPtr);
+ return Tcl_DStringAppend(dsPtr, eventPtr->xkey.trans_chars, -1);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XGetModifierMapping --
+ *
+ * Fetch the current keycodes used as modifiers.
+ *
+ * Results:
+ * Returns a new modifier map.
+ *
+ * Side effects:
+ * Allocates a new modifier map data structure.
+ *
+ *----------------------------------------------------------------------
+ */
+
+XModifierKeymap *
+XGetModifierMapping(
+ Display *display)
+{
+ XModifierKeymap *modmap;
+
+ (void) display; /*unused*/
+
+ /*
+ * MacOSX doesn't use the key codes for the modifiers for anything, and we
+ * don't generate them either. So there is no modifier map.
+ */
+
+ modmap = ckalloc(sizeof(XModifierKeymap));
+ modmap->max_keypermod = 0;
+ modmap->modifiermap = NULL;
+ return modmap;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XFreeModifiermap --
+ *
+ * Deallocate a modifier map that was created by XGetModifierMapping.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Frees the datastructure referenced by modmap.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XFreeModifiermap(
+ XModifierKeymap *modmap)
+{
+ if (modmap->modifiermap != NULL) {
+ ckfree(modmap->modifiermap);
+ }
+ ckfree(modmap);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XKeysymToString, XStringToKeysym --
+ *
+ * These X window functions map keysyms to strings & strings to keysyms.
+ * However, Tk already does this for the most common keysyms. Therefore,
+ * these functions only need to support keysyms that will be specific to
+ * the Macintosh. Currently, there are none.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+char *
+XKeysymToString(
+ KeySym keysym)
+{
+ return NULL;
+}
+
+KeySym
+XStringToKeysym(
+ const char* string)
+{
+ return NoSymbol;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XKeysymToMacKeycode --
+ *
+ * An internal function like XKeysymToKeycode but only generating the Mac
+ * specific keycode plus the modifiers Shift and Option.
+ *
+ * Results:
+ * A Mac keycode with the actual keycode in the low byte and Mac-style
+ * modifier bits in the high byte.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+XKeysymToMacKeycode(
+ Display *display,
+ KeySym keysym)
+{
+ KeyInfo *kPtr;
+
+ if (keysym <= LATIN1_MAX) {
+ /*
+ * Handle keysyms in the Latin-1 range where keysym and Unicode
+ * character code point are the same.
+ */
+
+ InitLatin1Table(display);
+ return latin1Table[keysym];
+ }
+
+ /*
+ * Handle special keys from our exception tables. Don't mind if this is
+ * slow, neither the test suite nor [event generate] need to be optimized
+ * (we hope).
+ */
+
+ for (kPtr = keyArray; kPtr->keycode != 0; kPtr++) {
+ if (kPtr->keysym == keysym) {
+ return kPtr->keycode;
+ }
+ }
+ for (kPtr = virtualkeyArray; kPtr->keycode != 0; kPtr++) {
+ if (kPtr->keysym == keysym) {
+ return kPtr->keycode;
+ }
+ }
+
+ /*
+ * For other keysyms (not Latin-1 and not special keys), we'd need a
+ * generic keysym-to-unicode table. We don't have that, so we give up here.
+ */
+
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XKeysymToKeycode --
+ *
+ * The function XKeysymToKeycode takes an X11 keysym and converts it into
+ * a Mac keycode. It is in the stubs table for compatibility but not used
+ * anywhere in the core.
+ *
+ * Results:
+ * A 32 bit keycode with the the mac keycode (without modifiers) in the
+ * higher 16 bits of the keycode and the ASCII or Latin-1 code in the
+ * lower 8 bits of the keycode.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+KeyCode
+XKeysymToKeycode(
+ Display* display,
+ KeySym keysym)
+{
+ int macKeycode = XKeysymToMacKeycode(display, keysym);
+ KeyCode result;
+
+ /*
+ * See also TkpSetKeycodeAndState. The 0x0010 magic is used in
+ * XKeycodeToKeysym. For special keys like XK_Return the lower 8 bits of
+ * the keysym are usually a related ASCII control code.
+ */
+
+ if ((keysym >= XK_F1) && (keysym <= XK_F35)) {
+ result = 0x0010;
+ } else {
+ result = 0x00FF & keysym;
+ }
+ result |= (macKeycode & MAC_KEYCODE_MASK) << 16;
+
+ return result;
+}
+
+/*
+NB: Keep this commented code for a moment for reference.
+
+ if ((keysym >= XK_space) && (XK_asciitilde)) {
+ if (keysym == 'a') {
+ virtualKeyCode = 0x00;
+ } else if (keysym == 'b' || keysym == 'B') {
+ virtualKeyCode = 0x0B;
+ } else if (keysym == 'c') {
+ virtualKeyCode = 0x08;
+ } else if (keysym == 'x' || keysym == 'X') {
+ virtualKeyCode = 0x07;
+ } else if (keysym == 'z') {
+ virtualKeyCode = 0x06;
+ } else if (keysym == ' ') {
+ virtualKeyCode = 0x31;
+ } else if (keysym == XK_Return) {
+ virtualKeyCode = 0x24;
+ keysym = '\r';
+ }
+ keycode = keysym + (virtualKeyCode <<16);
+ }
+
+ return keycode;
+*/
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpSetKeycodeAndState --
+ *
+ * The function TkpSetKeycodeAndState takes a keysym and fills in the
+ * appropriate members of an XEvent. It is similar to XKeysymToKeycode,
+ * but it also sets the modifier mask in the XEvent. It is used by [event
+ * generate] and it is in the stubs table.
+ *
+ * Results:
+ * Fills an XEvent, sets the member xkey.keycode with a keycode
+ * formatted the same as XKeysymToKeycode and the member xkey.state with
+ * the modifiers implied by the keysym. Also fills in xkey.trans_chars,
+ * so that the actual characters can be retrieved later.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpSetKeycodeAndState(
+ Tk_Window tkwin,
+ KeySym keysym,
+ XEvent *eventPtr)
+{
+ if (keysym == NoSymbol) {
+ eventPtr->xkey.keycode = 0;
+ } else {
+ Display *display = Tk_Display(tkwin);
+ int macKeycode = XKeysymToMacKeycode(display, keysym);
+
+ /*
+ * See also XKeysymToKeycode.
+ */
+
+ if ((keysym >= XK_F1) && (keysym <= XK_F35)) {
+ eventPtr->xkey.keycode = 0x0010;
+ } else {
+ eventPtr->xkey.keycode = 0x00FF & keysym;
+ }
+ eventPtr->xkey.keycode |= (macKeycode & MAC_KEYCODE_MASK) << 16;
+
+ if (shiftKey & macKeycode) {
+ eventPtr->xkey.state |= ShiftMask;
+ }
+ if (optionKey & macKeycode) {
+ eventPtr->xkey.state |= OPTION_MASK;
+ }
+
+ if (keysym <= LATIN1_MAX) {
+ int done = Tcl_UniCharToUtf(keysym, eventPtr->xkey.trans_chars);
+
+ eventPtr->xkey.trans_chars[done] = 0;
+ } else {
+ eventPtr->xkey.trans_chars[0] = 0;
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetKeySym --
+ *
+ * Given an X KeyPress or KeyRelease event, map the keycode in the event
+ * into a keysym.
+ *
+ * Results:
+ * The return value is the keysym corresponding to eventPtr, or NoSymbol
+ * if no matching keysym could be found.
+ *
+ * Side effects:
+ * In the first call for a given display, keycode-to-keysym maps get
+ * loaded.
+ *
+ *----------------------------------------------------------------------
+ */
+
+KeySym
+TkpGetKeySym(
+ TkDisplay *dispPtr, /* Display in which to map keycode. */
+ XEvent *eventPtr) /* Description of X event. */
+{
+ KeySym sym;
+ int index;
+
+ /*
+ * Refresh the mapping information if it's stale.
+ */
+
+ if (dispPtr->bindInfoStale) {
+ TkpInitKeymapInfo(dispPtr);
+ }
+
+ /*
+ * Handle pure modifier keys specially. We use -1 as a signal for
+ * this.
+ */
+
+ if (eventPtr->xany.send_event == -1) {
+ int modifier = eventPtr->xkey.keycode;
+
+ if (modifier == cmdKey) {
+ return XK_Meta_L;
+ } else if (modifier == shiftKey) {
+ return XK_Shift_L;
+ } else if (modifier == alphaLock) {
+ return XK_Caps_Lock;
+ } else if (modifier == optionKey) {
+ return XK_Alt_L;
+ } else if (modifier == controlKey) {
+ return XK_Control_L;
+ } else if (modifier == kEventKeyModifierNumLockMask) {
+ return XK_Num_Lock;
+ } else if (modifier == kEventKeyModifierFnMask) {
+ return XK_Super_L;
+ } else if (modifier == rightShiftKey) {
+ return XK_Shift_R;
+ } else if (modifier == rightOptionKey) {
+ return XK_Alt_R;
+ } else if (modifier == rightControlKey) {
+ return XK_Control_R;
+ } else {
+ /*
+ * If we get here, we probably need to implement something new.
+ */
+
+ return NoSymbol;
+ }
+ }
+
+ /*
+ * Figure out which of the four slots in the keymap vector to use for this
+ * key. Refer to Xlib documentation for more info on how this computation
+ * works. (Note: We use "Option" in keymap columns 2 and 3 where other
+ * implementations have "Mode_switch".)
+ */
+
+ index = 0;
+
+ /*
+ * We want Option key combinations to use their base chars as keysyms, so
+ * we ignore the option modifier here.
+ */
+
+#if 0
+ if (eventPtr->xkey.state & OPTION_MASK) {
+ index |= 2;
+ }
+#endif
+
+ if ((eventPtr->xkey.state & ShiftMask)
+ || (/* (dispPtr->lockUsage != LU_IGNORE)
+ && */ (eventPtr->xkey.state & LockMask))) {
+ index |= 1;
+ }
+
+ /*
+ * First try of the actual translation.
+ */
+
+ sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, index);
+
+ /*
+ * Special handling: If the key was shifted because of Lock, but lock is
+ * only caps lock, not shift lock, and the shifted keysym isn't upper-case
+ * alphabetic, then switch back to the unshifted keysym.
+ */
+
+ if ((index & 1) && !(eventPtr->xkey.state & ShiftMask)
+ /*&& (dispPtr->lockUsage == LU_CAPS)*/ ) {
+ /*
+ * FIXME: Keysyms are only identical to Unicode for ASCII and Latin-1,
+ * so we can't use Tcl_UniCharIsUpper() for keysyms outside that range.
+ * This may be a serious problem here.
+ */
+
+ if ((sym == NoSymbol) || (sym > LATIN1_MAX)
+ || !Tcl_UniCharIsUpper(sym)) {
+ index &= ~1;
+ sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
+ index);
+ }
+ }
+
+ /*
+ * Another bit of special handling: If this is a shifted key and there is
+ * no keysym defined, then use the keysym for the unshifted key.
+ */
+
+ if ((index & 1) && (sym == NoSymbol)) {
+ sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode,
+ index & ~1);
+ }
+ return sym;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkpInitKeymapInfo --
+ *
+ * This procedure is invoked to scan keymap information to recompute stuff
+ * that's important for binding, such as the modifier key (if any) that
+ * corresponds to the "Mode_switch" keysym.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Keymap-related information in dispPtr is updated.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+TkpInitKeymapInfo(
+ TkDisplay *dispPtr) /* Display for which to recompute keymap
+ * information. */
+{
+ dispPtr->bindInfoStale = 0;
+
+ /*
+ * Behaviours that are variable on X11 are defined constant on MacOSX.
+ * lockUsage is only used above in TkpGetKeySym(), nowhere else currently.
+ * There is no offical "Mode_switch" key.
+ */
+
+ dispPtr->lockUsage = LU_CAPS;
+ dispPtr->modeModMask = 0;
+
+#if 0
+ /*
+ * With this, <Alt> and <Meta> become synonyms for <Command> and <Option>
+ * in bindings like they are (and always have been) in the keysyms that
+ * are reported by KeyPress events. But the init scripts like text.tcl
+ * have some disabling bindings for <Meta>, so we don't want this without
+ * some changes in those scripts. See also bug #700311.
+ */
+
+ dispPtr->altModMask = OPTION_MASK;
+ dispPtr->metaModMask = COMMAND_MASK;
+#else
+ dispPtr->altModMask = 0;
+ dispPtr->metaModMask = 0;
+#endif
+
+ /*
+ * MacOSX doesn't use the keycodes for the modifiers for anything, and we
+ * don't generate them either (the keycodes actually given in the simulated
+ * modifier events are bogus). So there is no modifier map. If we ever want
+ * to simulate real modifier keycodes, the list will be constant in the
+ * Carbon implementation.
+ */
+
+ if (dispPtr->modKeyCodes != NULL) {
+ ckfree(dispPtr->modKeyCodes);
+ }
+ dispPtr->numModKeyCodes = 0;
+ dispPtr->modKeyCodes = NULL;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/carbon/tkMacOSXMenu.c b/carbon/tkMacOSXMenu.c
new file mode 100644
index 0000000..31bb20e
--- /dev/null
+++ b/carbon/tkMacOSXMenu.c
@@ -0,0 +1,4743 @@
+/*
+ * tkMacOSXMenu.c --
+ *
+ * This module implements the Mac-platform specific features of menus.
+ *
+ * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkMenubutton.h"
+#include "tkMenu.h"
+#include "tkColor.h"
+#include "tkFont.h"
+#include "tkMacOSXDebug.h"
+
+/*
+#ifdef TK_MAC_DEBUG
+#define TK_MAC_DEBUG_MENUS
+#endif
+*/
+
+#define USE_TK_MDEF
+
+typedef struct MacMenu {
+ MenuRef menuHdl; /* The Menu Manager data structure. */
+#ifdef USE_TK_MDEF
+ int useMDEF; /* true if this menu uses the MDEF */
+#endif
+} MacMenu;
+
+typedef struct MenuEntryUserData {
+ Drawable mdefDrawable;
+ TkMenuEntry *mePtr;
+ Tk_Font tkfont;
+ Tk_FontMetrics *fmPtr;
+} MenuEntryUserData;
+
+/*
+ * Platform specific flags for menu entries
+ *
+ * ENTRY_COMMAND_ACCEL Indicates the entry has the command key
+ * in its accelerator string.
+ * ENTRY_OPTION_ACCEL Indicates the entry has the option key
+ * in its accelerator string.
+ * ENTRY_SHIFT_ACCEL Indicates the entry has the shift key
+ * in its accelerator string.
+ * ENTRY_CONTROL_ACCEL Indicates the entry has the control key
+ * in its accelerator string.
+ */
+
+#define ENTRY_COMMAND_ACCEL ENTRY_PLATFORM_FLAG1
+#define ENTRY_OPTION_ACCEL ENTRY_PLATFORM_FLAG2
+#define ENTRY_SHIFT_ACCEL ENTRY_PLATFORM_FLAG3
+#define ENTRY_CONTROL_ACCEL ENTRY_PLATFORM_FLAG4
+#define ENTRY_ACCEL_MASK (ENTRY_COMMAND_ACCEL | ENTRY_OPTION_ACCEL \
+ | ENTRY_SHIFT_ACCEL | ENTRY_CONTROL_ACCEL)
+#define MODIFIER_NUM 4
+
+/*
+ * This structure is used to keep track of subfields within Macintosh menu
+ * items.
+ */
+
+typedef struct EntryGeometry {
+ int accelTextStart; /* Offset into the accel string where the text
+ * starts. Everything before this is modifier
+ * key descriptions. */
+ int modifierWidth; /* Width of modifier symbols. */
+ int accelTextWidth; /* Width of the text after the modifier
+ * keys. */
+ int nonAccelMargin; /* The width of the margin for entries without
+ * accelerators. */
+ int modifierNum; /* Number of modifiers */
+ Tcl_UniChar modifierUniChars[MODIFIER_NUM];
+ /* Modifiers in unicode */
+ char accelGlyph; /* Accelerator glyph, if any */
+} EntryGeometry;
+
+/*
+ * Structure to keep track of toplevel windows and their menubars.
+ */
+
+typedef struct TopLevelMenubarList {
+ struct TopLevelMenubarList *nextPtr;
+ /* The next window in the list. */
+ Tk_Window tkwin; /* The toplevel window. */
+ TkMenu *menuPtr; /* The menu associated with this toplevel. */
+} TopLevelMenubarList;
+
+/*
+ * Platform-specific flags for menus.
+ *
+ * MENU_APPLE_MENU 0 indicates a custom Apple menu has not been
+ * installed; 1 a custom Apple menu has been
+ * installed.
+ * MENU_HELP_MENU 0 indicates a custom Help menu has not been
+ * installed; 1 a custom Help menu has been
+ * installed.
+ * MENU_RECONFIGURE_PENDING 1 indicates that an idle handler has been
+ * scheduled to reconfigure the Macintosh
+ * MenuHandle.
+ */
+
+#define MENU_APPLE_MENU MENU_PLATFORM_FLAG1
+#define MENU_HELP_MENU MENU_PLATFORM_FLAG2
+#define MENU_RECONFIGURE_PENDING MENU_PLATFORM_FLAG3
+
+#define CASCADE_CMD (0x1b) /* The special command char for cascade
+ * menus. */
+#define MENUBAR_REDRAW_PENDING 1
+
+static int gNoTkMenus = 0; /* This is used by Tk_MacOSXTurnOffMenus as
+ * the flag that Tk is not to draw any
+ * menus. */
+
+static Tcl_HashTable commandTable;
+ /* The list of menuInstancePtrs associated
+ * with menu ids. */
+static short currentAppleMenuID;
+ /* The id of the current Apple menu. 0 for
+ * none. */
+static short currentHelpMenuID; /* The id of the current Help menu. 0 for
+ * none. */
+static Tcl_Interp *currentMenuBarInterp;
+ /* The interpreter of the window that owns the
+ * current menubar. */
+static char *currentMenuBarName;
+ /* Malloced. Name of current menu in menu bar.
+ * NULL if no menu set. TO DO: make this a
+ * DString. */
+static Tk_Window currentMenuBarOwner;
+ /* Which window owns the current menu bar. */
+static int inPostMenu; /* We cannot be re-entrant like X windows. */
+static short lastMenuID; /* To pass to NewMenu; need to figure out a
+ * good way to do this. */
+static short lastCascadeID; /* Cascades have to have ids that are less
+ * than 256. */
+static int menuBarFlags; /* Used for whether the menu bar needs
+ * redrawing or not. */
+
+struct MenuCommandHandlerData { /* This is the ClientData we pass to */
+ TkMenu *menuPtr; /* Tcl_DoWhenIdle to move handling */
+ int index; /* menu commands to the event loop. */
+};
+
+static TopLevelMenubarList *windowListPtr;
+ /* A list of windows that have menubars set. */
+
+/*
+ * Array of unicode, charcode and utf representations of the most common
+ * special menu symbols.
+ */
+
+typedef struct MenuSymbol {
+ const Tcl_UniChar unicode;
+ const char charCode;
+ /* char padding; */
+ int utfLen, width;
+ char utf[TCL_UTF_MAX + 1];
+} MenuSymbol;
+
+static MenuSymbol menuSymbols[] = {
+ {kCommandUnicode, kCommandCharCode},
+ {kOptionUnicode, kMenuOptionGlyph},
+ {kControlUnicode, kMenuControlGlyph},
+ {kShiftUnicode, kMenuShiftGlyph},
+ {kCheckUnicode, kCheckCharCode},
+ {kDiamondUnicode, kDiamondCharCode},
+ {kBulletUnicode, kBulletCharCode},
+ {0x2026, kNullCharCode},
+ {0, 0},
+};
+
+enum MenuSymbolIdx {
+ COMMAND_SYMBOL,
+ OPTION_SYMBOL,
+ CONTROL_SYMBOL,
+ SHIFT_SYMBOL,
+ CHECK_SYMBOL,
+ DIAMDOND_SYMBOL,
+ BULLET_SYMBOL,
+ ELLIPSIS_SYMBOL,
+};
+
+MenuRef tkCurrentAppleMenu = NULL;
+
+static SInt32 menuMarkColumnWidth = 0, menuMarkIndent = 0;
+static SInt32 menuTextLeadingEdgeMargin = 0, menuTextTrailingEdgeMargin = 0;
+static SInt16 menuItemExtraHeight = 0, menuItemExtraWidth = 0;
+static SInt16 menuSeparatorHeight = 0;
+
+/*
+ * Forward declarations for procedures defined later in this file:
+ */
+
+MODULE_SCOPE int TkMacOSXGetNewMenuID(Tcl_Interp *interp,
+ TkMenu *menuInstPtr, int cascade,
+ short *menuIDPtr);
+MODULE_SCOPE void TkMacOSXFreeMenuID(short menuID);
+
+static void CompleteIdlers(TkMenu *menuPtr);
+static void DrawMenuBarWhenIdle(ClientData clientData);
+static void DrawMenuEntryAccelerator(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d, GC gc,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
+ Tk_3DBorder activeBorder, int x, int y, int width,
+ int height, int drawArrow);
+static void DrawMenuEntryBackground(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d,
+ Tk_3DBorder activeBorder, Tk_3DBorder bgBorder,
+ int x, int y, int width, int heigth);
+static void DrawMenuEntryIndicator(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Drawable d, GC gc,
+ GC indicatorGC, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int x, int y,
+ int width, int height);
+static void DrawMenuEntryLabel(TkMenu *menuPtr,TkMenuEntry *mePtr,
+ Drawable d, GC gc, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int x, int y,
+ int width, int height);
+static void DrawMenuSeparator(TkMenu *menuPtr, TkMenuEntry *mePtr,
+ Drawable d, GC gc, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int x, int y,
+ int width, int height);
+static void DrawTearoffEntry(TkMenu *menuPtr, TkMenuEntry *mePtr,
+ Drawable d, GC gc, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int x, int y,
+ int width, int height);
+static void EventuallyInvokeMenu(ClientData data);
+static void GetEntryText(TkMenuEntry *mePtr,
+ Tcl_DString *dStringPtr);
+static void GetMenuAccelGeometry(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int *modWidthPtr,
+ int *textWidthPtr, int *heightPtr);
+static void GetMenuLabelGeometry(TkMenuEntry *mePtr,
+ Tk_Font tkfont, const Tk_FontMetrics *fmPtr,
+ int *widthPtr, int *heightPtr);
+static void GetMenuIndicatorGeometry(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int *widthPtr,
+ int *heightPtr);
+static void GetMenuSeparatorGeometry(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int *widthPtr,
+ int *heightPtr);
+static TkMenuEntry * GetParentMenuEntry(TkMenu *menuPtr);
+static void GetTearoffEntryGeometry(TkMenu *menuPtr,
+ TkMenuEntry *mePtr, Tk_Font tkfont,
+ const Tk_FontMetrics *fmPtr, int *widthPtr,
+ int *heightPtr);
+static char FindMarkCharacter(TkMenuEntry *mePtr);
+static int GetUtfMarkCharacter(char markChar,
+ const char **markUtfPtr);
+static TkMenu * MenuPtrForMenuRef(MenuRef menu);
+static int ParseAccelerators(const char **accelStringPtr,
+ int *modifierNumPtr,
+ Tcl_UniChar *modifierUniChars,
+ int *modifierWidth);
+static void MenuSelectEvent(TkMenu *menuPtr);
+static void ReconfigureIndividualMenu(TkMenu *menuPtr,
+ MenuHandle macMenuHdl, int base);
+static void ReconfigureMacintoshMenu(ClientData clientData);
+static void RecursivelyClearActiveMenu(TkMenu *menuPtr);
+static void RecursivelyDeleteMenu(TkMenu *menuPtr);
+static void RecursivelyInsertMenu(TkMenu *menuPtr);
+static void SetDefaultMenubar(void);
+static int SetMenuCascade(TkMenu *menuPtr);
+
+#ifdef USE_TK_MDEF
+#define SCREEN_MARGIN 5
+static MacDrawable macMDEFDrawable;
+ /* Drawable for use by MDEF code */
+static int MDEFScrollFlag = 0; /* Used so that popups don't scroll too
+ * soon. */
+static MenuItemDrawingUPP tkThemeMenuItemDrawingUPP;
+ /* Points to the UPP for theme Item
+ * drawing. */
+static Tcl_Obj *useMDEFVar;
+
+static void DrawMenuBackground(TkMenu *menuPtr, Rect *menuRectPtr,
+ Drawable d);
+static void MenuDefProc(short message, MenuHandle menu,
+ Rect *menuRectPtr, Point hitPt, short *whichItem);
+static void HandleMenuHiliteMsg(MenuRef menu, Rect *menuRectPtr,
+ Point hitPt, SInt16 *whichItem, TkMenu *menuPtr);
+static void HandleMenuDrawMsg(MenuRef menu, Rect *menuRectPtr,
+ Point hitPt, SInt16 *whichItem, TkMenu *menuPtr);
+static void HandleMenuFindItemMsg(MenuRef menu, Rect *menuRectPtr,
+ Point hitPt, SInt16 *whichItem, TkMenu *menuPtr);
+static void HandleMenuPopUpMsg(MenuRef menu, Rect *menuRectPtr,
+ Point hitPt, SInt16 *whichItem, TkMenu *menuPtr);
+static void HandleMenuCalcItemMsg(MenuRef menu, Rect *menuRectPtr,
+ Point hitPt, SInt16 *whichItem, TkMenu *menuPtr);
+static void AppearanceEntryDrawWrapper(TkMenuEntry *mePtr,
+ Rect *menuRectPtr, MenuTrackingData *mtdPtr,
+ Drawable d, Tk_FontMetrics *fmPtr, Tk_Font tkfont,
+ int erase);
+static pascal void ThemeMenuItemDrawingProc(const Rect *inBounds,
+ SInt16 inDepth, Boolean inIsColorDevice,
+ SInt32 inUserData);
+#else /* USE_TK_MDEF */
+# define useMDEF 0
+#endif /* USE_TK_MDEF */
+
+#define IS_THEME_MENU_FONT(tkfont) (strcmp(Tk_NameOfFont(tkfont), "menu") == 0)
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawThemeText --
+ *
+ * Wrapper for DrawThemeTextBox API.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+DrawThemeText(
+ Drawable d,
+ GC gc,
+ CFStringRef string,
+ ThemeFontID font,
+ ThemeDrawState drawState,
+ const Rect* bounds,
+ int baseline,
+ int just)
+{
+ TkMacOSXDrawingContext dc;
+ Rect adjustedBounds;
+
+ /*
+ * Menu item text drawn with the .Keyboard font (used for
+ * kThemeMenuItemCmdKeyFont) won't always have the same ascent and
+ * baseline as text drawn with the regular menu item font, since the
+ * glyphs in the .Keyboard font may have a different height. Therefore, we
+ * first determine the baseline of the text and then adjust the bounds
+ * rect so the baseline aligns with the overall baseline of the menu item.
+ */
+
+ if (font == kThemeMenuItemCmdKeyFont) {
+ Point size;
+ SInt16 cmdKeyBaseline;
+
+ GetThemeTextDimensions(string, font, drawState, false, &size,
+ &cmdKeyBaseline);
+ adjustedBounds = *bounds;
+ OffsetRect(&adjustedBounds, 0, baseline - bounds->top - size.v -
+ cmdKeyBaseline);
+ bounds = &adjustedBounds;
+ }
+ if (TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
+ ChkErr(DrawThemeTextBox, string, font, drawState, false, bounds, just,
+ dc.context);
+ TkMacOSXRestoreDrawingContext(&dc);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MeasureThemeText --
+ *
+ * Wrapper for GetThemeTextDimensions API.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+MeasureThemeText(
+ CFStringRef string,
+ ThemeFontID font)
+{
+ Point pt;
+
+ ChkErr(GetThemeTextDimensions, string, font, kThemeStateActive, false, &pt,
+ NULL);
+ return pt.h;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXUseID --
+ *
+ * Take the ID out of the available list for new menus. Used by the
+ * default menu bar's menus so that they do not get created at the tk
+ * level. See TkMacOSXGetNewMenuID for more information.
+ *
+ * Results:
+ * Returns TCL_OK if the id was not in use. Returns TCL_ERROR if the id
+ * was in use.
+ *
+ * Side effects:
+ * A hash table entry in the command table is created with a NULL value.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkMacOSXUseMenuID(
+ short macID) /* The id to take out of the table */
+{
+ Tcl_HashEntry *commandEntryPtr;
+ int newEntry;
+ int iMacID = macID; /* Do this to remove compiler warning */
+
+ TkMenuInit();
+ commandEntryPtr = Tcl_CreateHashEntry(&commandTable, (char *) iMacID,
+ &newEntry);
+ if (!newEntry) {
+ return TCL_ERROR;
+ }
+ Tcl_SetHashValue(commandEntryPtr, NULL);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetNewMenuID --
+ *
+ * Allocates a new menu id and marks it in use. Each menu on the mac must
+ * be designated by a unique id, which is a short. In addition, some ids
+ * are reserved by the system. Since Tk uses mostly dynamic menus, we
+ * must allocate and free these ids on the fly. We use the id as a key
+ * into a hash table; if there is no hash entry, we know that we can use
+ * the id.
+ *
+ * Carbon allows a much larger number of menus than the old APIs. I
+ * believe this is 32768, but am not sure. This code just uses 2000 as
+ * the upper limit. Unfortunately tk leaks menus when cloning, under some
+ * circumstances (see bug on sourceforge).
+ *
+ * Results:
+ * Returns TCL_OK if succesful; TCL_ERROR if there are no more ids of the
+ * appropriate type to allocate. menuIDPtr contains the new id if
+ * succesful.
+ *
+ * Side effects:
+ * An entry is created for the menu in the command hash table, and the
+ * hash entry is stored in the appropriate field in the menu data
+ * structure.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkMacOSXGetNewMenuID(
+ Tcl_Interp *interp, /* Used for error reporting */
+ TkMenu *menuPtr, /* The menu we are working with */
+ int cascade, /* 0 if we are working with a normal menu;
+ * 1 if we are working with a cascade */
+ short *menuIDPtr) /* The resulting id */
+{
+ int found = 0;
+ int newEntry;
+ Tcl_HashEntry *commandEntryPtr = NULL;
+ short returnID = *menuIDPtr;
+
+ /*
+ * The following code relies on shorts and unsigned chars wrapping when
+ * the highest value is incremented. Also, the values between 236 and 255
+ * inclusive are reserved for DA's by the Mac OS.
+ */
+
+ if (!cascade) {
+ short curID = lastMenuID + 1;
+
+ if (curID == 236) {
+ curID = 256;
+ }
+
+ while (curID != lastMenuID) {
+ int iCurID = curID;
+ commandEntryPtr = Tcl_CreateHashEntry(&commandTable,
+ (char *) iCurID, &newEntry);
+ if (newEntry == 1) {
+ found = 1;
+ lastMenuID = returnID = curID;
+ break;
+ }
+ curID++;
+ if (curID == 236) {
+ curID = 256;
+ }
+ }
+ } else {
+ /*
+ * Cascade ids must be between 0 and 235 only, so they must be dealt
+ * with separately.
+ */
+
+ short curID = lastCascadeID + 1;
+
+ if (curID == 2000) {
+ curID = 0;
+ }
+
+ while (curID != lastCascadeID) {
+ int iCurID = curID;
+ commandEntryPtr = Tcl_CreateHashEntry(&commandTable,
+ (char *) iCurID, &newEntry);
+ if (newEntry == 1) {
+ found = 1;
+ lastCascadeID = returnID = curID;
+ break;
+ }
+ curID++;
+ if (curID == 2000) {
+ curID = 0;
+ }
+ }
+ }
+
+ if (!found) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "No more menus can be allocated.", NULL);
+ return TCL_ERROR;
+ }
+ Tcl_SetHashValue(commandEntryPtr, menuPtr);
+ *menuIDPtr = returnID;
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXFreeMenuID --
+ *
+ * Marks the id as free.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The hash table entry for the ID is cleared.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXFreeMenuID(
+ short menuID) /* The id to free */
+{
+ Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&commandTable,
+ (char*)(intptr_t)menuID);
+
+ if (entryPtr != NULL) {
+ Tcl_DeleteHashEntry(entryPtr);
+ }
+ if (menuID == currentAppleMenuID) {
+ currentAppleMenuID = 0;
+ }
+ if (menuID == currentHelpMenuID) {
+ currentHelpMenuID = 0;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MenuPtrForMenuRef --
+ *
+ * Returns a pointer to the TkMenu corresponding to a given Carbon
+ * MenuRef.
+ *
+ * Results:
+ * Returns a pointer to a TkMenu or NULL.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkMenu *
+MenuPtrForMenuRef(
+ MenuRef menu)
+{
+ TkMenu *menuPtr = NULL;
+ MenuID menuID = GetMenuID(menu);
+ Tcl_HashEntry *commandEntryPtr =
+ Tcl_FindHashEntry(&commandTable, (char*)(intptr_t)menuID);
+
+ if (commandEntryPtr) {
+ menuPtr = Tcl_GetHashValue(commandEntryPtr);
+ }
+ return menuPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetParentMenuEntry --
+ *
+ * Returns a pointer to the parent's TkMenuEntry of a given TkMenu.
+ *
+ * Results:
+ * Returns a pointer to a TkMenuEntry or NULL.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkMenuEntry*
+GetParentMenuEntry(
+ TkMenu *menuPtr)
+{
+ TkMenuEntry *cascadeEntryPtr;
+
+ for (cascadeEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
+ cascadeEntryPtr != NULL;
+ cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) {
+ const char *name = (cascadeEntryPtr->namePtr == NULL) ? ""
+ : Tcl_GetString(cascadeEntryPtr->namePtr);
+
+ if (strcmp(name, Tk_PathName(menuPtr->tkwin)) == 0) {
+ break;
+ }
+ }
+ return cascadeEntryPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpNewMenu --
+ *
+ * Gets a new blank menu. Only the platform specific options are filled
+ * in.
+ *
+ * Results:
+ * Returns a standard TCL error.
+ *
+ * Side effects:
+ * Allocates a Macintosh menu handle and puts in the platformData field
+ * of the menuPtr.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpNewMenu(
+ TkMenu *menuPtr) /* The common structure we are making the
+ * platform structure for. */
+{
+ short menuID;
+ MenuRef macMenuHdl;
+#ifdef USE_TK_MDEF
+ MenuDefSpec menuDefSpec;
+ Tcl_Obj *useMDEFObjPtr;
+ int useMDEF = 1;
+#endif
+ int error = TCL_OK;
+ OSStatus err;
+ CFStringRef cfStr;
+
+ error = TkMacOSXGetNewMenuID(menuPtr->interp, menuPtr, 0, &menuID);
+ if (error != TCL_OK) {
+ return error;
+ }
+ err = ChkErr(CreateNewMenu, menuID, kMenuAttrDoNotUseUserCommandKeys,
+ &macMenuHdl);
+ if (err != noErr) {
+ Tcl_AppendResult(menuPtr->interp, "CreateNewMenu failed.", NULL);
+ return TCL_ERROR;
+ }
+ cfStr = CFStringCreateWithCString(NULL, Tk_PathName(menuPtr->tkwin),
+ kCFStringEncodingUTF8);
+ if (!cfStr) {
+ Tcl_AppendResult(menuPtr->interp, "CFStringCreateWithCString failed.",
+ NULL);
+ return TCL_ERROR;
+ }
+ err = ChkErr(SetMenuTitleWithCFString, macMenuHdl, cfStr);
+ CFRelease(cfStr);
+ if (err != noErr) {
+ Tcl_AppendResult(menuPtr->interp, "SetMenuTitleWithCFString failed.",
+ NULL);
+ return TCL_ERROR;
+ }
+
+ menuPtr->platformData = ckalloc(sizeof(MacMenu));
+ ((MacMenu *) menuPtr->platformData)->menuHdl = macMenuHdl;
+
+#ifdef USE_TK_MDEF
+ /*
+ * Check whether we want to use the custom mdef or not. For now
+ * the default is to use it unless the variable is explicitly
+ * set to no.
+ */
+
+ useMDEFObjPtr = Tcl_ObjGetVar2(menuPtr->interp, useMDEFVar, NULL,
+ TCL_GLOBAL_ONLY);
+ if (useMDEFObjPtr == NULL || Tcl_GetBooleanFromObj(NULL, useMDEFObjPtr,
+ &useMDEF) == TCL_ERROR || useMDEF) {
+ menuDefSpec.defType = kMenuDefProcPtr;
+ menuDefSpec.u.defProc = MenuDefProc;
+ ChkErr(SetMenuDefinition, macMenuHdl, &menuDefSpec);
+ }
+ ((MacMenu *) menuPtr->platformData)->useMDEF = useMDEF;
+#endif /* USE_TK_MDEF */
+
+ if ((currentMenuBarInterp == menuPtr->interp)
+ && (currentMenuBarName != NULL)) {
+ Tk_Window parentWin = Tk_Parent(menuPtr->tkwin);
+
+ if (strcmp(currentMenuBarName, Tk_PathName(parentWin)) == 0) {
+ if ((strcmp(Tk_PathName(menuPtr->tkwin)
+ + strlen(Tk_PathName(parentWin)), ".apple") == 0)
+ || (strcmp(Tk_PathName(menuPtr->tkwin)
+ + strlen(Tk_PathName(parentWin)), ".help") == 0)) {
+ if (!(menuBarFlags & MENUBAR_REDRAW_PENDING)) {
+ Tcl_DoWhenIdle(DrawMenuBarWhenIdle, NULL);
+ menuBarFlags |= MENUBAR_REDRAW_PENDING;
+ }
+ }
+ }
+ }
+
+ menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
+ Tcl_DoWhenIdle(ReconfigureMacintoshMenu, menuPtr);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDestroyMenu --
+ *
+ * Destroys platform-specific menu structures.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * All platform-specific allocations are freed up.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDestroyMenu(
+ TkMenu *menuPtr) /* The common menu structure */
+{
+ MenuRef macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
+
+ if (menuPtr->menuFlags & MENU_RECONFIGURE_PENDING) {
+ Tcl_CancelIdleCall(ReconfigureMacintoshMenu, menuPtr);
+ menuPtr->menuFlags &= ~MENU_RECONFIGURE_PENDING;
+ }
+ if (GetMenuID(macMenuHdl) == currentHelpMenuID) {
+ MenuRef helpMenuHdl;
+ MenuItemIndex helpIndex;
+
+ if ((HMGetHelpMenu(&helpMenuHdl,&helpIndex) == noErr)
+ && (helpMenuHdl != NULL)) {
+ int i, count = CountMenuItems(helpMenuHdl);
+
+ for (i = helpIndex; i <= count; i++) {
+ DeleteMenuItem(helpMenuHdl, helpIndex);
+ }
+ }
+ currentHelpMenuID = 0;
+ }
+ if (menuPtr->platformData != NULL) {
+ MenuID menuID = GetMenuID(macMenuHdl);
+
+ DeleteMenu(menuID);
+ TkMacOSXFreeMenuID(menuID);
+ DisposeMenu(macMenuHdl);
+ ckfree(menuPtr->platformData);
+ menuPtr->platformData = NULL;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SetMenuCascade --
+ *
+ * Does any cleanup to change a menu from a normal to a cascade.
+ *
+ * Results:
+ * Standard Tcl error.
+ *
+ * Side effects:
+ * The mac menu id is reset.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+SetMenuCascade(
+ TkMenu *menuPtr) /* The menu we are setting up to be a
+ * cascade. */
+{
+ MenuHandle macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
+ MenuID newMenuID, menuID = GetMenuID(macMenuHdl);
+ int error = TCL_OK;
+
+ if (menuID >= 256) {
+ error = TkMacOSXGetNewMenuID(menuPtr->interp, menuPtr, 1, &newMenuID);
+ if (error == TCL_OK) {
+ TkMacOSXFreeMenuID(menuID);
+ SetMenuID(macMenuHdl,newMenuID);
+ }
+ }
+ return error;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDestroyMenuEntry --
+ *
+ * Cleans up platform-specific menu entry items.
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * All platform-specific allocations are freed up.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDestroyMenuEntry(
+ TkMenuEntry *mePtr) /* The common structure for the menu entry. */
+{
+ TkMenu *menuPtr = mePtr->menuPtr;
+
+ ckfree(mePtr->platformEntryData);
+ if ((menuPtr->platformData != NULL)
+ && !(menuPtr->menuFlags & MENU_RECONFIGURE_PENDING)) {
+ menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
+ Tcl_DoWhenIdle(ReconfigureMacintoshMenu, menuPtr);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetEntryText --
+ *
+ * Given a menu entry, gives back the text that should go in it.
+ * Separators should be done by the caller, as they have to be handled
+ * specially. This is primarily used to do a substitution between "..."
+ * and the ellipsis character which looks nicer.
+ *
+ * Results:
+ * itemText points to the new text for the item.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+GetEntryText(
+ TkMenuEntry *mePtr, /* A pointer to the menu entry. */
+ Tcl_DString *dStringPtr) /* The DString to put the text into. This
+ * will be initialized by this routine. */
+{
+#ifdef USE_TK_MDEF
+ const int useMDEF = ((MacMenu *) mePtr->menuPtr->platformData)->useMDEF;
+#endif
+ int noLabel = (mePtr->labelPtr == NULL || mePtr->labelLength == 0);
+
+ Tcl_DStringInit(dStringPtr);
+ if (mePtr->type == TEAROFF_ENTRY && (useMDEF || noLabel)) {
+ Tcl_DStringAppend(dStringPtr, "(Tear-off)", -1);
+ } else if (mePtr->imagePtr != NULL && (useMDEF || noLabel) &&
+ mePtr->compound == COMPOUND_NONE) {
+ Tcl_DStringAppend(dStringPtr, "(Image)", -1);
+ } else if (mePtr->bitmapPtr != NULL && (useMDEF || noLabel) &&
+ mePtr->compound == COMPOUND_NONE) {
+ Tcl_DStringAppend(dStringPtr, "(Pixmap)", -1);
+ } else if (noLabel) {
+ /*
+ * The Mac menu manager does not like null strings.
+ */
+
+ Tcl_DStringAppend(dStringPtr, " ", -1);
+ } else {
+ int length;
+ char *text = Tcl_GetStringFromObj(mePtr->labelPtr, &length);
+ char *dStringText;
+ int i;
+
+ for (i = 0; *text; text++, i++) {
+ if ((*text == '.') && (*(text+1) == '.') && (*(text+2) == '.')) {
+ Tcl_DStringAppend(dStringPtr, menuSymbols[ELLIPSIS_SYMBOL].utf,
+ menuSymbols[ELLIPSIS_SYMBOL].utfLen);
+ i += menuSymbols[ELLIPSIS_SYMBOL].utfLen - 1;
+ text += 2;
+ } else {
+ Tcl_DStringSetLength(dStringPtr,
+ Tcl_DStringLength(dStringPtr) + 1);
+ dStringText = Tcl_DStringValue(dStringPtr);
+ dStringText[i] = *text;
+ }
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * FindMarkCharacter --
+ *
+ * Finds the Macintosh mark character based on the font of the item. We
+ * calculate a good mark character based on the font that this item is
+ * rendered in.
+ *
+ * Results:
+ * Mark char.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+char
+FindMarkCharacter(
+ TkMenuEntry *mePtr) /* The entry we are finding the character
+ * for. */
+{
+ static const char markChars[] = {kCheckCharCode, kDiamondCharCode,
+ kBulletCharCode, '-', kCheckCharCode};
+ const char *markChar = markChars;
+ int i = sizeof(markChars);
+ Tk_Font tkfont;
+
+ tkfont = Tk_GetFontFromObj(mePtr->menuPtr->tkwin,
+ (mePtr->fontPtr == NULL) ? mePtr->menuPtr->fontPtr
+ : mePtr->fontPtr);
+
+ while (--i) {
+ if (!TkMacOSXIsCharacterMissing(tkfont, *markChar)) {
+ break;
+ }
+ markChar++;
+ }
+ return *markChar;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetUtfMarkCharacter --
+ *
+ * Get the utf8 string for the given mark character, taking into account
+ * the special menu font char codes.
+ *
+ * Results:
+ * Length of returned utf8 string.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+GetUtfMarkCharacter(
+ char markChar,
+ const char **markUtfPtr)
+{
+ const MenuSymbol *ms = menuSymbols;
+ int len = 0;
+
+ while (ms->unicode) {
+ if (ms->charCode && ms->charCode == markChar) {
+ *markUtfPtr = ms->utf;
+ len = ms->utfLen;
+ break;
+ }
+ ms++;
+ }
+ if (!len) {
+ static char markUtf[TCL_UTF_MAX + 1];
+
+ Tcl_ExternalToUtf(NULL, TkMacOSXCarbonEncoding, &markChar, 1, 0, NULL,
+ markUtf, TCL_UTF_MAX + 1, NULL, &len, NULL);
+ *markUtfPtr = markUtf;
+ }
+ return len;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ParseAccelerators --
+ *
+ * Parse menu accelerator string.
+ *
+ * Results:
+ * Accelerator flags.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+ParseAccelerators(
+ const char **accelStringPtr,
+ int *modifierNumPtr,
+ Tcl_UniChar *modifierUniChars,
+ int *modifierWidth)
+{
+ struct Modif {
+ const char *name;
+ const size_t len;
+ const int flag, symbol;
+ };
+#define MODIF(n, f) { #n, sizeof(#n)-1, ENTRY_##f##_ACCEL, f##_SYMBOL }
+ static const struct Modif modifs[] = {
+ MODIF(Control, CONTROL),
+ MODIF(Ctrl, CONTROL),
+ MODIF(Option, OPTION),
+ MODIF(Opt, OPTION),
+ MODIF(Alt, OPTION),
+ MODIF(Shift, SHIFT),
+ MODIF(Command, COMMAND),
+ MODIF(Cmd, COMMAND),
+ MODIF(Meta, COMMAND),
+ { NULL, 0, 0, 0}
+ };
+#undef MODIF
+ const char *accelString = *accelStringPtr;
+ int flags = 0, num = 0, seen = 0, width = 0;
+ const struct Modif *m;
+
+ while (1) {
+ m = modifs;
+ while (m->name) {
+ int l = m->len;
+
+ if (!strncasecmp(accelString, m->name, l) &&
+ (accelString[l] == '-' || accelString[l] == '+')) {
+ flags |= m->flag;
+ accelString += l+1;
+ break;
+ }
+ m++;
+ }
+ if (!m->name || !*accelString) {
+ break;
+ }
+ }
+ m = modifs;
+ while (m->name && num < MODIFIER_NUM) {
+ if (flags & m->flag && !(seen & m->flag)) {
+ modifierUniChars[num++] = menuSymbols[m->symbol].unicode;
+ width += menuSymbols[m->symbol].width;
+ seen |= m->flag;
+ }
+ m++;
+ }
+ *accelStringPtr = accelString;
+ *modifierNumPtr = num;
+ *modifierWidth = width;
+ return flags;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpConfigureMenuEntry --
+ *
+ * Processes configurations for menu entries.
+ *
+ * Results:
+ * Returns standard TCL result. If TCL_ERROR is returned, then the
+ * interp's result contains an error message.
+ *
+ * Side effects:
+ * Configuration information get set for mePtr; old resources get freed,
+ * if any need it.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpConfigureMenuEntry(
+ TkMenuEntry *mePtr) /* Information about menu entry; may or may
+ * not already have values for some fields. */
+{
+ TkMenu *menuPtr = mePtr->menuPtr;
+ EntryGeometry *geometryPtr = (EntryGeometry *) mePtr->platformEntryData;
+
+ /*
+ * Cascade menus have to have menu IDs of less than 256. So we need to
+ * change the child menu if this has been configured for a cascade item.
+ */
+
+ if (mePtr->type == CASCADE_ENTRY) {
+ if ((mePtr->childMenuRefPtr != NULL)
+ && (mePtr->childMenuRefPtr->menuPtr != NULL)) {
+ MenuHandle childMenuHdl = ((MacMenu *) mePtr
+ ->childMenuRefPtr->menuPtr->platformData)->menuHdl;
+
+ if (childMenuHdl != NULL) {
+ int error = SetMenuCascade(mePtr->childMenuRefPtr->menuPtr);
+
+ if (error != TCL_OK) {
+ return error;
+ }
+
+ if (menuPtr->menuType == MENUBAR) {
+ CFStringRef cfStr = CFStringCreateWithCString(NULL,
+ (!(mePtr->labelPtr) ? "" :
+ Tcl_GetString(mePtr->labelPtr)),
+ kCFStringEncodingUTF8);
+
+ if (cfStr) {
+ SetMenuTitleWithCFString(childMenuHdl, cfStr);
+ CFRelease(cfStr);
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * We need to parse the accelerator string. If it has the strings for
+ * Command, Control, Shift or Option, we need to flag it so we can draw
+ * the symbols for it. We also need to precalcuate the position of the
+ * first real character we are drawing.
+ */
+
+ if (0 == mePtr->accelLength) {
+ geometryPtr->accelTextStart = -1;
+ } else {
+ const char *accelString = (mePtr->accelPtr == NULL) ? ""
+ : Tcl_GetString(mePtr->accelPtr);
+ const char *accelStart = accelString;
+
+ mePtr->entryFlags &= ~ENTRY_ACCEL_MASK;
+ mePtr->entryFlags |= ParseAccelerators(&accelString,
+ &geometryPtr->modifierNum, geometryPtr->modifierUniChars,
+ &geometryPtr->modifierWidth);
+ geometryPtr->accelTextStart = (ptrdiff_t)(accelString - accelStart);
+ }
+
+ if (!(menuPtr->menuFlags & MENU_RECONFIGURE_PENDING)) {
+ menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
+ Tcl_DoWhenIdle(ReconfigureMacintoshMenu, menuPtr);
+ }
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ReconfigureIndividualMenu --
+ *
+ * This routine redoes the guts of the menu. It works from a base item
+ * and offset, so that a regular menu will just have all of its items
+ * added, but the help menu will have all of its items appended after the
+ * apple-defined items.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The Macintosh menu handle is updated
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+ReconfigureIndividualMenu(
+ TkMenu *menuPtr, /* The menu we are affecting. */
+ MenuHandle macMenuHdl, /* The macintosh menu we are affecting. Will
+ * not necessarily be menuPtr->platformData
+ * because this could be the help menu. */
+ int base) /* The last index that we do not want touched.
+ * 0 for normal menus; # of system help menu
+ * items for help menus. */
+{
+ int count;
+ int index;
+ TkMenuEntry *mePtr;
+ int parentDisabled = 0;
+
+#ifdef TK_MAC_DEBUG_MENUS
+ /*
+ * Carbon-internal menu debugging (c.f. Technote 2124)
+ */
+
+ TkMacOSXInitNamedDebugSymbol(HIToolbox, void, DebugPrintMenu,
+ MenuRef menu);
+ if (DebugPrintMenu) {
+ DebugPrintMenu(macMenuHdl);
+ }
+#endif
+
+ mePtr = GetParentMenuEntry(menuPtr);
+ if (mePtr && mePtr->state == ENTRY_DISABLED) {
+ parentDisabled = 1;
+ }
+
+ /*
+ * First, we get rid of all of the old items.
+ */
+
+ count = CountMenuItems(macMenuHdl);
+ for (index = base; index < count; index++) {
+ DeleteMenuItem(macMenuHdl, base + 1);
+ }
+
+ count = menuPtr->numEntries;
+
+ for (index = 1; index <= count; index++) {
+ mePtr = menuPtr->entries[index - 1];
+
+ /*
+ * We have to do separators separately because SetMenuItemText does
+ * not parse meta-characters.
+ */
+
+ if (mePtr->type == SEPARATOR_ENTRY) {
+ AppendMenuItemTextWithCFString(macMenuHdl, NULL,
+ kMenuItemAttrSeparator | kMenuItemAttrDisabled, 0, NULL);
+ } else {
+ Tcl_DString itemTextDString;
+ CFStringRef cfStr;
+
+ GetEntryText(mePtr, &itemTextDString);
+ cfStr = CFStringCreateWithCString(NULL,
+ Tcl_DStringValue(&itemTextDString), kCFStringEncodingUTF8);
+ if (cfStr) {
+ AppendMenuItemTextWithCFString(macMenuHdl, cfStr, 0, 0, NULL);
+ CFRelease(cfStr);
+ } else {
+ AppendMenuItemTextWithCFString(macMenuHdl, CFSTR ("<Error>"),
+ 0, 0, NULL);
+ }
+ Tcl_DStringFree(&itemTextDString);
+
+ /*
+ * Set enabling and disabling correctly.
+ */
+
+ if (parentDisabled || (mePtr->state == ENTRY_DISABLED)) {
+ DisableMenuItem(macMenuHdl, base + index);
+ } else {
+ EnableMenuItem(macMenuHdl, base + index);
+ }
+
+ /*
+ * Set the check mark for check entries and radio entries.
+ */
+
+ SetItemMark(macMenuHdl, base + index, 0);
+ if ((mePtr->type == CHECK_BUTTON_ENTRY)
+ || (mePtr->type == RADIO_BUTTON_ENTRY)) {
+ CheckMenuItem(macMenuHdl, base + index, (mePtr->entryFlags
+ & ENTRY_SELECTED) && mePtr->indicatorOn);
+ if (mePtr->indicatorOn
+ && (mePtr->entryFlags & ENTRY_SELECTED)) {
+ SetItemMark(macMenuHdl, base + index,
+ FindMarkCharacter(mePtr));
+ }
+ }
+
+ if (mePtr->type == CASCADE_ENTRY) {
+ if ((mePtr->childMenuRefPtr != NULL)
+ && (mePtr->childMenuRefPtr->menuPtr != NULL)) {
+ MenuHandle childMenuHdl =
+ ((MacMenu *) mePtr->childMenuRefPtr
+ ->menuPtr->platformData)->menuHdl;
+
+ if (childMenuHdl != NULL) {
+ ChkErr(SetMenuItemHierarchicalID, macMenuHdl,
+ base + index, GetMenuID(childMenuHdl));
+ }
+
+ /*
+ * If we changed the highligthing of this menu, its
+ * children all have to be reconfigured so that their
+ * state will be reflected in the menubar.
+ */
+
+ if (!(mePtr->childMenuRefPtr->menuPtr->menuFlags
+ & MENU_RECONFIGURE_PENDING)) {
+ mePtr->childMenuRefPtr->menuPtr->menuFlags
+ |= MENU_RECONFIGURE_PENDING;
+ Tcl_DoWhenIdle(ReconfigureMacintoshMenu,
+ mePtr->childMenuRefPtr->menuPtr);
+ }
+ }
+ }
+
+ if ((mePtr->type != CASCADE_ENTRY) && (mePtr->accelPtr != NULL)) {
+ int accelLen, modifiers = 0, hasCmd = 0;
+ EntryGeometry *geometryPtr = (EntryGeometry *)
+ mePtr->platformEntryData;
+ int offset = geometryPtr->accelTextStart;
+ char *accel = Tcl_GetStringFromObj(mePtr->accelPtr, &accelLen);
+
+ accelLen -= offset;
+ accel += offset;
+ if (mePtr->entryFlags & ENTRY_OPTION_ACCEL) {
+ modifiers |= kMenuOptionModifier;
+ }
+ if (mePtr->entryFlags & ENTRY_SHIFT_ACCEL) {
+ modifiers |= kMenuShiftModifier;
+ }
+ if (mePtr->entryFlags & ENTRY_CONTROL_ACCEL) {
+ modifiers |= kMenuControlModifier;
+ }
+ if (mePtr->entryFlags & ENTRY_COMMAND_ACCEL) {
+ hasCmd = 1;
+ }
+ if (accelLen == 1) {
+ if (hasCmd || (modifiers != 0 && modifiers !=
+ kMenuShiftModifier)) {
+ SetItemCmd(macMenuHdl, base + index, accel[0]);
+ if (!hasCmd) {
+ modifiers |= kMenuNoCommandModifier;
+ }
+ }
+ } else {
+ /*
+ * Convert from accelerator names to Carbon menu glyphs.
+ */
+
+ struct Glyph {
+ const char *name;
+ const size_t len;
+ const char glyph;
+ };
+#define GLYPH(n, g) { #n, sizeof(#n)-1, kMenu##g##Glyph }
+ static const struct Glyph glyphs[] = {
+ GLYPH(PageUp, PageUp),
+ GLYPH(PageDown, PageDown),
+ GLYPH(Left, LeftArrow),
+ GLYPH(Right, RightArrow),
+ GLYPH(Up, UpArrow),
+ GLYPH(Down, DownArrow),
+ GLYPH(Escape, Escape),
+ GLYPH(Clear, Clear),
+ GLYPH(Enter, Enter),
+ GLYPH(Backspace,DeleteLeft),
+ GLYPH(Space, Space),
+ GLYPH(Tab, TabRight),
+ GLYPH(Delete, DeleteRight),
+ GLYPH(Home, NorthwestArrow),
+ GLYPH(End, SoutheastArrow),
+ GLYPH(Return, Return),
+ GLYPH(Help, Help),
+ GLYPH(Power, Power),
+ { NULL, 0, 0}
+ };
+#undef GLYPH
+ const struct Glyph *g = glyphs;
+ char glyph = 0;
+
+ if (accel[0] == 'F' && accelLen < 4 &&
+ (accel[1] > '0' && accel[1] <= '9')) {
+ int fkey = accel[1] - '0';
+
+ if (accelLen == 3) {
+ if (accel[2] >= '0' && accel[2] <= '9') {
+ fkey = 10 * fkey + (accel[2] - '0');
+ } else {
+ fkey = 0;
+ }
+ }
+ if (fkey >= 1 && fkey <= 12) {
+ glyph = kMenuF1Glyph + fkey - 1;
+ } else if (fkey >= 13 && fkey <= 15) {
+ glyph = kMenuF13Glyph + fkey - 13;
+ }
+ } else while (g->name) {
+ if (accel[0] == g->name[0] &&
+ (size_t)accelLen == g->len &&
+ !strncasecmp(accel, g->name, g->len)) {
+ glyph = g->glyph;
+ break;
+ }
+ g++;
+ }
+ if (glyph) {
+ ChkErr(SetMenuItemKeyGlyph, macMenuHdl, base + index,
+ glyph);
+ if (!hasCmd) {
+ modifiers |= kMenuNoCommandModifier;
+ }
+ geometryPtr->accelGlyph = glyph;
+ }
+ }
+ ChkErr(SetMenuItemModifiers, macMenuHdl, base + index,
+ modifiers);
+ }
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ReconfigureMacintoshMenu --
+ *
+ * Rebuilds the Macintosh MenuHandle items from the menu. Called usually
+ * as an idle handler, but can be called synchronously if the menu is
+ * about to be posted.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Configuration information get set for mePtr; old resources get freed,
+ * if any need it.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+ReconfigureMacintoshMenu(
+ ClientData clientData) /* Information about menu entry; may or may
+ * not already have values for some fields. */
+{
+ TkMenu *menuPtr = clientData;
+ MenuHandle macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
+ MenuHandle helpMenuHdl = NULL;
+
+ menuPtr->menuFlags &= ~MENU_RECONFIGURE_PENDING;
+
+ if (NULL == macMenuHdl) {
+ return;
+ }
+
+ ReconfigureIndividualMenu(menuPtr, macMenuHdl, 0);
+
+ if (GetMenuID(macMenuHdl) == currentHelpMenuID) {
+ MenuItemIndex helpIndex;
+
+ HMGetHelpMenu(&helpMenuHdl,&helpIndex);
+ if (helpMenuHdl != NULL) {
+ ReconfigureIndividualMenu(menuPtr, helpMenuHdl, helpIndex - 1);
+ }
+ }
+
+ if (menuPtr->menuType == MENUBAR) {
+ if (!(menuBarFlags & MENUBAR_REDRAW_PENDING)) {
+ Tcl_DoWhenIdle(DrawMenuBarWhenIdle, NULL);
+ menuBarFlags |= MENUBAR_REDRAW_PENDING;
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CompleteIdlers --
+ *
+ * Completes all idle handling so that the menus are in sync when the
+ * user invokes them with the mouse.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The Macintosh menu handles are flushed out.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+CompleteIdlers(
+ TkMenu *menuPtr) /* The menu we are completing. */
+{
+ int i;
+
+ if (menuPtr->menuFlags & MENU_RECONFIGURE_PENDING) {
+ Tcl_CancelIdleCall(ReconfigureMacintoshMenu, menuPtr);
+ ReconfigureMacintoshMenu(menuPtr);
+ }
+
+ for (i = 0; i < menuPtr->numEntries; i++) {
+ if ((menuPtr->entries[i]->type == CASCADE_ENTRY) &&
+ (menuPtr->entries[i]->childMenuRefPtr != NULL) &&
+ (menuPtr->entries[i]->childMenuRefPtr->menuPtr != NULL)) {
+ CompleteIdlers(menuPtr->entries[i]->childMenuRefPtr->menuPtr);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpPostMenu --
+ *
+ * Posts a menu on the screen
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The menu is posted and handled.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpPostMenu(
+ Tcl_Interp *interp, /* The interpreter this menu lives in */
+ TkMenu *menuPtr, /* The menu we are posting */
+ int x, /* The global x-coordinate of the top, left-
+ * hand corner of where the menu is supposed
+ * to be posted. */
+ int y) /* The global y-coordinate */
+{
+ MenuHandle macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
+ long popUpResult;
+ int result;
+
+ if (inPostMenu > 0) {
+ Tcl_AppendResult(interp,
+ "Cannot call post menu while already posting menu", NULL);
+ result = TCL_ERROR;
+ } else {
+ short menuID;
+ Window window;
+ int oldWidth = menuPtr->totalWidth;
+
+ inPostMenu++;
+ result = TkPreprocessMenu(menuPtr);
+
+ /*
+ * The post commands could have deleted the menu, which means we are
+ * dead and should go away.
+ */
+
+ if (result != TCL_OK || !menuPtr->tkwin) {
+ goto endPostMenu;
+ }
+
+ CompleteIdlers(menuPtr);
+ if (menuBarFlags & MENUBAR_REDRAW_PENDING) {
+ Tcl_CancelIdleCall(DrawMenuBarWhenIdle, NULL);
+ DrawMenuBarWhenIdle(NULL);
+ }
+ RecursivelyInsertMenu(menuPtr);
+
+ TkMacOSXTrackingLoop(1);
+ popUpResult = PopUpMenuSelect(macMenuHdl, y, x, menuPtr->active);
+ TkMacOSXTrackingLoop(0);
+ menuPtr->totalWidth = oldWidth;
+
+ /*
+ * Simulate the mouse up.
+ */
+
+ window = Tk_WindowId(menuPtr->tkwin);
+ TkGenerateButtonEventForXPointer(window);
+
+ /*
+ * Dispatch the command.
+ */
+
+ menuID = HiWord(popUpResult);
+ if (menuID != 0) {
+ result = TkMacOSXDispatchMenuEvent(menuID, LoWord(popUpResult));
+ }
+
+endPostMenu:
+ inPostMenu--;
+ }
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpMenuNewEntry --
+ *
+ * Adds a pointer to a new menu entry structure with the platform-
+ * specific fields filled in. The Macintosh uses the platformEntryData
+ * field of the TkMenuEntry record to store geometry information.
+ *
+ * Results:
+ * Standard TCL error.
+ *
+ * Side effects:
+ * Storage gets allocated. New menu entry data is put into the
+ * platformEntryData field of the mePtr.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpMenuNewEntry(
+ TkMenuEntry *mePtr) /* The menu we are adding an entry to */
+{
+ EntryGeometry *geometryPtr = ckalloc(sizeof(EntryGeometry));
+ TkMenu *menuPtr = mePtr->menuPtr;
+
+ geometryPtr->accelTextStart = 0;
+ geometryPtr->accelTextWidth = 0;
+ geometryPtr->nonAccelMargin = 0;
+ geometryPtr->modifierWidth = 0;
+ geometryPtr->modifierNum = 0;
+ geometryPtr->accelGlyph = 0;
+ mePtr->platformEntryData = (TkMenuPlatformEntryData) geometryPtr;
+ if (!(menuPtr->menuFlags & MENU_RECONFIGURE_PENDING)) {
+ menuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
+ Tcl_DoWhenIdle(ReconfigureMacintoshMenu, menuPtr);
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_MacOSXTurnOffMenus --
+ *
+ * Turns off all the menu drawing code. This is more than just disabling
+ * the "menu" command, this means that Tk will NEVER touch the menubar.
+ * It is needed in the Plugin, where Tk does not own the menubar.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A flag is set which will disable all menu drawing.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_MacOSXTurnOffMenus(void)
+{
+ gNoTkMenus = 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawMenuBarWhenIdle --
+ *
+ * Update the menu bar next time there is an idle event.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Menu bar is redrawn.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+DrawMenuBarWhenIdle(
+ ClientData clientData) /* ignored here */
+{
+ TkMenuReferences *menuRefPtr;
+ TkMenu *appleMenuPtr, *helpMenuPtr, *menuBarPtr = NULL;
+ MenuHandle macMenuHdl;
+ Tcl_HashEntry *hashEntryPtr;
+
+ /*
+ * If we have been turned off, exit.
+ */
+
+ if (gNoTkMenus) {
+ return;
+ }
+
+ /*
+ * We need to clear the apple and help menus of any extra items.
+ */
+
+ if (currentAppleMenuID != 0) {
+ hashEntryPtr = Tcl_FindHashEntry(&commandTable,
+ (char*)(intptr_t)currentAppleMenuID);
+ appleMenuPtr = Tcl_GetHashValue(hashEntryPtr);
+ TkpDestroyMenu(appleMenuPtr);
+ TkpNewMenu(appleMenuPtr);
+ appleMenuPtr->menuFlags &= ~MENU_APPLE_MENU;
+ appleMenuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
+ Tcl_DoWhenIdle(ReconfigureMacintoshMenu, appleMenuPtr);
+ }
+
+ if (currentHelpMenuID != 0) {
+ hashEntryPtr = Tcl_FindHashEntry(&commandTable,
+ (char*)(intptr_t)currentHelpMenuID);
+ helpMenuPtr = Tcl_GetHashValue(hashEntryPtr);
+ TkpDestroyMenu(helpMenuPtr);
+ TkpNewMenu(helpMenuPtr);
+ helpMenuPtr->menuFlags &= ~MENU_HELP_MENU;
+ helpMenuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
+ Tcl_DoWhenIdle(ReconfigureMacintoshMenu, helpMenuPtr);
+ }
+
+ /*
+ * We need to find the clone of this menu that is the menubar. Once we do
+ * that, for every cascade in the menu, we need to insert the Mac menu in
+ * the Mac menubar. Finally, we need to redraw the menubar.
+ */
+
+ menuRefPtr = NULL;
+ if (currentMenuBarName != NULL) {
+ menuRefPtr = TkFindMenuReferences(currentMenuBarInterp,
+ currentMenuBarName);
+ }
+ if (menuRefPtr) {
+ TkMenu *menuPtr;
+ TkMenu *cascadeMenuPtr;
+ char *appleMenuName, *helpMenuName;
+ int appleIndex = -1, helpIndex = -1, i;
+
+ menuPtr = menuRefPtr->menuPtr;
+ if (menuPtr != NULL) {
+ TkMenuReferences *specialMenuRefPtr;
+ TkMenuEntry *specialEntryPtr;
+
+ appleMenuName = ckalloc(strlen(currentMenuBarName) + 1 +
+ strlen(".apple") + 1);
+ sprintf(appleMenuName, "%s.apple", Tk_PathName(menuPtr->tkwin));
+ specialMenuRefPtr = TkFindMenuReferences(currentMenuBarInterp,
+ appleMenuName);
+ if ((specialMenuRefPtr != NULL)
+ && (specialMenuRefPtr->menuPtr != NULL)) {
+ for (specialEntryPtr = specialMenuRefPtr->parentEntryPtr;
+ specialEntryPtr != NULL;
+ specialEntryPtr = specialEntryPtr->nextCascadePtr) {
+ if (specialEntryPtr->menuPtr == menuPtr) {
+ appleIndex = specialEntryPtr->index;
+ break;
+ }
+ }
+ }
+ ckfree(appleMenuName);
+
+ helpMenuName = ckalloc(strlen(currentMenuBarName) + 1 +
+ strlen(".help") + 1);
+ sprintf(helpMenuName, "%s.help", Tk_PathName(menuPtr->tkwin));
+ specialMenuRefPtr = TkFindMenuReferences(currentMenuBarInterp,
+ helpMenuName);
+ if ((specialMenuRefPtr != NULL)
+ && (specialMenuRefPtr->menuPtr != NULL)) {
+ for (specialEntryPtr = specialMenuRefPtr->parentEntryPtr;
+ specialEntryPtr != NULL;
+ specialEntryPtr = specialEntryPtr->nextCascadePtr) {
+ if (specialEntryPtr->menuPtr == menuPtr) {
+ helpIndex = specialEntryPtr->index;
+ break;
+ }
+ }
+ }
+ ckfree(helpMenuName);
+ }
+
+ for (menuBarPtr = menuPtr;
+ (menuBarPtr != NULL) && (menuBarPtr->menuType != MENUBAR);
+ menuBarPtr = menuBarPtr->nextInstancePtr) {
+ /*
+ * Null loop body.
+ */
+ }
+
+ if (menuBarPtr) {
+ if (menuBarPtr->tearoff != menuPtr->tearoff) {
+ if (menuBarPtr->tearoff) {
+ appleIndex = (-1 == appleIndex) ? appleIndex
+ : appleIndex + 1;
+ helpIndex = (-1 == helpIndex) ? helpIndex
+ : helpIndex + 1;
+ } else {
+ appleIndex = (-1 == appleIndex) ? appleIndex
+ : appleIndex - 1;
+ helpIndex = (-1 == helpIndex) ? helpIndex
+ : helpIndex - 1;
+ }
+ }
+ ClearMenuBar();
+
+ if (appleIndex == -1) {
+ InsertMenu(tkAppleMenu, 0);
+ currentAppleMenuID = 0;
+ tkCurrentAppleMenu = tkAppleMenu;
+ } else {
+ short appleID;
+
+ appleMenuPtr = menuBarPtr->entries[appleIndex]
+ ->childMenuRefPtr->menuPtr;
+ TkpDestroyMenu(appleMenuPtr);
+ TkMacOSXGetNewMenuID(appleMenuPtr->interp, appleMenuPtr, 0,
+ &appleID);
+ macMenuHdl = NewMenu(appleID, "\p\024");
+ appleMenuPtr->platformData = ckalloc(sizeof(MacMenu));
+ ((MacMenu *)appleMenuPtr->platformData)->menuHdl
+ = macMenuHdl;
+ appleMenuPtr->menuFlags |= MENU_APPLE_MENU;
+ if (!(appleMenuPtr->menuFlags
+ & MENU_RECONFIGURE_PENDING)) {
+ appleMenuPtr->menuFlags |= MENU_RECONFIGURE_PENDING;
+ Tcl_DoWhenIdle(ReconfigureMacintoshMenu, appleMenuPtr);
+ }
+ InsertMenu(macMenuHdl, 0);
+ RecursivelyInsertMenu(appleMenuPtr);
+ currentAppleMenuID = appleID;
+ tkCurrentAppleMenu = macMenuHdl;
+ }
+ if (helpIndex == -1) {
+ currentHelpMenuID = 0;
+ }
+
+ for (i = 0; i < menuBarPtr->numEntries; i++) {
+ if (i == appleIndex) {
+ if (menuBarPtr->entries[i]->state == ENTRY_DISABLED) {
+ DisableMenuItem(((MacMenu *) menuBarPtr->entries[i]
+ ->childMenuRefPtr->menuPtr
+ ->platformData)->menuHdl, 0);
+ } else {
+ EnableMenuItem(((MacMenu *) menuBarPtr->entries[i]
+ ->childMenuRefPtr->menuPtr
+ ->platformData)->menuHdl, 0);
+ }
+ continue;
+ } else if (i == helpIndex) {
+ TkMenu *helpMenuPtr = menuBarPtr->entries[i]
+ ->childMenuRefPtr->menuPtr;
+
+ if (helpMenuPtr == NULL) {
+ continue;
+ }
+ helpMenuPtr->menuFlags |= MENU_HELP_MENU;
+ if (!(helpMenuPtr->menuFlags
+ & MENU_RECONFIGURE_PENDING)) {
+ helpMenuPtr->menuFlags
+ |= MENU_RECONFIGURE_PENDING;
+ Tcl_DoWhenIdle(ReconfigureMacintoshMenu, helpMenuPtr);
+ }
+ macMenuHdl =
+ ((MacMenu *) helpMenuPtr->platformData)->menuHdl;
+ currentHelpMenuID = GetMenuID(macMenuHdl);
+ } else if (menuBarPtr->entries[i]->type
+ == CASCADE_ENTRY) {
+ if ((menuBarPtr->entries[i]->childMenuRefPtr != NULL)
+ && menuBarPtr->entries[i]->childMenuRefPtr
+ ->menuPtr != NULL) {
+ cascadeMenuPtr = menuBarPtr->entries[i]
+ ->childMenuRefPtr->menuPtr;
+ macMenuHdl = ((MacMenu *) cascadeMenuPtr
+ ->platformData)->menuHdl;
+ DeleteMenu(GetMenuID(macMenuHdl));
+ InsertMenu(macMenuHdl, 0);
+ RecursivelyInsertMenu(cascadeMenuPtr);
+ if (menuBarPtr->entries[i]->state == ENTRY_DISABLED) {
+ DisableMenuItem(((MacMenu *) menuBarPtr->entries[i]
+ ->childMenuRefPtr->menuPtr
+ ->platformData)->menuHdl, 0);
+ } else {
+ EnableMenuItem(((MacMenu *) menuBarPtr->entries[i]
+ ->childMenuRefPtr->menuPtr
+ ->platformData)->menuHdl, 0);
+ }
+ }
+ }
+ }
+ }
+ }
+ if (!menuRefPtr || !menuBarPtr) {
+ SetDefaultMenubar();
+ }
+ DrawMenuBar();
+ menuBarFlags &= ~MENUBAR_REDRAW_PENDING;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RecursivelyInsertMenu --
+ *
+ * Puts all of the cascades of this menu in the Mac hierarchical list.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The menubar is changed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+RecursivelyInsertMenu(
+ TkMenu *menuPtr) /* All of the cascade items in this menu will
+ * be inserted into the mac menubar. */
+{
+ int i;
+ TkMenu *cascadeMenuPtr;
+ MenuHandle macMenuHdl;
+
+ for (i = 0; i < menuPtr->numEntries; i++) {
+ if (menuPtr->entries[i]->type == CASCADE_ENTRY) {
+ if ((menuPtr->entries[i]->childMenuRefPtr != NULL) &&
+ (menuPtr->entries[i]->childMenuRefPtr->menuPtr != NULL)) {
+ cascadeMenuPtr = menuPtr->entries[i]->childMenuRefPtr->menuPtr;
+ macMenuHdl =
+ ((MacMenu *) cascadeMenuPtr->platformData)->menuHdl;
+ InsertMenu(macMenuHdl, -1);
+ RecursivelyInsertMenu(cascadeMenuPtr);
+ }
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RecursivelyDeleteMenu --
+ *
+ * Takes all of the cascades of this menu out of the Mac hierarchical
+ * list.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The menubar is changed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+RecursivelyDeleteMenu(
+ TkMenu *menuPtr) /* All of the cascade items in this menu will
+ * be deleted from the mac menubar. */
+{
+ int i;
+ TkMenu *cascadeMenuPtr;
+ MenuHandle macMenuHdl;
+
+ for (i = 0; i < menuPtr->numEntries; i++) {
+ if (menuPtr->entries[i]->type == CASCADE_ENTRY) {
+ if ((menuPtr->entries[i]->childMenuRefPtr != NULL) &&
+ (menuPtr->entries[i]->childMenuRefPtr->menuPtr != NULL)) {
+ cascadeMenuPtr = menuPtr->entries[i]->childMenuRefPtr->menuPtr;
+ macMenuHdl =
+ ((MacMenu *) cascadeMenuPtr->platformData)->menuHdl;
+ DeleteMenu(GetMenuID(macMenuHdl));
+ RecursivelyDeleteMenu(cascadeMenuPtr);
+ }
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * SetDefaultMenubar --
+ *
+ * Puts the Apple, File and Edit menus into the Macintosh menubar.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The menubar is changed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+SetDefaultMenubar(void)
+{
+ if (currentMenuBarName != NULL) {
+ ckfree(currentMenuBarName);
+ currentMenuBarName = NULL;
+ }
+ currentMenuBarOwner = NULL;
+ ClearMenuBar();
+ InsertMenu(tkAppleMenu, 0);
+ InsertMenu(tkFileMenu, 0);
+ InsertMenu(tkEditMenu, 0);
+ if (!(menuBarFlags & MENUBAR_REDRAW_PENDING)) {
+ Tcl_DoWhenIdle(DrawMenuBarWhenIdle, NULL);
+ menuBarFlags |= MENUBAR_REDRAW_PENDING;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpSetMainMenubar --
+ *
+ * Puts the menu associated with a window into the menubar. Should only
+ * be called when the window is in front.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The menubar is changed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpSetMainMenubar(
+ Tcl_Interp *interp, /* The interpreter of the application */
+ Tk_Window tkwin, /* The frame we are setting up */
+ const char *menuName) /* The name of the menu to put in front. If
+ * NULL, use the default menu bar. */
+{
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ WindowRef macWindowPtr;
+ WindowRef frontNonFloating;
+
+ macWindowPtr = TkMacOSXDrawableWindow(winPtr->window);
+
+ frontNonFloating = ActiveNonFloatingWindow();
+ if ((macWindowPtr == NULL) || (macWindowPtr != frontNonFloating)) {
+ return;
+ }
+
+ if ((currentMenuBarInterp != interp) || (currentMenuBarOwner != tkwin)
+ || (currentMenuBarName == NULL) || (menuName == NULL)
+ || (strcmp(menuName, currentMenuBarName) != 0)) {
+ Tk_Window searchWindow;
+ TopLevelMenubarList *listPtr;
+
+ if (currentMenuBarName != NULL) {
+ ckfree(currentMenuBarName);
+ }
+
+ if (menuName == NULL) {
+ searchWindow = tkwin;
+ if (strcmp(Tk_Class(searchWindow), "Menu") == 0) {
+ TkMenuReferences *menuRefPtr;
+
+ menuRefPtr = TkFindMenuReferences(interp, Tk_PathName(tkwin));
+ if (menuRefPtr != NULL) {
+ TkMenu *menuPtr = menuRefPtr->menuPtr;
+
+ if (menuPtr != NULL) {
+ searchWindow = menuPtr->masterMenuPtr->tkwin;
+ }
+ }
+ }
+ for (; searchWindow != NULL;
+ searchWindow = Tk_Parent(searchWindow)) {
+ for (listPtr = windowListPtr; listPtr != NULL;
+ listPtr = listPtr->nextPtr) {
+ if (listPtr->tkwin == searchWindow) {
+ break;
+ }
+ }
+ if (listPtr != NULL) {
+ menuName = Tk_PathName(
+ listPtr->menuPtr->masterMenuPtr->tkwin);
+ break;
+ }
+ }
+ }
+
+ if (menuName == NULL) {
+ currentMenuBarName = NULL;
+ } else {
+ currentMenuBarName = ckalloc(strlen(menuName) + 1);
+ strcpy(currentMenuBarName, menuName);
+ }
+ currentMenuBarOwner = tkwin;
+ currentMenuBarInterp = interp;
+ }
+ if (!(menuBarFlags & MENUBAR_REDRAW_PENDING)) {
+ Tcl_DoWhenIdle(DrawMenuBarWhenIdle, NULL);
+ menuBarFlags |= MENUBAR_REDRAW_PENDING;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpSetWindowMenuBar --
+ *
+ * Associates a given menu with a window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * On Windows and UNIX, associates the platform menu with the platform
+ * window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpSetWindowMenuBar(
+ Tk_Window tkwin, /* The window we are setting the menu in */
+ TkMenu *menuPtr) /* The menu we are setting */
+{
+ TopLevelMenubarList *listPtr, *prevPtr;
+
+ /*
+ * Remove any existing reference to this window.
+ */
+
+ for (prevPtr = NULL, listPtr = windowListPtr;
+ listPtr != NULL;
+ prevPtr = listPtr, listPtr = listPtr->nextPtr) {
+ if (listPtr->tkwin == tkwin) {
+ break;
+ }
+ }
+
+ if (listPtr != NULL) {
+ if (prevPtr != NULL) {
+ prevPtr->nextPtr = listPtr->nextPtr;
+ } else {
+ windowListPtr = listPtr->nextPtr;
+ }
+ ckfree(listPtr);
+ }
+
+ if (menuPtr != NULL) {
+ listPtr = ckalloc(sizeof(TopLevelMenubarList));
+ listPtr->nextPtr = windowListPtr;
+ windowListPtr = listPtr;
+ listPtr->tkwin = tkwin;
+ listPtr->menuPtr = menuPtr;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * EventuallyInvokeMenu --
+ *
+ * This IdleTime callback actually invokes the menu command scheduled in
+ * TkMacOSXDispatchMenuEvent.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Commands get executed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+EventuallyInvokeMenu (
+ ClientData data)
+{
+ struct MenuCommandHandlerData *realData = data;
+ int code;
+
+ code = TkInvokeMenu(realData->menuPtr->interp, realData->menuPtr,
+ realData->index);
+
+ if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) {
+ Tcl_AddErrorInfo(realData->menuPtr->interp, "\n (menu invoke)");
+ Tcl_BackgroundException(realData->menuPtr->interp, code);
+ }
+
+ if (realData->menuPtr->tkwin) {
+ RecursivelyClearActiveMenu(realData->menuPtr);
+ }
+ TkMacOSXClearMenubarActive();
+
+ Tcl_Release(realData->menuPtr->interp);
+ Tcl_Release(realData->menuPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXDispatchMenuEvent --
+ *
+ * Given a menu id and an item, dispatches the command associated with
+ * it.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Commands for the event are scheduled for execution at idle time.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkMacOSXDispatchMenuEvent(
+ int menuID, /* The menu id of the menu we are invoking */
+ int index) /* The one-based index of the item that was
+ * selected. */
+{
+ int result = TCL_OK;
+
+ if (menuID != 0) {
+ if (menuID == kHMHelpMenuID) {
+ if (currentMenuBarOwner != NULL) {
+ TkMenuReferences *helpMenuRef;
+ char *helpMenuName = ckalloc(strlen(currentMenuBarName)
+ + strlen(".help") + 1);
+
+ sprintf(helpMenuName, "%s.help", currentMenuBarName);
+ helpMenuRef = TkFindMenuReferences(currentMenuBarInterp,
+ helpMenuName);
+ ckfree(helpMenuName);
+ if ((helpMenuRef != NULL) && (helpMenuRef->menuPtr != NULL)) {
+ MenuRef outHelpMenu;
+ MenuItemIndex itemIndex;
+ int newIndex;
+
+ HMGetHelpMenu(&outHelpMenu, &itemIndex);
+ newIndex = index - itemIndex;
+ result = TkInvokeMenu(currentMenuBarInterp,
+ helpMenuRef->menuPtr, newIndex);
+ }
+ }
+ } else {
+ Tcl_HashEntry *commandEntryPtr =
+ Tcl_FindHashEntry(&commandTable, (char*)(intptr_t)menuID);
+ if (commandEntryPtr != NULL) {
+ TkMenu *menuPtr = (TkMenu *) Tcl_GetHashValue(commandEntryPtr);
+
+ if ((currentAppleMenuID == menuID)
+ && (index > menuPtr->numEntries + 1)) {
+ /*
+ * We don't need to do anything here, the standard
+ * Application event handler will open the built-in Apple
+ * menu item for us.
+ */
+
+ result = TCL_OK;
+ } else {
+ struct MenuCommandHandlerData *data =
+ ckalloc(sizeof(struct MenuCommandHandlerData));
+
+ Tcl_Preserve(menuPtr->interp);
+ Tcl_Preserve(menuPtr);
+ data->menuPtr = menuPtr;
+ data->index = index - 1;
+ Tcl_DoWhenIdle(EventuallyInvokeMenu, data);
+ /* result = TkInvokeMenu(menuPtr->interp, menuPtr, index - 1); */
+ }
+ } else {
+ return TCL_ERROR;
+ }
+ }
+ }
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetMenuIndicatorGeometry --
+ *
+ * Gets the width and height of the indicator area of a menu.
+ *
+ * Results:
+ * widthPtr and heightPtr are set.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+GetMenuIndicatorGeometry (
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are measuring */
+ Tk_Font tkfont, /* Precalculated font */
+ const Tk_FontMetrics *fmPtr,/* Precalculated font metrics */
+ int *widthPtr, /* The resulting width */
+ int *heightPtr) /* The resulting height */
+{
+ *heightPtr = fmPtr->linespace + menuItemExtraHeight;
+ if (IS_THEME_MENU_FONT(tkfont)) {
+ *widthPtr = menuMarkColumnWidth;
+ } else {
+ const char markChar = FindMarkCharacter(mePtr);
+ const char *markUtf = NULL;
+ int len;
+
+ len = GetUtfMarkCharacter(markChar, &markUtf);
+ *widthPtr = Tk_TextWidth(tkfont, markUtf, len) + 2*menuMarkIndent;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetMenuAccelGeometry --
+ *
+ * Gets the width and height of the accelerator area of a menu.
+ *
+ * Results:
+ * widthPtr and heightPtr are set.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+GetMenuAccelGeometry (
+ TkMenu *menuPtr, /* The menu we are measuring */
+ TkMenuEntry *mePtr, /* The entry we are measuring */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int *modWidthPtr, /* The width of all of the key
+ * modifier symbols. */
+ int *textWidthPtr, /* The resulting width */
+ int *heightPtr) /* The resulting height */
+{
+ *heightPtr = fmPtr->linespace + menuItemExtraHeight;
+ *modWidthPtr = menuSymbols[COMMAND_SYMBOL].width;
+ *textWidthPtr = 0;
+ if (mePtr->type != CASCADE_ENTRY && mePtr->accelLength > 0) {
+ const char *accel = (mePtr->accelPtr == NULL) ? ""
+ : Tcl_GetString(mePtr->accelPtr);
+ EntryGeometry *geometryPtr = (EntryGeometry*)mePtr->platformEntryData;
+
+ if (IS_THEME_MENU_FONT(tkfont)) {
+ CFStringRef cfStr;
+ int width = 0;
+ int maxWidth = ((TkFont *)tkfont)->fm.maxWidth;
+
+ if (geometryPtr->accelGlyph) {
+ cfStr = CFStringCreateWithBytes(NULL,
+ (UInt8*)&geometryPtr->accelGlyph, 1,
+ kTextEncodingMacKeyboardGlyphs, false);
+ if (cfStr) {
+ width = MeasureThemeText(cfStr, kThemeMenuItemCmdKeyFont);
+ CFRelease(cfStr);
+ }
+ }
+ if ((mePtr->entryFlags & ENTRY_ACCEL_MASK) == 0) {
+ if (!geometryPtr->accelGlyph) {
+ width = Tk_TextWidth(tkfont, accel, mePtr->accelLength);
+ }
+ *textWidthPtr = maxWidth;
+ if (width < maxWidth) {
+ *modWidthPtr = 0;
+ } else {
+ *modWidthPtr = width - maxWidth;
+ }
+ } else {
+ if (!geometryPtr->accelGlyph) {
+ width = Tk_TextWidth(tkfont, accel +
+ geometryPtr->accelTextStart, mePtr->accelLength -
+ geometryPtr->accelTextStart);
+ }
+ if (width < maxWidth) {
+ *textWidthPtr = maxWidth;
+ } else {
+ *textWidthPtr = width;
+ }
+ if (geometryPtr->modifierNum) {
+ *modWidthPtr = geometryPtr->modifierWidth;
+ }
+ }
+ } else {
+ *textWidthPtr = Tk_TextWidth(tkfont, accel, mePtr->accelLength);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetTearoffEntryGeometry --
+ *
+ * Gets the width and height of of a tearoff entry.
+ *
+ * Results:
+ * widthPtr and heightPtr are set.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+GetTearoffEntryGeometry (
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are measuring */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int *widthPtr, /* The resulting width */
+ int *heightPtr) /* The resulting height */
+{
+#ifdef USE_TK_MDEF
+ const int useMDEF = ((MacMenu *) menuPtr->platformData)->useMDEF;
+#endif
+ if (useMDEF && menuPtr->menuType != TEAROFF_MENU) {
+ *heightPtr = fmPtr->linespace + menuItemExtraHeight;
+ *widthPtr = menuPtr->totalWidth;
+ } else {
+ *widthPtr = *heightPtr = 0;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetMenuSeparatorGeometry --
+ *
+ * Gets the width and height of menu separator.
+ *
+ * Results:
+ * widthPtr and heightPtr are set.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+GetMenuSeparatorGeometry(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are measuring */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */
+ int *widthPtr, /* The resulting width */
+ int *heightPtr) /* The resulting height */
+{
+ *widthPtr = 0;
+ *heightPtr = menuSeparatorHeight;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawMenuEntryIndicator --
+ *
+ * This procedure draws the indicator part of a menu.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Commands are output to X to display the menu in its
+ * current mode.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+DrawMenuEntryIndicator(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* The drawable we are drawing */
+ GC gc, /* The GC we are drawing with */
+ GC indicatorGC, /* The GC to use for the indicator */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int x, /* topleft hand corner of entry */
+ int y, /* topleft hand corner of entry */
+ int width, /* width of entry */
+ int height) /* height of entry */
+{
+ if ((mePtr->type == CHECK_BUTTON_ENTRY) ||
+ (mePtr->type == RADIO_BUTTON_ENTRY)) {
+ if (mePtr->indicatorOn && (mePtr->entryFlags & ENTRY_SELECTED)) {
+ short mark;
+ int baseline = y + (height + fmPtr->ascent - fmPtr->descent)/2;
+
+ GetItemMark(((MacMenu *) menuPtr->platformData)->menuHdl,
+ mePtr->index + 1, &mark);
+ if (IS_THEME_MENU_FONT(tkfont)) {
+ ThemeFontID font = kThemeMenuItemMarkFont;
+ TextEncoding encoding = GetApplicationTextEncoding();
+ CFStringRef cfStr;
+ ThemeDrawState drawState;
+ Rect bounds = {y, x + menuMarkIndent, y + height, x + width};
+
+ if (mark < kSpaceCharCode) {
+ font = kThemeMenuItemCmdKeyFont;
+ encoding = kTextEncodingMacKeyboardGlyphs;
+ }
+ switch (mePtr->state) {
+ case ENTRY_ACTIVE:
+ drawState = kThemeStatePressed;
+ break;
+ case ENTRY_DISABLED:
+ drawState = kThemeStateInactive;
+ break;
+ default:
+ drawState = kThemeStateActive;
+ break;
+ }
+ cfStr = CFStringCreateWithBytes(NULL, (UInt8*)&mark, 1,
+ encoding, false);
+ if (cfStr) {
+ DrawThemeText(d, gc, cfStr, font, drawState, &bounds,
+ baseline, teFlushDefault);
+ CFRelease(cfStr);
+ }
+ } else if (mark != 0) {
+ const char *markUtf = NULL;
+ int len;
+
+ len = GetUtfMarkCharacter(mark, &markUtf);
+ Tk_DrawChars(menuPtr->display, d, gc, tkfont, markUtf, len,
+ x + menuMarkIndent, baseline);
+ }
+ }
+ }
+}
+
+#ifdef USE_TK_MDEF
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawMenuBackground --
+ *
+ * If Appearance is present, draws the Appearance background
+ *
+ * Results:
+ * Nothing
+ *
+ * Side effects:
+ * Commands are output to X to display the menu in its current mode.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+DrawMenuBackground(
+ TkMenu *menuPtr,
+ Rect *menuRectPtr, /* The menu rect */
+ Drawable d) /* What we are drawing into */
+{
+ Tk_3DBorder border;
+
+ EraseMenuBackground(((MacMenu *) menuPtr->platformData)->menuHdl,
+ menuRectPtr, ((MacDrawable*)d)->context);
+ border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr);
+ Tk_Fill3DRectangle(menuPtr->tkwin, d, border,
+ menuRectPtr->left, menuRectPtr->top,
+ menuRectPtr->right - menuRectPtr->left,
+ menuRectPtr->bottom - menuRectPtr->top, 0, TK_RELIEF_FLAT);
+}
+#endif /* USE_TK_MDEF */
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawMenuEntryAccelerator --
+ *
+ * This procedure draws the accelerator part of a menu.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Commands are output to X to display the menu in its current mode.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+DrawMenuEntryAccelerator(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* The drawable we are drawing in */
+ GC gc, /* The gc to draw into */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ Tk_3DBorder activeBorder, /* border for menu background */
+ int x, /* The left side of the entry */
+ int y, /* The top of the entry */
+ int width, /* The width of the entry */
+ int height, /* The height of the entry */
+ int drawArrow) /* Whether or not to draw cascade arrow */
+{
+ if (mePtr->type != CASCADE_ENTRY && mePtr->accelLength > 0) {
+ const char *accel = (mePtr->accelPtr == NULL) ? ""
+ : Tcl_GetString(mePtr->accelPtr);
+ EntryGeometry *geometryPtr = (EntryGeometry*)mePtr->platformEntryData;
+ int leftEdge = x + width - geometryPtr->accelTextWidth;
+ int baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2;
+
+ if (IS_THEME_MENU_FONT(tkfont)) {
+ CFStringRef cfStr;
+ ThemeDrawState drawState;
+
+ switch (mePtr->state) {
+ case ENTRY_ACTIVE:
+ drawState = kThemeStatePressed;
+ break;
+ case ENTRY_DISABLED:
+ drawState = kThemeStateInactive;
+ break;
+ default:
+ drawState = kThemeStateActive;
+ break;
+ }
+ if ((mePtr->entryFlags & ENTRY_ACCEL_MASK) == 0) {
+ leftEdge -= geometryPtr->modifierWidth;
+ }
+ if (geometryPtr->accelGlyph) {
+ Rect bounds = {y, leftEdge, y + height, leftEdge +
+ geometryPtr->accelTextWidth};
+
+ cfStr = CFStringCreateWithBytes(NULL,
+ (UInt8*)&geometryPtr->accelGlyph, 1,
+ kTextEncodingMacKeyboardGlyphs, false);
+ if (cfStr) {
+ DrawThemeText(d, gc, cfStr, kThemeMenuItemCmdKeyFont,
+ drawState, &bounds, baseline, teFlushDefault);
+ CFRelease(cfStr);
+ }
+ } else {
+ Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel +
+ geometryPtr->accelTextStart, mePtr->accelLength -
+ geometryPtr->accelTextStart, leftEdge, baseline);
+ }
+ if (geometryPtr->modifierNum) {
+ Rect bounds = {y, leftEdge - geometryPtr->modifierWidth,
+ y + height, leftEdge};
+
+ cfStr = CFStringCreateWithCharacters(NULL,
+ geometryPtr->modifierUniChars,
+ geometryPtr->modifierNum);
+ if (cfStr) {
+ DrawThemeText(d, gc, cfStr, kThemeMenuItemCmdKeyFont,
+ drawState, &bounds, baseline, teFlushDefault);
+ CFRelease(cfStr);
+ }
+ }
+ } else {
+ Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel,
+ mePtr->accelLength, leftEdge, baseline);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawMenuSeparator --
+ *
+ * The menu separator is drawn.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Commands are output to X to display the menu in its current mode.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+DrawMenuSeparator(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* The drawable we are drawing into */
+ GC gc, /* The gc we are drawing with */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int x, /* left coordinate of entry */
+ int y, /* top coordinate of entry */
+ int width, /* width of entry */
+ int height) /* height of entry */
+{
+ TkMacOSXDrawingContext dc;
+ Rect r;
+
+ r.top = y;
+ r.left = x;
+ r.bottom = y + height;
+ r.right = x + width;
+ if (TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) {
+ ChkErr(DrawThemeMenuSeparator, &r);
+ TkMacOSXRestoreDrawingContext(&dc);
+ }
+}
+
+#ifdef USE_TK_MDEF
+/*
+ *----------------------------------------------------------------------
+ *
+ * AppearanceEntryDrawWrapper --
+ *
+ * It routes to the Appearance Managers DrawThemeEntry, which will then
+ * call us back after setting up the drawing context.
+ *
+ * Results:
+ * A menu entry is drawn
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+AppearanceEntryDrawWrapper(
+ TkMenuEntry *mePtr,
+ Rect *menuRectPtr,
+ MenuTrackingData *mtdPtr,
+ Drawable d,
+ Tk_FontMetrics *fmPtr,
+ Tk_Font tkfont,
+ int erase)
+{
+ MenuEntryUserData meData;
+ Rect itemRect;
+ ThemeMenuState theState;
+ ThemeMenuItemType theType;
+ Tk_FontMetrics entryMetrics;
+
+ meData.mePtr = mePtr;
+ meData.mdefDrawable = d;
+ if (mePtr->fontPtr == NULL) {
+ meData.fmPtr = fmPtr;
+ meData.tkfont = tkfont;
+ } else {
+ meData.tkfont = Tk_GetFontFromObj(mePtr->menuPtr->tkwin,
+ mePtr->fontPtr);
+ Tk_GetFontMetrics(meData.tkfont, &entryMetrics);
+ fmPtr = &entryMetrics;
+ }
+ itemRect.left = menuRectPtr->left + mePtr->x;
+ itemRect.top = mtdPtr->virtualMenuTop + mePtr->y;
+ itemRect.right = mePtr->entryFlags & ENTRY_LAST_COLUMN ?
+ menuRectPtr->right : itemRect.left + mePtr->width;
+ itemRect.bottom = itemRect.top + mePtr->height;
+
+ if (mePtr->state == ENTRY_ACTIVE) {
+ theState = kThemeMenuSelected;
+ } else if (mePtr->state == ENTRY_DISABLED) {
+ theState = kThemeMenuDisabled;
+ } else {
+ theState = kThemeMenuActive;
+ }
+ if (mePtr->type == CASCADE_ENTRY) {
+ theType = kThemeMenuItemHierarchical;
+ } else {
+ theType = kThemeMenuItemPlain;
+ }
+ if (erase) {
+ DisableScreenUpdates();
+ DrawMenuBackground(mePtr->menuPtr, &itemRect, d);
+ }
+ DrawThemeMenuItem(menuRectPtr, &itemRect,
+ mtdPtr->virtualMenuTop, mtdPtr->virtualMenuBottom, theState,
+ theType | kThemeMenuItemNoBackground, tkThemeMenuItemDrawingUPP,
+ (unsigned long) &meData);
+ if (erase) {
+ EnableScreenUpdates();
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ThemeMenuItemDrawingProc --
+ *
+ * This routine is called from the Appearance DrawThemeMenuEntry
+ *
+ * Results:
+ * A menu entry is drawn
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+pascal void
+ThemeMenuItemDrawingProc(
+ const Rect *inBounds,
+ SInt16 inDepth,
+ Boolean inIsColorDevice,
+ SInt32 inUserData)
+{
+ MenuEntryUserData *meData = (MenuEntryUserData *) inUserData;
+
+ TkpDrawMenuEntry(meData->mePtr, meData->mdefDrawable, meData->tkfont,
+ meData->fmPtr, inBounds->left, inBounds->top, inBounds->right -
+ inBounds->left + menuItemExtraWidth, inBounds->bottom -
+ inBounds->top + menuItemExtraHeight, 0, 1);
+}
+#endif /* USE_TK_MDEF */
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXHandleTearoffMenu() --
+ *
+ * This routine sees if the MDEF has set a menu and a mouse position for
+ * tearing off and makes a tearoff menu if it has.
+ *
+ * Results:
+ * menuPtr->interp will have the result of the tearoff command.
+ *
+ * Side effects:
+ * A new tearoff menu is created if it is supposed to be.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXHandleTearoffMenu(void)
+{
+ /*
+ * Obsolete: Nothing to do.
+ */
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkpInitializeMenuBindings --
+ *
+ * For every interp, initializes the bindings for Windows menus. Does
+ * nothing on Mac or XWindows.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * C-level bindings are setup for the interp which will handle Alt-key
+ * sequences for menus without beeping or interfering with user-defined
+ * Alt-key bindings.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+TkpInitializeMenuBindings(
+ Tcl_Interp *interp, /* The interpreter to set. */
+ Tk_BindingTable bindingTable)
+ /* The table to add to. */
+{
+ /*
+ * Nothing to do.
+ */
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkpComputeMenubarGeometry --
+ *
+ * This procedure is invoked to recompute the size and layout of a menu
+ * that is a menubar clone.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Fields of menu entries are changed to reflect their current positions,
+ * and the size of the menu window itself may be changed.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+TkpComputeMenubarGeometry(
+ TkMenu *menuPtr) /* Structure describing menu. */
+{
+ TkpComputeStandardMenuGeometry(menuPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawTearoffEntry --
+ *
+ * This procedure draws a tearoff entry.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Commands are output to X to display the menu in its current mode.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+DrawTearoffEntry(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* The drawable we are drawing into */
+ GC gc, /* The gc we are drawing with */
+ Tk_Font tkfont, /* The font we are drawing with */
+ const Tk_FontMetrics *fmPtr,/* The metrics we are drawing with */
+ int x, /* Left edge of entry. */
+ int y, /* Top edge of entry. */
+ int width, /* Width of entry. */
+ int height) /* Height of entry. */
+{
+ XPoint points[2];
+ int margin, segmentWidth, maxX;
+ Tk_3DBorder border;
+
+ if (menuPtr->menuType != MASTER_MENU ) {
+ return;
+ }
+
+ margin = fmPtr->linespace/2;
+ points[0].x = x;
+ points[0].y = y + height/2;
+ points[1].y = points[0].y;
+ segmentWidth = 6;
+ maxX = x + menuPtr->totalWidth - 1;
+ border = Tk_Get3DBorderFromObj(menuPtr->tkwin, menuPtr->borderPtr);
+
+ while (points[0].x < maxX) {
+ points[1].x = points[0].x + segmentWidth;
+ if (points[1].x > maxX) {
+ points[1].x = maxX;
+ }
+ Tk_Draw3DPolygon(menuPtr->tkwin, d, border, points, 2, 1,
+ TK_RELIEF_RAISED);
+ points[0].x += 2*segmentWidth;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXSetHelpMenuItemCount --
+ *
+ * Has to be called after the first call to InsertMenu. Sets up the
+ * global variable for the number of items in the unmodified help menu.
+ * NB. Nobody uses this any more, since you can get the number of system
+ * help items from HMGetHelpMenu trivially. But it is in the stubs
+ * table...
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Nothing.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXSetHelpMenuItemCount(void)
+{
+ /*
+ * Obsolete: Nothing to do.
+ */
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXMenuClick --
+ *
+ * Prepares a menubar for MenuSelect or MenuKey.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Any pending configurations of the menubar are completed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXMenuClick(void)
+{
+ TkMenu *menuPtr;
+ TkMenuReferences *menuRefPtr;
+
+ if ((currentMenuBarInterp != NULL) && (currentMenuBarName != NULL)) {
+ menuRefPtr = TkFindMenuReferences(currentMenuBarInterp,
+ currentMenuBarName);
+ for (menuPtr = menuRefPtr->menuPtr->masterMenuPtr;
+ menuPtr != NULL; menuPtr = menuPtr->nextInstancePtr) {
+ if (menuPtr->menuType == MENUBAR) {
+ CompleteIdlers(menuPtr);
+ break;
+ }
+ }
+ }
+
+ if (menuBarFlags & MENUBAR_REDRAW_PENDING) {
+ Tcl_CancelIdleCall(DrawMenuBarWhenIdle, NULL);
+ DrawMenuBarWhenIdle(NULL);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDrawMenuEntry --
+ *
+ * Draws the given menu entry at the given coordinates with the given
+ * attributes.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * X Server commands are executed to display the menu entry.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDrawMenuEntry(
+ TkMenuEntry *mePtr, /* The entry to draw */
+ Drawable d, /* What to draw into */
+ Tk_Font tkfont, /* Precalculated font for menu */
+ const Tk_FontMetrics *menuMetricsPtr,
+ /* Precalculated metrics for menu */
+ int x, /* X-coordinate of topleft of entry */
+ int y, /* Y-coordinate of topleft of entry */
+ int width, /* Width of the entry rectangle */
+ int height, /* Height of the current rectangle */
+ int strictMotif, /* Boolean flag */
+ int drawArrow) /* Whether or not to draw the cascade
+ * arrow for cascade items. Only applies
+ * to Windows. */
+{
+ GC gc;
+ TkMenu *menuPtr = mePtr->menuPtr;
+ int padY = (menuPtr->menuType == MENUBAR) ? 3 : 0;
+ GC indicatorGC;
+ Tk_3DBorder bgBorder, activeBorder;
+ const Tk_FontMetrics *fmPtr;
+ Tk_FontMetrics entryMetrics;
+ int adjustedY = y + padY;
+ int adjustedHeight = height - 2 * padY;
+
+ /*
+ * Choose the gc for drawing the foreground part of the entry. Under
+ * Appearance, we pass a null (appearanceGC) to tell ourselves not to
+ * change whatever color the appearance manager has set.
+ */
+
+ if ((mePtr->state == ENTRY_ACTIVE) && !strictMotif) {
+ gc = mePtr->activeGC;
+ if (gc == NULL) {
+ gc = menuPtr->activeGC;
+ }
+ } else {
+ TkMenuEntry *parentEntryPtr = GetParentMenuEntry(menuPtr);
+
+ if (((parentEntryPtr && parentEntryPtr->state == ENTRY_DISABLED) ||
+ (mePtr->state == ENTRY_DISABLED)) &&
+ (menuPtr->disabledFgPtr != NULL)) {
+ gc = mePtr->disabledGC;
+ if (gc == NULL) {
+ gc = menuPtr->disabledGC;
+ }
+ } else {
+ gc = mePtr->textGC;
+ if (gc == NULL) {
+ gc = menuPtr->textGC;
+ }
+ }
+ }
+
+ indicatorGC = mePtr->indicatorGC;
+ if (indicatorGC == NULL) {
+ indicatorGC = menuPtr->indicatorGC;
+ }
+
+ bgBorder = Tk_Get3DBorderFromObj(menuPtr->tkwin,
+ (mePtr->borderPtr == NULL)
+ ? menuPtr->borderPtr : mePtr->borderPtr);
+ if (strictMotif) {
+ activeBorder = bgBorder;
+ } else {
+ activeBorder = Tk_Get3DBorderFromObj(menuPtr->tkwin,
+ (mePtr->activeBorderPtr == NULL)
+ ? menuPtr->activeBorderPtr : mePtr->activeBorderPtr);
+ }
+
+ if (mePtr->fontPtr == NULL) {
+ fmPtr = menuMetricsPtr;
+ } else {
+ tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr);
+ Tk_GetFontMetrics(tkfont, &entryMetrics);
+ fmPtr = &entryMetrics;
+ }
+
+ /*
+ * Need to draw the entire background, including padding. On Unix, for
+ * menubars, we have to draw the rest of the entry taking into account the
+ * padding.
+ */
+
+ DrawMenuEntryBackground(menuPtr, mePtr, d, activeBorder, bgBorder, x, y,
+ width, height);
+
+ if (mePtr->type == SEPARATOR_ENTRY) {
+ DrawMenuSeparator(menuPtr, mePtr, d, gc, tkfont,
+ fmPtr, x, adjustedY, width, adjustedHeight);
+ } else if (mePtr->type == TEAROFF_ENTRY) {
+ DrawTearoffEntry(menuPtr, mePtr, d, gc, tkfont, fmPtr, x, adjustedY,
+ width, adjustedHeight);
+ } else {
+ DrawMenuEntryLabel(menuPtr, mePtr, d, gc, tkfont, fmPtr, x,
+ adjustedY, width, adjustedHeight);
+ DrawMenuEntryAccelerator(menuPtr, mePtr, d, gc, tkfont, fmPtr,
+ activeBorder, x, adjustedY, width, adjustedHeight, drawArrow);
+ if (!mePtr->hideMargin) {
+ DrawMenuEntryIndicator(menuPtr, mePtr, d, gc, indicatorGC, tkfont,
+ fmPtr, x, adjustedY, width, adjustedHeight);
+ }
+ }
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkpComputeStandardMenuGeometry --
+ *
+ * This procedure is invoked to recompute the size and layout of a menu
+ * that is not a menubar clone.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Fields of menu entries are changed to reflect their current positions,
+ * and the size of the menu window itself may be changed.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+TkpComputeStandardMenuGeometry(
+ TkMenu *menuPtr) /* Structure describing menu. */
+{
+ Tk_Font tkfont, menuFont;
+ Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr;
+ int x, y, height, modifierWidth, labelWidth, indicatorSpace;
+ int windowWidth, windowHeight, accelWidth, maxAccelTextWidth;
+ int i, j, lastColumnBreak, maxModifierWidth, maxWidth, nonAccelMargin;
+ int maxNonAccelMargin, maxEntryWithAccelWidth, maxEntryWithoutAccelWidth;
+ int entryWidth, maxIndicatorSpace, borderWidth, activeBorderWidth;
+ TkMenuEntry *mePtr, *columnEntryPtr;
+ EntryGeometry *geometryPtr;
+ int haveAccel = 0;
+
+ if (menuPtr->tkwin == NULL) {
+ return;
+ }
+
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr,
+ &borderWidth);
+ Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr,
+ &activeBorderWidth);
+ x = y = borderWidth;
+ indicatorSpace = labelWidth = accelWidth = maxAccelTextWidth = 0;
+ windowHeight = maxWidth = lastColumnBreak = 0;
+ maxModifierWidth = maxNonAccelMargin = 0;
+ maxEntryWithAccelWidth = maxEntryWithoutAccelWidth = 0;
+ maxIndicatorSpace = 0;
+
+ /*
+ * On the Mac especially, getting font metrics can be quite slow, so we
+ * want to do it intelligently. We are going to precalculate them and pass
+ * them down to all of the measuring and drawing routines. We will measure
+ * the font metrics of the menu once. If an entry does not have its own
+ * font set, then we give the geometry/drawing routines the menu's font
+ * and metrics. If an entry has its own font, we will measure that font
+ * and give all of the geometry/drawing the entry's font and metrics.
+ */
+
+ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
+ Tk_GetFontMetrics(menuFont, &menuMetrics);
+
+ for (i = 0; i < menuPtr->numEntries; i++) {
+ mePtr = menuPtr->entries[i];
+ if (mePtr->type == CASCADE_ENTRY || mePtr->accelLength > 0) {
+ haveAccel = 1;
+ break;
+ }
+ }
+
+ for (i = 0; i < menuPtr->numEntries; i++) {
+ mePtr = menuPtr->entries[i];
+ if (mePtr->fontPtr == NULL) {
+ tkfont = menuFont;
+ fmPtr = &menuMetrics;
+ } else {
+ tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr);
+ Tk_GetFontMetrics(tkfont, &entryMetrics);
+ fmPtr = &entryMetrics;
+ }
+
+ if ((i > 0) && mePtr->columnBreak) {
+ if (maxIndicatorSpace != 0) {
+ maxIndicatorSpace += 2;
+ }
+ for (j = lastColumnBreak; j < i; j++) {
+ columnEntryPtr = menuPtr->entries[j];
+ geometryPtr =
+ (EntryGeometry *) columnEntryPtr->platformEntryData;
+
+ columnEntryPtr->indicatorSpace = maxIndicatorSpace;
+ columnEntryPtr->width = maxIndicatorSpace + maxWidth
+ + 2 * activeBorderWidth;
+ geometryPtr->accelTextWidth = maxAccelTextWidth;
+ geometryPtr->modifierWidth = maxModifierWidth;
+ columnEntryPtr->x = x;
+ columnEntryPtr->entryFlags &= ~ENTRY_LAST_COLUMN;
+ if (maxEntryWithoutAccelWidth > maxEntryWithAccelWidth) {
+ geometryPtr->nonAccelMargin = maxEntryWithoutAccelWidth
+ - maxEntryWithAccelWidth;
+ if (geometryPtr->nonAccelMargin > maxNonAccelMargin) {
+ geometryPtr->nonAccelMargin = maxNonAccelMargin;
+ }
+ } else {
+ geometryPtr->nonAccelMargin = 0;
+ }
+ }
+ x += maxIndicatorSpace + maxWidth + 2 * borderWidth;
+ windowWidth = x;
+ maxWidth = maxIndicatorSpace = maxAccelTextWidth = 0;
+ maxModifierWidth = maxNonAccelMargin = maxEntryWithAccelWidth = 0;
+ maxEntryWithoutAccelWidth = 0;
+ lastColumnBreak = i;
+ y = borderWidth;
+ }
+ /*geometryPtr = (EntryGeometry *) mePtr->platformEntryData;*/ /* dead code */
+
+ if (mePtr->type == SEPARATOR_ENTRY) {
+ GetMenuSeparatorGeometry(menuPtr, mePtr, tkfont,
+ fmPtr, &entryWidth, &height);
+ mePtr->height = height;
+ } else if (mePtr->type == TEAROFF_ENTRY) {
+ GetTearoffEntryGeometry(menuPtr, mePtr, tkfont,
+ fmPtr, &entryWidth, &height);
+ mePtr->height = height;
+ } else {
+ /*
+ * For each entry, compute the height required by that particular
+ * entry, plus three widths: the width of the label, the width to
+ * allow for an indicator to be displayed to the left of the label
+ * (if any), and the width of the accelerator to be displayed to
+ * the right of the label (if any). These sizes depend, of course,
+ * on the type of the entry.
+ */
+
+ GetMenuLabelGeometry(mePtr, tkfont, fmPtr, &labelWidth, &height);
+ mePtr->height = height;
+
+ nonAccelMargin = 0;
+ if (mePtr->type == CASCADE_ENTRY) {
+ GetMenuAccelGeometry(menuPtr, mePtr, tkfont, fmPtr,
+ &modifierWidth, &accelWidth, &height);
+ } else if (mePtr->accelLength == 0) {
+ if (haveAccel && !mePtr->hideMargin) {
+ if (IS_THEME_MENU_FONT(tkfont)) {
+ nonAccelMargin = menuSymbols[COMMAND_SYMBOL].width;
+ } else {
+ nonAccelMargin = Tk_TextWidth(tkfont,
+ menuSymbols[COMMAND_SYMBOL].utf,
+ menuSymbols[COMMAND_SYMBOL].utfLen);
+ }
+ }
+ accelWidth = modifierWidth = 0;
+ } else {
+ GetMenuAccelGeometry(menuPtr, mePtr, tkfont,
+ fmPtr, &modifierWidth, &accelWidth, &height);
+ if (height > mePtr->height) {
+ mePtr->height = height;
+ }
+ }
+
+ if (!(mePtr->hideMargin)) {
+ GetMenuIndicatorGeometry(menuPtr, mePtr, tkfont,
+ fmPtr, &indicatorSpace, &height);
+ if (height > mePtr->height) {
+ mePtr->height = height;
+ }
+ } else {
+ indicatorSpace = 0;
+ }
+
+ if (nonAccelMargin > maxNonAccelMargin) {
+ maxNonAccelMargin = nonAccelMargin;
+ }
+ if (accelWidth > maxAccelTextWidth) {
+ maxAccelTextWidth = accelWidth;
+ }
+ if (modifierWidth > maxModifierWidth) {
+ maxModifierWidth = modifierWidth;
+ }
+ if (indicatorSpace > maxIndicatorSpace) {
+ maxIndicatorSpace = indicatorSpace;
+ }
+
+ entryWidth = labelWidth + modifierWidth + accelWidth
+ + nonAccelMargin;
+
+ if (entryWidth > maxWidth) {
+ maxWidth = entryWidth;
+ }
+
+ if (mePtr->accelLength > 0) {
+ if (entryWidth > maxEntryWithAccelWidth) {
+ maxEntryWithAccelWidth = entryWidth;
+ }
+ } else {
+ if (entryWidth > maxEntryWithoutAccelWidth) {
+ maxEntryWithoutAccelWidth = entryWidth;
+ }
+ }
+ mePtr->height += 2 * activeBorderWidth;
+ }
+ mePtr->y = y;
+ y += menuPtr->entries[i]->height + borderWidth;
+ if (y > windowHeight) {
+ windowHeight = y;
+ }
+ }
+
+ for (j = lastColumnBreak; j < menuPtr->numEntries; j++) {
+ columnEntryPtr = menuPtr->entries[j];
+ geometryPtr = (EntryGeometry *) columnEntryPtr->platformEntryData;
+
+ columnEntryPtr->indicatorSpace = maxIndicatorSpace;
+ columnEntryPtr->width = maxIndicatorSpace + maxWidth
+ + 2 * activeBorderWidth;
+ geometryPtr->accelTextWidth = maxAccelTextWidth;
+ columnEntryPtr->x = x;
+ columnEntryPtr->entryFlags |= ENTRY_LAST_COLUMN;
+ if (maxEntryWithoutAccelWidth > maxEntryWithAccelWidth) {
+ geometryPtr->nonAccelMargin = maxEntryWithoutAccelWidth
+ - maxEntryWithAccelWidth;
+ if (geometryPtr->nonAccelMargin > maxNonAccelMargin) {
+ geometryPtr->nonAccelMargin = maxNonAccelMargin;
+ }
+ } else {
+ geometryPtr->nonAccelMargin = 0;
+ }
+ }
+ windowWidth = x + maxIndicatorSpace + maxWidth
+ + 2 * activeBorderWidth + borderWidth;
+ windowHeight += borderWidth;
+
+ /*
+ * The X server doesn't like zero dimensions, so round up to at least 1 (a
+ * zero-sized menu should never really occur, anyway).
+ */
+
+ if (windowWidth <= 0) {
+ windowWidth = 1;
+ }
+ if (windowHeight <= 0) {
+ windowHeight = 1;
+ }
+ menuPtr->totalWidth = windowWidth;
+ menuPtr->totalHeight = windowHeight;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawMenuEntryLabel --
+ *
+ * This procedure draws the label part of a menu.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Commands are output to X to display the menu in its current mode.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+DrawMenuEntryLabel(
+ TkMenu *menuPtr, /* The menu we are drawing */
+ TkMenuEntry *mePtr, /* The entry we are drawing */
+ Drawable d, /* What we are drawing into */
+ GC gc, /* The gc we are drawing into */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */
+ int x, /* left edge */
+ int y, /* right edge */
+ int width, /* width of entry */
+ int height) /* height of entry */
+{
+ int imageWidth, imageHeight, textWidth = 0, textHeight = 0;
+ int indicatorSpace = mePtr->indicatorSpace;
+ int leftEdge = x + indicatorSpace;
+ int haveImage = 0, haveText = 0;
+ int imageXOffset = 0, imageYOffset = 0;
+ int textXOffset = 0, textYOffset = 0;
+ Pixmap bitmap = (Pixmap) NULL;
+ Tcl_DString itemTextDString;
+
+ /*
+ * Work out what we will need to draw first.
+ */
+
+ if (mePtr->image != NULL) {
+ Tk_SizeOfImage(mePtr->image, &imageWidth, &imageHeight);
+ haveImage = 1;
+ } else if (mePtr->bitmapPtr != NULL) {
+ bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
+ Tk_SizeOfBitmap(menuPtr->display, bitmap, &imageWidth, &imageHeight);
+ haveImage = 1;
+ }
+ if (!haveImage || (mePtr->compound != COMPOUND_NONE)) {
+ if (mePtr->labelLength > 0) {
+ GetEntryText(mePtr, &itemTextDString);
+ if (mePtr->compound != COMPOUND_NONE) {
+ textWidth = Tk_TextWidth(tkfont,
+ Tcl_DStringValue(&itemTextDString),
+ Tcl_DStringLength(&itemTextDString)) +
+ menuTextLeadingEdgeMargin + menuTextTrailingEdgeMargin;
+ textHeight = fmPtr->linespace;
+ }
+ haveText = 1;
+ }
+ }
+
+ /*
+ * Now work out what the relative positions are.
+ */
+
+ if (haveImage && haveText && (mePtr->compound != COMPOUND_NONE)) {
+ int fullWidth = (imageWidth > textWidth ? imageWidth : textWidth);
+
+ switch ((enum compound) mePtr->compound) {
+ case COMPOUND_TOP:
+ textXOffset = (fullWidth - textWidth)/2;
+ textYOffset = imageHeight/2 + 2;
+ imageXOffset = (fullWidth - imageWidth)/2;
+ imageYOffset = -textHeight/2;
+ break;
+ case COMPOUND_BOTTOM:
+ textXOffset = (fullWidth - textWidth)/2;
+ textYOffset = -imageHeight/2;
+ imageXOffset = (fullWidth - imageWidth)/2;
+ imageYOffset = textHeight/2 + 2;
+ break;
+ case COMPOUND_LEFT:
+ /*
+ * Position image in the indicator space to the left of the
+ * entries, unless this entry is a radio|check button because then
+ * the indicator space will be used.
+ */
+
+ textXOffset = imageWidth + 2 - menuTextLeadingEdgeMargin;
+ if ((mePtr->type != CHECK_BUTTON_ENTRY)
+ && (mePtr->type != RADIO_BUTTON_ENTRY)) {
+ textXOffset -= indicatorSpace;
+ imageXOffset = -indicatorSpace;
+ }
+ if (textXOffset < 0) {
+ textXOffset = 0;
+ }
+ break;
+ case COMPOUND_RIGHT:
+ imageXOffset = textWidth + 2 - menuTextTrailingEdgeMargin;
+ break;
+ case COMPOUND_CENTER:
+ textXOffset = (fullWidth - textWidth)/2;
+ imageXOffset = (fullWidth - imageWidth)/2;
+ break;
+ case COMPOUND_NONE:
+ /*
+ * Never reached.
+ */
+ break;
+ }
+ }
+
+ /*
+ * Draw label and/or bitmap or image for entry.
+ */
+
+ if (mePtr->image != NULL) {
+ if ((mePtr->selectImage != NULL)
+ && (mePtr->entryFlags & ENTRY_SELECTED)) {
+ Tk_RedrawImage(mePtr->selectImage, 0, 0, imageWidth, imageHeight,
+ d, leftEdge + imageXOffset,
+ y + (mePtr->height - imageHeight)/2 + imageYOffset);
+ } else {
+ Tk_RedrawImage(mePtr->image, 0, 0, imageWidth, imageHeight,
+ d, leftEdge + imageXOffset,
+ y + (mePtr->height - imageHeight)/2 + imageYOffset);
+ }
+ } else if (mePtr->bitmapPtr != NULL) {
+ XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0, imageWidth,
+ imageHeight, leftEdge + imageXOffset,
+ y + (mePtr->height - imageHeight)/2 + imageYOffset, 1);
+ }
+ if (haveText) {
+ int baseline = y + (height + fmPtr->ascent - fmPtr->descent)/2;
+
+ Tk_DrawChars(menuPtr->display, d, gc, tkfont,
+ Tcl_DStringValue(&itemTextDString),
+ Tcl_DStringLength(&itemTextDString),
+ leftEdge + menuTextLeadingEdgeMargin + textXOffset,
+ baseline + textYOffset);
+ Tcl_DStringFree(&itemTextDString);
+ }
+
+ if (mePtr->state == ENTRY_DISABLED) {
+ if (menuPtr->disabledFgPtr == NULL) {
+ /* XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y,
+ width, height); */
+ } else if ((mePtr->image != NULL)
+ && (menuPtr->disabledImageGC != None)) {
+ XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC,
+ leftEdge + imageXOffset,
+ y + (mePtr->height - imageHeight)/2 + imageYOffset,
+ imageWidth, imageHeight);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DrawMenuEntryBackground --
+ *
+ * This procedure draws the background part of a menu entry. Under
+ * Appearance, we only draw the background if the entry's border is set,
+ * we DO NOT inherit it from the menu...
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Commands are output to X to display the menu in its current mode.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+DrawMenuEntryBackground(
+ TkMenu *menuPtr, /* The menu we are drawing. */
+ TkMenuEntry *mePtr, /* The entry we are drawing. */
+ Drawable d, /* What we are drawing into */
+ Tk_3DBorder activeBorder, /* Border for active items */
+ Tk_3DBorder bgBorder, /* Border for the background */
+ int x, /* left edge */
+ int y, /* top edge */
+ int width, /* width of rectangle to draw */
+ int height) /* height of rectangle to draw */
+{
+ if ((menuPtr->menuType == TEAROFF_MENU)
+ || ((mePtr->state == ENTRY_ACTIVE)
+ && (mePtr->activeBorderPtr != None))
+ || ((mePtr->state != ENTRY_ACTIVE) && (mePtr->borderPtr != None))) {
+ if (mePtr->state == ENTRY_ACTIVE) {
+ bgBorder = activeBorder;
+ }
+ Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder,
+ x, y, width, height, 0, TK_RELIEF_FLAT);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetMenuLabelGeometry --
+ *
+ * Figures out the size of the label portion of a menu item.
+ *
+ * Results:
+ * widthPtr and heightPtr are filled in with the correct geometry
+ * information.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+GetMenuLabelGeometry(
+ TkMenuEntry *mePtr, /* The entry we are computing */
+ Tk_Font tkfont, /* The precalculated font */
+ const Tk_FontMetrics *fmPtr,/* The precalculated metrics */
+ int *widthPtr, /* The resulting width of the label portion */
+ int *heightPtr) /* The resulting height of the label portion */
+{
+ TkMenu *menuPtr = mePtr->menuPtr;
+ int haveImage = 0, tornOff = (menuPtr->menuType == TEAROFF_MENU);
+#ifdef USE_TK_MDEF
+ const int useMDEF = ((MacMenu *) menuPtr->platformData)->useMDEF;
+#endif
+
+ if (mePtr->image != NULL && (useMDEF || tornOff)) {
+ Tk_SizeOfImage(mePtr->image, widthPtr, heightPtr);
+ haveImage = 1;
+ } else if (mePtr->bitmapPtr != NULL && (useMDEF || tornOff)) {
+ Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr);
+ Tk_SizeOfBitmap(menuPtr->display, bitmap, widthPtr, heightPtr);
+ haveImage = 1;
+ }
+ if (!haveImage || (mePtr->compound != COMPOUND_NONE)) {
+ int textWidth = 0, textHeight = fmPtr->linespace;
+
+ if (mePtr->labelPtr != NULL) {
+ Tcl_DString itemTextDString;
+
+ GetEntryText(mePtr, &itemTextDString);
+ textWidth = Tk_TextWidth(tkfont,
+ Tcl_DStringValue(&itemTextDString),
+ Tcl_DStringLength(&itemTextDString)) +
+ menuTextLeadingEdgeMargin + menuTextTrailingEdgeMargin;
+ Tcl_DStringFree(&itemTextDString);
+
+ if (haveImage && (mePtr->compound != COMPOUND_NONE)) {
+ switch ((enum compound) mePtr->compound) {
+ int margin;
+
+ case COMPOUND_TOP:
+ case COMPOUND_BOTTOM:
+ if (textWidth > *widthPtr) {
+ *widthPtr = textWidth;
+ }
+ *heightPtr += textHeight + 2;
+ break;
+ case COMPOUND_LEFT:
+ margin = *widthPtr + 2;
+ if (margin > menuTextLeadingEdgeMargin) {
+ margin = menuTextLeadingEdgeMargin;
+ }
+ *widthPtr += textWidth + 2 - margin;
+ if (textHeight > *heightPtr) {
+ *heightPtr = textHeight;
+ }
+ break;
+ case COMPOUND_RIGHT:
+ margin = menuTextTrailingEdgeMargin;
+ *widthPtr += textWidth + 2 - margin;
+ if (textHeight > *heightPtr) {
+ *heightPtr = textHeight;
+ }
+ break;
+ case COMPOUND_CENTER:
+ if (textWidth > *widthPtr) {
+ *widthPtr = textWidth;
+ }
+ if (textHeight > *heightPtr) {
+ *heightPtr = textHeight;
+ }
+ break;
+ case COMPOUND_NONE:
+ /*
+ * Never reached.
+ */
+ break;
+ }
+ goto labelGeomDone;
+ }
+ }
+ *widthPtr = textWidth;
+ *heightPtr = textHeight;
+ }
+
+ labelGeomDone:
+ *heightPtr += menuItemExtraHeight;
+ *widthPtr += menuItemExtraWidth;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGenerateParentMenuSelectEvent --
+ *
+ * Respond to a hierarchical menu being opened.
+ *
+ * Results:
+ * True if event(s) are generated - false otherwise.
+ *
+ * Side effects:
+ * Places a virtual event on the event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkMacOSXGenerateParentMenuSelectEvent(
+ MenuRef menu)
+{
+ TkMenu *menuPtr = MenuPtrForMenuRef(menu);
+
+ if (menuPtr) {
+ TkMenuEntry *parentEntryPtr = GetParentMenuEntry(menuPtr);
+
+ if (parentEntryPtr && (menuPtr = parentEntryPtr->menuPtr)) {
+ TkActivateMenuEntry(menuPtr, parentEntryPtr->index);
+ MenuSelectEvent(menuPtr);
+ Tcl_ServiceAll();
+ return true;
+ }
+ }
+ return false;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGenerateMenuSelectEvent --
+ *
+ * Respond to a menu item being selected.
+ *
+ * Results:
+ * True if event(s) are generated - false otherwise.
+ *
+ * Side effects:
+ * Places a virtual event on the event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkMacOSXGenerateMenuSelectEvent(
+ MenuRef menu,
+ MenuItemIndex index)
+{
+ TkMenu *menuPtr = MenuPtrForMenuRef(menu);
+ int item = index - 1;
+
+ if (menuPtr) {
+ if (item < 0 || item >= menuPtr->numEntries ||
+ (menuPtr->entries[item])->state == ENTRY_DISABLED) {
+ TkActivateMenuEntry(menuPtr, -1);
+ } else {
+ TkActivateMenuEntry(menuPtr, item);
+ MenuSelectEvent(menuPtr);
+ Tcl_ServiceAll();
+ return true;
+ }
+ }
+ return false;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MenuSelectEvent --
+ *
+ * Generates a "MenuSelect" virtual event. This can be used to do
+ * context-sensitive menu help.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Places a virtual event on the event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+MenuSelectEvent(
+ TkMenu *menuPtr) /* the menu we have selected. */
+{
+ XVirtualEvent event;
+
+ bzero(&event, sizeof(XVirtualEvent));
+ event.type = VirtualEvent;
+ event.serial = menuPtr->display->request;
+ event.send_event = false;
+ event.display = menuPtr->display;
+ Tk_MakeWindowExist(menuPtr->tkwin);
+ event.event = Tk_WindowId(menuPtr->tkwin);
+ event.root = XRootWindow(menuPtr->display, 0);
+ event.subwindow = None;
+ event.time = TkpGetMS();
+
+ XQueryPointer(NULL, None, NULL, NULL, &event.x_root, &event.y_root, NULL,
+ NULL, &event.state);
+ event.same_screen = true;
+ event.name = Tk_GetUid("MenuSelect");
+ Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXClearActiveMenu --
+ *
+ * Clears Tk's active entry for the given MenuRef.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Generates <<MenuSelect>> virtual events.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXClearActiveMenu(
+ MenuRef menu)
+{
+ TkMenu *menuPtr = MenuPtrForMenuRef(menu);
+
+ if (menuPtr) {
+ RecursivelyClearActiveMenu(menuPtr);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RecursivelyClearActiveMenu --
+ *
+ * Recursively clears the active entry in the menu's cascade hierarchy.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Generates <<MenuSelect>> virtual events.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+RecursivelyClearActiveMenu(
+ TkMenu *menuPtr) /* The menu to reset. */
+{
+ int i;
+ TkMenuEntry *mePtr;
+
+ TkActivateMenuEntry(menuPtr, -1);
+ for (i = 0; i < menuPtr->numEntries; i++) {
+ mePtr = menuPtr->entries[i];
+ if (mePtr->type == CASCADE_ENTRY) {
+ if ((mePtr->childMenuRefPtr != NULL)
+ && (mePtr->childMenuRefPtr->menuPtr != NULL)) {
+ RecursivelyClearActiveMenu(mePtr->childMenuRefPtr->menuPtr);
+ }
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXClearMenubarActive --
+ *
+ * Recursively clears the active entry in the current menubar hierarchy.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Generates <<MenuSelect>> virtual events.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXClearMenubarActive(void)
+{
+ TkMenuReferences *menuBarRefPtr;
+
+ if (currentMenuBarName != NULL) {
+ menuBarRefPtr = TkFindMenuReferences(currentMenuBarInterp,
+ currentMenuBarName);
+ if ((menuBarRefPtr != NULL) && (menuBarRefPtr->menuPtr != NULL)) {
+ TkMenu *menuPtr;
+
+ for (menuPtr = menuBarRefPtr->menuPtr->masterMenuPtr;
+ menuPtr != NULL; menuPtr = menuPtr->nextInstancePtr) {
+ if (menuPtr->menuType == MENUBAR) {
+ RecursivelyClearActiveMenu(menuPtr);
+ }
+ }
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpMenuNotifyToplevelCreate --
+ *
+ * This routine reconfigures the menu and the clones indicated by
+ * menuName becuase a toplevel has been created and any system menus need
+ * to be created. Only applicable to Windows.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * An idle handler is set up to do the reconfiguration.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpMenuNotifyToplevelCreate(
+ Tcl_Interp *interp, /* The interp the menu lives in. */
+ const char *menuName) /* The name of the menu to reconfigure. */
+{
+ /*
+ * Nothing to do.
+ */
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpMenuInit --
+ *
+ * Initializes Mac-specific menu data.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Allocates a hash table.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpMenuInit(void)
+{
+ MenuSymbol *ms = menuSymbols;
+ CFStringRef cfStr;
+
+ lastMenuID = 256;
+ Tcl_InitHashTable(&commandTable, TCL_ONE_WORD_KEYS);
+ currentMenuBarOwner = NULL;
+ currentAppleMenuID = 0;
+ currentHelpMenuID = 0;
+ currentMenuBarInterp = NULL;
+ currentMenuBarName = NULL;
+ windowListPtr = NULL;
+
+#ifdef USE_TK_MDEF
+ tkThemeMenuItemDrawingUPP
+ = NewMenuItemDrawingUPP(ThemeMenuItemDrawingProc);
+ useMDEFVar = Tcl_NewStringObj("::tk::mac::useCustomMDEF", -1);
+ macMDEFDrawable.winPtr = NULL;
+ macMDEFDrawable.xOff = 0;
+ macMDEFDrawable.yOff = 0;
+ macMDEFDrawable.visRgn = NULL;
+ macMDEFDrawable.aboveVisRgn = NULL;
+ macMDEFDrawable.drawRect = CGRectNull;
+ macMDEFDrawable.referenceCount = 0;
+ macMDEFDrawable.toplevel = NULL;
+ macMDEFDrawable.flags = 0;
+ macMDEFDrawable.grafPtr = NULL;
+ macMDEFDrawable.context = NULL;
+ macMDEFDrawable.size = CGSizeZero;
+#endif
+
+ ChkErr(GetThemeMetric, kThemeMetricMenuMarkColumnWidth,
+ &menuMarkColumnWidth);
+ ChkErr(GetThemeMetric, kThemeMetricMenuMarkIndent, &menuMarkIndent);
+ ChkErr(GetThemeMetric, kThemeMetricMenuTextLeadingEdgeMargin,
+ &menuTextLeadingEdgeMargin);
+ ChkErr(GetThemeMetric, kThemeMetricMenuTextTrailingEdgeMargin,
+ &menuTextTrailingEdgeMargin);
+ ChkErr(GetThemeMenuItemExtra, kThemeMenuItemPlain, &menuItemExtraHeight,
+ &menuItemExtraWidth);
+ ChkErr(GetThemeMenuSeparatorHeight, &menuSeparatorHeight);
+
+ while (ms->unicode) {
+ ms->utfLen = Tcl_UniCharToUtf(ms->unicode, ms->utf);
+ ms->utf[ms->utfLen] = 0;
+ cfStr = CFStringCreateWithCharacters(NULL, &ms->unicode, 1);
+ if (cfStr) {
+ ms->width = MeasureThemeText(cfStr, kThemeMenuItemCmdKeyFont);
+ CFRelease(cfStr);
+ }
+ ms++;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpMenuThreadInit --
+ *
+ * Does platform-specific initialization of thread-specific menu state.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpMenuThreadInit(void)
+{
+ /*
+ * Nothing to do.
+ */
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpPreprocessMacMenu --
+ *
+ * Handle preprocessing of menubar if it exists.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * All post commands for the current menubar get executed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXPreprocessMenu(void)
+{
+ if ((currentMenuBarName != NULL) && (currentMenuBarInterp != NULL)) {
+ TkMenuReferences *mbRefPtr =
+ TkFindMenuReferences(currentMenuBarInterp,currentMenuBarName);
+
+ if ((mbRefPtr != NULL) && (mbRefPtr->menuPtr != NULL)) {
+ int code;
+
+ Tcl_Preserve(currentMenuBarInterp);
+ code = TkPreprocessMenu(mbRefPtr->menuPtr->masterMenuPtr);
+ if ((code != TCL_OK) && (code != TCL_CONTINUE)
+ && (code != TCL_BREAK)) {
+ Tcl_AddErrorInfo(currentMenuBarInterp,
+ "\n (menu preprocess)");
+ Tcl_BackgroundException(currentMenuBarInterp, code);
+ }
+ Tcl_Release(currentMenuBarInterp);
+ }
+ }
+}
+
+#ifdef USE_TK_MDEF
+#pragma mark MDEF
+/*
+ *----------------------------------------------------------------------
+ *
+ * MenuDefProc --
+ *
+ * This routine is the MDEF handler for Tk. It receives all messages for
+ * the menu and dispatches them.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * This routine causes menus to be drawn and will certainly allocate
+ * memory as a result. Also, the menu can scroll up and down, and various
+ * other interface actions can take place.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+MenuDefProc(
+ SInt16 message, /* What action are we taking? */
+ MenuRef menu, /* The menu we are working with */
+ Rect *menuRectPtr, /* A pointer to the rect for the whole
+ * menu. */
+ Point hitPt, /* Where the mouse was clicked for the
+ * appropriate messages. */
+ SInt16 *whichItem) /* Output result. Which item was hit by the
+ * user? */
+{
+ TkMenu *menuPtr;
+ Tcl_HashEntry *commandEntryPtr;
+ MenuID menuID;
+
+ menuID = GetMenuID(menu);
+ commandEntryPtr = Tcl_FindHashEntry(&commandTable, (char*)(intptr_t)menuID);
+ if (!commandEntryPtr) return;
+ menuPtr = Tcl_GetHashValue(commandEntryPtr);
+
+ switch (message) {
+ case kMenuInitMsg:
+ *whichItem = noErr;
+ break;
+ case kMenuDisposeMsg:
+ break;
+ case kMenuHiliteItemMsg:
+ HandleMenuHiliteMsg(menu, menuRectPtr, hitPt, whichItem, menuPtr);
+ break;
+ case kMenuCalcItemMsg:
+ HandleMenuCalcItemMsg(menu, menuRectPtr, hitPt, whichItem, menuPtr);
+ break;
+ case kMenuDrawItemsMsg:
+#ifdef TK_MAC_DEBUG_MENUS
+ TkMacOSXDbgMsg("MDEF: DrawItemsMsg");
+#endif
+ /*
+ * We do nothing here, because we don't support the Menu Managers
+ * dynamic item groups
+ */
+
+ break;
+ case kMenuThemeSavvyMsg:
+ *whichItem = kThemeSavvyMenuResponse;
+ break;
+ case kMenuSizeMsg:
+#ifdef TK_MAC_DEBUG_MENUS
+ TkMacOSXDbgMsg("MDEF: SizeMsg %d, %d", hitPt.h, hitPt.v);
+#endif
+ SetMenuWidth(menu, hitPt.h < menuPtr->totalWidth ? hitPt.h :
+ menuPtr->totalWidth);
+ SetMenuHeight(menu, hitPt.v < menuPtr->totalHeight ? hitPt.v :
+ menuPtr->totalHeight);
+ break;
+ case kMenuDrawMsg:
+ HandleMenuDrawMsg(menu, menuRectPtr, hitPt, whichItem, menuPtr);
+ break;
+ case kMenuFindItemMsg:
+ HandleMenuFindItemMsg(menu, menuRectPtr, hitPt, whichItem, menuPtr);
+ break;
+ case kMenuPopUpMsg:
+ HandleMenuPopUpMsg(menu, menuRectPtr, hitPt, whichItem, menuPtr);
+ break;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * HandleMenuHiliteMsg --
+ *
+ * Handles the MenuDefProc's hilite message.
+ *
+ * Results:
+ * A menu entry is drawn
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+HandleMenuHiliteMsg(
+ MenuRef menu,
+ Rect *menuRectPtr,
+ Point hitPt,
+ SInt16 *whichItem,
+ TkMenu *menuPtr)
+{
+ OSStatus err;
+ Tk_Font tkfont;
+ Tk_FontMetrics fontMetrics;
+ MDEFHiliteItemData *hidPtr = (MDEFHiliteItemData *) whichItem;
+ int oldItem = hidPtr->previousItem - 1;
+ int newItem = hidPtr->newItem - 1;
+ MenuTrackingData mtd, *mtdPtr = &mtd;
+
+#ifdef TK_MAC_DEBUG_MENUS
+ TkMacOSXDbgMsg("MDEF: HiliteMsg %d -> %d", hidPtr->previousItem,
+ hidPtr->newItem);
+#endif
+ GetPort(&macMDEFDrawable.grafPtr);
+ macMDEFDrawable.context = (CGContextRef) hidPtr->context;
+
+ err = ChkErr(GetMenuTrackingData, menu, mtdPtr);
+ if (err != noErr) {
+ return;
+ }
+
+ tkfont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
+ Tk_GetFontMetrics(tkfont, &fontMetrics);
+ if (oldItem >= 0) {
+ AppearanceEntryDrawWrapper(menuPtr->entries[oldItem], menuRectPtr,
+ mtdPtr, (Drawable) &macMDEFDrawable, &fontMetrics, tkfont, 1);
+ }
+ if (newItem >= 0) {
+ AppearanceEntryDrawWrapper(menuPtr->entries[newItem], menuRectPtr,
+ mtdPtr, (Drawable) &macMDEFDrawable, &fontMetrics, tkfont, 0);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * HandleMenuDrawMsg --
+ *
+ * Handles the MenuDefProc's draw message.
+ *
+ * Results:
+ * A menu entry is drawn
+ *
+ * Side effects:
+ * None
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+HandleMenuDrawMsg(
+ MenuRef menu,
+ Rect *menuRectPtr,
+ Point hitPt,
+ SInt16 *whichItem,
+ TkMenu *menuPtr)
+{
+ Tk_Font menuFont;
+ Tk_FontMetrics fontMetrics;
+ TkMenuEntry *mePtr;
+ int i;
+ Rect menuClipRect, bounds;
+ MDEFDrawData *ddPtr = (MDEFDrawData *) whichItem;
+ MenuTrackingData *mtdPtr = &(ddPtr->trackingData);
+ TkWindow *winPtr = (TkWindow *) menuPtr->tkwin;
+
+ GetPort(&macMDEFDrawable.grafPtr);
+ GetPortBounds(macMDEFDrawable.grafPtr, &bounds);
+ macMDEFDrawable.context = (CGContextRef) ddPtr->context;
+#ifdef TK_MAC_DEBUG_MENUS
+ TkMacOSXDbgMsg("MDEF: DrawMsg %d - %d; %d - %d", menuRectPtr->top,
+ menuRectPtr->bottom, bounds.top, bounds.bottom);
+#endif
+ winPtr->changes.x = menuRectPtr->left;
+ winPtr->changes.y = menuRectPtr->top;
+ winPtr->changes.width = menuRectPtr->right - menuRectPtr->left;
+ winPtr->changes.height = menuRectPtr->bottom - menuRectPtr->top;
+ TkpClipDrawableToRect(menuPtr->display, (Drawable) &macMDEFDrawable,
+ 0, 0, -1, -1);
+#if 0
+ if (menuPtr->menuRefPtr->topLevelListPtr != NULL) {
+ menuType = kThemeMenuTypePullDown;
+ } else if (menuPtr->menuRefPtr->parentEntryPtr != NULL) {
+ menuType = kThemeMenuTypeHierarchical;
+ } else {
+ menuType = kThemeMenuTypePopUp;
+ }
+#endif
+ DrawMenuBackground(menuPtr, menuRectPtr, (Drawable) &macMDEFDrawable);
+ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
+ Tk_GetFontMetrics(menuFont, &fontMetrics);
+ menuClipRect = *menuRectPtr;
+ mtdPtr->virtualMenuBottom = mtdPtr->virtualMenuTop + menuPtr->totalHeight;
+
+ /*
+ * Next, figure out scrolling information.
+ */
+
+ if ((menuRectPtr->bottom - menuRectPtr->top) < menuPtr->totalHeight) {
+ short arrowHeight = fontMetrics.linespace + 1;
+ Rect arrowRect, eraseRect;
+ ThemeMenuState menuState = IsMenuItemEnabled(menu, 0) ?
+ kThemeMenuActive : kThemeMenuDisabled;
+
+ if (mtdPtr->virtualMenuTop < menuRectPtr->top) {
+ arrowRect = bounds;
+ /*arrowRect.top += 1;*/
+ arrowRect.bottom = arrowRect.top + arrowHeight;
+ eraseRect = arrowRect;
+ eraseRect.top = menuRectPtr->top;
+ menuClipRect.top = arrowRect.bottom;
+ ChkErr(EraseMenuBackground, menu, &eraseRect,
+ macMDEFDrawable.context);
+ ChkErr(DrawThemeMenuItem, menuRectPtr, &arrowRect,
+ mtdPtr->virtualMenuTop, mtdPtr->virtualMenuBottom,
+ menuState, kThemeMenuItemScrollUpArrow, NULL, 0);
+#ifdef TK_MAC_DEBUG_MENUS
+ TkMacOSXDbgMsg("upArrow: %d - %d, %d - %d", arrowRect.top,
+ arrowRect.bottom, arrowRect.left, arrowRect.right);
+#endif
+ }
+ if (mtdPtr->virtualMenuBottom > menuRectPtr->bottom) {
+ arrowRect = bounds;
+ arrowRect.bottom -= 1;
+ arrowRect.top = arrowRect.bottom - arrowHeight;
+ eraseRect = arrowRect;
+ eraseRect.bottom = menuRectPtr->bottom;
+ menuClipRect.bottom = arrowRect.top;
+ ChkErr(EraseMenuBackground, menu, &eraseRect,
+ macMDEFDrawable.context);
+ ChkErr(DrawThemeMenuItem, menuRectPtr, &arrowRect,
+ mtdPtr->virtualMenuTop, mtdPtr->virtualMenuBottom,
+ menuState, kThemeMenuItemScrollDownArrow, NULL, 0);
+#ifdef TK_MAC_DEBUG_MENUS
+ TkMacOSXDbgMsg("downArrow: %d - %d, %d - %d", arrowRect.top,
+ arrowRect.bottom, arrowRect.left, arrowRect.right);
+#endif
+ }
+ TkpClipDrawableToRect(menuPtr->display, (Drawable) &macMDEFDrawable,
+ menuClipRect.left, menuClipRect.top, menuClipRect.right -
+ menuClipRect.left, menuClipRect.bottom - menuClipRect.top);
+ }
+
+ /*
+ * Now, actually draw the menu. Don't draw entries that are higher than
+ * the top arrow, and don't draw entries that are lower than the bottom.
+ */
+
+ for (i = 0; i < menuPtr->numEntries; i++) {
+ mePtr = menuPtr->entries[i];
+ if (mtdPtr->virtualMenuTop + mePtr->y + mePtr->height <
+ menuClipRect.top || mtdPtr->virtualMenuTop + mePtr->y >
+ menuClipRect.bottom) {
+ continue;
+ }
+ AppearanceEntryDrawWrapper(mePtr, menuRectPtr, mtdPtr,
+ (Drawable) &macMDEFDrawable, &fontMetrics, menuFont, 0);
+ }
+ MDEFScrollFlag = 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * HandleMenuFindItemMsg --
+ *
+ * Handles the MenuDefProc's FindItems message. We have to respond by
+ * filling in the itemSelected, itemUnderMouse and itemRect fields. This
+ * is also the time to scroll the menu if it is too long to fit on the
+ * screen.
+ *
+ * Results:
+ * The Menu system is informed of the selected item & the item under the
+ * mouse.
+ *
+ * Side effects:
+ * The menu might get scrolled.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+HandleMenuFindItemMsg(
+ MenuRef menu,
+ Rect *menuRectPtr,
+ Point hitPt,
+ SInt16 *whichItem,
+ TkMenu *menuPtr)
+{
+ Tk_Font menuFont;
+ Tk_FontMetrics fontMetrics;
+ TkMenuEntry *mePtr;
+ int i, newItem = -1, itemUnderMouse = -1;
+ Rect itemRect = {0, 0, 0, 0}, menuClipRect, bounds;
+ int hasTopScroll, hasBottomScroll;
+ MDEFFindItemData *fiPtr = (MDEFFindItemData *)whichItem;
+ MenuTrackingData *mtdPtr = &(fiPtr->trackingData), topMtd;
+ enum {
+ DONT_SCROLL, DOWN_SCROLL, UP_SCROLL
+ } scrollDirection;
+ short arrowHeight;
+
+#ifdef TK_MAC_DEBUG_MENUS
+ static Point lastHitPt = {0, 0};
+
+ if (hitPt.h != lastHitPt.h || hitPt.v != lastHitPt.v) {
+ lastHitPt = hitPt;
+ TkMacOSXDbgMsg("MDEF: FindItemMsg: %d, %d", hitPt.h, hitPt.v);
+ }
+#endif
+
+ GetPort(&macMDEFDrawable.grafPtr);
+ GetPortBounds(macMDEFDrawable.grafPtr, &bounds);
+ macMDEFDrawable.context = (CGContextRef) fiPtr->context;
+
+ /*
+ * Now we need to take care of scrolling the menu.
+ */
+
+ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr);
+ Tk_GetFontMetrics(menuFont, &fontMetrics);
+ arrowHeight = fontMetrics.linespace + 1;
+ menuClipRect = *menuRectPtr;
+ hasTopScroll = mtdPtr->virtualMenuTop < menuRectPtr->top;
+ hasBottomScroll = mtdPtr->virtualMenuBottom > menuRectPtr->bottom;
+ scrollDirection = DONT_SCROLL;
+ if (hasTopScroll) {
+ menuClipRect.top = bounds.top + arrowHeight;
+ if (hitPt.v < menuClipRect.top) {
+ newItem = -1;
+ scrollDirection = DOWN_SCROLL;
+ }
+ }
+ if (hasBottomScroll) {
+ menuClipRect.bottom = bounds.bottom - 1 - arrowHeight;
+ if (hitPt.v > menuClipRect.bottom) {
+ newItem = -1;
+ scrollDirection = UP_SCROLL;
+ }
+ }
+ if (MDEFScrollFlag) {
+ scrollDirection = DONT_SCROLL;
+ MDEFScrollFlag = 0;
+ }
+ /*
+ * Don't scroll if there are other menus open above us
+ */
+ ChkErr(GetMenuTrackingData, NULL, &topMtd);
+ if (menu != topMtd.menu) {
+ scrollDirection = DONT_SCROLL;
+ }
+ if (scrollDirection == DONT_SCROLL) {
+ /*
+ * Find out which item was hit. If it is the same as the old item, we
+ * don't need to do anything.
+ */
+
+ if (PtInRect(hitPt, menuRectPtr)) {
+ for (i = 0; i < menuPtr->numEntries; i++) {
+ mePtr = menuPtr->entries[i];
+ itemRect.left = menuRectPtr->left + mePtr->x;
+ itemRect.top = mtdPtr->virtualMenuTop + mePtr->y;
+ itemRect.right = mePtr->entryFlags & ENTRY_LAST_COLUMN ?
+ menuRectPtr->right : itemRect.left + mePtr->width;
+ itemRect.bottom = itemRect.top + mePtr->height;
+ if (PtInRect(hitPt, &itemRect)) {
+ if ((mePtr->type == SEPARATOR_ENTRY)
+ || (mePtr->state == ENTRY_DISABLED)) {
+ newItem = -1;
+ itemUnderMouse = i;
+ } else {
+ TkMenuEntry *parentEntryPtr =
+ GetParentMenuEntry(menuPtr);
+
+ if (parentEntryPtr &&
+ parentEntryPtr->state == ENTRY_DISABLED) {
+ newItem = -1;
+ itemUnderMouse = i;
+ } else {
+ newItem = i;
+ itemUnderMouse = i;
+ }
+ }
+ break;
+ }
+ }
+ }
+ } else {
+ short scrollAmt;
+ unsigned long scrollDelay;
+ Rect arrowRect, eraseRect, scrolledMenuClipRect;
+ ThemeMenuState menuState = IsMenuItemEnabled(menu, 0) ?
+ kThemeMenuActive : kThemeMenuDisabled;
+ int oldItem = mtdPtr->itemSelected - 1;
+ short d;
+
+ TkpClipDrawableToRect(menuPtr->display, (Drawable) &macMDEFDrawable,
+ 0, 0, -1, -1);
+ scrollAmt = fontMetrics.linespace + menuItemExtraHeight;
+ if (scrollDirection == UP_SCROLL) {
+ scrollAmt = -scrollAmt;
+ d = hitPt.v - bounds.bottom;
+ } else {
+ d = bounds.top - hitPt.v;
+ }
+ scrollDelay = (d >= scrollAmt/2) ? 1 : 10;
+ menuClipRect = *menuRectPtr;
+ if (mtdPtr->virtualMenuTop + scrollAmt < menuRectPtr->top) {
+ arrowRect = bounds;
+ /*arrowRect.top += 1;*/
+ arrowRect.bottom = arrowRect.top + arrowHeight;
+ eraseRect = arrowRect;
+ eraseRect.top = menuRectPtr->top;
+ menuClipRect.top = arrowRect.bottom;
+ if (!hasTopScroll) {
+ ChkErr(EraseMenuBackground, menu, &eraseRect,
+ macMDEFDrawable.context);
+ ChkErr(DrawThemeMenuItem, menuRectPtr, &arrowRect,
+ mtdPtr->virtualMenuTop + scrollAmt,
+ mtdPtr->virtualMenuBottom + scrollAmt,
+ menuState, kThemeMenuItemScrollUpArrow, NULL, 0);
+#ifdef TK_MAC_DEBUG_MENUS
+ TkMacOSXDbgMsg("upArrow: %d - %d, %d - %d", arrowRect.top,
+ arrowRect.bottom, arrowRect.left, arrowRect.right);
+#endif
+ }
+ }
+ if (mtdPtr->virtualMenuBottom + scrollAmt > menuRectPtr->bottom) {
+ arrowRect = bounds;
+ arrowRect.bottom -= 1;
+ arrowRect.top = arrowRect.bottom - arrowHeight;
+ eraseRect = arrowRect;
+ eraseRect.bottom = menuRectPtr->bottom;
+ menuClipRect.bottom = arrowRect.top;
+ if (!hasBottomScroll) {
+ ChkErr(EraseMenuBackground, menu, &eraseRect,
+ macMDEFDrawable.context);
+ ChkErr(DrawThemeMenuItem, menuRectPtr, &arrowRect,
+ mtdPtr->virtualMenuTop + scrollAmt,
+ mtdPtr->virtualMenuBottom + scrollAmt,
+ menuState, kThemeMenuItemScrollDownArrow, NULL, 0);
+#ifdef TK_MAC_DEBUG_MENUS
+ TkMacOSXDbgMsg("downArrow: %d - %d, %d - %d", arrowRect.top,
+ arrowRect.bottom, arrowRect.left, arrowRect.right);
+#endif
+ }
+ }
+ TkpClipDrawableToRect(menuPtr->display, (Drawable) &macMDEFDrawable,
+ menuClipRect.left, menuClipRect.top, menuClipRect.right -
+ menuClipRect.left, menuClipRect.bottom - menuClipRect.top);
+ TkActivateMenuEntry(menuPtr, -1);
+ if (oldItem >= 0) {
+ AppearanceEntryDrawWrapper(menuPtr->entries[oldItem], menuRectPtr,
+ mtdPtr, (Drawable) &macMDEFDrawable, &fontMetrics,
+ menuFont, 1);
+ }
+ ChkErr(ScrollMenuImage, menu, &menuClipRect, 0, scrollAmt,
+ macMDEFDrawable.context);
+ mtdPtr->virtualMenuTop += scrollAmt;
+ mtdPtr->virtualMenuBottom += scrollAmt;
+ scrolledMenuClipRect = menuClipRect;
+ OffsetRect(&scrolledMenuClipRect, 0, scrollAmt);
+ menuClipRect = bounds;
+ if (mtdPtr->virtualMenuTop < menuRectPtr->top) {
+ menuClipRect.top += arrowHeight;
+ }
+ if (mtdPtr->virtualMenuBottom > menuRectPtr->bottom) {
+ menuClipRect.bottom -= arrowHeight;
+ }
+ TkpClipDrawableToRect(menuPtr->display, (Drawable) &macMDEFDrawable,
+ menuClipRect.left, menuClipRect.top, menuClipRect.right -
+ menuClipRect.left, menuClipRect.bottom - menuClipRect.top);
+ if (scrolledMenuClipRect.bottom < menuClipRect.bottom) {
+ menuClipRect.top = scrolledMenuClipRect.bottom;
+ } else if (scrolledMenuClipRect.top < menuClipRect.top) {
+ menuClipRect.bottom = scrolledMenuClipRect.top;
+ }
+ for (i = 0; i < menuPtr->numEntries; i++) {
+ mePtr = menuPtr->entries[i];
+ if (mtdPtr->virtualMenuTop + mePtr->y + mePtr->height <
+ menuClipRect.top || mtdPtr->virtualMenuTop + mePtr->y >
+ menuClipRect.bottom) {
+ continue;
+ }
+#ifdef TK_MAC_DEBUG_MENUS
+ TkMacOSXDbgMsg("Drawing item %i", i);
+#endif
+ AppearanceEntryDrawWrapper(mePtr, menuRectPtr, mtdPtr,
+ (Drawable) &macMDEFDrawable, &fontMetrics, menuFont, 1);
+ }
+ Delay(scrollDelay, NULL);
+ }
+ mtdPtr->itemSelected = newItem + 1;
+ mtdPtr->itemUnderMouse = itemUnderMouse + 1;
+ mtdPtr->itemRect = itemRect;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * HandleMenuPopUpMsg --
+ *
+ * Handles the MenuDefProc's PopUp message. The menu is posted with the
+ * selected item at the point given in hitPt.
+ *
+ * Results:
+ * A menu is posted.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+HandleMenuPopUpMsg(
+ MenuRef menu,
+ Rect *menuRectPtr,
+ Point hitPt,
+ SInt16 *whichItem,
+ TkMenu *menuPtr)
+{
+ int maxMenuHeight;
+ int oldItem;
+ Rect portRect;
+ BitMap screenBits;
+ static SInt16 menuBarHeight = 0;
+
+#ifdef TK_MAC_DEBUG_MENUS
+ TkMacOSXDbgMsg("MDEF: PopUpMsg");
+#endif
+
+ if (!menuBarHeight) {
+ ChkErr(GetThemeMenuBarHeight, &menuBarHeight);
+ }
+ GetQDGlobalsScreenBits(&screenBits);
+
+ /*
+ * Note that for some oddball reason, h and v are reversed in the point
+ * given to us by the MDEF.
+ */
+
+ oldItem = *whichItem;
+ if (oldItem >= menuPtr->numEntries) {
+ oldItem = -1;
+ }
+ portRect.top = 0;
+ portRect.bottom = 1280;
+ maxMenuHeight = screenBits.bounds.bottom - screenBits.bounds.top
+ - menuBarHeight - SCREEN_MARGIN;
+ if (menuPtr->totalHeight > maxMenuHeight) {
+ menuRectPtr->top = menuBarHeight;
+ } else {
+ int delta;
+
+ menuRectPtr->top = hitPt.h;
+ if (oldItem >= 0) {
+ menuRectPtr->top -= menuPtr->entries[oldItem]->y;
+ }
+
+ if (menuRectPtr->top < menuBarHeight) {
+ /*
+ * Displace downward if the menu would stick off the top of the
+ * screen.
+ */
+
+ menuRectPtr->top = menuBarHeight + SCREEN_MARGIN;
+ } else {
+ /*
+ * Or upward if the menu sticks off the bottom end...
+ */
+
+ delta = menuRectPtr->top + menuPtr->totalHeight - maxMenuHeight;
+ if (delta > 0) {
+ menuRectPtr->top -= delta;
+ }
+ }
+ }
+ menuRectPtr->left = hitPt.v;
+ menuRectPtr->right = menuRectPtr->left + menuPtr->totalWidth;
+ menuRectPtr->bottom = menuRectPtr->top +
+ ((maxMenuHeight < menuPtr->totalHeight)
+ ? maxMenuHeight : menuPtr->totalHeight);
+ if (menuRectPtr->top == menuBarHeight) {
+ *whichItem = hitPt.h;
+ } else {
+ *whichItem = menuRectPtr->top;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * HandleMenuCalcItemMsg --
+ *
+ * Handles the MenuDefProc's CalcItem message. It is supposed to
+ * calculate the Rect of the menu entry in whichItem in the menu, and put
+ * that in menuRectPtr. I assume this works, but I have never seen the
+ * MenuManager send this message.
+ *
+ * Results:
+ * The Menu Manager is informed of the bounding rect of a menu rect.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+HandleMenuCalcItemMsg(
+ MenuRef menu,
+ Rect *menuRectPtr,
+ Point hitPt,
+ SInt16 *whichItem,
+ TkMenu *menuPtr)
+{
+ TkMenuEntry *mePtr;
+ MenuTrackingData mtd, *mtdPtr = &mtd;
+ OSStatus err;
+ int virtualTop, item = *whichItem-1;
+
+ err = ChkErr(GetMenuTrackingData, menu, mtdPtr);
+ if (err == noErr) {
+ virtualTop = mtdPtr->virtualMenuTop;
+ } else {
+ virtualTop = 0;
+ }
+
+ if (item >= 0 && item < menuPtr->numEntries) {
+ mePtr = menuPtr->entries[item];
+ menuRectPtr->left = mePtr->x;
+ menuRectPtr->top = mePtr->y + virtualTop;
+ if (mePtr->entryFlags & ENTRY_LAST_COLUMN) {
+ menuRectPtr->right = menuPtr->totalWidth;
+ } else {
+ menuRectPtr->right = mePtr->x + mePtr->width;
+ }
+ menuRectPtr->bottom = menuRectPtr->top + mePtr->height;
+ }
+#ifdef TK_MAC_DEBUG_MENUS
+ TkMacOSXDbgMsg("MDEF: CalcItemMsg %d: %d, %d", *whichItem,
+ menuRectPtr->left, menuRectPtr->top);
+#endif
+}
+#endif /* USE_TK_MDEF */
+
+/*
+ * Local Variables:
+ * fill-column: 78
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/carbon/tkMacOSXMenubutton.c b/carbon/tkMacOSXMenubutton.c
new file mode 100644
index 0000000..9846d13
--- /dev/null
+++ b/carbon/tkMacOSXMenubutton.c
@@ -0,0 +1,950 @@
+/*
+ * tkMacOSXMenubutton.c --
+ *
+ * This file implements the Macintosh specific portion of the
+ * menubutton widget.
+ *
+ * Copyright (c) 1996 by Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkMenu.h"
+#include "tkMenubutton.h"
+#include "tkMacOSXFont.h"
+#include "tkMacOSXDebug.h"
+
+#define kShadowOffset (3) /* amount to offset shadow from frame */
+#define kTriangleWidth (11) /* width of the triangle */
+#define kTriangleHeight (6) /* height of the triangle */
+#define kTriangleMargin (5) /* margin around triangle */
+
+#define TK_POPUP_OFFSET 32 /* size of popup marker */
+
+#define FIRST_DRAW 2
+#define ACTIVE 4
+
+MODULE_SCOPE int TkMacOSXGetNewMenuID(Tcl_Interp *interp, TkMenu *menuInstPtr,
+ int cascade, short *menuIDPtr);
+MODULE_SCOPE void TkMacOSXFreeMenuID(short menuID);
+
+typedef struct {
+ SInt16 initialValue;
+ SInt16 minValue;
+ SInt16 maxValue;
+ SInt16 procID;
+ int isBevel;
+} MenuButtonControlParams;
+
+typedef struct {
+ int len;
+ Str255 title;
+ ControlFontStyleRec style;
+} ControlTitleParams;
+
+/*
+ * Declaration of Mac specific button structure.
+ */
+
+typedef struct MacMenuButton {
+ TkMenuButton info; /* Generic button info. */
+ WindowRef windowRef;
+ ControlRef userPane;
+ ControlRef control;
+ MenuRef menuRef;
+ unsigned long userPaneBackground;
+ int flags;
+ MenuButtonControlParams params;
+ ControlTitleParams titleParams;
+ ControlButtonContentInfo bevelButtonContent;
+ OpenCPicParams picParams;
+} MacMenuButton;
+
+/*
+ * Forward declarations for procedures defined later in this file:
+ */
+
+static OSStatus SetUserPaneDrawProc(ControlRef control,
+ ControlUserPaneDrawProcPtr upp);
+static OSStatus SetUserPaneSetUpSpecialBackgroundProc(ControlRef control,
+ ControlUserPaneBackgroundProcPtr upp);
+static void UserPaneDraw(ControlRef control, ControlPartCode cpc);
+static void UserPaneBackgroundProc(ControlHandle,
+ ControlBackgroundPtr info);
+static int MenuButtonInitControl (MacMenuButton *mbPtr, Rect *paneRect,
+ Rect *cntrRect );
+static void MenuButtonEventProc(ClientData clientData, XEvent *eventPtr);
+static int UpdateControlColors(MacMenuButton *mbPtr);
+static void ComputeMenuButtonControlParams(TkMenuButton *mbPtr,
+ MenuButtonControlParams * paramsPtr);
+static void ComputeControlTitleParams(TkMenuButton *mbPtr,
+ ControlTitleParams *paramsPtr);
+static void CompareControlTitleParams(ControlTitleParams *p1Ptr,
+ ControlTitleParams *p2Ptr, int *titleChanged, int *styleChanged);
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpCreateMenuButton --
+ *
+ * Allocate a new TkMenuButton structure.
+ *
+ * Results:
+ * Returns a newly allocated TkMenuButton structure.
+ *
+ * Side effects:
+ * Registers an event handler for the widget.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkMenuButton *
+TkpCreateMenuButton(
+ Tk_Window tkwin)
+{
+ MacMenuButton *mbPtr = ckalloc(sizeof(MacMenuButton));
+
+ Tk_CreateEventHandler(tkwin, ActivateMask,
+ MenuButtonEventProc, (ClientData) mbPtr);
+ mbPtr->flags = 0;
+ mbPtr->userPaneBackground = PIXEL_MAGIC << 24;
+ mbPtr->userPane = NULL;
+ mbPtr->control = NULL;
+ mbPtr->menuRef = NULL;
+ bzero(&mbPtr->params, sizeof(mbPtr->params));
+ bzero(&mbPtr->titleParams, sizeof(mbPtr->titleParams));
+
+ return (TkMenuButton *) mbPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDisplayMenuButton --
+ *
+ * This procedure is invoked to display a menubutton widget.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Commands are output to X to display the menubutton in its
+ * current mode.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDisplayMenuButton(
+ ClientData clientData) /* Information about widget. */
+{
+ TkMenuButton *butPtr = (TkMenuButton *) clientData;
+ Tk_Window tkwin = butPtr->tkwin;
+ TkWindow *winPtr;
+ Pixmap pixmap;
+ MacMenuButton *mbPtr = (MacMenuButton *) butPtr;
+ CGrafPtr destPort, savePort;
+ Boolean portChanged = false;
+ int hasImageOrBitmap = 0, width, height;
+ OSStatus err;
+ ControlButtonGraphicAlignment theAlignment;
+ Rect paneRect, cntrRect;
+ int active, enabled;
+
+ butPtr->flags &= ~REDRAW_PENDING;
+ if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
+ return;
+ }
+ pixmap = (Pixmap) Tk_WindowId(tkwin);
+ TkMacOSXSetUpClippingRgn(Tk_WindowId(tkwin));
+
+ winPtr = (TkWindow *)butPtr->tkwin;
+ paneRect.left = winPtr->privatePtr->xOff;
+ paneRect.top = winPtr->privatePtr->yOff;
+ paneRect.right = paneRect.left+Tk_Width(butPtr->tkwin);
+ paneRect.bottom = paneRect.top+Tk_Height(butPtr->tkwin);
+
+ cntrRect = paneRect;
+
+ cntrRect.left += butPtr->inset;
+ cntrRect.top += butPtr->inset;
+ cntrRect.right -= butPtr->inset;
+ cntrRect.bottom -= butPtr->inset;
+
+ if (mbPtr->userPane) {
+ MenuButtonControlParams params;
+ bzero(&params, sizeof(params));
+ ComputeMenuButtonControlParams(butPtr, &params);
+ if (
+#ifdef TK_REBUILD_TOPLEVEL
+ (winPtr->flags & TK_REBUILD_TOPLEVEL) ||
+#endif
+ bcmp(&params,&mbPtr->params,sizeof(params))) {
+ if (mbPtr->userPane) {
+ DisposeControl(mbPtr->userPane);
+ mbPtr->userPane = NULL;
+ mbPtr->control = NULL;
+ }
+ }
+ }
+ if (!mbPtr->userPane) {
+ if (MenuButtonInitControl(mbPtr, &paneRect, &cntrRect)) {
+ TkMacOSXDbgMsg("Init Control failed");
+ return;
+ }
+ }
+ SetControlBounds(mbPtr->userPane, &paneRect);
+ SetControlBounds(mbPtr->control, &cntrRect);
+
+ if (butPtr->image != None) {
+ Tk_SizeOfImage(butPtr->image, &width, &height);
+ hasImageOrBitmap = 1;
+ } else if (butPtr->bitmap != None) {
+ Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height);
+ hasImageOrBitmap = 1;
+ }
+
+ /*
+ * We need to cache the title and its style
+ */
+
+ if (!(mbPtr->flags & FIRST_DRAW)) {
+ ControlTitleParams titleParams;
+ int titleChanged;
+ int styleChanged;
+
+ ComputeControlTitleParams(butPtr, &titleParams);
+ CompareControlTitleParams(&titleParams, &mbPtr->titleParams,
+ &titleChanged, &styleChanged);
+ if (titleChanged) {
+ CFStringRef cf = CFStringCreateWithCString(NULL,
+ (char*) titleParams.title, kCFStringEncodingUTF8);
+
+ if (hasImageOrBitmap) {
+ SetControlTitleWithCFString(mbPtr->control, cf);
+ } else {
+ SetMenuItemTextWithCFString(mbPtr->menuRef, 1, cf);
+ }
+ CFRelease(cf);
+ bcopy(titleParams.title, mbPtr->titleParams.title,
+ titleParams.len + 1);
+ mbPtr->titleParams.len = titleParams.len;
+ }
+ if ((titleChanged||styleChanged) && titleParams .len) {
+ if (hasImageOrBitmap) {
+ err = ChkErr(SetControlFontStyle, mbPtr->control,
+ &titleParams.style);
+ if (err != noErr) {
+ return;
+ }
+ }
+ bcopy(&titleParams.style, &mbPtr->titleParams.style,
+ sizeof(titleParams.style));
+ }
+ }
+ if (hasImageOrBitmap) {
+ {
+ destPort = TkMacOSXGetDrawablePort(Tk_WindowId(tkwin));
+ portChanged = QDSwapPort(destPort, &savePort);
+ mbPtr->picParams.version = -2;
+ mbPtr->picParams.hRes = 0x00480000;
+ mbPtr->picParams.vRes = 0x00480000;
+ mbPtr->picParams.srcRect.top = 0;
+ mbPtr->picParams.srcRect.left = 0;
+ mbPtr->picParams.srcRect.bottom = height;
+ mbPtr->picParams.srcRect.right = width;
+ mbPtr->picParams.reserved1 = 0;
+ mbPtr->picParams.reserved2 = 0;
+ mbPtr->bevelButtonContent.contentType = kControlContentPictHandle;
+ mbPtr->bevelButtonContent.u.picture = OpenCPicture(&mbPtr->picParams);
+ if (!mbPtr->bevelButtonContent.u.picture) {
+ TkMacOSXDbgMsg("OpenCPicture failed");
+ }
+ tkPictureIsOpen = 1;
+
+ /*
+ * TO DO - There is one case where XCopyPlane calls CopyDeepMask,
+ * which does not get recorded in the picture. So the bitmap code
+ * will fail in that case.
+ */
+ }
+ if (butPtr->image != NULL) {
+ Tk_RedrawImage(butPtr->image, 0, 0, width, height, pixmap, 0, 0);
+ } else {
+ GC gc;
+
+ if (butPtr->state == STATE_DISABLED) {
+ gc = butPtr->disabledGC;
+ } else if (butPtr->state == STATE_ACTIVE) {
+ gc = butPtr->activeTextGC;
+ } else {
+ gc = butPtr->normalTextGC;
+ }
+ XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, gc, 0, 0,
+ width, height, 0, 0, 1);
+ }
+ {
+ ClosePicture();
+ tkPictureIsOpen = 0;
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+ }
+ ChkErr(SetControlData, mbPtr->control, kControlButtonPart,
+ kControlBevelButtonContentTag,
+ sizeof(ControlButtonContentInfo),
+ (char *) &mbPtr->bevelButtonContent);
+ switch (butPtr->anchor) {
+ case TK_ANCHOR_N:
+ theAlignment = kControlBevelButtonAlignTop;
+ break;
+ case TK_ANCHOR_NE:
+ theAlignment = kControlBevelButtonAlignTopRight;
+ break;
+ case TK_ANCHOR_E:
+ theAlignment = kControlBevelButtonAlignRight;
+ break;
+ case TK_ANCHOR_SE:
+ theAlignment = kControlBevelButtonAlignBottomRight;
+ break;
+ case TK_ANCHOR_S:
+ theAlignment = kControlBevelButtonAlignBottom;
+ break;
+ case TK_ANCHOR_SW:
+ theAlignment = kControlBevelButtonAlignBottomLeft;
+ break;
+ case TK_ANCHOR_W:
+ theAlignment = kControlBevelButtonAlignLeft;
+ break;
+ case TK_ANCHOR_NW:
+ theAlignment = kControlBevelButtonAlignTopLeft;
+ break;
+ case TK_ANCHOR_CENTER:
+ theAlignment = kControlBevelButtonAlignCenter;
+ break;
+ }
+
+ ChkErr(SetControlData, mbPtr->control, kControlButtonPart,
+ kControlBevelButtonGraphicAlignTag,
+ sizeof(ControlButtonGraphicAlignment), (char *) &theAlignment);
+ }
+ active = ((mbPtr->flags & ACTIVE) != 0);
+ if (active != IsControlActive(mbPtr->control)) {
+ if (active) {
+ ChkErr(ActivateControl, mbPtr->control);
+ } else {
+ ChkErr(DeactivateControl, mbPtr->control);
+ }
+ }
+ enabled = !(butPtr->state == STATE_DISABLED);
+ if (enabled != IsControlEnabled(mbPtr->control)) {
+ if (enabled) {
+ ChkErr(EnableControl, mbPtr->control);
+ } else {
+ ChkErr(DisableControl, mbPtr->control);
+ }
+ }
+ if (active && enabled) {
+ if (butPtr->state == STATE_ACTIVE) {
+ if (hasImageOrBitmap) {
+ HiliteControl(mbPtr->control, kControlButtonPart);
+ } else {
+ HiliteControl(mbPtr->control, kControlLabelPart);
+ }
+ } else {
+ HiliteControl(mbPtr->control, kControlNoPart);
+ }
+ }
+ UpdateControlColors(mbPtr);
+ if (mbPtr->flags & FIRST_DRAW) {
+ ShowControl(mbPtr->control);
+ ShowControl(mbPtr->userPane);
+ mbPtr->flags ^= FIRST_DRAW;
+ } else {
+ SetControlVisibility(mbPtr->control, true, true);
+ Draw1Control(mbPtr->userPane);
+ }
+ if (hasImageOrBitmap) {
+ if (mbPtr->bevelButtonContent.contentType ==
+ kControlContentPictHandle) {
+ KillPicture(mbPtr->bevelButtonContent.u.picture);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDestroyMenuButton --
+ *
+ * Free data structures associated with the menubutton control.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Restores the default control state.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDestroyMenuButton(
+ TkMenuButton *mbPtr)
+{
+ MacMenuButton *macMbPtr = (MacMenuButton *) mbPtr;
+
+ if (macMbPtr->userPane) {
+ DisposeControl(macMbPtr->userPane);
+ macMbPtr->userPane = NULL;
+ }
+ if (macMbPtr->menuRef) {
+ short menuID = GetMenuID(macMbPtr->menuRef);
+
+ TkMacOSXFreeMenuID(menuID);
+ DisposeMenu(macMbPtr->menuRef);
+ macMbPtr->menuRef = NULL;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpComputeMenuButtonGeometry --
+ *
+ * After changes in a menu button's text or bitmap, this procedure
+ * recomputes the menu button's geometry and passes this information
+ * along to the geometry manager for the window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The menu button's window may change size.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpComputeMenuButtonGeometry(
+ register TkMenuButton *mbPtr) /* Widget record for menu button. */
+{
+ int width, height;
+ int hasImageOrBitmap = 0;
+
+ mbPtr->inset = mbPtr->highlightWidth + mbPtr->borderWidth;
+ if (mbPtr->image != None) {
+ Tk_SizeOfImage(mbPtr->image, &width, &height);
+ hasImageOrBitmap = 1;
+ } else if (mbPtr->bitmap != None) {
+ Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height);
+ hasImageOrBitmap = 1;
+ } else {
+ hasImageOrBitmap = 0;
+ Tk_FreeTextLayout(mbPtr->textLayout);
+ mbPtr->textLayout = Tk_ComputeTextLayout(mbPtr->tkfont, mbPtr->text,
+ -1, mbPtr->wrapLength, mbPtr->justify, 0, &mbPtr->textWidth,
+ &mbPtr->textHeight);
+ width = mbPtr->textWidth;
+ height = mbPtr->textHeight;
+ if (mbPtr->width > 0) {
+ width = mbPtr->width * Tk_TextWidth(mbPtr->tkfont, "0", 1);
+ }
+ if (mbPtr->height > 0) {
+ Tk_FontMetrics fm;
+
+ Tk_GetFontMetrics(mbPtr->tkfont, &fm);
+ height = mbPtr->height * fm.linespace;
+ }
+ width += 2*mbPtr->padX;
+ height += 2*mbPtr->padY;
+ }
+ if (hasImageOrBitmap) {
+ if (mbPtr->width > 0) {
+ width = mbPtr->width;
+ }
+ if (mbPtr->height > 0) {
+ height = mbPtr->height;
+ }
+ mbPtr->inset = mbPtr->highlightWidth + 2;
+ width += (2 * mbPtr->borderWidth + 4);
+ height += (2 * mbPtr->borderWidth + 4);
+ } else {
+ width += TK_POPUP_OFFSET;
+ }
+ if (mbPtr->indicatorOn) {
+ mbPtr->indicatorHeight = kTriangleHeight;
+ mbPtr->indicatorWidth = kTriangleWidth + kTriangleMargin;
+ width += mbPtr->indicatorWidth;
+ } else {
+ mbPtr->indicatorHeight = 0;
+ mbPtr->indicatorWidth = 0;
+ }
+
+ Tk_GeometryRequest(mbPtr->tkwin, (int) (width + 2*mbPtr->inset),
+ (int) (height + 2*mbPtr->inset));
+ Tk_SetInternalBorder(mbPtr->tkwin, mbPtr->inset);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ComputeMenuButtonControlParams --
+ *
+ * This procedure computes the various parameters used
+ * when creating a Carbon control (NewControl)
+ * These are determined by the various tk menu button parameters
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Sets the control initialisation parameters
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ComputeMenuButtonControlParams(
+ TkMenuButton *mbPtr,
+ MenuButtonControlParams *paramsPtr)
+{
+ int fakeMenuID = 256;
+
+ /*
+ * Determine ProcID based on button type and dimensions
+ *
+ * We need to set minValue to some non-zero value,
+ * Otherwise, the markers do not show up
+ */
+
+ paramsPtr->minValue = kControlBehaviorMultiValueMenu;
+ paramsPtr->maxValue = 0;
+ if (mbPtr->image || mbPtr->bitmap) {
+ paramsPtr->isBevel = 1;
+ if (mbPtr->borderWidth <= 2) {
+ paramsPtr->procID = kControlBevelButtonSmallBevelProc;
+ } else if (mbPtr->borderWidth == 3) {
+ paramsPtr->procID = kControlBevelButtonNormalBevelProc;
+ } else {
+ paramsPtr->procID = kControlBevelButtonLargeBevelProc;
+ }
+ if (mbPtr->indicatorOn) {
+ paramsPtr->initialValue = fakeMenuID;
+ } else {
+ paramsPtr->initialValue = 0;
+ }
+ } else {
+ paramsPtr->isBevel = 0;
+ paramsPtr->procID = kControlPopupButtonProc
+ + kControlPopupVariableWidthVariant;
+ paramsPtr->minValue = -12345;
+ paramsPtr->maxValue = -1;
+ paramsPtr->initialValue = 0;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * returns 0 if same, 1 otherwise
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+CompareControlTitleParams(
+ ControlTitleParams *p1Ptr,
+ ControlTitleParams *p2Ptr,
+ int *titleChanged,
+ int *styleChanged)
+{
+ if (p1Ptr->len != p2Ptr->len) {
+ *titleChanged = 1;
+ } else if (bcmp(p1Ptr->title,p2Ptr->title,p1Ptr->len)) {
+ *titleChanged = 1;
+ } else {
+ *titleChanged = 0;
+ }
+
+ if (p1Ptr->len && p2Ptr->len) {
+ *styleChanged = bcmp(&p1Ptr->style, &p2Ptr->style,
+ sizeof(p2Ptr->style));
+ } else {
+ *styleChanged = p1Ptr->len||p2Ptr->len;
+ }
+}
+
+static void
+ComputeControlTitleParams(
+ TkMenuButton *butPtr,
+ ControlTitleParams *paramsPtr)
+{
+ Tk_Font font;
+
+ paramsPtr->len = TkFontGetFirstTextLayout(butPtr->textLayout, &font,
+ (char*) paramsPtr->title);
+ paramsPtr->title[paramsPtr->len] = 0;
+ if (paramsPtr->len) {
+ TkMacOSXInitControlFontStyle(font,&paramsPtr->style);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MenuButtonInitControl --
+ *
+ * This procedure initialises a Carbon control
+ *
+ * Results:
+ * 0 on success, 1 on failure.
+ *
+ * Side effects:
+ * A background pane control and the control itself is created
+ * The contol is embedded in the background control
+ * The background control is embedded in the root control
+ * of the containing window
+ * The creation parameters for the control are also computed
+ *
+ *----------------------------------------------------------------------
+ */
+int
+MenuButtonInitControl(
+ MacMenuButton *mbPtr, /* Mac button. */
+ Rect *paneRect,
+ Rect *cntrRect)
+{
+ OSStatus err;
+ TkMenuButton *butPtr = (TkMenuButton *) mbPtr;
+ SInt16 procID, initialValue, minValue, maxValue;
+ Boolean initiallyVisible;
+ SInt32 controlReference;
+ short menuID;
+ ControlRef rootControl =
+ TkMacOSXGetRootControl(Tk_WindowId(butPtr->tkwin));
+
+ mbPtr->windowRef = TkMacOSXDrawableWindow(Tk_WindowId(butPtr->tkwin));
+
+ /*
+ * Set up the user pane
+ */
+
+ initiallyVisible = false;
+ initialValue = kControlSupportsEmbedding | kControlHasSpecialBackground;
+ minValue = 0;
+ maxValue = 1;
+ procID = kControlUserPaneProc;
+ controlReference = (SInt32)mbPtr;
+ mbPtr->userPane = NewControl(mbPtr->windowRef, paneRect, "\p",
+ initiallyVisible, initialValue, minValue, maxValue, procID,
+ controlReference);
+ if (!mbPtr->userPane) {
+ TkMacOSXDbgMsg("Failed to create user pane control");
+ return 1;
+ }
+ err = ChkErr(EmbedControl, mbPtr->userPane, rootControl);
+ if (err != noErr) {
+ return 1;
+ }
+ SetUserPaneSetUpSpecialBackgroundProc(mbPtr->userPane,
+ UserPaneBackgroundProc);
+ SetUserPaneDrawProc(mbPtr->userPane,UserPaneDraw);
+ initiallyVisible = false;
+ ComputeMenuButtonControlParams(butPtr,&mbPtr->params);
+
+ /*
+ * Do this only if we are using bevel buttons.
+ */
+
+ ComputeControlTitleParams(butPtr, &mbPtr->titleParams);
+ mbPtr->control = NewControl(mbPtr->windowRef,
+ cntrRect, "\p" /* mbPtr->titleParams.title */,
+ initiallyVisible, mbPtr->params.initialValue,
+ mbPtr->params.minValue, mbPtr->params.maxValue,
+ mbPtr->params.procID, controlReference);
+ if (!mbPtr->control) {
+ TkMacOSXDbgMsg("Failed to create control of type %d",
+ mbPtr->params.procID);
+ return 1;
+ }
+ err = ChkErr(EmbedControl, mbPtr->control, mbPtr->userPane);
+ if (err != noErr ) {
+ return 1;
+ }
+ if (mbPtr->params.isBevel) {
+ CFStringRef cf = CFStringCreateWithCString(NULL,
+ (char*) mbPtr->titleParams.title, kCFStringEncodingUTF8);
+
+ SetControlTitleWithCFString(mbPtr->control, cf);
+ CFRelease(cf);
+ if (mbPtr->titleParams.len) {
+ err = ChkErr(SetControlFontStyle, mbPtr->control,
+ &mbPtr->titleParams.style);
+ if (err != noErr) {
+ return 1;
+ }
+ }
+ } else {
+ CFStringRef cfStr;
+
+ err = TkMacOSXGetNewMenuID(mbPtr->info.interp, (TkMenu *) mbPtr, 0,
+ &menuID);
+ if (err != TCL_OK) {
+ return 1;
+ }
+ err = ChkErr(CreateNewMenu, menuID, kMenuAttrDoNotUseUserCommandKeys,
+ &(mbPtr->menuRef));
+ if (err != noErr) {
+ return 1;
+ }
+ cfStr = CFStringCreateWithCString(NULL, Tk_PathName(mbPtr->info.tkwin),
+ kCFStringEncodingUTF8);
+ if (!cfStr) {
+ TkMacOSXDbgMsg("CFStringCreateWithCString failed");
+ return 1;
+ }
+ err = ChkErr(SetMenuTitleWithCFString, mbPtr->menuRef, cfStr);
+ CFRelease(cfStr);
+ if (err != noErr) {
+ return 1;
+ }
+ cfStr = CFStringCreateWithCString(NULL,
+ (char*) mbPtr->titleParams.title, kCFStringEncodingUTF8);
+ AppendMenuItemText(mbPtr->menuRef, "\px");
+ if (cfStr) {
+ SetMenuItemTextWithCFString(mbPtr->menuRef, 1, cfStr);
+ CFRelease(cfStr);
+ }
+ ChkErr(SetControlData, mbPtr->control, kControlNoPart,
+ kControlPopupButtonMenuRefTag, sizeof(mbPtr->menuRef),
+ &mbPtr->menuRef);
+ SetControlMinimum(mbPtr->control, 1);
+ SetControlMaximum(mbPtr->control, 1);
+ SetControlValue(mbPtr->control, 1);
+ }
+ mbPtr->flags |= FIRST_DRAW;
+ if (IsWindowActive(mbPtr->windowRef)) {
+ mbPtr->flags |= ACTIVE;
+ }
+ return 0;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * SetUserPane
+ *
+ * Utility function to add a UserPaneDrawProc
+ * to a userPane control. From MoreControls code
+ * from Apple DTS.
+ *
+ * Results:
+ * MacOS system error.
+ *
+ * Side effects:
+ * The user pane gets a new UserPaneDrawProc.
+ *
+ *--------------------------------------------------------------
+ */
+OSStatus
+SetUserPaneDrawProc(
+ ControlRef control,
+ ControlUserPaneDrawProcPtr upp)
+{
+ ControlUserPaneDrawUPP myControlUserPaneDrawUPP =
+ NewControlUserPaneDrawUPP(upp);
+
+ return SetControlData(control, kControlNoPart,kControlUserPaneDrawProcTag,
+ sizeof(myControlUserPaneDrawUPP), (Ptr)&myControlUserPaneDrawUPP);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * SetUserPaneSetUpSpecialBackgroundProc --
+ *
+ * Utility function to add a UserPaneBackgroundProc
+ * to a userPane control
+ *
+ * Results:
+ * MacOS system error.
+ *
+ * Side effects:
+ * The user pane gets a new UserPaneBackgroundProc.
+ *
+ *--------------------------------------------------------------
+ */
+
+OSStatus
+SetUserPaneSetUpSpecialBackgroundProc(
+ ControlRef control,
+ ControlUserPaneBackgroundProcPtr upp)
+{
+ ControlUserPaneBackgroundUPP myControlUserPaneBackgroundUPP =
+ NewControlUserPaneBackgroundUPP(upp);
+
+ return SetControlData(control, kControlNoPart,
+ kControlUserPaneBackgroundProcTag,
+ sizeof(myControlUserPaneBackgroundUPP),
+ (Ptr) &myControlUserPaneBackgroundUPP);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * UserPaneDraw --
+ *
+ * This function draws the background of the user pane that will
+ * lie under checkboxes and radiobuttons.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The user pane gets updated to the current color.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+UserPaneDraw(
+ ControlRef control,
+ ControlPartCode cpc)
+{
+ Rect contrlRect;
+ MacMenuButton * mbPtr =
+ (MacMenuButton *)(intptr_t)GetControlReference(control);
+ CGrafPtr port;
+
+ GetPort(&port);
+ GetControlBounds(control,&contrlRect);
+ TkMacOSXSetColorInPort(mbPtr->userPaneBackground, 0, NULL, port);
+ EraseRect (&contrlRect);
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * UserPaneBackgroundProc --
+ *
+ * This function sets up the background of the user pane that will
+ * lie under checkboxes and radiobuttons.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The user pane background gets set to the current color.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+UserPaneBackgroundProc(
+ ControlHandle control,
+ ControlBackgroundPtr info)
+{
+ MacMenuButton *mbPtr =
+ (MacMenuButton *)(intptr_t)GetControlReference(control);
+
+ if (info->colorDevice) {
+ CGrafPtr port;
+
+ GetPort(&port);
+ TkMacOSXSetColorInPort(mbPtr->userPaneBackground, 0, NULL, port);
+ }
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * UpdateControlColors --
+ *
+ * This function will review the colors used to display
+ * a Macintosh button. If any non-standard colors are
+ * used we create a custom palette for the button, populate
+ * with the colors for the button and install the palette.
+ *
+ * Under Appearance, we just set the pointer that will be
+ * used by the UserPaneDrawProc.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The Macintosh control may get a custom palette installed.
+ *
+ *--------------------------------------------------------------
+ */
+
+static int
+UpdateControlColors(
+ MacMenuButton *mbPtr)
+{
+ XColor *xcolor;
+ TkMenuButton * butPtr = (TkMenuButton *) mbPtr;
+
+ /*
+ * Under Appearance we cannot change the background of the
+ * button itself. However, the color we are setting is the color
+ * of the containing userPane. This will be the color that peeks
+ * around the rounded corners of the button.
+ * We make this the highlightbackground rather than the background,
+ * because if you color the background of a frame containing a
+ * button, you usually also color the highlightbackground as well,
+ * or you will get a thin grey ring around the button.
+ */
+
+ xcolor = Tk_3DBorderColor(butPtr->normalBorder);
+ mbPtr->userPaneBackground = xcolor->pixel;
+
+ return false;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * MenuButtonEventProc --
+ *
+ * This procedure is invoked by the Tk dispatcher for various
+ * events on buttons.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * When it gets exposed, it is redisplayed.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+MenuButtonEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
+{
+ TkMenuButton *buttonPtr = (TkMenuButton *) clientData;
+ MacMenuButton *mbPtr = (MacMenuButton *) clientData;
+
+ if (eventPtr->type == ActivateNotify
+ || eventPtr->type == DeactivateNotify) {
+ if ((buttonPtr->tkwin == NULL) || (!Tk_IsMapped(buttonPtr->tkwin))) {
+ return;
+ }
+ if (eventPtr->type == ActivateNotify) {
+ mbPtr->flags |= ACTIVE;
+ } else {
+ mbPtr->flags &= ~ACTIVE;
+ }
+ if ((buttonPtr->flags & REDRAW_PENDING) == 0) {
+ Tcl_DoWhenIdle(TkpDisplayMenuButton, (ClientData) buttonPtr);
+ buttonPtr->flags |= REDRAW_PENDING;
+ }
+ }
+}
diff --git a/carbon/tkMacOSXMenus.c b/carbon/tkMacOSXMenus.c
new file mode 100644
index 0000000..8509f8c
--- /dev/null
+++ b/carbon/tkMacOSXMenus.c
@@ -0,0 +1,406 @@
+/*
+ * tkMacOSXMenus.c --
+ *
+ * These calls set up and manage the menubar for the Macintosh version of
+ * Tk.
+ *
+ * Copyright (c) 1995-1996 Sun Microsystems, Inc.
+ * Copyright (c) 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+
+#define kAppleMenu 256
+#define kAppleAboutItem 1
+#define kFileMenu 2
+#define kEditMenu 3
+
+#define kSourceItem 1
+#define kDemoItem 2
+#define kCloseItem 3
+
+#define EDIT_CUT 1
+#define EDIT_COPY 2
+#define EDIT_PASTE 3
+#define EDIT_CLEAR 4
+
+MenuRef tkAppleMenu;
+MenuRef tkFileMenu;
+MenuRef tkEditMenu;
+
+static Tcl_Interp *gInterp = NULL; /* Standard menu interpreter. */
+static EventHandlerRef menuEventHandlerRef = NULL;
+
+static void GenerateEditEvent(int flag);
+static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp);
+static OSStatus MenuEventHandlerProc(EventHandlerCallRef callRef,
+ EventRef event, void *userData);
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetWidgetDemoPath --
+ *
+ * Get path to the widget demo.
+ *
+ * Results:
+ * pathObj with ref count 0.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static Tcl_Obj *
+GetWidgetDemoPath(
+ Tcl_Interp *interp)
+{
+ Tcl_Obj *libpath, *result = NULL;
+
+ libpath = Tcl_GetVar2Ex(gInterp, "tk_library", NULL, TCL_GLOBAL_ONLY);
+ if (libpath) {
+ Tcl_Obj *demo[2] = { Tcl_NewStringObj("demos", 5),
+ Tcl_NewStringObj("widget", 6) };
+
+ Tcl_IncrRefCount(libpath);
+ result = Tcl_FSJoinToPath(libpath, 2, demo);
+ Tcl_DecrRefCount(libpath);
+ }
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXHandleMenuSelect --
+ *
+ * Handles events that occur in the Menu bar.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXHandleMenuSelect(
+ MenuID theMenu,
+ MenuItemIndex theItem,
+ int optionKeyPressed)
+{
+ Tk_Window tkwin;
+ Window window;
+ TkDisplay *dispPtr;
+ Tcl_CmdInfo dummy;
+ int code;
+
+ if (theItem == 0) {
+ TkMacOSXClearMenubarActive();
+ return;
+ }
+
+ switch (theMenu) {
+ case kAppleMenu:
+ switch (theItem) {
+ case kAppleAboutItem:
+ if (optionKeyPressed || gInterp == NULL ||
+ Tcl_GetCommandInfo(gInterp, "tkAboutDialog", &dummy) == 0) {
+ TkAboutDlg();
+ } else {
+ code = Tcl_EvalEx(gInterp, "tkAboutDialog", -1,
+ TCL_EVAL_GLOBAL);
+ if (code != TCL_OK) {
+ Tcl_BackgroundException(gInterp, code);
+ }
+ Tcl_ResetResult(gInterp);
+ }
+ break;
+ }
+ break;
+ case kFileMenu:
+ switch (theItem) {
+ case kSourceItem:
+ if (gInterp) {
+ if (Tcl_EvalEx(gInterp, "tk_getOpenFile -filetypes {"
+ "{{TCL Scripts} {.tcl} TEXT} {{Text Files} {} TEXT}}",
+ -1, TCL_EVAL_GLOBAL) == TCL_OK) {
+ Tcl_Obj *path = Tcl_GetObjResult(gInterp);
+ int len;
+
+ Tcl_GetStringFromObj(path, &len);
+ if (len) {
+ Tcl_IncrRefCount(path);
+ code = Tcl_FSEvalFile(gInterp, path);
+ if (code != TCL_OK) {
+ Tcl_BackgroundException(gInterp, code);
+ }
+ Tcl_DecrRefCount(path);
+ }
+ }
+ Tcl_ResetResult(gInterp);
+ }
+ break;
+ case kDemoItem:
+ if (gInterp) {
+ Tcl_Obj *path = GetWidgetDemoPath(gInterp);
+
+ if (path) {
+ Tcl_IncrRefCount(path);
+ code = Tcl_FSEvalFile(gInterp, path);
+ if (code != TCL_OK) {
+ Tcl_BackgroundException(gInterp, code);
+ }
+ Tcl_DecrRefCount(path);
+ Tcl_ResetResult(gInterp);
+ }
+ }
+ break;
+ case kCloseItem:
+ /* Send close event */
+ window = TkMacOSXGetXWindow(ActiveNonFloatingWindow());
+ dispPtr = TkGetDisplayList();
+ tkwin = Tk_IdToWindow(dispPtr->display, window);
+ TkGenWMDestroyEvent(tkwin);
+ break;
+ }
+ break;
+ case kEditMenu:
+ /*
+ * This implementation just send the keysyms Tk thinks are associated
+ * with function keys that do Cut, Copy & Paste on a Sun keyboard.
+ */
+
+ GenerateEditEvent(theItem);
+ break;
+ default:
+ TkMacOSXDispatchMenuEvent(theMenu, theItem);
+ break;
+ }
+
+ /*
+ * Finally we unhighlight the menu.
+ */
+
+ HiliteMenu(0);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MenuEventHandlerProc --
+ *
+ * One-time handler of kEventMenuEnableItems for the edit menu.
+ *
+ * Results:
+ * OS status code.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static OSStatus
+MenuEventHandlerProc(
+ EventHandlerCallRef callRef,
+ EventRef event,
+ void *userData)
+{
+ OSStatus result = eventNotHandledErr, err;
+ int menuContext;
+
+ err = ChkErr(GetEventParameter, event, kEventParamMenuContext, typeUInt32,
+ NULL, sizeof(menuContext), NULL, &menuContext);
+ if (err == noErr && (menuContext & kMenuContextMenuBarTracking)) {
+ if (gInterp) {
+ Tcl_Obj *path = GetWidgetDemoPath(gInterp);
+
+ if (path) {
+ Tcl_IncrRefCount(path);
+ if (Tcl_FSAccess(path, R_OK) == 0) {
+ EnableMenuItem(tkFileMenu, kDemoItem);
+ }
+ Tcl_DecrRefCount(path);
+ }
+ }
+ ChkErr(RemoveEventHandler, menuEventHandlerRef);
+ menuEventHandlerRef = NULL;
+ result = noErr;
+ }
+
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXInitMenus --
+ *
+ * This procedure initializes the Macintosh menu bar.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXInitMenus(
+ Tcl_Interp *interp)
+{
+ OSStatus err;
+ EventHandlerUPP menuEventHandlerUPP;
+ const EventTypeSpec menuEventTypes[] = {
+ {kEventClassMenu, kEventMenuEnableItems},
+ };
+
+ gInterp = interp;
+ if (TkMacOSXUseMenuID(kAppleMenu) != TCL_OK) {
+ Tcl_Panic("Menu ID %d is already in use!", kAppleMenu);
+ }
+ err = ChkErr(CreateNewMenu, kAppleMenu, kMenuAttrDoNotUseUserCommandKeys,
+ &tkAppleMenu);
+ if (err != noErr) {
+ Tcl_Panic("CreateNewMenu failed !");
+ }
+ SetMenuTitle(tkAppleMenu, "\p\024");
+ InsertMenu(tkAppleMenu, 0);
+ AppendMenu(tkAppleMenu, "\pAbout Tcl & Tk\xc9");
+ AppendMenu(tkAppleMenu, "\p(-");
+
+ if (TkMacOSXUseMenuID(kFileMenu) != TCL_OK) {
+ Tcl_Panic("Menu ID %d is already in use!", kFileMenu);
+ }
+ err = ChkErr(CreateNewMenu, kFileMenu, kMenuAttrDoNotUseUserCommandKeys,
+ &tkFileMenu);
+ if (err != noErr) {
+ Tcl_Panic("CreateNewMenu failed !");
+ }
+ SetMenuTitle(tkFileMenu, "\pFile");
+ InsertMenu(tkFileMenu, 0);
+ InsertMenuItem(tkFileMenu, "\pSource\xc9", kSourceItem - 1);
+ InsertMenuItem(tkFileMenu, "\pRun Widget Demo", kDemoItem - 1);
+ InsertMenuItem(tkFileMenu, "\pClose/W", kCloseItem - 1);
+ DisableMenuItem(tkFileMenu, kDemoItem);
+ menuEventHandlerUPP = NewEventHandlerUPP(MenuEventHandlerProc);
+ ChkErr(InstallEventHandler, GetMenuEventTarget(tkFileMenu),
+ menuEventHandlerUPP, GetEventTypeCount(menuEventTypes),
+ menuEventTypes, NULL, &menuEventHandlerRef);
+ DisposeEventHandlerUPP(menuEventHandlerUPP);
+
+ if (TkMacOSXUseMenuID(kEditMenu) != TCL_OK) {
+ Tcl_Panic("Menu ID %d is already in use!", kEditMenu);
+ }
+ err = ChkErr(CreateNewMenu, kEditMenu, kMenuAttrDoNotUseUserCommandKeys,
+ &tkEditMenu);
+ if (err != noErr) {
+ Tcl_Panic("CreateNewMenu failed !");
+ }
+ SetMenuTitle(tkEditMenu, "\pEdit");
+ InsertMenu(tkEditMenu, 0);
+ AppendMenu(tkEditMenu, "\pCut/X");
+ AppendMenu(tkEditMenu, "\pCopy/C");
+ AppendMenu(tkEditMenu, "\pPaste/V");
+ AppendMenu(tkEditMenu, "\pClear");
+ if (TkMacOSXUseMenuID(kHMHelpMenuID) != TCL_OK) {
+ Tcl_Panic("Help menu ID %s is already in use!", kHMHelpMenuID);
+ }
+
+ /*
+ * Workaround a Carbon bug with kHICommandPreferences: the first call to
+ * IsMenuKeyEvent returns false for the preferences menu item key shorcut
+ * event (even if the corresponding menu item is dynamically enabled by a
+ * kEventCommandUpdateStatus handler), unless the kHICommandPreferences
+ * menu item has previously been enabled manually. [Bug 1481503]
+ */
+
+ EnableMenuCommand(NULL, kHICommandPreferences);
+
+ DrawMenuBar();
+ return;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GenerateEditEvent --
+ *
+ * Takes an edit menu item and posts the corasponding a virtual event to
+ * Tk's event queue.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * May place events of queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+GenerateEditEvent(
+ int flag)
+{
+ XVirtualEvent event;
+ int x, y;
+ Tk_Window tkwin;
+ Window window;
+ TkDisplay *dispPtr;
+
+ window = TkMacOSXGetXWindow(ActiveNonFloatingWindow());
+ dispPtr = TkGetDisplayList();
+ tkwin = Tk_IdToWindow(dispPtr->display, window);
+ tkwin = (Tk_Window) ((TkWindow *) tkwin)->dispPtr->focusPtr;
+ if (tkwin == NULL) {
+ return;
+ }
+
+ bzero(&event, sizeof(XVirtualEvent));
+ event.type = VirtualEvent;
+ event.serial = Tk_Display(tkwin)->request;
+ event.send_event = false;
+ event.display = Tk_Display(tkwin);
+ event.event = Tk_WindowId(tkwin);
+ event.root = XRootWindow(Tk_Display(tkwin), 0);
+ event.subwindow = None;
+ event.time = TkpGetMS();
+
+ XQueryPointer(NULL, None, NULL, NULL,
+ &event.x_root, &event.y_root, &x, &y, &event.state);
+ Tk_TopCoordsToWindow(tkwin, x, y, &event.x, &event.y);
+ event.same_screen = true;
+
+ switch (flag) {
+ case EDIT_CUT:
+ event.name = Tk_GetUid("Cut");
+ break;
+ case EDIT_COPY:
+ event.name = Tk_GetUid("Copy");
+ break;
+ case EDIT_PASTE:
+ event.name = Tk_GetUid("Paste");
+ break;
+ case EDIT_CLEAR:
+ event.name = Tk_GetUid("Clear");
+ break;
+ }
+ Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
+}
+
+/*
+ * Local Variables:
+ * fill-column: 78
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/carbon/tkMacOSXMouseEvent.c b/carbon/tkMacOSXMouseEvent.c
new file mode 100644
index 0000000..697e00d
--- /dev/null
+++ b/carbon/tkMacOSXMouseEvent.c
@@ -0,0 +1,1190 @@
+/*
+ * tkMacOSXMouseEvent.c --
+ *
+ * This file implements functions that decode & handle mouse events on
+ * MacOS X.
+ *
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * The following terms apply to all files originating from Apple
+ * Computer, Inc. ("Apple") and associated with the software unless
+ * explicitly disclaimed in individual files.
+ *
+ * Apple hereby grants permission to use, copy, modify, distribute, and
+ * license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that
+ * this notice is included verbatim in any distributions. No written
+ * agreement, license, or royalty fee is required for any of the
+ * authorized uses. Modifications to this software may be copyrighted by
+ * their authors and need not follow the licensing terms described here,
+ * provided that the new terms are clearly indicated on the first page of
+ * each file where they apply.
+ *
+ * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE SOFTWARE
+ * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
+ * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS
+ * DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF APPLE OR THE
+ * AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. APPLE,
+ * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
+ * NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND
+ * APPLE,THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
+ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * GOVERNMENT USE: If you are acquiring this software on behalf of the
+ * U.S. government, the Government shall have only "Restricted Rights" in
+ * the software and related documentation as defined in the Federal
+ * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you are
+ * acquiring the software on behalf of the Department of Defense, the
+ * software shall be classified as "Commercial Computer Software" and the
+ * 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.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkMacOSXWm.h"
+#include "tkMacOSXEvent.h"
+#include "tkMacOSXDebug.h"
+
+typedef struct {
+ WindowRef whichWin;
+ WindowRef activeNonFloating;
+ WindowPartCode windowPart;
+ unsigned int state;
+ long delta;
+ Window window;
+ Point global;
+ Point local;
+} MouseEventData;
+
+/*
+ * Declarations of static variables used in this file.
+ */
+
+static int gEatButtonUp = 0; /* 1 if we need to eat the next up event. */
+
+/*
+ * Declarations of functions used only in this file.
+ */
+
+static void BringWindowForward(WindowRef wRef, int isFrontProcess,
+ int frontWindowOnly);
+static int GeneratePollingEvents(MouseEventData *medPtr);
+static int GenerateMouseWheelEvent(MouseEventData *medPtr);
+static int GenerateButtonEvent(MouseEventData *medPtr);
+static int GenerateToolbarButtonEvent(MouseEventData *medPtr);
+static int HandleWindowTitlebarMouseDown(MouseEventData *medPtr,
+ Tk_Window tkwin);
+static unsigned int ButtonModifiers2State(UInt32 buttonState,
+ UInt32 keyModifiers);
+static Tk_Window GetGrabWindowForWindow(Tk_Window tkwin);
+static int TkMacOSXGetEatButtonUp(void);
+static void TkMacOSXSetEatButtonUp(int f);
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXProcessMouseEvent --
+ *
+ * This routine processes the event in eventPtr, and generates the
+ * appropriate Tk events from it.
+ *
+ * Results:
+ * True if event(s) are generated - false otherwise.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkMacOSXProcessMouseEvent(
+ TkMacOSXEvent *eventPtr,
+ MacEventStatus *statusPtr)
+{
+ Tk_Window tkwin;
+ Point where, where2;
+ int result;
+ TkDisplay *dispPtr;
+ OSStatus err;
+ MouseEventData mouseEventData, *medPtr = &mouseEventData;
+ int isFrontProcess;
+
+ switch (eventPtr->eKind) {
+ case kEventMouseDown:
+ case kEventMouseUp:
+ case kEventMouseMoved:
+ case kEventMouseDragged:
+ case kEventMouseWheelMoved:
+ break;
+ default:
+ return false;
+ }
+
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamMouseLocation, typeQDPoint, NULL, sizeof(where), NULL,
+ &where);
+ if (err != noErr) {
+ GetGlobalMouse(&where);
+ }
+
+ err = ChkErr(GetEventParameter, eventPtr->eventRef, kEventParamWindowRef,
+ typeWindowRef, NULL, sizeof(WindowRef), NULL, &medPtr->whichWin);
+ if (err == noErr) {
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamWindowPartCode, typeWindowPartCode, NULL,
+ sizeof(WindowPartCode), NULL, &medPtr->windowPart);
+ }
+ if (err != noErr) {
+ medPtr->windowPart = FindWindow(where, &medPtr->whichWin);
+ }
+ medPtr->window = TkMacOSXGetXWindow(medPtr->whichWin);
+ if (medPtr->whichWin != NULL && medPtr->window == None) {
+ return false;
+ }
+ if (eventPtr->eKind == kEventMouseDown) {
+ if (IsWindowActive(medPtr->whichWin) && IsWindowPathSelectEvent(
+ medPtr->whichWin, eventPtr->eventRef)) {
+ ChkErr(WindowPathSelect, medPtr->whichWin, NULL, NULL);
+ return false;
+ }
+ if (medPtr->windowPart == inProxyIcon) {
+ TkMacOSXTrackingLoop(1);
+ err = ChkErr(TrackWindowProxyDrag, medPtr->whichWin, where);
+ TkMacOSXTrackingLoop(0);
+ if (err == errUserWantsToDragWindow) {
+ medPtr->windowPart = inDrag;
+ } else {
+ return false;
+ }
+ }
+ }
+ isFrontProcess = Tk_MacOSXIsAppInFront();
+ if (isFrontProcess) {
+ medPtr->state = ButtonModifiers2State(GetCurrentEventButtonState(),
+ GetCurrentEventKeyModifiers());
+ } else {
+ medPtr->state = ButtonModifiers2State(GetCurrentButtonState(),
+ GetCurrentKeyModifiers());
+ }
+ medPtr->global = where;
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamWindowMouseLocation, typeQDPoint, NULL,
+ sizeof(Point), NULL, &medPtr->local);
+ if (err == noErr) {
+ if (medPtr->whichWin) {
+ Rect widths;
+
+ GetWindowStructureWidths(medPtr->whichWin, &widths);
+ medPtr->local.h -= widths.left;
+ medPtr->local.v -= widths.top;
+ }
+ } else {
+ medPtr->local = where;
+ if (medPtr->whichWin) {
+ QDGlobalToLocalPoint(GetWindowPort(medPtr->whichWin),
+ &medPtr->local);
+ }
+ }
+ medPtr->activeNonFloating = ActiveNonFloatingWindow();
+ dispPtr = TkGetDisplayList();
+ tkwin = Tk_IdToWindow(dispPtr->display, medPtr->window);
+
+ if (eventPtr->eKind != kEventMouseDown) {
+ int res = false;
+
+ switch (eventPtr->eKind) {
+ case kEventMouseUp:
+ /*
+ * The window manager only needs to know about mouse down events
+ * and sometimes we need to "eat" the mouse up. Otherwise, we just
+ * pass the event to Tk.
+ */
+
+ if (TkMacOSXGetEatButtonUp()) {
+ TkMacOSXSetEatButtonUp(false);
+ } else {
+ res = GenerateButtonEvent(medPtr);
+ }
+ break;
+ case kEventMouseWheelMoved:
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamMouseWheelDelta, typeLongInteger, NULL,
+ sizeof(long), NULL, &medPtr->delta);
+ if (err != noErr ) {
+ statusPtr->err = 1;
+ } else {
+ EventMouseWheelAxis axis;
+
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL,
+ sizeof(EventMouseWheelAxis), NULL, &axis);
+ if (err == noErr && axis == kEventMouseWheelAxisX) {
+ medPtr->state |= ShiftMask;
+ }
+ res = GenerateMouseWheelEvent(medPtr);
+ }
+ break;
+ case kEventMouseMoved:
+ case kEventMouseDragged:
+ res = GeneratePollingEvents(medPtr);
+ break;
+ default:
+ Tcl_Panic("Unknown mouse event !");
+ }
+ if (res) {
+ statusPtr->stopProcessing = 1;
+ }
+ return res;
+ }
+
+ TkMacOSXSetEatButtonUp(false);
+ if (!medPtr->whichWin) {
+ return false;
+ }
+
+ /*
+ * We got a mouse down in a window, so see if this is the activate click.
+ * This click moves the window forward. We don't want the corresponding
+ * mouse-up to be reported to the application or else it will mess up some
+ * Tk scripts.
+ */
+
+ if (!(TkpIsWindowFloating(medPtr->whichWin))
+ && (medPtr->whichWin != medPtr->activeNonFloating
+ || !isFrontProcess)) {
+ int frontWindowOnly = 1;
+ int cmdDragGrow = ((medPtr->windowPart == inDrag ||
+ medPtr->windowPart == inGrow) && medPtr->state & Mod1Mask);
+
+ if (!cmdDragGrow) {
+ Tk_Window grabWin = GetGrabWindowForWindow(tkwin);
+
+ frontWindowOnly = !grabWin;
+ if (grabWin && grabWin != tkwin) {
+ TkMacOSXSetEatButtonUp(true);
+ BringWindowForward(TkMacOSXDrawableWindow(
+ ((TkWindow *) grabWin)->window), isFrontProcess,
+ frontWindowOnly);
+ return false;
+ }
+ }
+
+ /*
+ * Clicks in the titlebar widgets are handled without bringing the
+ * window forward.
+ */
+
+ result = HandleWindowTitlebarMouseDown(medPtr, tkwin);
+ if (result != -1) {
+ statusPtr->stopProcessing = 1;
+ return result;
+ }
+
+ /*
+ * Only windows with the kWindowNoActivatesAttribute can receive mouse
+ * events in the background.
+ */
+
+ if (!(((TkWindow *)tkwin)->wmInfoPtr->attributes &
+ kWindowNoActivatesAttribute)) {
+ /*
+ * Allow background window dragging & growing with Command down.
+ */
+
+ if (!cmdDragGrow) {
+ TkMacOSXSetEatButtonUp(true);
+ BringWindowForward(medPtr->whichWin, isFrontProcess,
+ frontWindowOnly);
+ }
+
+ /*
+ * Allow dragging & growing of windows that were/are in the
+ * background.
+ */
+
+ if (!(medPtr->windowPart == inDrag ||
+ medPtr->windowPart == inGrow)) {
+ return false;
+ }
+ }
+ } else {
+ result = HandleWindowTitlebarMouseDown(medPtr, tkwin);
+ if (result != -1) {
+ statusPtr->stopProcessing = 1;
+ return result;
+ }
+ }
+
+ switch (medPtr->windowPart) {
+ case inDrag: {
+ WindowAttributes attributes;
+
+ GetWindowAttributes(medPtr->whichWin, &attributes);
+ if (!(attributes & kWindowAsyncDragAttribute)) {
+ TkMacOSXTrackingLoop(1);
+ DragWindow(medPtr->whichWin, where, NULL);
+ TkMacOSXTrackingLoop(0);
+ where2.h = where2.v = 0;
+ QDLocalToGlobalPoint(GetWindowPort(medPtr->whichWin), &where2);
+ return (EqualPt(where, where2)) ? false : true;
+ }
+ break;
+ }
+ case inGrow: {
+ /*
+ * Generally the content region is the domain of Tk sub-windows.
+ * However, one exception is the grow region. A button down in this
+ * area will be handled by the window manager. Note: this means that
+ * Tk may not get button down events in this area!
+ */
+
+ XPoint p = {where.h, where.v};
+ if (TkMacOSXGrowToplevel(medPtr->whichWin, p) == true) {
+ statusPtr->stopProcessing = 1;
+ return true;
+ }
+ }
+ case inContent:
+ return GenerateButtonEvent(medPtr);
+ }
+ return false;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * HandleWindowTitlebarMouseDown --
+ *
+ * Handle clicks in window titlebar.
+ *
+ * Results:
+ * 1 if event was handled, 0 if event was not handled, -1 if MouseDown
+ * was not in window titlebar.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+HandleWindowTitlebarMouseDown(
+ MouseEventData *medPtr,
+ Tk_Window tkwin)
+{
+ int result = INT_MAX;
+
+ switch (medPtr->windowPart) {
+ case inGoAway:
+ case inCollapseBox:
+ case inZoomIn:
+ case inZoomOut:
+ case inToolbarButton:
+ if (!IsWindowActive(medPtr->whichWin)) {
+ WindowRef frontWindow = FrontNonFloatingWindow();
+ WindowModality frontWindowModality = kWindowModalityNone;
+
+ if (frontWindow && frontWindow != medPtr->whichWin) {
+ ChkErr(GetWindowModality, frontWindow,
+ &frontWindowModality, NULL);
+ }
+ if (frontWindowModality == kWindowModalityAppModal) {
+ result = 0;
+ }
+ }
+ break;
+ default:
+ result = -1;
+ break;
+ }
+
+ if (result == INT_MAX) {
+ result = 0;
+ TkMacOSXTrackingLoop(1);
+ switch (medPtr->windowPart) {
+ case inGoAway:
+ if (TrackGoAway(medPtr->whichWin, medPtr->global) && tkwin) {
+ TkGenWMDestroyEvent(tkwin);
+ result = 1;
+ }
+ break;
+ case inCollapseBox:
+ if (TrackBox(medPtr->whichWin, medPtr->global,
+ medPtr->windowPart) && tkwin) {
+ TkpWmSetState((TkWindow *) tkwin, IconicState);
+ result = 1;
+ }
+ break;
+ case inZoomIn:
+ case inZoomOut:
+ if (TrackBox(medPtr->whichWin, medPtr->global,
+ medPtr->windowPart)) {
+ result = TkMacOSXZoomToplevel(medPtr->whichWin,
+ medPtr->windowPart);
+ }
+ break;
+ case inToolbarButton:
+ if (TrackBox(medPtr->whichWin, medPtr->global,
+ medPtr->windowPart)) {
+ result = GenerateToolbarButtonEvent(medPtr);
+ }
+ break;
+ }
+ TkMacOSXTrackingLoop(0);
+ }
+
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GeneratePollingEvents --
+ *
+ * This function polls the mouse position and generates X Motion, Enter &
+ * Leave events. The cursor is also updated at this time.
+ *
+ * Results:
+ * True if event(s) are generated - false otherwise.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue. The cursor may
+ * be changed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GeneratePollingEvents(
+ MouseEventData *medPtr)
+{
+ Tk_Window tkwin, rootwin, grabWin;
+ int local_x, local_y;
+ TkDisplay *dispPtr;
+
+ grabWin = TkMacOSXGetCapture();
+
+ if ((!TkpIsWindowFloating(medPtr->whichWin)
+ && (medPtr->activeNonFloating != medPtr->whichWin))) {
+ /*
+ * If the window for this event is not floating, and is not the active
+ * non-floating window, don't generate polling events. We don't send
+ * events to backgrounded windows. So either send it to the grabWin,
+ * or NULL if there is no grabWin.
+ */
+
+ tkwin = grabWin;
+ } else {
+ /*
+ * First check whether the toplevel containing this mouse event is the
+ * grab window. If not, then send the event to the grab window.
+ * Otherwise, set tkWin to the subwindow which most closely contains
+ * the mouse event.
+ */
+
+ dispPtr = TkGetDisplayList();
+ rootwin = Tk_IdToWindow(dispPtr->display, medPtr->window);
+ if ((rootwin == NULL)
+ || ((grabWin != NULL) && (rootwin != grabWin))) {
+ tkwin = grabWin;
+ } else {
+ tkwin = Tk_TopCoordsToWindow(rootwin, medPtr->local.h,
+ medPtr->local.v, &local_x, &local_y);
+ }
+ }
+
+ /*
+ * The following call will generate the appropiate X events and adjust any
+ * state that Tk must remember.
+ */
+
+ Tk_UpdatePointer(tkwin, medPtr->global.h, medPtr->global.v,
+ medPtr->state);
+ return true;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * BringWindowForward --
+ *
+ * Bring this background window to the front.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The window is brought forward.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+BringWindowForward(
+ WindowRef wRef,
+ int isFrontProcess,
+ int frontWindowOnly)
+{
+ if (wRef && !TkpIsWindowFloating(wRef) && IsValidWindowPtr(wRef)) {
+ WindowRef frontWindow = FrontNonFloatingWindow();
+ WindowModality frontWindowModality = kWindowModalityNone;
+
+ if (frontWindow && frontWindow != wRef) {
+ ChkErr(GetWindowModality, frontWindow, &frontWindowModality, NULL);
+ }
+ if (frontWindowModality != kWindowModalityAppModal) {
+ Window window = TkMacOSXGetXWindow(wRef);
+
+ if (window != None) {
+ TkDisplay *dispPtr = TkGetDisplayList();
+ TkWindow *winPtr = (TkWindow *)
+ Tk_IdToWindow(dispPtr->display, window);
+
+ if (winPtr && winPtr->wmInfoPtr &&
+ winPtr->wmInfoPtr->master != None) {
+ TkWindow *masterWinPtr = (TkWindow *)Tk_IdToWindow(
+ dispPtr->display, winPtr->wmInfoPtr->master);
+
+ if (masterWinPtr && masterWinPtr->window != None &&
+ TkMacOSXHostToplevelExists(masterWinPtr)) {
+ WindowRef masterMacWin =
+ TkMacOSXDrawableWindow(masterWinPtr->window);
+
+ if (masterMacWin) {
+ BringToFront(masterMacWin);
+ }
+ }
+ }
+ }
+ SelectWindow(wRef);
+ } else {
+ frontWindowOnly = 0;
+ }
+ }
+ if (!isFrontProcess) {
+ ProcessSerialNumber ourPsn = {0, kCurrentProcess};
+
+ ChkErr(SetFrontProcessWithOptions, &ourPsn,
+ frontWindowOnly ? kSetFrontProcessFrontWindowOnly : 0);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXBringWindowForward --
+ *
+ * Bring this window to the front in response to a mouse click. If a grab
+ * is in effect, bring the grab window to the front instead.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The window is brought forward.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXBringWindowForward(
+ WindowRef wRef)
+{
+ TkDisplay *dispPtr = TkGetDisplayList();
+ Tk_Window tkwin =
+ Tk_IdToWindow(dispPtr->display, TkMacOSXGetXWindow(wRef));
+ Tk_Window grabWin = GetGrabWindowForWindow(tkwin);
+
+ if (grabWin && grabWin != tkwin) {
+ wRef = TkMacOSXDrawableWindow(((TkWindow *) grabWin)->window);
+ }
+ TkMacOSXSetEatButtonUp(true);
+ BringWindowForward(wRef, Tk_MacOSXIsAppInFront(), !grabWin);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetGrabWindowForWindow --
+ *
+ * Get the grab window for the given window, if any.
+ *
+ * Results:
+ * Grab Tk_Window or None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Tk_Window
+GetGrabWindowForWindow(
+ Tk_Window tkwin)
+{
+ Tk_Window grabWin = TkMacOSXGetCapture();
+
+ if (!grabWin) {
+ int grabState = TkGrabState((TkWindow *) tkwin);
+
+ if (grabState != TK_GRAB_NONE && grabState != TK_GRAB_IN_TREE) {
+ grabWin = (Tk_Window) (((TkWindow *) tkwin)->dispPtr->grabWinPtr);
+ }
+ }
+
+ return grabWin;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GenerateMouseWheelEvent --
+ *
+ * Generates a "MouseWheel" Tk event.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Places a mousewheel event on the event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GenerateMouseWheelEvent(
+ MouseEventData *medPtr)
+{
+ Tk_Window tkwin, rootwin;
+ TkDisplay *dispPtr;
+ TkWindow *winPtr;
+ XEvent xEvent;
+
+ dispPtr = TkGetDisplayList();
+ rootwin = Tk_IdToWindow(dispPtr->display, medPtr->window);
+ if (rootwin == NULL) {
+ tkwin = NULL;
+ } else {
+ tkwin = Tk_TopCoordsToWindow(rootwin, medPtr->local.h,
+ medPtr->local.v, &xEvent.xbutton.x, &xEvent.xbutton.y);
+ }
+
+ /*
+ * The following call will generate the appropiate X events and adjust any
+ * state that Tk must remember.
+ */
+
+ if (!tkwin) {
+ tkwin = TkMacOSXGetCapture();
+ }
+ if (!tkwin) {
+ return false;
+ }
+
+ winPtr = (TkWindow *) tkwin;
+ xEvent.type = MouseWheelEvent;
+ xEvent.xkey.keycode = medPtr->delta;
+ xEvent.xbutton.x_root = medPtr->global.h;
+ xEvent.xbutton.y_root = medPtr->global.v;
+ xEvent.xbutton.state = medPtr->state;
+ xEvent.xany.serial = LastKnownRequestProcessed(winPtr->display);
+ xEvent.xany.send_event = false;
+ xEvent.xany.display = winPtr->display;
+ xEvent.xany.window = Tk_WindowId(winPtr);
+ Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL);
+ return true;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetEatButtonUp --
+ *
+ * Results:
+ * Return the flag indicating if we need to eat the next mouse up event.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkMacOSXGetEatButtonUp(void)
+{
+ return gEatButtonUp;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXSetEatButtonUp --
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Sets the flag indicating if we need to eat the next mouse up event
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXSetEatButtonUp(
+ int f)
+{
+ gEatButtonUp = f;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXKeyModifiers --
+ *
+ * Returns the current state of the modifier keys.
+ *
+ * Results:
+ * An OS Modifier state.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+EventModifiers
+TkMacOSXModifierState(void)
+{
+ UInt32 keyModifiers;
+ int isFrontProcess = (GetCurrentEvent() && Tk_MacOSXIsAppInFront());
+
+ keyModifiers = isFrontProcess ? GetCurrentEventKeyModifiers() :
+ GetCurrentKeyModifiers();
+
+ return (EventModifiers) (keyModifiers & USHRT_MAX);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXButtonKeyState --
+ *
+ * Returns the current state of the button & modifier keys.
+ *
+ * Results:
+ * A bitwise inclusive OR of a subset of the following: Button1Mask,
+ * ShiftMask, LockMask, ControlMask, Mod*Mask.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+unsigned int
+TkMacOSXButtonKeyState(void)
+{
+ UInt32 buttonState = 0, keyModifiers;
+ int isFrontProcess = (GetCurrentEvent() && Tk_MacOSXIsAppInFront());
+
+ if (!TkMacOSXGetEatButtonUp()) {
+ buttonState = isFrontProcess ? GetCurrentEventButtonState() :
+ GetCurrentButtonState();
+ }
+ keyModifiers = isFrontProcess ? GetCurrentEventKeyModifiers() :
+ GetCurrentKeyModifiers();
+
+ return ButtonModifiers2State(buttonState, keyModifiers);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ButtonModifiers2State --
+ *
+ * Converts Carbon mouse button state and modifier values into a Tk
+ * button/modifier state.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static unsigned int
+ButtonModifiers2State(
+ UInt32 buttonState,
+ UInt32 keyModifiers)
+{
+ unsigned int state;
+
+ /*
+ * Tk supports at most 5 buttons.
+ */
+
+ state = (buttonState & ((1<<5) - 1)) << 8;
+
+ if (keyModifiers & alphaLock) {
+ state |= LockMask;
+ }
+ if (keyModifiers & shiftKey) {
+ state |= ShiftMask;
+ }
+ if (keyModifiers & controlKey) {
+ state |= ControlMask;
+ }
+ if (keyModifiers & cmdKey) {
+ state |= Mod1Mask; /* command key */
+ }
+ if (keyModifiers & optionKey) {
+ state |= Mod2Mask; /* option key */
+ }
+ if (keyModifiers & kEventKeyModifierNumLockMask) {
+ state |= Mod3Mask;
+ }
+ if (keyModifiers & kEventKeyModifierFnMask) {
+ state |= Mod4Mask;
+ }
+
+ return state;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XQueryPointer --
+ *
+ * Check the current state of the mouse. This is not a complete
+ * implementation of this function. It only computes the root coordinates
+ * and the current mask.
+ *
+ * Results:
+ * Sets root_x_return, root_y_return, and mask_return. Returns true on
+ * success.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Bool
+XQueryPointer(
+ Display *display,
+ Window w,
+ Window *root_return,
+ Window *child_return,
+ int *root_x_return,
+ int *root_y_return,
+ int *win_x_return,
+ int *win_y_return,
+ unsigned int *mask_return)
+{
+ int getGlobal = (root_x_return && root_y_return);
+ int getLocal = (win_x_return && win_y_return);
+
+ if (getGlobal || getLocal) {
+ Point where, local;
+ OSStatus err = noErr;
+ int gotMouseLoc = 0;
+ EventRef ev = GetCurrentEvent();
+
+ if (ev && getLocal) {
+ err = ChkErr(GetEventParameter, ev, kEventParamWindowMouseLocation,
+ typeQDPoint, NULL, sizeof(Point), NULL, &local);
+ gotMouseLoc = (err == noErr);
+ }
+ if (getGlobal || !gotMouseLoc) {
+ if (ev) {
+ err = ChkErr(GetEventParameter, ev, kEventParamMouseLocation,
+ typeQDPoint, NULL, sizeof(Point), NULL, &where);
+ }
+ if (!ev || err != noErr) {
+ GetGlobalMouse(&where);
+ }
+ }
+ if (getLocal) {
+ WindowRef whichWin;
+
+ if (ev) {
+ err = ChkErr(GetEventParameter, ev, kEventParamWindowRef,
+ typeWindowRef, NULL, sizeof(WindowRef), NULL,
+ &whichWin);
+ }
+ if (!ev || err != noErr) {
+ FindWindow(where, &whichWin);
+ }
+ if (gotMouseLoc) {
+ if (whichWin) {
+ Rect widths;
+
+ ChkErr(GetWindowStructureWidths, whichWin, &widths);
+ local.h -= widths.left;
+ local.v -= widths.top;
+ }
+ } else {
+ local = where;
+ if (whichWin) {
+ QDGlobalToLocalPoint(GetWindowPort(whichWin), &local);
+ }
+ }
+ }
+ if (getGlobal) {
+ *root_x_return = where.h;
+ *root_y_return = where.v;
+ }
+ if (getLocal) {
+ *win_x_return = local.h;
+ *win_y_return = local.v;
+ }
+ }
+ if (mask_return) {
+ *mask_return = TkMacOSXButtonKeyState();
+ }
+ return True;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkGenerateButtonEventForXPointer --
+ *
+ * This procedure generates an X button event for the current pointer
+ * state as reported by XQueryPointer().
+ *
+ * Results:
+ * True if event(s) are generated - false otherwise.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue. Grab state may
+ * also change.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkGenerateButtonEventForXPointer(
+ Window window) /* X Window containing button event. */
+{
+ MouseEventData med;
+ int global_x, global_y, local_x, local_y;
+
+ bzero(&med, sizeof(MouseEventData));
+ XQueryPointer(NULL, None, NULL, NULL, &global_x, &global_y,
+ &local_x, &local_y, &med.state);
+ med.global.h = global_x;
+ med.global.v = global_y;
+ med.local.h = local_x;
+ med.local.v = local_y;
+ med.window = window;
+ med.activeNonFloating = ActiveNonFloatingWindow();
+
+ return GenerateButtonEvent(&med);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkGenerateButtonEvent --
+ *
+ * Given a global x & y position and the button key status this procedure
+ * generates the appropiate X button event. It also handles the state
+ * changes needed to implement implicit grabs.
+ *
+ * Results:
+ * True if event(s) are generated, false otherwise.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue. Grab state may
+ * also change.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkGenerateButtonEvent(
+ int x, /* X location of mouse, */
+ int y, /* Y location of mouse. */
+ Window window, /* X Window containing button event. */
+ unsigned int state) /* Button Key state suitable for X event. */
+{
+ MouseEventData med;
+
+ bzero(&med, sizeof(MouseEventData));
+ med.state = state;
+ med.window = window;
+ med.global.h = x;
+ med.global.v = y;
+ FindWindow(med.global, &med.whichWin);
+ med.activeNonFloating = ActiveNonFloatingWindow();
+ med.local = med.global;
+ QDGlobalToLocalPoint(GetWindowPort(med.whichWin), &med.local);
+
+ return GenerateButtonEvent(&med);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GenerateButtonEvent --
+ *
+ * Generate an X button event from a MouseEventData structure. Handles
+ * the state changes needed to implement implicit grabs.
+ *
+ * Results:
+ * True if event(s) are generated - false otherwise.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue. Grab state may
+ * also change.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GenerateButtonEvent(
+ MouseEventData *medPtr)
+{
+ Tk_Window tkwin;
+ int dummy;
+ TkDisplay *dispPtr;
+
+#if UNUSED
+ /*
+ * ButtonDown events will always occur in the front window. ButtonUp
+ * events, however, may occur anywhere on the screen. ButtonUp events
+ * should only be sent to Tk if in the front window or during an implicit
+ * grab.
+ */
+
+ if ((medPtr->activeNonFloating == NULL)
+ || ((!(TkpIsWindowFloating(medPtr->whichWin))
+ && (medPtr->activeNonFloating != medPtr->whichWin))
+ && TkMacOSXGetCapture() == NULL)) {
+ return false;
+ }
+#endif
+
+ dispPtr = TkGetDisplayList();
+ tkwin = Tk_IdToWindow(dispPtr->display, medPtr->window);
+
+ if (tkwin != NULL) {
+ tkwin = Tk_TopCoordsToWindow(tkwin, medPtr->local.h, medPtr->local.v,
+ &dummy, &dummy);
+ }
+
+ Tk_UpdatePointer(tkwin, medPtr->global.h, medPtr->global.v, medPtr->state);
+ return true;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GenerateToolbarButtonEvent --
+ *
+ * Generates a "ToolbarButton" virtual event. This can be used to manage
+ * disappearing toolbars.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Places a virtual event on the event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GenerateToolbarButtonEvent(
+ MouseEventData *medPtr)
+{
+ Tk_Window rootwin, tkwin = NULL;
+ TkDisplay *dispPtr;
+ TkWindow *winPtr;
+ XVirtualEvent event;
+
+ dispPtr = TkGetDisplayList();
+ rootwin = Tk_IdToWindow(dispPtr->display, medPtr->window);
+ if (rootwin) {
+ tkwin = Tk_TopCoordsToWindow(rootwin,
+ medPtr->local.h, medPtr->local.v, &event.x, &event.y);
+ }
+ if (!tkwin) {
+ return true;
+ }
+ winPtr = (TkWindow *) tkwin;
+
+ bzero(&event, sizeof(XVirtualEvent));
+ event.type = VirtualEvent;
+ event.serial = LastKnownRequestProcessed(winPtr->display);
+ event.send_event = false;
+ event.display = winPtr->display;
+ event.event = winPtr->window;
+ event.root = XRootWindow(winPtr->display, 0);
+ event.subwindow = None;
+ event.time = TkpGetMS();
+ event.x_root = medPtr->global.h;
+ event.y_root = medPtr->global.v;
+ event.state = medPtr->state;
+ event.same_screen = true;
+ event.name = Tk_GetUid("ToolbarButton");
+
+ Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL);
+ return true;
+}
+
+void
+TkpWarpPointer(
+ TkDisplay *dispPtr)
+{
+ CGPoint pt;
+ UInt32 buttonState;
+
+ if (dispPtr->warpWindow) {
+ int x, y;
+
+ Tk_GetRootCoords(dispPtr->warpWindow, &x, &y);
+ pt.x = x + dispPtr->warpX;
+ pt.y = y + dispPtr->warpY;
+ } else {
+ pt.x = dispPtr->warpX;
+ pt.y = dispPtr->warpY;
+ }
+
+ /*
+ * Tell the OSX core to generate the events to make it happen. This is
+ * fairly ugly, but means that under most circumstances we'll register all
+ * the events that would normally be generated correctly. If we use
+ * CGWarpMouseCursorPosition instead, strange things happen.
+ */
+
+ buttonState = (GetCurrentEvent() && Tk_MacOSXIsAppInFront())
+ ? GetCurrentEventButtonState() : GetCurrentButtonState();
+
+ CGPostMouseEvent(pt, 1 /* generate motion events */, 5,
+ buttonState&1 ? 1 : 0, buttonState&2 ? 1 : 0,
+ buttonState&4 ? 1 : 0, buttonState&8 ? 1 : 0,
+ buttonState&16 ? 1 : 0);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/carbon/tkMacOSXNotify.c b/carbon/tkMacOSXNotify.c
new file mode 100644
index 0000000..fdd5afd
--- /dev/null
+++ b/carbon/tkMacOSXNotify.c
@@ -0,0 +1,196 @@
+/*
+ * tkMacOSXNotify.c --
+ *
+ * This file contains the implementation of a tcl event source
+ * for the Carbon event loop.
+ *
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkMacOSXEvent.h"
+#include <pthread.h>
+
+/*
+ * The following static indicates whether this module has been initialized
+ * in the current thread.
+ */
+
+typedef struct ThreadSpecificData {
+ int initialized;
+} ThreadSpecificData;
+static Tcl_ThreadDataKey dataKey;
+
+static void TkMacOSXNotifyExitHandler(ClientData clientData);
+static void CarbonEventsSetupProc(ClientData clientData, int flags);
+static void CarbonEventsCheckProc(ClientData clientData, int flags);
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_MacOSXSetupTkNotifier --
+ *
+ * This procedure is called during Tk initialization to create
+ * the event source for Carbon events.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A new event source is created.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_MacOSXSetupTkNotifier(void)
+{
+ ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey,
+ sizeof(ThreadSpecificData));
+
+ if (!tsdPtr->initialized) {
+ /* HACK ALERT: There is a bug in Jaguar where when it goes to make
+ * the event queue for the Main Event Loop, it stores the Current
+ * event loop rather than the Main Event Loop in the Queue structure.
+ * So we have to make sure that the Main Event Queue gets set up on
+ * the main thread. Calling GetMainEventQueue will force this to
+ * happen.
+ */
+ GetMainEventQueue();
+
+ tsdPtr->initialized = 1;
+
+ /*
+ * Install Carbon events event source in main event loop thread.
+ */
+
+ if (GetCurrentEventLoop() == GetMainEventLoop()) {
+ if (!pthread_main_np()) {
+ /*
+ * Panic if the Carbon main event loop thread (i.e. the thread
+ * where HIToolbox was first loaded) is not the main
+ * application thread, as Carbon does not support this
+ * properly.
+ */
+
+ Tcl_Panic("Tk_MacOSXSetupTkNotifier: %s",
+ "first [load] of TkAqua has to occur in the main thread!");
+ }
+ Tcl_CreateEventSource(CarbonEventsSetupProc,
+ CarbonEventsCheckProc, GetMainEventQueue());
+ TkCreateExitHandler(TkMacOSXNotifyExitHandler, NULL);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXNotifyExitHandler --
+ *
+ * This function is called during finalization to clean up the
+ * TkMacOSXNotify module.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TkMacOSXNotifyExitHandler(
+ ClientData clientData) /* Not used. */
+{
+ ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey,
+ sizeof(ThreadSpecificData));
+
+ Tcl_DeleteEventSource(CarbonEventsSetupProc,
+ CarbonEventsCheckProc, GetMainEventQueue());
+ tsdPtr->initialized = 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CarbonEventsSetupProc --
+ *
+ * This procedure implements the setup part of the Carbon Events event
+ * source. It is invoked by Tcl_DoOneEvent before entering the notifier
+ * to check for events.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * If Carbon events are queued, then the maximum block time will be set
+ * to 0 to ensure that the notifier returns control to Tcl.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+CarbonEventsSetupProc(
+ ClientData clientData,
+ int flags)
+{
+ static Tcl_Time blockTime = { 0, 0 };
+
+ if (!(flags & TCL_WINDOW_EVENTS)) {
+ return;
+ }
+
+ if (GetNumEventsInQueue((EventQueueRef) clientData)) {
+ Tcl_SetMaxBlockTime(&blockTime);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * CarbonEventsCheckProc --
+ *
+ * This procedure processes events sitting in the Carbon event queue.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Moves applicable queued Carbon events onto the Tcl event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+CarbonEventsCheckProc(
+ ClientData clientData,
+ int flags)
+{
+ int numFound;
+ OSStatus err = noErr;
+
+ if (!(flags & TCL_WINDOW_EVENTS)) {
+ return;
+ }
+
+ numFound = GetNumEventsInQueue((EventQueueRef) clientData);
+
+ /*
+ * Avoid starving other event sources:
+ */
+
+ if (numFound > 4) {
+ numFound = 4;
+ }
+ while (numFound > 0 && err == noErr) {
+ err = TkMacOSXReceiveAndDispatchEvent();
+ numFound--;
+ }
+}
diff --git a/carbon/tkMacOSXPort.h b/carbon/tkMacOSXPort.h
new file mode 100644
index 0000000..b5bfcde
--- /dev/null
+++ b/carbon/tkMacOSXPort.h
@@ -0,0 +1,187 @@
+/*
+ * tkMacOSXPort.h --
+ *
+ * This file is included by all of the Tk C files. It contains
+ * information that may be configuration-dependent, such as
+ * #includes for system include files and a few other things.
+ *
+ * Copyright (c) 1994-1996 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#ifndef _TKMACPORT
+#define _TKMACPORT
+
+#include <stdio.h>
+#include <ctype.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <math.h>
+#include <pwd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#include <sys/stat.h>
+#ifndef _TCL
+# include <tcl.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#include <unistd.h>
+#include <X11/Xlib.h>
+#include <X11/cursorfont.h>
+#include <X11/keysym.h>
+#include <X11/Xatom.h>
+#include <X11/Xfuncproto.h>
+#include <X11/Xutil.h>
+#include "tkIntXlibDecls.h"
+
+/*
+ * The following macro defines the type of the mask arguments to
+ * select:
+ */
+
+#ifndef NO_FD_SET
+# define SELECT_MASK fd_set
+#else
+# ifndef _AIX
+ typedef long fd_mask;
+# endif
+# if defined(_IBMR2)
+# define SELECT_MASK void
+# else
+# define SELECT_MASK int
+# endif
+#endif
+
+/*
+ * The following macro defines the number of fd_masks in an fd_set:
+ */
+
+#ifndef FD_SETSIZE
+# ifdef OPEN_MAX
+# define FD_SETSIZE OPEN_MAX
+# else
+# define FD_SETSIZE 256
+# endif
+#endif
+#if !defined(howmany)
+# define howmany(x, y) (((x)+((y)-1))/(y))
+#endif
+#ifndef NFDBITS
+# define NFDBITS NBBY*sizeof(fd_mask)
+#endif
+#define MASK_SIZE howmany(FD_SETSIZE, NFDBITS)
+
+/*
+ * Define "NBBY" (number of bits per byte) if it's not already defined.
+ */
+
+#ifndef NBBY
+# define NBBY 8
+#endif
+
+/*
+ * The following define causes Tk to use its internal keysym hash table
+ */
+
+#define REDO_KEYSYM_LOOKUP
+
+/*
+ * Defines for X functions that are used by Tk but are treated as
+ * no-op functions on the Macintosh.
+ */
+
+#define XFlush(display)
+#define XFree(data) {if ((data) != NULL) ckfree((char *) (data));}
+#define XGrabServer(display)
+#define XNoOp(display) {display->request++;}
+#define XUngrabServer(display)
+#define XSynchronize(display, bool) {display->request++;}
+#define XVisualIDFromVisual(visual) (visual->visualid)
+
+/*
+ * The following functions are not used on the Mac, so we stub them out.
+ */
+
+#define TkpButtonSetDefaults() {}
+#define TkpCmapStressed(tkwin,colormap) (0)
+#define TkpFreeColor(tkColPtr)
+#define TkSetPixmapColormap(p,c) {}
+#define TkpSync(display)
+
+/*
+ * The following macro returns the pixel value that corresponds to the
+ * RGB values in the given XColor structure.
+ */
+
+#define PIXEL_MAGIC ((unsigned char) 0x69)
+#define TkpGetPixel(p) ((((((PIXEL_MAGIC << 8) \
+ | (((p)->red >> 8) & 0xff)) << 8) \
+ | (((p)->green >> 8) & 0xff)) << 8) \
+ | (((p)->blue >> 8) & 0xff))
+
+/*
+ * This macro stores a representation of the window handle in a string.
+ * This should perhaps use the real size of an XID.
+ */
+
+#define TkpPrintWindowId(buf,w) \
+ sprintf((buf), "0x%x", (unsigned int) (w))
+
+/*
+ * TkpScanWindowId is just an alias for Tcl_GetInt on Unix.
+ */
+
+#define TkpScanWindowId(i,s,wp) \
+ Tcl_GetInt((i),(s),(int *) (wp))
+
+/*
+ * Turn off Tk double-buffering as Aqua windows are already double-buffered.
+ */
+
+#define TK_NO_DOUBLE_BUFFERING 1
+
+/*
+ * Magic pixel code values for system colors.
+ *
+ * NOTE: values must be kept in sync with indices into the
+ * systemColorMap array in tkMacOSXColor.c !
+ */
+
+#define TRANSPARENT_PIXEL 30
+#define HIGHLIGHT_PIXEL 31
+#define HIGHLIGHT_SECONDARY_PIXEL 32
+#define HIGHLIGHT_TEXT_PIXEL 33
+#define HIGHLIGHT_ALTERNATE_PIXEL 34
+#define CONTROL_TEXT_PIXEL 35
+#define CONTROL_BODY_PIXEL 37
+#define CONTROL_FRAME_PIXEL 39
+#define WINDOW_BODY_PIXEL 41
+#define MENU_ACTIVE_PIXEL 43
+#define MENU_ACTIVE_TEXT_PIXEL 45
+#define MENU_BACKGROUND_PIXEL 47
+#define MENU_DISABLED_PIXEL 49
+#define MENU_TEXT_PIXEL 51
+#define APPEARANCE_PIXEL 52
+
+#endif /* _TKMACPORT */
diff --git a/carbon/tkMacOSXPrivate.h b/carbon/tkMacOSXPrivate.h
new file mode 100644
index 0000000..72b418e
--- /dev/null
+++ b/carbon/tkMacOSXPrivate.h
@@ -0,0 +1,352 @@
+/*
+ * tkMacOSXPrivate.h --
+ *
+ * Macros and declarations that are purely internal & private to TkAqua.
+ *
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#ifndef _TKMACPRIV
+#define _TKMACPRIV
+
+#ifndef _TKMACINT
+#include "tkMacOSXInt.h"
+#endif
+
+/* Define constants only available on Mac OS X 10.3 or later */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
+# define kEventAppAvailableWindowBoundsChanged 110
+# define kEventParamTransactionID 'trns'
+# define kEventParamWindowPartCode 'wpar'
+# define typeWindowPartCode 'wpar'
+# define kMenuAttrDoNotUseUserCommandKeys (1 << 7)
+# define kSimpleWindowClass 18
+# define kWindowDoesNotCycleAttribute (1L << 15)
+# define kWindowAsyncDragAttribute (1L << 23)
+# define kThemeBrushAlternatePrimaryHighlightColor -5
+# define kThemeResizeUpCursor 19
+# define kThemeResizeDownCursor 19
+# define kThemeResizeUpDownCursor 19
+# define kThemePoofCursor 19
+# define kThemeBackgroundMetal 6
+# define kThemeIncDecButtonSmall 21
+# define kThemeIncDecButtonMini 22
+# define kThemeComboBox 16
+# define kThemeMiniSystemFont 109
+# define kAppearancePartUpButton 20
+# define kAppearancePartDownButton 21
+# define kAppearancePartPageUpArea 22
+# define kAppearancePartPageDownArea 23
+# define kAppearancePartIndicator 129
+# define kUIModeAllSuppressed 4
+# define FixedToInt(a) ((short)(((Fixed)(a) + fixed1/2) >> 16))
+# define IntToFixed(a) ((Fixed)(a) << 16)
+#endif
+/* Define constants only available on Mac OS X 10.4 or later */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1040
+# define kWindowNoTitleBarAttribute (1L << 9)
+# define kWindowMetalNoContentSeparatorAttribute (1L << 11)
+# define kThemeDisclosureTriangle 6
+# define kThemeBrushListViewOddRowBackground 56
+# define kThemeBrushListViewEvenRowBackground 57
+# define kThemeBrushListViewColumnDivider 58
+# define kThemeMetricScrollBarMinThumbHeight 132
+# define kThemeMetricSmallScrollBarMinThumbHeight 134
+# define kThemeScrollBarMedium kThemeMediumScrollBar
+# define kThemeScrollBarSmall kThemeSmallScrollBar
+# ifdef __BIG_ENDIAN__
+# define kCGBitmapByteOrder32Host (4 << 12)
+# else
+# define kCGBitmapByteOrder32Host (2 << 12)
+# endif
+#endif
+/* Define constants only available on Mac OS X 10.5 or later */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
+# define kWindowUnifiedTitleAndToolbarAttribute (1L << 7)
+# define kWindowTexturedSquareCornersAttribute (1L << 10)
+#endif
+/* HIToolbox version constants */
+#ifndef kHIToolboxVersionNumber10_3
+# define kHIToolboxVersionNumber10_3 (145)
+#endif
+#ifndef kHIToolboxVersionNumber10_4
+# define kHIToolboxVersionNumber10_4 (219)
+#endif
+#ifndef kHIToolboxVersionNumber10_5
+# define kHIToolboxVersionNumber10_5 (343)
+#endif
+/* Macros for HIToolbox runtime version checking */
+MODULE_SCOPE float tkMacOSXToolboxVersionNumber;
+#define TK_IF_HI_TOOLBOX(vers, ...) \
+ tk_if_mac_os_x_min_10_##vers(tkMacOSXToolboxVersionNumber >= \
+ kHIToolboxVersionNumber10_##vers, 1, __VA_ARGS__)
+#define TK_ELSE_HI_TOOLBOX(vers, ...) \
+ tk_else_mac_os_x_min_10_##vers(__VA_ARGS__)
+/* Macros for Mac OS X API availability checking */
+#define TK_IF_MAC_OS_X_API(vers, symbol, ...) \
+ tk_if_mac_os_x_10_##vers(symbol != NULL, 1, __VA_ARGS__)
+#define TK_ELSE_MAC_OS_X(vers, ...) \
+ tk_else_mac_os_x_10_##vers(__VA_ARGS__)
+#define TK_IF_MAC_OS_X_API_COND(vers, symbol, cond, ...) \
+ tk_if_mac_os_x_10_##vers(symbol != NULL, cond, __VA_ARGS__)
+#define TK_ELSE(...) \
+ } else { __VA_ARGS__
+#define TK_ENDIF \
+ }
+/* Private macros that implement the checking macros above */
+#define tk_if_mac_os_x_yes(chk, cond, ...) \
+ if (cond) { __VA_ARGS__
+#define tk_else_mac_os_x_yes(...) \
+ } else {
+#define tk_if_mac_os_x_chk(chk, cond, ...) \
+ if ((chk) && (cond)) { __VA_ARGS__
+#define tk_else_mac_os_x_chk(...) \
+ } else { __VA_ARGS__
+#define tk_if_mac_os_x_no(chk, cond, ...) \
+ if (0) {
+#define tk_else_mac_os_x_no(...) \
+ } else { __VA_ARGS__
+/* Private mapping macros defined according to Mac OS X version requirements */
+/* 10.3 Panther */
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1030
+#define tk_if_mac_os_x_min_10_3 tk_if_mac_os_x_yes
+#define tk_else_mac_os_x_min_10_3 tk_else_mac_os_x_yes
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+#define tk_if_mac_os_x_10_3 tk_if_mac_os_x_yes
+#define tk_else_mac_os_x_10_3 tk_else_mac_os_x_yes
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+#else /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#define tk_if_mac_os_x_min_10_3 tk_if_mac_os_x_chk
+#define tk_else_mac_os_x_min_10_3 tk_else_mac_os_x_chk
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+#define tk_if_mac_os_x_10_3 tk_if_mac_os_x_chk
+#define tk_else_mac_os_x_10_3 tk_else_mac_os_x_chk
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
+#define tk_if_mac_os_x_10_3 tk_if_mac_os_x_no
+#define tk_else_mac_os_x_10_3 tk_else_mac_os_x_no
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+/* 10.4 Tiger */
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1040
+#define tk_if_mac_os_x_min_10_4 tk_if_mac_os_x_yes
+#define tk_else_mac_os_x_min_10_4 tk_else_mac_os_x_yes
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+#define tk_if_mac_os_x_10_4 tk_if_mac_os_x_yes
+#define tk_else_mac_os_x_10_4 tk_else_mac_os_x_yes
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+#else /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#define tk_if_mac_os_x_min_10_4 tk_if_mac_os_x_chk
+#define tk_else_mac_os_x_min_10_4 tk_else_mac_os_x_chk
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+#define tk_if_mac_os_x_10_4 tk_if_mac_os_x_chk
+#define tk_else_mac_os_x_10_4 tk_else_mac_os_x_chk
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1040
+#define tk_if_mac_os_x_10_4 tk_if_mac_os_x_no
+#define tk_else_mac_os_x_10_4 tk_else_mac_os_x_no
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+/* 10.5 Leopard */
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
+#define tk_if_mac_os_x_min_10_5 tk_if_mac_os_x_yes
+#define tk_else_mac_os_x_min_10_5 tk_else_mac_os_x_yes
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+#define tk_if_mac_os_x_10_5 tk_if_mac_os_x_yes
+#define tk_else_mac_os_x_10_5 tk_else_mac_os_x_yes
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+#else /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#define tk_if_mac_os_x_min_10_5 tk_if_mac_os_x_chk
+#define tk_else_mac_os_x_min_10_5 tk_else_mac_os_x_chk
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+#define tk_if_mac_os_x_10_5 tk_if_mac_os_x_chk
+#define tk_else_mac_os_x_10_5 tk_else_mac_os_x_chk
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
+#define tk_if_mac_os_x_10_5 tk_if_mac_os_x_no
+#define tk_else_mac_os_x_10_5 tk_else_mac_os_x_no
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+
+/*
+ * Macros for DEBUG_ASSERT_MESSAGE et al from Debugging.h.
+ */
+
+#undef kComponentSignatureString
+#undef COMPONENT_SIGNATURE
+#define kComponentSignatureString "TkMacOSX"
+#define COMPONENT_SIGNATURE 'Tk '
+
+/*
+ * Macros abstracting checks only active in a debug build.
+ */
+
+#ifdef TK_MAC_DEBUG
+/*
+ * Macro to do debug message output.
+ */
+#define TkMacOSXDbgMsg(m, ...) \
+ do { \
+ fprintf(stderr, "%s:%d: %s(): " m "\n", strrchr(__FILE__, '/')+1, \
+ __LINE__, __func__, ##__VA_ARGS__); \
+ } while (0)
+
+/*
+ * Macro to do debug API failure message output.
+ */
+#if !defined(DEBUGLEVEL) || !DEBUGLEVEL
+#define TkMacOSXDbgOSErr(f, err) \
+ do { \
+ TkMacOSXDbgMsg("%s failed: %ld", #f, err); \
+ } while (0)
+#else
+#define TkMacOSXDbgOSErr(f, err) \
+ do { \
+ DEBUG_ASSERT_MESSAGE(kComponentSignatureString, #f " failed:", \
+ __func__, 0, strrchr(__FILE__, '/')+1, __LINE__, err); \
+ } while (0)
+#endif
+
+/*
+ * Macro to do very common check for noErr return from given API and output
+ * debug message in case of failure.
+ */
+#define ChkErr(f, ...) ({ \
+ OSStatus err = f(__VA_ARGS__); \
+ if (err != noErr) { \
+ TkMacOSXDbgOSErr(f, err); \
+ } \
+ err;})
+
+/*
+ * Macro to check emptyness of shared QD tmp region before use in debug builds.
+ */
+#define TkMacOSXCheckTmpQdRgnEmpty() \
+ do { \
+ if (!EmptyRgn(tkMacOSXtmpQdRgn)) { \
+ Tcl_Panic("tkMacOSXtmpQdRgn nonempty"); \
+ } \
+ } while(0)
+#else /* TK_MAC_DEBUG */
+#define TkMacOSXDbgMsg(m, ...)
+#define TkMacOSXDbgOSErr(f, err)
+#define ChkErr(f, ...) ({f(__VA_ARGS__);})
+#define TkMacOSXCheckTmpQdRgnEmpty()
+#endif /* TK_MAC_DEBUG */
+
+/*
+ * Macro abstracting use of TkMacOSXGetNamedSymbol to init named symbols.
+ */
+
+#define TkMacOSXInitNamedSymbol(module, ret, symbol, ...) \
+ static ret (* symbol)(__VA_ARGS__) = (void*)(-1L); \
+ if (symbol == (void*)(-1L)) { \
+ symbol = TkMacOSXGetNamedSymbol(STRINGIFY(module), \
+ STRINGIFY(_##symbol)); \
+ }
+
+/*
+ * Structure encapsulating current drawing environment.
+ */
+
+typedef struct TkMacOSXDrawingContext {
+ CGContextRef context;
+ CGrafPtr port, savePort;
+ ThemeDrawingState saveState;
+ RgnHandle saveClip;
+ HIShapeRef clipRgn;
+ PixPatHandle penPat;
+ Rect portBounds;
+ Boolean portChanged;
+} TkMacOSXDrawingContext;
+
+/*
+ * Variables internal to TkAqua.
+ */
+
+MODULE_SCOPE RgnHandle tkMacOSXtmpQdRgn;
+MODULE_SCOPE int tkMacOSXUseCGDrawing;
+
+/*
+ * Prototypes for TkMacOSXRegion.c.
+ */
+
+#if 0
+MODULE_SCOPE void TkMacOSXEmtpyRegion(TkRegion r);
+MODULE_SCOPE int TkMacOSXIsEmptyRegion(TkRegion r);
+#endif
+MODULE_SCOPE HIShapeRef TkMacOSXGetNativeRegion(TkRegion r);
+MODULE_SCOPE void TkMacOSXSetWithNativeRegion(TkRegion r,
+ HIShapeRef rgn);
+MODULE_SCOPE void TkMacOSXOffsetRegion(TkRegion r, short dx, short dy);
+MODULE_SCOPE HIShapeRef TkMacOSXHIShapeCreateEmpty(void);
+MODULE_SCOPE HIMutableShapeRef TkMacOSXHIShapeCreateMutableWithRect(
+ const CGRect *inRect);
+MODULE_SCOPE OSStatus TkMacOSXHIShapeSetWithShape(
+ HIMutableShapeRef inDestShape,
+ HIShapeRef inSrcShape);
+#if 0
+MODULE_SCOPE OSStatus TkMacOSXHIShapeSetWithRect(HIMutableShapeRef inShape,
+ const CGRect *inRect);
+#endif
+MODULE_SCOPE OSStatus TkMacOSHIShapeDifferenceWithRect(
+ HIMutableShapeRef inShape, const CGRect *inRect);
+MODULE_SCOPE OSStatus TkMacOSHIShapeUnionWithRect(HIMutableShapeRef inShape,
+ const CGRect *inRect);
+MODULE_SCOPE OSStatus TkMacOSHIShapeUnion(HIShapeRef inShape1,
+ HIShapeRef inShape2, HIMutableShapeRef outResult);
+
+/*
+ * Prototypes of TkAqua internal procs.
+ */
+
+MODULE_SCOPE void * TkMacOSXGetNamedSymbol(const char *module,
+ const char *symbol);
+MODULE_SCOPE void TkMacOSXDisplayChanged(Display *display);
+MODULE_SCOPE void TkMacOSXInitScrollbarMetrics(void);
+MODULE_SCOPE int TkMacOSXUseAntialiasedText(Tcl_Interp *interp,
+ int enable);
+MODULE_SCOPE void TkMacOSXInitCarbonEvents(Tcl_Interp *interp);
+MODULE_SCOPE int TkMacOSXInitCGDrawing(Tcl_Interp *interp, int enable,
+ int antiAlias);
+MODULE_SCOPE void TkMacOSXInitKeyboard(Tcl_Interp *interp);
+MODULE_SCOPE int TkMacOSXGenerateFocusEvent(Window window,
+ int activeFlag);
+MODULE_SCOPE int TkMacOSXGenerateParentMenuSelectEvent(MenuRef menu);
+MODULE_SCOPE int TkMacOSXGenerateMenuSelectEvent(MenuRef menu,
+ MenuItemIndex index);
+MODULE_SCOPE void TkMacOSXClearActiveMenu(MenuRef menu);
+MODULE_SCOPE WindowClass TkMacOSXWindowClass(TkWindow *winPtr);
+MODULE_SCOPE int TkMacOSXIsWindowZoomed(TkWindow *winPtr);
+MODULE_SCOPE int TkGenerateButtonEventForXPointer(Window window);
+MODULE_SCOPE EventModifiers TkMacOSXModifierState(void);
+MODULE_SCOPE int TkMacOSXSetupDrawingContext(Drawable d, GC gc,
+ int useCG, TkMacOSXDrawingContext *dcPtr);
+MODULE_SCOPE void TkMacOSXRestoreDrawingContext(
+ TkMacOSXDrawingContext *dcPtr);
+MODULE_SCOPE void TkMacOSXSetColorInPort(unsigned long pixel, int fg,
+ PixPatHandle penPat, CGrafPtr port);
+MODULE_SCOPE void TkMacOSXSetColorInContext(unsigned long pixel,
+ CGContextRef context);
+MODULE_SCOPE int TkMacOSXRunTclEventLoop(void);
+MODULE_SCOPE OSStatus TkMacOSXStartTclEventLoopCarbonTimer(void);
+MODULE_SCOPE OSStatus TkMacOSXStopTclEventLoopCarbonTimer(void);
+MODULE_SCOPE void TkMacOSXTrackingLoop(int tracking);
+MODULE_SCOPE OSStatus TkMacOSXReceiveAndDispatchEvent(void);
+MODULE_SCOPE void TkMacOSXInstallWindowCarbonEventHandler(
+ Tcl_Interp *interp, WindowRef window);
+MODULE_SCOPE int TkMacOSXMakeFullscreen(TkWindow *winPtr,
+ WindowRef window, int fullscreen,
+ Tcl_Interp *interp);
+MODULE_SCOPE void TkMacOSXEnterExitFullscreen(TkWindow *winPtr,
+ int active);
+MODULE_SCOPE void TkMacOSXBringWindowForward(WindowRef wRef);
+MODULE_SCOPE WindowRef TkMacOSXDrawableWindow(Drawable drawable);
+MODULE_SCOPE void TkMacOSXWinCGBounds(TkWindow *winPtr, CGRect *bounds);
+MODULE_SCOPE HIShapeRef TkMacOSXGetClipRgn(Drawable drawable);
+MODULE_SCOPE Tcl_Obj * TkMacOSXGetStringObjFromCFString(CFStringRef str);
+
+#endif /* _TKMACPRIV */
diff --git a/carbon/tkMacOSXRegion.c b/carbon/tkMacOSXRegion.c
new file mode 100644
index 0000000..e2faab0
--- /dev/null
+++ b/carbon/tkMacOSXRegion.c
@@ -0,0 +1,644 @@
+/*
+ * tkMacOSXRegion.c --
+ *
+ * Implements X window calls for manipulating regions
+ *
+ * Copyright (c) 1995-1996 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkCreateRegion --
+ *
+ * Implements the equivelent of the X window function XCreateRegion. See
+ * Xwindow documentation for more details.
+ *
+ * Results:
+ * Returns an allocated region handle.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkRegion
+TkCreateRegion(void)
+{
+ return (TkRegion) HIShapeCreateMutable();
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkDestroyRegion --
+ *
+ * Implements the equivelent of the X window function XDestroyRegion. See
+ * Xwindow documentation for more details.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Memory is freed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkDestroyRegion(
+ TkRegion r)
+{
+ if (r) {
+ CFRelease(r);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkIntersectRegion --
+ *
+ * Implements the equivalent of the X window function XIntersectRegion.
+ * See Xwindow documentation for more details.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkIntersectRegion(
+ TkRegion sra,
+ TkRegion srb,
+ TkRegion dr_return)
+{
+ ChkErr(HIShapeIntersect, (HIShapeRef) sra, (HIShapeRef) srb,
+ (HIMutableShapeRef) dr_return);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkSubtractRegion --
+ *
+ * Implements the equivalent of the X window function XSubtractRegion.
+ * See X window documentation for more details.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkSubtractRegion(
+ TkRegion sra,
+ TkRegion srb,
+ TkRegion dr_return)
+{
+ ChkErr(HIShapeDifference, (HIShapeRef) sra, (HIShapeRef) srb,
+ (HIMutableShapeRef) dr_return);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkUnionRectWithRegion --
+ *
+ * Implements the equivelent of the X window function
+ * XUnionRectWithRegion. See Xwindow documentation for more details.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkUnionRectWithRegion(
+ XRectangle* rectangle,
+ TkRegion src_region,
+ TkRegion dest_region_return)
+{
+ const CGRect r = CGRectMake(rectangle->x, rectangle->y,
+ rectangle->width, rectangle->height);
+
+ if (src_region == dest_region_return) {
+ ChkErr(TkMacOSHIShapeUnionWithRect,
+ (HIMutableShapeRef) dest_region_return, &r);
+ } else {
+ HIShapeRef rectRgn = HIShapeCreateWithRect(&r);
+
+ ChkErr(TkMacOSHIShapeUnion, rectRgn, (HIShapeRef) src_region,
+ (HIMutableShapeRef) dest_region_return);
+ CFRelease(rectRgn);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkRectInRegion --
+ *
+ * Implements the equivelent of the X window function XRectInRegion. See
+ * Xwindow documentation for more details.
+ *
+ * Results:
+ * Returns RectanglePart or RectangleOut. Note that this is not a
+ * complete implementation since it doesn't test for RectangleIn.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkRectInRegion(
+ TkRegion region,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height)
+{
+ int result;
+ const CGRect r = CGRectMake(x, y, width, height);
+
+ TK_IF_MAC_OS_X_API (4, HIShapeIntersectsRect,
+ result = HIShapeIntersectsRect((HIShapeRef) region, &r) ?
+ RectanglePart : RectangleOut;
+ ) TK_ELSE_MAC_OS_X (4,
+ HIShapeRef rectRgn = HIShapeCreateWithRect(&r);
+ HIShapeRef sectRgn = HIShapeCreateIntersection((HIShapeRef) region,
+ rectRgn);
+
+#if 1
+ result = !HIShapeIsEmpty(sectRgn) ? RectanglePart : RectangleOut;
+#else
+ /*
+ * More expensive full implementation that tests for RectangleIn,
+ * unused by Tk at present.
+ */
+
+ if (!HIShapeIsEmpty(sectRgn)) {
+ HIShapeRef diffRgn = HIShapeCreateDifference(rectRgn, sectRgn);
+
+ if (HIShapeIsEmpty(diffRgn)) {
+ result = RectangleIn;
+ } else {
+ result = RectanglePart;
+ }
+ CFRelease(diffRgn);
+ } else {
+ result = RectangleOut;
+ }
+#endif
+ CFRelease(sectRgn);
+ CFRelease(rectRgn);
+ ) TK_ENDIF;
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkClipBox --
+ *
+ * Implements the equivelent of the X window function XClipBox. See
+ * Xwindow documentation for more details.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkClipBox(
+ TkRegion r,
+ XRectangle* rect_return)
+{
+ CGRect rect;
+
+ HIShapeGetBounds((HIShapeRef) r, &rect);
+ rect_return->x = rect.origin.x;
+ rect_return->y = rect.origin.y;
+ rect_return->width = rect.size.width;
+ rect_return->height = rect.size.height;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpBuildRegionFromAlphaData --
+ *
+ * Set up a rectangle of the given region based on the supplied alpha
+ * data.
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * The region is updated, with extra pixels added to it.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpBuildRegionFromAlphaData(
+ TkRegion region, /* Region to update. */
+ unsigned int x, /* Where in region to update. */
+ unsigned int y, /* Where in region to update. */
+ unsigned int width, /* Size of rectangle to update. */
+ unsigned int height, /* Size of rectangle to update. */
+ unsigned char *dataPtr, /* Data to read from. */
+ unsigned int pixelStride, /* num bytes from one piece of alpha
+ * data to the next in the line. */
+ unsigned int lineStride) /* num bytes from one line of alpha
+ * data to the next line. */
+{
+ unsigned char *lineDataPtr;
+ unsigned int x1, y1, end;
+ XRectangle rect;
+
+ for (y1 = 0; y1 < height; y1++) {
+ lineDataPtr = dataPtr;
+ for (x1 = 0; x1 < width; x1 = end) {
+ /*
+ * Search for first non-transparent pixel.
+ */
+
+ while ((x1 < width) && !*lineDataPtr) {
+ x1++;
+ lineDataPtr += pixelStride;
+ }
+ end = x1;
+
+ /*
+ * Search for first transparent pixel.
+ */
+
+ while ((end < width) && *lineDataPtr) {
+ end++;
+ lineDataPtr += pixelStride;
+ }
+ if (end > x1) {
+ rect.x = x + x1;
+ rect.y = y + y1;
+ rect.width = end - x1;
+ rect.height = 1;
+ TkUnionRectWithRegion(&rect, region, region);
+ }
+ }
+ dataPtr += lineStride;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpRetainRegion --
+ *
+ * Increases reference count of region.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpRetainRegion(
+ TkRegion r)
+{
+ CFRetain(r);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpReleaseRegion --
+ *
+ * Decreases reference count of region.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * May free memory.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpReleaseRegion(
+ TkRegion r)
+{
+ CFRelease(r);
+}
+#if 0
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXEmtpyRegion --
+ *
+ * Set region to emtpy.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXEmtpyRegion(
+ TkRegion r)
+{
+ ChkErr(HIShapeSetEmpty, (HIMutableShapeRef) r);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXIsEmptyRegion --
+ *
+ * Return native region for given tk region.
+ *
+ * Results:
+ * 1 if empty, 0 otherwise.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkMacOSXIsEmptyRegion(
+ TkRegion r)
+{
+ return HIShapeIsEmpty((HIMutableShapeRef) r) ? 1 : 0;
+}
+#endif
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetNativeRegion --
+ *
+ * Return native region for given tk region.
+ *
+ * Results:
+ * Native region, CFRelease when done.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+HIShapeRef
+TkMacOSXGetNativeRegion(
+ TkRegion r)
+{
+ return (HIShapeRef) CFRetain(r);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXSetWithNativeRegion --
+ *
+ * Set region to the native region.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXSetWithNativeRegion(
+ TkRegion r,
+ HIShapeRef rgn)
+{
+ ChkErr(TkMacOSXHIShapeSetWithShape, (HIMutableShapeRef) r, rgn);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXOffsetRegion --
+ *
+ * Offsets region by given distances.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXOffsetRegion(
+ TkRegion r,
+ short dx,
+ short dy)
+{
+ ChkErr(HIShapeOffset, (HIMutableShapeRef) r, dx, dy);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXHIShapeCreateEmpty, TkMacOSXHIShapeCreateMutableWithRect,
+ * TkMacOSXHIShapeSetWithShape, TkMacOSXHIShapeSetWithRect,
+ * TkMacOSHIShapeDifferenceWithRect, TkMacOSHIShapeUnionWithRect,
+ * TkMacOSHIShapeUnion --
+ *
+ * Wrapper functions for missing/buggy HIShape API
+ *
+ *----------------------------------------------------------------------
+ */
+
+HIShapeRef
+TkMacOSXHIShapeCreateEmpty(void)
+{
+ HIShapeRef result;
+
+ TK_IF_MAC_OS_X_API (4, HIShapeCreateEmpty,
+ result = HIShapeCreateEmpty();
+ ) TK_ELSE_MAC_OS_X (4,
+ static HIShapeRef emptyRgn = NULL;
+
+ if (!emptyRgn) {
+ HIMutableShapeRef rgn = HIShapeCreateMutable();
+
+ emptyRgn = HIShapeCreateCopy(rgn);
+ CFRelease(rgn);
+ }
+ result = HIShapeCreateCopy(emptyRgn);
+ ) TK_ENDIF;
+
+ return result;
+}
+
+HIMutableShapeRef
+TkMacOSXHIShapeCreateMutableWithRect(
+ const CGRect *inRect)
+{
+ HIMutableShapeRef result;
+
+ TK_IF_MAC_OS_X_API (5, HIShapeCreateMutableWithRect,
+ result = HIShapeCreateMutableWithRect(inRect);
+ ) TK_ELSE_MAC_OS_X (5,
+ HIShapeRef rgn = HIShapeCreateWithRect(inRect);
+
+ result = HIShapeCreateMutableCopy(rgn);
+ CFRelease(rgn);
+ ) TK_ENDIF;
+
+ return result;
+}
+
+OSStatus
+TkMacOSXHIShapeSetWithShape(
+ HIMutableShapeRef inDestShape,
+ HIShapeRef inSrcShape)
+{
+ OSStatus result;
+
+ TK_IF_MAC_OS_X_API (5, HIShapeSetWithShape,
+ result = HIShapeSetWithShape(inDestShape, inSrcShape);
+ ) TK_ELSE_MAC_OS_X (5,
+ result = HIShapeSetEmpty(inDestShape);
+ if (result == noErr) {
+ result = HIShapeDifference(inSrcShape, inDestShape, inDestShape);
+ }
+ ) TK_ENDIF;
+
+ return result;
+}
+
+#if 0
+OSStatus
+TkMacOSXHIShapeSetWithRect(
+ HIMutableShapeRef inShape,
+ const CGRect *inRect)
+{
+ OSStatus result;
+ HIShapeRef rgn = HIShapeCreateWithRect(inRect);
+
+ result = TkMacOSXHIShapeSetWithShape(inShape, rgn);
+ CFRelease(rgn);
+
+ return result;
+}
+#endif
+
+OSStatus
+TkMacOSHIShapeDifferenceWithRect(
+ HIMutableShapeRef inShape,
+ const CGRect *inRect)
+{
+ OSStatus result;
+ HIShapeRef rgn = HIShapeCreateWithRect(inRect);
+
+ result = HIShapeDifference(inShape, rgn, inShape);
+ CFRelease(rgn);
+
+ return result;
+}
+
+OSStatus
+TkMacOSHIShapeUnionWithRect(
+ HIMutableShapeRef inShape,
+ const CGRect *inRect)
+{
+ OSStatus result;
+
+ TK_IF_MAC_OS_X_API (5, HIShapeUnionWithRect,
+ result = HIShapeUnionWithRect(inShape, inRect);
+ ) TK_ELSE_MAC_OS_X (5,
+ HIShapeRef rgn = HIShapeCreateWithRect(inRect);
+
+ result = TkMacOSHIShapeUnion(rgn, inShape, inShape);
+ CFRelease(rgn);
+ ) TK_ENDIF;
+
+ return result;
+}
+
+OSStatus
+TkMacOSHIShapeUnion(
+ HIShapeRef inShape1,
+ HIShapeRef inShape2,
+ HIMutableShapeRef outResult)
+{
+ OSStatus result;
+
+ TK_IF_HI_TOOLBOX (4,
+ result = HIShapeUnion(inShape1, inShape2, outResult);
+ ) TK_ELSE_HI_TOOLBOX (4,
+ /*
+ * Workaround HIShapeUnion bug in 10.3 and earlier.
+ */
+
+ HIShapeRef rgn = HIShapeCreateCopy(outResult);
+
+ result = HIShapeUnion(inShape1, inShape2, (HIMutableShapeRef) rgn);
+ if (result == noErr) {
+ result = HIShapeSetEmpty(outResult);
+ if (result == noErr) {
+ result = HIShapeDifference(rgn, outResult, outResult);
+ }
+ }
+ CFRelease(rgn);
+ ) TK_ENDIF;
+
+ return result;
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * coding: utf-8
+ * End:
+ */
diff --git a/carbon/tkMacOSXScale.c b/carbon/tkMacOSXScale.c
new file mode 100644
index 0000000..bc46596
--- /dev/null
+++ b/carbon/tkMacOSXScale.c
@@ -0,0 +1,482 @@
+/*
+ * tkMacOSXScale.c --
+ *
+ * This file implements the Macintosh specific portion of the
+ * scale widget.
+ *
+ * Copyright (c) 1996 by Sun Microsystems, Inc.
+ * Copyright (c) 1998-2000 by Scriptics Corporation.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkScale.h"
+
+/*
+#ifdef TK_MAC_DEBUG
+#define TK_MAC_DEBUG_SCALE
+#endif
+*/
+
+/*
+ * Defines used in this file.
+ */
+
+#define slider 1110
+#define inSlider 1
+#define inInc 2
+#define inDecr 3
+
+/*
+ * Declaration of Macintosh specific scale structure.
+ */
+
+typedef struct MacScale {
+ TkScale info; /* Generic scale info. */
+ int flags; /* Flags. */
+ ControlRef scaleHandle; /* Handle to the Scale control struct. */
+} MacScale;
+
+/*
+ * Globals uses locally in this file.
+ */
+static ControlActionUPP scaleActionProc = NULL; /* Pointer to func. */
+
+/*
+ * Forward declarations for procedures defined later in this file:
+ */
+
+static void MacScaleEventProc(ClientData clientData, XEvent *eventPtr);
+static pascal void ScaleActionProc(ControlRef theControl,
+ ControlPartCode partCode);
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpCreateScale --
+ *
+ * Allocate a new TkScale structure.
+ *
+ * Results:
+ * Returns a newly allocated TkScale structure.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkScale *
+TkpCreateScale(
+ Tk_Window tkwin)
+{
+ MacScale *macScalePtr = ckalloc(sizeof(MacScale));
+
+ macScalePtr->scaleHandle = NULL;
+ if (scaleActionProc == NULL) {
+ scaleActionProc = NewControlActionUPP(ScaleActionProc);
+ }
+
+ Tk_CreateEventHandler(tkwin, ButtonPressMask,
+ MacScaleEventProc, (ClientData) macScalePtr);
+
+ return (TkScale *) macScalePtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDestroyScale --
+ *
+ * Free Macintosh specific resources.
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * The slider control is destroyed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDestroyScale(
+ TkScale *scalePtr)
+{
+ MacScale *macScalePtr = (MacScale *) scalePtr;
+
+ /*
+ * Free Macintosh control.
+ */
+
+ if (macScalePtr->scaleHandle != NULL) {
+ DisposeControl(macScalePtr->scaleHandle);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDisplayScale --
+ *
+ * This procedure is invoked as an idle handler to redisplay
+ * the contents of a scale widget.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The scale gets redisplayed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDisplayScale(
+ ClientData clientData) /* Widget record for scale. */
+{
+ TkScale *scalePtr = (TkScale *) clientData;
+ Tk_Window tkwin = scalePtr->tkwin;
+ Tcl_Interp *interp = scalePtr->interp;
+ int result;
+ char string[PRINT_CHARS];
+ MacScale *macScalePtr = (MacScale *) clientData;
+ Rect r;
+ WindowRef windowRef;
+ CGrafPtr destPort, savePort;
+ Boolean portChanged;
+ MacDrawable *macDraw;
+ SInt32 initialValue, minValue, maxValue;
+ UInt16 numTicks;
+
+#ifdef TK_MAC_DEBUG_SCALE
+ TkMacOSXDbgMsg("TkpDisplayScale");
+#endif
+ scalePtr->flags &= ~REDRAW_PENDING;
+ if ((scalePtr->tkwin == NULL) || !Tk_IsMapped(scalePtr->tkwin)) {
+ goto done;
+ }
+
+ /*
+ * Invoke the scale's command if needed.
+ */
+
+ Tcl_Preserve((ClientData) scalePtr);
+ if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) {
+ Tcl_Preserve((ClientData) interp);
+ sprintf(string, scalePtr->format, scalePtr->value);
+ result = Tcl_VarEval(interp, scalePtr->command, " ", string, NULL);
+ if (result != TCL_OK) {
+ Tcl_AddErrorInfo(interp, "\n (command executed by scale)");
+ Tcl_BackgroundException(interp, result);
+ }
+ Tcl_Release((ClientData) interp);
+ }
+ scalePtr->flags &= ~INVOKE_COMMAND;
+ if (scalePtr->flags & SCALE_DELETED) {
+ Tcl_Release((ClientData) scalePtr);
+ return;
+ }
+ Tcl_Release((ClientData) scalePtr);
+
+ /*
+ * Now handle the part of redisplay that is the same for
+ * horizontal and vertical scales: border and traversal
+ * highlight.
+ */
+
+ if (scalePtr->highlightWidth != 0) {
+ GC gc = Tk_GCForColor(scalePtr->highlightColorPtr, Tk_WindowId(tkwin));
+
+ Tk_DrawFocusHighlight(tkwin, gc, scalePtr->highlightWidth,
+ Tk_WindowId(tkwin));
+ }
+ Tk_Draw3DRectangle(tkwin, Tk_WindowId(tkwin), scalePtr->bgBorder,
+ scalePtr->highlightWidth, scalePtr->highlightWidth,
+ Tk_Width(tkwin) - 2*scalePtr->highlightWidth,
+ Tk_Height(tkwin) - 2*scalePtr->highlightWidth,
+ scalePtr->borderWidth, scalePtr->relief);
+
+ /*
+ * Set up port for drawing Macintosh control.
+ */
+
+ macDraw = (MacDrawable *) Tk_WindowId(tkwin);
+ destPort = TkMacOSXGetDrawablePort(Tk_WindowId(tkwin));
+ windowRef = TkMacOSXDrawableWindow(Tk_WindowId(tkwin));
+ portChanged = QDSwapPort(destPort, &savePort);
+ TkMacOSXSetUpClippingRgn(Tk_WindowId(tkwin));
+
+ /*
+ * Create Macintosh control.
+ */
+
+#define MAC_OSX_SCROLL_WIDTH 10
+
+ if (scalePtr->orient == ORIENT_HORIZONTAL) {
+ int offset = (Tk_Height(tkwin) - MAC_OSX_SCROLL_WIDTH)/2;
+
+ if (offset < 0) {
+ offset = 0;
+ }
+
+ r.left = macDraw->xOff + scalePtr->inset;
+ r.top = macDraw->yOff + offset;
+ r.right = macDraw->xOff+Tk_Width(tkwin) - scalePtr->inset;
+ r.bottom = macDraw->yOff + offset + MAC_OSX_SCROLL_WIDTH/2;
+ } else {
+ int offset = (Tk_Width(tkwin) - MAC_OSX_SCROLL_WIDTH)/2;
+
+ if (offset < 0) {
+ offset = 0;
+ }
+
+ r.left = macDraw->xOff + offset;
+ r.top = macDraw->yOff + scalePtr->inset;
+ r.right = macDraw->xOff + offset + MAC_OSX_SCROLL_WIDTH/2;
+ r.bottom = macDraw->yOff+Tk_Height(tkwin) - scalePtr->inset;
+ }
+
+ if (macScalePtr->scaleHandle == NULL) {
+#ifdef TK_MAC_DEBUG_SCALE
+ TkMacOSXDbgMsg("Initialising scale");
+#endif
+ initialValue = scalePtr->value;
+ if (scalePtr->orient == ORIENT_HORIZONTAL) {
+ minValue = scalePtr->fromValue;
+ maxValue = scalePtr->toValue;
+ } else {
+ minValue = scalePtr->fromValue;
+ maxValue = scalePtr->toValue;
+ }
+
+ if (scalePtr->tickInterval == 0) {
+ numTicks = 0;
+ } else {
+ numTicks = (maxValue - minValue)/scalePtr->tickInterval;
+ }
+
+ CreateSliderControl(windowRef, &r, initialValue, minValue, maxValue,
+ kControlSliderPointsDownOrRight, numTicks, 1, scaleActionProc,
+ &(macScalePtr->scaleHandle));
+ SetControlReference(macScalePtr->scaleHandle, (UInt32) scalePtr);
+
+ if (IsWindowActive(windowRef)) {
+ macScalePtr->flags |= ACTIVE;
+ }
+ } else {
+ SetControlBounds(macScalePtr->scaleHandle, &r);
+ SetControl32BitValue(macScalePtr->scaleHandle, scalePtr->value);
+ SetControl32BitMinimum(macScalePtr->scaleHandle, scalePtr->fromValue);
+ SetControl32BitMaximum(macScalePtr->scaleHandle, scalePtr->toValue);
+ }
+
+ /*
+ * Finally draw the control.
+ */
+
+ SetControlVisibility(macScalePtr->scaleHandle,true,true);
+ HiliteControl(macScalePtr->scaleHandle,0);
+ Draw1Control(macScalePtr->scaleHandle);
+
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+done:
+ scalePtr->flags &= ~REDRAW_ALL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpScaleElement --
+ *
+ * Determine which part of a scale widget lies under a given
+ * point.
+ *
+ * Results:
+ * The return value is either TROUGH1, SLIDER, TROUGH2, or
+ * OTHER, depending on which of the scale's active elements
+ * (if any) is under the point at (x,y).
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpScaleElement(
+ TkScale *scalePtr, /* Widget record for scale. */
+ int x, int y) /* Coordinates within scalePtr's window. */
+{
+ MacScale *macScalePtr = (MacScale *) scalePtr;
+ ControlPartCode part;
+ Point where;
+ Rect bounds;
+ CGrafPtr destPort, savePort;
+ Boolean portChanged;
+
+#ifdef TK_MAC_DEBUG_SCALE
+ TkMacOSXDbgMsg("TkpScaleElement");
+#endif
+ destPort = TkMacOSXGetDrawablePort(Tk_WindowId(scalePtr->tkwin));
+ portChanged = QDSwapPort(destPort, &savePort);
+
+ /*
+ * All of the calculations in this procedure mirror those in
+ * DisplayScrollbar. Be sure to keep the two consistent.
+ */
+
+ TkMacOSXWinBounds((TkWindow *) scalePtr->tkwin, &bounds);
+ where.h = x + bounds.left;
+ where.v = y + bounds.top;
+ part = TestControl(macScalePtr->scaleHandle, where);
+
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+
+#ifdef TK_MAC_DEBUG_SCALE
+ fprintf (stderr,"ScalePart %d, pos ( %d %d )\n", part, where.h, where.v );
+#endif
+
+ switch (part) {
+ case inSlider:
+ return SLIDER;
+ case inInc:
+ if (scalePtr->orient == ORIENT_VERTICAL) {
+ return TROUGH1;
+ } else {
+ return TROUGH2;
+ }
+ case inDecr:
+ if (scalePtr->orient == ORIENT_VERTICAL) {
+ return TROUGH2;
+ } else {
+ return TROUGH1;
+ }
+ default:
+ return OTHER;
+ }
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * MacScaleEventProc --
+ *
+ * This procedure is invoked by the Tk dispatcher for
+ * ButtonPress events on scales.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * When the window gets deleted, internal structures get
+ * cleaned up. When it gets exposed, it is redisplayed.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+MacScaleEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
+{
+ MacScale *macScalePtr = (MacScale *) clientData;
+ Point where;
+ Rect bounds;
+ int part;
+ CGrafPtr destPort, savePort;
+ Boolean portChanged;
+
+#ifdef TK_MAC_DEBUG_SCALE
+ fprintf(stderr,"MacScaleEventProc\n" );
+#endif
+
+ /*
+ * To call Macintosh control routines we must have the port
+ * set to the window containing the control. We will then test
+ * which part of the control was hit and act accordingly.
+ */
+
+ destPort = TkMacOSXGetDrawablePort(Tk_WindowId(macScalePtr->info.tkwin));
+ portChanged = QDSwapPort(destPort, &savePort);
+ TkMacOSXSetUpClippingRgn(Tk_WindowId(macScalePtr->info.tkwin));
+
+ TkMacOSXWinBounds((TkWindow *) macScalePtr->info.tkwin, &bounds);
+ where.h = eventPtr->xbutton.x + bounds.left;
+ where.v = eventPtr->xbutton.y + bounds.top;
+#ifdef TK_MAC_DEBUG_SCALE
+ TkMacOSXDbgMsg("calling TestControl");
+#endif
+ part = TestControl(macScalePtr->scaleHandle, where);
+ if (part == 0) {
+ return;
+ }
+
+ TkMacOSXTrackingLoop(1);
+ part = HandleControlClick(macScalePtr->scaleHandle, where,
+ TkMacOSXModifierState(), scaleActionProc);
+ TkMacOSXTrackingLoop(0);
+
+ /*
+ * Update the value for the widget.
+ */
+
+ macScalePtr->info.value = GetControlValue(macScalePtr->scaleHandle);
+ /* TkScaleSetValue(&macScalePtr->info, macScalePtr->info.value, 1, 0); */
+
+ /*
+ * The HandleControlClick call will "eat" the ButtonUp event. We now
+ * generate a ButtonUp event so Tk will unset implicit grabs etc.
+ */
+
+ TkGenerateButtonEventForXPointer(Tk_WindowId(macScalePtr->info.tkwin));
+
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * ScaleActionProc --
+ *
+ * Callback procedure used by the Macintosh toolbox call
+ * HandleControlClick. This call will update the display
+ * while the scrollbar is being manipulated by the user.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * May change the display.
+ *
+ *--------------------------------------------------------------
+ */
+
+static pascal void
+ScaleActionProc(
+ ControlRef theControl, /* Handle to scrollbat control */
+ ControlPartCode partCode) /* Part of scrollbar that was "hit" */
+{
+ int value;
+ TkScale *scalePtr = (TkScale *) GetControlReference(theControl);
+
+#ifdef TK_MAC_DEBUG_SCALE
+ TkMacOSXDbgMsg("ScaleActionProc");
+#endif
+ value = GetControlValue(theControl);
+ TkScaleSetValue(scalePtr, value, 1, 1);
+ Tcl_Preserve((ClientData) scalePtr);
+ TkMacOSXRunTclEventLoop();
+ Tcl_Release((ClientData) scalePtr);
+}
+
diff --git a/carbon/tkMacOSXScrlbr.c b/carbon/tkMacOSXScrlbr.c
new file mode 100644
index 0000000..c991c88
--- /dev/null
+++ b/carbon/tkMacOSXScrlbr.c
@@ -0,0 +1,1017 @@
+/*
+ * tkMacOSXScrollbar.c --
+ *
+ * This file implements the Macintosh specific portion of the scrollbar
+ * widget. The Macintosh scrollbar may also draw a windows grow region
+ * under certain cases.
+ *
+ * Copyright (c) 1996 by Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkScrollbar.h"
+#include "tkMacOSXDebug.h"
+
+#define MIN_SCROLLBAR_VALUE 0
+#define SCROLLBAR_SCALING_VALUE ((double)(LONG_MAX>>1))
+
+/*
+ * Declaration of Mac specific scrollbar structure.
+ */
+
+typedef struct MacScrollbar {
+ TkScrollbar info; /* Generic scrollbar info */
+ ControlRef sbHandle; /* Scrollbar control */
+ int macFlags; /* Various flags; see below */
+ Rect eraseRect; /* Rect to erase before drawing control */
+} MacScrollbar;
+
+/*
+ * Flag bits for scrollbars on the Mac:
+ *
+ * ALREADY_DEAD: Non-zero means this scrollbar has been
+ * destroyed, but has not been cleaned up.
+ * IN_MODAL_LOOP: Non-zero means this scrollbar is in the middle
+ * of a modal loop.
+ * ACTIVE: Non-zero means this window is currently
+ * active (in the foreground).
+ */
+
+#define ALREADY_DEAD 1
+#define IN_MODAL_LOOP 2
+#define ACTIVE 4
+
+/*
+ * Globals uses locally in this file.
+ */
+static ControlActionUPP scrollActionProc = NULL; /* Pointer to func. */
+static ControlActionUPP thumbActionProc = NULL; /* Pointer to func. */
+static Point mouseDownPoint; /* Used to store the coordinates where the
+ * mouse was first pressed to begin dragging
+ * the thumb, because ThumbActionProc can't
+ * take any args. */
+
+typedef struct ScrollbarMetrics {
+ SInt32 width, minHeight, minThumbHeight;
+ short topArrowHeight, bottomArrowHeight;
+ ControlSize size;
+} ScrollbarMetrics;
+
+static ScrollbarMetrics metrics[2] = {
+ {15, 54, 26, 14, 14, kControlSizeNormal}, /* kThemeScrollBarMedium */
+ {11, 40, 20, 10, 10, kControlSizeSmall}, /* kThemeScrollBarSmall */
+};
+
+/*
+ * Forward declarations for procedures defined later in this file:
+ */
+
+static pascal void ScrollbarActionProc(ControlRef theControl,
+ ControlPartCode partCode);
+static pascal void ThumbActionProc(ControlRef theControl,
+ ControlPartCode partCode);
+static int ScrollbarPress(MacScrollbar *, XEvent *);
+static void ScrollbarEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void UpdateControlValues(MacScrollbar *macScrollPtr);
+
+/*
+ * The class procedure table for the scrollbar widget. Leave the proc fields
+ * initialized to NULL, which should happen automatically because of the scope
+ * at which the variable is declared.
+ */
+
+const Tk_ClassProcs tkpScrollbarProcs = {
+ sizeof(Tk_ClassProcs), /* size */
+ NULL, /* worldChangedProc */
+ NULL, /* createProc */
+ NULL /* modalProc */
+};
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXInitScrollbarMetrics --
+ *
+ * This function initializes the current system metrics for a scrollbar.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Updates the geometry cache info for all scrollbars.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXInitScrollbarMetrics(void)
+{
+ const short height = 100, width = 50;
+ ThemeTrackDrawInfo info = {0, {0, 0, height, width}, 0, 1, 0, 0,
+ kThemeTrackShowThumb, kThemeTrackActive, 0, {{1, 0}}};
+ Rect bounds;
+
+ ChkErr(GetThemeMetric, kThemeMetricScrollBarWidth, &metrics[0].width);
+ ChkErr(GetThemeMetric, kThemeMetricScrollBarMinThumbHeight,
+ &metrics[0].minThumbHeight);
+ info.kind = kThemeScrollBarMedium;
+ ChkErr(GetThemeTrackDragRect, &info, &bounds);
+ metrics[0].topArrowHeight = bounds.top;
+ metrics[0].bottomArrowHeight = height - bounds.bottom;
+ metrics[0].minHeight = metrics[0].minThumbHeight +
+ metrics[0].topArrowHeight + metrics[0].bottomArrowHeight;
+ ChkErr(GetThemeMetric, kThemeMetricSmallScrollBarWidth, &metrics[1].width);
+ ChkErr(GetThemeMetric, kThemeMetricSmallScrollBarMinThumbHeight,
+ &metrics[1].minThumbHeight);
+ info.kind = kThemeScrollBarSmall;
+ ChkErr(GetThemeTrackDragRect, &info, &bounds);
+ metrics[1].topArrowHeight = bounds.top;
+ metrics[1].bottomArrowHeight = height - bounds.bottom;
+ metrics[1].minHeight = metrics[1].minThumbHeight +
+ metrics[1].topArrowHeight + metrics[1].bottomArrowHeight;
+
+ sprintf(tkDefScrollbarWidth, "%ld", metrics[0].width);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpCreateScrollbar --
+ *
+ * Allocate a new TkScrollbar structure.
+ *
+ * Results:
+ * Returns a newly allocated TkScrollbar structure.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkScrollbar *
+TkpCreateScrollbar(
+ Tk_Window tkwin) /* New Tk Window. */
+{
+ static int initialized = 0;
+ MacScrollbar * macScrollPtr;
+
+ if (scrollActionProc == NULL) {
+ scrollActionProc = NewControlActionUPP(ScrollbarActionProc);
+ thumbActionProc = NewControlActionUPP(ThumbActionProc);
+ }
+ if (!initialized) {
+ TkMacOSXInitScrollbarMetrics();
+ initialized = 1;
+ }
+ macScrollPtr = ckalloc(sizeof(MacScrollbar));
+ macScrollPtr->sbHandle = NULL;
+ macScrollPtr->macFlags = 0;
+ SetRect(&macScrollPtr->eraseRect, 0, 0, 0, 0);
+
+ Tk_CreateEventHandler(tkwin, ActivateMask|ExposureMask|
+ StructureNotifyMask|FocusChangeMask|ButtonPressMask,
+ ScrollbarEventProc, (ClientData) macScrollPtr);
+
+ return (TkScrollbar *) macScrollPtr;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkpDisplayScrollbar --
+ *
+ * This procedure redraws the contents of a scrollbar window. It is
+ * invoked as a do-when-idle handler, so it only runs when there's
+ * nothing else for the application to do.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Information appears on the screen.
+ *
+ *--------------------------------------------------------------
+ */
+
+void
+TkpDisplayScrollbar(
+ ClientData clientData) /* Information about window. */
+{
+ TkScrollbar *scrollPtr = (TkScrollbar *) clientData;
+ MacScrollbar *macScrollPtr = (MacScrollbar *) clientData;
+ Tk_Window tkwin = scrollPtr->tkwin;
+ CGrafPtr destPort, savePort;
+ Boolean portChanged;
+ WindowRef windowRef;
+
+ if ((scrollPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
+ goto done;
+ }
+
+ /*
+ * Draw the focus or any 3D relief we may have.
+ */
+ if (scrollPtr->highlightWidth != 0) {
+ GC fgGC, bgGC;
+
+ bgGC = Tk_GCForColor(scrollPtr->highlightBgColorPtr,
+ Tk_WindowId(tkwin));
+
+ if (scrollPtr->flags & GOT_FOCUS) {
+ fgGC = Tk_GCForColor(scrollPtr->highlightColorPtr,
+ Tk_WindowId(tkwin));
+ TkpDrawHighlightBorder(tkwin, fgGC, bgGC, scrollPtr->highlightWidth,
+ Tk_WindowId(tkwin));
+ } else {
+ TkpDrawHighlightBorder(tkwin, bgGC, bgGC, scrollPtr->highlightWidth,
+ Tk_WindowId(tkwin));
+ }
+ }
+ Tk_Draw3DRectangle(tkwin, Tk_WindowId(tkwin), scrollPtr->bgBorder,
+ scrollPtr->highlightWidth, scrollPtr->highlightWidth,
+ Tk_Width(tkwin) - 2*scrollPtr->highlightWidth,
+ Tk_Height(tkwin) - 2*scrollPtr->highlightWidth,
+ scrollPtr->borderWidth, scrollPtr->relief);
+
+ if (macScrollPtr->sbHandle == NULL) {
+ Rect r = {0, 0, 1, 1};
+
+ windowRef = TkMacOSXDrawableWindow(Tk_WindowId(tkwin));
+ CreateScrollBarControl(windowRef, &r, 0, 0, 0, 0, true, NULL,
+ &(macScrollPtr->sbHandle));
+ SetControlReference(macScrollPtr->sbHandle, (SInt32) scrollPtr);
+
+ if (IsWindowActive(windowRef)) {
+ macScrollPtr->macFlags |= ACTIVE;
+ }
+ }
+
+ /*
+ * Update the control values before we draw.
+ */
+
+ UpdateControlValues(macScrollPtr);
+
+ /*
+ * Set up port for drawing Macintosh control.
+ */
+ destPort = TkMacOSXGetDrawablePort(Tk_WindowId(tkwin));
+ portChanged = QDSwapPort(destPort, &savePort);
+ TkMacOSXSetUpClippingRgn(Tk_WindowId(tkwin));
+
+ /*
+ * Scrollbars do not erase the complete control bounds if they are wider
+ * than the standard width, so manually erase the extra space.
+ */
+
+ if (!EmptyRect(&macScrollPtr->eraseRect)) {
+ EraseRect(&macScrollPtr->eraseRect);
+ }
+
+ Draw1Control(macScrollPtr->sbHandle);
+
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+
+ done:
+ scrollPtr->flags &= ~REDRAW_PENDING;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpConfigureScrollbar --
+ *
+ * This procedure is called after the generic code has finished
+ * processing configuration options, in order to configure platform
+ * specific options.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpConfigureScrollbar(
+ register TkScrollbar *scrollPtr)
+ /* Information about widget; may or may not
+ * already have values for some fields. */
+{
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpComputeScrollbarGeometry --
+ *
+ * After changes in a scrollbar's size or configuration, this procedure
+ * recomputes various geometry information used in displaying the
+ * scrollbar.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The scrollbar will be displayed differently.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpComputeScrollbarGeometry(
+ register TkScrollbar *scrollPtr) /* Scrollbar whose geometry may
+ * have changed. */
+{
+ int variant, fieldLength;
+
+ if (scrollPtr->highlightWidth < 0) {
+ scrollPtr->highlightWidth = 0;
+ }
+ scrollPtr->inset = scrollPtr->highlightWidth + scrollPtr->borderWidth;
+ variant = ((scrollPtr->vertical ? Tk_Width(scrollPtr->tkwin) :
+ Tk_Height(scrollPtr->tkwin)) - 2 * scrollPtr->inset
+ < metrics[0].width) ? 1 : 0;
+ scrollPtr->arrowLength = (metrics[variant].topArrowHeight +
+ metrics[variant].bottomArrowHeight) / 2;
+ fieldLength = (scrollPtr->vertical ? Tk_Height(scrollPtr->tkwin)
+ : Tk_Width(scrollPtr->tkwin))
+ - 2 * (scrollPtr->arrowLength + scrollPtr->inset);
+ if (fieldLength < 0) {
+ fieldLength = 0;
+ }
+ scrollPtr->sliderFirst = fieldLength * scrollPtr->firstFraction;
+ scrollPtr->sliderLast = fieldLength * scrollPtr->lastFraction;
+
+ /*
+ * Adjust the slider so that some piece of it is always displayed in the
+ * scrollbar and so that it has at least a minimal width (so it can be
+ * grabbed with the mouse).
+ */
+
+ if (scrollPtr->sliderFirst > (fieldLength - 2*scrollPtr->borderWidth)) {
+ scrollPtr->sliderFirst = fieldLength - 2*scrollPtr->borderWidth;
+ }
+ if (scrollPtr->sliderFirst < 0) {
+ scrollPtr->sliderFirst = 0;
+ }
+ if (scrollPtr->sliderLast < (scrollPtr->sliderFirst +
+ metrics[variant].minThumbHeight)) {
+ scrollPtr->sliderLast = scrollPtr->sliderFirst +
+ metrics[variant].minThumbHeight;
+ }
+ if (scrollPtr->sliderLast > fieldLength) {
+ scrollPtr->sliderLast = fieldLength;
+ }
+ scrollPtr->sliderFirst += scrollPtr->inset +
+ metrics[variant].topArrowHeight;
+ scrollPtr->sliderLast += scrollPtr->inset +
+ metrics[variant].bottomArrowHeight;
+
+ /*
+ * Register the desired geometry for the window (leave enough space for
+ * the two arrows plus a minimum-size slider, plus border around the whole
+ * window, if any). Then arrange for the window to be redisplayed.
+ */
+
+ if (scrollPtr->vertical) {
+ Tk_GeometryRequest(scrollPtr->tkwin, scrollPtr->width +
+ 2 * scrollPtr->inset, 2 * (scrollPtr->arrowLength +
+ scrollPtr->borderWidth + scrollPtr->inset) +
+ metrics[variant].minThumbHeight);
+ } else {
+ Tk_GeometryRequest(scrollPtr->tkwin, 2 * (scrollPtr->arrowLength +
+ scrollPtr->borderWidth + scrollPtr->inset) +
+ metrics[variant].minThumbHeight, scrollPtr->width +
+ 2 * scrollPtr->inset);
+ }
+ Tk_SetInternalBorder(scrollPtr->tkwin, scrollPtr->inset);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpDestroyScrollbar --
+ *
+ * Free data structures associated with the scrollbar control.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpDestroyScrollbar(
+ TkScrollbar *scrollPtr) /* Scrollbar to destroy. */
+{
+ MacScrollbar *macScrollPtr = (MacScrollbar *)scrollPtr;
+
+ if (macScrollPtr->sbHandle != NULL) {
+ if (!(macScrollPtr->macFlags & IN_MODAL_LOOP)) {
+ DisposeControl(macScrollPtr->sbHandle);
+ macScrollPtr->sbHandle = NULL;
+ }
+ }
+ macScrollPtr->macFlags |= ALREADY_DEAD;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkpScrollbarPosition --
+ *
+ * Determine the scrollbar element corresponding to a given position.
+ *
+ * Results:
+ * One of TOP_ARROW, TOP_GAP, etc., indicating which element of the
+ * scrollbar covers the position given by (x, y). If (x,y) is outside the
+ * scrollbar entirely, then OUTSIDE is returned.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------
+ */
+
+int
+TkpScrollbarPosition(
+ TkScrollbar *scrollPtr, /* Scrollbar widget record. */
+ int x, int y) /* Coordinates within scrollPtr's
+ * window. */
+{
+ MacScrollbar *macScrollPtr = (MacScrollbar *) scrollPtr;
+ CGrafPtr destPort, savePort;
+ Boolean portChanged;
+ int inactive = 0;
+ ControlPartCode part;
+ Point where = {y, x};
+ Rect bounds;
+
+ if ((x < scrollPtr->inset) || (x >= (Tk_Width(scrollPtr->tkwin) -
+ scrollPtr->inset)) || (y < scrollPtr->inset) ||
+ (y >= (Tk_Height(scrollPtr->tkwin) - scrollPtr->inset))) {
+ return OUTSIDE;
+ }
+
+ /*
+ * All of the calculations in this procedure mirror those in
+ * DisplayScrollbar. Be sure to keep the two consistent. On the Macintosh
+ * we use the OS call TestControl to do this mapping. For TestControl to
+ * work, the scrollbar must be active and must be in the current port.
+ */
+
+ destPort = TkMacOSXGetDrawablePort(Tk_WindowId(scrollPtr->tkwin));
+ portChanged = QDSwapPort(destPort, &savePort);
+ UpdateControlValues(macScrollPtr);
+ if (!IsControlActive(macScrollPtr->sbHandle)) {
+ inactive = true;
+ ActivateControl(macScrollPtr->sbHandle);
+ }
+ TkMacOSXWinBounds((TkWindow *) scrollPtr->tkwin, &bounds);
+ where.h += bounds.left;
+ where.v += bounds.top;
+ part = TestControl(((MacScrollbar *) scrollPtr)->sbHandle, where);
+ if (inactive) {
+ DeactivateControl(macScrollPtr->sbHandle);
+ }
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+ switch (part) {
+ case kAppearancePartUpButton:
+ return TOP_ARROW;
+ case kAppearancePartPageUpArea:
+ return TOP_GAP;
+ case kAppearancePartIndicator:
+ return SLIDER;
+ case kAppearancePartPageDownArea:
+ return BOTTOM_GAP;
+ case kAppearancePartDownButton:
+ return BOTTOM_ARROW;
+ default:
+ return OUTSIDE;
+ }
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * ThumbActionProc --
+ *
+ * Callback procedure used by the Macintosh toolbox call
+ * HandleControlClick. This call is used to track the thumb of the
+ * scrollbar. Unlike the ScrollbarActionProc function this function is
+ * called once and basically takes over tracking the scrollbar from the
+ * control. This is done to avoid conflicts with what the control plans
+ * to draw.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * May change the display.
+ *
+ *--------------------------------------------------------------
+ */
+
+static pascal void
+ThumbActionProc(
+ ControlRef theControl,
+ ControlPartCode partCode)
+{
+ TkScrollbar *scrollPtr = (TkScrollbar *)(intptr_t)
+ GetControlReference(theControl);
+ MacScrollbar *macScrollPtr = (MacScrollbar *) scrollPtr;
+ Tcl_DString cmdString;
+ /*int origValue;*/ /* dead code */
+ int variant;
+ short trackBarSize;
+ double oldFirstFraction, newFirstFraction;
+ char valueString[40];
+ Point currentPoint = { 0, 0 };
+ Rect trackRect;
+ Tcl_Interp *interp;
+ MouseTrackingResult trackingResult;
+ OSStatus err;
+
+ if (scrollPtr == NULL) {
+ return;
+ }
+
+ Tcl_DStringInit(&cmdString);
+ /*origValue = GetControl32BitValue(macScrollPtr->sbHandle);*/ /* dead code */
+ GetControlBounds(macScrollPtr->sbHandle, &trackRect);
+
+ if (scrollPtr->vertical) {
+ variant = (trackRect.right - trackRect.left) < metrics[0].width ? 1 : 0;
+ trackBarSize = trackRect.bottom - trackRect.top -
+ metrics[variant].topArrowHeight -
+ metrics[variant].bottomArrowHeight;
+ InsetRect(&trackRect, -25, -113);
+ } else {
+ variant = (trackRect.bottom - trackRect.top) < metrics[0].width ? 1 : 0;
+ trackBarSize = trackRect.right - trackRect.left -
+ metrics[variant].topArrowHeight -
+ metrics[variant].bottomArrowHeight;
+ InsetRect(&trackRect, -113, -25);
+ }
+
+ /*
+ * Track the mouse while the button is held down. If the mouse is moved,
+ * we calculate the value that should be passed to the "command" part of
+ * the scrollbar. Since the mouse may move a distance too small to cause a
+ * change to the first fraction, each calculation must be done versus what
+ * the first fraction was when the mouse button was initially pressed.
+ * Otherwise, moving the mouse too slowly will cause the calculated
+ * fraction delta to be zero and the scrollbar won't respond.
+ */
+
+ oldFirstFraction = scrollPtr->firstFraction;
+
+ TkMacOSXTrackingLoop(1);
+ do {
+ err = ChkErr(TrackMouseLocationWithOptions, NULL,
+ kTrackMouseLocationOptionDontConsumeMouseUp,
+ kEventDurationForever, &currentPoint, NULL, &trackingResult);
+ if ((err == noErr) && ((trackingResult == kMouseTrackingMouseDragged)
+ || (trackingResult == kMouseTrackingMouseMoved))) {
+ /*
+ * Calculate where the scrollbar should move to, based on where the
+ * mouse button was pressed and where the scrollbar initially was
+ * at that time. Note that PtInRect() will return false if
+ * currentPoint or trackRect are not in is not in current graphics
+ * port, which may happen if any of the waiting idle events change
+ * the port (e.g. with SetPort()) but fail to restore it before
+ * returning and the scrollbar will lock in place.
+ */
+
+ newFirstFraction = oldFirstFraction;
+ if (PtInRect(currentPoint, &trackRect)) {
+ short pixDiff;
+
+ if (scrollPtr->vertical) {
+ pixDiff = currentPoint.v - mouseDownPoint.v;
+ } else {
+ pixDiff = currentPoint.h - mouseDownPoint.h;
+ }
+ newFirstFraction += (double)pixDiff / trackBarSize;
+ if (newFirstFraction > 1.0) {
+ newFirstFraction = 1.0;
+ } else if (newFirstFraction < 0.0) {
+ newFirstFraction = 0.0;
+ }
+ }
+
+ /*
+ * Move the scrollbar thumb to the new first fraction given its
+ * position when initially pressed and how far the mouse has
+ * moved. Process waiting idle tasks afterward to allow for the
+ * display to update.
+ */
+
+ Tcl_PrintDouble(NULL, newFirstFraction, valueString);
+ Tcl_DStringSetLength(&cmdString, 0);
+ Tcl_DStringAppend(&cmdString, scrollPtr->command,
+ scrollPtr->commandSize);
+ Tcl_DStringAppendElement(&cmdString, "moveto");
+ Tcl_DStringAppendElement(&cmdString, valueString);
+ interp = scrollPtr->interp;
+ Tcl_Preserve(interp);
+ Tcl_EvalEx(interp, Tcl_DStringValue(&cmdString),
+ Tcl_DStringLength(&cmdString), TCL_EVAL_GLOBAL);
+ Tcl_Release(interp);
+ TkMacOSXRunTclEventLoop();
+ }
+ } while ((err == noErr) && trackingResult != kMouseTrackingMouseReleased);
+ TkMacOSXTrackingLoop(0);
+ Tcl_DStringFree(&cmdString);
+ return;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * ScrollbarActionProc --
+ *
+ * Callback procedure used by the Macintosh toolbox call
+ * HandleControlClick. This call will update the display while the
+ * scrollbar is being manipulated by the user.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * May change the display.
+ *
+ *--------------------------------------------------------------
+ */
+
+static pascal void
+ScrollbarActionProc(
+ ControlRef theControl, /* Handle to scrollbat control */
+ ControlPartCode partCode) /* Part of scrollbar that was "hit" */
+{
+ TkScrollbar *scrollPtr = (TkScrollbar *)(intptr_t)
+ GetControlReference(theControl);
+ MacScrollbar *macScrollPtr = (MacScrollbar *) scrollPtr;
+ Tcl_DString cmdString;
+
+ Tcl_DStringInit(&cmdString);
+ Tcl_DStringAppend(&cmdString, scrollPtr->command,
+ scrollPtr->commandSize);
+
+ if ( partCode == kAppearancePartUpButton ||
+ partCode == kAppearancePartDownButton ) {
+ Tcl_DStringAppendElement(&cmdString, "scroll");
+ Tcl_DStringAppendElement(&cmdString,
+ (partCode == kAppearancePartUpButton) ? "-1" : "1");
+ Tcl_DStringAppendElement(&cmdString, "unit");
+ } else if (partCode == kAppearancePartPageUpArea ||
+ partCode == kAppearancePartPageDownArea ) {
+ Tcl_DStringAppendElement(&cmdString, "scroll");
+ Tcl_DStringAppendElement(&cmdString,
+ (partCode == kAppearancePartPageUpArea) ? "-1" : "1");
+ Tcl_DStringAppendElement(&cmdString, "page");
+ } else if (partCode == kAppearancePartIndicator) {
+ char valueString[TCL_DOUBLE_SPACE];
+
+ Tcl_PrintDouble(NULL, (GetControl32BitValue(macScrollPtr->sbHandle) -
+ MIN_SCROLLBAR_VALUE) / SCROLLBAR_SCALING_VALUE, valueString);
+ Tcl_DStringAppendElement(&cmdString, "moveto");
+ Tcl_DStringAppendElement(&cmdString, valueString);
+ }
+ Tcl_Preserve(scrollPtr->interp);
+ Tcl_EvalEx(scrollPtr->interp, Tcl_DStringValue(&cmdString),
+ Tcl_DStringLength(&cmdString), TCL_EVAL_GLOBAL);
+ Tcl_Release(scrollPtr->interp);
+ Tcl_DStringFree(&cmdString);
+ TkMacOSXRunTclEventLoop();
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * ScrollbarPress --
+ *
+ * This procedure is invoked in response to <ButtonPress> events.
+ * Enters a modal loop to handle scrollbar interactions.
+ *
+ *--------------------------------------------------------------
+ */
+
+static int
+ScrollbarPress(MacScrollbar *macScrollPtr, XEvent *eventPtr)
+{
+ TkScrollbar *scrollPtr = &macScrollPtr->info;
+ Point where;
+ Rect bounds;
+ ControlPartCode part;
+ CGrafPtr destPort, savePort;
+ Boolean portChanged;
+ Window window;
+
+ Tcl_Preserve(scrollPtr);
+ macScrollPtr->macFlags |= IN_MODAL_LOOP;
+
+ /*
+ * To call Macintosh control routines we must have the port set to the
+ * window containing the control. We will then test which part of the
+ * control was hit and act accordingly.
+ */
+
+ destPort = TkMacOSXGetDrawablePort(Tk_WindowId(scrollPtr->tkwin));
+ portChanged = QDSwapPort(destPort, &savePort);
+ TkMacOSXSetUpClippingRgn(Tk_WindowId(scrollPtr->tkwin));
+
+ TkMacOSXWinBounds((TkWindow *) scrollPtr->tkwin, &bounds);
+ where.h = eventPtr->xbutton.x + bounds.left;
+ where.v = eventPtr->xbutton.y + bounds.top;
+ part = TestControl(macScrollPtr->sbHandle, where);
+ TkMacOSXTrackingLoop(1);
+ if (part == kAppearancePartIndicator && scrollPtr->jump == false) {
+ /*
+ * Case 1: In thumb, no jump scrolling. Call track control with
+ * the thumb action proc which will do most of the work.
+ */
+
+ mouseDownPoint.h = where.h;
+ mouseDownPoint.v = where.v;
+ HandleControlClick(macScrollPtr->sbHandle, where,
+ TkMacOSXModifierState(), thumbActionProc);
+ } else if (part == kAppearancePartIndicator) {
+ /*
+ * Case 2: in thumb with jump scrolling. Call HandleControlClick
+ * with a NULL action proc. Use the new value of the control to
+ * set update the control.
+ */
+
+ part = HandleControlClick(macScrollPtr->sbHandle, where,
+ TkMacOSXModifierState(), NULL);
+ if (part == kAppearancePartIndicator) {
+ Tcl_Interp *interp = scrollPtr->interp;
+ Tcl_DString cmdString;
+ char valueString[TCL_DOUBLE_SPACE];
+
+ Tcl_PrintDouble(NULL,
+ (GetControl32BitValue(macScrollPtr->sbHandle) -
+ MIN_SCROLLBAR_VALUE) / SCROLLBAR_SCALING_VALUE,
+ valueString);
+ Tcl_DStringInit(&cmdString);
+ Tcl_DStringAppend(&cmdString, scrollPtr->command,
+ strlen(scrollPtr->command));
+ Tcl_DStringAppendElement(&cmdString, "moveto");
+ Tcl_DStringAppendElement(&cmdString, valueString);
+
+ Tcl_Preserve(interp);
+ Tcl_EvalEx(interp, Tcl_DStringValue(&cmdString),
+ Tcl_DStringLength(&cmdString), TCL_EVAL_GLOBAL);
+ Tcl_Release(interp);
+ Tcl_DStringFree(&cmdString);
+ TkMacOSXRunTclEventLoop();
+ }
+ } else if (part != 0) {
+ /*
+ * Case 3: in any other part of the scrollbar. We call
+ * HandleControlClick with the scrollActionProc which will do most
+ * all the work.
+ */
+
+ HandleControlClick(macScrollPtr->sbHandle, where,
+ TkMacOSXModifierState(), scrollActionProc);
+
+ /*
+ * Workaround for Carbon bug where the scrollbar down arrow
+ * sometimes gets "stuck" after the mousebutton has been released.
+ */
+
+ if (scrollPtr->tkwin) {
+ TkMacOSXSetUpClippingRgn(Tk_WindowId(scrollPtr->tkwin));
+ }
+ Draw1Control(macScrollPtr->sbHandle);
+ }
+ TkMacOSXTrackingLoop(0);
+
+ /*
+ * The HandleControlClick call will "eat" the ButtonUp event. We now
+ * generate a ButtonUp event so Tk will unset implicit grabs etc.
+ */
+
+ if (scrollPtr->tkwin) {
+ window = Tk_WindowId(scrollPtr->tkwin);
+ TkGenerateButtonEventForXPointer(window);
+ }
+
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+
+ if (macScrollPtr->sbHandle && (macScrollPtr->macFlags & ALREADY_DEAD)) {
+ DisposeControl(macScrollPtr->sbHandle);
+ macScrollPtr->sbHandle = NULL;
+ }
+ macScrollPtr->macFlags &= ~IN_MODAL_LOOP;
+ Tcl_Release(scrollPtr);
+
+ return TCL_OK;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * ScrollbarEventProc --
+ *
+ * This procedure is invoked by the Tk dispatcher for various events on
+ * scrollbars.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * When the window gets deleted, internal structures get cleaned up. When
+ * it gets exposed, it is redisplayed.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+ScrollbarEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
+{
+ TkScrollbar *scrollPtr = (TkScrollbar *) clientData;
+ MacScrollbar *macScrollPtr = (MacScrollbar *) clientData;
+
+ if (eventPtr->type == UnmapNotify) {
+ TkMacOSXSetScrollbarGrow((TkWindow *) scrollPtr->tkwin, false);
+ } else if (eventPtr->type == ActivateNotify) {
+ macScrollPtr->macFlags |= ACTIVE;
+ TkScrollbarEventuallyRedraw((ClientData) scrollPtr);
+ } else if (eventPtr->type == DeactivateNotify) {
+ macScrollPtr->macFlags &= ~ACTIVE;
+ TkScrollbarEventuallyRedraw((ClientData) scrollPtr);
+ } else if (eventPtr->type == ButtonPress) {
+ ScrollbarPress(macScrollPtr, eventPtr);
+ } else {
+ TkScrollbarEventProc(clientData, eventPtr);
+ }
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * UpdateControlValues --
+ *
+ * This procedure updates the Macintosh scrollbar control to display the
+ * values defined by the Tk scrollbar.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The Macintosh control is updated.
+ *
+ *--------------------------------------------------------------
+ */
+
+static void
+UpdateControlValues(
+ MacScrollbar *macScrollPtr) /* Scrollbar data struct. */
+{
+ TkScrollbar *scrollPtr = (TkScrollbar *) macScrollPtr;
+ Tk_Window tkwin = scrollPtr->tkwin;
+ MacDrawable *macDraw = (MacDrawable *) Tk_WindowId(scrollPtr->tkwin);
+ double dViewSize;
+ Rect contrlRect, portRect;
+ int variant, active;
+ short width, height;
+
+ contrlRect.left = macDraw->xOff + scrollPtr->inset;
+ contrlRect.top = macDraw->yOff + scrollPtr->inset;
+ contrlRect.right = macDraw->xOff + Tk_Width(tkwin) - scrollPtr->inset;
+ contrlRect.bottom = macDraw->yOff + Tk_Height(tkwin) - scrollPtr->inset;
+
+ GetPortBounds(GetWindowPort(GetControlOwner(macScrollPtr->sbHandle)),
+ &portRect);
+
+ /*
+ * If the scrollbar is flush against the bottom right hand corner then we
+ * leave space to draw the grow region for the window.
+ */
+
+ if (portRect.bottom == contrlRect.bottom &&
+ portRect.right == contrlRect.right) {
+ TkMacOSXSetScrollbarGrow((TkWindow *) tkwin, true);
+ if (macDraw->toplevel &&
+ TkMacOSXResizable(macDraw->toplevel->winPtr)) {
+ int growSize;
+
+ switch (TkMacOSXWindowClass(macDraw->toplevel->winPtr)) {
+ case kFloatingWindowClass:
+ case kUtilityWindowClass:
+ growSize = metrics[1].width - 1;
+ break;
+ case kDocumentWindowClass:
+ case kMovableAlertWindowClass:
+ case kMovableModalWindowClass:
+ default:
+ growSize = metrics[0].width - 1;
+ break;
+ }
+ if (scrollPtr->vertical) {
+ contrlRect.bottom -= growSize;
+ } else {
+ contrlRect.right -= growSize;
+ }
+ }
+ } else {
+ TkMacOSXSetScrollbarGrow((TkWindow *) tkwin, false);
+ }
+
+ if (IsControlVisible (macScrollPtr->sbHandle)) {
+ SetControlVisibility(macScrollPtr->sbHandle, false, false);
+ }
+
+ if (scrollPtr->vertical) {
+ width = contrlRect.right - contrlRect.left;
+ height = contrlRect.bottom - contrlRect.top;
+ } else {
+ width = contrlRect.bottom - contrlRect.top;
+ height = contrlRect.right - contrlRect.left;
+ }
+ variant = width < metrics[0].width ? 1 : 0;
+ SetControlData(macScrollPtr->sbHandle, kControlEntireControl,
+ kControlSizeTag, sizeof(ControlSize),
+ &(metrics[variant].size));
+
+ macScrollPtr->eraseRect = contrlRect;
+ if (scrollPtr->vertical) {
+ macScrollPtr->eraseRect.left += metrics[variant].width;
+ } else {
+ macScrollPtr->eraseRect.top += metrics[variant].width;
+ }
+
+ /*
+ * Ensure we set scrollbar control bounds only once all size adjustments
+ * have been computed.
+ */
+
+ SetControlBounds(macScrollPtr->sbHandle, &contrlRect);
+
+ /*
+ * Given the Tk parameters for the fractions of the start and end of the
+ * thumb, the following calculation determines the location for the
+ * Macintosh thumb. The Aqua scroll control works as follows. The
+ * scrollbar's value is the position of the left (or top) side of the view
+ * area in the content area being scrolled. The maximum value of the
+ * control is therefore the dimension of the content area less the size of
+ * the view area. Since these values are all integers, and Tk gives the
+ * thumb position as fractions, we have introduced a scaling factor.
+ */
+
+ dViewSize = (scrollPtr->lastFraction - scrollPtr->firstFraction)
+ * SCROLLBAR_SCALING_VALUE;
+ SetControl32BitMinimum(macScrollPtr->sbHandle, MIN_SCROLLBAR_VALUE);
+ SetControl32BitMaximum(macScrollPtr->sbHandle, MIN_SCROLLBAR_VALUE +
+ SCROLLBAR_SCALING_VALUE - dViewSize);
+ SetControlViewSize(macScrollPtr->sbHandle, dViewSize);
+ SetControl32BitValue(macScrollPtr->sbHandle, MIN_SCROLLBAR_VALUE +
+ SCROLLBAR_SCALING_VALUE * scrollPtr->firstFraction);
+
+ if((scrollPtr->firstFraction <= 0.0 && scrollPtr->lastFraction >= 1.0)
+ || height <= metrics[variant].minHeight) {
+ /* Disable scrollbar */
+ SetControl32BitMaximum(macScrollPtr->sbHandle, MIN_SCROLLBAR_VALUE);
+ }
+ active = ((macScrollPtr->macFlags & ACTIVE) != 0);
+ if (active != IsControlActive(macScrollPtr->sbHandle)) {
+ if (active) {
+ ActivateControl(macScrollPtr->sbHandle);
+ } else {
+ DeactivateControl(macScrollPtr->sbHandle);
+ }
+ }
+ SetControlVisibility(macScrollPtr->sbHandle, true, false);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/carbon/tkMacOSXSend.c b/carbon/tkMacOSXSend.c
new file mode 100644
index 0000000..df6b2af
--- /dev/null
+++ b/carbon/tkMacOSXSend.c
@@ -0,0 +1,506 @@
+/*
+ * tkMacOSXSend.c --
+ *
+ * This file provides procedures that implement the "send" command,
+ * allowing commands to be passed from interpreter to interpreter. This
+ * current implementation for the Mac has most functionality stubed out.
+ *
+ * The current plan, which we have not had time to implement, is for the
+ * first Wish app to create a gestalt of type 'WIsH'. This gestalt will
+ * point to a table, in system memory, of Tk apps. Each Tk app, when it
+ * starts up, will register their name, and process ID, in this table.
+ * This will allow us to implement "tk appname".
+ *
+ * Then the send command will look up the process id of the target app in
+ * this table, and send an AppleEvent to that process. The AppleEvent
+ * handler is much like the do script handler, except that you have to
+ * specify the name of the tk app as well, since there may be many
+ * interps in one wish app, and you need to send it to the right one.
+ *
+ * Implementing this has been on our list of things to do, but what with
+ * the demise of Tcl at Sun, and the lack of resources at Scriptics it
+ * may not get done for awhile. So this sketch is offered for the brave
+ * to attempt if they need the functionality...
+ *
+ * Copyright (c) 1989-1994 The Regents of the University of California.
+ * Copyright (c) 1994-1998 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXInt.h"
+
+/*
+ * The following structure is used to keep track of the interpreters
+ * registered by this process.
+ */
+
+typedef struct RegisteredInterp {
+ char *name; /* Interpreter's name (malloc-ed). */
+ Tcl_Interp *interp; /* Interpreter associated with name. */
+ struct RegisteredInterp *nextPtr;
+ /* Next in list of names associated with
+ * interps in this process. NULL means end of
+ * list. */
+} RegisteredInterp;
+
+/*
+ * A registry of all interpreters for a display is kept in a property
+ * "InterpRegistry" on the root window of the display. It is organized as a
+ * series of zero or more concatenated strings (in no particular order), each
+ * of the form
+ * window space name '\0'
+ * where "window" is the hex id of the comm. window to use to talk to an
+ * interpreter named "name".
+ *
+ * When the registry is being manipulated by an application (e.g. to add or
+ * remove an entry), it is loaded into memory using a structure of the
+ * following type:
+ */
+
+typedef struct NameRegistry {
+ TkDisplay *dispPtr; /* Display from which the registry was
+ * read. */
+ int locked; /* Non-zero means that the display was locked
+ * when the property was read in. */
+ int modified; /* Non-zero means that the property has been
+ * modified, so it needs to be written out
+ * when the NameRegistry is closed. */
+ unsigned long propLength; /* Length of the property, in bytes. */
+ char *property; /* The contents of the property, or NULL if
+ * none. See format description above; this is
+ * *not* terminated by the first null
+ * character. Dynamically allocated. */
+ int allocedByX; /* Non-zero means must free property with
+ * XFree; zero means use ckfree. */
+} NameRegistry;
+
+static int initialized = false; /* A flag to denote if we have initialized
+ * yet. */
+
+static RegisteredInterp *interpListPtr = NULL;
+ /* List of all interpreters registered by this
+ * process. */
+
+/*
+ * The information below is used for communication between processes during
+ * "send" commands. Each process keeps a private window, never even mapped,
+ * with one property, "Comm". When a command is sent to an interpreter, the
+ * command is appended to the comm property of the communication window
+ * associated with the interp's process. Similarly, when a result is returned
+ * from a sent command, it is also appended to the comm property.
+ *
+ * Each command and each result takes the form of ASCII text. For a command,
+ * the text consists of a zero character followed by several null-terminated
+ * ASCII strings. The first string consists of the single letter "c".
+ * Subsequent strings have the form "option value" where the following options
+ * are supported:
+ *
+ * -r commWindow serial
+ *
+ * This option means that a response should be sent to the window whose X
+ * identifier is "commWindow" (in hex), and the response should be
+ * identified with the serial number given by "serial" (in decimal). If
+ * this option isn't specified then the send is asynchronous and no
+ * response is sent.
+ *
+ * -n name
+ *
+ * "Name" gives the name of the application for which the command is
+ * intended. This option must be present.
+ *
+ * -s script
+ *
+ * "Script" is the script to be executed. This option must be present.
+ *
+ * The options may appear in any order. The -n and -s options must be present,
+ * but -r may be omitted for asynchronous RPCs. For compatibility with future
+ * releases that may add new features, there may be additional options
+ * present; as long as they start with a "-" character, they will be ignored.
+ *
+ *
+ * A result also consists of a zero character followed by several null-
+ * terminated ASCII strings. The first string consists of the single letter
+ * "r". Subsequent strings have the form "option value" where the following
+ * options are supported:
+ *
+ * -s serial
+ *
+ * Identifies the command for which this is the result. It is the same as
+ * the "serial" field from the -s option in the command. This option must
+ * be present.
+ *
+ * -c code
+ *
+ * "Code" is the completion code for the script, in decimal. If the code
+ * is omitted it defaults to TCL_OK.
+ *
+ * -r result
+ *
+ * "Result" is the result string for the script, which may be either a
+ * result or an error message. If this field is omitted then it defaults
+ * to an empty string.
+ *
+ * -i errorInfo
+ *
+ * "ErrorInfo" gives a string with which to initialize the errorInfo
+ * variable. This option may be omitted; it is ignored unless the
+ * completion code is TCL_ERROR.
+ *
+ * -e errorCode
+ *
+ * "ErrorCode" gives a string with with to initialize the errorCode
+ * variable. This option may be omitted; it is ignored unless the
+ * completion code is TCL_ERROR.
+ *
+ * Options may appear in any order, and only the -s option must be present. As
+ * with commands, there may be additional options besides these; unknown
+ * options are ignored.
+ */
+
+/*
+ * Maximum size property that can be read at one time by this module:
+ */
+
+#define MAX_PROP_WORDS 100000
+
+/*
+ * Forward declarations for procedures defined later in this file:
+ */
+
+static int SendInit(Tcl_Interp *interp);
+
+/*
+ *--------------------------------------------------------------
+ *
+ * Tk_SetAppName --
+ *
+ * This procedure is called to associate an ASCII name with a Tk
+ * application. If the application has already been named, the name
+ * replaces the old one.
+ *
+ * Results:
+ * The return value is the name actually given to the application. This
+ * will normally be the same as name, but if name was already in use for
+ * an application then a name of the form "name #2" will be chosen, with
+ * a high enough number to make the name unique.
+ *
+ * Side effects:
+ * Registration info is saved, thereby allowing the "send" command to be
+ * used later to invoke commands in the application. In addition, the
+ * "send" command is created in the application's interpreter. The
+ * registration will be removed automatically if the interpreter is
+ * deleted or the "send" command is removed.
+ *
+ *--------------------------------------------------------------
+ */
+
+const char *
+Tk_SetAppName(
+ Tk_Window tkwin, /* Token for any window in the application to
+ * be named: it is just used to identify the
+ * application and the display. */
+ const char *name) /* The name that will be used to refer to the
+ * interpreter in later "send" commands. Must
+ * be globally unique. */
+{
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ Tcl_Interp *interp = winPtr->mainPtr->interp;
+ int i, suffix, offset, result;
+ RegisteredInterp *riPtr, *prevPtr;
+ const char *actualName;
+ Tcl_DString dString;
+ Tcl_Obj *resultObjPtr, *interpNamePtr;
+ char *interpName;
+
+ if (!initialized) {
+ SendInit(interp);
+ }
+
+ /*
+ * See if the application is already registered; if so, remove its current
+ * name from the registry. The deletion of the command will take care of
+ * disposing of this entry.
+ */
+
+ for (riPtr = interpListPtr, prevPtr = NULL; riPtr != NULL;
+ prevPtr = riPtr, riPtr = riPtr->nextPtr) {
+ if (riPtr->interp == interp) {
+ if (prevPtr == NULL) {
+ interpListPtr = interpListPtr->nextPtr;
+ } else {
+ prevPtr->nextPtr = riPtr->nextPtr;
+ }
+ break;
+ }
+ }
+
+ /*
+ * Pick a name to use for the application. Use "name" if it's not already
+ * in use. Otherwise add a suffix such as " #2", trying larger and larger
+ * numbers until we eventually find one that is unique.
+ */
+
+ actualName = name;
+ suffix = 1;
+ offset = 0;
+ Tcl_DStringInit(&dString);
+
+ TkGetInterpNames(interp, tkwin);
+ resultObjPtr = Tcl_GetObjResult(interp);
+ Tcl_IncrRefCount(resultObjPtr);
+ for (i = 0; ; ) {
+ result = Tcl_ListObjIndex(NULL, resultObjPtr, i, &interpNamePtr);
+ if (result != TCL_OK || interpNamePtr == NULL) {
+ break;
+ }
+ interpName = Tcl_GetString(interpNamePtr);
+ if (strcmp(actualName, interpName) == 0) {
+ if (suffix == 1) {
+ Tcl_DStringAppend(&dString, name, -1);
+ Tcl_DStringAppend(&dString, " #", 2);
+ offset = Tcl_DStringLength(&dString);
+ Tcl_DStringSetLength(&dString, offset + 10);
+ actualName = Tcl_DStringValue(&dString);
+ }
+ suffix++;
+ sprintf(Tcl_DStringValue(&dString) + offset, "%d", suffix);
+ i = 0;
+ } else {
+ i++;
+ }
+ }
+
+ Tcl_DecrRefCount(resultObjPtr);
+ Tcl_ResetResult(interp);
+
+ /*
+ * We have found a unique name. Now add it to the registry.
+ */
+
+ riPtr = ckalloc(sizeof(RegisteredInterp));
+ riPtr->interp = interp;
+ riPtr->name = ckalloc(strlen(actualName) + 1);
+ riPtr->nextPtr = interpListPtr;
+ interpListPtr = riPtr;
+ strcpy(riPtr->name, actualName);
+
+ /*
+ * TODO: DeleteProc
+ */
+
+ Tcl_CreateObjCommand(interp, "send", Tk_SendObjCmd, riPtr, NULL);
+ if (Tcl_IsSafe(interp)) {
+ Tcl_HideCommand(interp, "send", "send");
+ }
+ Tcl_DStringFree(&dString);
+
+ return riPtr->name;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * Tk_SendObjCmd --
+ *
+ * This procedure is invoked to process the "send" Tcl command. See the
+ * user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *--------------------------------------------------------------
+ */
+
+int
+Tk_SendObjCmd(
+ ClientData clientData, /* Used only for deletion */
+ Tcl_Interp *interp, /* The interp we are sending from */
+ int objc, /* Number of arguments */
+ Tcl_Obj *const objv[]) /* The arguments */
+{
+ const char *const sendOptions[] = {"-async", "-displayof", "-", NULL};
+ char *stringRep, *destName;
+ /*int async = 0;*/
+ int i, index, firstArg;
+ RegisteredInterp *riPtr;
+ Tcl_Obj *listObjPtr;
+ int result = TCL_OK;
+
+ for (i = 1; i < (objc - 1); ) {
+ stringRep = Tcl_GetString(objv[i]);
+ if (stringRep[0] == '-') {
+ if (Tcl_GetIndexFromObj(interp, objv[i], sendOptions, "option", 0,
+ &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (index == 0) {
+ /*async = 1;*/
+ i++;
+ } else if (index == 1) {
+ i += 2;
+ } else {
+ i++;
+ }
+ } else {
+ break;
+ }
+ }
+
+ if (objc < (i + 2)) {
+ Tcl_WrongNumArgs(interp, 1, objv,
+ "?-option value ...? interpName arg ?arg ...?");
+ return TCL_ERROR;
+ }
+
+ destName = Tcl_GetString(objv[i]);
+ firstArg = i + 1;
+
+ /*
+ * See if the target interpreter is local. If so, execute the command
+ * directly without going through the DDE server. The only tricky thing is
+ * passing the result from the target interpreter to the invoking
+ * interpreter. Watch out: they could be the same!
+ */
+
+ for (riPtr = interpListPtr; (riPtr != NULL)
+ && (strcmp(destName, riPtr->name)); riPtr = riPtr->nextPtr) {
+ /*
+ * Empty loop body.
+ */
+ }
+
+ if (riPtr != NULL) {
+ /*
+ * This command is to a local interp. No need to go through the
+ * server.
+ */
+
+ Tcl_Interp *localInterp;
+
+ Tcl_Preserve(riPtr);
+ localInterp = riPtr->interp;
+ Tcl_Preserve(localInterp);
+ if (firstArg == (objc - 1)) {
+ /*
+ * This might be one of those cases where the new parser is
+ * faster.
+ */
+
+ result = Tcl_EvalObjEx(localInterp, objv[firstArg],
+ TCL_EVAL_DIRECT);
+ } else {
+ listObjPtr = Tcl_NewListObj(0, NULL);
+ for (i = firstArg; i < objc; i++) {
+ Tcl_ListObjAppendList(interp, listObjPtr, objv[i]);
+ }
+ Tcl_IncrRefCount(listObjPtr);
+ result = Tcl_EvalObjEx(localInterp, listObjPtr, TCL_EVAL_DIRECT);
+ Tcl_DecrRefCount(listObjPtr);
+ }
+ if (interp != localInterp) {
+ if (result == TCL_ERROR) {
+ /* Tcl_Obj *errorObjPtr; */
+
+ /*
+ * An error occurred, so transfer error information from the
+ * destination interpreter back to our interpreter. Must clear
+ * interp's result before calling Tcl_AddErrorInfo, since
+ * Tcl_AddErrorInfo will store the interp's result in
+ * errorInfo before appending riPtr's $errorInfo; we've
+ * already got everything we need in riPtr's $errorInfo.
+ */
+
+ Tcl_ResetResult(interp);
+ Tcl_AddErrorInfo(interp, Tcl_GetVar2(localInterp,
+ "errorInfo", NULL, TCL_GLOBAL_ONLY));
+ /* errorObjPtr = Tcl_GetObjVar2(localInterp, "errorCode", NULL,
+ TCL_GLOBAL_ONLY);
+ Tcl_SetObjErrorCode(interp, errorObjPtr); */
+ }
+ Tcl_SetObjResult(interp, Tcl_GetObjResult(localInterp));
+ }
+ Tcl_Release(riPtr);
+ Tcl_Release(localInterp);
+ } else {
+ /*
+ * TODO: This is a non-local request. Send the script to the server
+ * and poll it for a result.
+ */
+ }
+
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkGetInterpNames --
+ *
+ * This procedure is invoked to fetch a list of all the interpreter names
+ * currently registered for the display of a particular window.
+ *
+ * Results:
+ * A standard Tcl return value. Interp->result will be set to hold a list
+ * of all the interpreter names defined for tkwin's display. If an error
+ * occurs, then TCL_ERROR is returned and interp->result will hold an
+ * error message.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkGetInterpNames(
+ Tcl_Interp *interp, /* Interpreter for returning a result. */
+ Tk_Window tkwin) /* Window whose display is to be used for the
+ * lookup. */
+{
+ Tcl_Obj *listObjPtr;
+ RegisteredInterp *riPtr;
+
+ listObjPtr = Tcl_NewListObj(0, NULL);
+ riPtr = interpListPtr;
+ while (riPtr != NULL) {
+ Tcl_ListObjAppendElement(interp, listObjPtr,
+ Tcl_NewStringObj(riPtr->name, -1));
+ riPtr = riPtr->nextPtr;
+ }
+
+ Tcl_SetObjResult(interp, listObjPtr);
+ return TCL_OK;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * SendInit --
+ *
+ * This procedure is called to initialize the communication channels for
+ * sending commands and receiving results.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Sets up various data structures and windows.
+ *
+ *--------------------------------------------------------------
+ */
+
+static int
+SendInit(
+ Tcl_Interp *interp) /* Interpreter to use for error reporting (no
+ * errors are ever returned, but the
+ * interpreter is needed anyway). */
+{
+ return TCL_OK;
+}
diff --git a/carbon/tkMacOSXSubwindows.c b/carbon/tkMacOSXSubwindows.c
new file mode 100644
index 0000000..23e73ff
--- /dev/null
+++ b/carbon/tkMacOSXSubwindows.c
@@ -0,0 +1,1469 @@
+/*
+ * tkMacOSXSubwindows.c --
+ *
+ * Implements subwindows for the macintosh version of Tk.
+ *
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2008 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkMacOSXDebug.h"
+#include "tkMacOSXWm.h"
+
+/*
+#ifdef TK_MAC_DEBUG
+#define TK_MAC_DEBUG_CLIP_REGIONS
+#endif
+*/
+
+/*
+ * Prototypes for functions used only in this file.
+ */
+
+static void MoveResizeWindow(MacDrawable *macWin);
+static void GenerateConfigureNotify(TkWindow *winPtr,
+ int includeWin);
+static void UpdateOffsets(TkWindow *winPtr, int deltaX,
+ int deltaY);
+static void NotifyVisibility(TkWindow *winPtr, XEvent *eventPtr);
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * AllocGWorld --
+ * Simplifies the allocation of new drawable ports.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static inline void
+AllocGWorld(
+ int width,
+ int height,
+ int mono,
+ CGrafPtr *grafPtrPtr)
+{
+ Rect bounds = {0, 0, height, width};
+
+#ifdef __LITTLE_ENDIAN__
+ ChkErr(NewGWorld, grafPtrPtr, mono ? 1 : 0, &bounds, NULL, NULL,
+ kNativeEndianPixMap);
+#else
+ ChkErr(NewGWorld, grafPtrPtr, mono ? 1 : 0, &bounds, NULL, NULL, 0);
+#endif
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XDestroyWindow --
+ *
+ * Dealocates the given X Window.
+ *
+ * Results:
+ * The window id is returned.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XDestroyWindow(
+ Display *display, /* Display. */
+ Window window) /* Window. */
+{
+ MacDrawable *macWin = (MacDrawable *) window;
+ WindowRef winRef;
+
+ /*
+ * Remove any dangling pointers that may exist if the window we are
+ * deleting is being tracked by the grab code.
+ */
+
+ TkPointerDeadWindow(macWin->winPtr);
+ macWin->toplevel->referenceCount--;
+
+ if (!Tk_IsTopLevel(macWin->winPtr)) {
+ TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
+ if (macWin->winPtr->parentPtr != NULL) {
+ TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr);
+ }
+ if (macWin->visRgn) {
+ CFRelease(macWin->visRgn);
+ }
+ if (macWin->aboveVisRgn) {
+ CFRelease(macWin->aboveVisRgn);
+ }
+
+ if (macWin->toplevel->referenceCount == 0) {
+ ckfree(macWin->toplevel);
+ }
+ ckfree(macWin);
+ return;
+ }
+
+ /*
+ * We are relying on the Activate Mac OS event to pass the focus away from
+ * a window that is getting Destroyed to the Front non-floating window. BUT
+ * we don't get activate events when a floating window is destroyed, since
+ * the front non-floating window doesn't in fact get activated... So maybe
+ * we can check here and if we are destroying a floating window, we can
+ * pass the focus back to the front non-floating window...
+ */
+
+ if (macWin->grafPtr != NULL) {
+ TkWindow *focusPtr = TkGetFocusWin(macWin->winPtr);
+
+ if (focusPtr == NULL
+ || (focusPtr->mainPtr->winPtr == macWin->winPtr)) {
+ winRef = TkMacOSXDrawableWindow(window);
+ if (TkpIsWindowFloating (winRef)) {
+ Window window = TkMacOSXGetXWindow(ActiveNonFloatingWindow());
+
+ if (window != None) {
+ TkMacOSXGenerateFocusEvent(window, 1);
+ }
+ }
+ }
+ }
+ if (macWin->visRgn) {
+ CFRelease(macWin->visRgn);
+ }
+ if (macWin->aboveVisRgn) {
+ CFRelease(macWin->aboveVisRgn);
+ }
+
+ /*
+ * Delete the Mac window and remove it from the windowTable. The window
+ * could be NULL if the window was never mapped. However, we don't do this
+ * for embedded windows, they don't go in the window list, and they do not
+ * own their portPtr's.
+ */
+
+ if (!Tk_IsEmbedded(macWin->winPtr)) {
+ WindowRef winRef = TkMacOSXDrawableWindow(window);
+
+ if (winRef) {
+ TkMacOSXWindowList *listPtr, *prevPtr;
+ WindowGroupRef group;
+
+ if (GetWindowProperty(winRef, 'Tk ', 'TsGp', sizeof(group), NULL,
+ &group) == noErr) {
+ TkDisplay *dispPtr = TkGetDisplayList();
+ ItemCount i = CountWindowGroupContents(group,
+ kWindowGroupContentsReturnWindows);
+ WindowRef macWin;
+ WindowGroupRef newGroup;
+ Window window;
+
+ while (i > 0) {
+ ChkErr(GetIndexedWindow, group, i--, 0, &macWin);
+ if (!macWin) {
+ continue;
+ }
+
+ window = TkMacOSXGetXWindow(macWin);
+ newGroup = NULL;
+ if (window != None) {
+ TkWindow *winPtr = (TkWindow *)
+ Tk_IdToWindow(dispPtr->display, window);
+
+ if (winPtr && winPtr->wmInfoPtr) {
+ newGroup = GetWindowGroupOfClass(
+ winPtr->wmInfoPtr->macClass);
+ }
+ }
+ if (!newGroup) {
+ newGroup =
+ GetWindowGroupOfClass(kDocumentWindowClass);
+ }
+ ChkErr(SetWindowGroup, macWin, newGroup);
+ }
+ ChkErr(SetWindowGroupOwner, group, NULL);
+ ChkErr(ReleaseWindowGroup, group);
+ }
+ TkMacOSXUnregisterMacWindow(winRef);
+ DisposeWindow(winRef);
+
+ for (listPtr=tkMacOSXWindowListPtr, prevPtr=NULL;
+ tkMacOSXWindowListPtr != NULL;
+ prevPtr=listPtr, listPtr=listPtr->nextPtr) {
+ if (listPtr->winPtr == macWin->winPtr) {
+ if (prevPtr == NULL) {
+ tkMacOSXWindowListPtr = listPtr->nextPtr;
+ } else {
+ prevPtr->nextPtr = listPtr->nextPtr;
+ }
+ ckfree(listPtr);
+ break;
+ }
+ }
+ }
+ }
+
+ macWin->grafPtr = NULL;
+
+ /*
+ * Delay deletion of a toplevel data structure untill all children have
+ * been deleted.
+ */
+
+ if (macWin->toplevel->referenceCount == 0) {
+ ckfree(macWin->toplevel);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XMapWindow --
+ *
+ * Map the given X Window to the screen. See X window documentation for
+ * more details.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The subwindow or toplevel may appear on the screen.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XMapWindow(
+ Display *display, /* Display. */
+ Window window) /* Window. */
+{
+ MacDrawable *macWin = (MacDrawable *) window;
+ XEvent event;
+
+ /*
+ * Under certain situations it's possible for this function to be called
+ * before the toplevel window it's associated with has actually been
+ * mapped. In that case we need to create the real Macintosh window now as
+ * this function as well as other X functions assume that the portPtr is
+ * valid.
+ */
+
+ if (!TkMacOSXHostToplevelExists(macWin->toplevel->winPtr)) {
+ TkMacOSXMakeRealWindowExist(macWin->toplevel->winPtr);
+ }
+
+ display->request++;
+ macWin->winPtr->flags |= TK_MAPPED;
+ if (Tk_IsTopLevel(macWin->winPtr)) {
+ if (!Tk_IsEmbedded(macWin->winPtr)) {
+ /*
+ * XXX This should be ShowSheetWindow for kSheetWindowClass
+ * XXX windows that have a wmPtr->master parent set.
+ */
+
+ WindowRef wRef = TkMacOSXDrawableWindow(window);
+
+ if ((macWin->winPtr->wmInfoPtr->macClass == kSheetWindowClass)
+ && (macWin->winPtr->wmInfoPtr->master != None)) {
+ ShowSheetWindow(wRef, TkMacOSXDrawableWindow(
+ macWin->winPtr->wmInfoPtr->master));
+ } else {
+ ShowWindow(wRef);
+ }
+ }
+ TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr);
+
+ /*
+ * We only need to send the MapNotify event for toplevel windows.
+ */
+
+ event.xany.serial = display->request;
+ event.xany.send_event = False;
+ event.xany.display = display;
+
+ event.xmap.window = window;
+ event.xmap.type = MapNotify;
+ event.xmap.event = window;
+ event.xmap.override_redirect = macWin->winPtr->atts.override_redirect;
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ } else {
+ /*
+ * Generate damage for that area of the window.
+ */
+
+ TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr);
+ TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
+ }
+
+ /*
+ * Generate VisibilityNotify events for window and all mapped children.
+ */
+
+ event.xany.send_event = False;
+ event.xany.display = display;
+ event.xvisibility.type = VisibilityNotify;
+ event.xvisibility.state = VisibilityUnobscured;
+ NotifyVisibility(macWin->winPtr, &event);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * NotifyVisibility --
+ *
+ * Recursively called helper proc for XMapWindow().
+
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * VisibilityNotify events are queued.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+NotifyVisibility(
+ TkWindow *winPtr,
+ XEvent *eventPtr)
+{
+ if (winPtr->atts.event_mask & VisibilityChangeMask) {
+ eventPtr->xany.serial = LastKnownRequestProcessed(winPtr->display);
+ eventPtr->xvisibility.window = winPtr->window;
+ Tk_QueueWindowEvent(eventPtr, TCL_QUEUE_TAIL);
+ }
+ for (winPtr = winPtr->childList; winPtr != NULL;
+ winPtr = winPtr->nextPtr) {
+ if (winPtr->flags & TK_MAPPED) {
+ NotifyVisibility(winPtr, eventPtr);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XUnmapWindow --
+ *
+ * Unmap the given X Window to the screen. See X window documentation for
+ * more details.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The subwindow or toplevel may be removed from the screen.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XUnmapWindow(
+ Display *display, /* Display. */
+ Window window) /* Window. */
+{
+ MacDrawable *macWin = (MacDrawable *) window;
+ XEvent event;
+
+ display->request++;
+ macWin->winPtr->flags &= ~TK_MAPPED;
+ if (Tk_IsTopLevel(macWin->winPtr)) {
+ if (!Tk_IsEmbedded(macWin->winPtr) &&
+ macWin->winPtr->wmInfoPtr->hints.initial_state!=IconicState) {
+ /*
+ * XXX This should be HideSheetWindow for kSheetWindowClass
+ * XXX windows that have a wmPtr->master parent set.
+ */
+
+ WindowRef wref = TkMacOSXDrawableWindow(window);
+
+ if ((macWin->winPtr->wmInfoPtr->macClass == kSheetWindowClass)
+ && (macWin->winPtr->wmInfoPtr->master != None)) {
+ HideSheetWindow(wref);
+ } else {
+ HideWindow(wref);
+ }
+ }
+ TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr);
+
+ /*
+ * We only need to send the UnmapNotify event for toplevel windows.
+ */
+
+ event.xany.serial = display->request;
+ event.xany.send_event = False;
+ event.xany.display = display;
+
+ event.xunmap.type = UnmapNotify;
+ event.xunmap.window = window;
+ event.xunmap.event = window;
+ event.xunmap.from_configure = false;
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ } else {
+ /*
+ * Generate damage for that area of the window.
+ */
+
+ TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
+ TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XResizeWindow --
+ *
+ * Resize a given X window. See X windows documentation for further
+ * details.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XResizeWindow(
+ Display *display, /* Display. */
+ Window window, /* Window. */
+ unsigned int width,
+ unsigned int height)
+{
+ MacDrawable *macWin = (MacDrawable *) window;
+
+ display->request++;
+ if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
+ WindowRef w = TkMacOSXDrawableWindow(window);
+
+ if (w) {
+ Rect bounds;
+
+ ChkErr(GetWindowBounds, w, kWindowContentRgn, &bounds);
+ bounds.right = bounds.left + width;
+ bounds.bottom = bounds.top + height;
+ ChkErr(SetWindowBounds, w, kWindowContentRgn, &bounds);
+ }
+ } else {
+ MoveResizeWindow(macWin);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XMoveResizeWindow --
+ *
+ * Move or resize a given X window. See X windows documentation
+ * for further details.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XMoveResizeWindow(
+ Display *display, /* Display. */
+ Window window, /* Window. */
+ int x, int y,
+ unsigned int width,
+ unsigned int height)
+{
+ MacDrawable *macWin = (MacDrawable *) window;
+
+ display->request++;
+ if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
+ WindowRef w = TkMacOSXDrawableWindow(window);
+
+ if (w) {
+ Rect bounds;
+
+ bounds.left = x + macWin->winPtr->wmInfoPtr->xInParent;
+ bounds.right = bounds.left + width;
+ bounds.top = y + macWin->winPtr->wmInfoPtr->yInParent;
+ bounds.bottom = bounds.top + height;
+ ChkErr(SetWindowBounds, w, kWindowContentRgn, &bounds);
+ }
+ } else {
+ MoveResizeWindow(macWin);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XMoveWindow --
+ *
+ * Move a given X window. See X windows documentation for further
+ * details.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XMoveWindow(
+ Display *display, /* Display. */
+ Window window, /* Window. */
+ int x, int y)
+{
+ MacDrawable *macWin = (MacDrawable *) window;
+
+ display->request++;
+ if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
+ WindowRef w = TkMacOSXDrawableWindow(window);
+
+ if (w) {
+ ChkErr(MoveWindowStructure, w, x, y);
+ }
+ } else {
+ MoveResizeWindow(macWin);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MoveResizeWindow --
+ *
+ * Helper proc for XResizeWindow, XMoveResizeWindow and XMoveWindow.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+MoveResizeWindow(
+ MacDrawable *macWin)
+{
+ int deltaX = 0, deltaY = 0, parentBorderwidth = 0;
+ MacDrawable *macParent = NULL;
+ CGrafPtr destPort = TkMacOSXGetDrawablePort((Drawable) macWin);
+
+ /*
+ * Find the Parent window, for an embedded window it will be its container.
+ */
+
+ if (Tk_IsEmbedded(macWin->winPtr)) {
+ TkWindow *contWinPtr = TkpGetOtherWindow(macWin->winPtr);
+
+ if (contWinPtr) {
+ macParent = contWinPtr->privatePtr;
+ } else {
+ /*
+ * Here we should handle out of process embedding. At this point,
+ * we are assuming that the changes.x,y is not maintained, if you
+ * need the info get it from Tk_GetRootCoords, and that the
+ * toplevel sits at 0,0 when it is drawn.
+ */
+ }
+ } else {
+ /*
+ * TODO: update all xOff & yOffs
+ */
+
+ macParent = macWin->winPtr->parentPtr->privatePtr;
+ parentBorderwidth = macWin->winPtr->parentPtr->changes.border_width;
+ }
+
+ if (macParent) {
+ deltaX = macParent->xOff + parentBorderwidth +
+ macWin->winPtr->changes.x - macWin->xOff;
+ deltaY = macParent->yOff + parentBorderwidth +
+ macWin->winPtr->changes.y - macWin->yOff;
+ }
+ if (destPort) {
+ TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
+ if (macParent) {
+ TkMacOSXInvalClipRgns((Tk_Window) macParent->winPtr);
+ }
+ }
+ UpdateOffsets(macWin->winPtr, deltaX, deltaY);
+ if (destPort) {
+ TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
+ }
+ GenerateConfigureNotify(macWin->winPtr, 0);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GenerateConfigureNotify --
+ *
+ * Generates ConfigureNotify events for all the child widgets of the
+ * widget passed in the winPtr parameter. If includeWin is true, also
+ * generates ConfigureNotify event for the widget itself.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * ConfigureNotify events will be posted.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+GenerateConfigureNotify(
+ TkWindow *winPtr,
+ int includeWin)
+{
+ TkWindow *childPtr;
+
+ for (childPtr = winPtr->childList; childPtr != NULL;
+ childPtr = childPtr->nextPtr) {
+ if (!Tk_IsMapped(childPtr) || Tk_IsTopLevel(childPtr)) {
+ continue;
+ }
+ GenerateConfigureNotify(childPtr, 1);
+ }
+ if (includeWin) {
+ TkDoConfigureNotify(winPtr);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XRaiseWindow --
+ *
+ * Change the stacking order of a window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Changes the stacking order of the specified window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XRaiseWindow(
+ Display *display, /* Display. */
+ Window window) /* Window. */
+{
+ MacDrawable *macWin = (MacDrawable *) window;
+
+ display->request++;
+ if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
+ TkWmRestackToplevel(macWin->winPtr, Above, NULL);
+ } else {
+ /*
+ * TODO: this should generate damage
+ */
+ }
+}
+
+#if 0
+/*
+ *----------------------------------------------------------------------
+ *
+ * XLowerWindow --
+ *
+ * Change the stacking order of a window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Changes the stacking order of the specified window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XLowerWindow(
+ Display *display, /* Display. */
+ Window window) /* Window. */
+{
+ MacDrawable *macWin = (MacDrawable *) window;
+
+ display->request++;
+ if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
+ TkWmRestackToplevel(macWin->winPtr, Below, NULL);
+ } else {
+ /*
+ * TODO: this should generate damage
+ */
+ }
+}
+#endif
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XConfigureWindow --
+ *
+ * Change the size, position, stacking, or border of the specified window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Changes the attributes of the specified window. Note that we ignore the
+ * passed in values and use the values stored in the TkWindow data
+ * structure.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XConfigureWindow(
+ Display *display, /* Display. */
+ Window w, /* Window. */
+ unsigned int value_mask,
+ XWindowChanges *values)
+{
+ MacDrawable *macWin = (MacDrawable *) w;
+ TkWindow *winPtr = macWin->winPtr;
+
+ display->request++;
+
+ /*
+ * Change the shape and/or position of the window.
+ */
+
+ if (value_mask & (CWX|CWY|CWWidth|CWHeight)) {
+ XMoveResizeWindow(display, w, winPtr->changes.x, winPtr->changes.y,
+ winPtr->changes.width, winPtr->changes.height);
+ }
+
+ /*
+ * Change the stacking order of the window. Tk actually keeps all the
+ * information we need for stacking order. All we need to do is make sure
+ * the clipping regions get updated and generate damage that will ensure
+ * things get drawn correctly.
+ */
+
+ if (value_mask & CWStackMode) {
+ Rect bounds;
+ WindowRef wRef = TkMacOSXDrawableWindow(w);
+
+ if (wRef) {
+ TkMacOSXInvalClipRgns((Tk_Window) winPtr->parentPtr);
+ TkMacOSXWinBounds(winPtr, &bounds);
+ InvalWindowRect(wRef, &bounds);
+ }
+ }
+
+ /* TkGenWMMoveRequestEvent(macWin->winPtr,
+ macWin->winPtr->changes.x, macWin->winPtr->changes.y); */
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXUpdateClipRgn --
+ *
+ * This function updates the cliping regions for a given window and all of
+ * its children. Once updated the TK_CLIP_INVALID flag in the subwindow
+ * data structure is unset. The TK_CLIP_INVALID flag should always be
+ * unset before any drawing is attempted.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The clip regions for the window and its children are updated.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXUpdateClipRgn(
+ TkWindow *winPtr)
+{
+ MacDrawable *macWin;
+
+ if (winPtr == NULL) {
+ return;
+ }
+ macWin = winPtr->privatePtr;
+ if (macWin && macWin->flags & TK_CLIP_INVALID) {
+ TkWindow *win2Ptr;
+
+ if (Tk_IsMapped(winPtr)) {
+ int rgnChanged = 0;
+ CGRect bounds;
+ HIMutableShapeRef rgn;
+
+ /*
+ * Start with a region defined by the window bounds.
+ */
+
+ TkMacOSXWinCGBounds(winPtr, &bounds);
+ rgn = TkMacOSXHIShapeCreateMutableWithRect(&bounds);
+
+ /*
+ * Clip away the area of any windows that may obscure this window.
+ * For a non-toplevel window, first, clip to the parents visible
+ * clip region. Second, clip away any siblings that are higher in
+ * the stacking order. For an embedded toplevel, just clip to the
+ * container's visible clip region. Remember, we only allow one
+ * contained window in a frame, and don't support any other widgets
+ * in the frame either. This is not currently enforced, however.
+ */
+
+ if (!Tk_IsTopLevel(winPtr)) {
+ TkMacOSXUpdateClipRgn(winPtr->parentPtr);
+ if (winPtr->parentPtr) {
+ ChkErr(HIShapeIntersect,
+ winPtr->parentPtr->privatePtr->aboveVisRgn,
+ rgn, rgn);
+ }
+ win2Ptr = winPtr;
+ while ((win2Ptr = win2Ptr->nextPtr)) {
+ if (Tk_IsTopLevel(win2Ptr) || !Tk_IsMapped(win2Ptr)) {
+ continue;
+ }
+ TkMacOSXWinCGBounds(win2Ptr, &bounds);
+ ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds);
+ }
+ } else if (Tk_IsEmbedded(winPtr)) {
+ win2Ptr = TkpGetOtherWindow(winPtr);
+ if (win2Ptr) {
+ TkMacOSXUpdateClipRgn(win2Ptr);
+ ChkErr(HIShapeIntersect,
+ win2Ptr->privatePtr->aboveVisRgn, rgn, rgn);
+ } else if (tkMacOSXEmbedHandler != NULL) {
+ HIShapeRef visRgn;
+
+ TkMacOSXCheckTmpQdRgnEmpty();
+ tkMacOSXEmbedHandler->getClipProc((Tk_Window) winPtr,
+ tkMacOSXtmpQdRgn);
+ visRgn = HIShapeCreateWithQDRgn(tkMacOSXtmpQdRgn);
+ SetEmptyRgn(tkMacOSXtmpQdRgn);
+ ChkErr(HIShapeIntersect, visRgn, rgn, rgn);
+ }
+
+ /*
+ * TODO: Here we should handle out of process embedding.
+ */
+ } else if (winPtr->wmInfoPtr->attributes &
+ kWindowResizableAttribute) {
+ HIViewRef growBoxView;
+ OSErr err = HIViewFindByID(HIViewGetRoot(
+ TkMacOSXDrawableWindow(winPtr->window)),
+ kHIViewWindowGrowBoxID, &growBoxView);
+
+ if (err == noErr) {
+ ChkErr(HIViewGetFrame, growBoxView, &bounds);
+ bounds = CGRectOffset(bounds,
+ -winPtr->wmInfoPtr->xInParent,
+ -winPtr->wmInfoPtr->yInParent);
+ ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds);
+ }
+ }
+ macWin->aboveVisRgn = HIShapeCreateCopy(rgn);
+
+ /*
+ * The final clip region is the aboveVis region (or visible region)
+ * minus all the children of this window. If the window is a
+ * container, we must also subtract the region of the embedded
+ * window.
+ */
+
+ win2Ptr = winPtr->childList;
+ while (win2Ptr) {
+ if (Tk_IsTopLevel(win2Ptr) || !Tk_IsMapped(win2Ptr)) {
+ win2Ptr = win2Ptr->nextPtr;
+ continue;
+ }
+ TkMacOSXWinCGBounds(win2Ptr, &bounds);
+ ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds);
+ rgnChanged = 1;
+ win2Ptr = win2Ptr->nextPtr;
+ }
+
+ if (Tk_IsContainer(winPtr)) {
+ win2Ptr = TkpGetOtherWindow(winPtr);
+ if (win2Ptr) {
+ if (Tk_IsMapped(win2Ptr)) {
+ TkMacOSXWinCGBounds(win2Ptr, &bounds);
+ ChkErr(TkMacOSHIShapeDifferenceWithRect, rgn, &bounds);
+ rgnChanged = 1;
+ }
+ }
+
+ /*
+ * TODO: Here we should handle out of process embedding.
+ */
+ }
+
+ if (rgnChanged) {
+ HIShapeRef diffRgn = HIShapeCreateDifference(
+ macWin->aboveVisRgn, rgn);
+
+ if (!HIShapeIsEmpty(diffRgn)) {
+ macWin->visRgn = HIShapeCreateCopy(rgn);
+ }
+ CFRelease(diffRgn);
+ }
+ CFRelease(rgn);
+ } else {
+ /*
+ * An unmapped window has empty clip regions to prevent any
+ * (erroneous) drawing into it or its children from becoming
+ * visible. [Bug 940117]
+ */
+
+ if (!Tk_IsTopLevel(winPtr)) {
+ TkMacOSXUpdateClipRgn(winPtr->parentPtr);
+ } else if (Tk_IsEmbedded(winPtr)) {
+ win2Ptr = TkpGetOtherWindow(winPtr);
+ if (win2Ptr) {
+ TkMacOSXUpdateClipRgn(win2Ptr);
+ }
+ }
+ macWin->aboveVisRgn = TkMacOSXHIShapeCreateEmpty();
+ }
+ if (!macWin->visRgn) {
+ macWin->visRgn = HIShapeCreateCopy(macWin->aboveVisRgn);
+ }
+ macWin->flags &= ~TK_CLIP_INVALID;
+
+#ifdef TK_MAC_DEBUG_CLIP_REGIONS
+ TkMacOSXDebugFlashRegion((Drawable) macWin, macWin->visRgn);
+#endif /* TK_MAC_DEBUG_CLIP_REGIONS */
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXVisableClipRgn --
+ *
+ * This function returnd the Macintosh cliping region for the given
+ * window. A NULL Rgn means the window is not visible.
+ *
+ * Results:
+ * The region.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkRegion
+TkMacOSXVisableClipRgn(
+ TkWindow *winPtr)
+{
+ if (winPtr->privatePtr->flags & TK_CLIP_INVALID) {
+ TkMacOSXUpdateClipRgn(winPtr);
+ }
+ return (TkRegion)HIShapeCreateMutableCopy(winPtr->privatePtr->visRgn);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXInvalidateWindow --
+ *
+ * This function makes the window as invalid will generate damage for the
+ * window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Damage is created.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXInvalidateWindow(
+ MacDrawable *macWin, /* Make window that's causing damage. */
+ int flag) /* Should be TK_WINDOW_ONLY or
+ * TK_PARENT_WINDOW */
+{
+ WindowRef windowRef;
+ HIShapeRef rgn;
+
+ windowRef = TkMacOSXDrawableWindow((Drawable)macWin);
+ if (macWin->flags & TK_CLIP_INVALID) {
+ TkMacOSXUpdateClipRgn(macWin->winPtr);
+ }
+ rgn = (flag == TK_WINDOW_ONLY) ? macWin->visRgn : macWin->aboveVisRgn;
+ if (!HIShapeIsEmpty(rgn)) {
+ TkMacOSXCheckTmpQdRgnEmpty();
+ ChkErr(HIShapeGetAsQDRgn, rgn, tkMacOSXtmpQdRgn);
+ InvalWindowRgn(windowRef, tkMacOSXtmpQdRgn);
+ SetEmptyRgn(tkMacOSXtmpQdRgn);
+ }
+#ifdef TK_MAC_DEBUG_CLIP_REGIONS
+ TkMacOSXDebugFlashRegion((Drawable) macWin, rgn);
+#endif /* TK_MAC_DEBUG_CLIP_REGIONS */
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetDrawableWindow --
+ *
+ * This function returns the WindowRef for a given X drawable.
+ *
+ * Results:
+ * A WindowRef, or NULL for off screen pixmaps.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+WindowRef
+TkMacOSXDrawableWindow(
+ Drawable drawable)
+{
+ MacDrawable *macWin = (MacDrawable *) drawable;
+ WindowRef result = NULL;
+
+ if (!macWin || macWin->flags & TK_IS_PIXMAP) {
+ result = NULL;
+ } else {
+ result = GetWindowFromPort(TkMacOSXGetDrawablePort(drawable));
+ }
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetDrawablePort --
+ *
+ * This function returns the Graphics Port for a given X drawable.
+ *
+ * Results:
+ * A CGrafPort. Either an off screen pixmap or a Window.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void *
+TkMacOSXGetDrawablePort(
+ Drawable drawable)
+{
+ MacDrawable *macWin = (MacDrawable *) drawable;
+ CGrafPtr resultPort = NULL;
+
+ if (!macWin) {
+ return NULL;
+ }
+
+ /*
+ * Handle toplevel windows.
+ */
+
+ if (macWin->toplevel) {
+ TkWindow *contWinPtr;
+
+ if (!(macWin->toplevel->flags & TK_EMBEDDED)) {
+ return macWin->toplevel->grafPtr;
+ }
+
+ /*
+ * If the Drawable is in an embedded window, use the Port of its
+ * container.
+ *
+ * TRICKY POINT: we can have cases when a toplevel is being destroyed
+ * where the winPtr for the toplevel has been freed, but the children
+ * are not all the way destroyed. The children will call this function
+ * as they are being destroyed, but Tk_IsEmbedded will return garbage.
+ * So we check the copy of the TK_EMBEDDED flag we put into the
+ * toplevel's macWin flags.
+ */
+
+ contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr);
+
+ resultPort = NULL;
+ if (contWinPtr != NULL) {
+ resultPort = TkMacOSXGetDrawablePort((Drawable)
+ contWinPtr->privatePtr);
+ } else if (tkMacOSXEmbedHandler != NULL) {
+ resultPort = tkMacOSXEmbedHandler->getPortProc((Tk_Window)
+ macWin->winPtr);
+ }
+
+ if (!resultPort) {
+ /*
+ * FIXME: So far as I can tell, the only time that this happens is
+ * when we are tearing down an embedded child interpreter, and most
+ * of the time, this is harmless... However, we really need to find
+ * why the embedding loses.
+ */
+
+ TkMacOSXDbgMsg("Couldn't find container");
+ }
+
+ /*
+ * TODO: Here we should handle out of process embedding.
+ */
+
+ return resultPort;
+ }
+
+ if ((macWin->flags & TK_IS_PIXMAP) && !macWin->grafPtr) {
+ AllocGWorld(macWin->size.width, macWin->size.height,
+ macWin->flags & TK_IS_BW_PIXMAP, &macWin->grafPtr);
+ }
+ return macWin->grafPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetRootControl --
+ *
+ * This function returns the Root Control for a given X drawable.
+ *
+ * Results:
+ * A ControlRef .
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void *
+TkMacOSXGetRootControl(
+ Drawable drawable)
+{
+ /*
+ * will probably need to fix this up for embedding
+ */
+
+ MacDrawable *macWin = (MacDrawable *) drawable;
+ TkWindow *contWinPtr;
+
+ if (macWin == NULL) {
+ return NULL;
+ }
+
+ if (!(macWin->toplevel->flags & TK_EMBEDDED)) {
+ return macWin->toplevel->rootControl;
+ }
+
+ contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr);
+ if (contWinPtr == NULL) {
+ return NULL;
+ }
+
+ return TkMacOSXGetRootControl((Drawable) contWinPtr->privatePtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXInvalClipRgns --
+ *
+ * This function invalidates the clipping regions for a given window and
+ * all of its children. This function should be called whenever changes
+ * are made to subwindows that would affect the size or position of
+ * windows.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The cliping regions for the window and its children are mark invalid.
+ * (Make sure they are valid before drawing.)
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXInvalClipRgns(
+ Tk_Window tkwin)
+{
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *childPtr;
+ MacDrawable *macWin = winPtr->privatePtr;
+
+ /*
+ * If already marked we can stop because all descendants will also already
+ * be marked.
+ */
+
+ if (!macWin || macWin->flags & TK_CLIP_INVALID) {
+ return;
+ }
+
+ macWin->flags |= TK_CLIP_INVALID;
+ if (macWin->visRgn) {
+ CFRelease(macWin->visRgn);
+ macWin->visRgn = NULL;
+ }
+ if (macWin->aboveVisRgn) {
+ CFRelease(macWin->aboveVisRgn);
+ macWin->aboveVisRgn = NULL;
+ }
+
+ /*
+ * Invalidate clip regions for all children & their descendants, unless the
+ * child is a toplevel.
+ */
+
+ childPtr = winPtr->childList;
+ while (childPtr) {
+ if (!Tk_IsTopLevel(childPtr)) {
+ TkMacOSXInvalClipRgns((Tk_Window) childPtr);
+ }
+ childPtr = childPtr->nextPtr;
+ }
+
+ /*
+ * Also, if the window is a container, mark its embedded window.
+ */
+
+ if (Tk_IsContainer(winPtr)) {
+ childPtr = TkpGetOtherWindow(winPtr);
+
+ if (childPtr) {
+ TkMacOSXInvalClipRgns((Tk_Window) childPtr);
+ }
+
+ /*
+ * TODO: Here we should handle out of process embedding.
+ */
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXWinBounds --
+ *
+ * Given a Tk window this function determines the windows bounds in
+ * relation to the Macintosh window's coordinate system. This is also the
+ * same coordinate system as the Tk toplevel window in which this window
+ * is contained.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXWinBounds(
+ TkWindow *winPtr,
+ void *b)
+{
+ Rect *bounds = b;
+ bounds->left = winPtr->privatePtr->xOff;
+ bounds->top = winPtr->privatePtr->yOff;
+ bounds->right = bounds->left + winPtr->changes.width;
+ bounds->bottom = bounds->top + winPtr->changes.height;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXWinCGBounds --
+ *
+ * Given a Tk window this function determines the windows bounds in
+ * relation to the Macintosh window's coordinate system. This is also the
+ * same coordinate system as the Tk toplevel window in which this window
+ * is contained.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXWinCGBounds(
+ TkWindow *winPtr,
+ CGRect *bounds)
+{
+ bounds->origin.x = winPtr->privatePtr->xOff;
+ bounds->origin.y = winPtr->privatePtr->yOff;
+ bounds->size.width = winPtr->changes.width;
+ bounds->size.height = winPtr->changes.height;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * UpdateOffsets --
+ *
+ * Updates the X & Y offsets of the given TkWindow from the TopLevel it is
+ * a decendant of.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The xOff & yOff fields for the Mac window datastructure is updated to
+ * the proper offset.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+UpdateOffsets(
+ TkWindow *winPtr,
+ int deltaX,
+ int deltaY)
+{
+ TkWindow *childPtr;
+
+ if (winPtr->privatePtr == NULL) {
+ /*
+ * We haven't called Tk_MakeWindowExist for this window yet. The offset
+ * information will be postponed and calulated at that time. (This will
+ * usually only happen when a mapped parent is being moved but has
+ * child windows that have yet to be mapped.)
+ */
+
+ return;
+ }
+
+ winPtr->privatePtr->xOff += deltaX;
+ winPtr->privatePtr->yOff += deltaY;
+
+ childPtr = winPtr->childList;
+ while (childPtr != NULL) {
+ if (!Tk_IsTopLevel(childPtr)) {
+ UpdateOffsets(childPtr, deltaX, deltaY);
+ }
+ childPtr = childPtr->nextPtr;
+ }
+
+ if (Tk_IsContainer(winPtr)) {
+ childPtr = TkpGetOtherWindow(winPtr);
+ if (childPtr != NULL) {
+ UpdateOffsets(childPtr,deltaX,deltaY);
+ }
+
+ /*
+ * TODO: Here we should handle out of process embedding.
+ */
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_GetPixmap --
+ *
+ * Creates an in memory drawing surface.
+ *
+ * Results:
+ * Returns a handle to a new pixmap.
+ *
+ * Side effects:
+ * Allocates a new Macintosh GWorld.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Pixmap
+Tk_GetPixmap(
+ Display *display, /* Display for new pixmap (can be null). */
+ Drawable d, /* Drawable where pixmap will be used (ignored). */
+ int width, /* Dimensions of pixmap. */
+ int height,
+ int depth) /* Bits per pixel for pixmap. */
+{
+ MacDrawable *macPix;
+
+ if (display != NULL) {
+ display->request++;
+ }
+ macPix = ckalloc(sizeof(MacDrawable));
+ macPix->winPtr = NULL;
+ macPix->xOff = 0;
+ macPix->yOff = 0;
+ macPix->visRgn = NULL;
+ macPix->aboveVisRgn = NULL;
+ macPix->drawRect = CGRectNull;
+ macPix->referenceCount = 0;
+ macPix->toplevel = NULL;
+ macPix->flags = TK_IS_PIXMAP | (depth == 1 ? TK_IS_BW_PIXMAP : 0);
+ macPix->grafPtr = NULL;
+ macPix->context = NULL;
+ macPix->size = CGSizeMake(width, height);
+ AllocGWorld(width, height, depth==1, &macPix->grafPtr);
+
+ return (Pixmap) macPix;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_FreePixmap --
+ *
+ * Release the resources associated with a pixmap.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Deletes the Macintosh GWorld created by Tk_GetPixmap.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_FreePixmap(
+ Display *display, /* Display. */
+ Pixmap pixmap) /* Pixmap to destroy */
+{
+ MacDrawable *macPix = (MacDrawable *) pixmap;
+
+ display->request++;
+ if (macPix->grafPtr) {
+ DisposeGWorld(macPix->grafPtr);
+ }
+ if (macPix->context) {
+ TkMacOSXDbgMsg("Cannot free CG backed Pixmap");
+ }
+ ckfree(macPix);
+}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/carbon/tkMacOSXTest.c b/carbon/tkMacOSXTest.c
new file mode 100644
index 0000000..d8e8aca
--- /dev/null
+++ b/carbon/tkMacOSXTest.c
@@ -0,0 +1,80 @@
+/*
+ * tkMacOSXTest.c --
+ *
+ * Contains commands for platform specific tests for
+ * the Macintosh platform.
+ *
+ * Copyright (c) 1996 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXInt.h"
+
+/*
+ * Forward declarations of procedures defined later in this file:
+ */
+
+static int DebuggerCmd (ClientData dummy, Tcl_Interp *interp,
+ int argc, const char **argv);
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkplatformtestInit --
+ *
+ * Defines commands that test platform specific functionality for
+ * Unix platforms.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * Defines new commands.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkplatformtestInit(
+ Tcl_Interp *interp) /* Interpreter to add commands to. */
+{
+ /*
+ * Add commands for platform specific tests on MacOS here.
+ */
+
+ Tcl_CreateCommand(interp, "debugger", DebuggerCmd,
+ (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DebuggerCmd --
+ *
+ * This procedure simply calls the low level debugger.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+DebuggerCmd(
+ ClientData clientData, /* Not used. */
+ Tcl_Interp *interp, /* Not used. */
+ int argc, /* Not used. */
+ const char **argv) /* Not used. */
+{
+ Debugger();
+ return TCL_OK;
+}
diff --git a/carbon/tkMacOSXWindowEvent.c b/carbon/tkMacOSXWindowEvent.c
new file mode 100644
index 0000000..2f46026
--- /dev/null
+++ b/carbon/tkMacOSXWindowEvent.c
@@ -0,0 +1,985 @@
+/*
+ * tkMacOSXWindowEvent.c --
+ *
+ * This file defines the routines for both creating and handling Window
+ * Manager class events for Tk.
+ *
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * The following terms apply to all files originating from Apple
+ * Computer, Inc. ("Apple") and associated with the software unless
+ * explicitly disclaimed in individual files.
+ *
+ * Apple hereby grants permission to use, copy, modify, distribute, and
+ * license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that
+ * this notice is included verbatim in any distributions. No written
+ * agreement, license, or royalty fee is required for any of the
+ * authorized uses. Modifications to this software may be copyrighted by
+ * their authors and need not follow the licensing terms described here,
+ * provided that the new terms are clearly indicated on the first page of
+ * each file where they apply.
+ *
+ * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE SOFTWARE
+ * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
+ * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS
+ * DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF APPLE OR THE
+ * AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. APPLE,
+ * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
+ * NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND
+ * APPLE, THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
+ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * GOVERNMENT USE: If you are acquiring this software on behalf of the
+ * U.S. government, the Government shall have only "Restricted Rights" in
+ * the software and related documentation as defined in the Federal
+ * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you are
+ * acquiring the software on behalf of the Department of Defense, the
+ * software shall be classified as "Commercial Computer Software" and the
+ * 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.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkMacOSXWm.h"
+#include "tkMacOSXEvent.h"
+#include "tkMacOSXDebug.h"
+
+/*
+#ifdef TK_MAC_DEBUG
+#define TK_MAC_DEBUG_CLIP_REGIONS
+#endif
+*/
+
+/*
+ * Declaration of functions used only in this file
+ */
+
+static int GenerateUpdateEvent(Window window);
+static int GenerateUpdates(HIMutableShapeRef updateRgn,
+ CGRect *updateBounds, TkWindow *winPtr);
+static int GenerateActivateEvents(Window window, int activeFlag);
+static void ClearPort(CGrafPtr port, HIShapeRef updateRgn);
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXProcessApplicationEvent --
+ *
+ * This processes Application level events, mainly activate and
+ * deactivate.
+ *
+ * Results:
+ * 0.
+ *
+ * Side effects:
+ * Hide or reveal floating windows.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkMacOSXProcessApplicationEvent(
+ TkMacOSXEvent *eventPtr,
+ MacEventStatus *statusPtr)
+{
+ Tcl_CmdInfo dummy;
+
+ /*
+ * This is a bit of a hack. We get "show" events both when we come back
+ * from being hidden, and whenever we are activated. I only want to run
+ * the "show" proc when we have been hidden already, not as a substitute
+ * for <Activate>. So I use this toggle...
+ */
+
+ static int toggleHide = 0;
+
+ switch (eventPtr->eKind) {
+ case kEventAppActivated:
+ ShowFloatingWindows();
+ break;
+ case kEventAppDeactivated:
+ TkSuspendClipboard();
+ HideFloatingWindows();
+ break;
+ case kEventAppQuit:
+ statusPtr->stopProcessing = 1;
+ break;
+ case kEventAppHidden:
+ if (toggleHide == 0) {
+ toggleHide = 1;
+ if (eventPtr->interp && Tcl_GetCommandInfo(eventPtr->interp,
+ "::tk::mac::OnHide", &dummy)) {
+ Tcl_GlobalEval(eventPtr->interp, "::tk::mac::OnHide");
+ }
+ }
+ statusPtr->stopProcessing = 1;
+ break;
+ case kEventAppShown:
+ if (toggleHide == 1) {
+ toggleHide = 0;
+ if (eventPtr->interp && Tcl_GetCommandInfo(eventPtr->interp,
+ "::tk::mac::OnShow", &dummy)) {
+ Tcl_GlobalEval(eventPtr->interp, "::tk::mac::OnShow");
+ }
+ }
+ statusPtr->stopProcessing = 1;
+ break;
+ case kEventAppAvailableWindowBoundsChanged: {
+ static UInt32 prevId = 0;
+ UInt32 id;
+ OSStatus err;
+
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamTransactionID, typeUInt32, NULL, sizeof(id), NULL,
+ &id);
+ if (err != noErr || id != prevId) {
+ TkDisplay *dispPtr = TkGetDisplayList();
+
+ prevId = id;
+ TkMacOSXDisplayChanged(dispPtr->display);
+ }
+ /*
+ * Should we call ::tk::mac::OnDisplayChanged?
+ */
+ break;
+ }
+ default:
+ break;
+ }
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXProcessAppearanceEvent --
+ *
+ * This processes Appearance events.
+ *
+ * Results:
+ * 0.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkMacOSXProcessAppearanceEvent(
+ TkMacOSXEvent *eventPtr,
+ MacEventStatus *statusPtr)
+{
+ switch (eventPtr->eKind) {
+ case kEventAppearanceScrollBarVariantChanged:
+ TkMacOSXInitScrollbarMetrics();
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXProcessWindowEvent --
+ *
+ * This processes Window level events, mainly activate and deactivate.
+ *
+ * Results:
+ * 0.
+ *
+ * Side effects:
+ * Cause Windows to be moved forward or backward in the window stack.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkMacOSXProcessWindowEvent(
+ TkMacOSXEvent *eventPtr,
+ MacEventStatus *statusPtr)
+{
+ OSStatus err;
+ WindowRef whichWindow;
+ Window window;
+ int eventFound = false;
+ TkDisplay *dispPtr;
+ TkWindow *winPtr;
+
+ switch (eventPtr->eKind) {
+ case kEventWindowActivated:
+ case kEventWindowDeactivated:
+ case kEventWindowUpdate:
+ case kEventWindowExpanding:
+ case kEventWindowBoundsChanged:
+ case kEventWindowDragStarted:
+ case kEventWindowDragCompleted:
+ case kEventWindowConstrain:
+ case kEventWindowGetRegion:
+ case kEventWindowDrawContent:
+ break;
+ default:
+ return 0;
+ break;
+ }
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamDirectObject, typeWindowRef, NULL, sizeof(whichWindow),
+ NULL, &whichWindow);
+ if (err != noErr) {
+ return 0;
+ }
+
+ window = TkMacOSXGetXWindow(whichWindow);
+ dispPtr = TkGetDisplayList();
+ winPtr = (TkWindow *) Tk_IdToWindow(dispPtr->display, window);
+
+ switch (eventPtr->eKind) {
+ case kEventWindowActivated:
+ case kEventWindowDeactivated:
+ if (window != None) {
+ int activate = (eventPtr->eKind == kEventWindowActivated);
+
+ eventFound |= GenerateActivateEvents(window, activate);
+ eventFound |= TkMacOSXGenerateFocusEvent(window, activate);
+ if (winPtr) {
+ TkMacOSXEnterExitFullscreen(winPtr, activate);
+ }
+ statusPtr->stopProcessing = 1;
+ }
+ break;
+ case kEventWindowUpdate:
+ if (window != None && GenerateUpdateEvent(window)) {
+ eventFound = true;
+ statusPtr->stopProcessing = 1;
+ }
+ break;
+ case kEventWindowExpanding:
+ if (winPtr) {
+ winPtr->wmInfoPtr->hints.initial_state =
+ TkMacOSXIsWindowZoomed(winPtr) ? ZoomState : NormalState;
+ Tk_MapWindow((Tk_Window) winPtr);
+
+ /*
+ * Need to process all Tk events generated by Tk_MapWindow()
+ * before returning to ensure all children are mapped, as
+ * otherwise the Activate event that follows Expanding would not
+ * be processed by any unmapped children.
+ */
+
+ while (Tcl_ServiceEvent(TCL_WINDOW_EVENTS)) {/*empty body*/};
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {/*empty body*/};
+ }
+ break;
+ case kEventWindowBoundsChanged:
+ if (winPtr) {
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ UInt32 attr;
+ Rect bounds;
+ int x = -1, y = -1, width = -1, height = -1, flags = 0;
+
+ ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamAttributes, typeUInt32, NULL, sizeof(attr),
+ NULL, &attr);
+ ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamCurrentBounds, typeQDRectangle, NULL,
+ sizeof(bounds), NULL, &bounds);
+ if (attr & kWindowBoundsChangeOriginChanged) {
+ x = bounds.left - wmPtr->xInParent;
+ y = bounds.top - wmPtr->yInParent;
+ flags |= TK_LOCATION_CHANGED;
+ }
+ if (attr & kWindowBoundsChangeSizeChanged) {
+ width = bounds.right - bounds.left;
+ height = bounds.bottom - bounds.top;
+ flags |= TK_SIZE_CHANGED;
+ }
+ TkMacOSXInvalClipRgns((Tk_Window) winPtr);
+ TkMacOSXInvalidateWindow((MacDrawable*) window, TK_PARENT_WINDOW);
+ TkGenWMConfigureEvent((Tk_Window)winPtr, x, y, width, height,
+ flags);
+ if (attr & kWindowBoundsChangeUserResize ||
+ attr & kWindowBoundsChangeUserDrag) {
+ TkMacOSXRunTclEventLoop();
+ }
+ if (wmPtr->attributes & kWindowResizableAttribute) {
+ HIViewRef growBoxView;
+
+ err = HIViewFindByID(HIViewGetRoot(whichWindow),
+ kHIViewWindowGrowBoxID, &growBoxView);
+ if (err == noErr) {
+ ChkErr(HIViewSetNeedsDisplay, growBoxView, true);
+ }
+ }
+ }
+ break;
+ case kEventWindowDragStarted:
+ if (!(TkMacOSXModifierState() & cmdKey)) {
+ TkMacOSXBringWindowForward(whichWindow);
+ }
+ TkMacOSXTrackingLoop(1);
+ break;
+ case kEventWindowDragCompleted: {
+ Rect maxBounds, bounds, strWidths;
+ int h = 0, v = 0;
+
+ TkMacOSXTrackingLoop(0);
+ ChkErr(GetWindowGreatestAreaDevice, whichWindow, kWindowDragRgn, NULL,
+ &maxBounds);
+ ChkErr(GetWindowBounds, whichWindow, kWindowStructureRgn, &bounds);
+ ChkErr(GetWindowStructureWidths, whichWindow, &strWidths);
+ if (bounds.left > maxBounds.right - strWidths.left) {
+ h = maxBounds.right - (strWidths.left ? strWidths.left : 40)
+ - bounds.left;
+ } else if (bounds.right < maxBounds.left + strWidths.right) {
+ h = maxBounds.left + (strWidths.right ? strWidths.right : 40)
+ - bounds.right;
+ }
+ if (bounds.top > maxBounds.bottom - strWidths.top) {
+ v = maxBounds.bottom - (strWidths.top ? strWidths.top : 40)
+ - bounds.top;
+ } else if (bounds.bottom < maxBounds.top + strWidths.bottom) {
+ v = maxBounds.top + (strWidths.bottom ? strWidths.bottom : 40)
+ - bounds.bottom;
+ } else if (strWidths.top && bounds.top < maxBounds.top) {
+ v = maxBounds.top - bounds.top;
+ }
+ if (h || v) {
+ OffsetRect(&bounds, h, v);
+ ChkErr(SetWindowBounds, whichWindow, kWindowStructureRgn,&bounds);
+ }
+ break;
+ }
+ case kEventWindowConstrain:
+ if (winPtr && (winPtr->wmInfoPtr->flags & WM_FULLSCREEN) &&
+ TkMacOSXMakeFullscreen(winPtr,whichWindow,1,NULL) == TCL_OK) {
+ statusPtr->stopProcessing = 1;
+ }
+ break;
+ case kEventWindowGetRegion:
+ if (winPtr && (winPtr->wmInfoPtr->flags & WM_TRANSPARENT)) {
+ WindowRegionCode code;
+
+ statusPtr->stopProcessing = (CallNextEventHandler(
+ eventPtr->callRef, eventPtr->eventRef) == noErr);
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamWindowRegionCode, typeWindowRegionCode, NULL,
+ sizeof(code), NULL, &code);
+ if (err == noErr && code == kWindowOpaqueRgn) {
+ RgnHandle rgn;
+
+ err = ChkErr(GetEventParameter, eventPtr->eventRef,
+ kEventParamRgnHandle, typeQDRgnHandle, NULL,
+ sizeof(rgn), NULL, &rgn);
+ if (err == noErr) {
+ SetEmptyRgn(rgn);
+ statusPtr->stopProcessing = 1;
+ }
+ }
+ }
+ break;
+ case kEventWindowDrawContent:
+ if (winPtr && (winPtr->wmInfoPtr->flags & WM_TRANSPARENT)) {
+ CGrafPtr port;
+
+ GetPort(&port);
+ ClearPort(port, NULL);
+ }
+ break;
+ }
+
+ return eventFound;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GenerateUpdateEvent --
+ *
+ * Given a Macintosh window update event this function generates all the
+ * Expose XEvents needed by Tk.
+ *
+ * Results:
+ * True if event(s) are generated - false otherwise.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GenerateUpdateEvent(
+ Window window)
+{
+ WindowRef macWindow;
+ TkDisplay *dispPtr;
+ TkWindow *winPtr;
+ int result = 0;
+ CGRect updateBounds;
+ HIShapeRef rgn;
+ HIMutableShapeRef updateRgn;
+ int dx, dy;
+
+ dispPtr = TkGetDisplayList();
+ winPtr = (TkWindow *)Tk_IdToWindow(dispPtr->display, window);
+
+ if (winPtr ==NULL ){
+ return result;
+ }
+ macWindow = TkMacOSXDrawableWindow(window);
+ TK_IF_MAC_OS_X_API (5, HIWindowCopyShape,
+ ChkErr(HIWindowCopyShape, macWindow, kWindowUpdateRgn,
+ kHICoordSpaceWindow, &rgn);
+ dx = -winPtr->wmInfoPtr->xInParent;
+ dy = -winPtr->wmInfoPtr->yInParent;
+ ) TK_ELSE_MAC_OS_X (5,
+ Rect bounds;
+
+ TkMacOSXCheckTmpQdRgnEmpty();
+ ChkErr(GetWindowRegion, macWindow, kWindowUpdateRgn, tkMacOSXtmpQdRgn);
+ rgn = HIShapeCreateWithQDRgn(tkMacOSXtmpQdRgn);
+ SetEmptyRgn(tkMacOSXtmpQdRgn);
+ ChkErr(GetWindowBounds, macWindow, kWindowContentRgn, &bounds);
+ dx = -bounds.left;
+ dy = -bounds.top;
+ ) TK_ENDIF;
+
+ updateRgn = HIShapeCreateMutableCopy(rgn);
+ CFRelease(rgn);
+ ChkErr(HIShapeOffset, updateRgn, dx, dy);
+ HIShapeGetBounds(updateRgn, &updateBounds);
+#ifdef TK_MAC_DEBUG_CLIP_REGIONS
+ TkMacOSXDebugFlashRegion(window, updateRgn);
+#endif /* TK_MAC_DEBUG_CLIP_REGIONS */
+ BeginUpdate(macWindow);
+ if (winPtr->wmInfoPtr->flags & WM_TRANSPARENT) {
+ ClearPort(TkMacOSXGetDrawablePort(window), updateRgn);
+ }
+ result = GenerateUpdates(updateRgn, &updateBounds, winPtr);
+ EndUpdate(macWindow);
+ CFRelease(updateRgn);
+ if (result) {
+ /*
+ * Ensure there are no pending idle-time redraws that could prevent
+ * the just posted Expose events from generating new redraws.
+ */
+
+ Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT);
+ }
+ return result;
+ }
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GenerateUpdates --
+ *
+ * Given a Macintosh update region and a Tk window this function geneates
+ * a X Expose event for the window if it is within the update region. The
+ * function will then recursivly have each damaged window generate Expose
+ * events for its child windows.
+ *
+ * Results:
+ * True if event(s) are generated - false otherwise.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+GenerateUpdates(
+ HIMutableShapeRef updateRgn,
+ CGRect *updateBounds,
+ TkWindow *winPtr)
+{
+ TkWindow *childPtr;
+ XEvent event;
+ CGRect bounds, damageBounds;
+ HIShapeRef boundsRgn, damageRgn;
+
+ TkMacOSXWinCGBounds(winPtr, &bounds);
+ if (!CGRectIntersectsRect(bounds, *updateBounds)) {
+ return 0;
+ }
+ TK_IF_MAC_OS_X_API (4, HIShapeIntersectsRect,
+ if (!HIShapeIntersectsRect(updateRgn, &bounds)) {
+ return 0;
+ }
+ ) TK_ENDIF
+
+ /*
+ * Compute the bounding box of the area that the damage occured in.
+ */
+
+ boundsRgn = HIShapeCreateWithRect(&bounds);
+ damageRgn = HIShapeCreateIntersection(updateRgn, boundsRgn);
+ if (HIShapeIsEmpty(damageRgn)) {
+ CFRelease(damageRgn);
+ CFRelease(boundsRgn);
+ return 0;
+ }
+ HIShapeGetBounds(damageRgn, &damageBounds);
+ ChkErr(TkMacOSHIShapeUnion, boundsRgn, updateRgn, updateRgn);
+ HIShapeGetBounds(updateRgn, updateBounds);
+ CFRelease(damageRgn);
+ CFRelease(boundsRgn);
+
+ event.xany.serial = Tk_Display(winPtr)->request;
+ event.xany.send_event = false;
+ event.xany.window = Tk_WindowId(winPtr);
+ event.xany.display = Tk_Display(winPtr);
+ event.type = Expose;
+ event.xexpose.x = damageBounds.origin.x - bounds.origin.x;
+ event.xexpose.y = damageBounds.origin.y - bounds.origin.y;
+ event.xexpose.width = damageBounds.size.width;
+ event.xexpose.height = damageBounds.size.height;
+ event.xexpose.count = 0;
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+
+ /*
+ * Generate updates for the children of this window
+ */
+
+ for (childPtr = winPtr->childList; childPtr != NULL;
+ childPtr = childPtr->nextPtr) {
+ if (!Tk_IsMapped(childPtr) || Tk_IsTopLevel(childPtr)) {
+ continue;
+ }
+ GenerateUpdates(updateRgn, updateBounds, childPtr);
+ }
+
+ /*
+ * Generate updates for any contained windows
+ */
+
+ if (Tk_IsContainer(winPtr)) {
+ childPtr = TkpGetOtherWindow(winPtr);
+ if (childPtr != NULL && Tk_IsMapped(childPtr)) {
+ GenerateUpdates(updateRgn, updateBounds, childPtr);
+ }
+
+ /*
+ * TODO: Here we should handle out of process embedding.
+ */
+ }
+
+ return 1;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GenerateActivateEvents --
+ *
+ * Given a Macintosh window activate event this function generates all
+ * the X Activate events needed by Tk.
+ *
+ * Results:
+ * True if event(s) are generated - false otherwise.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+GenerateActivateEvents(
+ Window window, /* Root X window for event. */
+ int activeFlag)
+{
+ TkWindow *winPtr;
+ TkDisplay *dispPtr;
+
+ dispPtr = TkGetDisplayList();
+ winPtr = (TkWindow *) Tk_IdToWindow(dispPtr->display, window);
+ if (winPtr == NULL || winPtr->window == None) {
+ return false;
+ }
+
+ TkGenerateActivateEvents(winPtr,activeFlag);
+ return true;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGenerateFocusEvent --
+ *
+ * Given a Macintosh window activate event this function generates all
+ * the X Focus events needed by Tk.
+ *
+ * Results:
+ * True if event(s) are generated - false otherwise.
+ *
+ * Side effects:
+ * Additional events may be place on the Tk event queue.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkMacOSXGenerateFocusEvent(
+ Window window, /* Root X window for event. */
+ int activeFlag)
+{
+ XEvent event;
+ Tk_Window tkwin;
+ TkDisplay *dispPtr;
+
+ dispPtr = TkGetDisplayList();
+ tkwin = Tk_IdToWindow(dispPtr->display, window);
+ if (tkwin == NULL) {
+ return false;
+ }
+
+ /*
+ * Don't send focus events to windows of class help or to windows with the
+ * kWindowNoActivatesAttribute.
+ */
+
+ if (((TkWindow *)tkwin)->wmInfoPtr->macClass == kHelpWindowClass ||
+ ((TkWindow *)tkwin)->wmInfoPtr->attributes &
+ kWindowNoActivatesAttribute) {
+ return false;
+ }
+
+ /*
+ * Generate FocusIn and FocusOut events. This event is only sent to the
+ * toplevel window.
+ */
+
+ if (activeFlag) {
+ event.xany.type = FocusIn;
+ } else {
+ event.xany.type = FocusOut;
+ }
+
+ event.xany.serial = dispPtr->display->request;
+ event.xany.send_event = False;
+ event.xfocus.display = dispPtr->display;
+ event.xfocus.window = window;
+ event.xfocus.mode = NotifyNormal;
+ event.xfocus.detail = NotifyDetailNone;
+
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+ return true;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkGenWMConfigureEvent --
+ *
+ * Generate a ConfigureNotify event for Tk. Depending on the value of
+ * flag the values of width/height, x/y, or both may be changed.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A ConfigureNotify event is sent to Tk.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkGenWMConfigureEvent(
+ Tk_Window tkwin,
+ int x,
+ int y,
+ int width,
+ int height,
+ int flags)
+{
+ XEvent event;
+ WmInfo *wmPtr;
+ TkWindow *winPtr = (TkWindow *) tkwin;
+
+ if (tkwin == NULL) {
+ return;
+ }
+
+ event.type = ConfigureNotify;
+ event.xconfigure.serial = Tk_Display(tkwin)->request;
+ event.xconfigure.send_event = False;
+ event.xconfigure.display = Tk_Display(tkwin);
+ event.xconfigure.event = Tk_WindowId(tkwin);
+ event.xconfigure.window = Tk_WindowId(tkwin);
+ event.xconfigure.border_width = winPtr->changes.border_width;
+ event.xconfigure.override_redirect = winPtr->atts.override_redirect;
+ if (winPtr->changes.stack_mode == Above) {
+ event.xconfigure.above = winPtr->changes.sibling;
+ } else {
+ event.xconfigure.above = None;
+ }
+
+ if (!(flags & TK_LOCATION_CHANGED)) {
+ x = Tk_X(tkwin);
+ y = Tk_Y(tkwin);
+ }
+ if (!(flags & TK_SIZE_CHANGED)) {
+ width = Tk_Width(tkwin);
+ height = Tk_Height(tkwin);
+ }
+ event.xconfigure.x = x;
+ event.xconfigure.y = y;
+ event.xconfigure.width = width;
+ event.xconfigure.height = height;
+
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+
+ /*
+ * Update window manager information.
+ */
+
+ if (Tk_IsTopLevel(winPtr)) {
+ wmPtr = winPtr->wmInfoPtr;
+ if (flags & TK_LOCATION_CHANGED) {
+ wmPtr->x = x;
+ wmPtr->y = y;
+ wmPtr->flags &= ~(WM_NEGATIVE_X | WM_NEGATIVE_Y);
+ }
+ if ((flags & TK_SIZE_CHANGED) && !(wmPtr->flags & WM_SYNC_PENDING) &&
+ ((width != Tk_Width(tkwin)) || (height != Tk_Height(tkwin)))) {
+ if ((wmPtr->width == -1) && (width == winPtr->reqWidth)) {
+ /*
+ * Don't set external width, since the user didn't change it
+ * from what the widgets asked for.
+ */
+ } else {
+ if (wmPtr->gridWin != NULL) {
+ wmPtr->width = wmPtr->reqGridWidth
+ + (width - winPtr->reqWidth)/wmPtr->widthInc;
+ if (wmPtr->width < 0) {
+ wmPtr->width = 0;
+ }
+ } else {
+ wmPtr->width = width;
+ }
+ }
+ if ((wmPtr->height == -1) && (height == winPtr->reqHeight)) {
+ /*
+ * Don't set external height, since the user didn't change it
+ * from what the widgets asked for.
+ */
+ } else {
+ if (wmPtr->gridWin != NULL) {
+ wmPtr->height = wmPtr->reqGridHeight
+ + (height - winPtr->reqHeight)/wmPtr->heightInc;
+ if (wmPtr->height < 0) {
+ wmPtr->height = 0;
+ }
+ } else {
+ wmPtr->height = height;
+ }
+ }
+ wmPtr->configWidth = width;
+ wmPtr->configHeight = height;
+ }
+ }
+
+ /*
+ * Now set up the changes structure. Under X we wait for the
+ * ConfigureNotify to set these values. On the Mac we know imediatly that
+ * this is what we want - so we just set them. However, we need to make
+ * sure the windows clipping region is marked invalid so the change is
+ * visible to the subwindow.
+ */
+
+ winPtr->changes.x = x;
+ winPtr->changes.y = y;
+ winPtr->changes.width = width;
+ winPtr->changes.height = height;
+ TkMacOSXInvalClipRgns(tkwin);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkGenWMDestroyEvent --
+ *
+ * Generate a WM Destroy event for Tk.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A WM_PROTOCOL/WM_DELETE_WINDOW event is sent to Tk.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkGenWMDestroyEvent(
+ Tk_Window tkwin)
+{
+ XEvent event;
+
+ event.xany.serial = Tk_Display(tkwin)->request;
+ event.xany.send_event = False;
+ event.xany.display = Tk_Display(tkwin);
+
+ event.xclient.window = Tk_WindowId(tkwin);
+ event.xclient.type = ClientMessage;
+ event.xclient.message_type = Tk_InternAtom(tkwin, "WM_PROTOCOLS");
+ event.xclient.format = 32;
+ event.xclient.data.l[0] = Tk_InternAtom(tkwin, "WM_DELETE_WINDOW");
+ Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkWmProtocolEventProc --
+ *
+ * This procedure is called by the Tk_HandleEvent whenever a
+ * ClientMessage event arrives whose type is "WM_PROTOCOLS". This
+ * procedure handles the message from the window manager in an
+ * appropriate fashion.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Depends on what sort of handler, if any, was set up for the protocol.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkWmProtocolEventProc(
+ TkWindow *winPtr, /* Window to which the event was sent. */
+ XEvent *eventPtr) /* X event. */
+{
+ WmInfo *wmPtr;
+ ProtocolHandler *protPtr;
+ Tcl_Interp *interp;
+ Atom protocol;
+ int result;
+
+ wmPtr = winPtr->wmInfoPtr;
+ if (wmPtr == NULL) {
+ return;
+ }
+ protocol = (Atom) eventPtr->xclient.data.l[0];
+ for (protPtr = wmPtr->protPtr; protPtr != NULL;
+ protPtr = protPtr->nextPtr) {
+ if (protocol == protPtr->protocol) {
+ Tcl_Preserve(protPtr);
+ interp = protPtr->interp;
+ Tcl_Preserve(interp);
+ result = Tcl_GlobalEval(interp, protPtr->command);
+ if (result != TCL_OK) {
+ Tcl_AddErrorInfo(interp, "\n (command for \"");
+ Tcl_AddErrorInfo(interp,
+ Tk_GetAtomName((Tk_Window) winPtr, protocol));
+ Tcl_AddErrorInfo(interp, "\" window manager protocol)");
+ Tcl_BackgroundException(interp, result);
+ }
+ Tcl_Release(interp);
+ Tcl_Release(protPtr);
+ return;
+ }
+ }
+
+ /*
+ * No handler was present for this protocol. If this is a WM_DELETE_WINDOW
+ * message then just destroy the window.
+ */
+
+ if (protocol == Tk_InternAtom((Tk_Window) winPtr, "WM_DELETE_WINDOW")) {
+ Tk_DestroyWindow((Tk_Window) winPtr);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_MacOSXIsAppInFront --
+ *
+ * Returns 1 if this app is the foreground app.
+ *
+ * Results:
+ * 1 if app is in front, 0 otherwise.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+Tk_MacOSXIsAppInFront(void)
+{
+ OSStatus err;
+ ProcessSerialNumber frontPsn, ourPsn = {0, kCurrentProcess};
+ Boolean isFrontProcess = true;
+
+ err = ChkErr(GetFrontProcess, &frontPsn);
+ if (err == noErr) {
+ ChkErr(SameProcess, &frontPsn, &ourPsn, &isFrontProcess);
+ }
+
+ return (isFrontProcess == true);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ClearPort --
+ *
+ * Clear (i.e. fill with transparent color) the given port.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ClearPort(
+ CGrafPtr port,
+ HIShapeRef updateRgn)
+{
+ CGContextRef context;
+ Rect bounds;
+ CGRect rect;
+
+ GetPortBounds(port, &bounds);
+ QDBeginCGContext(port, &context);
+ SyncCGContextOriginWithPort(context, port);
+ CGContextConcatCTM(context, CGAffineTransformMake(1.0, 0.0, 0.0, -1.0, 0.0,
+ bounds.bottom - bounds.top));
+ if (updateRgn) {
+ ChkErr(HIShapeReplacePathInCGContext, updateRgn, context);
+ CGContextEOClip(context);
+ }
+ rect = CGRectMake(0, 0, bounds.right, bounds.bottom);
+ CGContextClearRect(context, rect);
+ QDEndCGContext(port, &context);
+}
+
+/*
+ * Local Variables:
+ * fill-column: 78
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/carbon/tkMacOSXWm.c b/carbon/tkMacOSXWm.c
new file mode 100644
index 0000000..0ec8d74
--- /dev/null
+++ b/carbon/tkMacOSXWm.c
@@ -0,0 +1,6495 @@
+/*
+ * tkMacOSXWm.c --
+ *
+ * This module takes care of the interactions between a Tk-based
+ * application and the window manager. Among other things, it implements
+ * the "wm" command and passes geometry information to the window
+ * manager.
+ *
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkScrollbar.h"
+#include "tkMacOSXWm.h"
+#include "tkMacOSXEvent.h"
+#include "tkMacOSXDebug.h"
+
+/*
+#ifdef TK_MAC_DEBUG
+#define TK_MAC_DEBUG_WINDOWS
+#endif
+*/
+
+/*
+ * Data for [wm attributes] command:
+ */
+typedef enum {
+ WMATT_ALPHA, WMATT_FULLSCREEN, WMATT_MODIFIED, WMATT_NOTIFY,
+ WMATT_TITLEPATH, WMATT_TOPMOST, WMATT_TRANSPARENT,
+ _WMATT_LAST_ATTRIBUTE
+} WmAttribute;
+
+static const char *const WmAttributeNames[] = {
+ "-alpha", "-fullscreen", "-modified", "-notify",
+ "-titlepath", "-topmost", "-transparent",
+ NULL
+};
+
+/*
+ * This is a list of all of the toplevels that have been mapped so far. It is
+ * used by the menu code to inval windows that were damaged by menus, and will
+ * eventually also be used to keep track of floating windows.
+ */
+
+TkMacOSXWindowList *tkMacOSXWindowListPtr = NULL;
+
+/*
+ * The variable below is used to enable or disable tracing in this module. If
+ * tracing is enabled, then information is printed on standard output about
+ * interesting interactions with the window manager.
+ */
+
+static int wmTracing = 0;
+
+/*
+ * The following structure is the official type record for geometry management
+ * of top-level windows.
+ */
+
+static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin);
+
+static const Tk_GeomMgr wmMgrType = {
+ "wm", /* name */
+ TopLevelReqProc, /* requestProc */
+ NULL, /* lostSlaveProc */
+};
+
+/*
+ * The following keeps state for Aqua dock icon bounce notification.
+ */
+
+static int tkMacOSXWmAttrNotifyVal = 0;
+
+/*
+ * Hash table for Mac Window -> TkWindow mapping.
+ */
+
+static Tcl_HashTable windowTable;
+static int windowHashInit = false;
+
+/*
+ * Forward declarations for procedures defined in this file:
+ */
+
+static void InitialWindowBounds(TkWindow *winPtr,
+ WindowRef macWindow, Rect *geometry);
+static int ParseGeometry(Tcl_Interp *interp, char *string,
+ TkWindow *winPtr);
+static void TopLevelEventProc(ClientData clientData,
+ XEvent *eventPtr);
+static void WmStackorderToplevelWrapperMap(TkWindow *winPtr,
+ Display *display, Tcl_HashTable *table);
+static void UpdateGeometryInfo(ClientData clientData);
+static void UpdateSizeHints(TkWindow *winPtr);
+static void UpdateVRootGeometry(WmInfo *wmPtr);
+static int WmAspectCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmAttributesCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmClientCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmColormapwindowsCmd(Tk_Window tkwin,
+ TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmCommandCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmDeiconifyCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmFocusmodelCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmForgetCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmFrameCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmGeometryCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmGridCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmGroupCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmIconbitmapCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmIconifyCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmIconmaskCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmIconnameCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmIconphotoCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmIconpositionCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmIconwindowCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmManageCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmMaxsizeCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmMinsizeCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmOverrideredirectCmd(Tk_Window tkwin,
+ TkWindow *winPtr, Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmPositionfromCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmProtocolCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmResizableCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmSizefromCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmStackorderCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmStateCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmTitleCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmTransientCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static int WmWithdrawCmd(Tk_Window tkwin, TkWindow *winPtr,
+ Tcl_Interp *interp, int objc,
+ Tcl_Obj *const objv[]);
+static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr);
+static int WmWinStyle(Tcl_Interp *interp, TkWindow *winPtr,
+ int objc, Tcl_Obj *const objv[]);
+static void ApplyWindowClassAttributeChanges(TkWindow *winPtr,
+ WindowRef macWindow, WindowClass oldClass,
+ WindowAttributes oldAttributes, int create);
+static void ApplyMasterOverrideChanges(TkWindow *winPtr,
+ WindowRef macWindow);
+static WindowGroupRef WmGetWindowGroup(TkWindow *winPtr);
+static void GetMinSize(TkWindow *winPtr, int *minWidthPtr,
+ int *minHeightPtr);
+static void GetMaxSize(TkWindow *winPtr, int *maxWidthPtr,
+ int *maxHeightPtr);
+static void RemapWindows(TkWindow *winPtr,
+ MacDrawable *parentWin);
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkWmNewWindow --
+ *
+ * This procedure is invoked whenever a new top-level window is created.
+ * Its job is to initialize the WmInfo structure for the window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A WmInfo structure gets allocated and initialized.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkWmNewWindow(
+ TkWindow *winPtr) /* Newly-created top-level window. */
+{
+ WmInfo *wmPtr = ckalloc(sizeof(WmInfo));
+
+ wmPtr->winPtr = winPtr;
+ wmPtr->reparent = None;
+ wmPtr->titleUid = NULL;
+ wmPtr->iconName = NULL;
+ wmPtr->master = None;
+ wmPtr->hints.flags = InputHint | StateHint;
+ wmPtr->hints.input = True;
+ wmPtr->hints.initial_state = NormalState;
+ wmPtr->hints.icon_pixmap = None;
+ wmPtr->hints.icon_window = None;
+ wmPtr->hints.icon_x = wmPtr->hints.icon_y = 0;
+ wmPtr->hints.icon_mask = None;
+ wmPtr->hints.window_group = None;
+ wmPtr->leaderName = NULL;
+ wmPtr->masterWindowName = NULL;
+ wmPtr->icon = NULL;
+ wmPtr->iconFor = NULL;
+ wmPtr->sizeHintsFlags = 0;
+ wmPtr->minWidth = wmPtr->minHeight = 1;
+ wmPtr->maxWidth = 0;
+ wmPtr->maxHeight = 0;
+ wmPtr->gridWin = NULL;
+ wmPtr->widthInc = wmPtr->heightInc = 1;
+ wmPtr->minAspect.x = wmPtr->minAspect.y = 1;
+ wmPtr->maxAspect.x = wmPtr->maxAspect.y = 1;
+ wmPtr->reqGridWidth = wmPtr->reqGridHeight = -1;
+ wmPtr->gravity = NorthWestGravity;
+ wmPtr->width = -1;
+ wmPtr->height = -1;
+ wmPtr->x = winPtr->changes.x;
+ wmPtr->y = winPtr->changes.y;
+ wmPtr->parentWidth = winPtr->changes.width
+ + 2*winPtr->changes.border_width;
+ wmPtr->parentHeight = winPtr->changes.height
+ + 2*winPtr->changes.border_width;
+ wmPtr->xInParent = 0;
+ wmPtr->yInParent = 0;
+ wmPtr->cmapList = NULL;
+ wmPtr->cmapCount = 0;
+ wmPtr->configX = 0;
+ wmPtr->configY = 0;
+ wmPtr->configWidth = -1;
+ wmPtr->configHeight = -1;
+ wmPtr->vRoot = None;
+ wmPtr->protPtr = NULL;
+ wmPtr->cmdArgv = NULL;
+ wmPtr->clientMachine = NULL;
+ wmPtr->flags = WM_NEVER_MAPPED;
+ wmPtr->style = -1;
+ wmPtr->macClass = kDocumentWindowClass;
+ wmPtr->attributes = kWindowStandardDocumentAttributes
+ | kWindowLiveResizeAttribute;
+ wmPtr->scrollWinPtr = NULL;
+ winPtr->wmInfoPtr = wmPtr;
+
+ UpdateVRootGeometry(wmPtr);
+
+ /*
+ * Tk must monitor structure events for top-level windows, in order to
+ * detect size and position changes caused by window managers.
+ */
+
+ Tk_CreateEventHandler((Tk_Window) winPtr, StructureNotifyMask,
+ TopLevelEventProc, winPtr);
+
+ /*
+ * Arrange for geometry requests to be reflected from the window to the
+ * window manager.
+ */
+
+ Tk_ManageGeometry((Tk_Window) winPtr, &wmMgrType, (ClientData) 0);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkWmMapWindow --
+ *
+ * This procedure is invoked to map a top-level window. This module gets
+ * a chance to update all window-manager-related information in
+ * properties before the window manager sees the map event and checks the
+ * properties. It also gets to decide whether or not to even map the
+ * window after all.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Properties of winPtr may get updated to provide up-to-date information
+ * to the window manager. The window may also get mapped, but it may not
+ * be if this procedure decides that isn't appropriate (e.g. because the
+ * window is withdrawn).
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkWmMapWindow(
+ TkWindow *winPtr) /* Top-level window that's about to be
+ * mapped. */
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ if (wmPtr->flags & WM_NEVER_MAPPED) {
+ wmPtr->flags &= ~WM_NEVER_MAPPED;
+
+ /*
+ * Create the underlying Mac window for this Tk window.
+ */
+
+ if (!TkMacOSXHostToplevelExists(winPtr)) {
+ TkMacOSXMakeRealWindowExist(winPtr);
+ }
+
+ /*
+ * Generate configure event when we first map the window.
+ */
+
+ TkGenWMConfigureEvent((Tk_Window) winPtr, wmPtr->x, wmPtr->y, -1, -1,
+ TK_LOCATION_CHANGED);
+
+ /*
+ * This is the first time this window has ever been mapped. Store all
+ * the window-manager-related information for the window.
+ */
+
+ if (wmPtr->titleUid == NULL) {
+ wmPtr->titleUid = winPtr->nameUid;
+ }
+
+ if (!Tk_IsEmbedded(winPtr)) {
+ TkSetWMName(winPtr, wmPtr->titleUid);
+ }
+
+ TkWmSetClass(winPtr);
+
+ if (wmPtr->iconName != NULL) {
+ XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName);
+ }
+
+ wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
+ }
+ if (wmPtr->hints.initial_state == WithdrawnState) {
+ return;
+ }
+
+ /*
+ * TODO: we need to display a window if it's iconic on creation.
+ */
+
+ if (wmPtr->hints.initial_state == IconicState) {
+ return;
+ }
+
+ /*
+ * Update geometry information.
+ */
+
+ wmPtr->flags |= WM_ABOUT_TO_MAP;
+ if (wmPtr->flags & WM_UPDATE_PENDING) {
+ Tk_CancelIdleCall(UpdateGeometryInfo, winPtr);
+ }
+ UpdateGeometryInfo(winPtr);
+ wmPtr->flags &= ~WM_ABOUT_TO_MAP;
+
+ /*
+ * Map the window.
+ */
+
+ XMapWindow(winPtr->display, winPtr->window);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkWmUnmapWindow --
+ *
+ * This procedure is invoked to unmap a top-level window. On the
+ * Macintosh all we do is call XUnmapWindow.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Unmaps the window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkWmUnmapWindow(
+ TkWindow *winPtr) /* Top-level window that's about to be
+ * mapped. */
+{
+ XUnmapWindow(winPtr->display, winPtr->window);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkWmDeadWindow --
+ *
+ * This procedure is invoked when a top-level window is about to be
+ * deleted. It cleans up the wm-related data structures for the window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The WmInfo structure for winPtr gets freed up.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkWmDeadWindow(
+ TkWindow *winPtr) /* Top-level window that's being deleted. */
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ WmInfo *wmPtr2;
+
+ if (wmPtr == NULL) {
+ return;
+ }
+ if (wmPtr->hints.flags & IconPixmapHint) {
+ Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap);
+ }
+ if (wmPtr->hints.flags & IconMaskHint) {
+ Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_mask);
+ }
+ if (wmPtr->iconName != NULL) {
+ ckfree(wmPtr->iconName);
+ }
+ if (wmPtr->leaderName != NULL) {
+ ckfree(wmPtr->leaderName);
+ }
+ if (wmPtr->masterWindowName != NULL) {
+ ckfree(wmPtr->masterWindowName);
+ }
+ if (wmPtr->icon != NULL) {
+ wmPtr2 = ((TkWindow *) wmPtr->icon)->wmInfoPtr;
+ wmPtr2->iconFor = NULL;
+ }
+ if (wmPtr->iconFor != NULL) {
+ wmPtr2 = ((TkWindow *) wmPtr->iconFor)->wmInfoPtr;
+ wmPtr2->icon = NULL;
+ wmPtr2->hints.flags &= ~IconWindowHint;
+ }
+ while (wmPtr->protPtr != NULL) {
+ ProtocolHandler *protPtr;
+
+ protPtr = wmPtr->protPtr;
+ wmPtr->protPtr = protPtr->nextPtr;
+ Tcl_EventuallyFree(protPtr, TCL_DYNAMIC);
+ }
+ if (wmPtr->cmdArgv != NULL) {
+ ckfree(wmPtr->cmdArgv);
+ }
+ if (wmPtr->clientMachine != NULL) {
+ ckfree(wmPtr->clientMachine);
+ }
+ if (wmPtr->flags & WM_UPDATE_PENDING) {
+ Tk_CancelIdleCall(UpdateGeometryInfo, winPtr);
+ }
+ ckfree(wmPtr);
+ winPtr->wmInfoPtr = NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkWmSetClass --
+ *
+ * This procedure is invoked whenever a top-level window's class is
+ * changed. If the window has been mapped then this procedure updates the
+ * window manager property for the class. If the window hasn't been
+ * mapped, the update is deferred until just before the first mapping.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A window property may get updated.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkWmSetClass(
+ TkWindow *winPtr) /* Newly-created top-level window. */
+{
+ return;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_WmObjCmd --
+ *
+ * This procedure is invoked to process the "wm" Tcl command. See the
+ * user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+/* ARGSUSED */
+int
+Tk_WmObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+{
+ Tk_Window tkwin = (Tk_Window) clientData;
+ static const char *const optionStrings[] = {
+ "aspect", "attributes", "client", "colormapwindows",
+ "command", "deiconify", "focusmodel", "forget",
+ "frame", "geometry", "grid", "group",
+ "iconbitmap", "iconify", "iconmask", "iconname",
+ "iconphoto", "iconposition", "iconwindow",
+ "manage", "maxsize", "minsize", "overrideredirect",
+ "positionfrom", "protocol", "resizable", "sizefrom",
+ "stackorder", "state", "title", "transient",
+ "withdraw", NULL };
+ enum options {
+ WMOPT_ASPECT, WMOPT_ATTRIBUTES, WMOPT_CLIENT, WMOPT_COLORMAPWINDOWS,
+ WMOPT_COMMAND, WMOPT_DEICONIFY, WMOPT_FOCUSMODEL, WMOPT_FORGET,
+ WMOPT_FRAME, WMOPT_GEOMETRY, WMOPT_GRID, WMOPT_GROUP,
+ WMOPT_ICONBITMAP, WMOPT_ICONIFY, WMOPT_ICONMASK, WMOPT_ICONNAME,
+ WMOPT_ICONPHOTO, WMOPT_ICONPOSITION, WMOPT_ICONWINDOW,
+ WMOPT_MANAGE, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT,
+ WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM,
+ WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT,
+ WMOPT_WITHDRAW };
+ int index, length;
+ char *argv1;
+ TkWindow *winPtr;
+
+ if (objc < 2) {
+ wrongNumArgs:
+ Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?");
+ return TCL_ERROR;
+ }
+
+ argv1 = Tcl_GetStringFromObj(objv[1], &length);
+ if ((argv1[0] == 't') && (strncmp(argv1, "tracing", length) == 0)
+ && (length >= 3)) {
+ if ((objc != 2) && (objc != 3)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "?boolean?");
+ return TCL_ERROR;
+ }
+ if (objc == 2) {
+ Tcl_SetResult(interp, ((wmTracing) ? "on" : "off"), TCL_STATIC);
+ return TCL_OK;
+ }
+ return Tcl_GetBooleanFromObj(interp, objv[2], &wmTracing);
+ }
+
+ if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
+ &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ if (objc < 3) {
+ goto wrongNumArgs;
+ }
+
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], (Tk_Window *) &winPtr)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (!Tk_IsTopLevel(winPtr)
+ && (index != WMOPT_MANAGE) && (index != WMOPT_FORGET)) {
+ Tcl_AppendResult(interp, "window \"", winPtr->pathName,
+ "\" isn't a top-level window", NULL);
+ return TCL_ERROR;
+ }
+
+ switch ((enum options) index) {
+ case WMOPT_ASPECT:
+ return WmAspectCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ATTRIBUTES:
+ return WmAttributesCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_CLIENT:
+ return WmClientCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_COLORMAPWINDOWS:
+ return WmColormapwindowsCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_COMMAND:
+ return WmCommandCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_DEICONIFY:
+ return WmDeiconifyCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_FOCUSMODEL:
+ return WmFocusmodelCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_FORGET:
+ return WmForgetCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_FRAME:
+ return WmFrameCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_GEOMETRY:
+ return WmGeometryCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_GRID:
+ return WmGridCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_GROUP:
+ return WmGroupCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONBITMAP:
+ return WmIconbitmapCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONIFY:
+ return WmIconifyCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONMASK:
+ return WmIconmaskCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONNAME:
+ return WmIconnameCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONPHOTO:
+ return WmIconphotoCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONPOSITION:
+ return WmIconpositionCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_ICONWINDOW:
+ return WmIconwindowCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_MANAGE:
+ return WmManageCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_MAXSIZE:
+ return WmMaxsizeCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_MINSIZE:
+ return WmMinsizeCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_OVERRIDEREDIRECT:
+ return WmOverrideredirectCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_POSITIONFROM:
+ return WmPositionfromCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_PROTOCOL:
+ return WmProtocolCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_RESIZABLE:
+ return WmResizableCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_SIZEFROM:
+ return WmSizefromCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_STACKORDER:
+ return WmStackorderCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_STATE:
+ return WmStateCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_TITLE:
+ return WmTitleCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_TRANSIENT:
+ return WmTransientCmd(tkwin, winPtr, interp, objc, objv);
+ case WMOPT_WITHDRAW:
+ return WmWithdrawCmd(tkwin, winPtr, interp, objc, objv);
+ }
+
+ /* This should not happen */
+ return TCL_ERROR;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmAspectCmd --
+ *
+ * This procedure is invoked to process the "wm aspect" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmAspectCmd(
+ 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;
+ int numer1, denom1, numer2, denom2;
+
+ if ((objc != 3) && (objc != 7)) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "window ?minNumer minDenom maxNumer maxDenom?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ if (wmPtr->sizeHintsFlags & PAspect) {
+ char buf[TCL_INTEGER_SPACE * 4];
+
+ sprintf(buf, "%d %d %d %d", wmPtr->minAspect.x,
+ wmPtr->minAspect.y, wmPtr->maxAspect.x,
+ wmPtr->maxAspect.y);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ }
+ return TCL_OK;
+ }
+ if (*Tcl_GetString(objv[3]) == '\0') {
+ wmPtr->sizeHintsFlags &= ~PAspect;
+ } else {
+ if ((Tcl_GetIntFromObj(interp, objv[3], &numer1) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[4], &denom1) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[5], &numer2) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[6], &denom2) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+ if ((numer1 <= 0) || (denom1 <= 0) || (numer2 <= 0) ||
+ (denom2 <= 0)) {
+ Tcl_SetResult(interp, "aspect number can't be <= 0", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ wmPtr->minAspect.x = numer1;
+ wmPtr->minAspect.y = denom1;
+ wmPtr->maxAspect.x = numer2;
+ wmPtr->maxAspect.y = denom2;
+ wmPtr->sizeHintsFlags |= PAspect;
+ }
+ wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
+ WmUpdateGeom(wmPtr, winPtr);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmSetAttribute --
+ *
+ * Helper routine for WmAttributesCmd. Sets the value of the specified
+ * attribute.
+ *
+ * Returns:
+ *
+ * TCL_OK if successful, TCL_ERROR otherwise. In case of an error, leaves
+ * a message in the interpreter's result.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmSetAttribute(
+ TkWindow *winPtr, /* Toplevel to work with */
+ WindowRef macWindow,
+ Tcl_Interp *interp, /* Current interpreter */
+ WmAttribute attribute, /* Code of attribute to set */
+ Tcl_Obj *value) /* New value */
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ int boolean;
+
+ switch (attribute) {
+ case WMATT_ALPHA: {
+ double dval;
+
+ if (Tcl_GetDoubleFromObj(interp, value, &dval) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ /*
+ * The user should give (transparent) 0 .. 1.0 (opaque)
+ */
+
+ if (dval < 0.0) {
+ dval = 0.0;
+ } else if (dval > 1.0) {
+ dval = 1.0;
+ }
+ ChkErr(SetWindowAlpha, macWindow, dval);
+ break;
+ }
+ case WMATT_FULLSCREEN:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (boolean != ((wmPtr->flags & WM_FULLSCREEN) != 0)) {
+ if (TkMacOSXMakeFullscreen(winPtr, macWindow, boolean, interp)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ }
+ break;
+ case WMATT_MODIFIED:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (boolean != IsWindowModified(macWindow)) {
+ ChkErr(SetWindowModified, macWindow, boolean);
+ }
+ break;
+ case WMATT_NOTIFY:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (boolean == !tkMacOSXWmAttrNotifyVal) {
+ static NMRec notifyRec;
+
+ if (boolean) {
+ bzero(&notifyRec, sizeof(notifyRec));
+ notifyRec.qType = nmType;
+ notifyRec.nmMark = 1;
+ ChkErr(NMInstall, &notifyRec);
+ } else {
+ ChkErr(NMRemove, &notifyRec);
+ }
+ tkMacOSXWmAttrNotifyVal = boolean;
+ }
+ break;
+ case WMATT_TITLEPATH: {
+ const char *path = Tcl_FSGetNativePath(value);
+ OSStatus err;
+
+ if (path && *path) {
+ FSRef ref;
+ Boolean d;
+
+ err = ChkErr(FSPathMakeRef, (const unsigned char*)path, &ref, &d);
+ if (err == noErr) {
+ TK_IF_MAC_OS_X_API (4, HIWindowSetProxyFSRef,
+ err = ChkErr(HIWindowSetProxyFSRef, macWindow, &ref);
+ ) TK_ELSE_MAC_OS_X (4,
+ AliasHandle alias;
+
+ err = ChkErr(FSNewAlias, NULL, &ref, &alias);
+ if (err == noErr) {
+ err = ChkErr(SetWindowProxyAlias, macWindow, alias);
+ DisposeHandle((Handle) alias);
+ }
+ ) TK_ENDIF
+ }
+ } else {
+ int len;
+
+ Tcl_GetStringFromObj(value, &len);
+ if (!len) {
+ err = ChkErr(RemoveWindowProxy, macWindow);
+ } else {
+ err = fnfErr;
+ }
+ }
+ if (err != noErr) {
+ return TCL_ERROR;
+ }
+ break;
+ }
+ case WMATT_TOPMOST:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (boolean != ((wmPtr->flags & WM_TOPMOST) != 0)) {
+ WindowGroupRef group;
+
+ if (boolean) {
+ wmPtr->flags |= WM_TOPMOST;
+ } else {
+ wmPtr->flags &= ~WM_TOPMOST;
+ }
+ group = WmGetWindowGroup(winPtr);
+ if (group && group != GetWindowGroup(macWindow)) {
+ ChkErr(SetWindowGroup, macWindow, group);
+ }
+ }
+ break;
+ case WMATT_TRANSPARENT:
+ if (Tcl_GetBooleanFromObj(interp, value, &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (boolean != ((wmPtr->flags & WM_TRANSPARENT) != 0)) {
+ WindowAttributes oldAttributes = wmPtr->attributes;
+
+ if (boolean) {
+ wmPtr->flags |= WM_TRANSPARENT;
+ wmPtr->attributes |= kWindowNoShadowAttribute;
+ TK_IF_MAC_OS_X_API (3, HIWindowChangeFeatures,
+ UInt32 features;
+
+ ChkErr(GetWindowFeatures, macWindow, &features);
+ if (features & kWindowIsOpaque) {
+ ChkErr(HIWindowChangeFeatures, macWindow, 0,
+ kWindowIsOpaque);
+ }
+ ) TK_ENDIF
+ } else {
+ wmPtr->flags &= ~WM_TRANSPARENT;
+ wmPtr->attributes &= ~kWindowNoShadowAttribute;
+ }
+ ApplyWindowClassAttributeChanges(winPtr, macWindow,
+ wmPtr->macClass, oldAttributes, 1);
+ ChkErr(ReshapeCustomWindow, macWindow);
+ TkMacOSXInvalidateWindow((MacDrawable *) winPtr->window,
+ TK_PARENT_WINDOW);
+ }
+ break;
+ case _WMATT_LAST_ATTRIBUTE:
+ default:
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmGetAttribute --
+ *
+ * Helper routine for WmAttributesCmd. Returns the current value of the
+ * specified attribute.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static Tcl_Obj *
+WmGetAttribute(
+ TkWindow *winPtr, /* Toplevel to work with */
+ WindowRef macWindow,
+ WmAttribute attribute) /* Code of attribute to get */
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ Tcl_Obj *result = NULL;
+
+ switch (attribute) {
+ case WMATT_ALPHA: {
+ float fval = 1.0;
+
+ ChkErr(GetWindowAlpha, macWindow, &fval);
+ result = Tcl_NewDoubleObj(fval);
+ break;
+ }
+ case WMATT_FULLSCREEN:
+ result = Tcl_NewBooleanObj(wmPtr->flags & WM_FULLSCREEN);
+ break;
+ case WMATT_MODIFIED:
+ result = Tcl_NewBooleanObj(IsWindowModified(macWindow));
+ break;
+ case WMATT_NOTIFY:
+ result = Tcl_NewBooleanObj(tkMacOSXWmAttrNotifyVal);
+ break;
+ case WMATT_TITLEPATH: {
+ FSRef ref;
+ UInt8 path[PATH_MAX+1];
+ OSStatus err;
+
+ TK_IF_MAC_OS_X_API (4, HIWindowSetProxyFSRef,
+ err = ChkErr(HIWindowGetProxyFSRef, macWindow, &ref);
+ ) TK_ELSE_MAC_OS_X (4,
+ Boolean wasChanged;
+ AliasHandle alias;
+
+ err = ChkErr(GetWindowProxyAlias, macWindow, &alias);
+ if (err == noErr) {
+ err = ChkErr(FSResolveAlias, NULL, alias, &ref, &wasChanged);
+ }
+ ) TK_ENDIF
+ if (err == noErr) {
+ err = ChkErr(FSRefMakePath, &ref, path, PATH_MAX);
+ }
+ if (err != noErr) {
+ *path = 0;
+ }
+ result = Tcl_NewStringObj((char*) path, -1);
+ break;
+ }
+ case WMATT_TOPMOST:
+ result = Tcl_NewBooleanObj(wmPtr->flags & WM_TOPMOST);
+ break;
+ case WMATT_TRANSPARENT:
+ result = Tcl_NewBooleanObj(wmPtr->flags & WM_TRANSPARENT);
+ break;
+ case _WMATT_LAST_ATTRIBUTE:
+ default:
+ break;
+ }
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmAttributesCmd --
+ *
+ * This procedure is invoked to process the "wm attributes" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmAttributesCmd(
+ 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. */
+{
+ int attribute = 0;
+ WindowRef macWindow;
+
+ if (winPtr->window == None) {
+ Tk_MakeWindowExist((Tk_Window) winPtr);
+ }
+ if (!TkMacOSXHostToplevelExists(winPtr)) {
+ TkMacOSXMakeRealWindowExist(winPtr);
+ }
+ macWindow = TkMacOSXDrawableWindow(winPtr->window);
+
+ if (objc == 3) { /* wm attributes $win */
+ Tcl_Obj *result = Tcl_NewListObj(0,0);
+
+ for (attribute = 0; attribute < _WMATT_LAST_ATTRIBUTE; ++attribute) {
+ Tcl_ListObjAppendElement(interp, result,
+ Tcl_NewStringObj(WmAttributeNames[attribute], -1));
+ Tcl_ListObjAppendElement(interp, result,
+ WmGetAttribute(winPtr, macWindow, attribute));
+ }
+ Tcl_SetObjResult(interp, result);
+ } else if (objc == 4) { /* wm attributes $win -attribute */
+ if (Tcl_GetIndexFromObj(interp, objv[3], WmAttributeNames,
+ "attribute", 0, &attribute) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, WmGetAttribute(winPtr, macWindow, attribute));
+ } else if ((objc - 3) % 2 == 0) { /* wm attributes $win -att value... */
+ int i;
+
+ for (i = 3; i < objc; i += 2) {
+ if (Tcl_GetIndexFromObj(interp, objv[i], WmAttributeNames,
+ "attribute", 0, &attribute) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (WmSetAttribute(winPtr, macWindow, interp, attribute, objv[i+1])
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ }
+ } else {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?-attribute ?value ...??");
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmClientCmd --
+ *
+ * This procedure is invoked to process the "wm client" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmClientCmd(
+ 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;
+ char *argv3;
+ int length;
+
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?name?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ if (wmPtr->clientMachine != NULL) {
+ Tcl_SetResult(interp, wmPtr->clientMachine, TCL_STATIC);
+ }
+ return TCL_OK;
+ }
+ argv3 = Tcl_GetStringFromObj(objv[3], &length);
+ if (argv3[0] == 0) {
+ if (wmPtr->clientMachine != NULL) {
+ ckfree(wmPtr->clientMachine);
+ wmPtr->clientMachine = NULL;
+ }
+ return TCL_OK;
+ }
+ if (wmPtr->clientMachine != NULL) {
+ ckfree(wmPtr->clientMachine);
+ }
+ wmPtr->clientMachine = ckalloc(length + 1);
+ strcpy(wmPtr->clientMachine, argv3);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmColormapwindowsCmd --
+ *
+ * This procedure is invoked to process the "wm colormapwindows" Tcl
+ * command. See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmColormapwindowsCmd(
+ 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;
+ TkWindow **cmapList;
+ TkWindow *winPtr2;
+ int i, windowObjc, gotToplevel = 0;
+ Tcl_Obj **windowObjv;
+
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?windowList?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ Tk_MakeWindowExist((Tk_Window) winPtr);
+ for (i = 0; i < wmPtr->cmapCount; i++) {
+ if ((i == (wmPtr->cmapCount-1))
+ && (wmPtr->flags & WM_ADDED_TOPLEVEL_COLORMAP)) {
+ break;
+ }
+ Tcl_AppendElement(interp, wmPtr->cmapList[i]->pathName);
+ }
+ return TCL_OK;
+ }
+ if (Tcl_ListObjGetElements(interp, objv[3], &windowObjc, &windowObjv)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ cmapList = ckalloc((windowObjc+1) * sizeof(TkWindow*));
+ for (i = 0; i < windowObjc; i++) {
+ if (TkGetWindowFromObj(interp, tkwin, windowObjv[i],
+ (Tk_Window *) &winPtr2) != TCL_OK) {
+ ckfree(cmapList);
+ return TCL_ERROR;
+ }
+ if (winPtr2 == winPtr) {
+ gotToplevel = 1;
+ }
+ if (winPtr2->window == None) {
+ Tk_MakeWindowExist((Tk_Window) winPtr2);
+ }
+ cmapList[i] = winPtr2;
+ }
+ if (!gotToplevel) {
+ wmPtr->flags |= WM_ADDED_TOPLEVEL_COLORMAP;
+ cmapList[windowObjc] = winPtr;
+ windowObjc++;
+ } else {
+ wmPtr->flags &= ~WM_ADDED_TOPLEVEL_COLORMAP;
+ }
+ wmPtr->flags |= WM_COLORMAPS_EXPLICIT;
+ if (wmPtr->cmapList != NULL) {
+ ckfree(wmPtr->cmapList);
+ }
+ wmPtr->cmapList = cmapList;
+ wmPtr->cmapCount = windowObjc;
+
+ /*
+ * On the Macintosh all of this is just an excercise in compatability as
+ * we don't support colormaps. If we did they would be installed here.
+ */
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmCommandCmd --
+ *
+ * This procedure is invoked to process the "wm command" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmCommandCmd(
+ 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;
+ char *argv3;
+ int cmdArgc;
+ const char **cmdArgv;
+
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?value?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ if (wmPtr->cmdArgv != NULL) {
+ argv3 = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv);
+ Tcl_SetResult(interp, argv3, TCL_VOLATILE);
+ ckfree(argv3);
+ }
+ return TCL_OK;
+ }
+ argv3 = Tcl_GetString(objv[3]);
+ if (argv3[0] == 0) {
+ if (wmPtr->cmdArgv != NULL) {
+ ckfree(wmPtr->cmdArgv);
+ wmPtr->cmdArgv = NULL;
+ }
+ return TCL_OK;
+ }
+ if (Tcl_SplitList(interp, argv3, &cmdArgc, &cmdArgv) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (wmPtr->cmdArgv != NULL) {
+ ckfree(wmPtr->cmdArgv);
+ }
+ wmPtr->cmdArgc = cmdArgc;
+ wmPtr->cmdArgv = cmdArgv;
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmDeiconifyCmd --
+ *
+ * This procedure is invoked to process the "wm deiconify" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmDeiconifyCmd(
+ 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), NULL);
+ return TCL_ERROR;
+ }
+ if (winPtr->flags & TK_EMBEDDED) {
+ Tcl_AppendResult(interp, "can't deiconify ", winPtr->pathName,
+ ": it is an embedded window", NULL);
+ return TCL_ERROR;
+ }
+ TkpWmSetState(winPtr, TkMacOSXIsWindowZoomed(winPtr) ?
+ ZoomState : NormalState);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmFocusmodelCmd --
+ *
+ * This procedure is invoked to process the "wm focusmodel" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmFocusmodelCmd(
+ 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;
+ static const char *const optionStrings[] = {
+ "active", "passive", NULL };
+ enum options {
+ OPT_ACTIVE, OPT_PASSIVE };
+ int index;
+
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?active|passive?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ Tcl_SetResult(interp, (wmPtr->hints.input ? "passive" : "active"),
+ TCL_STATIC);
+ return TCL_OK;
+ }
+
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
+ &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (index == OPT_ACTIVE) {
+ wmPtr->hints.input = False;
+ } else { /* OPT_PASSIVE */
+ wmPtr->hints.input = True;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmForgetCmd --
+ *
+ * This procedure is invoked to process the "wm forget" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmForgetCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel or Frame to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+{
+#if 1
+ Tcl_AppendResult(interp, "wm forget is not yet supported", NULL);
+ return TCL_ERROR;
+#else
+ register Tk_Window frameWin = (Tk_Window)winPtr;
+ char *oldClass = (char*)Tk_Class(frameWin);
+
+ if (Tk_IsTopLevel(frameWin)) {
+ MacDrawable *macWin = (MacDrawable *) winPtr->window;
+ CGrafPtr destPort = TkMacOSXGetDrawablePort(winPtr->window);
+
+ TkFocusJoin(winPtr);
+ Tk_UnmapWindow(frameWin);
+
+ if (destPort != NULL) {
+ WindowRef winRef = GetWindowFromPort(destPort);
+
+ TkMacOSXUnregisterMacWindow(winRef);
+ DisposeWindow(winRef);
+ }
+ macWin->grafPtr = NULL;
+ macWin->toplevel = winPtr->parentPtr->privatePtr->toplevel;
+ macWin->flags &= ~TK_HOST_EXISTS;
+
+ RemapWindows(winPtr, macWin);
+ TkWmDeadWindow(winPtr);
+ winPtr->flags &=
+ ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
+
+ TkMapTopFrame(frameWin);
+ } else {
+ /* Already not managed by wm - ignore it */
+ }
+ return TCL_OK;
+#endif
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmFrameCmd --
+ *
+ * This procedure is invoked to process the "wm frame" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmFrameCmd(
+ 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;
+ Window window;
+ char buf[TCL_INTEGER_SPACE];
+
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window");
+ return TCL_ERROR;
+ }
+ window = wmPtr->reparent;
+ if (window == None) {
+ window = Tk_WindowId((Tk_Window) winPtr);
+ }
+ sprintf(buf, "0x%x", (unsigned) window);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmGeometryCmd --
+ *
+ * This procedure is invoked to process the "wm geometry" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmGeometryCmd(
+ 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;
+ char xSign, ySign;
+ int width, height;
+ char *argv3;
+
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ char buf[16 + TCL_INTEGER_SPACE * 4];
+
+ xSign = (wmPtr->flags & WM_NEGATIVE_X) ? '-' : '+';
+ ySign = (wmPtr->flags & WM_NEGATIVE_Y) ? '-' : '+';
+ if (wmPtr->gridWin != NULL) {
+ width = wmPtr->reqGridWidth + (winPtr->changes.width
+ - winPtr->reqWidth)/wmPtr->widthInc;
+ height = wmPtr->reqGridHeight + (winPtr->changes.height
+ - winPtr->reqHeight)/wmPtr->heightInc;
+ } else {
+ width = winPtr->changes.width;
+ height = winPtr->changes.height;
+ }
+ sprintf(buf, "%dx%d%c%d%c%d",
+ width, height, xSign, wmPtr->x, ySign, wmPtr->y);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ return TCL_OK;
+ }
+ argv3 = Tcl_GetString(objv[3]);
+ if (*argv3 == '\0') {
+ wmPtr->width = -1;
+ wmPtr->height = -1;
+ WmUpdateGeom(wmPtr, winPtr);
+ return TCL_OK;
+ }
+ return ParseGeometry(interp, argv3, winPtr);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmGridCmd --
+ *
+ * This procedure is invoked to process the "wm grid" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmGridCmd(
+ 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;
+ int reqWidth, reqHeight, widthInc, heightInc;
+
+ if ((objc != 3) && (objc != 7)) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "window ?baseWidth baseHeight widthInc heightInc?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ if (wmPtr->sizeHintsFlags & PBaseSize) {
+ char buf[TCL_INTEGER_SPACE * 4];
+
+ sprintf(buf, "%d %d %d %d", wmPtr->reqGridWidth,
+ wmPtr->reqGridHeight, wmPtr->widthInc,
+ wmPtr->heightInc);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ }
+ return TCL_OK;
+ }
+ if (*Tcl_GetString(objv[3]) == '\0') {
+ /*
+ * Turn off gridding and reset the width and height to make sense as
+ * ungridded numbers.
+ */
+
+ wmPtr->sizeHintsFlags &= ~(PBaseSize|PResizeInc);
+ if (wmPtr->width != -1) {
+ wmPtr->width = winPtr->reqWidth + (wmPtr->width
+ - wmPtr->reqGridWidth)*wmPtr->widthInc;
+ wmPtr->height = winPtr->reqHeight + (wmPtr->height
+ - wmPtr->reqGridHeight)*wmPtr->heightInc;
+ }
+ wmPtr->widthInc = 1;
+ wmPtr->heightInc = 1;
+ } else {
+ if ((Tcl_GetIntFromObj(interp, objv[3], &reqWidth) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[4], &reqHeight) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[5], &widthInc) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[6], &heightInc)!=TCL_OK)) {
+ return TCL_ERROR;
+ }
+ if (reqWidth < 0) {
+ Tcl_SetResult(interp, "baseWidth can't be < 0", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ if (reqHeight < 0) {
+ Tcl_SetResult(interp, "baseHeight can't be < 0", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ if (widthInc <= 0) {
+ Tcl_SetResult(interp, "widthInc can't be <= 0", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ if (heightInc <= 0) {
+ Tcl_SetResult(interp, "heightInc can't be <= 0", TCL_STATIC);
+ return TCL_ERROR;
+ }
+ Tk_SetGrid((Tk_Window) winPtr, reqWidth, reqHeight, widthInc,
+ heightInc);
+ }
+ wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
+ WmUpdateGeom(wmPtr, winPtr);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmGroupCmd --
+ *
+ * This procedure is invoked to process the "wm group" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmGroupCmd(
+ 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;
+ Tk_Window tkwin2;
+ char *argv3;
+ int length;
+
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ if (wmPtr->hints.flags & WindowGroupHint) {
+ Tcl_SetResult(interp, wmPtr->leaderName, TCL_STATIC);
+ }
+ return TCL_OK;
+ }
+ argv3 = Tcl_GetStringFromObj(objv[3], &length);
+ if (*argv3 == '\0') {
+ wmPtr->hints.flags &= ~WindowGroupHint;
+ if (wmPtr->leaderName != NULL) {
+ ckfree(wmPtr->leaderName);
+ }
+ wmPtr->leaderName = NULL;
+ } else {
+ if (TkGetWindowFromObj(interp, tkwin, objv[3], &tkwin2) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ Tk_MakeWindowExist(tkwin2);
+ if (wmPtr->leaderName != NULL) {
+ ckfree(wmPtr->leaderName);
+ }
+ wmPtr->hints.window_group = Tk_WindowId(tkwin2);
+ wmPtr->hints.flags |= WindowGroupHint;
+ wmPtr->leaderName = ckalloc(length + 1);
+ strcpy(wmPtr->leaderName, argv3);
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmIconbitmapCmd --
+ *
+ * This procedure is invoked to process the "wm iconbitmap" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmIconbitmapCmd(
+ 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;
+ Pixmap pixmap;
+ char *str;
+ int len;
+
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ if (wmPtr->hints.flags & IconPixmapHint) {
+ Tcl_SetResult(interp, (char*)Tk_NameOfBitmap(winPtr->display,
+ wmPtr->hints.icon_pixmap), TCL_STATIC);
+ }
+ return TCL_OK;
+ }
+ str = Tcl_GetStringFromObj(objv[3], &len);
+ if (winPtr->window == None) {
+ Tk_MakeWindowExist((Tk_Window) winPtr);
+ }
+ if (!TkMacOSXHostToplevelExists(winPtr)) {
+ TkMacOSXMakeRealWindowExist(winPtr);
+ }
+ if (WmSetAttribute(winPtr, TkMacOSXDrawableWindow(winPtr->window), interp,
+ WMATT_TITLEPATH, objv[3]) == TCL_OK) {
+ if (!len) {
+ if (wmPtr->hints.icon_pixmap != None) {
+ Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap);
+ wmPtr->hints.icon_pixmap = None;
+ }
+ wmPtr->hints.flags &= ~IconPixmapHint;
+ }
+ } else {
+ pixmap = Tk_GetBitmap(interp, (Tk_Window) winPtr, Tk_GetUid(str));
+ if (pixmap == None) {
+ return TCL_ERROR;
+ }
+ wmPtr->hints.icon_pixmap = pixmap;
+ wmPtr->hints.flags |= IconPixmapHint;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmIconifyCmd --
+ *
+ * This procedure is invoked to process the "wm iconify" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmIconifyCmd(
+ 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 (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
+ Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
+ "\": override-redirect flag is set", NULL);
+ return TCL_ERROR;
+ }
+ if (wmPtr->master != None) {
+ Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
+ "\": it is a transient", NULL);
+ return TCL_ERROR;
+ }
+ if (wmPtr->iconFor != NULL) {
+ Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
+ ": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
+ return TCL_ERROR;
+ }
+ if (winPtr->flags & TK_EMBEDDED) {
+ Tcl_AppendResult(interp, "can't iconify ", winPtr->pathName,
+ ": it is an embedded window", NULL);
+ return TCL_ERROR;
+ }
+ TkpWmSetState(winPtr, IconicState);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmIconmaskCmd --
+ *
+ * This procedure is invoked to process the "wm iconmask" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmIconmaskCmd(
+ 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;
+ Pixmap pixmap;
+ char *argv3;
+
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ if (wmPtr->hints.flags & IconMaskHint) {
+ Tcl_SetResult(interp, (char *) Tk_NameOfBitmap(winPtr->display,
+ wmPtr->hints.icon_mask), TCL_STATIC);
+ }
+ return TCL_OK;
+ }
+ argv3 = Tcl_GetString(objv[3]);
+ if (*argv3 == '\0') {
+ if (wmPtr->hints.icon_mask != None) {
+ Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_mask);
+ }
+ wmPtr->hints.flags &= ~IconMaskHint;
+ } else {
+ pixmap = Tk_GetBitmap(interp, tkwin, argv3);
+ if (pixmap == None) {
+ return TCL_ERROR;
+ }
+ wmPtr->hints.icon_mask = pixmap;
+ wmPtr->hints.flags |= IconMaskHint;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmIconnameCmd --
+ *
+ * This procedure is invoked to process the "wm iconname" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmIconnameCmd(
+ 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;
+ const char *argv3;
+ int length;
+
+ if (objc > 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ if (wmPtr->iconName != NULL) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->iconName, -1));
+ }
+ return TCL_OK;
+ }
+
+ if (wmPtr->iconName != NULL) {
+ ckfree(wmPtr->iconName);
+ }
+ argv3 = Tcl_GetStringFromObj(objv[3], &length);
+ wmPtr->iconName = ckalloc(length + 1);
+ strcpy(wmPtr->iconName, argv3);
+ if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
+ XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName);
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmIconphotoCmd --
+ *
+ * This procedure is invoked to process the "wm iconphoto" Tcl command.
+ * See the user documentation for details on what it does. Not yet
+ * implemented for OS X.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmIconphotoCmd(
+ 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. */
+{
+ Tk_PhotoHandle photo;
+ int i, width, height, isDefault = 0;
+
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "window ?-default? image1 ?image2 ...?");
+ return TCL_ERROR;
+ }
+ if (strcmp(Tcl_GetString(objv[3]), "-default") == 0) {
+ isDefault = 1;
+ if (objc == 4) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "window ?-default? image1 ?image2 ...?");
+ return TCL_ERROR;
+ }
+ }
+
+ /*
+ * Iterate over all images to retrieve their sizes, in order to allocate a
+ * buffer large enough to hold all images.
+ */
+
+ for (i = 3 + isDefault; i < objc; i++) {
+ photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
+ if (photo == NULL) {
+ Tcl_AppendResult(interp, "can't use \"", Tcl_GetString(objv[i]),
+ "\" as iconphoto: not a photo image", NULL);
+ return TCL_ERROR;
+ }
+ Tk_PhotoGetSize(photo, &width, &height);
+ }
+
+ /*
+ * TODO: This requires implementation for OS X, but we silently return for
+ * now.
+ */
+
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmIconpositionCmd --
+ *
+ * This procedure is invoked to process the "wm iconposition" Tcl
+ * command. See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmIconpositionCmd(
+ 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;
+ int x, y;
+
+ if ((objc != 3) && (objc != 5)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ if (wmPtr->hints.flags & IconPositionHint) {
+ char buf[TCL_INTEGER_SPACE * 2];
+
+ sprintf(buf, "%d %d", wmPtr->hints.icon_x,
+ wmPtr->hints.icon_y);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ }
+ return TCL_OK;
+ }
+ if (*Tcl_GetString(objv[3]) == '\0') {
+ wmPtr->hints.flags &= ~IconPositionHint;
+ } else {
+ if ((Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)){
+ return TCL_ERROR;
+ }
+ wmPtr->hints.icon_x = x;
+ wmPtr->hints.icon_y = y;
+ wmPtr->hints.flags |= IconPositionHint;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmIconwindowCmd --
+ *
+ * This procedure is invoked to process the "wm iconwindow" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmIconwindowCmd(
+ 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;
+ Tk_Window tkwin2;
+ WmInfo *wmPtr2;
+
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ if (wmPtr->icon != NULL) {
+ Tcl_SetResult(interp, Tk_PathName(wmPtr->icon), TCL_STATIC);
+ }
+ return TCL_OK;
+ }
+ if (*Tcl_GetString(objv[3]) == '\0') {
+ wmPtr->hints.flags &= ~IconWindowHint;
+ if (wmPtr->icon != NULL) {
+ wmPtr2 = ((TkWindow *) wmPtr->icon)->wmInfoPtr;
+ wmPtr2->iconFor = NULL;
+ wmPtr2->hints.initial_state = WithdrawnState;
+ }
+ wmPtr->icon = NULL;
+ } else {
+ if (TkGetWindowFromObj(interp, tkwin, objv[3], &tkwin2) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (!Tk_IsTopLevel(tkwin2)) {
+ Tcl_AppendResult(interp, "can't use ", Tcl_GetString(objv[3]),
+ " as icon window: not at top level", NULL);
+ return TCL_ERROR;
+ }
+ wmPtr2 = ((TkWindow *) tkwin2)->wmInfoPtr;
+ if (wmPtr2->iconFor != NULL) {
+ Tcl_AppendResult(interp, Tcl_GetString(objv[3]),
+ " is already an icon for ",
+ Tk_PathName(wmPtr2->iconFor), NULL);
+ return TCL_ERROR;
+ }
+ if (wmPtr->icon != NULL) {
+ WmInfo *wmPtr3 = ((TkWindow *) wmPtr->icon)->wmInfoPtr;
+ wmPtr3->iconFor = NULL;
+ }
+ Tk_MakeWindowExist(tkwin2);
+ wmPtr->hints.icon_window = Tk_WindowId(tkwin2);
+ wmPtr->hints.flags |= IconWindowHint;
+ wmPtr->icon = tkwin2;
+ wmPtr2->iconFor = (Tk_Window) winPtr;
+ if (!(wmPtr2->flags & WM_NEVER_MAPPED)) {
+ /*
+ * Don't have iconwindows on the Mac. We just withdraw.
+ */
+
+ Tk_UnmapWindow(tkwin2);
+ }
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmManageCmd --
+ *
+ * This procedure is invoked to process the "wm manage" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmManageCmd(
+ Tk_Window tkwin, /* Main window of the application. */
+ TkWindow *winPtr, /* Toplevel or Frame to work with */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+{
+#if 1
+ Tcl_AppendResult(interp, "wm manage is not yet supported", NULL);
+ return TCL_ERROR;
+#else
+ register Tk_Window frameWin = (Tk_Window)winPtr;
+ register WmInfo *wmPtr = winPtr->wmInfoPtr;
+ char *oldClass = (char*)Tk_Class(frameWin);
+
+ if (!Tk_IsTopLevel(frameWin)) {
+ MacDrawable *macWin = (MacDrawable *) winPtr->window;
+
+ if (!Tk_IsManageable(frameWin)) {
+ Tcl_AppendResult(interp, "window \"",
+ Tk_PathName(frameWin), "\" is not manageable: must be "
+ "a frame, labelframe or toplevel", NULL);
+ return TCL_ERROR;
+ }
+ TkFocusSplit(winPtr);
+ Tk_UnmapWindow(frameWin);
+ if (wmPtr == NULL) {
+ TkWmNewWindow(winPtr);
+ if (winPtr->window == None) {
+ Tk_MakeWindowExist((Tk_Window) winPtr);
+ macWin = (MacDrawable *) winPtr->window;
+ }
+ TkWmMapWindow(winPtr);
+ Tk_UnmapWindow(frameWin);
+ }
+ wmPtr = winPtr->wmInfoPtr;
+ winPtr->flags &= ~TK_MAPPED;
+ macWin->grafPtr = NULL;
+ macWin->toplevel = macWin;
+ RemapWindows(winPtr, macWin);
+ winPtr->flags |=
+ (TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED);
+ TkMapTopFrame(frameWin);
+ } else if (Tk_IsTopLevel(frameWin)) {
+ /* Already managed by wm - ignore it */
+ }
+ return TCL_OK;
+#endif
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmMaxsizeCmd --
+ *
+ * This procedure is invoked to process the "wm maxsize" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmMaxsizeCmd(
+ 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;
+ int width, height;
+
+ if ((objc != 3) && (objc != 5)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ char buf[TCL_INTEGER_SPACE * 2];
+
+ GetMaxSize(winPtr, &width, &height);
+ sprintf(buf, "%d %d", width, height);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ return TCL_OK;
+ }
+ if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+ wmPtr->maxWidth = width;
+ wmPtr->maxHeight = height;
+ wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
+ WmUpdateGeom(wmPtr, winPtr);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmMinsizeCmd --
+ *
+ * This procedure is invoked to process the "wm minsize" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmMinsizeCmd(
+ 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;
+ int width, height;
+
+ if ((objc != 3) && (objc != 5)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ char buf[TCL_INTEGER_SPACE * 2];
+
+ GetMinSize(winPtr, &width, &height);
+ sprintf(buf, "%d %d", width, height);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ return TCL_OK;
+ }
+ if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK)
+ || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+ wmPtr->minWidth = width;
+ wmPtr->minHeight = height;
+ wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
+ WmUpdateGeom(wmPtr, winPtr);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmOverrideredirectCmd --
+ *
+ * This procedure is invoked to process the "wm overrideredirect" Tcl
+ * command. See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmOverrideredirectCmd(
+ 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. */
+{
+ int boolean;
+ XSetWindowAttributes atts;
+
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
+ Tk_Attributes((Tk_Window) winPtr)->override_redirect));
+ return TCL_OK;
+ }
+ if (Tcl_GetBooleanFromObj(interp, objv[3], &boolean) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ atts.override_redirect = (boolean) ? True : False;
+ Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts);
+ ApplyMasterOverrideChanges(winPtr, NULL);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmPositionfromCmd --
+ *
+ * This procedure is invoked to process the "wm positionfrom" Tcl
+ * command. See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmPositionfromCmd(
+ 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;
+ static const char *const optionStrings[] = {
+ "program", "user", NULL };
+ enum options {
+ OPT_PROGRAM, OPT_USER };
+ int index;
+
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?user/program?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ if (wmPtr->sizeHintsFlags & USPosition) {
+ Tcl_SetResult(interp, "user", TCL_STATIC);
+ } else if (wmPtr->sizeHintsFlags & PPosition) {
+ Tcl_SetResult(interp, "program", TCL_STATIC);
+ }
+ return TCL_OK;
+ }
+ if (*Tcl_GetString(objv[3]) == '\0') {
+ wmPtr->sizeHintsFlags &= ~(USPosition|PPosition);
+ } else {
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
+ &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (index == OPT_USER) {
+ wmPtr->sizeHintsFlags &= ~PPosition;
+ wmPtr->sizeHintsFlags |= USPosition;
+ } else {
+ wmPtr->sizeHintsFlags &= ~USPosition;
+ wmPtr->sizeHintsFlags |= PPosition;
+ }
+ }
+ wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
+ WmUpdateGeom(wmPtr, winPtr);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmProtocolCmd --
+ *
+ * This procedure is invoked to process the "wm protocol" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmProtocolCmd(
+ 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;
+ register ProtocolHandler *protPtr, *prevPtr;
+ Atom protocol;
+ char *cmd;
+ int cmdLength;
+
+ if ((objc < 3) || (objc > 5)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ /*
+ * Return a list of all defined protocols for the window.
+ */
+
+ for (protPtr = wmPtr->protPtr; protPtr != NULL;
+ protPtr = protPtr->nextPtr) {
+ Tcl_AppendElement(interp,
+ Tk_GetAtomName((Tk_Window) winPtr, protPtr->protocol));
+ }
+ return TCL_OK;
+ }
+ protocol = Tk_InternAtom((Tk_Window) winPtr, Tcl_GetString(objv[3]));
+ if (objc == 4) {
+ /*
+ * Return the command to handle a given protocol.
+ */
+
+ for (protPtr = wmPtr->protPtr; protPtr != NULL;
+ protPtr = protPtr->nextPtr) {
+ if (protPtr->protocol == protocol) {
+ Tcl_SetResult(interp, protPtr->command, TCL_STATIC);
+ return TCL_OK;
+ }
+ }
+ return TCL_OK;
+ }
+
+ /*
+ * Delete any current protocol handler, then create a new one with the
+ * specified command, unless the command is empty.
+ */
+
+ for (protPtr = wmPtr->protPtr, prevPtr = NULL; protPtr != NULL;
+ prevPtr = protPtr, protPtr = protPtr->nextPtr) {
+ if (protPtr->protocol == protocol) {
+ if (prevPtr == NULL) {
+ wmPtr->protPtr = protPtr->nextPtr;
+ } else {
+ prevPtr->nextPtr = protPtr->nextPtr;
+ }
+ Tcl_EventuallyFree(protPtr, TCL_DYNAMIC);
+ break;
+ }
+ }
+ cmd = Tcl_GetStringFromObj(objv[4], &cmdLength);
+ if (cmdLength > 0) {
+ protPtr = ckalloc(HANDLER_SIZE(cmdLength));
+ protPtr->protocol = protocol;
+ protPtr->nextPtr = wmPtr->protPtr;
+ wmPtr->protPtr = protPtr;
+ protPtr->interp = interp;
+ strcpy(protPtr->command, cmd);
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmResizableCmd --
+ *
+ * This procedure is invoked to process the "wm resizable" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmResizableCmd(
+ 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;
+ int width, height;
+ WindowAttributes oldAttributes = wmPtr->attributes;
+
+ if ((objc != 3) && (objc != 5)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ char buf[TCL_INTEGER_SPACE * 2];
+
+ sprintf(buf, "%d %d",
+ (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) ? 0 : 1,
+ (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) ? 0 : 1);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ return TCL_OK;
+ }
+ if ((Tcl_GetBooleanFromObj(interp, objv[3], &width) != TCL_OK)
+ || (Tcl_GetBooleanFromObj(interp, objv[4], &height) != TCL_OK)) {
+ return TCL_ERROR;
+ }
+ if (width) {
+ wmPtr->flags &= ~WM_WIDTH_NOT_RESIZABLE;
+ wmPtr->attributes |= kWindowHorizontalZoomAttribute;
+ } else {
+ wmPtr->flags |= WM_WIDTH_NOT_RESIZABLE;
+ wmPtr->attributes &= ~kWindowHorizontalZoomAttribute;
+ }
+ if (height) {
+ wmPtr->flags &= ~WM_HEIGHT_NOT_RESIZABLE;
+ wmPtr->attributes |= kWindowVerticalZoomAttribute;
+ } else {
+ wmPtr->flags |= WM_HEIGHT_NOT_RESIZABLE;
+ wmPtr->attributes &= ~kWindowVerticalZoomAttribute;
+ }
+ if (width || height) {
+ wmPtr->attributes |= kWindowResizableAttribute;
+ } else {
+ wmPtr->attributes &= ~kWindowResizableAttribute;
+ }
+ wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
+ if (wmPtr->scrollWinPtr != NULL) {
+ TkScrollbarEventuallyRedraw((TkScrollbar *)
+ wmPtr->scrollWinPtr->instanceData);
+ }
+ WmUpdateGeom(wmPtr, winPtr);
+ ApplyWindowClassAttributeChanges(winPtr, NULL, wmPtr->macClass,
+ oldAttributes, 1);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmSizefromCmd --
+ *
+ * This procedure is invoked to process the "wm sizefrom" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmSizefromCmd(
+ 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;
+ static const char *const optionStrings[] = {
+ "program", "user", NULL };
+ enum options {
+ OPT_PROGRAM, OPT_USER };
+ int index;
+
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?user|program?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ if (wmPtr->sizeHintsFlags & USSize) {
+ Tcl_SetResult(interp, "user", TCL_STATIC);
+ } else if (wmPtr->sizeHintsFlags & PSize) {
+ Tcl_SetResult(interp, "program", TCL_STATIC);
+ }
+ return TCL_OK;
+ }
+
+ if (*Tcl_GetString(objv[3]) == '\0') {
+ wmPtr->sizeHintsFlags &= ~(USSize|PSize);
+ } else {
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
+ &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (index == OPT_USER) {
+ wmPtr->sizeHintsFlags &= ~PSize;
+ wmPtr->sizeHintsFlags |= USSize;
+ } else { /* OPT_PROGRAM */
+ wmPtr->sizeHintsFlags &= ~USSize;
+ wmPtr->sizeHintsFlags |= PSize;
+ }
+ }
+ wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
+ WmUpdateGeom(wmPtr, winPtr);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmStackorderCmd --
+ *
+ * This procedure is invoked to process the "wm stackorder" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmStackorderCmd(
+ 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. */
+{
+ TkWindow **windows, **window_ptr;
+ static const char *const optionStrings[] = {
+ "isabove", "isbelow", NULL };
+ enum options {
+ OPT_ISABOVE, OPT_ISBELOW };
+ int index;
+
+ if ((objc != 3) && (objc != 5)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?isabove|isbelow window?");
+ return TCL_ERROR;
+ }
+
+ if (objc == 3) {
+ windows = TkWmStackorderToplevel(winPtr);
+ if (windows == NULL) {
+ Tcl_Panic("TkWmStackorderToplevel failed");
+ }
+
+ for (window_ptr = windows; *window_ptr ; window_ptr++) {
+ Tcl_AppendElement(interp, (*window_ptr)->pathName);
+ }
+ ckfree(windows);
+ return TCL_OK;
+ } else {
+ TkWindow *winPtr2;
+ int index1=-1, index2=-1, result;
+
+ if (TkGetWindowFromObj(interp, tkwin, objv[4], (Tk_Window *) &winPtr2)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ if (!Tk_IsTopLevel(winPtr2)) {
+ Tcl_AppendResult(interp, "window \"", winPtr2->pathName,
+ "\" isn't a top-level window", NULL);
+ return TCL_ERROR;
+ }
+
+ if (!Tk_IsMapped(winPtr)) {
+ Tcl_AppendResult(interp, "window \"", winPtr->pathName,
+ "\" isn't mapped", NULL);
+ return TCL_ERROR;
+ }
+
+ if (!Tk_IsMapped(winPtr2)) {
+ Tcl_AppendResult(interp, "window \"", winPtr2->pathName,
+ "\" isn't mapped", NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Lookup stacking order of all toplevels that are children of "." and
+ * find the position of winPtr and winPtr2 in the stacking order.
+ */
+
+ windows = TkWmStackorderToplevel(winPtr->mainPtr->winPtr);
+ if (windows == NULL) {
+ Tcl_AppendResult(interp, "TkWmStackorderToplevel failed", NULL);
+ return TCL_ERROR;
+ }
+
+ for (window_ptr = windows; *window_ptr ; window_ptr++) {
+ if (*window_ptr == winPtr) {
+ index1 = (window_ptr - windows);
+ }
+ if (*window_ptr == winPtr2) {
+ index2 = (window_ptr - windows);
+ }
+ }
+ if (index1 == -1) {
+ Tcl_Panic("winPtr window not found");
+ }
+ if (index2 == -1) {
+ Tcl_Panic("winPtr2 window not found");
+ }
+
+ ckfree(windows);
+
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
+ &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (index == OPT_ISABOVE) {
+ result = index1 > index2;
+ } else { /* OPT_ISBELOW */
+ result = index1 < index2;
+ }
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(result));
+ return TCL_OK;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmStateCmd --
+ *
+ * This procedure is invoked to process the "wm state" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmStateCmd(
+ 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;
+ static const char *const optionStrings[] = {
+ "normal", "iconic", "withdrawn", "zoomed", NULL };
+ enum options {
+ OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED };
+ int index;
+
+ if ((objc < 3) || (objc > 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?state?");
+ return TCL_ERROR;
+ }
+ if (objc == 4) {
+ if (wmPtr->iconFor != NULL) {
+ Tcl_AppendResult(interp, "can't change state of ",
+ Tcl_GetString(objv[2]), ": it is an icon for ",
+ Tk_PathName(wmPtr->iconFor), NULL);
+ return TCL_ERROR;
+ }
+ if (winPtr->flags & TK_EMBEDDED) {
+ Tcl_AppendResult(interp, "can't change state of ",
+ winPtr->pathName, ": it is an embedded window", NULL);
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, "argument", 0,
+ &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ if (index == OPT_NORMAL) {
+ TkpWmSetState(winPtr, NormalState);
+
+ /*
+ * This varies from 'wm deiconify' because it does not force the
+ * window to be raised and receive focus
+ */
+ } else if (index == OPT_ICONIC) {
+ if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) {
+ Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
+ "\": override-redirect flag is set", NULL);
+ return TCL_ERROR;
+ }
+ if (wmPtr->master != None) {
+ Tcl_AppendResult(interp, "can't iconify \"", winPtr->pathName,
+ "\": it is a transient", NULL);
+ return TCL_ERROR;
+ }
+ TkpWmSetState(winPtr, IconicState);
+ } else if (index == OPT_WITHDRAWN) {
+ TkpWmSetState(winPtr, WithdrawnState);
+ } 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;
+ case WithdrawnState:
+ Tcl_SetResult(interp, "withdrawn", TCL_STATIC);
+ break;
+ case ZoomState:
+ Tcl_SetResult(interp, "zoomed", TCL_STATIC);
+ break;
+ }
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmTitleCmd --
+ *
+ * This procedure is invoked to process the "wm title" Tcl command. See
+ * the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmTitleCmd(
+ 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;
+ char *argv3;
+ int length;
+
+ if (objc > 4) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ Tcl_SetResult(interp, (char *)((wmPtr->titleUid != NULL) ?
+ wmPtr->titleUid : winPtr->nameUid), TCL_STATIC);
+ return TCL_OK;
+ }
+ argv3 = Tcl_GetStringFromObj(objv[3], &length);
+ wmPtr->titleUid = Tk_GetUid(argv3);
+ if (!(wmPtr->flags & WM_NEVER_MAPPED) && !Tk_IsEmbedded(winPtr)) {
+ TkSetWMName(winPtr, wmPtr->titleUid);
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmTransientCmd --
+ *
+ * This procedure is invoked to process the "wm transient" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmTransientCmd(
+ 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;
+ Tk_Window master;
+ WmInfo *wmPtr2;
+ char *argv3;
+ int length;
+
+ if ((objc != 3) && (objc != 4)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?master?");
+ return TCL_ERROR;
+ }
+ if (objc == 3) {
+ if (wmPtr->master != None) {
+ Tcl_SetResult(interp, wmPtr->masterWindowName, TCL_STATIC);
+ }
+ return TCL_OK;
+ }
+ if (Tcl_GetString(objv[3])[0] == '\0') {
+ wmPtr->master = None;
+ if (wmPtr->masterWindowName != NULL) {
+ ckfree(wmPtr->masterWindowName);
+ }
+ wmPtr->masterWindowName = NULL;
+ } else {
+ if (TkGetWindowFromObj(interp, tkwin, objv[3], &master) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ Tk_MakeWindowExist(master);
+
+ if (wmPtr->iconFor != NULL) {
+ Tcl_AppendResult(interp, "can't make \"", Tcl_GetString(objv[2]),
+ "\" a transient: it is an icon for ",
+ Tk_PathName(wmPtr->iconFor), NULL);
+ return TCL_ERROR;
+ }
+
+ wmPtr2 = ((TkWindow *) master)->wmInfoPtr;
+
+ /* Under some circumstances, wmPtr2 is NULL here */
+ if (wmPtr2 != NULL && wmPtr2->iconFor != NULL) {
+ Tcl_AppendResult(interp, "can't make \"", Tcl_GetString(objv[3]),
+ "\" a master: it is an icon for ",
+ Tk_PathName(wmPtr2->iconFor), NULL);
+ return TCL_ERROR;
+ }
+
+ if ((TkWindow *) master == winPtr) {
+ Tcl_AppendResult(interp, "can't make \"", Tk_PathName(winPtr),
+ "\" its own master", NULL);
+ return TCL_ERROR;
+ }
+
+ argv3 = Tcl_GetStringFromObj(objv[3], &length);
+ wmPtr->master = Tk_WindowId(master);
+ if (wmPtr->masterWindowName != NULL) {
+ ckfree(wmPtr->masterWindowName);
+ }
+ wmPtr->masterWindowName = ckalloc(length+1);
+ strcpy(wmPtr->masterWindowName, argv3);
+ }
+ ApplyMasterOverrideChanges(winPtr, NULL);
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmWithdrawCmd --
+ *
+ * This procedure is invoked to process the "wm withdraw" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmWithdrawCmd(
+ 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 withdraw ", Tcl_GetString(objv[2]),
+ ": it is an icon for ", Tk_PathName(wmPtr->iconFor), NULL);
+ return TCL_ERROR;
+ }
+ TkpWmSetState(winPtr, WithdrawnState);
+ return TCL_OK;
+}
+
+/*
+ * Invoked by those wm subcommands that affect geometry.
+ * Schedules a geometry update.
+ */
+
+static void
+WmUpdateGeom(
+ WmInfo *wmPtr,
+ TkWindow *winPtr)
+{
+ if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
+ wmPtr->flags |= WM_UPDATE_PENDING;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_SetGrid --
+ *
+ * This procedure is invoked by a widget when it wishes to set a grid
+ * coordinate system that controls the size of a top-level window. It
+ * provides a C interface equivalent to the "wm grid" command and is
+ * usually asscoiated with the -setgrid option.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Grid-related information will be passed to the window manager, so that
+ * the top-level window associated with tkwin will resize on even grid
+ * units. If some other window already controls gridding for the
+ * top-level window then this procedure call has no effect.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_SetGrid(
+ Tk_Window tkwin, /* Token for window. New window mgr info will
+ * be posted for the top-level window
+ * associated with this window. */
+ int reqWidth, /* Width (in grid units) corresponding to the
+ * requested geometry for tkwin. */
+ int reqHeight, /* Height (in grid units) corresponding to the
+ * requested geometry for tkwin. */
+ int widthInc, int heightInc)/* Pixel increments corresponding to a change
+ * of one grid unit. */
+{
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ WmInfo *wmPtr;
+
+ /*
+ * Ensure widthInc and heightInc are greater than 0
+ */
+
+ if (widthInc <= 0) {
+ widthInc = 1;
+ }
+ if (heightInc <= 0) {
+ heightInc = 1;
+ }
+
+ /*
+ * Find the top-level window for tkwin, plus the window manager
+ * information.
+ */
+
+ while (!(winPtr->flags & TK_TOP_LEVEL)) {
+ winPtr = winPtr->parentPtr;
+ }
+ wmPtr = winPtr->wmInfoPtr;
+
+ if ((wmPtr->gridWin != NULL) && (wmPtr->gridWin != tkwin)) {
+ return;
+ }
+
+ if ((wmPtr->reqGridWidth == reqWidth)
+ && (wmPtr->reqGridHeight == reqHeight)
+ && (wmPtr->widthInc == widthInc)
+ && (wmPtr->heightInc == heightInc)
+ && ((wmPtr->sizeHintsFlags & (PBaseSize|PResizeInc))
+ == (PBaseSize|PResizeInc))) {
+ return;
+ }
+
+ /*
+ * If gridding was previously off, then forget about any window size
+ * requests made by the user or via "wm geometry": these are in pixel
+ * units and there's no easy way to translate them to grid units since the
+ * new requested size of the top-level window in pixels may not yet have
+ * been registered yet (it may filter up the hierarchy in DoWhenIdle
+ * handlers). However, if the window has never been mapped yet then just
+ * leave the window size alone: assume that it is intended to be in grid
+ * units but just happened to have been specified before this procedure
+ * was called.
+ */
+
+ if ((wmPtr->gridWin == NULL) && !(wmPtr->flags & WM_NEVER_MAPPED)) {
+ wmPtr->width = -1;
+ wmPtr->height = -1;
+ }
+
+ /*
+ * Set the new gridding information, and start the process of passing all
+ * of this information to the window manager.
+ */
+
+ wmPtr->gridWin = tkwin;
+ wmPtr->reqGridWidth = reqWidth;
+ wmPtr->reqGridHeight = reqHeight;
+ wmPtr->widthInc = widthInc;
+ wmPtr->heightInc = heightInc;
+ wmPtr->sizeHintsFlags |= PBaseSize|PResizeInc;
+ wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
+ if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
+ wmPtr->flags |= WM_UPDATE_PENDING;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_UnsetGrid --
+ *
+ * This procedure cancels the effect of a previous call to Tk_SetGrid.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * If tkwin currently controls gridding for its top-level window,
+ * gridding is cancelled for that top-level window; if some other window
+ * controls gridding then this procedure has no effect.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_UnsetGrid(
+ Tk_Window tkwin) /* Token for window that is currently
+ * controlling gridding. */
+{
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ WmInfo *wmPtr;
+
+ /*
+ * Find the top-level window for tkwin, plus the window manager
+ * information.
+ */
+
+ while (!(winPtr->flags & TK_TOP_LEVEL)) {
+ winPtr = winPtr->parentPtr;
+ }
+ wmPtr = winPtr->wmInfoPtr;
+ if (tkwin != wmPtr->gridWin) {
+ return;
+ }
+
+ wmPtr->gridWin = NULL;
+ wmPtr->sizeHintsFlags &= ~(PBaseSize|PResizeInc);
+ if (wmPtr->width != -1) {
+ wmPtr->width = winPtr->reqWidth + (wmPtr->width
+ - wmPtr->reqGridWidth)*wmPtr->widthInc;
+ wmPtr->height = winPtr->reqHeight + (wmPtr->height
+ - wmPtr->reqGridHeight)*wmPtr->heightInc;
+ }
+ wmPtr->widthInc = 1;
+ wmPtr->heightInc = 1;
+
+ wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
+ if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
+ wmPtr->flags |= WM_UPDATE_PENDING;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TopLevelEventProc --
+ *
+ * This procedure is invoked when a top-level (or other externally-
+ * managed window) is restructured in any way.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Tk's internal data structures for the window get modified to reflect
+ * the structural change.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+TopLevelEventProc(
+ ClientData clientData, /* Window for which event occurred. */
+ XEvent *eventPtr) /* Event that just happened. */
+{
+ TkWindow *winPtr = clientData;
+
+ winPtr->wmInfoPtr->flags |= WM_VROOT_OFFSET_STALE;
+ if (eventPtr->type == DestroyNotify) {
+ if (!(winPtr->flags & TK_ALREADY_DEAD)) {
+ /*
+ * A top-level window was deleted externally (e.g., by the window
+ * manager). This is probably not a good thing, but cleanup as
+ * best we can. The error handler is needed because
+ * Tk_DestroyWindow will try to destroy the window, but of course
+ * it's already gone.
+ */
+
+ Tk_ErrorHandler handler = Tk_CreateErrorHandler(winPtr->display,
+ -1, -1, -1, NULL, NULL);
+
+ Tk_DestroyWindow((Tk_Window) winPtr);
+ Tk_DeleteErrorHandler(handler);
+ }
+ if (wmTracing) {
+ TkMacOSXDbgMsg("TopLevelEventProc: %s deleted", winPtr->pathName);
+ }
+ } else if (eventPtr->type == ReparentNotify) {
+ Tcl_Panic("recieved unwanted reparent event");
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TopLevelReqProc --
+ *
+ * This procedure is invoked by the geometry manager whenever the
+ * requested size for a top-level window is changed.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Arrange for the window to be resized to satisfy the request (this
+ * happens as a when-idle action).
+ *
+ *----------------------------------------------------------------------
+ */
+
+ /* ARGSUSED */
+static void
+TopLevelReqProc(
+ ClientData dummy, /* Not used. */
+ Tk_Window tkwin) /* Information about window. */
+{
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ WmInfo *wmPtr;
+
+ wmPtr = winPtr->wmInfoPtr;
+ wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
+ if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
+ wmPtr->flags |= WM_UPDATE_PENDING;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * UpdateGeometryInfo --
+ *
+ * This procedure is invoked when a top-level window is first mapped, and
+ * also as a when-idle procedure, to bring the geometry and/or position
+ * of a top-level window back into line with what has been requested by
+ * the user and/or widgets. This procedure doesn't return until the
+ * window manager has responded to the geometry change.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The window's size and location may change, unless the WM prevents that
+ * from happening.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+UpdateGeometryInfo(
+ ClientData clientData) /* Pointer to the window's record. */
+{
+ TkWindow *winPtr = clientData;
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ int x, y, width, height, min, max;
+
+ wmPtr->flags &= ~WM_UPDATE_PENDING;
+
+ if (wmPtr->flags & WM_FULLSCREEN) {
+ return;
+ }
+
+ /*
+ * Compute the new size for the top-level window. See the user
+ * documentation for details on this, but the size requested depends on
+ * (a) the size requested internally by the window's widgets, (b) the size
+ * requested by the user in a "wm geometry" command or via wm-based
+ * interactive resizing (if any), and (c) whether or not the window is
+ * gridded. Don't permit sizes <= 0 because this upsets the X server.
+ */
+
+ if (wmPtr->width == -1) {
+ width = winPtr->reqWidth;
+ } else if (wmPtr->gridWin != NULL) {
+ width = winPtr->reqWidth
+ + (wmPtr->width - wmPtr->reqGridWidth)*wmPtr->widthInc;
+ } else {
+ width = wmPtr->width;
+ }
+ if (width <= 0) {
+ width = 1;
+ }
+
+ /*
+ * Account for window max/min width
+ */
+
+ if (wmPtr->gridWin != NULL) {
+ min = winPtr->reqWidth
+ + (wmPtr->minWidth - wmPtr->reqGridWidth)*wmPtr->widthInc;
+ if (wmPtr->maxWidth > 0) {
+ max = winPtr->reqWidth
+ + (wmPtr->maxWidth - wmPtr->reqGridWidth)*wmPtr->widthInc;
+ } else {
+ max = 0;
+ }
+ } else {
+ min = wmPtr->minWidth;
+ max = wmPtr->maxWidth;
+ }
+ if (width < min) {
+ width = min;
+ } else if ((max > 0) && (width > max)) {
+ width = max;
+ }
+
+ if (wmPtr->height == -1) {
+ height = winPtr->reqHeight;
+ } else if (wmPtr->gridWin != NULL) {
+ height = winPtr->reqHeight
+ + (wmPtr->height - wmPtr->reqGridHeight)*wmPtr->heightInc;
+ } else {
+ height = wmPtr->height;
+ }
+ if (height <= 0) {
+ height = 1;
+ }
+
+ /*
+ * Account for window max/min height
+ */
+
+ if (wmPtr->gridWin != NULL) {
+ min = winPtr->reqHeight
+ + (wmPtr->minHeight - wmPtr->reqGridHeight)*wmPtr->heightInc;
+ if (wmPtr->maxHeight > 0) {
+ max = winPtr->reqHeight
+ + (wmPtr->maxHeight-wmPtr->reqGridHeight)*wmPtr->heightInc;
+ } else {
+ max = 0;
+ }
+ } else {
+ min = wmPtr->minHeight;
+ max = wmPtr->maxHeight;
+ }
+ if (height < min) {
+ height = min;
+ } else if ((max > 0) && (height > max)) {
+ height = max;
+ }
+
+ /*
+ * Compute the new position for the upper-left pixel of the window's
+ * decorative frame. This is tricky, because we need to include the border
+ * widths supplied by a reparented parent in this calculation, but can't
+ * use the parent's current overall size since that may change as a result
+ * of this code.
+ */
+
+ if (wmPtr->flags & WM_NEGATIVE_X) {
+ x = wmPtr->vRootWidth - wmPtr->x
+ - (width + (wmPtr->parentWidth - winPtr->changes.width));
+ } else {
+ x = wmPtr->x;
+ }
+ if (wmPtr->flags & WM_NEGATIVE_Y) {
+ y = wmPtr->vRootHeight - wmPtr->y
+ - (height + (wmPtr->parentHeight - winPtr->changes.height));
+ } else {
+ y = wmPtr->y;
+ }
+
+ /*
+ * If the window's size is going to change and the window is supposed to
+ * not be resizable by the user, then we have to update the size hints.
+ * There may also be a size-hint-update request pending from somewhere
+ * else, too.
+ */
+
+ if (((width != winPtr->changes.width)
+ || (height != winPtr->changes.height))
+ && (wmPtr->gridWin == NULL)
+ && ((wmPtr->sizeHintsFlags & (PMinSize|PMaxSize)) == 0)) {
+ wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
+ }
+ if (wmPtr->flags & WM_UPDATE_SIZE_HINTS) {
+ UpdateSizeHints(winPtr);
+ }
+
+ /*
+ * Reconfigure the window if it isn't already configured correctly. A few
+ * tricky points:
+ *
+ * 1. If the window is embedded and the container is also in this process,
+ * don't actually reconfigure the window; just pass the desired size on
+ * to the container. Also, zero out any position information, since
+ * embedded windows are not allowed to move.
+ * 2. Sometimes the window manager will give us a different size than we
+ * asked for (e.g. mwm has a minimum size for windows), so base the
+ * size check on what we *asked for* last time, not what we got.
+ * 3. Don't move window unless a new position has been requested for it.
+ * This is because of "features" in some window managers (e.g. twm, as
+ * of 4/24/91) where they don't interpret coordinates according to
+ * ICCCM. Moving a window to its current location may cause it to shift
+ * position on the screen.
+ */
+
+ if (Tk_IsEmbedded(winPtr)) {
+ TkWindow *contWinPtr = TkpGetOtherWindow(winPtr);
+
+ /*
+ * TODO: Here we should handle out of process embedding.
+ */
+
+ if (contWinPtr != NULL) {
+ /*
+ * This window is embedded and the container is also in this
+ * process, so we don't need to do anything special about the
+ * geometry, except to make sure that the desired size is known by
+ * the container. Also, zero out any position information, since
+ * embedded windows are not allowed to move.
+ */
+
+ wmPtr->x = wmPtr->y = 0;
+ wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y);
+ Tk_GeometryRequest((Tk_Window) contWinPtr, width, height);
+ }
+ return;
+ }
+ if (wmPtr->flags & WM_MOVE_PENDING) {
+ wmPtr->configWidth = width;
+ wmPtr->configHeight = height;
+ if (wmTracing) {
+ TkMacOSXDbgMsg("Moving to %d %d, resizing to %d x %d", x, y,
+ width, height);
+ }
+ wmPtr->flags |= WM_SYNC_PENDING;
+ XMoveResizeWindow(winPtr->display, winPtr->window, x, y,
+ (unsigned) width, (unsigned) height);
+ wmPtr->flags &= ~WM_SYNC_PENDING;
+ } else if ((width != wmPtr->configWidth)
+ || (height != wmPtr->configHeight)) {
+ wmPtr->configWidth = width;
+ wmPtr->configHeight = height;
+ if (wmTracing) {
+ TkMacOSXDbgMsg("Resizing to %d x %d\n", width, height);
+ }
+ wmPtr->flags |= WM_SYNC_PENDING;
+ XResizeWindow(winPtr->display, winPtr->window, (unsigned) width,
+ (unsigned) height);
+ wmPtr->flags &= ~WM_SYNC_PENDING;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * UpdateSizeHints --
+ *
+ * This procedure is called to update the window manager's size hints
+ * information from the information in a WmInfo structure.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Properties get changed for winPtr.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+UpdateSizeHints(
+ TkWindow *winPtr)
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ wmPtr->flags &= ~WM_UPDATE_SIZE_HINTS;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ParseGeometry --
+ *
+ * This procedure parses a geometry string and updates information used
+ * to control the geometry of a top-level window.
+ *
+ * Results:
+ * A standard Tcl return value, plus an error message in the interp's
+ * result if an error occurs.
+ *
+ * Side effects:
+ * The size and/or location of winPtr may change.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+ParseGeometry(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ char *string, /* String containing new geometry. Has the
+ * standard form "=wxh+x+y". */
+ TkWindow *winPtr) /* Pointer to top-level window whose geometry
+ * is to be changed. */
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ int x, y, width, height, flags;
+ char *end;
+ char *p = string;
+
+ /*
+ * The leading "=" is optional.
+ */
+
+ if (*p == '=') {
+ p++;
+ }
+
+ /*
+ * Parse the width and height, if they are present. Don't actually update
+ * any of the fields of wmPtr until we've successfully parsed the entire
+ * geometry string.
+ */
+
+ width = wmPtr->width;
+ height = wmPtr->height;
+ x = wmPtr->x;
+ y = wmPtr->y;
+ flags = wmPtr->flags;
+ if (isdigit(UCHAR(*p))) {
+ width = strtoul(p, &end, 10);
+ p = end;
+ if (*p != 'x') {
+ goto error;
+ }
+ p++;
+ if (!isdigit(UCHAR(*p))) {
+ goto error;
+ }
+ height = strtoul(p, &end, 10);
+ p = end;
+ }
+
+ /*
+ * Parse the X and Y coordinates, if they are present.
+ */
+
+ if (*p != '\0') {
+ flags &= ~(WM_NEGATIVE_X | WM_NEGATIVE_Y);
+ if (*p == '-') {
+ flags |= WM_NEGATIVE_X;
+ } else if (*p != '+') {
+ goto error;
+ }
+ p++;
+ if (!isdigit(UCHAR(*p)) && (*p != '-')) {
+ goto error;
+ }
+ x = strtol(p, &end, 10);
+ p = end;
+ if (*p == '-') {
+ flags |= WM_NEGATIVE_Y;
+ } else if (*p != '+') {
+ goto error;
+ }
+ p++;
+ if (!isdigit(UCHAR(*p)) && (*p != '-')) {
+ goto error;
+ }
+ y = strtol(p, &end, 10);
+ if (*end != '\0') {
+ goto error;
+ }
+
+ /*
+ * Assume that the geometry information came from the user, unless an
+ * explicit source has been specified. Otherwise most window managers
+ * assume that the size hints were program-specified and they ignore
+ * them.
+ */
+
+ if ((wmPtr->sizeHintsFlags & (USPosition|PPosition)) == 0) {
+ wmPtr->sizeHintsFlags |= USPosition;
+ flags |= WM_UPDATE_SIZE_HINTS;
+ }
+ }
+
+ /*
+ * Everything was parsed OK. Update the fields of *wmPtr and arrange for
+ * the appropriate information to be percolated out to the window manager
+ * at the next idle moment.
+ */
+
+ wmPtr->width = width;
+ wmPtr->height = height;
+ if ((x != wmPtr->x) || (y != wmPtr->y)
+ || ((flags & (WM_NEGATIVE_X|WM_NEGATIVE_Y))
+ != (wmPtr->flags & (WM_NEGATIVE_X|WM_NEGATIVE_Y)))) {
+ if (wmPtr->flags & WM_FULLSCREEN) {
+ wmPtr->configX = x;
+ wmPtr->configY = y;
+ } else {
+ wmPtr->x = x;
+ wmPtr->y = y;
+ }
+ flags |= WM_MOVE_PENDING;
+ }
+ wmPtr->flags = flags;
+
+ if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
+ Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
+ wmPtr->flags |= WM_UPDATE_PENDING;
+ }
+ return TCL_OK;
+
+ error:
+ Tcl_AppendResult(interp, "bad geometry specifier \"", string, "\"", NULL);
+ return TCL_ERROR;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_GetRootCoords --
+ *
+ * Given a token for a window, this procedure traces through the window's
+ * lineage to find the (virtual) root-window coordinates corresponding to
+ * point (0,0) in the window.
+ *
+ * Results:
+ * The locations pointed to by xPtr and yPtr are filled in with the root
+ * coordinates of the (0,0) point in tkwin. If a virtual root window is
+ * in effect for the window, then the coordinates in the virtual root are
+ * returned.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_GetRootCoords(
+ Tk_Window tkwin, /* Token for window. */
+ int *xPtr, /* Where to store x-displacement of (0,0). */
+ int *yPtr) /* Where to store y-displacement of (0,0). */
+{
+ int x, y;
+ TkWindow *winPtr = (TkWindow *) tkwin;
+
+ /*
+ * Search back through this window's parents all the way to a top-level
+ * window, combining the offsets of each window within its parent.
+ */
+
+ x = y = 0;
+ while (1) {
+ x += winPtr->changes.x + winPtr->changes.border_width;
+ y += winPtr->changes.y + winPtr->changes.border_width;
+ if (winPtr->flags & TK_TOP_LEVEL) {
+ TkWindow *otherPtr;
+
+ if (!(Tk_IsEmbedded(winPtr))) {
+ x += winPtr->wmInfoPtr->xInParent;
+ y += winPtr->wmInfoPtr->yInParent;
+ break;
+ }
+
+ otherPtr = TkpGetOtherWindow(winPtr);
+ if (otherPtr == NULL) {
+ if (tkMacOSXEmbedHandler->getOffsetProc != NULL) {
+ Point theOffset;
+
+ /*
+ * We do not require that the changes.x & changes.y for a
+ * non-Tk master window be kept up to date. So we first
+ * subtract off the possibly bogus values that have been
+ * added on at the top of this pass through the loop, and
+ * then call out to the getOffsetProc to give us the
+ * correct offset.
+ */
+
+ x -= winPtr->changes.x + winPtr->changes.border_width;
+ y -= winPtr->changes.y + winPtr->changes.border_width;
+
+ tkMacOSXEmbedHandler->getOffsetProc((Tk_Window) winPtr,
+ &theOffset);
+
+ x += theOffset.h;
+ y += theOffset.v;
+ }
+ break;
+ }
+
+ /*
+ * The container window is in the same application. Query its
+ * coordinates.
+ */
+
+ winPtr = otherPtr;
+
+ /*
+ * Remember to offset by the container window here, since at the
+ * end of this if branch, we will pop out to the container's
+ * parent...
+ */
+
+ x += winPtr->changes.x + winPtr->changes.border_width;
+ y += winPtr->changes.y + winPtr->changes.border_width;
+ }
+ winPtr = winPtr->parentPtr;
+ }
+ *xPtr = x;
+ *yPtr = y;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_CoordsToWindow --
+ *
+ * This is a Macintosh specific implementation of this function. Given
+ * the root coordinates of a point, this procedure returns the token for
+ * the top-most window covering that point, if there exists such a window
+ * in this application.
+ *
+ * Results:
+ * The return result is either a token for the window corresponding to
+ * rootX and rootY, or else NULL to indicate that there is no such
+ * window.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Tk_Window
+Tk_CoordsToWindow(
+ int rootX, int rootY, /* Coordinates of point in root window. If a
+ * virtual-root window manager is in use,
+ * these coordinates refer to the virtual
+ * root, not the real root. */
+ Tk_Window tkwin) /* Token for any window in application; used
+ * to identify the display. */
+{
+ WindowPtr whichWin;
+ Point where;
+ Window rootChild;
+ TkWindow *winPtr, *childPtr;
+ TkWindow *nextPtr; /* Coordinates of highest child found so far
+ * that contains point. */
+ int x, y; /* Coordinates in winPtr. */
+ int tmpx, tmpy, bd;
+ TkDisplay *dispPtr;
+
+ /*
+ * Step 1: find the top-level window that contains the desired point.
+ */
+
+ where.h = rootX;
+ where.v = rootY;
+ FindWindow(where, &whichWin);
+ if (whichWin == NULL) {
+ return NULL;
+ }
+ rootChild = TkMacOSXGetXWindow(whichWin);
+ dispPtr = TkGetDisplayList();
+ winPtr = (TkWindow *) Tk_IdToWindow(dispPtr->display, rootChild);
+ if (winPtr == NULL) {
+ return NULL;
+ }
+
+ /*
+ * Step 2: work down through the hierarchy underneath this window. At each
+ * level, scan through all the children to find the highest one in the
+ * stacking order that contains the point. Then repeat the whole process
+ * on that child.
+ */
+
+ x = rootX - winPtr->wmInfoPtr->xInParent;
+ y = rootY - winPtr->wmInfoPtr->yInParent;
+ while (1) {
+ x -= winPtr->changes.x;
+ y -= winPtr->changes.y;
+ nextPtr = NULL;
+
+ /*
+ * Container windows cannot have children. So if it is a container,
+ * look there, otherwise inspect the children.
+ */
+
+ if (Tk_IsContainer(winPtr)) {
+ childPtr = TkpGetOtherWindow(winPtr);
+ if (childPtr != NULL) {
+ if (Tk_IsMapped(childPtr)) {
+ tmpx = x - childPtr->changes.x;
+ tmpy = y - childPtr->changes.y;
+ bd = childPtr->changes.border_width;
+
+ if ((tmpx >= -bd) && (tmpy >= -bd)
+ && (tmpx < (childPtr->changes.width + bd))
+ && (tmpy < (childPtr->changes.height + bd))) {
+ nextPtr = childPtr;
+ }
+ }
+ }
+
+ /*
+ * TODO: Here we should handle out of process embedding.
+ */
+ } else {
+ for (childPtr = winPtr->childList; childPtr != NULL;
+ childPtr = childPtr->nextPtr) {
+ if (!Tk_IsMapped(childPtr) ||
+ (childPtr->flags & TK_TOP_LEVEL)) {
+ continue;
+ }
+ tmpx = x - childPtr->changes.x;
+ tmpy = y - childPtr->changes.y;
+ bd = childPtr->changes.border_width;
+ if ((tmpx >= -bd) && (tmpy >= -bd)
+ && (tmpx < (childPtr->changes.width + bd))
+ && (tmpy < (childPtr->changes.height + bd))) {
+ nextPtr = childPtr;
+ }
+ }
+ }
+ if (nextPtr == NULL) {
+ break;
+ }
+ winPtr = nextPtr;
+ }
+ return (Tk_Window) winPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_TopCoordsToWindow --
+ *
+ * Given a Tk Window, and coordinates of a point relative to that window
+ * this procedure returns the top-most child of the window (excluding
+ * toplevels) covering that point, if there exists such a window in this
+ * application. It also sets newX, and newY to the coords of the point
+ * relative to the window returned.
+ *
+ * Results:
+ * The return result is either a token for the window corresponding to
+ * rootX and rootY, or else NULL to indicate that there is no such
+ * window. newX and newY are also set to the coords of the point relative
+ * to the returned window.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Tk_Window
+Tk_TopCoordsToWindow(
+ Tk_Window tkwin, /* Token for a Tk Window which defines the
+ * coordinates for rootX & rootY */
+ int rootX, int rootY, /* Coordinates of a point in tkWin. */
+ int *newX, int *newY) /* Coordinates of point in the upperMost child
+ * of tkWin containing (rootX,rootY) */
+{
+ TkWindow *winPtr, *childPtr;
+ TkWindow *nextPtr; /* Coordinates of highest child found so far
+ * that contains point. */
+ int x, y; /* Coordinates in winPtr. */
+ Window *children; /* Children of winPtr, or NULL. */
+
+ winPtr = (TkWindow *) tkwin;
+ x = rootX;
+ y = rootY;
+ while (1) {
+ nextPtr = NULL;
+ children = NULL;
+
+ /*
+ * Container windows cannot have children. So if it is a container,
+ * look there, otherwise inspect the children.
+ */
+
+ if (Tk_IsContainer(winPtr)) {
+ childPtr = TkpGetOtherWindow(winPtr);
+ if (childPtr != NULL) {
+ if (Tk_IsMapped(childPtr) &&
+ x > childPtr->changes.x &&
+ x < childPtr->changes.x + childPtr->changes.width &&
+ y > childPtr->changes.y &&
+ y < childPtr->changes.y + childPtr->changes.height) {
+ nextPtr = childPtr;
+ }
+ }
+
+ /*
+ * TODO: Here we should handle out of process embedding.
+ */
+ } else {
+ for (childPtr = winPtr->childList; childPtr != NULL;
+ childPtr = childPtr->nextPtr) {
+ if (!Tk_IsMapped(childPtr) ||
+ (childPtr->flags & TK_TOP_LEVEL)) {
+ continue;
+ }
+ if (x < childPtr->changes.x || y < childPtr->changes.y) {
+ continue;
+ }
+ if (x > childPtr->changes.x + childPtr->changes.width ||
+ y > childPtr->changes.y + childPtr->changes.height) {
+ continue;
+ }
+ nextPtr = childPtr;
+ }
+ }
+ if (nextPtr == NULL) {
+ break;
+ }
+ winPtr = nextPtr;
+ x -= winPtr->changes.x;
+ y -= winPtr->changes.y;
+ }
+ *newX = x;
+ *newY = y;
+ return (Tk_Window) winPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * UpdateVRootGeometry --
+ *
+ * This procedure is called to update all the virtual root geometry
+ * information in wmPtr.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The vRootX, vRootY, vRootWidth, and vRootHeight fields in wmPtr are
+ * filled with the most up-to-date information.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+UpdateVRootGeometry(
+ WmInfo *wmPtr) /* Window manager information to be updated.
+ * The wmPtr->vRoot field must be valid. */
+{
+ TkWindow *winPtr = wmPtr->winPtr;
+ unsigned int bd, dummy;
+ Window dummy2;
+ Status status;
+ Tk_ErrorHandler handler;
+
+ /*
+ * If this isn't a virtual-root window manager, just return information
+ * about the screen.
+ */
+
+ wmPtr->flags &= ~WM_VROOT_OFFSET_STALE;
+ if (wmPtr->vRoot == None) {
+ noVRoot:
+ wmPtr->vRootX = wmPtr->vRootY = 0;
+ wmPtr->vRootWidth = DisplayWidth(winPtr->display, winPtr->screenNum);
+ wmPtr->vRootHeight = DisplayHeight(winPtr->display, winPtr->screenNum);
+ return;
+ }
+
+ /*
+ * Refresh the virtual root information if it's out of date.
+ */
+
+ handler = Tk_CreateErrorHandler(winPtr->display, -1, -1, -1, NULL, NULL);
+ status = XGetGeometry(winPtr->display, wmPtr->vRoot,
+ &dummy2, &wmPtr->vRootX, &wmPtr->vRootY,
+ &wmPtr->vRootWidth, &wmPtr->vRootHeight, &bd, &dummy);
+ if (wmTracing) {
+ TkMacOSXDbgMsg("x = %d, y = %d, width = %d, height = %d, status = %d",
+ wmPtr->vRootX, wmPtr->vRootY, wmPtr->vRootWidth,
+ wmPtr->vRootHeight, status);
+ }
+ Tk_DeleteErrorHandler(handler);
+ if (status == 0) {
+ /*
+ * The virtual root is gone! Pretend that it never existed.
+ */
+
+ wmPtr->vRoot = None;
+ goto noVRoot;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_GetVRootGeometry --
+ *
+ * This procedure returns information about the virtual root window
+ * corresponding to a particular Tk window.
+ *
+ * Results:
+ * The values at xPtr, yPtr, widthPtr, and heightPtr are set with the
+ * offset and dimensions of the root window corresponding to tkwin. If
+ * tkwin is being managed by a virtual root window manager these values
+ * correspond to the virtual root window being used for tkwin; otherwise
+ * the offsets will be 0 and the dimensions will be those of the screen.
+ *
+ * Side effects:
+ * Vroot window information is refreshed if it is out of date.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_GetVRootGeometry(
+ Tk_Window tkwin, /* Window whose virtual root is to be
+ * queried. */
+ int *xPtr, int *yPtr, /* Store x and y offsets of virtual root
+ * here. */
+ int *widthPtr, /* Store dimensions of virtual root here. */
+ int *heightPtr)
+{
+ WmInfo *wmPtr;
+ TkWindow *winPtr = (TkWindow *) tkwin;
+
+ /*
+ * Find the top-level window for tkwin, and locate the window manager
+ * information for that window.
+ */
+
+ while (!(winPtr->flags & TK_TOP_LEVEL)) {
+ winPtr = winPtr->parentPtr;
+ }
+ wmPtr = winPtr->wmInfoPtr;
+
+ /*
+ * Make sure that the geometry information is up-to-date, then copy it out
+ * to the caller.
+ */
+
+ if (wmPtr->flags & WM_VROOT_OFFSET_STALE) {
+ UpdateVRootGeometry(wmPtr);
+ }
+ *xPtr = wmPtr->vRootX;
+ *yPtr = wmPtr->vRootY;
+ *widthPtr = wmPtr->vRootWidth;
+ *heightPtr = wmPtr->vRootHeight;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_MoveToplevelWindow --
+ *
+ * This procedure is called instead of Tk_MoveWindow to adjust the x-y
+ * location of a top-level window. It delays the actual move to a later
+ * time and keeps window-manager information up-to-date with the move.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The window is eventually moved so that its upper-left corner
+ * (actually, the upper-left corner of the window's decorative frame, if
+ * there is one) is at (x,y).
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_MoveToplevelWindow(
+ Tk_Window tkwin, /* Window to move. */
+ int x, int y) /* New location for window (within parent). */
+{
+ TkWindow *winPtr = (TkWindow *) tkwin;
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ if (!(winPtr->flags & TK_TOP_LEVEL)) {
+ Tcl_Panic("Tk_MoveToplevelWindow called with non-toplevel window");
+ }
+ wmPtr->x = x;
+ wmPtr->y = y;
+ wmPtr->flags |= WM_MOVE_PENDING;
+ wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y);
+ if ((wmPtr->sizeHintsFlags & (USPosition|PPosition)) == 0) {
+ wmPtr->sizeHintsFlags |= USPosition;
+ wmPtr->flags |= WM_UPDATE_SIZE_HINTS;
+ }
+
+ /*
+ * If the window has already been mapped, must bring its geometry
+ * up-to-date immediately, otherwise an event might arrive from the server
+ * that would overwrite wmPtr->x and wmPtr->y and lose the new position.
+ */
+
+ if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
+ if (wmPtr->flags & WM_UPDATE_PENDING) {
+ Tk_CancelIdleCall(UpdateGeometryInfo, winPtr);
+ }
+ UpdateGeometryInfo(winPtr);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkWmRestackToplevel --
+ *
+ * This procedure restacks a top-level window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * WinPtr gets restacked as specified by aboveBelow and otherPtr. This
+ * procedure doesn't return until the restack has taken effect and the
+ * ConfigureNotify event for it has been received.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkWmRestackToplevel(
+ TkWindow *winPtr, /* Window to restack. */
+ int aboveBelow, /* Gives relative position for restacking;
+ * must be Above or Below. */
+ TkWindow *otherPtr) /* Window relative to which to restack; if
+ * NULL, then winPtr gets restacked above or
+ * below *all* siblings. */
+{
+ WmInfo *wmPtr;
+
+ WindowRef macWindow, otherMacWindow, frontWindow, tmpWindow;
+
+ wmPtr = winPtr->wmInfoPtr;
+
+ /*
+ * Get the mac window. Make sure it exists & is mapped.
+ */
+
+ if (winPtr->window == None) {
+ Tk_MakeWindowExist((Tk_Window) winPtr);
+ }
+ if (winPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
+ /*
+ * Can't set stacking order properly until the window is on the screen
+ * (mapping it may give it a reparent window), so make sure it's on
+ * the screen.
+ */
+
+ TkWmMapWindow(winPtr);
+ }
+ macWindow = TkMacOSXDrawableWindow(winPtr->window);
+
+ /*
+ * Get the window in which a raise or lower is in relation to.
+ */
+
+ if (otherPtr != NULL) {
+ if (otherPtr->window == None) {
+ Tk_MakeWindowExist((Tk_Window) otherPtr);
+ }
+ if (otherPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) {
+ TkWmMapWindow(otherPtr);
+ }
+ otherMacWindow = TkMacOSXDrawableWindow(otherPtr->window);
+ } else {
+ otherMacWindow = NULL;
+ }
+
+ frontWindow = ActiveNonFloatingWindow();
+
+ if (aboveBelow == Above) {
+ if (macWindow == frontWindow) {
+ /*
+ * Do nothing - it's already at the top.
+ */
+ } else if (otherMacWindow == frontWindow || otherMacWindow == NULL) {
+ /*
+ * Raise the window to the top. If the window is visible then we
+ * also make it the active window.
+ */
+
+ if (wmPtr->hints.initial_state == WithdrawnState) {
+ BringToFront(macWindow);
+ } else {
+ SelectWindow(macWindow);
+ }
+ } else {
+ /*
+ * Find the window to be above. (Front window will actually be the
+ * window to be behind.) Front window is NULL if no other windows.
+ */
+
+ while (frontWindow != NULL &&
+ (tmpWindow=GetNextWindow(frontWindow)) != otherMacWindow) {
+ frontWindow = tmpWindow;
+ }
+ if (frontWindow != NULL) {
+ SendBehind(macWindow, frontWindow);
+ }
+ }
+ } else {
+ /*
+ * Send behind. If it was in front find another window to make active.
+ */
+
+ if (macWindow == frontWindow) {
+ tmpWindow = GetNextWindow(macWindow);
+ if (tmpWindow != NULL) {
+ SelectWindow(tmpWindow);
+ }
+ }
+ SendBehind(macWindow, otherMacWindow);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkWmAddToColormapWindows --
+ *
+ * This procedure is called to add a given window to the
+ * WM_COLORMAP_WINDOWS property for its top-level, if it isn't already
+ * there. It is invoked by the Tk code that creates a new colormap, in
+ * order to make sure that colormap information is propagated to the
+ * window manager by default.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * WinPtr's window gets added to the WM_COLORMAP_WINDOWS property of its
+ * nearest top-level ancestor, unless the colormaps have been set
+ * explicitly with the "wm colormapwindows" command.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkWmAddToColormapWindows(
+ TkWindow *winPtr) /* Window with a non-default colormap. Should
+ * not be a top-level window. */
+{
+ TkWindow *topPtr;
+ TkWindow **oldPtr, **newPtr;
+ int count, i;
+
+ if (winPtr->window == None) {
+ return;
+ }
+
+ for (topPtr = winPtr->parentPtr; ; topPtr = topPtr->parentPtr) {
+ if (topPtr == NULL) {
+ /*
+ * Window is being deleted. Skip the whole operation.
+ */
+
+ return;
+ }
+ if (topPtr->flags & TK_TOP_LEVEL) {
+ break;
+ }
+ }
+ if (topPtr->wmInfoPtr->flags & WM_COLORMAPS_EXPLICIT) {
+ return;
+ }
+
+ /*
+ * Make sure that the window isn't already in the list.
+ */
+
+ count = topPtr->wmInfoPtr->cmapCount;
+ oldPtr = topPtr->wmInfoPtr->cmapList;
+
+ for (i = 0; i < count; i++) {
+ if (oldPtr[i] == winPtr) {
+ return;
+ }
+ }
+
+ /*
+ * Make a new bigger array and use it to reset the property. Automatically
+ * add the toplevel itself as the last element of the list.
+ */
+
+ newPtr = ckalloc((count+2) * sizeof(TkWindow *));
+ if (count > 0) {
+ memcpy(newPtr, oldPtr, count * sizeof(TkWindow *));
+ }
+ if (count == 0) {
+ count++;
+ }
+ newPtr[count-1] = winPtr;
+ newPtr[count] = topPtr;
+ if (oldPtr != NULL) {
+ ckfree(oldPtr);
+ }
+
+ topPtr->wmInfoPtr->cmapList = newPtr;
+ topPtr->wmInfoPtr->cmapCount = count+1;
+
+ /*
+ * On the Macintosh all of this is just an excercise in compatability as
+ * we don't support colormaps. If we did they would be installed here.
+ */
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkWmRemoveFromColormapWindows --
+ *
+ * This procedure is called to remove a given window from the
+ * WM_COLORMAP_WINDOWS property for its top-level. It is invoked when
+ * windows are deleted.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * WinPtr's window gets removed from the WM_COLORMAP_WINDOWS property of
+ * its nearest top-level ancestor, unless the top-level itself is being
+ * deleted too.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkWmRemoveFromColormapWindows(
+ TkWindow *winPtr) /* Window that may be present in
+ * WM_COLORMAP_WINDOWS property for its
+ * top-level. Should not be a top-level
+ * window. */
+{
+ TkWindow *topPtr, **oldPtr;
+ int count, i, j;
+
+ for (topPtr = winPtr->parentPtr; ; topPtr = topPtr->parentPtr) {
+ if (topPtr == NULL) {
+ /*
+ * Ancestors have been deleted, so skip the whole operation. Seems
+ * like this can't ever happen?
+ */
+
+ return;
+ }
+ if (topPtr->flags & TK_TOP_LEVEL) {
+ break;
+ }
+ }
+ if (topPtr->flags & TK_ALREADY_DEAD) {
+ /*
+ * Top-level is being deleted, so there's no need to cleanup the
+ * WM_COLORMAP_WINDOWS property.
+ */
+
+ return;
+ }
+
+ /*
+ * Find the window and slide the following ones down to cover it up.
+ */
+
+ count = topPtr->wmInfoPtr->cmapCount;
+ oldPtr = topPtr->wmInfoPtr->cmapList;
+ for (i = 0; i < count; i++) {
+ if (oldPtr[i] == winPtr) {
+ for (j = i ; j < count-1; j++) {
+ oldPtr[j] = oldPtr[j+1];
+ }
+ topPtr->wmInfoPtr->cmapCount = count - 1;
+ break;
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkGetPointerCoords --
+ *
+ * Fetch the position of the mouse pointer.
+ *
+ * Results:
+ * *xPtr and *yPtr are filled in with the (virtual) root coordinates of
+ * the mouse pointer for tkwin's display. If the pointer isn't on tkwin's
+ * screen, then -1 values are returned for both coordinates. The argument
+ * tkwin must be a toplevel window.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkGetPointerCoords(
+ Tk_Window tkwin, /* Toplevel window that identifies screen on
+ * which lookup is to be done. */
+ int *xPtr, int *yPtr) /* Store pointer coordinates here. */
+{
+ XQueryPointer(NULL, None, NULL, NULL, xPtr, yPtr, NULL, NULL, NULL);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * InitialWindowBounds --
+ *
+ * This function calculates the initial bounds for a new Mac toplevel
+ * window. Unless the geometry is specified by the user this code will
+ * auto place the windows in a cascade diagonially across the main
+ * monitor of the Mac.
+ *
+ * Results:
+ * The bounds are returned in geometry.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+InitialWindowBounds(
+ TkWindow *winPtr, /* Window to get initial bounds for. */
+ WindowRef macWindow,
+ Rect *geometry) /* On return the initial bounds. */
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ if (!(wmPtr->sizeHintsFlags & (USPosition | PPosition))) {
+ WindowRef parent;
+
+ parent = GetFrontWindowOfClass(wmPtr->macClass, false);
+ if (parent && parent == macWindow) {
+ parent = GetNextWindowOfClass(parent, wmPtr->macClass, false);
+ }
+ if (parent && parent != macWindow) {
+ Rect bounds;
+
+ ChkErr(RepositionWindow, macWindow, parent,
+ kWindowCascadeOnParentWindowScreen);
+ ChkErr(GetWindowBounds, macWindow, kWindowStructureRgn, &bounds);
+ wmPtr->x = bounds.left;
+ wmPtr->y = bounds.top;
+ } else {
+ static SInt16 menuBarHeight = 0;
+
+ if (!menuBarHeight) {
+ ChkErr(GetThemeMenuBarHeight, &menuBarHeight);
+ }
+ wmPtr->x = 5;
+ wmPtr->y = menuBarHeight + 5;
+ }
+ }
+
+ geometry->left = wmPtr->x;
+ geometry->top = wmPtr->y;
+ geometry->right = wmPtr->x + winPtr->changes.width;
+ geometry->bottom = wmPtr->y + winPtr->changes.height;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXResizable --
+ *
+ * This function determines if the passed in window is part of a toplevel
+ * window that is resizable. If the window is resizable in the x, y or
+ * both directions, true is returned.
+ *
+ * Results:
+ * True if resizable, false otherwise.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkMacOSXResizable(
+ TkWindow *winPtr) /* Tk window or NULL. */
+{
+ WmInfo *wmPtr;
+
+ if (winPtr == NULL) {
+ return false;
+ }
+ while (winPtr->wmInfoPtr == NULL) {
+ winPtr = winPtr->parentPtr;
+ }
+
+ wmPtr = winPtr->wmInfoPtr;
+ if ((wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) &&
+ (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE)) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGrowToplevel --
+ *
+ * The function is invoked when the user clicks in the grow region of a
+ * Tk window. The function will handle the dragging procedure and not
+ * return until completed. Finally, the function may place information
+ * Tk's event queue is the window was resized.
+ *
+ * Results:
+ * True if events were placed on event queue, false otherwise.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkMacOSXGrowToplevel(
+ void *whichWindow,
+ XPoint s)
+{
+ Point start = {s.y, s.x};
+ Point where = start;
+ TkDisplay *dispPtr;
+ Rect portRect;
+ CGrafPtr destPort = GetWindowPort(whichWindow);
+
+ QDGlobalToLocalPoint(destPort, &where);
+ GetPortBounds(destPort, &portRect);
+ if (where.h > (portRect.right - 16) &&
+ where.v > (portRect.bottom - 16)) {
+ Window window;
+ TkWindow *winPtr;
+ WmInfo *wmPtr;
+ int minWidth, minHeight, maxWidth, maxHeight;
+ Rect limits, bounds, *maxBounds;
+ Boolean resizeResult;
+
+ window = TkMacOSXGetXWindow(whichWindow);
+ dispPtr = TkGetDisplayList();
+ winPtr = (TkWindow *) Tk_IdToWindow(dispPtr->display, window);
+ wmPtr = winPtr->wmInfoPtr;
+ maxBounds = (Rect*)(dispPtr->display->screens->ext_data);
+
+ if ((wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) &&
+ (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE)) {
+ return false;
+ }
+ GetMinSize(winPtr, &minWidth, &minHeight);
+ GetMaxSize(winPtr, &maxWidth, &maxHeight);
+ if (wmPtr->gridWin != NULL) {
+ int base = winPtr->reqWidth - (wmPtr->reqGridWidth
+ * wmPtr->widthInc);
+
+ if (base < 0) {
+ base = 0;
+ }
+ limits.left = base + (minWidth * wmPtr->widthInc);
+ limits.right = base + (maxWidth * wmPtr->widthInc);
+ base = winPtr->reqHeight - (wmPtr->reqGridHeight
+ * wmPtr->heightInc);
+ if (base < 0) {
+ base = 0;
+ }
+ limits.top = base + (minHeight * wmPtr->heightInc);
+ limits.bottom = base + (maxHeight * wmPtr->heightInc);
+ } else {
+ limits.left = minWidth;
+ limits.right = maxWidth;
+ limits.top = minHeight;
+ limits.bottom = maxHeight;
+ }
+ if (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) {
+ limits.left = limits.right = winPtr->changes.width;
+ }
+ if (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) {
+ limits.top = limits.bottom = winPtr->changes.height;
+ }
+ if (PtInRect(start, maxBounds)) {
+ Rect strBounds, strWidths, limitBounds;
+
+ ChkErr(GetWindowBounds, whichWindow, kWindowStructureRgn,
+ &strBounds);
+ ChkErr(GetWindowStructureWidths, whichWindow, &strWidths);
+
+ limitBounds.left = limits.left + (strBounds.left + strWidths.left);
+ limitBounds.right = limits.right +
+ (strBounds.left + strWidths.left + strWidths.right);
+ limitBounds.top = limits.top + (strBounds.top + strWidths.top);
+ limitBounds.bottom = limits.bottom +
+ (strBounds.top + strWidths.top + strWidths.bottom);
+ if (limitBounds.left < maxBounds->left) {
+ limitBounds.left = maxBounds->left;
+ }
+ if (limitBounds.right > maxBounds->right) {
+ limitBounds.right = maxBounds->right;
+ }
+ if (limitBounds.top < maxBounds->top) {
+ limitBounds.top = maxBounds->top;
+ }
+ if (limitBounds.bottom > maxBounds->bottom) {
+ limitBounds.bottom = maxBounds->bottom;
+ }
+ limits.left = limitBounds.left - (strBounds.left + strWidths.left);
+ limits.right = limitBounds.right -
+ (strBounds.left + strWidths.left + strWidths.right);
+ limits.top = limitBounds.top - (strBounds.top + strWidths.top);
+ limits.bottom = limitBounds.bottom -
+ (strBounds.top + strWidths.top + strWidths.bottom);
+ }
+ TkMacOSXTrackingLoop(1);
+ resizeResult = ResizeWindow(whichWindow, start, &limits, &bounds);
+ TkMacOSXTrackingLoop(0);
+ if (resizeResult) {
+ return true;
+ }
+ }
+ return false;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkSetWMName --
+ *
+ * Set the title for a toplevel window. If the window is embedded, do not
+ * change the window title.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * The title of the window is changed.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkSetWMName(
+ TkWindow *winPtr,
+ Tk_Uid titleUid)
+{
+ CFStringRef title;
+
+ if (Tk_IsEmbedded(winPtr)) {
+ return;
+ }
+
+ title = CFStringCreateWithBytes(NULL, (const unsigned char *) titleUid,
+ strlen(titleUid), kCFStringEncodingUTF8, false);
+ if (title) {
+ WindowRef macWin = TkMacOSXDrawableWindow(winPtr->window);
+
+ SetWindowTitleWithCFString(macWin, title);
+ CFRelease(title);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkGetTransientMaster --
+ *
+ * If the passed window has the TRANSIENT_FOR property set this will
+ * return the master window. Otherwise it will return None.
+ *
+ * Results:
+ * The master window or None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Window
+TkGetTransientMaster(
+ TkWindow *winPtr)
+{
+ if (winPtr->wmInfoPtr != NULL) {
+ return winPtr->wmInfoPtr->master;
+ }
+ return None;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXGetXWindow --
+ *
+ * Returns the X window Id associated with the given WindowRef.
+ *
+ * Results:
+ * The window id is returned. None is returned if not a Tk window.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+Window
+TkMacOSXGetXWindow(
+ void *macWinPtr)
+{
+ Tcl_HashEntry *hPtr;
+
+ if ((macWinPtr == NULL) || !windowHashInit) {
+ return None;
+ }
+ hPtr = Tcl_FindHashEntry(&windowTable, (char *) macWinPtr);
+ if (hPtr == NULL) {
+ return None;
+ }
+ 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.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE int
+TkMacOSXIsWindowZoomed(
+ TkWindow *winPtr)
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ int maxWidth, maxHeight;
+ Point idealSize;
+
+ if ((wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) &&
+ (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE)) {
+ return false;
+ }
+ GetMaxSize(winPtr, &maxWidth, &maxHeight);
+ if (wmPtr->gridWin != NULL) {
+ int base = winPtr->reqWidth - (wmPtr->reqGridWidth * wmPtr->widthInc);
+
+ if (base < 0) {
+ base = 0;
+ }
+ maxWidth = base + (maxWidth * wmPtr->widthInc);
+ base = winPtr->reqHeight - (wmPtr->reqGridHeight * wmPtr->heightInc);
+ if (base < 0) {
+ base = 0;
+ }
+ maxHeight = base + (maxHeight * wmPtr->heightInc);
+ }
+ if (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) {
+ idealSize.h = winPtr->changes.width;
+ } else {
+ idealSize.h = maxWidth;
+ }
+ if (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) {
+ idealSize.v = winPtr->changes.height;
+ } else {
+ idealSize.v = maxHeight;
+ }
+
+ return IsWindowInStandardState(TkMacOSXDrawableWindow(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(
+ void *whichWindow, /* The Macintosh window to zoom. */
+ short zoomPart) /* Either inZoomIn or inZoomOut */
+{
+ Window window;
+ TkDisplay *dispPtr;
+ TkWindow *winPtr;
+ WmInfo *wmPtr;
+ Point idealSize;
+ int maxWidth, maxHeight;
+ OSStatus err;
+
+ 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;
+ }
+ GetMaxSize(winPtr, &maxWidth, &maxHeight);
+ if (wmPtr->gridWin != NULL) {
+ int base = winPtr->reqWidth - (wmPtr->reqGridWidth * wmPtr->widthInc);
+
+ if (base < 0) {
+ base = 0;
+ }
+ maxWidth = base + (maxWidth * wmPtr->widthInc);
+ base = winPtr->reqHeight - (wmPtr->reqGridHeight * wmPtr->heightInc);
+ if (base < 0) {
+ base = 0;
+ }
+ maxHeight = base + (maxHeight * wmPtr->heightInc);
+ }
+ if (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) {
+ idealSize.h = winPtr->changes.width;
+ } else {
+ idealSize.h = maxWidth;
+ }
+ if (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) {
+ idealSize.v = winPtr->changes.height;
+ } else {
+ idealSize.v = maxHeight;
+ }
+
+ /*
+ * Do nothing if already in desired zoom state.
+ */
+
+ if (!IsWindowInStandardState(whichWindow, &idealSize, NULL) ==
+ (zoomPart == inZoomIn)) {
+ return false;
+ }
+
+ err = ChkErr(ZoomWindowIdeal, whichWindow, zoomPart, &idealSize);
+ if (err != noErr) {
+ return false;
+ }
+ wmPtr->hints.initial_state =
+ (zoomPart == inZoomIn ? NormalState : ZoomState);
+ return true;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkUnsupported1Cmd --
+ *
+ * This procedure is invoked to process the
+ * "::tk::unsupported::MacWindowStyle" Tcl command. This command allows
+ * you to set the style of decoration for a Macintosh window.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * Changes the style of a new Mac window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+/* ARGSUSED */
+int
+TkUnsupported1ObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *const objv[]) /* Argument objects. */
+{
+ static const char *const subcmds[] = {
+ "style", NULL
+ };
+ enum SubCmds {
+ TKMWS_STYLE
+ };
+ Tk_Window tkwin = clientData;
+ TkWindow *winPtr;
+ int index;
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?");
+ return TCL_ERROR;
+ }
+
+ winPtr = (TkWindow *)
+ Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin);
+ if (winPtr == NULL) {
+ return TCL_ERROR;
+ }
+ if (!(winPtr->flags & TK_TOP_LEVEL)) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "window \"", winPtr->pathName,
+ "\" isn't a top-level window", NULL);
+ return TCL_ERROR;
+ }
+
+ if (Tcl_GetIndexFromObj(interp, objv[1], subcmds, "option", 0,
+ &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ if (((enum SubCmds) index) == TKMWS_STYLE) {
+ if ((objc < 3) || (objc > 5)) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?class attributes?");
+ return TCL_ERROR;
+ }
+ return WmWinStyle(interp, winPtr, objc, objv);
+ }
+ /* won't be reached */
+ return TCL_ERROR;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmWinStyle --
+ *
+ * This procedure is invoked to process the
+ * "::tk::unsupported::MacWindowStyle style" subcommand. This command
+ * allows you to set the style of decoration for a Macintosh window.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * Changes the style of a new Mac window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+WmWinStyle(
+ Tcl_Interp *interp, /* Current interpreter. */
+ TkWindow *winPtr, /* Window to be manipulated. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj * const objv[]) /* Argument objects. */
+{
+ struct StrIntMap {
+ const char *strValue;
+ UInt32 intValue;
+ };
+ static const struct StrIntMap styleMap[] = {
+ { "documentProc", documentProc },
+ { "noGrowDocProc", documentProc },
+ { "dBoxProc", dBoxProc },
+ { "plainDBox", plainDBox },
+ { "altDBoxProc", altDBoxProc },
+ { "movableDBoxProc", movableDBoxProc },
+ { "zoomDocProc", zoomDocProc },
+ { "zoomNoGrow", zoomNoGrow },
+ { "floatProc", floatGrowProc },
+ { "floatGrowProc", floatGrowProc },
+ { "floatZoomProc", floatZoomGrowProc },
+ { "floatZoomGrowProc", floatZoomGrowProc },
+ { "floatSideProc", floatSideGrowProc },
+ { "floatSideGrowProc", floatSideGrowProc },
+ { "floatSideZoomProc", floatSideZoomGrowProc },
+ { "floatSideZoomGrowProc", floatSideZoomGrowProc },
+ { NULL, 0 }
+ };
+ static const struct StrIntMap classMap[] = {
+ { "alert", kAlertWindowClass },
+ { "moveableAlert", kMovableAlertWindowClass },
+ { "modal", kModalWindowClass },
+ { "moveableModal", kMovableModalWindowClass },
+ { "floating", kFloatingWindowClass },
+ { "document", kDocumentWindowClass },
+ { "utility", kUtilityWindowClass },
+ { "help", kHelpWindowClass },
+ { "sheet", kSheetWindowClass },
+ { "toolbar", kToolbarWindowClass },
+ { "plain", kPlainWindowClass },
+ { "overlay", kOverlayWindowClass },
+ { "sheetAlert", kSheetAlertWindowClass },
+ { "altPlain", kAltPlainWindowClass },
+ { "simple", kSimpleWindowClass },
+ { "drawer", kDrawerWindowClass },
+ { NULL, 0 }
+ };
+ static const struct StrIntMap compositeAttrMap[] = {
+ { "none", kWindowNoAttributes },
+ { "standardDocument", kWindowStandardDocumentAttributes },
+ { "standardFloating", kWindowStandardFloatingAttributes },
+ { "fullZoom", kWindowFullZoomAttribute },
+ { NULL, 0 }
+ };
+ static const struct StrIntMap attrMap[] = {
+ { "closeBox", kWindowCloseBoxAttribute },
+ { "horizontalZoom", kWindowHorizontalZoomAttribute },
+ { "verticalZoom", kWindowVerticalZoomAttribute },
+ { "collapseBox", kWindowCollapseBoxAttribute },
+ { "resizable", kWindowResizableAttribute },
+ { "sideTitlebar", kWindowSideTitlebarAttribute },
+ { "toolbarButton", kWindowToolbarButtonAttribute },
+ { "unifiedTitleAndToolbar", kWindowUnifiedTitleAndToolbarAttribute },
+ { "metal", kWindowMetalAttribute },
+ { "noTitleBar", kWindowNoTitleBarAttribute },
+ { "texturedSquareCorners", kWindowTexturedSquareCornersAttribute },
+ { "metalNoContentSeparator", kWindowMetalNoContentSeparatorAttribute },
+ { "doesNotCycle", kWindowDoesNotCycleAttribute },
+ { "noUpdates", kWindowNoUpdatesAttribute },
+ { "noActivates", kWindowNoActivatesAttribute },
+ { "opaqueForEvents", kWindowOpaqueForEventsAttribute },
+ { "noShadow", kWindowNoShadowAttribute },
+ { "hideOnSuspend", kWindowHideOnSuspendAttribute },
+ { "hideOnFullScreen", kWindowHideOnFullScreenAttribute },
+ { "inWindowMenu", kWindowInWindowMenuAttribute },
+ { "liveResize", kWindowLiveResizeAttribute },
+ { "ignoreClicks", kWindowIgnoreClicksAttribute },
+ { "noConstrain", kWindowNoConstrainAttribute },
+ { NULL, 0 }
+ };
+ int index, i;
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+
+ if (objc == 3) {
+ if (wmPtr->style != -1) {
+ for (i = 0; styleMap[i].strValue != NULL; i++) {
+ if (wmPtr->style == (short) styleMap[i].intValue) {
+ Tcl_SetObjResult(interp,
+ Tcl_NewStringObj(styleMap[i].strValue, -1));
+ return TCL_OK;
+ }
+ }
+ Tcl_Panic("invalid style");
+ } else {
+ Tcl_Obj *attributeList, *newResult = NULL;
+ WindowAttributes attributes;
+
+ for (i = 0; classMap[i].strValue != NULL; i++) {
+ if (wmPtr->macClass == classMap[i].intValue) {
+ newResult = Tcl_NewStringObj(classMap[i].strValue, -1);
+ break;
+ }
+ }
+ if (newResult == NULL) {
+ Tcl_Panic("invalid class");
+ }
+
+ attributeList = Tcl_NewListObj(0, NULL);
+ attributes = wmPtr->attributes;
+
+ for (i = 0; compositeAttrMap[i].strValue != NULL; i++) {
+ UInt32 intValue = compositeAttrMap[i].intValue;
+
+ if (intValue && (attributes & intValue) == intValue) {
+ Tcl_ListObjAppendElement(interp, attributeList,
+ Tcl_NewStringObj(compositeAttrMap[i].strValue,
+ -1));
+ attributes &= ~intValue;
+ break;
+ }
+ }
+ for (i = 0; attrMap[i].strValue != NULL; i++) {
+ if (attributes & attrMap[i].intValue) {
+ Tcl_ListObjAppendElement(interp, attributeList,
+ Tcl_NewStringObj(attrMap[i].strValue, -1));
+ }
+ }
+ Tcl_ListObjAppendElement(interp, newResult, attributeList);
+ Tcl_SetObjResult(interp, newResult);
+ }
+ } else if (objc == 4) {
+ if (Tcl_GetIndexFromObjStruct(interp, objv[3], styleMap,
+ sizeof(struct StrIntMap), "style", 0, &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ wmPtr->style = styleMap[index].intValue;
+ } else if (objc == 5) {
+ int attrObjc;
+ Tcl_Obj **attrObjv = NULL;
+ WindowClass oldClass = wmPtr->macClass;
+ WindowAttributes oldAttributes = wmPtr->attributes;
+
+ if (Tcl_GetIndexFromObjStruct(interp, objv[3], classMap,
+ sizeof(struct StrIntMap), "class", 0, &index) != TCL_OK) {
+ goto badClassAttrs;
+ }
+ wmPtr->macClass = classMap[index].intValue;
+ if (!IsValidWindowClass(wmPtr->macClass)) {
+ goto badClassAttrs;
+ }
+ if (Tcl_ListObjGetElements(interp, objv[4], &attrObjc, &attrObjv)
+ != TCL_OK) {
+ goto badClassAttrs;
+ }
+ wmPtr->attributes = kWindowNoAttributes;
+ for (i = 0; i < attrObjc; i++) {
+ if (Tcl_GetIndexFromObjStruct(interp, attrObjv[i],
+ compositeAttrMap, sizeof(struct StrIntMap),
+ "attribute", 0, &index) == TCL_OK) {
+ wmPtr->attributes |= compositeAttrMap[index].intValue;
+ } else if (Tcl_GetIndexFromObjStruct(interp, attrObjv[i],
+ attrMap, sizeof(struct StrIntMap),
+ "attribute", 0, &index) == TCL_OK) {
+ Tcl_ResetResult(interp);
+ wmPtr->attributes |= attrMap[index].intValue;
+ } else {
+ goto badClassAttrs;
+ }
+ }
+ ApplyWindowClassAttributeChanges(winPtr, NULL, oldClass, oldAttributes,
+ 0);
+ wmPtr->style = -1;
+ return TCL_OK;
+
+ badClassAttrs:
+ wmPtr->macClass = oldClass;
+ wmPtr->attributes = oldAttributes;
+ return TCL_ERROR;
+ }
+ return TCL_OK;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpMakeMenuWindow --
+ *
+ * Configure the window to be either a undecorated pull-down (or pop-up)
+ * menu, or as a toplevel floating menu (palette).
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Changes the style bit used to create a new Mac toplevel.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpMakeMenuWindow(
+ Tk_Window tkwin, /* New window. */
+ int transient) /* 1 means menu is only posted briefly as a
+ * popup or pulldown or cascade. 0 means menu
+ * is always visible, e.g. as a floating
+ * menu. */
+{
+ TkWindow *winPtr = (TkWindow *) tkwin;
+
+ if (transient) {
+ winPtr->wmInfoPtr->macClass = kSimpleWindowClass;
+ winPtr->wmInfoPtr->attributes = kWindowNoActivatesAttribute;
+ } else {
+ winPtr->wmInfoPtr->macClass = kFloatingWindowClass;
+ winPtr->wmInfoPtr->attributes = kWindowStandardFloatingAttributes;
+ winPtr->wmInfoPtr->flags |= WM_WIDTH_NOT_RESIZABLE;
+ winPtr->wmInfoPtr->flags |= WM_HEIGHT_NOT_RESIZABLE;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXMakeRealWindowExist --
+ *
+ * This function finally creates the real Macintosh window that the Mac
+ * actually understands.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A new Macintosh toplevel is created.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXMakeRealWindowExist(
+ TkWindow *winPtr) /* Tk window. */
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ WindowRef newWindow = NULL;
+ ControlRef rootControl = NULL;
+ MacDrawable *macWin;
+ Rect initialBounds = {42, 0, 43, 1}, geometry, strWidths;
+ short structureW, structureH;
+ TkMacOSXWindowList *listPtr;
+ OSStatus err;
+
+ if (TkMacOSXHostToplevelExists(winPtr)) {
+ return;
+ }
+
+ macWin = (MacDrawable *) winPtr->window;
+
+ /*
+ * If this is embedded, make sure its container's toplevel exists,
+ * then return...
+ */
+
+ if (Tk_IsEmbedded(winPtr)) {
+ TkWindow *contWinPtr = TkpGetOtherWindow(winPtr);
+
+ if (contWinPtr != NULL) {
+ TkMacOSXMakeRealWindowExist(
+ contWinPtr->privatePtr->toplevel->winPtr);
+ macWin->flags |= TK_HOST_EXISTS;
+ return;
+ }
+
+ if (tkMacOSXEmbedHandler == NULL) {
+ Tcl_Panic("TkMacOSXMakeRealWindowExist could not find container");
+ }
+ if (tkMacOSXEmbedHandler->containerExistProc &&
+ tkMacOSXEmbedHandler->containerExistProc((Tk_Window) winPtr)
+ != TCL_OK) {
+ Tcl_Panic("ContainerExistProc could not make container");
+ }
+ return;
+
+ /*
+ * TODO: Here we should handle out of process embedding.
+ */
+ }
+
+ if (wmPtr->style == -1) {
+ if (!IsValidWindowClass(wmPtr->macClass)) {
+ TkMacOSXDbgMsg("Invalid window class: %ld", wmPtr->macClass);
+ wmPtr->macClass = kPlainWindowClass;
+ }
+ wmPtr->attributes = (wmPtr->attributes | kWindowAsyncDragAttribute) &
+ GetAvailableWindowAttributes(wmPtr->macClass);
+ err = ChkErr(CreateNewWindow, wmPtr->macClass, wmPtr->attributes,
+ &initialBounds, &newWindow);
+ if (err != noErr) {
+ newWindow = NULL;
+ }
+ } else {
+ TkMacOSXDbgMsg("Window creation via NewCWindow API is deprecated, "
+ "use a window class instead of style %d", wmPtr->style);
+ newWindow = NewCWindow(NULL, &initialBounds, "\p", false,
+ wmPtr->style, (WindowRef) -1, true, 0);
+ }
+
+ if (newWindow == NULL) {
+ Tcl_Panic("couldn't allocate new Mac window");
+ }
+
+ ChkErr(GetWindowStructureWidths, newWindow, &strWidths);
+ if (wmPtr->macClass == kFloatingWindowClass) {
+ /*
+ * Workaround GetWindowStructureWidths() Carbon bug:
+ */
+
+ strWidths.top = 16;
+ }
+ wmPtr->xInParent = strWidths.left;
+ wmPtr->yInParent = strWidths.top;
+ structureW = strWidths.left + strWidths.right;
+ structureH = strWidths.top + strWidths.bottom;
+ wmPtr->parentWidth = winPtr->changes.width + structureW;
+ wmPtr->parentHeight = winPtr->changes.height + structureH;
+ InitialWindowBounds(winPtr, newWindow, &geometry);
+ geometry.right += structureW;
+ geometry.bottom += structureH;
+ ChkErr(SetWindowBounds, newWindow, kWindowStructureRgn, &geometry);
+
+ TkMacOSXInstallWindowCarbonEventHandler(NULL, newWindow);
+ if (ChkErr(CreateRootControl, newWindow, &rootControl) != noErr ) {
+ Tcl_Panic("couldn't create root control for new Mac window");
+ }
+ if (wmPtr->attributes & kWindowResizableAttribute) {
+ HIViewRef growBoxView;
+
+ err = HIViewFindByID(HIViewGetRoot(newWindow),
+ kHIViewWindowGrowBoxID, &growBoxView);
+ if (err == noErr && !HIGrowBoxViewIsTransparent(growBoxView)) {
+ ChkErr(HIGrowBoxViewSetTransparent, growBoxView, true);
+ }
+ }
+
+ /*
+ * Add this window to the list of toplevel windows.
+ */
+
+ listPtr = ckalloc(sizeof(TkMacOSXWindowList));
+ listPtr->nextPtr = tkMacOSXWindowListPtr;
+ listPtr->winPtr = winPtr;
+ tkMacOSXWindowListPtr = listPtr;
+
+ macWin->grafPtr = GetWindowPort(newWindow);
+ macWin->rootControl = rootControl;
+
+ if (wmPtr->master != None || winPtr->atts.override_redirect) {
+ ApplyMasterOverrideChanges(winPtr, newWindow);
+ }
+ SetWindowModified(newWindow, false);
+ TkMacOSXRegisterOffScreenWindow((Window) macWin, (GWorldPtr) newWindow);
+ macWin->flags |= TK_HOST_EXISTS;
+ ChkErr(GetWindowClass, newWindow, &(wmPtr->macClass));
+ ChkErr(GetWindowAttributes, newWindow, &(wmPtr->attributes));
+
+#ifdef TK_MAC_DEBUG_WINDOWS
+ TkMacOSXInitNamedDebugSymbol(HIToolbox, void, DebugPrintWindow, WindowRef);
+ if (DebugPrintWindow) {
+ DebugPrintWindow(newWindow);
+ }
+#endif /* TK_MAC_DEBUG_WINDOWS */
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXRegisterOffScreenWindow --
+ *
+ * This function adds the passed in Off Screen Port to the hash table
+ * that maps Mac windows to root X windows.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * An entry is added to the windowTable hash table.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXRegisterOffScreenWindow(
+ Window window, /* Window structure. */
+ void *portPtr) /* Pointer to a Mac GWorld. */
+{
+ Tcl_HashEntry *valueHashPtr;
+ int isNew;
+
+ if (!windowHashInit) {
+ Tcl_InitHashTable(&windowTable, TCL_ONE_WORD_KEYS);
+ windowHashInit = true;
+ }
+ valueHashPtr = Tcl_CreateHashEntry(&windowTable, (char *) portPtr, &isNew);
+ if (!isNew) {
+ Tcl_Panic("Same macintosh window allocated twice!");
+ }
+ Tcl_SetHashValue(valueHashPtr, window);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXUnregisterMacWindow --
+ *
+ * Given a macintosh port window, this function removes the association
+ * between this window and the root X window that Tk cares about.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * An entry is removed from the windowTable hash table.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXUnregisterMacWindow(
+ void *macWinPtr) /* Reference to a Mac Window */
+{
+ Tcl_HashEntry *entryPtr;
+
+ if (!windowHashInit) {
+ Tcl_Panic("TkMacOSXUnregisterMacWindow: unmapping before inited");
+ }
+ entryPtr = Tcl_FindHashEntry(&windowTable,(char *) macWinPtr);
+ if (!entryPtr) {
+ TkMacOSXDbgMsg("Failed to find window %08x", (int) macWinPtr);
+ } else {
+ Tcl_DeleteHashEntry(entryPtr);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXSetScrollbarGrow --
+ *
+ * Sets a flag for a toplevel window indicating that the passed Tk
+ * scrollbar window will display the grow region for the toplevel window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * A flag is set int windows toplevel parent.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXSetScrollbarGrow(
+ TkWindow *winPtr, /* Tk scrollbar window. */
+ int flag) /* Boolean value true or false. */
+{
+ if (flag) {
+ winPtr->privatePtr->toplevel->flags |= TK_SCROLLBAR_GROW;
+ winPtr->privatePtr->toplevel->winPtr->wmInfoPtr->scrollWinPtr = winPtr;
+ } else if (winPtr->privatePtr->toplevel->winPtr->wmInfoPtr->scrollWinPtr
+ == winPtr) {
+ winPtr->privatePtr->toplevel->flags &= ~TK_SCROLLBAR_GROW;
+ winPtr->privatePtr->toplevel->winPtr->wmInfoPtr->scrollWinPtr = NULL;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkWmFocusToplevel --
+ *
+ * This is a utility procedure invoked by focus-management code. It
+ * exists because of the extra wrapper windows that exist under Unix; its
+ * job is to map from wrapper windows to the corresponding toplevel
+ * windows. On PCs and Macs there are no wrapper windows so no mapping is
+ * necessary; this procedure just determines whether a window is a
+ * toplevel or not.
+ *
+ * Results:
+ * If winPtr is a toplevel window, returns the pointer to the window;
+ * otherwise returns NULL.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkWindow *
+TkWmFocusToplevel(
+ TkWindow *winPtr) /* Window that received a focus-related
+ * event. */
+{
+ if (!(winPtr->flags & TK_TOP_LEVEL)) {
+ return NULL;
+ }
+ return winPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetWrapperWindow --
+ *
+ * This is a utility procedure invoked by focus-management code. It maps
+ * to the wrapper for a top-level, which is just the same as the
+ * top-level on Macs and PCs.
+ *
+ * Results:
+ * If winPtr is a toplevel window, returns the pointer to the window;
+ * otherwise returns NULL.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkWindow *
+TkpGetWrapperWindow(
+ TkWindow *winPtr) /* Window that received a focus-related
+ * event. */
+{
+ if (!(winPtr->flags & TK_TOP_LEVEL)) {
+ return NULL;
+ }
+ return winPtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpWmSetState --
+ *
+ * Sets the window manager state for the wrapper window of a given
+ * toplevel window.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * May maximize, minimize, restore, or withdraw a window.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpWmSetState(
+ TkWindow *winPtr, /* Toplevel window to operate on. */
+ int state) /* One of IconicState, ZoomState, NormalState,
+ * or WithdrawnState. */
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ WindowRef macWin;
+
+ wmPtr->hints.initial_state = state;
+ if (wmPtr->flags & WM_NEVER_MAPPED) {
+ return;
+ }
+
+ macWin = TkMacOSXDrawableWindow(winPtr->window);
+
+ if (state == WithdrawnState) {
+ Tk_UnmapWindow((Tk_Window) winPtr);
+ } else if (state == IconicState) {
+ /*
+ * The window always gets unmapped. If we can show the icon version of
+ * the window we also collapse it.
+ */
+
+ 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 --
+ *
+ * Returns 1 if a window is floating, 0 otherwise.
+ *
+ * Results:
+ * 1 or 0 depending on window's floating attribute.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpIsWindowFloating(
+ void *wRef)
+{
+ WindowClass class;
+
+ if (wRef == NULL) {
+ return 0;
+ }
+
+ GetWindowClass(wRef, &class);
+ return (class == kFloatingWindowClass);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXWindowClass --
+ *
+ * Returns OS X window class of window
+ *
+ * Results:
+ * 1 or 0 depending on window's floating attribute.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+MODULE_SCOPE WindowClass
+TkMacOSXWindowClass(
+ TkWindow *winPtr)
+{
+ return winPtr->wmInfoPtr->macClass;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * TkMacOSXWindowOffset --
+ *
+ * Determines the x and y offset from the orgin of the toplevel window
+ * dressing (the structure region, i.e. title bar) and the orgin of the
+ * content area.
+ *
+ * Results:
+ * The x & y offset in pixels.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXWindowOffset(
+ void *wRef,
+ int *xOffset,
+ int *yOffset)
+{
+ Window window;
+ TkDisplay *dispPtr;
+ TkWindow *winPtr;
+
+ window = TkMacOSXGetXWindow(wRef);
+ dispPtr = TkGetDisplayList();
+ winPtr = (TkWindow *) Tk_IdToWindow(dispPtr->display, window);
+ *xOffset = winPtr->wmInfoPtr->xInParent;
+ *yOffset = winPtr->wmInfoPtr->yInParent;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetMS --
+ *
+ * Return a relative time in milliseconds. It doesn't matter when the
+ * epoch was.
+ *
+ * Results:
+ * Number of milliseconds.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+unsigned long
+TkpGetMS(void)
+{
+ Tcl_Time now;
+
+ Tcl_GetTime(&now);
+ return (long) now.sec * 1000 + now.usec / 1000;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XSetInputFocus --
+ *
+ * Change the focus window for the application.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XSetInputFocus(
+ Display* display,
+ Window focus,
+ int revert_to,
+ Time time)
+{
+ /*
+ * Don't need to do a thing. Tk manages the focus for us.
+ */
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpChangeFocus --
+ *
+ * This procedure is a stub on the Mac because we always own the focus if
+ * we are a front most application.
+ *
+ * Results:
+ * The return value is the serial number of the command that changed the
+ * focus. It may be needed by the caller to filter out focus change
+ * events that were queued before the command. If the procedure doesn't
+ * actually change the focus then it returns 0.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkpChangeFocus(
+ TkWindow *winPtr, /* Window that is to receive the X focus. */
+ int force) /* Non-zero means claim the focus even if it
+ * didn't originally belong to topLevelPtr's
+ * application. */
+{
+ /*
+ * We don't really need to do anything on the Mac. Tk will keep all this
+ * state for us.
+ */
+
+ if (winPtr->atts.override_redirect) {
+ return 0;
+ }
+
+ /*
+ * Remember the current serial number for the X server and issue a dummy
+ * server request. This marks the position at which we changed the focus,
+ * so we can distinguish FocusIn and FocusOut events on either side of the
+ * mark.
+ */
+
+ return NextRequest(winPtr->display);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmStackorderToplevelWrapperMap --
+ *
+ * This procedure will create a table that maps the reparent wrapper X id
+ * for a toplevel to the TkWindow structure that is wraps. Tk keeps track
+ * of a mapping from the window X id to the TkWindow structure but that
+ * does us no good here since we only get the X id of the wrapper window.
+ * Only those toplevel windows that are mapped have a position in the
+ * stacking order.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Adds entries to the passed hashtable.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+WmStackorderToplevelWrapperMap(
+ TkWindow *winPtr, /* TkWindow to recurse on */
+ Display *display, /* X display of parent window */
+ Tcl_HashTable *table) /* Maps mac window to TkWindow */
+{
+ TkWindow *childPtr;
+ Tcl_HashEntry *hPtr;
+ WindowRef macWindow;
+ int newEntry;
+
+ if (Tk_IsMapped(winPtr) && Tk_IsTopLevel(winPtr)
+ && (winPtr->display == display)) {
+ macWindow = TkMacOSXDrawableWindow(winPtr->window);
+
+ hPtr = Tcl_CreateHashEntry(table,
+ (const char *) macWindow, &newEntry);
+ Tcl_SetHashValue(hPtr, winPtr);
+ }
+
+ for (childPtr = winPtr->childList; childPtr != NULL;
+ childPtr = childPtr->nextPtr) {
+ WmStackorderToplevelWrapperMap(childPtr, display, table);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkWmStackorderToplevel --
+ *
+ * This procedure returns the stack order of toplevel windows.
+ *
+ * Results:
+ * An array of pointers to tk window objects in stacking order or else
+ * NULL if there was an error.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkWindow **
+TkWmStackorderToplevel(
+ TkWindow *parentPtr) /* Parent toplevel window. */
+{
+ WindowRef frontWindow;
+ TkWindow *childWinPtr, **windows, **window_ptr;
+ Tcl_HashTable table;
+ Tcl_HashEntry *hPtr;
+ Tcl_HashSearch search;
+
+ /*
+ * Map mac windows to a TkWindow of the wrapped toplevel.
+ */
+
+ Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS);
+ WmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table);
+
+ windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *));
+
+ /*
+ * Special cases: If zero or one toplevels were mapped there is no need to
+ * enumerate Windows.
+ */
+
+ switch (table.numEntries) {
+ case 0:
+ windows[0] = NULL;
+ goto done;
+ case 1:
+ hPtr = Tcl_FirstHashEntry(&table, &search);
+ windows[0] = Tcl_GetHashValue(hPtr);
+ windows[1] = NULL;
+ goto done;
+ }
+
+ frontWindow = GetFrontWindowOfClass(kAllWindowClasses, false);
+ if (frontWindow == NULL) {
+ ckfree(windows);
+ windows = NULL;
+ } else {
+ window_ptr = windows + table.numEntries;
+ *window_ptr-- = NULL;
+ while (frontWindow != NULL) {
+ hPtr = Tcl_FindHashEntry(&table, (char *) frontWindow);
+ if (hPtr != NULL) {
+ childWinPtr = Tcl_GetHashValue(hPtr);
+ *window_ptr-- = childWinPtr;
+ }
+ frontWindow = GetNextWindow(frontWindow);
+ }
+ if (window_ptr != (windows-1)) {
+ Tcl_Panic("num matched toplevel windows does not equal num "
+ "children");
+ }
+ }
+
+ done:
+ Tcl_DeleteHashTable(&table);
+ return windows;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ApplyWindowClassAttributeChanges --
+ *
+ * This procedure applies carbon window class and attribute changes.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ApplyWindowClassAttributeChanges(
+ TkWindow *winPtr,
+ WindowRef macWindow,
+ WindowClass oldClass,
+ WindowAttributes oldAttributes,
+ int create)
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ WindowAttributes newAttributes = wmPtr->attributes |
+ kWindowAsyncDragAttribute;
+
+ if (wmPtr->macClass != oldClass || newAttributes != oldAttributes) {
+ Rect strWidths;
+
+ if (!macWindow) {
+ if (winPtr->window == None) {
+ if (create) {
+ Tk_MakeWindowExist((Tk_Window) winPtr);
+ } else {
+ return;
+ }
+ }
+ if (!TkMacOSXHostToplevelExists(winPtr)) {
+ if (create) {
+ TkMacOSXMakeRealWindowExist(winPtr);
+ } else {
+ return;
+ }
+ }
+ macWindow = TkMacOSXDrawableWindow(winPtr->window);
+ }
+ if (wmPtr->macClass != oldClass) {
+ TK_IF_MAC_OS_X_API (4, HIWindowChangeClass,
+ ChkErr(HIWindowChangeClass, macWindow, wmPtr->macClass);
+ ) TK_ENDIF
+ ChkErr(GetWindowClass, macWindow, &(wmPtr->macClass));
+ }
+ if (newAttributes != oldAttributes) {
+ newAttributes &= GetAvailableWindowAttributes(wmPtr->macClass);
+ ChkErr(ChangeWindowAttributes, macWindow,
+ newAttributes & (newAttributes ^ oldAttributes),
+ oldAttributes & (newAttributes ^ oldAttributes));
+ }
+ ChkErr(GetWindowAttributes, macWindow, &(wmPtr->attributes));
+ if ((wmPtr->attributes ^ oldAttributes) & kWindowResizableAttribute) {
+ if (wmPtr->attributes & kWindowResizableAttribute) {
+ HIViewRef growBoxView;
+ OSStatus err = HIViewFindByID(HIViewGetRoot(macWindow),
+ kHIViewWindowGrowBoxID, &growBoxView);
+
+ if (err == noErr && !HIGrowBoxViewIsTransparent(growBoxView)) {
+ ChkErr(HIGrowBoxViewSetTransparent, growBoxView, true);
+ }
+ }
+ TkMacOSXInvalClipRgns((Tk_Window) winPtr);
+ TkMacOSXInvalidateWindow((MacDrawable *) winPtr->window,
+ TK_PARENT_WINDOW);
+ }
+
+ /*
+ * The change of window class/attributes might have changed the window
+ * structure widths:
+ */
+
+ GetWindowStructureWidths(macWindow, &strWidths);
+ wmPtr->xInParent = strWidths.left;
+ wmPtr->yInParent = strWidths.top;
+ wmPtr->parentWidth = winPtr->changes.width + strWidths.left
+ + strWidths.right;
+ wmPtr->parentHeight = winPtr->changes.height + strWidths.top
+ + strWidths.bottom;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ApplyMasterOverrideChanges --
+ *
+ * This procedure applies changes to override_redirect or master.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ApplyMasterOverrideChanges(
+ TkWindow *winPtr,
+ WindowRef macWindow)
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ WindowClass oldClass = wmPtr->macClass;
+ WindowAttributes oldAttributes = wmPtr->attributes;
+
+ /*
+ * FIX: We need an UpdateWrapper equivalent to make this 100% correct
+ */
+
+ if (winPtr->atts.override_redirect) {
+ if (oldClass == kDocumentWindowClass) {
+ wmPtr->macClass = kSimpleWindowClass;
+ wmPtr->attributes = kWindowNoAttributes;
+ }
+ wmPtr->attributes |= kWindowNoActivatesAttribute;
+ } else {
+ if (oldClass == kSimpleWindowClass &&
+ oldAttributes == kWindowNoActivatesAttribute) {
+ wmPtr->macClass = kDocumentWindowClass;
+ wmPtr->attributes = kWindowStandardDocumentAttributes
+ | kWindowLiveResizeAttribute;
+ }
+ wmPtr->attributes &= ~kWindowNoActivatesAttribute;
+ }
+ if (!macWindow && winPtr->window != None &&
+ TkMacOSXHostToplevelExists(winPtr)) {
+ macWindow = TkMacOSXDrawableWindow(winPtr->window);
+ }
+ if (macWindow) {
+ WindowGroupRef group;
+
+ ApplyWindowClassAttributeChanges(winPtr, macWindow, oldClass,
+ oldAttributes, 0);
+
+ if (winPtr->atts.override_redirect && wmPtr->master != None) {
+ wmPtr->flags |= WM_TOPMOST;
+ } else {
+ wmPtr->flags &= ~WM_TOPMOST;
+ }
+ group = WmGetWindowGroup(winPtr);
+ if (group && group != GetWindowGroup(macWindow)) {
+ ChkErr(SetWindowGroup, macWindow, group);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * WmGetWindowGroup --
+ *
+ * Gets the window group a toplevel should be placed in.
+ *
+ * Results:
+ * A WindowGroupRef.
+ *
+ * Side effects:
+ * A transient window group for the master (if any) may be created.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static WindowGroupRef
+WmGetWindowGroup(
+ TkWindow *winPtr)
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ WindowGroupRef group = NULL;
+
+ if (wmPtr->flags & WM_TOPMOST) {
+ group = GetWindowGroupOfClass(kUtilityWindowClass);
+ } else if (wmPtr->master != None) {
+ TkDisplay *dispPtr = TkGetDisplayList();
+ TkWindow *masterWinPtr = (TkWindow *)
+ Tk_IdToWindow(dispPtr->display, wmPtr->master);
+
+ if (masterWinPtr && masterWinPtr->window != None &&
+ TkMacOSXHostToplevelExists(masterWinPtr)) {
+ WindowRef masterMacWin =
+ TkMacOSXDrawableWindow(masterWinPtr->window);
+
+ if (masterMacWin && GetWindowProperty(masterMacWin, 'Tk ', 'TsGp',
+ sizeof(group), NULL, &group) != noErr) {
+ ChkErr(CreateWindowGroup, 0, &group);
+ if (group) {
+ ChkErr(SetWindowGroupParent, group,
+ GetWindowGroup(masterMacWin));
+ ChkErr(SetWindowGroupOwner, group, masterMacWin);
+ ChkErr(SetWindowProperty, masterMacWin, 'Tk ', 'TsGp',
+ sizeof(group), &group);
+ }
+ }
+ }
+ }
+ if (!group) {
+ group = GetWindowGroupOfClass(wmPtr->macClass);
+ }
+ return group;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXMakeFullscreen --
+ *
+ * This procedure sets a fullscreen window to the size of the screen.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkMacOSXMakeFullscreen(
+ TkWindow *winPtr,
+ WindowRef window,
+ int fullscreen,
+ Tcl_Interp *interp)
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ int result = TCL_OK, wasFullscreen = (wmPtr->flags & WM_FULLSCREEN);
+
+ if (fullscreen) {
+ int screenWidth = WidthOfScreen(Tk_Screen(winPtr));
+ int screenHeight = HeightOfScreen(Tk_Screen(winPtr));
+
+ /*
+ * Check max width and height if set by the user.
+ */
+
+ if ((wmPtr->maxWidth > 0 && wmPtr->maxWidth < screenWidth)
+ || (wmPtr->maxHeight > 0 && wmPtr->maxHeight < screenHeight)) {
+ if (interp) {
+ Tcl_AppendResult(interp,
+ "can't set fullscreen attribute for \"",
+ winPtr->pathName,
+ "\": max width/height is too small", NULL);
+ }
+ result = TCL_ERROR;
+ wmPtr->flags &= ~WM_FULLSCREEN;
+ } else {
+ Rect bounds, screenBounds = {0, 0, screenHeight, screenWidth};
+
+ ChkErr(GetWindowBounds, window, kWindowContentRgn, &bounds);
+ if (!EqualRect(&bounds, &screenBounds)) {
+ if (!wasFullscreen) {
+ wmPtr->configX = wmPtr->x;
+ wmPtr->configY = wmPtr->y;
+ wmPtr->configAttributes = wmPtr->attributes;
+ wmPtr->attributes &= ~kWindowResizableAttribute;
+ ApplyWindowClassAttributeChanges(winPtr, window,
+ wmPtr->macClass, wmPtr->configAttributes, 0);
+ }
+ wmPtr->flags |= WM_SYNC_PENDING;
+ ChkErr(SetWindowBounds, window, kWindowContentRgn,
+ &screenBounds);
+ wmPtr->flags &= ~WM_SYNC_PENDING;
+ }
+ wmPtr->flags |= WM_FULLSCREEN;
+ }
+ } else {
+ wmPtr->flags &= ~WM_FULLSCREEN;
+ }
+ if (wasFullscreen && !(wmPtr->flags & WM_FULLSCREEN)) {
+ WindowAttributes oldAttributes = wmPtr->attributes;
+ Rect bounds = {wmPtr->configY, wmPtr->configX,
+ wmPtr->configY + wmPtr->yInParent + wmPtr->configHeight,
+ wmPtr->configX + wmPtr->xInParent + wmPtr->configWidth};
+
+ wmPtr->attributes |= wmPtr->configAttributes &
+ kWindowResizableAttribute;
+ ApplyWindowClassAttributeChanges(winPtr, window, wmPtr->macClass,
+ oldAttributes, 0);
+ wmPtr->flags |= WM_SYNC_PENDING;
+ ChkErr(SetWindowBounds, window, kWindowStructureRgn, &bounds);
+ wmPtr->flags &= ~WM_SYNC_PENDING;
+ }
+ TkMacOSXEnterExitFullscreen(winPtr, IsWindowActive(window));
+ return result;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXEnterExitFullscreen --
+ *
+ * This procedure enters or exits fullscreen mode if required.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXEnterExitFullscreen(
+ TkWindow *winPtr,
+ int active)
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ SystemUIMode mode;
+ SystemUIOptions options;
+
+ GetSystemUIMode(&mode, &options);
+ if (wmPtr->flags & WM_FULLSCREEN && active) {
+ static SystemUIMode fullscreenMode = 0;
+ static SystemUIOptions fullscreenOptions = 0;
+
+ if (!fullscreenMode) {
+ TK_IF_HI_TOOLBOX (3,
+ fullscreenMode = kUIModeAllSuppressed;
+ ) TK_ELSE_HI_TOOLBOX (3,
+ fullscreenMode = kUIModeAllHidden;
+ fullscreenOptions = kUIOptionAutoShowMenuBar;
+ ) TK_ENDIF
+ }
+ if (mode != fullscreenMode) {
+ ChkErr(SetSystemUIMode, fullscreenMode, fullscreenOptions);
+ }
+ } else {
+ if (mode != kUIModeNormal) {
+ ChkErr(SetSystemUIMode, kUIModeNormal, 0);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetMinSize --
+ *
+ * This function computes the current minWidth and minHeight values for a
+ * window, taking into account the possibility that they may be
+ * defaulted.
+ *
+ * Results:
+ * The values at *minWidthPtr and *minHeightPtr are filled in with the
+ * minimum allowable dimensions of wmPtr's window, in grid units. If the
+ * requested minimum is smaller than the system required minimum, then
+ * this function computes the smallest size that will satisfy both the
+ * system and the grid constraints.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+GetMinSize(
+ TkWindow *winPtr, /* Toplevel window to operate on. */
+ int *minWidthPtr, /* Where to store the current minimum width of
+ * the window. */
+ int *minHeightPtr) /* Where to store the current minimum height
+ * of the window. */
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ int minWidth = 1, minHeight = 1;
+
+ /*
+ * Compute the minimum width & height by taking the default client size and
+ * rounding it up to the nearest grid unit. Return the greater of the
+ * default minimum and the specified minimum.
+ */
+
+ switch (wmPtr->macClass) {
+ case kDocumentWindowClass:
+ case kMovableAlertWindowClass:
+ case kMovableModalWindowClass:
+ minWidth = 72;
+ if (wmPtr->attributes & kWindowResizableAttribute) {
+ minHeight = 15;
+ }
+ if (wmPtr->attributes & kWindowToolbarButtonAttribute) {
+ minWidth += 29;
+ }
+ break;
+ case kFloatingWindowClass:
+ case kUtilityWindowClass:
+ minWidth = 59;
+ if (wmPtr->attributes & kWindowResizableAttribute) {
+ minHeight = 11;
+ }
+ if (wmPtr->attributes & kWindowSideTitlebarAttribute) {
+ int tmp = minWidth;
+
+ minWidth = minHeight;
+ minHeight = tmp;
+ } else if (wmPtr->attributes & kWindowToolbarButtonAttribute) {
+ minWidth += 29;
+ }
+ break;
+ default:
+ if (wmPtr->attributes & kWindowResizableAttribute) {
+ minWidth = 15;
+ minHeight = 15;
+ }
+ break;
+ }
+
+ if (wmPtr->gridWin != NULL) {
+ int base = winPtr->reqWidth - (wmPtr->reqGridWidth * wmPtr->widthInc);
+
+ if (base < 0) {
+ base = 0;
+ }
+ minWidth = ((minWidth - base) + wmPtr->widthInc-1)/wmPtr->widthInc;
+ base = winPtr->reqHeight - (wmPtr->reqGridHeight * wmPtr->heightInc);
+ if (base < 0) {
+ base = 0;
+ }
+ minHeight = ((minHeight - base) + wmPtr->heightInc-1)/wmPtr->heightInc;
+ }
+ if (minWidth < wmPtr->minWidth) {
+ minWidth = wmPtr->minWidth;
+ }
+ if (minHeight < wmPtr->minHeight) {
+ minHeight = wmPtr->minHeight;
+ }
+ *minWidthPtr = minWidth;
+ *minHeightPtr = minHeight;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * GetMaxSize --
+ *
+ * This function computes the current maxWidth and maxHeight values for a
+ * window, taking into account the possibility that they may be
+ * defaulted.
+ *
+ * Results:
+ * The values at *maxWidthPtr and *maxHeightPtr are filled in with the
+ * maximum allowable dimensions of wmPtr's window, in grid units. If no
+ * maximum has been specified for the window, then this function computes
+ * the largest sizes that will fit on the screen.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+GetMaxSize(
+ TkWindow *winPtr, /* Toplevel window to operate on. */
+ int *maxWidthPtr, /* Where to store the current maximum width of
+ * the window. */
+ int *maxHeightPtr) /* Where to store the current maximum height
+ * of the window. */
+{
+ WmInfo *wmPtr = winPtr->wmInfoPtr;
+ Rect *maxBounds = (Rect*)(winPtr->display->screens->ext_data);
+
+ if (wmPtr->maxWidth > 0) {
+ *maxWidthPtr = wmPtr->maxWidth;
+ } else {
+ int maxWidth = maxBounds->right - maxBounds->left - wmPtr->xInParent;
+
+ if (wmPtr->gridWin != NULL) {
+ maxWidth = wmPtr->reqGridWidth
+ + (maxWidth - winPtr->reqWidth)/wmPtr->widthInc;
+ }
+ *maxWidthPtr = maxWidth;
+ }
+ if (wmPtr->maxHeight > 0) {
+ *maxHeightPtr = wmPtr->maxHeight;
+ } else {
+ int maxHeight = maxBounds->bottom - maxBounds->top - wmPtr->yInParent;
+
+ if (wmPtr->gridWin != NULL) {
+ maxHeight = wmPtr->reqGridHeight
+ + (maxHeight - winPtr->reqHeight)/wmPtr->heightInc;
+ }
+ *maxHeightPtr = maxHeight;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * RemapWindows
+ *
+ * Adjust parent/child relation ships of the given window hierarchy.
+ *
+ * Results:
+ * none
+ *
+ * Side effects:
+ * keeps windowing system (X11) happy
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+RemapWindows(
+ TkWindow *winPtr,
+ MacDrawable *parentWin)
+{
+ TkWindow *childPtr;
+
+ /*
+ * Remove the OS specific window. It will get rebuilt when the window gets
+ * Mapped.
+ */
+
+ if (winPtr->window != None) {
+ MacDrawable *macWin = (MacDrawable *) winPtr->window;
+
+ macWin->grafPtr = NULL;
+ macWin->toplevel = parentWin->toplevel;
+ winPtr->flags &= ~TK_MAPPED;
+#ifdef TK_REBUILD_TOPLEVEL
+ winPtr->flags |= TK_REBUILD_TOPLEVEL;
+#endif
+ }
+
+ /* Repeat for all the children */
+ for (childPtr = winPtr->childList; childPtr != NULL;
+ childPtr = childPtr->nextPtr) {
+ RemapWindows(childPtr, (MacDrawable *) winPtr->window);
+ }
+}
+
+/*
+ * Local Variables:
+ * fill-column: 78
+ * c-basic-offset: 4
+ * End:
+ */
diff --git a/carbon/tkMacOSXWm.h b/carbon/tkMacOSXWm.h
new file mode 100644
index 0000000..ce4bede
--- /dev/null
+++ b/carbon/tkMacOSXWm.h
@@ -0,0 +1,304 @@
+/*
+ * tkMacOSXWm.h --
+ *
+ * Declarations of Macintosh specific window manager structures.
+ *
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * The following terms apply to all files originating from Apple
+ * Computer, Inc. ("Apple") and associated with the software
+ * unless explicitly disclaimed in individual files.
+ *
+ *
+ * Apple hereby grants permission to use, copy, modify,
+ * distribute, and license this software and its documentation
+ * for any purpose, provided that existing copyright notices are
+ * retained in all copies and that this notice is included
+ * verbatim in any distributions. No written agreement, license,
+ * or royalty fee is required for any of the authorized
+ * uses. Modifications to this software may be copyrighted by
+ * their authors and need not follow the licensing terms
+ * described here, provided that the new terms are clearly
+ * indicated on the first page of each file where they apply.
+ *
+ *
+ * IN NO EVENT SHALL APPLE, THE AUTHORS OR DISTRIBUTORS OF THE
+ * SOFTWARE BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
+ * INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
+ * THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
+ * EVEN IF APPLE OR THE AUTHORS HAVE BEEN ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE. APPLE, THE AUTHORS AND
+ * DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS
+ * SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND APPLE,THE
+ * AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
+ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * GOVERNMENT USE: If you are acquiring this software on behalf
+ * of the U.S. government, the Government shall have only
+ * "Restricted Rights" in the software and related documentation
+ * as defined in the Federal Acquisition Regulations (FARs) in
+ * Clause 52.227.19 (c) (2). If you are acquiring the software
+ * on behalf of the Department of Defense, the software shall be
+ * classified as "Commercial Computer Software" and the
+ * 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.
+ */
+
+#ifndef _TKMACWM
+#define _TKMACWM
+
+#include "tkMacOSXInt.h"
+
+/*
+ * A data structure of the following type holds information for
+ * each window manager protocol (such as WM_DELETE_WINDOW) for
+ * which a handler (i.e. a Tcl command) has been defined for a
+ * particular top-level window.
+ */
+
+typedef struct ProtocolHandler {
+ Atom protocol; /* Identifies the protocol. */
+ struct ProtocolHandler *nextPtr;
+ /* Next in list of protocol handlers for
+ * the same top-level window, or NULL for
+ * end of list. */
+ Tcl_Interp *interp; /* Interpreter in which to invoke command. */
+ char command[4]; /* Tcl command to invoke when a client
+ * message for this protocol arrives.
+ * The actual size of the structure varies
+ * to accommodate the needs of the actual
+ * command. THIS MUST BE THE LAST FIELD OF
+ * THE STRUCTURE. */
+} ProtocolHandler;
+
+#define HANDLER_SIZE(cmdLength) \
+((unsigned) (sizeof(ProtocolHandler) - 3 + cmdLength))
+
+/*
+ * A data structure of the following type holds window-manager-related
+ * information for each top-level window in an application.
+ */
+
+typedef struct TkWmInfo {
+ TkWindow *winPtr; /* Pointer to main Tk information for
+ * this window. */
+ Window reparent; /* If the window has been reparented, this
+ * gives the ID of the ancestor of the window
+ * that is a child of the root window (may
+ * not be window's immediate parent). If
+ * the window isn't reparented, this has the
+ * value None. */
+ Tk_Uid titleUid; /* Title to display in window caption. If
+ * NULL, use name of widget. */
+ char *iconName; /* Name to display in icon. */
+ Window master; /* Master window for TRANSIENT_FOR property,
+ * or None. */
+ XWMHints hints; /* Various pieces of information for
+ * window manager. */
+ char *leaderName; /* Path name of leader of window group
+ * (corresponds to hints.window_group).
+ * Malloc-ed. Note: this field doesn't
+ * get updated if leader is destroyed. */
+ char *masterWindowName; /* Path name of window specified as master
+ * in "wm transient" command, or NULL.
+ * Malloc-ed. Note: this field doesn't
+ * get updated if masterWindowName is
+ * destroyed. */
+ Tk_Window icon; /* Window to use as icon for this window,
+ * or NULL. */
+ Tk_Window iconFor; /* Window for which this window is icon, or
+ * NULL if this isn't an icon for anyone. */
+
+ /*
+ * Information used to construct an XSizeHints structure for
+ * the window manager:
+ */
+
+ int sizeHintsFlags; /* Flags word for XSizeHints structure.
+ * If the PBaseSize flag is set then the
+ * window is gridded; otherwise it isn't
+ * gridded. */
+ int minWidth, minHeight; /* Minimum dimensions of window, in
+ * grid units, not pixels. */
+ int maxWidth, maxHeight; /* Maximum dimensions of window, in
+ * grid units, not pixels. */
+ Tk_Window gridWin; /* Identifies the window that controls
+ * gridding for this top-level, or NULL if
+ * the top-level isn't currently gridded. */
+ int widthInc, heightInc; /* Increments for size changes (# pixels
+ * per step). */
+ struct {
+ int x; /* numerator */
+ int y; /* denominator */
+ } minAspect, maxAspect; /* Min/max aspect ratios for window. */
+ int reqGridWidth, reqGridHeight;
+ /* The dimensions of the window (in
+ * grid units) requested through
+ * the geometry manager. */
+ int gravity; /* Desired window gravity. */
+
+ /*
+ * Information used to manage the size and location of a window.
+ */
+
+ int width, height; /* Desired dimensions of window, specified
+ * in grid units. These values are
+ * set by the "wm geometry" command and by
+ * ConfigureNotify events (for when wm
+ * resizes window). -1 means user hasn't
+ * requested dimensions. */
+ int x, y; /* Desired X and Y coordinates for window.
+ * These values are set by "wm geometry",
+ * plus by ConfigureNotify events (when wm
+ * moves window). These numbers are
+ * different than the numbers stored in
+ * winPtr->changes because (a) they could be
+ * measured from the right or bottom edge
+ * of the screen (see WM_NEGATIVE_X and
+ * WM_NEGATIVE_Y flags) and (b) if the window
+ * has been reparented then they refer to the
+ * parent rather than the window itself. */
+ int parentWidth, parentHeight;
+ /* Width and height of reparent, in pixels
+ * *including border*. If window hasn't been
+ * reparented then these will be the outer
+ * dimensions of the window, including
+ * border. */
+ int xInParent, yInParent; /* Offset of window within reparent, measured
+ * from upper-left outer corner of parent's
+ * border to upper-left outer corner of child's
+ * border. If not reparented then these are
+ * zero. */
+ int configX, configY; /* x,y position of toplevel when window is
+ * switched into fullscreen state, */
+ int configWidth, configHeight;
+ /* Dimensions passed to last request that we
+ * issued to change geometry of window. Used
+ * to eliminate redundant resize operations. */
+
+ /*
+ * Information about the virtual root window for this top-level,
+ * if there is one.
+ */
+
+ Window vRoot; /* Virtual root window for this top-level,
+ * or None if there is no virtual root
+ * window (i.e. just use the screen's root). */
+ int vRootX, vRootY; /* Position of the virtual root inside the
+ * root window. If the WM_VROOT_OFFSET_STALE
+ * flag is set then this information may be
+ * incorrect and needs to be refreshed from
+ * the X server. If vRoot is None then these
+ * values are both 0. */
+ unsigned int vRootWidth, vRootHeight;
+ /* Dimensions of the virtual root window.
+ * If vRoot is None, gives the dimensions
+ * of the containing screen. This information
+ * is never stale, even though vRootX and
+ * vRootY can be. */
+
+ /*
+ * List of children of the toplevel which have private colormaps.
+ */
+
+ TkWindow **cmapList; /* Array of window with private colormaps. */
+ int cmapCount; /* Number of windows in array. */
+
+ /*
+ * Miscellaneous information.
+ */
+
+ ProtocolHandler *protPtr; /* First in list of protocol handlers for
+ * this window (NULL means none). */
+ int cmdArgc; /* Number of elements in cmdArgv below. */
+ const char **cmdArgv; /* Array of strings to store in the
+ * WM_COMMAND property. NULL means nothing
+ * available. */
+ char *clientMachine; /* String to store in WM_CLIENT_MACHINE
+ * property, or NULL. */
+ int flags; /* Miscellaneous flags, defined below. */
+
+ /*
+ * Macintosh information.
+ */
+ WindowClass macClass;
+ WindowAttributes attributes, configAttributes;
+ TkWindow *scrollWinPtr; /* Ptr to scrollbar handling grow widget. */
+ short style; /* Legacy window style. */
+} WmInfo;
+
+
+/*
+ * Flag values for WmInfo structures:
+ *
+ * WM_NEVER_MAPPED - non-zero means window has never been
+ * mapped; need to update all info when
+ * window is first mapped.
+ * WM_UPDATE_PENDING - non-zero means a call to UpdateGeometryInfo
+ * has already been scheduled for this
+ * window; no need to schedule another one.
+ * WM_NEGATIVE_X - non-zero means x-coordinate is measured in
+ * pixels from right edge of screen, rather
+ * than from left edge.
+ * WM_NEGATIVE_Y - non-zero means y-coordinate is measured in
+ * pixels up from bottom of screen, rather than
+ * down from top.
+ * WM_UPDATE_SIZE_HINTS - non-zero means that new size hints need to be
+ * propagated to window manager.
+ * WM_SYNC_PENDING - set to non-zero while waiting for the window
+ * manager to respond to some state change.
+ * WM_VROOT_OFFSET_STALE - non-zero means that (x,y) offset information
+ * about the virtual root window is stale and
+ * needs to be fetched fresh from the X server.
+ * WM_ABOUT_TO_MAP - non-zero means that the window is about to
+ * be mapped by TkWmMapWindow. This is used
+ * by UpdateGeometryInfo to modify its behavior.
+ * WM_MOVE_PENDING - non-zero means the application has requested
+ * a new position for the window, but it hasn't
+ * been reflected through the window manager
+ * yet.
+ * WM_COLORMAPS_EXPLICIT - non-zero means the colormap windows were
+ * set explicitly via "wm colormapwindows".
+ * WM_ADDED_TOPLEVEL_COLORMAP - non-zero means that when "wm colormapwindows"
+ * was called the top-level itself wasn't
+ * specified, so we added it implicitly at
+ * the end of the list.
+ * WM_WIDTH_NOT_RESIZABLE - non-zero means that we're not supposed to
+ * allow the user to change the width of the
+ * window (controlled by "wm resizable"
+ * command).
+ * WM_HEIGHT_NOT_RESIZABLE - non-zero means that we're not supposed to
+ * allow the user to change the height of the
+ * window (controlled by "wm resizable"
+ * command).
+ */
+
+#define WM_NEVER_MAPPED 0x0001
+#define WM_UPDATE_PENDING 0x0002
+#define WM_NEGATIVE_X 0x0004
+#define WM_NEGATIVE_Y 0x0008
+#define WM_UPDATE_SIZE_HINTS 0x0010
+#define WM_SYNC_PENDING 0x0020
+#define WM_VROOT_OFFSET_STALE 0x0040
+#define WM_ABOUT_TO_MAP 0x0080
+#define WM_MOVE_PENDING 0x0100
+#define WM_COLORMAPS_EXPLICIT 0x0200
+#define WM_ADDED_TOPLEVEL_COLORMAP 0x0400
+#define WM_WIDTH_NOT_RESIZABLE 0x0800
+#define WM_HEIGHT_NOT_RESIZABLE 0x1000
+#define WM_TOPMOST 0x2000
+#define WM_FULLSCREEN 0x4000
+#define WM_TRANSPARENT 0x8000
+
+#endif
+
diff --git a/macosx/tkMacOSXXCursors.r b/carbon/tkMacOSXXCursors.r
index 81d2c00..81d2c00 100644
--- a/macosx/tkMacOSXXCursors.r
+++ b/carbon/tkMacOSXXCursors.r
diff --git a/carbon/tkMacOSXXStubs.c b/carbon/tkMacOSXXStubs.c
new file mode 100644
index 0000000..33f20c4
--- /dev/null
+++ b/carbon/tkMacOSXXStubs.c
@@ -0,0 +1,1283 @@
+/*
+ * tkMacOSXXStubs.c --
+ *
+ * This file contains most of the X calls called by Tk. Many of these
+ * calls are just stubs and either don't make sense on the Macintosh or
+ * their implamentation just doesn't do anything. Other calls will
+ * eventually be moved into other files.
+ *
+ * Copyright (c) 1995-1997 Sun Microsystems, Inc.
+ * Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2005-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "tkMacOSXEvent.h"
+
+#include <IOKit/IOKitLib.h>
+
+/*
+ * Because this file is still under major development Debugger statements are
+ * used through out this file. The define TCL_DEBUG will decide whether the
+ * debugger statements actually call the debugger or not.
+ */
+
+#ifndef TCL_DEBUG
+# define Debugger()
+#endif
+
+#define ROOT_ID 10
+
+/*
+ * Declarations of static variables used in this file.
+ */
+
+static TkDisplay *gMacDisplay = NULL;
+ /* Macintosh display. */
+static const char *macScreenName = ":0";
+ /* Default name of macintosh display. */
+
+/*
+ * Forward declarations of procedures used in this file.
+ */
+
+static XID MacXIdAlloc(Display *display);
+static int DefaultErrorHandler(Display *display,
+ XErrorEvent *err_evt);
+
+/*
+ * Other declarations
+ */
+
+static int DestroyImage(XImage *image);
+static unsigned long ImageGetPixel(XImage *image, int x, int y);
+static int PutPixel(XImage *image, int x, int y,
+ unsigned long pixel);
+#if 0
+static XImage * SubImage(XImage *image, int x, int y,
+ unsigned int width, unsigned int height);
+static int AddPixel(XImage *image, long value);
+#endif
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkMacOSXDisplayChanged --
+ *
+ * Called to set up initial screen info or when an event indicated
+ * display (screen) change.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * May change info regarding the screen.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkMacOSXDisplayChanged(
+ Display *display)
+{
+ GDHandle graphicsDevice;
+ Screen *screen;
+ Rect bounds = {0, 0, 0, 0}, *maxBounds;
+
+ if (display == NULL || display->screens == NULL) {
+ return;
+ }
+ screen = display->screens;
+
+ graphicsDevice = GetMainDevice();
+ screen->root_depth = (*(*graphicsDevice)->gdPMap)->cmpSize *
+ (*(*graphicsDevice)->gdPMap)->cmpCount;
+ screen->height = (*graphicsDevice)->gdRect.bottom -
+ (*graphicsDevice)->gdRect.top;
+ screen->width = (*graphicsDevice)->gdRect.right -
+ (*graphicsDevice)->gdRect.left;
+
+ screen->mwidth = (screen->width * 254 + 360) / 720;
+ screen->mheight = (screen->height * 254 + 360) / 720;
+
+ maxBounds = (Rect *) screen->ext_data;
+ *maxBounds = bounds;
+ graphicsDevice = GetDeviceList();
+ while (graphicsDevice) {
+ OSStatus err;
+
+ err = ChkErr(GetAvailableWindowPositioningBounds, graphicsDevice,
+ &bounds);
+ if (err == noErr) {
+ UnionRect(&bounds, maxBounds, maxBounds);
+ }
+ graphicsDevice = GetNextDevice(graphicsDevice);
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpOpenDisplay --
+ *
+ * Create the Display structure and fill it with device specific
+ * information.
+ *
+ * Results:
+ * Returns a Display structure on success or NULL on failure.
+ *
+ * Side effects:
+ * Allocates a new Display structure.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkDisplay *
+TkpOpenDisplay(
+ const char *display_name)
+{
+ Display *display;
+ Screen *screen;
+ int fd = 0;
+ static Rect maxBounds = {0, 0, 0, 0};
+
+ if (gMacDisplay != NULL) {
+ if (strcmp(gMacDisplay->display->display_name, display_name) == 0) {
+ return gMacDisplay;
+ } else {
+ return NULL;
+ }
+ }
+
+ display = ckalloc(sizeof(Display));
+ screen = ckalloc(sizeof(Screen));
+ bzero(display, sizeof(Display));
+ bzero(screen, sizeof(Screen));
+
+ display->resource_alloc = MacXIdAlloc;
+ display->request = 0;
+ display->qlen = 0;
+ display->fd = fd;
+ display->screens = screen;
+ display->nscreens = 1;
+ display->default_screen = 0;
+ display->display_name = (char *) macScreenName;
+
+ Gestalt(gestaltQuickdrawVersion, (long *) &display->proto_minor_version);
+ display->proto_major_version = 10;
+ display->proto_minor_version -= gestaltMacOSXQD;
+ display->vendor = (char*) "Apple";
+ Gestalt(gestaltSystemVersion, (long *) &display->release);
+
+ /*
+ * These screen bits never change
+ */
+ screen->root = ROOT_ID;
+ screen->display = display;
+ screen->black_pixel = 0x00000000 | PIXEL_MAGIC << 24;
+ screen->white_pixel = 0x00FFFFFF | PIXEL_MAGIC << 24;
+ screen->ext_data = (XExtData *) &maxBounds;
+
+ screen->root_visual = ckalloc(sizeof(Visual));
+ screen->root_visual->visualid = 0;
+ screen->root_visual->class = TrueColor;
+ screen->root_visual->red_mask = 0x00FF0000;
+ screen->root_visual->green_mask = 0x0000FF00;
+ screen->root_visual->blue_mask = 0x000000FF;
+ screen->root_visual->bits_per_rgb = 24;
+ screen->root_visual->map_entries = 256;
+
+ /*
+ * Initialize screen bits that may change
+ */
+
+ TkMacOSXDisplayChanged(display);
+
+ gMacDisplay = ckalloc(sizeof(TkDisplay));
+
+ /*
+ * This is the quickest way to make sure that all the *Init flags get
+ * properly initialized
+ */
+
+ bzero(gMacDisplay, sizeof(TkDisplay));
+ gMacDisplay->display = display;
+ return gMacDisplay;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpCloseDisplay --
+ *
+ * Deallocates a display structure created by TkpOpenDisplay.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Frees memory.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpCloseDisplay(
+ TkDisplay *displayPtr)
+{
+ Display *display = displayPtr->display;
+
+ if (gMacDisplay != displayPtr) {
+ Tcl_Panic("TkpCloseDisplay: tried to call TkpCloseDisplay on bad display");
+ }
+
+ gMacDisplay = NULL;
+ if (display->screens != NULL) {
+ if (display->screens->root_visual != NULL) {
+ ckfree(display->screens->root_visual);
+ }
+ ckfree(display->screens);
+ }
+ ckfree(display);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkClipCleanup --
+ *
+ * This procedure is called to cleanup resources associated with claiming
+ * clipboard ownership and for receiving selection get results. This
+ * function is called in tkWindow.c. This has to be called by the display
+ * cleanup function because we still need the access display elements.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Resources are freed - the clipboard may no longer be used.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkClipCleanup(
+ TkDisplay *dispPtr) /* display associated with clipboard */
+{
+ /*
+ * Make sure that the local scrap is transfered to the global scrap if
+ * needed.
+ */
+
+ TkSuspendClipboard();
+
+ if (dispPtr->clipWindow != NULL) {
+ Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
+ dispPtr->applicationAtom);
+ Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
+ dispPtr->windowAtom);
+
+ Tk_DestroyWindow(dispPtr->clipWindow);
+ Tcl_Release(dispPtr->clipWindow);
+ dispPtr->clipWindow = NULL;
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * MacXIdAlloc --
+ *
+ * This procedure is invoked by Xlib as the resource allocator for a
+ * display.
+ *
+ * Results:
+ * The return value is an X resource identifier that isn't currently in
+ * use.
+ *
+ * Side effects:
+ * The identifier is removed from the stack of free identifiers, if it
+ * was previously on the stack.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static XID
+MacXIdAlloc(
+ Display *display) /* Display for which to allocate. */
+{
+ static long int cur_id = 100;
+ /*
+ * Some special XIds are reserved
+ * - this is why we start at 100
+ */
+
+ return ++cur_id;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DefaultErrorHandler --
+ *
+ * This procedure is the default X error handler. Tk uses it's own error
+ * handler so this call should never be called.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * This function will call panic and exit.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+DefaultErrorHandler(
+ Display* display,
+ XErrorEvent* err_evt)
+{
+ /*
+ * This call should never be called. Tk replaces it with its own error
+ * handler.
+ */
+
+ Tcl_Panic("Warning hit bogus error handler!");
+ return 0;
+}
+
+char *
+XGetAtomName(
+ Display * display,
+ Atom atom)
+{
+ display->request++;
+ return NULL;
+}
+
+int
+_XInitImageFuncPtrs(
+ XImage *image)
+{
+ return 0;
+}
+
+XErrorHandler
+XSetErrorHandler(
+ XErrorHandler handler)
+{
+ return DefaultErrorHandler;
+}
+
+Window
+XRootWindow(
+ Display *display,
+ int screen_number)
+{
+ display->request++;
+ return ROOT_ID;
+}
+
+int
+XGetGeometry(
+ Display *display,
+ Drawable d,
+ Window *root_return,
+ int *x_return,
+ int *y_return,
+ unsigned int *width_return,
+ unsigned int *height_return,
+ unsigned int *border_width_return,
+ unsigned int *depth_return)
+{
+ TkWindow *winPtr = ((MacDrawable *) d)->winPtr;
+
+ display->request++;
+ *root_return = ROOT_ID;
+ if (winPtr) {
+ *x_return = Tk_X(winPtr);
+ *y_return = Tk_Y(winPtr);
+ *width_return = Tk_Width(winPtr);
+ *height_return = Tk_Height(winPtr);
+ *border_width_return = winPtr->changes.border_width;
+ *depth_return = Tk_Depth(winPtr);
+ } else {
+ Rect boundsRect;
+ CGrafPtr destPort = TkMacOSXGetDrawablePort(d);
+
+ GetPortBounds(destPort, &boundsRect);
+ *x_return = boundsRect.left;
+ *y_return = boundsRect.top;
+ *width_return = boundsRect.right - boundsRect.left;
+ *height_return = boundsRect.bottom - boundsRect.top;
+ *border_width_return = 0;
+ *depth_return = 32;
+ }
+ return 1;
+}
+
+void
+XChangeProperty(
+ Display* display,
+ Window w,
+ Atom property,
+ Atom type,
+ int format,
+ int mode,
+ _Xconst unsigned char* data,
+ int nelements)
+{
+ Debugger();
+}
+
+void
+XSelectInput(
+ Display* display,
+ Window w,
+ long event_mask)
+{
+ Debugger();
+}
+
+void
+XBell(
+ Display* display,
+ int percent)
+{
+ SysBeep(percent);
+}
+
+#if 0
+void
+XSetWMNormalHints(
+ Display* display,
+ Window w,
+ XSizeHints* hints)
+{
+ /*
+ * Do nothing. Shouldn't even be called.
+ */
+}
+
+XSizeHints *
+XAllocSizeHints(void)
+{
+ /*
+ * Always return NULL. Tk code checks to see if NULL is returned & does
+ * nothing if it is.
+ */
+
+ return NULL;
+}
+#endif
+
+GContext
+XGContextFromGC(
+ GC gc)
+{
+ /*
+ * TODO: currently a no-op
+ */
+
+ return 0;
+}
+
+Status
+XSendEvent(
+ Display* display,
+ Window w,
+ Bool propagate,
+ long event_mask,
+ XEvent* event_send)
+{
+ Debugger();
+ return 0;
+}
+
+void
+XClearWindow(
+ Display* display,
+ Window w)
+{
+}
+
+/*
+void
+XDrawPoint(
+ Display* display,
+ Drawable d,
+ GC gc,
+ int x,
+ int y)
+{
+}
+
+void
+XDrawPoints(
+ Display* display,
+ Drawable d,
+ GC gc,
+ XPoint* points,
+ int npoints,
+ int mode)
+{
+}
+*/
+
+void
+XWarpPointer(
+ Display* display,
+ Window src_w,
+ Window dest_w,
+ int src_x,
+ int src_y,
+ unsigned int src_width,
+ unsigned int src_height,
+ int dest_x,
+ int dest_y)
+{
+}
+
+void
+XQueryColor(
+ Display* display,
+ Colormap colormap,
+ XColor* def_in_out)
+{
+ unsigned long p;
+ unsigned char r, g, b;
+ XColor *d = def_in_out;
+
+ p = d->pixel;
+ r = (p & 0x00FF0000) >> 16;
+ g = (p & 0x0000FF00) >> 8;
+ b = (p & 0x000000FF);
+ d->red = (r << 8) | r;
+ d->green = (g << 8) | g;
+ d->blue = (b << 8) | b;
+ d->flags = DoRed|DoGreen|DoBlue;
+ d->pad = 0;
+}
+
+void
+XQueryColors(
+ Display* display,
+ Colormap colormap,
+ XColor* defs_in_out,
+ int ncolors)
+{
+ int i;
+ unsigned long p;
+ unsigned char r, g, b;
+ XColor *d = defs_in_out;
+
+ for (i = 0; i < ncolors; i++, d++) {
+ p = d->pixel;
+ r = (p & 0x00FF0000) >> 16;
+ g = (p & 0x0000FF00) >> 8;
+ b = (p & 0x000000FF);
+ d->red = (r << 8) | r;
+ d->green = (g << 8) | g;
+ d->blue = (b << 8) | b;
+ d->flags = DoRed|DoGreen|DoBlue;
+ d->pad = 0;
+ }
+}
+
+int
+XQueryTree(display, w, root_return, parent_return, children_return,
+ nchildren_return)
+ Display* display;
+ Window w;
+ Window* root_return;
+ Window* parent_return;
+ Window** children_return;
+ unsigned int* nchildren_return;
+{
+ return 0;
+}
+
+
+int
+XGetWindowProperty(
+ Display *display,
+ Window w,
+ Atom property,
+ long long_offset,
+ long long_length,
+ Bool delete,
+ Atom req_type,
+ Atom *actual_type_return,
+ int *actual_format_return,
+ unsigned long *nitems_return,
+ unsigned long *bytes_after_return,
+ unsigned char ** prop_return)
+{
+ display->request++;
+ *actual_type_return = None;
+ *actual_format_return = *bytes_after_return = 0;
+ *nitems_return = 0;
+ return 0;
+}
+
+void
+XRefreshKeyboardMapping(
+ XMappingEvent *x)
+{
+ /* used by tkXEvent.c */
+ Debugger();
+}
+
+void
+XSetIconName(
+ Display* display,
+ Window w,
+ const char *icon_name)
+{
+ /*
+ * This is a no-op, no icon name for Macs.
+ */
+ display->request++;
+}
+
+void
+XForceScreenSaver(
+ Display* display,
+ int mode)
+{
+ /*
+ * This function is just a no-op. It is defined to reset the screen saver.
+ * However, there is no real way to do this on a Mac. Let me know if there
+ * is!
+ */
+
+ display->request++;
+}
+
+void
+Tk_FreeXId(
+ Display *display,
+ XID xid)
+{
+ /* no-op function needed for stubs implementation. */
+}
+
+int
+XSync(
+ Display *display,
+ Bool flag)
+{
+ TkMacOSXFlushWindows();
+ display->request++;
+ return 0;
+}
+
+#if 0
+int
+XSetClipRectangles(
+ Display *d,
+ GC gc,
+ int clip_x_origin,
+ int clip_y_origin,
+ XRectangle* rectangles,
+ int n,
+ int ordering)
+{
+ TkRegion clipRgn = TkCreateRegion();
+
+ while (n--) {
+ XRectangle rect = *rectangles;
+
+ rect.x += clip_x_origin;
+ rect.y += clip_y_origin;
+ TkUnionRectWithRegion(&rect, clipRgn, clipRgn);
+ rectangles++;
+ }
+ TkSetRegion(d, gc, clipRgn);
+ TkDestroyRegion(clipRgn);
+ return 1;
+}
+#endif
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkGetServerInfo --
+ *
+ * Given a window, this procedure returns information about the window
+ * server for that window. This procedure provides the guts of the "winfo
+ * server" command.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkGetServerInfo(
+ Tcl_Interp *interp, /* The server information is returned in this
+ * interpreter's result. */
+ Tk_Window tkwin) /* Token for window; this selects a particular
+ * display and server. */
+{
+ char buffer[8 + TCL_INTEGER_SPACE * 2];
+ char buffer2[TCL_INTEGER_SPACE];
+
+ sprintf(buffer, "QD%dR%x ", ProtocolVersion(Tk_Display(tkwin)),
+ ProtocolRevision(Tk_Display(tkwin)));
+ sprintf(buffer2, " %x", VendorRelease(Tk_Display(tkwin)));
+ Tcl_AppendResult(interp, buffer, ServerVendor(Tk_Display(tkwin)),
+ buffer2, NULL);
+}
+
+#pragma mark XImage handling
+/*
+ *----------------------------------------------------------------------
+ *
+ * XCreateImage --
+ *
+ * Allocates storage for a new XImage.
+ *
+ * Results:
+ * Returns a newly allocated XImage.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+XImage *
+XCreateImage(
+ Display* display,
+ Visual* visual,
+ unsigned int depth,
+ int format,
+ int offset,
+ char* data,
+ unsigned int width,
+ unsigned int height,
+ int bitmap_pad,
+ int bytes_per_line)
+{
+ XImage *ximage;
+
+ display->request++;
+ ximage = ckalloc(sizeof(XImage));
+
+ ximage->height = height;
+ ximage->width = width;
+ ximage->depth = depth;
+ ximage->xoffset = offset;
+ ximage->format = format;
+ ximage->data = data;
+
+ if (format == ZPixmap) {
+ ximage->bits_per_pixel = 32;
+ ximage->bitmap_unit = 32;
+ } else {
+ ximage->bits_per_pixel = 1;
+ ximage->bitmap_unit = 8;
+ }
+ if (bitmap_pad) {
+ ximage->bitmap_pad = bitmap_pad;
+ } else {
+ /* Use 16 byte alignment for best Quartz perfomance */
+ ximage->bitmap_pad = 128;
+ }
+ if (bytes_per_line) {
+ ximage->bytes_per_line = bytes_per_line;
+ } else {
+ ximage->bytes_per_line = ((width * ximage->bits_per_pixel +
+ (ximage->bitmap_pad - 1)) >> 3) &
+ ~((ximage->bitmap_pad >> 3) - 1);
+ }
+#ifdef WORDS_BIGENDIAN
+ ximage->byte_order = MSBFirst;
+ ximage->bitmap_bit_order = MSBFirst;
+#else
+ ximage->byte_order = LSBFirst;
+ ximage->bitmap_bit_order = LSBFirst;
+#endif
+ ximage->red_mask = 0x00FF0000;
+ ximage->green_mask = 0x0000FF00;
+ ximage->blue_mask = 0x000000FF;
+ ximage->obdata = NULL;
+ ximage->f.create_image = NULL;
+ ximage->f.destroy_image = DestroyImage;
+ ximage->f.get_pixel = ImageGetPixel;
+ ximage->f.put_pixel = PutPixel;
+ ximage->f.sub_image = NULL;
+ ximage->f.add_pixel = NULL;
+
+ return ximage;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XGetImage --
+ *
+ * This function copies data from a pixmap or window into an XImage.
+ *
+ * Results:
+ * Returns a newly allocated image containing the data from the given
+ * rectangle of the given drawable.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+XImage *
+XGetImage(
+ Display *display,
+ Drawable d,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height,
+ unsigned long plane_mask,
+ int format)
+{
+ XImage * imagePtr = NULL;
+ Pixmap pixmap = (Pixmap) NULL;
+ Tk_Window win = (Tk_Window) ((MacDrawable *) d)->winPtr;
+ GC gc;
+ int depth = 32;
+ int offset = 0;
+ int bitmap_pad = 32;
+ int bytes_per_line = 0;
+
+ if (TkMacOSXGetDrawablePort(d)) {
+ if (format == ZPixmap) {
+ if (width > 0 && height > 0) {
+ /*
+ * Tk_GetPixmap fails for zero width or height.
+ */
+
+ pixmap = Tk_GetPixmap(display, d, width, height, depth);
+ }
+ if (win) {
+ XGCValues values;
+
+ gc = Tk_GetGC(win, 0, &values);
+ } else {
+ gc = XCreateGC(display, pixmap, 0, NULL);
+ }
+ if (pixmap) {
+ XCopyArea(display, d, pixmap, gc, x, y, width, height, 0, 0);
+ }
+ imagePtr = XCreateImage(display, NULL, depth, format, offset,
+ (char *) TkMacOSXGetDrawablePort(pixmap),
+ width, height, bitmap_pad, bytes_per_line);
+
+ /*
+ * Track Pixmap underlying the XImage in the unused obdata field
+ * so that we can treat XImages coming from XGetImage specially.
+ */
+
+ imagePtr->obdata = (XPointer) pixmap;
+ if (!win) {
+ XFreeGC(display, gc);
+ }
+ } else {
+ TkpDisplayWarning(
+ "XGetImage: only ZPixmap types are implemented",
+ "XGetImage Failure");
+ }
+ }
+ return imagePtr;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * DestroyImage --
+ *
+ * Destroys storage associated with an image.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Deallocates the image.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+DestroyImage(
+ XImage *image)
+{
+ if (image) {
+ if (image->obdata) {
+ Tk_FreePixmap((Display*) gMacDisplay, (Pixmap) image->obdata);
+ } else if (image->data) {
+ ckfree(image->data);
+ }
+ ckfree(image);
+ }
+ return 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * ImageGetPixel --
+ *
+ * Get a single pixel from an image.
+ *
+ * Results:
+ * Returns the 32 bit pixel value.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static unsigned long
+ImageGetPixel(
+ XImage *image,
+ int x,
+ int y)
+{
+ CGrafPtr destPort, savePort;
+ Boolean portChanged;
+ RGBColor cPix;
+ unsigned long r, g, b, c;
+
+ destPort = (CGrafPtr) image->data;
+ portChanged = QDSwapPort(destPort, &savePort);
+ GetCPixel(x, y, &cPix);
+ if (image->obdata) {
+ /*
+ * Image from XGetImage, 16 bit color values.
+ */
+
+ r = (cPix . red) >> 8;
+ g = (cPix . green) >> 8;
+ b = (cPix . blue) >> 8;
+ } else {
+ r = cPix . red;
+ g = cPix . green;
+ b = cPix . blue;
+ }
+ c = (r<<16)|(g<<8)|(b);
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+ return c;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * PutPixel --
+ *
+ * Set a single pixel in an image.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static int
+PutPixel(
+ XImage *image,
+ int x,
+ int y,
+ unsigned long pixel)
+{
+ CGrafPtr destPort, savePort;
+ Boolean portChanged;
+ RGBColor cPix;
+ unsigned long r, g, b;
+
+ destPort = (CGrafPtr)image->data;
+ portChanged = QDSwapPort(destPort, &savePort);
+ r = (pixel & image->red_mask)>>16;
+ g = (pixel & image->green_mask)>>8;
+ b = (pixel & image->blue_mask);
+ if (image->obdata) {
+ /*
+ * Image from XGetImage, 16 bit color values.
+ */
+
+ cPix.red = r << 8;
+ cPix.green = g << 8;
+ cPix.blue = b << 8;
+ } else {
+ cPix.red = r;
+ cPix.green = g;
+ cPix.blue = b;
+ }
+ SetCPixel(x, y, &cPix);
+ if (portChanged) {
+ QDSwapPort(savePort, NULL);
+ }
+ return 0;
+}
+
+#if 0
+static XImage *
+SubImage(
+ XImage *image,
+ int x,
+ int y,
+ unsigned int width,
+ unsigned int height)
+{
+ Debugger();
+ return NULL;
+}
+
+static int
+AddPixel(
+ XImage *image,
+ long value)
+{
+ Debugger();
+ return 0;
+}
+#endif
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * XChangeWindowAttributes, XSetWindowBackground,
+ * XSetWindowBackgroundPixmap, XSetWindowBorder, XSetWindowBorderPixmap,
+ * XSetWindowBorderWidth, XSetWindowColormap
+ *
+ * These functions are all no-ops. They all have equivalent Tk calls that
+ * should always be used instead.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+XChangeWindowAttributes(
+ Display *display,
+ Window w,
+ unsigned long value_mask,
+ XSetWindowAttributes *attributes)
+{
+}
+
+void
+XSetWindowBackground(
+ Display *display,
+ Window window,
+ unsigned long value)
+{
+}
+
+void
+XSetWindowBackgroundPixmap(
+ Display *display,
+ Window w,
+ Pixmap background_pixmap)
+{
+}
+
+void
+XSetWindowBorder(
+ Display *display,
+ Window w,
+ unsigned long border_pixel)
+{
+}
+
+void
+XSetWindowBorderPixmap(
+ Display *display,
+ Window w,
+ Pixmap border_pixmap)
+{
+}
+
+void
+XSetWindowBorderWidth(
+ Display *display,
+ Window w,
+ unsigned int width)
+{
+}
+
+void
+XSetWindowColormap(
+ Display *display,
+ Window w,
+ Colormap colormap)
+{
+ Debugger();
+}
+
+Status
+XStringListToTextProperty(
+ char **list,
+ int count,
+ XTextProperty *text_prop_return)
+{
+ Debugger();
+ return (Status) 0;
+}
+
+void
+XSetWMClientMachine(
+ Display *display,
+ Window w,
+ XTextProperty *text_prop)
+{
+ Debugger();
+}
+
+XIC
+XCreateIC(void)
+{
+ Debugger();
+ return (XIC) 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkGetDefaultScreenName --
+ *
+ * Returns the name of the screen that Tk should use during
+ * initialization.
+ *
+ * Results:
+ * Returns a statically allocated string.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+const char *
+TkGetDefaultScreenName(
+ Tcl_Interp *interp, /* Not used. */
+ const char *screenName) /* If NULL, use default string. */
+{
+#if 0
+ if ((screenName == NULL) || (screenName[0] == '\0')) {
+ screenName = macScreenName;
+ }
+ return screenName;
+#endif
+ return macScreenName;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_GetUserInactiveTime --
+ *
+ * Return the number of milliseconds the user was inactive.
+ *
+ * Results:
+ * The number of milliseconds the user has been inactive, or -1 if
+ * querying the inactive time is not supported.
+ *
+ * Side effects:
+ * None.
+ *----------------------------------------------------------------------
+ */
+
+long
+Tk_GetUserInactiveTime(
+ Display *dpy)
+{
+ io_registry_entry_t regEntry;
+ CFMutableDictionaryRef props = NULL;
+ CFTypeRef timeObj;
+ long ret = -1l;
+ uint64_t time;
+ IOReturn result;
+
+ regEntry = IOServiceGetMatchingService(kIOMasterPortDefault,
+ IOServiceMatching("IOHIDSystem"));
+
+ if (regEntry == 0) {
+ return -1l;
+ }
+
+ result = IORegistryEntryCreateCFProperties(regEntry, &props,
+ kCFAllocatorDefault, 0);
+ IOObjectRelease(regEntry);
+
+ if (result != KERN_SUCCESS || props == NULL) {
+ return -1l;
+ }
+
+ timeObj = CFDictionaryGetValue(props, CFSTR("HIDIdleTime"));
+
+ if (timeObj) {
+ CFTypeID type = CFGetTypeID(timeObj);
+
+ if (type == CFDataGetTypeID()) { /* Jaguar */
+ CFDataGetBytes((CFDataRef) timeObj,
+ CFRangeMake(0, sizeof(time)), (UInt8 *) &time);
+ /* Convert nanoseconds to milliseconds. */
+ /* ret /= kMillisecondScale; */
+ ret = (long) (time/kMillisecondScale);
+ } else if (type == CFNumberGetTypeID()) { /* Panther+ */
+ CFNumberGetValue((CFNumberRef)timeObj,
+ kCFNumberSInt64Type, &time);
+ /* Convert nanoseconds to milliseconds. */
+ /* ret /= kMillisecondScale; */
+ ret = (long) (time/kMillisecondScale);
+ } else {
+ ret = -1l;
+ }
+ }
+ /* Cleanup */
+ CFRelease(props);
+
+ return ret;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_ResetUserInactiveTime --
+ *
+ * Reset the user inactivity timer
+ *
+ * Results:
+ * none
+ *
+ * Side effects:
+ * The user inactivity timer of the underlaying windowing system is reset
+ * to zero.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_ResetUserInactiveTime(
+ Display *dpy)
+{
+ UpdateSystemActivity(UsrActivity);
+}
diff --git a/carbon/ttkMacOSXTheme.c b/carbon/ttkMacOSXTheme.c
new file mode 100644
index 0000000..5a895aa
--- /dev/null
+++ b/carbon/ttkMacOSXTheme.c
@@ -0,0 +1,1132 @@
+/*
+ * ttkMacOSXTheme.c --
+ *
+ * Tk theme engine for Mac OSX, using the Appearance Manager API.
+ *
+ * Copyright (c) 2004 Joe English
+ * Copyright (c) 2005 Neil Madden
+ * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * See also:
+ *
+ * <URL: http://developer.apple.com/documentation/Carbon/Reference/
+ * Appearance_Manager/appearance_manager/APIIndex.html >
+ *
+ * Notes:
+ * "Active" means different things in Mac and Tk terminology --
+ * On Aqua, widgets are "Active" if they belong to the foreground window,
+ * "Inactive" if they are in a background window.
+ * Tk uses the term "active" to mean that the mouse cursor
+ * is over a widget; aka "hover", "prelight", or "hot-tracked".
+ * Aqua doesn't use this kind of feedback.
+ *
+ * The QuickDraw/Carbon coordinate system is relative to the
+ * top-level window, not to the Tk_Window. BoxToRect()
+ * accounts for this.
+ */
+
+#include "tkMacOSXPrivate.h"
+#include "ttk/ttkTheme.h"
+
+#if !defined(BUILD_tile)
+/*
+ * Use this version in the core:
+ */
+#define BEGIN_DRAWING(d) { \
+ TkMacOSXDrawingContext dc; \
+ if (!TkMacOSXSetupDrawingContext((d), NULL, 0, &dc)) {return;}
+#define END_DRAWING \
+ TkMacOSXRestoreDrawingContext(&dc); }
+#else /* BUILD_tile */
+/*
+ * TkMacOSXSetupDrawingContext is not available to extensions,
+ * need to do this the hard way in Tile:
+ */
+#define BEGIN_DRAWING(d) { \
+ CGrafPtr saveWorld; GDHandle saveDevice; \
+ GetGWorld(&saveWorld, &saveDevice); \
+ SetGWorld(TkMacOSXGetDrawablePort(d), 0); \
+ TkMacOSXSetUpClippingRgn(d);
+#define END_DRAWING \
+ SetGWorld(saveWorld,saveDevice); }
+#endif /* defined(BUILD_TILE) */
+
+/*----------------------------------------------------------------------
+ * +++ Utilities.
+ */
+
+/*
+ * BoxToRect --
+ * Convert a Ttk_Box in Tk coordinates relative to the given Drawable
+ * to a native Rect relative to the containing port.
+ */
+static inline Rect BoxToRect(Drawable d, Ttk_Box b)
+{
+ MacDrawable *md = (MacDrawable*)d;
+ Rect rect;
+
+ rect.top = b.y + md->yOff;
+ rect.left = b.x + md->xOff;
+ rect.bottom = rect.top + b.height;
+ rect.right = rect.left + b.width;
+
+ return rect;
+}
+
+/*
+ * PatternOrigin --
+ * Compute brush pattern origin for a Drawable relative to a Tk_Window.
+ *
+ * Notes: This will only be nonzero if the Drawable is an off-screen pixmap.
+ * See also SF bug #1157739.
+ */
+static Point PatternOrigin(Tk_Window tkwin, Drawable d)
+{
+ MacDrawable *md = (MacDrawable*)d;
+ Rect bounds;
+ Point origin;
+
+ TkMacOSXWinBounds((TkWindow *) tkwin, &bounds);
+ origin.h = md->xOff - bounds.left;
+ origin.v = md->yOff - bounds.top;
+
+ return origin;
+}
+
+/*
+ * DontErase --
+ * No-op ThemeEraseProc, can be passed to DrawThemeButton &c.
+ */
+static void DontErase(
+ const Rect *bounds, UInt32 eraseData, SInt16 depth, Boolean isColorDev)
+{ }
+
+/*
+ * Table mapping Tk states to Appearance manager ThemeStates
+ */
+
+static Ttk_StateTable ThemeStateTable[] = {
+ {kThemeStateUnavailable, TTK_STATE_DISABLED, 0},
+ {kThemeStatePressed, TTK_STATE_PRESSED, 0},
+ {kThemeStateInactive, TTK_STATE_BACKGROUND, 0},
+ {kThemeStateActive, 0, 0}
+/* Others: Not sure what these are supposed to mean.
+ Up/Down have something to do with "little arrow" increment controls...
+ Dunno what a "Rollover" is.
+ NEM: Rollover is TTK_STATE_ACTIVE... but we don't handle that yet, by the
+ looks of things
+ {kThemeStateRollover, 0, 0},
+ {kThemeStateUnavailableInactive, 0, 0}
+ {kThemeStatePressedUp, 0, 0},
+ {kThemeStatePressedDown, 0, 0}
+*/
+};
+
+/*----------------------------------------------------------------------
+ * +++ Button element: Used for elements drawn with DrawThemeButton.
+ */
+
+/*
+ * Extra margins to account for drop shadow.
+ */
+static Ttk_Padding ButtonMargins = {2,2,2,2};
+
+#define NoThemeMetric 0xFFFFFFFF
+
+typedef struct {
+ ThemeButtonKind kind;
+ ThemeMetric heightMetric;
+} ThemeButtonParms;
+
+static ThemeButtonParms
+ PushButtonParms = { kThemePushButton, kThemeMetricPushButtonHeight },
+ CheckBoxParms = { kThemeCheckBox, kThemeMetricCheckBoxHeight },
+ RadioButtonParms = { kThemeRadioButton, kThemeMetricRadioButtonHeight },
+ BevelButtonParms = { kThemeBevelButton, NoThemeMetric },
+ PopupButtonParms = { kThemePopupButton, kThemeMetricPopupButtonHeight },
+ DisclosureParms = { kThemeDisclosureButton, kThemeMetricDisclosureTriangleHeight },
+ ListHeaderParms = { kThemeListHeaderButton, kThemeMetricListHeaderHeight };
+
+static Ttk_StateTable ButtonValueTable[] = {
+ { kThemeButtonMixed, TTK_STATE_ALTERNATE, 0 },
+ { kThemeButtonOn, TTK_STATE_SELECTED, 0 },
+ { kThemeButtonOff, 0, 0 }
+/* Others: kThemeDisclosureRight, kThemeDisclosureDown, kThemeDisclosureLeft */
+};
+
+static Ttk_StateTable ButtonAdornmentTable[] = {
+ { kThemeAdornmentDefault| kThemeAdornmentFocus,
+ TTK_STATE_ALTERNATE| TTK_STATE_FOCUS, 0 },
+ { kThemeAdornmentDefault, TTK_STATE_ALTERNATE, 0 },
+ { kThemeAdornmentFocus, TTK_STATE_FOCUS, 0 },
+ { kThemeAdornmentNone, 0, 0 }
+};
+
+/*
+ * computeButtonDrawInfo --
+ * Fill in an appearance manager ThemeButtonDrawInfo record.
+ */
+static ThemeButtonDrawInfo computeButtonDrawInfo(
+ ThemeButtonParms *parms, Ttk_State state)
+{
+ ThemeButtonDrawInfo info;
+
+ info.state = Ttk_StateTableLookup(ThemeStateTable, state);
+ info.value = Ttk_StateTableLookup(ButtonValueTable, state);
+ info.adornment = Ttk_StateTableLookup(ButtonAdornmentTable, state);
+ return info;
+}
+
+static void ButtonElementSizeNoPadding(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ThemeButtonParms *parms = clientData;
+
+ if (parms->heightMetric != NoThemeMetric) {
+ SInt32 height;
+
+ ChkErr(GetThemeMetric, parms->heightMetric, &height);
+ *heightPtr = height;
+ }
+}
+
+static void ButtonElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ ThemeButtonParms *parms = clientData;
+ ThemeButtonDrawInfo info = computeButtonDrawInfo(parms, 0);
+ static const Rect scratchBounds = {0, 0, 100, 100};
+ Rect contentBounds;
+
+ ButtonElementSizeNoPadding(
+ clientData, elementRecord, tkwin,
+ widthPtr, heightPtr, paddingPtr);
+
+ /*
+ * To compute internal padding, query the appearance manager
+ * for the content bounds of a dummy rectangle, then use
+ * the difference as the padding.
+ */
+ ChkErr(GetThemeButtonContentBounds,
+ &scratchBounds, parms->kind, &info, &contentBounds);
+
+ paddingPtr->left = contentBounds.left;
+ paddingPtr->top = contentBounds.top;
+ paddingPtr->right = scratchBounds.right - contentBounds.right + 1;
+ paddingPtr->bottom = scratchBounds.bottom - contentBounds.bottom;
+
+ /*
+ * Now add a little extra padding to account for drop shadows.
+ * @@@ SHOULD: call GetThemeButtonBackgroundBounds() instead.
+ */
+
+ *paddingPtr = Ttk_AddPadding(*paddingPtr, ButtonMargins);
+ *widthPtr += Ttk_PaddingWidth(ButtonMargins);
+ *heightPtr += Ttk_PaddingHeight(ButtonMargins);
+}
+
+static void ButtonElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ ThemeButtonParms *parms = clientData;
+ ThemeButtonDrawInfo info = computeButtonDrawInfo(parms, state);
+ Rect bounds = BoxToRect(d, Ttk_PadBox(b, ButtonMargins));
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeButton, &bounds, parms->kind, &info, NULL, NULL, NULL, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec ButtonElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ ButtonElementSize,
+ ButtonElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Notebook elements.
+ */
+
+static Ttk_StateTable TabStyleTable[] = {
+ { kThemeTabFrontInactive, TTK_STATE_SELECTED|TTK_STATE_BACKGROUND, 0 },
+ { kThemeTabNonFrontInactive, TTK_STATE_BACKGROUND, 0 },
+ { kThemeTabFrontUnavailable, TTK_STATE_DISABLED|TTK_STATE_SELECTED, 0 },
+ { kThemeTabNonFrontUnavailable, TTK_STATE_DISABLED, 0 },
+ { kThemeTabFront, TTK_STATE_SELECTED, 0 },
+ { kThemeTabNonFrontPressed, TTK_STATE_PRESSED, 0 },
+ { kThemeTabNonFront, 0,0 }
+};
+
+/*
+ * Quoth DrawThemeTab() reference manual:
+ * "Small tabs have a height of 16 pixels large tabs have a height of
+ * 21 pixels. (The widths of tabs are variable.) Additionally, the
+ * distance that the tab overlaps the pane must be included in the tab
+ * rectangle this overlap distance is always 3 pixels, although the
+ * 3-pixel overlap is only drawn for the front tab."
+ */
+static const int TAB_HEIGHT = 21;
+static const int TAB_OVERLAP = 3;
+
+static void TabElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *heightPtr = TAB_HEIGHT + TAB_OVERLAP - 1;
+}
+
+static void TabElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ Rect bounds = BoxToRect(d, b);
+ ThemeTabStyle tabStyle = Ttk_StateTableLookup(TabStyleTable, state);
+
+ bounds.bottom += TAB_OVERLAP;
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeTab, &bounds, tabStyle, kThemeTabNorth, 0, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec TabElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ TabElementSize,
+ TabElementDraw
+};
+
+/*
+ * Notebook panes:
+ */
+static void PaneElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ /* Padding determined by trial-and-error */
+ *paddingPtr = Ttk_MakePadding(2, 8, 2, 2);
+}
+
+static void PaneElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ Rect bounds = BoxToRect(d, b);
+ ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state);
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeTabPane, &bounds, drawState);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec PaneElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ PaneElementSize,
+ PaneElementDraw
+};
+
+/*
+ * Labelframe borders:
+ * Use "primary group box ..."
+ * Quoth DrawThemePrimaryGroup reference:
+ * "The primary group box frame is drawn inside the specified
+ * rectangle and is a maximum of 2 pixels thick."
+ *
+ * "Maximum of 2 pixels thick" is apparently a lie;
+ * looks more like 4 to me with shading.
+ */
+static void GroupElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *paddingPtr = Ttk_UniformPadding(4);
+}
+
+static void GroupElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ Rect bounds = BoxToRect(d, b);
+ ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state);
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemePrimaryGroup, &bounds, drawState);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec GroupElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ GroupElementSize,
+ GroupElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Entry element --
+ * 3 pixels padding for focus rectangle
+ * 2 pixels padding for EditTextFrame
+ */
+
+typedef struct {
+ Tcl_Obj *backgroundObj;
+} EntryElement;
+
+static Ttk_ElementOptionSpec EntryElementOptions[] = {
+ { "-background", TK_OPTION_BORDER,
+ Tk_Offset(EntryElement,backgroundObj), "white" },
+ {0}
+};
+
+static void EntryElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *paddingPtr = Ttk_UniformPadding(5);
+}
+
+static void EntryElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ EntryElement *e = elementRecord;
+ Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin,e->backgroundObj);
+ Ttk_Box inner = Ttk_PadBox(b, Ttk_UniformPadding(3));
+ Rect bounds = BoxToRect(d, inner);
+ ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state);
+
+ /*
+ * Erase w/background color:
+ */
+ XFillRectangle(Tk_Display(tkwin), d,
+ Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC),
+ inner.x,inner.y, inner.width, inner.height);
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeEditTextFrame, &bounds, drawState);
+ if (state & TTK_STATE_FOCUS) {
+ ChkErr(DrawThemeFocusRect, &bounds, 1);
+ }
+ END_DRAWING
+}
+
+static Ttk_ElementSpec EntryElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(EntryElement),
+ EntryElementOptions,
+ EntryElementSize,
+ EntryElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Combobox:
+ *
+ * NOTES:
+ * kThemeMetricComboBoxLargeDisclosureWidth -> 17
+ * Padding and margins guesstimated by trial-and-error.
+ */
+
+static Ttk_Padding ComboboxPadding = { 2, 3, 17, 1 };
+static Ttk_Padding ComboboxMargins = { 3, 3, 4, 4 };
+
+static void ComboboxElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *widthPtr = 0;
+ *heightPtr = 0;
+ *paddingPtr = Ttk_AddPadding(ComboboxMargins, ComboboxPadding);
+}
+
+static void ComboboxElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ ThemeButtonParms *parms = clientData;
+ ThemeButtonDrawInfo info = computeButtonDrawInfo(parms, state);
+ Rect bounds = BoxToRect(d, Ttk_PadBox(b, ComboboxMargins));
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeButton,
+ &bounds, kThemeComboBox, &info, NULL, NULL, NULL, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec ComboboxElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ ComboboxElementSize,
+ ComboboxElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Spinbuttons.
+ *
+ * From Apple HIG, part III, section "Controls", "The Stepper Control":
+ * there should be 2 pixels of space between the stepper control
+ * (AKA IncDecButton, AKA "little arrows") and the text field it modifies.
+ */
+
+static Ttk_Padding SpinbuttonMargins = {2,0,2,0};
+static void SpinButtonElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ SInt32 s;
+
+ ChkErr(GetThemeMetric, kThemeMetricLittleArrowsWidth, &s);
+ *widthPtr = s + Ttk_PaddingWidth(SpinbuttonMargins);
+ ChkErr(GetThemeMetric, kThemeMetricLittleArrowsHeight, &s);
+ *heightPtr = s + Ttk_PaddingHeight(SpinbuttonMargins);
+}
+
+static void SpinButtonElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ Rect bounds = BoxToRect(d, Ttk_PadBox(b, SpinbuttonMargins));
+ ThemeButtonDrawInfo info;
+
+ /* @@@ can't currently distinguish PressedUp (== Pressed) from PressedDown;
+ * ignore this bit for now [see #2219588]
+ */
+ info.state = Ttk_StateTableLookup(ThemeStateTable,
+ state & ~TTK_STATE_PRESSED);
+ info.value = Ttk_StateTableLookup(ButtonValueTable, state);
+ info.adornment = kThemeAdornmentNone;
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeButton,
+ &bounds, kThemeIncDecButton, &info, NULL, NULL, NULL, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec SpinButtonElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ SpinButtonElementSize,
+ SpinButtonElementDraw
+};
+
+
+/*----------------------------------------------------------------------
+ * +++ DrawThemeTrack-based elements --
+ * Progress bars and scales. (See also: <<NOTE-TRACKS>>)
+ */
+
+static Ttk_StateTable ThemeTrackEnableTable[] = {
+ { kThemeTrackDisabled, TTK_STATE_DISABLED, 0 },
+ { kThemeTrackInactive, TTK_STATE_BACKGROUND, 0 },
+ { kThemeTrackActive, 0, 0 }
+ /* { kThemeTrackNothingToScroll, ?, ? }, */
+};
+
+typedef struct { /* TrackElement client data */
+ ThemeTrackKind kind;
+ SInt32 thicknessMetric;
+} TrackElementData;
+
+static TrackElementData ScaleData = {
+ kThemeSlider, kThemeMetricHSliderHeight
+};
+
+typedef struct {
+ Tcl_Obj *fromObj; /* minimum value */
+ Tcl_Obj *toObj; /* maximum value */
+ Tcl_Obj *valueObj; /* current value */
+ Tcl_Obj *orientObj; /* horizontal / vertical */
+} TrackElement;
+
+static Ttk_ElementOptionSpec TrackElementOptions[] = {
+ { "-from", TK_OPTION_DOUBLE, Tk_Offset(TrackElement,fromObj) },
+ { "-to", TK_OPTION_DOUBLE, Tk_Offset(TrackElement,toObj) },
+ { "-value", TK_OPTION_DOUBLE, Tk_Offset(TrackElement,valueObj) },
+ { "-orient", TK_OPTION_STRING, Tk_Offset(TrackElement,orientObj) },
+ {0,0,0}
+};
+
+static void TrackElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ TrackElementData *data = clientData;
+ SInt32 size = 24; /* reasonable default ... */
+
+ ChkErr(GetThemeMetric, data->thicknessMetric, &size);
+ *widthPtr = *heightPtr = size;
+}
+
+static void TrackElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ TrackElementData *data = clientData;
+ TrackElement *elem = elementRecord;
+ double from = 0, to = 100, value = 0;
+ int orientation = TTK_ORIENT_HORIZONTAL;
+ ThemeTrackDrawInfo info;
+
+ Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from);
+ Tcl_GetDoubleFromObj(NULL, elem->toObj, &to);
+ Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value);
+ Ttk_GetOrientFromObj(NULL, elem->orientObj, &orientation);
+
+ /* @@@ BUG: min, max, and value should account for resolution:
+ * @@@ if finer than 1.0, conversion to int breaks.
+ */
+ info.kind = data->kind;
+ info.bounds = BoxToRect(d, b);
+ info.min = (int) from; /* @@@ */
+ info.max = (int) to; /* @@@ */
+ info.value = (int) value; /* @@@ */
+
+ info.attributes = orientation == TTK_ORIENT_HORIZONTAL
+ ? kThemeTrackHorizontal : 0;
+ info.attributes |= kThemeTrackShowThumb;
+ info.enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state);
+
+ switch (data->kind) {
+ case kThemeProgressBar:
+ info.trackInfo.progress.phase = 0; /* 1-4: animation phase */
+ break;
+ case kThemeSlider:
+ info.trackInfo.slider.pressState = 0; /* @@@ fill this in */
+ info.trackInfo.slider.thumbDir = kThemeThumbPlain;
+ /* kThemeThumbUpward, kThemeThumbDownward, kThemeThumbPlain */
+ break;
+ }
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeTrack, &info, NULL, NULL, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec TrackElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(TrackElement),
+ TrackElementOptions,
+ TrackElementSize,
+ TrackElementDraw
+};
+
+/*
+ * Slider element -- <<NOTE-TRACKS>>
+ * Has geometry only. The Scale widget adjusts the position of this element,
+ * and uses it for hit detection. In the Aqua theme, the slider is actually
+ * drawn as part of the trough element.
+ *
+ * Also buggy: The geometry here is a Wild-Assed-Guess; I can't
+ * figure out how to get the Appearance Manager to tell me the
+ * slider size.
+ */
+static void SliderElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *widthPtr = *heightPtr = 24;
+}
+
+static Ttk_ElementSpec SliderElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ SliderElementSize,
+ TtkNullElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Progress bar element (new):
+ *
+ * @@@ NOTE: According to an older revision of the Aqua reference docs,
+ * @@@ the 'phase' field is between 0 and 4. Newer revisions say
+ * @@@ that it can be any UInt8 value.
+ */
+
+typedef struct {
+ Tcl_Obj *orientObj; /* horizontal / vertical */
+ Tcl_Obj *valueObj; /* current value */
+ Tcl_Obj *maximumObj; /* maximum value */
+ Tcl_Obj *phaseObj; /* animation phase */
+ Tcl_Obj *modeObj; /* progress bar mode */
+} PbarElement;
+
+static Ttk_ElementOptionSpec PbarElementOptions[] = {
+ { "-orient", TK_OPTION_STRING,
+ Tk_Offset(PbarElement,orientObj), "horizontal" },
+ { "-value", TK_OPTION_DOUBLE,
+ Tk_Offset(PbarElement,valueObj), "0" },
+ { "-maximum", TK_OPTION_DOUBLE,
+ Tk_Offset(PbarElement,maximumObj), "100" },
+ { "-phase", TK_OPTION_INT,
+ Tk_Offset(PbarElement,phaseObj), "0" },
+ { "-mode", TK_OPTION_STRING,
+ Tk_Offset(PbarElement,modeObj), "determinate" },
+ {0,0,0,0}
+};
+
+static void PbarElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ SInt32 size = 24; /* @@@ Check HIG for correct default */
+
+ ChkErr(GetThemeMetric, kThemeMetricLargeProgressBarThickness, &size);
+ *widthPtr = *heightPtr = size;
+}
+
+static void PbarElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ PbarElement *pbar = elementRecord;
+ int orientation = TTK_ORIENT_HORIZONTAL;
+ double value = 0, maximum = 100;
+ int phase = 0;
+ ThemeTrackDrawInfo info;
+
+ Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orientation);
+ Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value);
+ Tcl_GetDoubleFromObj(NULL, pbar->maximumObj, &maximum);
+ Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase);
+
+ if (!strcmp("indeterminate", Tcl_GetString(pbar->modeObj)) && value) {
+ info.kind = kThemeIndeterminateBar;
+ } else {
+ info.kind = kThemeProgressBar;
+ }
+ info.bounds = BoxToRect(d, b);
+ info.min = 0;
+ info.max = (int) maximum; /* @@@ See note above */
+ info.value = (int) value;
+ info.attributes = orientation == TTK_ORIENT_HORIZONTAL
+ ? kThemeTrackHorizontal : 0;
+ info.attributes |= kThemeTrackShowThumb;
+ info.enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state);
+ info.trackInfo.progress.phase = phase;
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeTrack, &info, NULL, NULL, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec PbarElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(PbarElement),
+ PbarElementOptions,
+ PbarElementSize,
+ PbarElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Separator element.
+ *
+ * DrawThemeSeparator() guesses the orientation of the line from
+ * the width and height of the rectangle, so the same element can
+ * can be used for horizontal, vertical, and general separators.
+ */
+
+static void SeparatorElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ *widthPtr = *heightPtr = 1;
+}
+
+static void SeparatorElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ Rect bounds = BoxToRect(d, b);
+ ThemeDrawState drawState;
+
+ /*
+ * DrawThemeSeparator only supports kThemeStateActive / kThemeStateInactive
+ */
+ state &= TTK_STATE_BACKGROUND;
+ drawState = Ttk_StateTableLookup(ThemeStateTable, state);
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeSeparator, &bounds, drawState);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec SeparatorElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ SeparatorElementSize,
+ SeparatorElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Size grip element.
+ */
+static const ThemeGrowDirection sizegripGrowDirection
+ = kThemeGrowRight|kThemeGrowDown;
+
+static void SizegripElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ Point origin = {0, 0};
+ Rect bounds;
+
+ ChkErr(GetThemeStandaloneGrowBoxBounds,
+ origin, sizegripGrowDirection, false, &bounds);
+ *widthPtr = bounds.right - bounds.left;
+ *heightPtr = bounds.bottom - bounds.top;
+}
+
+static void SizegripElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ Rect bounds = BoxToRect(d, b);
+ Point origin = {bounds.top, bounds.left};
+
+ /* Grow box only supports kThemeStateActive, kThemeStateInactive */
+ state &= TTK_STATE_BACKGROUND;
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeStandaloneGrowBox,
+ origin, sizegripGrowDirection, false,
+ Ttk_StateTableLookup(ThemeStateTable, state));
+ END_DRAWING
+}
+
+static Ttk_ElementSpec SizegripElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ SizegripElementSize,
+ SizegripElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Background and fill elements.
+ *
+ * This isn't quite right: In Aqua, the correct background for
+ * a control depends on what kind of container it belongs to,
+ * and the type of the top-level window.
+ *
+ * Also: patterned backgrounds should be aligned with the coordinate
+ * system of the top-level window. If we're drawing into an
+ * off-screen graphics port this leads to alignment glitches.
+ */
+
+static void FillElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ Rect bounds = BoxToRect(d, b);
+ ThemeBrush brush = (state & TTK_STATE_BACKGROUND)
+ ? kThemeBrushModelessDialogBackgroundInactive
+ : kThemeBrushModelessDialogBackgroundActive;
+
+ BEGIN_DRAWING(d)
+ ChkErr(SetThemeBackground, brush, 32, true);
+ QDSetPatternOrigin(PatternOrigin(tkwin, d));
+ EraseRect(&bounds);
+ END_DRAWING
+}
+
+static void BackgroundElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, unsigned int state)
+{
+ FillElementDraw(
+ clientData, elementRecord, tkwin,
+ d, Ttk_WinBox(tkwin), state);
+}
+
+static Ttk_ElementSpec FillElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ TtkNullElementSize,
+ FillElementDraw
+};
+
+static Ttk_ElementSpec BackgroundElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ TtkNullElementSize,
+ BackgroundElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ ToolbarBackground element -- toolbar style for frames.
+ *
+ * This is very similar to the normal background element, but uses a
+ * different ThemeBrush in order to get the lighter pinstripe effect
+ * used in toolbars. We use SetThemeBackground() rather than
+ * ApplyThemeBackground() in order to get the right style.
+ *
+ * <URL: http://developer.apple.com/documentation/Carbon/Reference/
+ * Appearance_Manager/appearance_manager/constant_7.html#/
+ * /apple_ref/doc/uid/TP30000243/C005321>
+ *
+ */
+static void ToolbarBackgroundElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ ThemeBrush brush = kThemeBrushToolbarBackground;
+ Rect bounds = BoxToRect(d, Ttk_WinBox(tkwin));
+
+ BEGIN_DRAWING(d)
+ ChkErr(SetThemeBackground, brush, 32, true);
+ QDSetPatternOrigin(PatternOrigin(tkwin, d));
+ EraseRect(&bounds);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec ToolbarBackgroundElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ TtkNullElementSize,
+ ToolbarBackgroundElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Treeview header
+ * Redefine the header to use a kThemeListHeaderButton.
+ */
+
+static Ttk_StateTable TreeHeaderAdornmentTable[] = {
+ { kThemeAdornmentHeaderButtonSortUp, TTK_STATE_ALTERNATE, 0 },
+ { kThemeAdornmentFocus, TTK_STATE_FOCUS, 0 },
+ { kThemeAdornmentNone, 0, 0 }
+};
+
+static void TreeHeaderElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ ThemeButtonParms *parms = clientData;
+ Rect bounds = BoxToRect(d, b);
+ ThemeButtonDrawInfo info;
+
+ info.state = Ttk_StateTableLookup(ThemeStateTable, state);
+ info.value = Ttk_StateTableLookup(ButtonValueTable, state);
+ info.adornment = Ttk_StateTableLookup(TreeHeaderAdornmentTable, state);
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeButton, &bounds, parms->kind, &info, NULL, NULL, NULL, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec TreeHeaderElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ ButtonElementSizeNoPadding,
+ TreeHeaderElementDraw
+};
+
+/*
+ * Disclosure triangle:
+ */
+#define TTK_TREEVIEW_STATE_OPEN TTK_STATE_USER1
+#define TTK_TREEVIEW_STATE_LEAF TTK_STATE_USER2
+static Ttk_StateTable DisclosureValueTable[] = {
+ { kThemeDisclosureDown, TTK_TREEVIEW_STATE_OPEN, 0 },
+ { kThemeDisclosureRight, 0, 0 },
+};
+
+static void DisclosureElementSize(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+{
+ SInt32 s;
+
+ ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleWidth, &s);
+ *widthPtr = s;
+ ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleHeight, &s);
+ *heightPtr = s;
+}
+
+static void DisclosureElementDraw(
+ void *clientData, void *elementRecord, Tk_Window tkwin,
+ Drawable d, Ttk_Box b, Ttk_State state)
+{
+ Rect bounds = BoxToRect(d, b);
+ ThemeButtonDrawInfo info;
+
+ if (state & TTK_TREEVIEW_STATE_LEAF) {
+ return;
+ }
+
+ info.state = Ttk_StateTableLookup(ThemeStateTable, state);
+ info.value = Ttk_StateTableLookup(DisclosureValueTable, state);
+ info.adornment = kThemeAdornmentDrawIndicatorOnly;
+
+ BEGIN_DRAWING(d)
+ ChkErr(DrawThemeButton,
+ &bounds, kThemeDisclosureTriangle, &info, NULL, DontErase, NULL, 0);
+ END_DRAWING
+}
+
+static Ttk_ElementSpec DisclosureElementSpec = {
+ TK_STYLE_VERSION_2,
+ sizeof(NullElement),
+ TtkNullElementOptions,
+ DisclosureElementSize,
+ DisclosureElementDraw
+};
+
+/*----------------------------------------------------------------------
+ * +++ Widget layouts.
+ */
+
+TTK_BEGIN_LAYOUT_TABLE(LayoutTable)
+
+TTK_LAYOUT("Toolbar",
+ TTK_NODE("Toolbar.background", TTK_FILL_BOTH))
+
+TTK_LAYOUT("TButton",
+ TTK_GROUP("Button.button", TTK_FILL_BOTH,
+ TTK_GROUP("Button.padding", TTK_FILL_BOTH,
+ TTK_NODE("Button.label", TTK_FILL_BOTH))))
+
+TTK_LAYOUT("TRadiobutton",
+ TTK_GROUP("Radiobutton.button", TTK_FILL_BOTH,
+ TTK_GROUP("Radiobutton.padding", TTK_FILL_BOTH,
+ TTK_NODE("Radiobutton.label", TTK_PACK_LEFT))))
+
+TTK_LAYOUT("TCheckbutton",
+ TTK_GROUP("Checkbutton.button", TTK_FILL_BOTH,
+ TTK_GROUP("Checkbutton.padding", TTK_FILL_BOTH,
+ TTK_NODE("Checkbutton.label", TTK_PACK_LEFT))))
+
+TTK_LAYOUT("TMenubutton",
+ TTK_GROUP("Menubutton.button", TTK_FILL_BOTH,
+ TTK_GROUP("Menubutton.padding", TTK_FILL_BOTH,
+ TTK_NODE("Menubutton.label", TTK_PACK_LEFT))))
+
+TTK_LAYOUT("TCombobox",
+ TTK_GROUP("Combobox.button", TTK_PACK_TOP|TTK_FILL_X,
+ TTK_GROUP("Combobox.padding", TTK_FILL_BOTH,
+ TTK_NODE("Combobox.textarea", TTK_FILL_X))))
+
+/* Notebook tabs -- no focus ring */
+TTK_LAYOUT("Tab",
+ TTK_GROUP("Notebook.tab", TTK_FILL_BOTH,
+ TTK_GROUP("Notebook.padding", TTK_EXPAND|TTK_FILL_BOTH,
+ TTK_NODE("Notebook.label", TTK_EXPAND|TTK_FILL_BOTH))))
+
+/* Progress bars -- track only */
+TTK_LAYOUT("TSpinbox",
+ TTK_NODE("Spinbox.spinbutton", TTK_PACK_RIGHT|TTK_STICK_E)
+ TTK_GROUP("Spinbox.field", TTK_EXPAND|TTK_FILL_X,
+ TTK_NODE("Spinbox.textarea", TTK_EXPAND|TTK_FILL_X)))
+
+TTK_LAYOUT("TProgressbar",
+ TTK_NODE("Progressbar.track", TTK_EXPAND|TTK_FILL_BOTH))
+
+/* Tree heading -- no border, fixed height */
+TTK_LAYOUT("Heading",
+ TTK_NODE("Treeheading.cell", TTK_FILL_X)
+ TTK_NODE("Treeheading.image", TTK_PACK_RIGHT)
+ TTK_NODE("Treeheading.text", 0))
+
+/* Tree items -- omit focus ring */
+TTK_LAYOUT("Item",
+ TTK_GROUP("Treeitem.padding", TTK_FILL_BOTH,
+ TTK_NODE("Treeitem.indicator", TTK_PACK_LEFT)
+ TTK_NODE("Treeitem.image", TTK_PACK_LEFT)
+ TTK_NODE("Treeitem.text", TTK_PACK_LEFT)))
+
+TTK_END_LAYOUT_TABLE
+
+/*----------------------------------------------------------------------
+ * +++ Initialization.
+ */
+
+static int AquaTheme_Init(Tcl_Interp *interp)
+{
+ Ttk_Theme themePtr = Ttk_CreateTheme(interp, "aqua", NULL);
+
+ if (!themePtr) {
+ return TCL_ERROR;
+ }
+
+ /*
+ * Elements:
+ */
+ Ttk_RegisterElementSpec(themePtr, "background", &BackgroundElementSpec, 0);
+ Ttk_RegisterElementSpec(themePtr, "fill", &FillElementSpec, 0);
+ Ttk_RegisterElementSpec(themePtr, "Toolbar.background",
+ &ToolbarBackgroundElementSpec, 0);
+
+ Ttk_RegisterElementSpec(themePtr, "Button.button",
+ &ButtonElementSpec, &PushButtonParms);
+ Ttk_RegisterElementSpec(themePtr, "Checkbutton.button",
+ &ButtonElementSpec, &CheckBoxParms);
+ Ttk_RegisterElementSpec(themePtr, "Radiobutton.button",
+ &ButtonElementSpec, &RadioButtonParms);
+ Ttk_RegisterElementSpec(themePtr, "Toolbutton.border",
+ &ButtonElementSpec, &BevelButtonParms);
+ Ttk_RegisterElementSpec(themePtr, "Menubutton.button",
+ &ButtonElementSpec, &PopupButtonParms);
+ Ttk_RegisterElementSpec(themePtr, "Spinbox.spinbutton",
+ &SpinButtonElementSpec, 0);
+ Ttk_RegisterElementSpec(themePtr, "Combobox.button",
+ &ComboboxElementSpec, 0);
+ Ttk_RegisterElementSpec(themePtr, "Treeitem.indicator",
+ &DisclosureElementSpec, &DisclosureParms);
+ Ttk_RegisterElementSpec(themePtr, "Treeheading.cell",
+ &TreeHeaderElementSpec, &ListHeaderParms);
+
+ Ttk_RegisterElementSpec(themePtr, "Notebook.tab", &TabElementSpec, 0);
+ Ttk_RegisterElementSpec(themePtr, "Notebook.client", &PaneElementSpec, 0);
+
+ Ttk_RegisterElementSpec(themePtr, "Labelframe.border",&GroupElementSpec,0);
+ Ttk_RegisterElementSpec(themePtr, "Entry.field",&EntryElementSpec,0);
+ Ttk_RegisterElementSpec(themePtr, "Spinbox.field",&EntryElementSpec,0);
+
+ Ttk_RegisterElementSpec(themePtr, "separator",&SeparatorElementSpec,0);
+ Ttk_RegisterElementSpec(themePtr, "hseparator",&SeparatorElementSpec,0);
+ Ttk_RegisterElementSpec(themePtr, "vseparator",&SeparatorElementSpec,0);
+
+ Ttk_RegisterElementSpec(themePtr, "sizegrip",&SizegripElementSpec,0);
+
+ /*
+ * <<NOTE-TRACKS>>
+ * The Progressbar widget adjusts the size of the pbar element.
+ * In the Aqua theme, the appearance manager computes the bar geometry;
+ * we do all the drawing in the ".track" element and leave the .pbar out.
+ */
+ Ttk_RegisterElementSpec(themePtr,"Scale.trough",
+ &TrackElementSpec, &ScaleData);
+ Ttk_RegisterElementSpec(themePtr,"Scale.slider",&SliderElementSpec,0);
+ Ttk_RegisterElementSpec(themePtr,"Progressbar.track", &PbarElementSpec, 0);
+
+ /*
+ * Layouts:
+ */
+ Ttk_RegisterLayouts(themePtr, LayoutTable);
+
+ Tcl_PkgProvide(interp, "ttk::theme::aqua", TTK_VERSION);
+ return TCL_OK;
+}
+
+MODULE_SCOPE
+int Ttk_MacOSXPlatformInit(Tcl_Interp *interp)
+{
+ return AquaTheme_Init(interp);
+}
+
diff --git a/changes b/changes
index e3a96be..84c46e9 100644
--- a/changes
+++ b/changes
@@ -6500,12 +6500,23 @@ Several documentation and release notes improvements
--- Released 8.5.2, March 28, 2008 --- See ChangeLog for details ---
+2008-04-01 (interface)[1819422] tkStubsPtr no longer in libtk (porter)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2008-04-02 (interface)[1819422] libtkstub symbols MODULE_SCOPE (steffen)
+
2008-04-07 (bug fix)[1937135] Tk_ParseArgv() double free crash (hobbs)
2008-04-07 (bug fix)[1936238] wish -h mem explosion (bachmann,kenny)
+2008-04-08 (new feature) Win: visual-styles API element engine (thoyts)
+
+2008-04-09 (enhancement) real LZW compression in GIF writer (nijtmans)
+
2008-04-14 (bug fix)[1941740] [tk_chooseColor -title] (thoyts)
+2008-04-16 (interface)[1938497] make stubs tables 'static const' (steffen)
+
2008-04-17 (bug fix)[1327482] canvas item <Enter> events (wangnick)
2008-05-23 (bug fix)[1967576] ttk::label height or width 0 panic (lawlor)
@@ -6516,12 +6527,17 @@ Several documentation and release notes improvements
2008-06-12 (platform support) Solaris/amd64 gcc 64bit support (steffen)
+2008-06-13 (new feature)[TIP 285] [tkwait] and [update] are now
+[interp cancel]able (mistachkin)
+
2008-06-18 (bug fix) Aqua: missing focus on first map (steffen)
---- Released 8.5.3, June 30, 2008 --- See ChangeLog for details ---
+--- Released 8.6a1, June 25, 2008 --- See ChangeLog for details ---
2008-07-04 (bug fix)[2009213] crash in [ttk::scale] (polo,english)
+2008-07-24 (bug fix)[2021443] consistent "wrong # args" messages (nijtmans)
+
2008-07-26 (bug fix)[2026405] portability of [winfo id] (uchida,thoyts)
2008-07-31 (bug fix) export Tk_PkgInitStubsCheck; fixes Tk embed on Windows
@@ -6531,12 +6547,15 @@ Several documentation and release notes improvements
2008-08-05 (bug fix)[2010422] Tk header files revised to accommodate
incompatible changes in recent X.org releases of X11 headers. (jenglish)
---- Released 8.5.4, August 15, 2008 --- See ChangeLog for details ---
+2008-08-19 (bug fix) revised number format in -[xy]scrollcommand callbacks
+and [xy]view methods (jenglish)
+ *** POTENTIAL INCOMPATIBILITY ***
-2008-08-19 (behavior change) arguments passed to -[xy]scrollcommand
-callbacks, and values returned by [xy]view methods are explicitly
-formatted as doubles. (english)
- *** POTENTIAL INCOMPATIBILITY ***
+2008-08-19 (enhancement) removed obsolete XID management code (staplin)
+
+Test suite modernization by Ania Pawelczyk.
+
+--- Released 8.6a2, August 25, 2008 --- See ChangeLog for details ---
2008-08-25 (bug fix)[1936220] fix [tk_getOpenFile -multiple 1] on unix (helfter)
@@ -6544,48 +6563,100 @@ formatted as doubles. (english)
2008-08-28 (bug fix) correct TK_LIBS value to include Xft (porter)
+2008-09-03 (support) Dropped support for pre-ANSI compilers. (porter)
+
+2008-10-01 (new feature)[TIP 236] [$canvas moveto] (mckay,fellows)
+
2008-10-05 (bug fix)[2112563] format double values explicitly in double
format, avoiding sensitivity to locale setting. (fellows)
- *** POTENTIAL INCOMPATIBILITY ***
-
-2008-10-10 (bug fix)[1894038] [package require] any Tk 8.5.* in any Tcl 8.5.*
-(porter)
+ *** POTENTIAL INCOMPATIBILITY ***
---- Released 8.5.5, October 15, 2008 --- See ChangeLog for details ---
+--- Released 8.6a3, October 10, 2008 --- See ChangeLog for details ---
2008-10-17 (enhancement) keyboard bindings for ttk::scale (thoyts)
+2008-10-18 (bug fix)[1825353] Russian Windows tiny fonts problem (thoyts)
+
+2008-10-18 (new feature)[TIP 321] [tk busy] (decoster,fellows)
+
+2008-10-28 (bug fix)[1534835,2054562] use of more correct cursors (english)
+
+2008-11-01 (new feature) New [ttk::spinbox] widget (thoyts)
+
+2008-11-01 (new feature)[TIP 97] [$canvas imove] [$canvas rchars] (fellows)
+
+2008-11-09 (bug fix)[2207435] [ttk::entry .t -textvar ::noexist::x] (english)
+
+2008-11-11 (bug fix)[2312027] Tk_Create*ImageType() thread safety (nijtmans)
+
+2008-11-11 (bug fix)[2264732] crash using nondefault visual (english)
+
2008-11-12 (bug fix)[1777362] permit [text] names containing "-" (thoyts)
-2008-11-15 (bug fix)[2239034] limit [wm manage] to Frames (thoyts)
+2008-11-14 (bug fix)[2239034] limit [wm manage] to Frames (thoyts)
-2008-11-19 (bug fix)[2312027] Tk_Create*ImageType() thread safety (nijtmans)
+2008-11-22 (new feature)[TIP 119] -angle option for canvas text items (fellows)
2008-11-22 (bug fix)[1939129,1991930] combobox behind other windows (thoyts)
-2008-12-22 (bug fix)[1813597,2218964] eliminate unnecessary units conversion
+2008-11-22 (new feature) Demo ctext.tcl now demos angled text (fellows)
+
+2008-11-23 (bug fix)[1389270] made [event generate <Focus*>] work (thoyts)
+
+2008-11-28 (bug fix)[1813597,2218964] eliminate unnecessary units conversion
in screen distances, reducing precision loss (ferrieux)
-2008-12-22 (bug fix)[2107938] no negative font size in PS (fellows)
+2008-12-03 (enhancement) new "hover" state for proper Vista visuals (thoyts)
+
+2008-12-05 (bug fix)[2107938] no negative font size in PS (fellows)
+
+2008-12-05 (enhancement) new "vista" theme (thoyts)
+
+2008-12-06 (new feature)[TIP 197] [$text -insertunfocussed] (edwards,fellows)
+
+2008-12-06 (new feature)[TIP 337] handle non-error bg exceptions (porter)
-2008-12-22 (bug fix)[2264732] crash using nondefault visual (english)
+2008-12-10 (new feature)[TIP 324] [tk fontchooser](thoyts,vetter,robert,steffen)
-2008-12-22 (bug fix)[2207435] [ttk::entry .t -textvar ::noexist::x] (english)
+2008-12-12 (new feature) Demo fontchoose.tcl demos [tk fontchooser] (thoyts)
+
+2008-12-18 (enhancement)[24442309] Updated German messages (haertel)
+
+--- Released 8.6b1, December 19, 2008 --- See ChangeLog for details ---
+
+2008-12-27 (bug fix)[2381555] horiz. scroll [$treeview identify] (english)
+
+2008-12-28 (new feature)[TIP 244] PNG photo format support (fellows)
+
+2008-12-28 (new feature)[TIP 171] <MouseWheel> event handling (fellows)
+ *** POTENTIAL INCOMPATIBILITY ***
---- Released 8.5.6, December 23, 2008 --- See ChangeLog for details ---
+2008-12-31 (bug fix)[2003310] radio|check button indicator color (english)
+
+2009-01-06 (bug fix)[2484771] messagebox: system to task modal (ferrieux,thoyts,mjanssen)
+
+2009-01-06 (enhancement)[1539990] optimize photo building (jepler)
+
+2009-01-07 (bug fix)[2473120] chooseDir syntax error (bron)
2009-01-07 (bug fix)[1847002] Win: prevent grab bypass (thoyts)
+2009-01-11 (bug fix)[2496162] crash calling Tk_DeleteOptionTable() (english)
+
2009-01-11 (bug fix) crash on XCreateIC failure (staplin)
2009-01-14 (bug fix)[2507326] Restore aMSN compat (nijtmans)
-2009-01-19 (new feature) CONFIG_INSTALL_DIR - where tclConfig.sh goes (cassoff)
+2009-01-19 (new feature) CONFIG_INSTALL_DIR - where tkConfig.sh goes (cassoff)
2009-01-19 (platform support) better tools for BSD ports (cassoff)
+2009-02-08 (bug fix)[2431428] panic computing layout on active widget (english)
+
2009-02-17 (platform support) MSVC and _WIN64 (hobbs)
+2009-02-21 (bug fix)[2546087] [console] display of true UTF-8 \0 (thoyts)
+
2009-02-23 (bug fix)[1329198,456299,2507419] menu image display (mcdonald)
2009-02-23 (bug fix)[2513104] fix cursor hotspots (mcdonald)
@@ -6594,13 +6665,23 @@ in screen distances, reducing precision loss (ferrieux)
2009-02-27 (bug fix)[2645457] crash in Tk_MakeWindowExist() (thoyts)
+2009-03-09 (bug fix)[2548661] crash in GetFontFamilyName (riefenstahl)
+
2009-03-25 (bug fix)[2178820] stop zero-size allocs in ttk (fellows)
2009-03-25 (bug fix)[1871101] blurry large fonts on Vista (garvey,fellows)
+2009-04-03 (bug fix)[1789819] stop panic on unexpected wm stack order (english)
+
2009-04-10 (bug fix)[2116837] std virtual events with Caps Lock (fellows)
---- Released 8.5.7, April 15, 2009 --- See ChangeLog for details ---
+2009-04-10 (platform) sse Darwin SUSv3 extensions if available (steffen)
+
+2009-04-10 (bug fix) Motif checkbutton on X11 only (steffen)
+
+2009-04-10 (bug fix) remove TkAqua Quit menu item on [console] (steffen)
+
+2009-04-10 (bug fix) crash deleting char range from [text] (steffen)
2009-04-23 (bug fix)[2779910] updated Win chooseDir (hobbs)
@@ -6610,6 +6691,8 @@ in screen distances, reducing precision loss (ferrieux)
2009-04-30 (bug fix)[2504402] iconphoto on non-32-bit displays (mcdonald,thoyts)
+2009-05-01 (bug fix)[2777019] anchor for text rotation (gavilan,fellows)
+
2009-05-03 (bug fix)[2785744] broken flag twiddling (baker,fellows)
2009-05-13 (bug fix)[2791352] XLFD parsing error (thoyts)
@@ -6618,20 +6701,42 @@ in screen distances, reducing precision loss (ferrieux)
2009-05-14 (bug fix)[1923684] confused checkbutton state (thoyts)
+2009-05-17 (new feature)[1470246] notebook tab orientation control (english)
+
2009-05-21 (bug fix)[2794778] Win menu keyboard traversal (thoyts)
2009-06-02 (bug fix)[2799589] crash on delayed window activation (thoyts)
2009-06-23 (bug fix)[220935] canvas dash update problem (nijtmans)
+2009-06-23 (platform) new subdir 'carbon' preserved for OSX 10.4-
+use --enable-aqua=carbon option to unix/configure to enable (steffen)
+
+2009-06-29 (new feature) source in `macosx` now built on Cocoa (steffen)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2009-06-30 (platform support) clang static analyzer macros (steffen)
+
2009-07-15 (bug fix)[2821962] photo image copy/paste (rib,fellows)
+2009-07-21 (bug fix)[2356057] rotated underlined text (fellows)
+
2009-07-22 (bug fix)[2496114] focus in dead window crash (griffin,fellows)
+2009-07-23 (bug fix)[2441988] report errors in selection handlers (fellows)
+ *** POTENTIAL INCOMPATIBILITY ***
+
2009-08-01 (bug fix)[2830420] X iconphoto for big endian (misch,fellows)
2009-08-04 (bug fix) [text] word-wrap of non-breaking space (fellows)
+2009-08-14 (bug fix) copy from unmapped toplevel crash (alaoui,steffen)
+
+2009-08-19 (bug fix)[2475855] prevent grid & pack on same master (spjuth)
+
+2009-08-24 (bug fix)[2821084] Cocoa: let WM_DELETE_WINDOW handler stop window
+deletion (walzer,steffen)
+
2009-08-24 (bug fix) tk::MessageBox bindings for ttk::buttons (steiner,fellows)
2009-08-25 (bug fix)[1909931] [send] update for Fedora 8 (fellows)
@@ -6652,13 +6757,13 @@ in screen distances, reducing precision loss (ferrieux)
2009-10-10 (feature)[1961455] underline, overstrike Xft fonts (caffin,fellows)
-2009-10-15 (feature)[2794032] permit [load] into Tcl 8.6+ interps (porter)
+2009-10-20 (enhancement) Updates to Polish messages (pawlak)
2009-10-22 (bug fix)[2168768] file dialog -typevariable scope (danckaert)
2009-10-22 (bug fix)[1469210] [text] modified error (danckaert)
-2009-10-24 (bug fix)[2883712] 64-bit Aqua progress bar (haffner)
+2009-10-22 (bug fix)[2883712] 64-bit Aqua progress bar (haffner)
2009-10-24 (bug fix)[1530276] X checkbutton -selectcolor (danckaert)
@@ -6668,36 +6773,39 @@ in screen distances, reducing precision loss (ferrieux)
2009-10-29 (bug fix)[1825353] Russian Windows tiny fonts problem (thoyts)
-2009-11-03 (bug fix)[2891541] fix grab behaviour for main window (thoyts)
+2009-11-01 (new feature) Ttk: [$w identify] now an ensemble (jenglish)
---- Released 8.5.8, November 16, 2009 --- See ChangeLog for details ---
+2009-11-19 (bug fix)[2899685] fix [imove] redraw logic (schekin,ferrieux)
2009-11-22 (bug fix)[2899949] crash on widget destroy (meier,thoyts)
-2009-11-24 (bug fix)[2902814] fix [wm iconphoto] on LP64 systems (fellows)
-
-2009-12-06 (bug fix)[2548661] crash in GetFontFamilyName (riefenstahl)
+2009-11-23 (bug fix)[2902573] Update Safe Tk to new Safe Base (kurpies)
-2009-12-06 (bug fix)[2864685] Compiz menu item animation (gavilan,thoyts)
+2009-11-24 (bug fix)[2902814] fix [wm iconphoto] on LP64 systems (fellows)
-2009-12-09 (bug fix)[2902573] Update Safe Tk to new Safe Base (kurpies)
+2009-12-08 (bug fix)[2864685] Compiz menu item animation (gavilan,thoyts)
2009-12-11 (bug fix)[2912473] accept :: in DISPLAY name (fellows)
-2009-12-16 (bug fix)[2496162] crash calling Tk_DeleteOptionTable() (english)
-
+2009-12-15 (bug fix)[2492179] Tcl_ObjType "option" no longer registered (porter)
+ *** POTENTIAL INCOMPATIBILITY for Tcl_GetObjType("option") ***
+
2009-12-20 (bug fix)[2917663] [send] accept SI:* on auth list (fellows)
-2009-12-22 (bug fix)[2919205] syntax bug in [tk_messageBox] (zaroo)
-
2009-12-22 (bug fix)[2912356] [ttk::sizegrip] accommodate Compiz (english)
+2009-12-25 (bug fix)[2977688,2546779] tab selection focus (english)
+
2009-12-27 (bug fix)[2879927] Win: cascade menu highlight (pawlak,thoyts)
2010-01-01 (bug fix)[1924761] stop [event generate] / XIM conflict (fellows)
2010-01-03 (bug fix)[2848897] ODS_NOACCEL flag support (kovalenko,thoyts)
+2010-01-04 (bug fix)[2811266] <Return> binding in [tk_dialog] (thoyts)
+
+2010-01-04 (bug fix)[2727476] font dialog appearance (thoyts)
+
2010-01-05 (bug fix)[220950] [$menu delete] bounds check (fellows)
2010-01-05 [2898255] unlimited multi-file select (pawlak,fellows,thoyts)
@@ -6708,44 +6816,93 @@ in screen distances, reducing precision loss (ferrieux)
2010-01-18 (bug fix)[2932808] canvas update on state change (mcdonald,nijtmans)
-2010-01-19 (bug fix)[2931374] overflow in complex tag search (schmitz)
-
2010-01-19 (new feature)[TIP 359] Extended Window Manager Hint Support (thoyts)
+2010-01-19 (bug fix)[2931374] overflow in complex tag search (schmitz)
+
2010-02-17 (bug fix)[2952745] crash in menu deletion (english)
+2010-02-20 (performance) treeview stop quadratic common case (english)
+
+2010-03-02 (enhancement) -fvisibility-hidden build support (nijtmans)
+
+2010-03-06 (bug fix)[2949774] cascade menu unpost (thoyts)
+
2010-03-11 (bug fix)[2968379] crash in peer text dump (fellows)
+2010-03-17 (bug fix)[2971663] Cocoa entry <Up>, <Down> (goddard,fellows)
+
+2010-03-28 (new feature) [$treeview tag names|add|remove] (english)
+
+2010-04-09 (new feature)[2983824] [$image write -file] use extension of file
+name to select image format (fellows)
+
+2010-04-19 [2898255] unlimited multi-file select (pawlak,fellows,thoyts)
+
2010-05-31 (bug fix)[3006842] crash on empty bind scripts (english)
+2010-06-15 (bug fix)[2585265] text <Delete>,<Backspace> note selection (fellows)
+
+2010-06-15 (new package)[3016598] Tk now provides "tile 0.8.6" (english)
+
+2010-07-19 (new feature) [$photo data -format GIF] (fellows)
+
2010-08-03 (bug fix) entry validation compat with Itcl scope (hobbs)
-2010-08-12 (bug fix)[2585265] text <Delete>,<Backspace> note selection (fellows)
+2010-08-11 (platform) Drop pre-aix 4.2 support, ldAix (hobbs)
+
+2010-08-21 (patch)[3034251] genStubs steal features of ttkGenStubs (nijtmans)
-2010-08-25 (feature)[3053320] update Ttk to tile 0.8.6 feature set (hobbs)
+2010-08-26 (bug fix)[1230554] configure, OSF-1 problems, windows manifest issues (hobbs)
---- Released 8.5.9, September 6, 2010 --- See ChangeLog for details ---
+2010-08-31 fixed manifest handling on windows (hobbs, kupries)
2010-09-02 (bug fix)[3057573] specify combobox text fg color (english)
+2010-09-05 (enhancement)[3046742,3046750] Improved error dialog UI (fellows)
+
2010-09-08 (bug fix)[2829363] [$tv see] open item -> sched display (english)
+2010-09-13 (platform) limit support to Win2000+ (nijtmans)
+
+2010-10-01 (bug fix)[3078902] no hang operating on zero-size subimages (fellows)
+
+2010-10-05 (bug fix)[3080953] corrupt multibyte char in %A subst (nijtmans)
+
2010-10-11 (bug fix)[3085489] crash in [tag add/remove] (english)
-2010-11-04 (enhancement) Updated German messages. (haertel,nijtmans)
+2010-10-11 (enhancement)[491789] Unicode command line support on Win (nijtmans)
+
+2010-11-03 windows build with -UNICODE (nijtmans)
+
+2010-11-05 Message catalogs reworked to use unicode copyright char (nijtmans)
+
+2010-11-06 Message catalogs resorted, updates to NL (nijtmans)
2010-11-16 (platform) VS 2005 SP1 MSVC compiler (nijtmans)
2010-11-24 (bug fix)[3071836] crash in tk_getSaveFile (twylite)
+2010-12-03 (enhancement)[3116490] mingw x-compile improvements (nijtmans)
+
2010-12-12 (platform) OpenBSD build improvements (cassoff)
2010-12-17 (platform) Revisions to support rpm 4.4.2 (cassoff)
+2011-01-06 (bug fix)[2857300] Cocoa: correct text width rounding (walzer)
+
+2011-01-06 (bug fix)[3086887] Cocoa: textured bg windows (walzer)
+
2011-01-13 (bug fix)[3154705] tk_messageBox close button disabled (skylera)
2011-01-22 (enhancement) add [ttk::entry validate] (schelte,english)
+2011-01-24 (bug fix)[2907388] OSX: composite character entry crash (berg,walzer)
+
+2011-03-02 (new doc) tk_mac.n: OS X specific functions (walzer)
+
+2011-03-03 (bug fix)[3175610] incomplete line item refresh (ferrieux)
+
2011-03-10 (bug fix)[3205260] crash in [wm manage] (boudaillier, thoyts)
2011-03-16 (bug fix)[3181181] tearoff submenu fix (menez, thoyts)
@@ -6767,24 +6924,20 @@ in screen distances, reducing precision loss (ferrieux)
2011-04-22 (bug fix)[3291543] mem corrupt when [$canvas dchars] removes all
coords of a polygon (rogers,spjuth)
-2011-04-30 (bug fix)[2949774] cascade menu unpost (thoyts)
+2011-04-29 (platform support) [wm forget|manage] on OS X (walzer)
2011-06-06 (bug fix)[2546087] [console] treatment of '\0' (porter)
2011-06-07 (bug fix)[2358545] Restore "08" in spinbox configured with -from
and -to (porter)
-2011-06-07 (bug fix)[2484771] modal dialog settings (hoff, thoyts)
-
-2011-06-10 (bug fix)[3175610] incomplete line item refresh (ferrieux)
+2011-06-10 (bug fix)[3315731] fix [$entry -invcmd] (porter)
2011-06-17 (bug fix)[3062331] crash in unset traces (macdonald,porter)
---- Released 8.5.10, June 23, 2011 --- See ChangeLog for details ---
-
-2011-06-29 (bug fix)[3341056] new crash in unset traces (militaru,porter)
+2011-08-03 (bug fix)[2891541] fix grab behaviour for main window (thoyts)
-2011-08-03 (bug fix)[3314770] restore file dialog resizeability (nijtmans)
+--- Released 8.6b2, August 8, 2011 --- See ChangeLog for details ---
2011-09-22 (bug fix)[3404541] -takefocus option (dzach,english)
@@ -6792,6 +6945,4 @@ and -to (porter)
2011-10-25 (bug fix)[3410609] AltGr keysyms on Swiss keyboard (tasser,kenny)
-2011-11-02 (performance)[3431491] improved "pixels" shimmer logic (fellows)
-
---- Released 8.5.11, November 4, 2011 --- See ChangeLog for details ---
+--- Released 8.6b3, November 20, 2011 --- See ChangeLog for details ---
diff --git a/compat/stdlib.h b/compat/stdlib.h
index 4d1a386..2c64890 100644
--- a/compat/stdlib.h
+++ b/compat/stdlib.h
@@ -1,43 +1,40 @@
/*
* stdlib.h --
*
- * Declares facilities exported by the "stdlib" portion of
- * the C library. This file isn't complete in the ANSI-C
- * sense; it only declares things that are needed by Tcl.
- * This file is needed even on many systems with their own
- * stdlib.h (e.g. SunOS) because not all stdlib.h files
- * declare all the procedures needed here (such as strtod).
+ * Declares facilities exported by the "stdlib" portion of the C library.
+ * This file isn't complete in the ANSI-C sense; it only declares things
+ * that are needed by Tk. This file is needed even on many systems with
+ * their own stdlib.h (e.g. SunOS) because not all stdlib.h files declare
+ * all the procedures needed here (such as strtod).
*
* Copyright (c) 1991 The Regents of the University of California.
* Copyright (c) 1994-1998 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _STDLIB
#define _STDLIB
-#include <tcl.h>
+#ifndef _TCL
+# include <tcl.h>
+#endif
-extern void abort _ANSI_ARGS_((void));
-extern double atof _ANSI_ARGS_((CONST char *string));
-extern int atoi _ANSI_ARGS_((CONST char *string));
-extern long atol _ANSI_ARGS_((CONST char *string));
-extern char * calloc _ANSI_ARGS_((unsigned int numElements,
- unsigned int size));
-extern void exit _ANSI_ARGS_((int status));
-extern int free _ANSI_ARGS_((char *blockPtr));
-extern char * getenv _ANSI_ARGS_((CONST char *name));
-extern char * malloc _ANSI_ARGS_((unsigned int numBytes));
-extern void qsort _ANSI_ARGS_((VOID *base, int n, int size,
- int (*compar)(CONST VOID *element1, CONST VOID
- *element2)));
-extern char * realloc _ANSI_ARGS_((char *ptr, unsigned int numBytes));
-extern double strtod _ANSI_ARGS_((CONST char *string, char **endPtr));
-extern long strtol _ANSI_ARGS_((CONST char *string, char **endPtr,
- int base));
-extern unsigned long strtoul _ANSI_ARGS_((CONST char *string,
- char **endPtr, int base));
+extern void abort(void);
+extern double atof(const char *string);
+extern int atoi(const char *string);
+extern long atol(const char *string);
+extern char * calloc(unsigned int numElements, unsigned int size);
+extern void exit(int status);
+extern int free(char *blockPtr);
+extern char * getenv(const char *name);
+extern char * malloc(unsigned int numBytes);
+extern void qsort(void *base, int n, int size, int (*compar)(
+ const void *element1, const void *element2));
+extern char * realloc(char *ptr, unsigned int numBytes);
+extern double strtod(const char *string, char **endPtr);
+extern long strtol(const char *string, char **endPtr, int base);
+extern unsigned long strtoul(const char *string, char **endPtr, int base);
#endif /* _STDLIB */
diff --git a/compat/unistd.h b/compat/unistd.h
index 1a40e90..9064b06 100644
--- a/compat/unistd.h
+++ b/compat/unistd.h
@@ -1,16 +1,14 @@
/*
* unistd.h --
*
- * Macros, CONSTants and prototypes for Posix conformance.
+ * Macros, constants and prototypes for Posix conformance.
*
- * Copyright 1989 Regents of the University of California
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies. The University of California
- * makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without
- * express or implied warranty.
+ * Copyright 1989 Regents of the University of California Permission to use,
+ * copy, modify, and distribute this software and its documentation for any
+ * purpose and without fee is hereby granted, provided that the above
+ * copyright notice appear in all copies. The University of California makes
+ * no representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
*/
#ifndef _UNISTD
@@ -18,7 +16,7 @@
#include <sys/types.h>
#ifndef _TCL
-# include "tcl.h"
+# include <tcl.h>
#endif
#ifndef NULL
@@ -26,56 +24,56 @@
#endif
/*
- * Strict POSIX stuff goes here. Extensions go down below, in the
- * ifndef _POSIX_SOURCE section.
+ * Strict POSIX stuff goes here. Extensions go down below, in the ifndef
+ * _POSIX_SOURCE section.
*/
-extern void _exit _ANSI_ARGS_((int status));
-extern int access _ANSI_ARGS_((CONST char *path, int mode));
-extern int chdir _ANSI_ARGS_((CONST char *path));
-extern int chown _ANSI_ARGS_((CONST char *path, uid_t owner, gid_t group));
-extern int close _ANSI_ARGS_((int fd));
-extern int dup _ANSI_ARGS_((int oldfd));
-extern int dup2 _ANSI_ARGS_((int oldfd, int newfd));
-extern int execl _ANSI_ARGS_((CONST char *path, ...));
-extern int execle _ANSI_ARGS_((CONST char *path, ...));
-extern int execlp _ANSI_ARGS_((CONST char *file, ...));
-extern int execv _ANSI_ARGS_((CONST char *path, char **argv));
-extern int execve _ANSI_ARGS_((CONST char *path, char **argv, char **envp));
-extern int execvp _ANSI_ARGS_((CONST char *file, char **argv));
-extern pid_t fork _ANSI_ARGS_((void));
-extern char *getcwd _ANSI_ARGS_((char *buf, size_t size));
-extern gid_t getegid _ANSI_ARGS_((void));
-extern uid_t geteuid _ANSI_ARGS_((void));
-extern gid_t getgid _ANSI_ARGS_((void));
-extern int getgroups _ANSI_ARGS_((int bufSize, int *buffer));
-extern pid_t getpid _ANSI_ARGS_((void));
-extern uid_t getuid _ANSI_ARGS_((void));
-extern int isatty _ANSI_ARGS_((int fd));
-extern long lseek _ANSI_ARGS_((int fd, long offset, int whence));
-extern int pipe _ANSI_ARGS_((int *fildes));
-extern int read _ANSI_ARGS_((int fd, char *buf, size_t size));
-extern int setgid _ANSI_ARGS_((gid_t group));
-extern int setuid _ANSI_ARGS_((uid_t user));
-extern unsigned sleep _ANSI_ARGS_ ((unsigned seconds));
-extern char *ttyname _ANSI_ARGS_((int fd));
-extern int unlink _ANSI_ARGS_((CONST char *path));
-extern int write _ANSI_ARGS_((int fd, CONST char *buf, size_t size));
+extern void _exit(int status);
+extern int access(const char *path, int mode);
+extern int chdir(const char *path);
+extern int chown(const char *path, uid_t owner, gid_t group);
+extern int close(int fd);
+extern int dup(int oldfd);
+extern int dup2(int oldfd, int newfd);
+extern int execl(const char *path, ...);
+extern int execle(const char *path, ...);
+extern int execlp(const char *file, ...);
+extern int execv(const char *path, char **argv);
+extern int execve(const char *path, char **argv, char **envp);
+extern int execvp(const char *file, char **argv);
+extern pid_t fork(void);
+extern char * getcwd(char *buf, size_t size);
+extern gid_t getegid(void);
+extern uid_t geteuid(void);
+extern gid_t getgid(void);
+extern int getgroups(int bufSize, int *buffer);
+extern pid_t getpid(void);
+extern uid_t getuid(void);
+extern int isatty(int fd);
+extern long lseek(int fd, long offset, int whence);
+extern int pipe(int *fildes);
+extern int read(int fd, char *buf, size_t size);
+extern int setgid(gid_t group);
+extern int setuid(uid_t user);
+extern unsigned sleep(unsigned seconds);
+extern char * ttyname(int fd);
+extern int unlink(const char *path);
+extern int write(int fd, const char *buf, size_t size);
#ifndef _POSIX_SOURCE
-extern char *crypt _ANSI_ARGS_((CONST char *, CONST char *));
-extern int fchown _ANSI_ARGS_((int fd, uid_t owner, gid_t group));
-extern int flock _ANSI_ARGS_((int fd, int operation));
-extern int ftruncate _ANSI_ARGS_((int fd, unsigned long length));
-extern int ioctl _ANSI_ARGS_((int fd, int request, ...));
-extern int readlink _ANSI_ARGS_((CONST char *path, char *buf, int bufsize));
-extern int setegid _ANSI_ARGS_((gid_t group));
-extern int seteuid _ANSI_ARGS_((uid_t user));
-extern int setreuid _ANSI_ARGS_((int ruid, int euid));
-extern int symlink _ANSI_ARGS_((CONST char *, CONST char *));
-extern int ttyslot _ANSI_ARGS_((void));
-extern int truncate _ANSI_ARGS_((CONST char *path, unsigned long length));
-extern int vfork _ANSI_ARGS_((void));
+extern char * crypt(const char *, const char *);
+extern int fchown(int fd, uid_t owner, gid_t group);
+extern int flock(int fd, int operation);
+extern int ftruncate(int fd, unsigned long length);
+extern int ioctl(int fd, int request, ...);
+extern int readlink(const char *path, char *buf, int bufsize);
+extern int setegid(gid_t group);
+extern int seteuid(uid_t user);
+extern int setreuid(int ruid, int euid);
+extern int symlink(const char *, const char *);
+extern int ttyslot(void);
+extern int truncate(const char *path, unsigned long length);
+extern int vfork(void);
#endif /* _POSIX_SOURCE */
#endif /* _UNISTD */
diff --git a/doc/3DBorder.3 b/doc/3DBorder.3
index 01b359b..ba0881b 100644
--- a/doc/3DBorder.3
+++ b/doc/3DBorder.3
@@ -134,7 +134,6 @@ it forms the bottom side.
Specifies which of the border's graphics contexts is desired.
Must be \fBTK_3D_FLAT_GC\fR, \fBTK_3D_LIGHT_GC\fR, or \fBTK_3D_DARK_GC\fR.
.BE
-
.SH DESCRIPTION
.PP
These procedures provide facilities for drawing window borders in a
@@ -153,7 +152,8 @@ darker than \fIobjPtr\fR.
\fBTk_Alloc3DBorderFromObj\fR returns a token that may be used in later calls
to \fBTk_Draw3DRectangle\fR. If an error occurs in allocating information
for the border (e.g. a bogus color name was given)
-then NULL is returned and an error message is left in \fIinterp->result\fR.
+then NULL is returned and an error message is left as the result of
+interpreter \fIinterp\fR.
If it returns successfully, \fBTk_Alloc3DBorderFromObj\fR caches
information about the return value in \fIobjPtr\fR, which speeds up
future calls to \fBTk_Alloc3DBorderFromObj\fR with the same \fIobjPtr\fR
@@ -290,6 +290,5 @@ with the Tk_3DBorder token for the border.
There should be exactly one call to \fBTk_Free3DBorderFromObj\fR or
\fBTk_Free3DBorder\fR for each call to \fBTk_Alloc3DBorderFromObj\fR
or \fBTk_Get3DBorder\fR.
-
.SH KEYWORDS
3D, background, border, color, depressed, illumination, object, polygon, raised, shadow, three-dimensional effect
diff --git a/doc/AddOption.3 b/doc/AddOption.3
index 09a6d9e..fe6107b 100644
--- a/doc/AddOption.3
+++ b/doc/AddOption.3
@@ -23,7 +23,6 @@ Value of option.
.AP int priority in
Overall priority level to use for option.
.BE
-
.SH DESCRIPTION
.PP
This procedure is invoked to add an option to the database
@@ -47,6 +46,5 @@ user-specific startup files.
.IP 80
Used for options specified interactively after the application starts
running.
-
.SH KEYWORDS
class, name, option, add
diff --git a/doc/BindTable.3 b/doc/BindTable.3
index 223c37b..24f8af5 100644
--- a/doc/BindTable.3
+++ b/doc/BindTable.3
@@ -45,7 +45,7 @@ call to \fBTk_CreateBindingTable\fR.
Identifies object with which binding is associated.
.AP "const char" *eventString in
String describing event sequence.
-.AP char *script in
+.AP "const char" *script in
Tcl script to invoke when binding triggers.
.AP int append in
Non-zero means append \fIscript\fR to existing script for binding,
@@ -61,7 +61,6 @@ Number of object identifiers pointed to by \fIobjectPtr\fR.
Points to an array of object identifiers: bindings will be considered
for each of these objects in order from first to last.
.BE
-
.SH DESCRIPTION
.PP
These procedures provide a general-purpose mechanism for creating
@@ -112,25 +111,25 @@ select relevant events, or to disallow the use of certain events
in bindings.
If an error occurred while creating the binding (e.g., \fIeventString\fR
refers to a non-existent event), then 0 is returned and an error
-message is left in \fIinterp->result\fR.
+message is left as the result of interpreter \fIinterp\fR.
.PP
\fBTk_DeleteBinding\fR removes from \fIbindingTable\fR the
binding given by \fIobject\fR and \fIeventString\fR, if
such a binding exists.
\fBTk_DeleteBinding\fR always returns \fBTCL_OK\fR.
-In some cases it may reset \fIinterp->result\fR to the default
+In some cases it may reset the interpreter result to the default
empty value.
.PP
\fBTk_GetBinding\fR returns a pointer to the script associated
with \fIeventString\fR and \fIobject\fR in \fIbindingTable\fR.
If no such binding exists then NULL is returned and an error
-message is left in \fIinterp->result\fR.
+message is left as the result of interpreter \fIinterp\fR.
.PP
-\fBTk_GetAllBindings\fR returns in \fIinterp->result\fR a list
+\fBTk_GetAllBindings\fR returns in \fIinterp\fR's result a list
of all the event strings for which there are bindings in
\fIbindingTable\fR associated with \fIobject\fR.
-If there are no bindings for \fIobject\fR then an empty
-string is returned in \fIinterp->result\fR.
+If there are no bindings for \fIobject\fR, the result will be an empty
+string.
.PP
\fBTk_DeleteAllBindings\fR deletes all of the bindings in
\fIbindingTable\fR that are associated with \fIobject\fR.
@@ -150,6 +149,5 @@ the object is skipped.
\fBTk_BindEvent\fR continues through all of the objects, handling
exceptions such as errors, \fBbreak\fR, and \fBcontinue\fR as
described in the documentation for \fBbind\fR.
-
.SH KEYWORDS
binding, event, object, script
diff --git a/doc/CanvPsY.3 b/doc/CanvPsY.3
index 08b17a4..342ddb3 100644
--- a/doc/CanvPsY.3
+++ b/doc/CanvPsY.3
@@ -61,7 +61,6 @@ and so on.
.AP int numPoints in
Number of points at \fIcoordPtr\fR.
.BE
-
.SH DESCRIPTION
.PP
These procedures are called by canvas type managers to carry out
@@ -83,38 +82,40 @@ transformation.
of a bitmap.
The Postscript is generated in proper image data format for Postscript,
i.e., as data between angle brackets, one bit per pixel.
-The Postscript is appended to \fIinterp->result\fR and \fBTCL_OK\fR is returned
-unless an error occurs, in which case \fBTCL_ERROR\fR is returned and
-\fIinterp->result\fR is overwritten with an error message.
+The Postscript is appended to the result of interpreter \fIinterp\fR
+and \fBTCL_OK\fR is returned unless an error occurs, in which case
+\fBTCL_ERROR\fR is returned and the interpreter result is overwritten
+with an error message.
.PP
\fBTk_CanvasPsColor\fR generates Postscript to set the current color
to correspond to its \fIcolorPtr\fR argument, taking into account any
color map specified in the \fBpostscript\fR command.
-It appends the Postscript to \fIinterp->result\fR and returns
-\fBTCL_OK\fR unless an error occurs, in which case \fBTCL_ERROR\fR is returned and
-\fIinterp->result\fR is overwritten with an error message.
+It appends the Postscript to the interpreter \fIinterp\fR's result and returns
+\fBTCL_OK\fR unless an error occurs, in which case \fBTCL_ERROR\fR is
+returned and the interpreter's result is overwritten with an error message.
.PP
\fBTk_CanvasPsFont\fR generates Postscript that sets the current font
to match \fItkFont\fR as closely as possible.
\fBTk_CanvasPsFont\fR takes into account any font map specified
in the \fBpostscript\fR command, and it does
the best it can at mapping X fonts to Postscript fonts.
-It appends the Postscript to \fIinterp->result\fR and returns \fBTCL_OK\fR
-unless an error occurs, in which case \fBTCL_ERROR\fR is returned and
-\fIinterp->result\fR is overwritten with an error message.
+It appends the Postscript to interpreter \fIinterp\fR's result and
+returns \fBTCL_OK\fR unless an error occurs, in which case
+\fBTCL_ERROR\fR is returned and the interpreter's result is
+overwritten with an error message.
.PP
\fBTk_CanvasPsPath\fR generates Postscript to set the current path
to the set of points given by \fIcoordPtr\fR and \fInumPoints\fR.
-It appends the resulting Postscript to \fIinterp->result\fR.
+It appends the resulting Postscript to the result of interpreter \fIinterp\fR.
.PP
\fBTk_CanvasPsStipple\fR generates Postscript that will fill the
current path in stippled fashion.
It uses \fIbitmap\fR as the stipple pattern and the current Postscript
color; ones in the stipple bitmap are drawn in the current color, and
zeroes are not drawn at all.
-The Postscript is appended to \fIinterp->result\fR and \fBTCL_OK\fR is
-returned, unless an error occurs, in which case \fBTCL_ERROR\fR is returned and
-\fIinterp->result\fR is overwritten with an error message.
-
+The Postscript is appended to interpreter \fIinterp\fR's result and
+\fBTCL_OK\fR is returned, unless an error occurs, in which case
+\fBTCL_ERROR\fR is returned and the interpreter's result is
+overwritten with an error message.
.SH KEYWORDS
bitmap, canvas, color, font, path, Postscript, stipple
diff --git a/doc/CanvTkwin.3 b/doc/CanvTkwin.3
index 14db15e..1ddaa6b 100644
--- a/doc/CanvTkwin.3
+++ b/doc/CanvTkwin.3
@@ -71,7 +71,6 @@ the left of this coordinate need to be redisplayed.
Bottom edge of the region that needs redisplay. Only pixels above
this coordinate need to be redisplayed.
.BE
-
.SH DESCRIPTION
.PP
These procedures are called by canvas type managers to perform various
@@ -86,7 +85,7 @@ canvas coordinate.
If \fIstring\fR is a valid coordinate description then \fBTk_CanvasGetCoord\fR
stores the corresponding canvas coordinate at *\fIdoublePtr\fR
and returns \fBTCL_OK\fR.
-Otherwise it stores an error message in \fIinterp->result\fR and
+Otherwise it stores an error message in the interpreter result and
returns \fBTCL_ERROR\fR.
.PP
\fBTk_CanvasDrawableCoords\fR is called by type managers during
@@ -142,18 +141,18 @@ The code of a canvas type manager will not call these procedures
directly, but will use their addresses to create a \fBTk_CustomOption\fR
structure for the \fB\-tags\fR option. The code typically looks
like this:
+.PP
.CS
-static Tk_CustomOption tagsOption = {Tk_CanvasTagsParseProc,
+static const Tk_CustomOption tagsOption = {Tk_CanvasTagsParseProc,
Tk_CanvasTagsPrintProc, (ClientData) NULL
};
-static Tk_ConfigSpec configSpecs[] = {
+static const Tk_ConfigSpec configSpecs[] = {
...
- {TK_CONFIG_CUSTOM, "\-tags", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
+ {TK_CONFIG_CUSTOM, "\-tags", NULL, NULL,
+ NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
...
};
.CE
-
.SH KEYWORDS
canvas, focus, item type, redisplay, selection, type manager
diff --git a/doc/CanvTxtInfo.3 b/doc/CanvTxtInfo.3
index 58bf6e1..fbfa913 100644
--- a/doc/CanvTxtInfo.3
+++ b/doc/CanvTxtInfo.3
@@ -20,7 +20,6 @@ Tk_CanvasTextInfo *
.AP Tk_Canvas canvas in
A token that identifies a particular canvas widget.
.BE
-
.SH DESCRIPTION
.PP
Textual canvas items are somewhat more complicated to manage than
@@ -47,7 +46,7 @@ typedef struct Tk_CanvasTextInfo {
Tk_Item *\fIfocusItemPtr\fR;
int \fIgotFocus\fR;
int \fIcursorOn\fR;
-} Tk_CanvasTextInfo;
+} \fBTk_CanvasTextInfo\fR;
.CE
The \fBselBorder\fR field identifies a Tk_3DBorder that should be
used for drawing the background under selected text.
@@ -97,6 +96,5 @@ anchor, as determined by \fIselItemPtr\fR or \fIanchorItemPtr\fR).
If all of the selected text in the item is deleted, the item should
set \fIselItemPtr\fR to NULL to indicate that there is no longer a
selection.
-
.SH KEYWORDS
canvas, focus, insertion cursor, selection, selection anchor, text
diff --git a/doc/Clipboard.3 b/doc/Clipboard.3
index 6555290..f3e8fec 100644
--- a/doc/Clipboard.3
+++ b/doc/Clipboard.3
@@ -31,10 +31,9 @@ Conversion type for this clipboard item; has same meaning as
.AP Atom format in
Representation to use when data is retrieved; has same meaning as
\fIformat\fR argument to \fBTk_CreateSelHandler\fR.
-.AP char *buffer in
+.AP "const char" *buffer in
Null terminated string containing the data to be appended to the clipboard.
.BE
-
.SH DESCRIPTION
.PP
These two procedures manage the clipboard for Tk.
@@ -43,9 +42,10 @@ once, then calling \fBTk_ClipboardAppend\fR to add data for any
number of targets.
.PP
\fBTk_ClipboardClear\fR claims the CLIPBOARD selection and frees any
-data items previously stored on the clipboard in this application.
+data items previously stored on the clipboard in this application.
It normally returns \fBTCL_OK\fR, but if an error occurs it returns
-\fBTCL_ERROR\fR and leaves an error message in \fIinterp->result\fR.
+\fBTCL_ERROR\fR and leaves an error message in interpreter
+\fIinterp\fR's result.
\fBTk_ClipboardClear\fR must be called before a sequence of
\fBTk_ClipboardAppend\fR calls can be issued.
.PP
@@ -60,8 +60,8 @@ currently owned by the application, either
because \fBTk_ClipboardClear\fR has not been called or because
ownership of the clipboard has changed since the last call to
\fBTk_ClipboardClear\fR,
-\fBTk_ClipboardAppend\fR returns \fBTCL_ERROR\fR and leaves an error message in
-\fIinterp->result\fR.
+\fBTk_ClipboardAppend\fR returns \fBTCL_ERROR\fR and leaves an error
+message in the result of interpreter \fIinterp\fR.
.PP
In order to guarantee atomicity, no event handling should occur
between \fBTk_ClipboardClear\fR and the following
@@ -71,8 +71,7 @@ this application).
.PP
\fBTk_ClipboardClear\fR may invoke callbacks, including arbitrary
Tcl scripts, as a result of losing the CLIPBOARD selection, so
-any calling function should take care to be reentrant at the point
+any calling function should take care to be re-entrant at the point
\fBTk_ClipboardClear\fR is invoked.
-
.SH KEYWORDS
append, clipboard, clear, format, type
diff --git a/doc/ClrSelect.3 b/doc/ClrSelect.3
index 961f2d7..545e63c 100644
--- a/doc/ClrSelect.3
+++ b/doc/ClrSelect.3
@@ -23,10 +23,9 @@ window.
.AP Atom selection in
The name of selection to be cleared.
.BE
-
.SH DESCRIPTION
.PP
-\fBTk_ClearSelection\fR cancels the selection specified by the atom
+\fBTk_ClearSelection\fR cancels the selection specified by the atom
\fIselection\fR for the display containing \fItkwin\fR.
The selection need not be in \fItkwin\fR itself or even in
\fItkwin\fR's application.
@@ -35,6 +34,5 @@ owns \fIselection\fR, the window will be notified and the
selection will be cleared.
If there is no owner for \fIselection\fR on the display, then the
procedure has no effect.
-
.SH KEYWORDS
clear, selection
diff --git a/doc/ConfigWidg.3 b/doc/ConfigWidg.3
index 6a3e41a..9b83898 100644
--- a/doc/ConfigWidg.3
+++ b/doc/ConfigWidg.3
@@ -25,12 +25,12 @@ int
.sp
\fBTk_FreeOptions(\fIspecs, widgRec, display, flags\fB)\fR
.SH ARGUMENTS
-.AS Tk_ConfigSpec *widgRec in/out
+.AS char *widgRec in/out
.AP Tcl_Interp *interp in
Interpreter to use for returning error messages.
.AP Tk_Window tkwin in
Window used to represent widget (needed to set up X resources).
-.AP Tk_ConfigSpec *specs in
+.AP "const Tk_ConfigSpec" *specs in
Pointer to table specifying legal configuration options for this
widget.
.AP int argc in
@@ -61,7 +61,7 @@ Display containing widget whose record is being freed; needed in
order to free up resources.
.BE
.SH DESCRIPTION
-.PP
+.PP
Note: \fBTk_ConfigureWidget\fR should be replaced with the new
\fBTcl_Obj\fR based API \fBTk_SetOptions\fR. The old interface is
retained for backward compatibility.
@@ -89,7 +89,7 @@ to fill in fields of \fIwidgRec\fR that are not specified in \fIargv\fR.
case it does not modify \fIinterp\fR.
If an error
occurs then \fBTCL_ERROR\fR is returned and \fBTk_ConfigureWidget\fR will
-leave an error message in \fIinterp->result\fR in the standard Tcl
+leave an error message in interpreter \fIinterp\fR's result in the standard Tcl
fashion.
In the event of an error return, some of the fields of \fIwidgRec\fR
could already have been set, if configuration information for them
@@ -103,14 +103,14 @@ option and has the following structure:
.CS
typedef struct {
int \fItype\fR;
- char *\fIargvName\fR;
- char *\fIdbName\fR;
- char *\fIdbClass\fR;
- char *\fIdefValue\fR;
+ const char *\fIargvName\fR;
+ const char *\fIdbName\fR;
+ const char *\fIdbClass\fR;
+ const char *\fIdefValue\fR;
int \fIoffset\fR;
int \fIspecFlags\fR;
- Tk_CustomOption *\fIcustomPtr\fR;
-} Tk_ConfigSpec;
+ const Tk_CustomOption *\fIcustomPtr\fR;
+} \fBTk_ConfigSpec\fR;
.CE
The \fItype\fR field indicates what type of configuration option this is
(e.g. \fBTK_CONFIG_COLOR\fR for a color value, or \fBTK_CONFIG_INT\fR for
@@ -356,7 +356,6 @@ is an empty string then the target will be set to NULL.
\fBTK_CONFIG_WINDOW\fR
The value must be a window path name. It is translated to a
\fBTk_Window\fR token and the token is stored in the target.
-
.SH "GROUPED ENTRIES"
.PP
In some cases it is useful to generate multiple resources from
@@ -374,7 +373,6 @@ Each of the entries after the first must have a NULL value in its
\fIargvName\fR field; this indicates that the entry is to be grouped
with the entry that precedes it. Only the \fItype\fR and \fIoffset\fR
fields are used from these follow-on entries.
-
.SH "FLAGS"
.PP
The \fIflags\fR argument passed to \fBTk_ConfigureWidget\fR is used
@@ -434,13 +432,11 @@ once, save the value, and provide it before calling
.TP
\fBTK_CONFIG_OPTION_SPECIFIED\fR
This bit is
-.VS 8.5
deprecated. It used to be set and cleared by \fBTk_ConfigureWidget\fR
so that callers could detect what entries were specified in
\fIargv\fR, but it was removed because it was inherently
thread-unsafe. Code that wishes to detect what options were specified
should use \fBTk_SetOptions\fR instead.
-.VE 8.5
.PP
The \fBTK_CONFIG_MONO_ONLY\fR and \fBTK_CONFIG_COLOR_ONLY\fR flags are typically
used to specify different default values for
@@ -473,7 +469,6 @@ for which this entry is valid. When calling \fBTk_ConfigureWidget\fR,
\fIflags\fR will have a single one of these bits set to select the
entries for the desired widget type. For a working example of
this feature, see the code in tkButton.c.
-
.SH TK_OFFSET
.PP
The \fBTk_Offset\fR macro is provided as a safe way of generating
@@ -481,7 +476,6 @@ the \fIoffset\fR values for entries in Tk_ConfigSpec structures.
It takes two arguments: the name of a type of record, and the
name of a field in that record. It returns the byte offset of
the named field in records of the given type.
-
.SH TK_CONFIGUREINFO
.PP
The \fBTk_ConfigureInfo\fR procedure may be used to obtain
@@ -492,12 +486,12 @@ pointer to a widget record containing the current information for
a widget (\fIwidgRec\fR), and a NULL \fIargvName\fR argument,
\fBTk_ConfigureInfo\fR generates a string describing all of the
configuration options for the window. The string is placed
-in \fIinterp->result\fR. Under normal circumstances
+in interpreter \fIinterp\fR's result. Under normal circumstances
it returns \fBTCL_OK\fR; if an error occurs then it returns \fBTCL_ERROR\fR
-and \fIinterp->result\fR contains an error message.
+and the interpreter's result will contain an error message.
.PP
If \fIargvName\fR is NULL, then the value left in
-\fIinterp->result\fR by \fBTk_ConfigureInfo\fR
+the interpreter's result by \fBTk_ConfigureInfo\fR
consists of a list of one or more entries, each of which describes
one configuration option (i.e. one entry in \fIspecs\fR). Each
entry in the list will contain either two or five values. If the
@@ -510,27 +504,25 @@ field of \fIwidgRec\fR by calling procedures like \fBTk_NameOfColor\fR.
.PP
If the \fIargvName\fR argument to \fBTk_ConfigureInfo\fR is non-NULL,
then it indicates a single option, and information is returned only
-for that option. The string placed in \fIinterp->result\fR will be
+for that option. The string placed in the interpreter's result will be
a list containing two or five values as described above; this will
be identical to the corresponding sublist that would have been returned
if \fIargvName\fR had been NULL.
.PP
The \fIflags\fR argument to \fBTk_ConfigureInfo\fR is used to restrict
the \fIspecs\fR entries to consider, just as for \fBTk_ConfigureWidget\fR.
-
.SH TK_CONFIGUREVALUE
.PP
\fBTk_ConfigureValue\fR takes arguments similar to \fBTk_ConfigureInfo\fR;
instead of returning a list of values, it just returns the current value
of the option given by \fIargvName\fR (\fIargvName\fR must not be NULL).
-The value is returned in \fIinterp->result\fR and \fBTCL_OK\fR is
+The value is returned in interpreter \fIinterp\fR's result and \fBTCL_OK\fR is
normally returned as the procedure's result.
If an error occurs in \fBTk_ConfigureValue\fR (e.g., \fIargvName\fR is
not a valid option name), \fBTCL_ERROR\fR is returned and an error message
-is left in \fIinterp->result\fR.
+is left in the interpreter's result.
This procedure is typically called to implement \fBcget\fR widget
commands.
-
.SH TK_FREEOPTIONS
.PP
The \fBTk_FreeOptions\fR procedure may be invoked during widget cleanup
@@ -543,7 +535,6 @@ it contains a null pointer) then no resource is freed for that
entry.
After freeing a resource, \fBTk_FreeOptions\fR sets the
corresponding field of the widget record to null.
-
.SH "CUSTOM OPTION TYPES"
.PP
Applications can extend the built-in configuration types with additional
@@ -554,22 +545,22 @@ typedef struct Tk_CustomOption {
Tk_OptionParseProc *\fIparseProc\fR;
Tk_OptionPrintProc *\fIprintProc\fR;
ClientData \fIclientData\fR;
-} Tk_CustomOption;
+} \fBTk_CustomOption\fR;
-typedef int Tk_OptionParseProc(
- ClientData \fIclientData\fR,
- Tcl_Interp *\fIinterp\fR,
- Tk_Window \fItkwin\fR,
- char *\fIvalue\fR,
- char *\fIwidgRec\fR,
- int \fIoffset\fR);
+typedef int \fBTk_OptionParseProc\fR(
+ ClientData \fIclientData\fR,
+ Tcl_Interp *\fIinterp\fR,
+ Tk_Window \fItkwin\fR,
+ char *\fIvalue\fR,
+ char *\fIwidgRec\fR,
+ int \fIoffset\fR);
-typedef char *Tk_OptionPrintProc(
- ClientData \fIclientData\fR,
- Tk_Window \fItkwin\fR,
- char *\fIwidgRec\fR,
- int \fIoffset\fR,
- Tcl_FreeProc **\fIfreeProcPtr\fR);
+typedef const char *\fBTk_OptionPrintProc\fR(
+ ClientData \fIclientData\fR,
+ Tk_Window \fItkwin\fR,
+ char *\fIwidgRec\fR,
+ int \fIoffset\fR,
+ Tcl_FreeProc **\fIfreeProcPtr\fR);
.CE
The Tk_CustomOption structure contains three fields, which are pointers
to the two procedures and a \fIclientData\fR value to be passed to those
@@ -599,7 +590,7 @@ be placed. The procedure should translate the string to whatever
form is appropriate for the option and store the value in the widget
record. It should normally return \fBTCL_OK\fR, but if an error occurs
in translating the string to a value then it should return \fBTCL_ERROR\fR
-and store an error message in \fIinterp->result\fR.
+and store an error message in interpreter \fIinterp\fR's result.
.PP
The \fIprintProc\fR procedure is called
by \fBTk_ConfigureInfo\fR to produce a string value describing an
@@ -622,7 +613,6 @@ Tk_CustomOption structure has been created for them, options of this
new type may be manipulated with Tk_ConfigSpec entries whose \fItype\fR
fields are \fBTK_CONFIG_CUSTOM\fR and whose \fIcustomPtr\fR fields point
to the Tk_CustomOption structure.
-
.SH EXAMPLES
.PP
Although the explanation of \fBTk_ConfigureWidget\fR is fairly
@@ -633,10 +623,8 @@ The library implementation of frames
(tkFrame.c) has a simple configuration table, and the library
implementation of buttons (tkButton.c) has a much more complex
table that uses many of the fancy \fIspecFlags\fR mechanisms.
-
.SH "SEE ALSO"
Tk_SetOptions(3)
-
.SH KEYWORDS
anchor, bitmap, boolean, border, cap style, color, configuration options,
cursor, custom, double, font, integer, join style, justify, millimeters,
diff --git a/doc/CoordToWin.3 b/doc/CoordToWin.3
index f984f8e..4e4eb66 100644
--- a/doc/CoordToWin.3
+++ b/doc/CoordToWin.3
@@ -25,7 +25,6 @@ Y-coordinate (in root window coordinates).
.AP Tk_Window tkwin in
Token for window that identifies application.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_CoordsToWindow\fR locates the window that contains a given point.
@@ -44,6 +43,5 @@ which window contains the mouse cursor: if a parent and a child both
contain the point then the child gets preference, and if two siblings
both contain the point then the highest one in the stacking order
(i.e. the one that's visible on the screen) gets preference.
-
.SH KEYWORDS
containing, coordinates, root window
diff --git a/doc/CrtCmHdlr.3 b/doc/CrtCmHdlr.3
index f8c72e5..05616fb 100644
--- a/doc/CrtCmHdlr.3
+++ b/doc/CrtCmHdlr.3
@@ -20,10 +20,8 @@ Tk_CreateClientMessageHandler, Tk_DeleteClientMessageHandler \- associate proced
.AP Tk_ClientMessageProc *proc in
Procedure to invoke whenever a ClientMessage X event occurs on any display.
.BE
-
.SH DESCRIPTION
.PP
-
\fBTk_CreateClientMessageHandler\fR arranges for \fIproc\fR to be invoked
in the future whenever a ClientMessage X event occurs that is not handled by
\fBWM_PROTOCOL\fR. \fBTk_CreateClientMessageHandler\fR is intended for use
@@ -39,9 +37,9 @@ call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
\fIProc\fR should have arguments and result that match the
type \fBTk_ClientMessageProc\fR:
.CS
-typedef int Tk_ClientMessageProc(
- Tk_Window \fItkwin\fR,
- XEvent *\fIeventPtr\fR);
+typedef int \fBTk_ClientMessageProc\fR(
+ Tk_Window \fItkwin\fR,
+ XEvent *\fIeventPtr\fR);
.CE
The \fItkwin\fR parameter to \fIproc\fR is the Tk window which is
associated with this event. \fIEventPtr\fR is a pointer to the X event.
@@ -62,6 +60,5 @@ finds that matches the \fIproc\fR argument. If no such handler exists,
then \fBTk_DeleteClientMessageHandler\fR returns without doing anything.
Although Tk supports it, it's probably a bad idea to have more than one
callback with the same \fIproc\fR argument.
-
.SH KEYWORDS
bind, callback, event, handler
diff --git a/doc/CrtErrHdlr.3 b/doc/CrtErrHdlr.3
index a75414e..acbd9f6 100644
--- a/doc/CrtErrHdlr.3
+++ b/doc/CrtErrHdlr.3
@@ -72,9 +72,9 @@ made when the handler was active (see below for more information).
\fIProc\fR should have arguments and result that match the
following type:
.CS
-typedef int Tk_ErrorProc(
- ClientData \fIclientData\fR,
- XErrorEvent *\fIerrEventPtr\fR);
+typedef int \fBTk_ErrorProc\fR(
+ ClientData \fIclientData\fR,
+ XErrorEvent *\fIerrEventPtr\fR);
.CE
The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR
argument given to \fBTcl_CreateErrorHandler\fR when the callback
@@ -136,6 +136,5 @@ handlers deleted before the \fBXSync\fR call.
For the Tk error handling mechanism to work properly, it is essential
that application code never calls \fBXSetErrorHandler\fR directly;
applications should use only \fBTk_CreateErrorHandler\fR.
-
.SH KEYWORDS
callback, error, event, handler
diff --git a/doc/CrtGenHdlr.3 b/doc/CrtGenHdlr.3
index a1bc637..68a2cd8 100644
--- a/doc/CrtGenHdlr.3
+++ b/doc/CrtGenHdlr.3
@@ -24,7 +24,6 @@ Procedure to invoke whenever any X event occurs on any display.
.AP ClientData clientData in
Arbitrary one-word value to pass to \fIproc\fR.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_CreateGenericHandler\fR arranges for \fIproc\fR to be
@@ -45,9 +44,9 @@ call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
\fIProc\fR should have arguments and result that match the
type \fBTk_GenericProc\fR:
.CS
-typedef int Tk_GenericProc(
- ClientData \fIclientData\fR,
- XEvent *\fIeventPtr\fR);
+typedef int \fBTk_GenericProc\fR(
+ ClientData \fIclientData\fR,
+ XEvent *\fIeventPtr\fR);
.CE
The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR
argument given to \fBTk_CreateGenericHandler\fR when the callback
diff --git a/doc/CrtImgType.3 b/doc/CrtImgType.3
index da083e0..d93f4b4 100644
--- a/doc/CrtImgType.3
+++ b/doc/CrtImgType.3
@@ -21,11 +21,12 @@ ClientData
.sp
\fBTk_InitImageArgs\fR(\fIinterp, argc, argvPtr\fR)
.SH ARGUMENTS
-.AS Tk_ImageType *typePtrPtr
-.AP Tk_ImageType *typePtr in
+.AS "const Tk_ImageType" *typePtrPtr
+.AP "const Tk_ImageType" *typePtr in
Structure that defines the new type of image.
-Must be static: a
+For Tk 8.4 and earlier this must be static: a
pointer to this structure is retained by the image code.
+In Tk 8.5, this limitation was relaxed.
.AP Tcl_Interp *interp in
Interpreter in which image was created.
.AP "const char" *name in
@@ -38,7 +39,6 @@ Number of arguments
.AP char ***argvPtr in/out
Pointer to argument list
.BE
-
.SH DESCRIPTION
.PP
\fBTk_CreateImageType\fR is invoked to define a new kind of image.
@@ -59,13 +59,13 @@ the name of the image type and pointers to five procedures provided
by the image manager to deal with images of this type:
.CS
typedef struct Tk_ImageType {
- char *\fIname\fR;
+ const char *\fIname\fR;
Tk_ImageCreateProc *\fIcreateProc\fR;
Tk_ImageGetProc *\fIgetProc\fR;
Tk_ImageDisplayProc *\fIdisplayProc\fR;
Tk_ImageFreeProc *\fIfreeProc\fR;
Tk_ImageDeleteProc *\fIdeleteProc\fR;
-} Tk_ImageType;
+} \fBTk_ImageType\fR;
.CE
The fields of this structure will be described in later subsections
of this entry.
@@ -92,7 +92,6 @@ option specified for a widget or canvas item.
.PP
The following subsections describe the fields of a Tk_ImageType
in more detail.
-
.SS NAME
.PP
\fItypePtr->name\fR provides a name for the image type.
@@ -101,21 +100,21 @@ in \fBimage create\fR commands to create images of the new
type.
If there already existed an image type by this name then
the new image type replaces the old one.
-
.SS CREATEPROC
+.PP
\fItypePtr->createProc\fR provides the address of a procedure for
Tk to call whenever \fBimage create\fR is invoked to create
an image of the new type.
\fItypePtr->createProc\fR must match the following prototype:
.CS
-typedef int Tk_ImageCreateProc(
- Tcl_Interp *\fIinterp\fR,
- char *\fIname\fR,
- int \fIobjc\fR,
- Tcl_Obj *const \fIobjv\fR[],
- Tk_ImageType *\fItypePtr\fR,
- Tk_ImageMaster \fImaster\fR,
- ClientData *\fImasterDataPtr\fR);
+typedef int \fBTk_ImageCreateProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ const char *\fIname\fR,
+ int \fIobjc\fR,
+ Tcl_Obj *const \fIobjv\fR[],
+ const Tk_ImageType *\fItypePtr\fR,
+ Tk_ImageMaster \fImaster\fR,
+ ClientData *\fImasterDataPtr\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the \fBimage\fR
command was invoked, and \fIname\fR is the name for the new image,
@@ -141,16 +140,15 @@ it should return \fBTCL_OK\fR.
.PP
\fIcreateProc\fR should call \fBTk_ImageChanged\fR in order to set the
size of the image and request an initial redisplay.
-
.SS GETPROC
.PP
\fItypePtr->getProc\fR is invoked by Tk whenever a widget
calls \fBTk_GetImage\fR to use a particular image.
This procedure must match the following prototype:
.CS
-typedef ClientData Tk_ImageGetProc(
- Tk_Window \fItkwin\fR,
- ClientData \fImasterData\fR);
+typedef ClientData \fBTk_ImageGetProc\fR(
+ Tk_Window \fItkwin\fR,
+ ClientData \fImasterData\fR);
.CE
The \fItkwin\fR argument identifies the window in which the
image will be used and \fImasterData\fR is the value
@@ -162,23 +160,22 @@ display the image in the given window.
is typically the address of the instance data structure.
Tk will pass this value back to the image manager when invoking
its \fIdisplayProc\fR and \fIfreeProc\fR procedures.
-
.SS DISPLAYPROC
.PP
\fItypePtr->displayProc\fR is invoked by Tk whenever an image needs
to be displayed (i.e., whenever a widget calls \fBTk_RedrawImage\fR).
\fIdisplayProc\fR must match the following prototype:
.CS
-typedef void Tk_ImageDisplayProc(
- ClientData \fIinstanceData\fR,
- Display *\fIdisplay\fR,
- Drawable \fIdrawable\fR,
- int \fIimageX\fR,
- int \fIimageY\fR,
- int \fIwidth\fR,
- int \fIheight\fR,
- int \fIdrawableX\fR,
- int \fIdrawableY\fR);
+typedef void \fBTk_ImageDisplayProc\fR(
+ ClientData \fIinstanceData\fR,
+ Display *\fIdisplay\fR,
+ Drawable \fIdrawable\fR,
+ int \fIimageX\fR,
+ int \fIimageY\fR,
+ int \fIwidth\fR,
+ int \fIheight\fR,
+ int \fIdrawableX\fR,
+ int \fIdrawableY\fR);
.CE
The \fIinstanceData\fR will be the same as the value returned by
\fIgetProc\fR when the instance was created.
@@ -195,7 +192,6 @@ as specified in the most recent call to \fBTk_ImageChanged\fR.
the image should be displayed; \fIdisplayProc\fR should display
the given region of the image so that point (\fIimageX\fR, \fIimageY\fR)
in the image appears at (\fIdrawableX\fR, \fIdrawableY\fR) in \fIdrawable\fR.
-
.SS FREEPROC
.PP
\fItypePtr->freeProc\fR contains the address of a procedure that
@@ -206,16 +202,15 @@ in a canvas is deleted, or when the image displayed in a widget or
canvas item is changed.
\fIfreeProc\fR must match the following prototype:
.CS
-typedef void Tk_ImageFreeProc(
- ClientData \fIinstanceData\fR,
- Display *\fIdisplay\fR);
+typedef void \fBTk_ImageFreeProc\fR(
+ ClientData \fIinstanceData\fR,
+ Display *\fIdisplay\fR);
.CE
The \fIinstanceData\fR will be the same as the value returned by
\fIgetProc\fR when the instance was created, and \fIdisplay\fR
is the display containing the window for the instance.
\fIfreeProc\fR should release any resources associated with the
image instance, since the instance will never be used again.
-
.SS DELETEPROC
.PP
\fItypePtr->deleteProc\fR is a procedure that Tk invokes when an
@@ -225,15 +220,14 @@ Before invoking \fIdeleteProc\fR Tk will invoke \fIfreeProc\fR for
each of the image's instances.
\fIdeleteProc\fR must match the following prototype:
.CS
-typedef void Tk_ImageDeleteProc(
- ClientData \fImasterData\fR);
+typedef void \fBTk_ImageDeleteProc\fR(
+ ClientData \fImasterData\fR);
.CE
The \fImasterData\fR argument will be the same as the value
stored in \fI*masterDataPtr\fR by \fIcreateProc\fR when the
image was created.
\fIdeleteProc\fR should release any resources associated with
the image.
-
.SH TK_GETIMAGEMASTERDATA
.PP
The procedure \fBTk_GetImageMasterData\fR may be invoked to retrieve
@@ -247,19 +241,19 @@ and the return value is the ClientData value returned by the
\fIcreateProc\fR when the image was created (this is typically a
pointer to the image master data structure). If no such image exists
then NULL is returned and NULL is stored at \fI*typePtrPtr\fR.
-
.SH "LEGACY INTERFACE SUPPORT"
+.PP
In Tk 8.2 and earlier, the definition of \fBTk_ImageCreateProc\fR
was incompatibly different, with the following prototype:
.CS
-typedef int Tk_ImageCreateProc(
- Tcl_Interp *\fIinterp\fR,
- char *\fIname\fR,
- int \fIargc\fR,
- char **\fIargv\fR,
- Tk_ImageType *\fItypePtr\fR,
- Tk_ImageMaster \fImaster\fR,
- ClientData *\fImasterDataPtr\fR);
+typedef int \fBTk_ImageCreateProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ char *\fIname\fR,
+ int \fIargc\fR,
+ char **\fIargv\fR,
+ Tk_ImageType *\fItypePtr\fR,
+ Tk_ImageMaster \fImaster\fR,
+ ClientData *\fImasterDataPtr\fR);
.CE
Legacy programs and libraries dating from those days may still
contain code that defines extended Tk image types using the old
@@ -283,9 +277,7 @@ use Tk 8.4 headers and stub libraries to do so.
.PP
Any new code written today should not make use of the legacy
interfaces. Expect their support to go away in Tk 9.
-
.SH "SEE ALSO"
Tk_ImageChanged, Tk_GetImage, Tk_FreeImage, Tk_RedrawImage, Tk_SizeOfImage
-
.SH KEYWORDS
image manager, image type, instance, master
diff --git a/doc/CrtItemType.3 b/doc/CrtItemType.3
index 4f06438..bc034a7 100644
--- a/doc/CrtItemType.3
+++ b/doc/CrtItemType.3
@@ -44,7 +44,7 @@ NULL \fInextPtr\fR.
.PP
You may find it easier to understand the rest of this manual entry
by looking at the code for an existing canvas item type such as
-bitmap (file tkCanvBmap.c) or text (tkCanvText.c).
+bitmap (in the file tkCanvBmap.c) or text (tkCanvText.c).
The easiest way to create a new type manager is to copy the code
for an existing type and modify it for the new type.
.PP
@@ -60,12 +60,13 @@ structures.
The first data structure is a Tk_ItemType; it contains
information such as the name of the type and pointers to
the standard procedures implemented by the type manager:
+.PP
.CS
typedef struct Tk_ItemType {
- char *\fIname\fR;
+ const char *\fIname\fR;
int \fIitemSize\fR;
Tk_ItemCreateProc *\fIcreateProc\fR;
- Tk_ConfigSpec *\fIconfigSpecs\fR;
+ const Tk_ConfigSpec *\fIconfigSpecs\fR;
Tk_ItemConfigureProc *\fIconfigProc\fR;
Tk_ItemCoordProc *\fIcoordProc\fR;
Tk_ItemDeleteProc *\fIdeleteProc\fR;
@@ -82,7 +83,7 @@ typedef struct Tk_ItemType {
Tk_ItemInsertProc *\fIinsertProc\fR;
Tk_ItemDCharsProc *\fIdCharsProc\fR;
Tk_ItemType *\fInextPtr\fR;
-} Tk_ItemType;
+} \fBTk_ItemType\fR;
.CE
.PP
The fields of a Tk_ItemType structure are described in more detail
@@ -92,7 +93,7 @@ argument must point to a structure with all of the fields initialized
except \fInextPtr\fR, which Tk sets to link all the types together
into a list.
The structure must be in permanent memory (either statically
-allocated or dynamically allocated but never freed); Tk retains
+allocated or dynamically allocated but never freed); Tk retains
a pointer to this structure.
.PP
The second data structure manipulated by a type manager is an
@@ -102,11 +103,12 @@ All of the items of a given type generally have item records with
the same structure, but different types usually have different
formats for their item records.
The first part of each item record is a header with a standard structure
-defined by Tk via the type Tk_Item; the rest of the item
+defined by Tk via the type Tk_Item; the rest of the item
record is defined by the type manager.
A type manager must define its item records with a Tk_Item as
the first field.
For example, the item record for bitmap items is defined as follows:
+.PP
.CS
typedef struct BitmapItem {
Tk_Item \fIheader\fR;
@@ -116,8 +118,9 @@ typedef struct BitmapItem {
XColor *\fIfgColor\fR;
XColor *\fIbgColor\fR;
GC \fIgc\fR;
-} BitmapItem;
+} \fBBitmapItem\fR;
.CE
+.PP
The \fIheader\fR substructure contains information used by Tk
to manage the item, such as its identifier, its tags, its type,
and its bounding box.
@@ -127,7 +130,7 @@ The type manager should not need to read or write any of the
fields in the header except for four fields
whose names are \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR.
These fields give a bounding box for the items using integer
-canvas coordinates: the item should not cover any pixels
+canvas coordinates: the item should not cover any pixels
with x-coordinate lower than \fIx1\fR or y-coordinate
lower than \fIy1\fR, nor should it cover any pixels with
x-coordinate greater than or equal to \fIx2\fR or y-coordinate
@@ -137,12 +140,12 @@ date as the item is moved and reconfigured.
.PP
Whenever Tk calls a procedure in a type manager it passes in a pointer
to an item record.
-The argument is always passed as a pointer to a Tk_Item; the type
+The argument is always passed as a pointer to a Tk_Item; the type
manager will typically cast this into a pointer to its own specific
type, such as BitmapItem.
.PP
The third data structure used by type managers has type
-Tk_Canvas; it serves as an opaque handle for the canvas widget
+Tk_Canvas; it serves as an opaque handle for the canvas widget
as a whole.
Type managers need not know anything about the contents of this
structure.
@@ -150,6 +153,7 @@ A Tk_Canvas handle is typically passed in to the
procedures of a type manager, and the type manager can pass the
handle back to library procedures such as Tk_CanvasTkwin
to fetch information about the canvas.
+.SH "TK_ITEMTYPE FIELDS"
.SS NAME
.PP
This section and the ones that follow describe each of the fields
@@ -160,8 +164,37 @@ in \fBcreate\fR widget commands to create items of the new
type.
If there already existed an item type by this name then
the new item type replaces the old one.
+.SS "FLAGS (IN ALWAYSREDRAW)"
+.PP
+The \fItypePtr\->alwaysRedraw\fR field (so named for historic reasons)
+contains a collection of flag bits that modify how the canvas core interacts
+with the item. The following bits are defined:
+.TP
+\fB1\fR
+.
+Indicates that the item should always be redrawn when any part of the canvas
+is redrawn, rather than only when the bounding box of the item overlaps the
+area being redrawn. This is used by window items, for example, which need to
+unmap subwindows that are not on the screen.
+.TP
+\fBTK_CONFIG_OBJS\fR
+.
+Indicates that operations which would otherwise take a string (or array of
+strings) actually take a Tcl_Obj reference (or an array of such references).
+The operations to which this applies are the \fIconfigProc\fR, the
+\fIcoordProc\fR, the \fIcreateProc\fR, the \fIindexProc\fR and the
+\fIinsertProc\fR.
+.TP
+\fBTK_MOVABLE_POINTS\fR
+.VS 8.6
+Indicates that the item supports the \fIdCharsProc\fR, \fIindexProc\fR and
+\fIinsertProc\fR with the same semantics as Tk's built-in line and polygon
+types, and that hence individual coordinate points can be moved. Must not be
+set if any of the above methods is NULL.
+.VE 8.6
.SS ITEMSIZE
-\fItypePtr->itemSize\fR gives the size in bytes of item records
+.PP
+\fItypePtr\->itemSize\fR gives the size in bytes of item records
of this type, including the Tk_Item header.
Tk uses this size to allocate memory space for items of the type.
All of the item records for a given type must have the same size.
@@ -170,31 +203,38 @@ of points for a polygon), the type manager can allocate a separate
object of variable length and keep a pointer to it in the item record.
.SS CREATEPROC
.PP
-\fItypePtr->createProc\fR points to a procedure for
+\fItypePtr\->createProc\fR points to a procedure for
Tk to call whenever a new item of this type is created.
-\fItypePtr->createProc\fR must match the following prototype:
+\fItypePtr\->createProc\fR must match the following prototype:
+.PP
.CS
-typedef int Tk_ItemCreateProc(
- Tcl_Interp *\fIinterp\fR,
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIobjc\fR,
- Tcl_Obj* const \fIobjv\fR[]);
+typedef int \fBTk_ItemCreateProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIobjc\fR,
+ Tcl_Obj *const \fIobjv\fR[]);
.CE
+.PP
The \fIinterp\fR argument is the interpreter in which the canvas's
\fBcreate\fR widget command was invoked, and \fIcanvas\fR is a
handle for the canvas widget.
\fIitemPtr\fR is a pointer to a newly-allocated item of
-size \fItypePtr->itemSize\fR.
+size \fItypePtr\->itemSize\fR.
Tk has already initialized the item's header (the first
\fBsizeof(Tk_ItemType)\fR bytes).
The \fIobjc\fR and \fIobjv\fR arguments describe all of the
arguments to the \fBcreate\fR command after the \fItype\fR
argument.
-For example, in the widget command
+Note that if \fBTK_CONFIG_OBJS\fR is not set in the
+\fItypePtr\->alwaysRedraw\fR field, the \fIobjv\fR parameter will actually
+contain a pointer to an array of constant strings.
+For example, in the widget command:
+.PP
.CS
\fB\&.c create rectangle 10 20 50 50 \-fill black\fR
.CE
+.PP
\fIobjc\fR will be \fB6\fR and \fIobjv\fR[0] will contain the
integer object \fB10\fR.
.PP
@@ -202,7 +242,7 @@ integer object \fB10\fR.
the type-specific parts of the item record and set an initial value
for the bounding box in the item's header.
It should return a standard Tcl completion code and leave an
-error message in \fIinterp->result\fR if an error occurs.
+error message in the interpreter result if an error occurs.
If an error occurs Tk will free the item record, so \fIcreateProc\fR
must be sure to leave the item record in a clean state if it returns an error
(e.g., it must free any additional memory that it allocated for
@@ -212,70 +252,84 @@ the item).
Each type manager must provide a standard table describing its
configuration options, in a form suitable for use with
\fBTk_ConfigureWidget\fR.
-This table will normally be used by \fItypePtr->createProc\fR
-and \fItypePtr->configProc\fR, but Tk also uses it directly
+This table will normally be used by \fItypePtr\->createProc\fR
+and \fItypePtr\->configProc\fR, but Tk also uses it directly
to retrieve option information in the \fBitemcget\fR and
\fBitemconfigure\fR widget commands.
-\fItypePtr->configSpecs\fR must point to the configuration table
+\fItypePtr\->configSpecs\fR must point to the configuration table
for this type.
Note: Tk provides a custom option type \fBtk_CanvasTagsOption\fR
-for implementing the \fB\-tags\fR option; see an existing type
+for implementing the \fB\-tags\fR option; see an existing type
manager for an example of how to use it in \fIconfigSpecs\fR.
.SS CONFIGPROC
.PP
-\fItypePtr->configProc\fR is called by Tk whenever the
+\fItypePtr\->configProc\fR is called by Tk whenever the
\fBitemconfigure\fR widget command is invoked to change the
configuration options for a canvas item.
This procedure must match the following prototype:
+.PP
.CS
-typedef int Tk_ItemConfigureProc(
- Tcl_Interp *\fIinterp\fR,
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIobjc\fR,
- Tcl_Obj* const \fIobjv\fR[],
- int \fIflags\fR);
+typedef int \fBTk_ItemConfigureProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIobjc\fR,
+ Tcl_Obj *const \fIobjv\fR[],
+ int \fIflags\fR);
.CE
-The \fIinterp\fR objument identifies the interpreter in which the
-widget command was invoked, \fIcanvas\fR is a handle for the canvas
+.PP
+The \fIinterp\fR argument identifies the interpreter in which the
+widget command was invoked, \fIcanvas\fR is a handle for the canvas
widget, and \fIitemPtr\fR is a pointer to the item being configured.
-\fIobjc\fR and \fIobjv\fR contain the configuration options. For
-example, if the following command is invoked:
+\fIobjc\fR and \fIobjv\fR contain the configuration options.
+Note that if \fBTK_CONFIG_OBJS\fR is not set in the
+\fItypePtr\->alwaysRedraw\fR field, the \fIobjv\fR parameter will actually
+contain a pointer to an array of constant strings.
+For example, if the following command is invoked:
+.PP
.CS
\fB\&.c itemconfigure 2 \-fill red \-outline black\fR
.CE
+.PP
\fIobjc\fR is \fB4\fR and \fIobjv\fR contains the string objects \fB\-fill\fR
through \fBblack\fR.
\fIobjc\fR will always be an even value.
-The \fIflags\fR argument contains flags to pass to \fBTk_ConfigureWidget\fR;
+The \fIflags\fR argument contains flags to pass to \fBTk_ConfigureWidget\fR;
currently this value is always \fBTK_CONFIG_ARGV_ONLY\fR when Tk
-invokes \fItypePtr->configProc\fR, but the type manager's \fIcreateProc\fR
+invokes \fItypePtr\->configProc\fR, but the type manager's \fIcreateProc\fR
procedure will usually invoke \fIconfigProc\fR with different flag values.
.PP
-\fItypePtr->configProc\fR returns a standard Tcl completion code and
-leaves an error message in \fIinterp->result\fR if an error occurs.
+\fItypePtr\->configProc\fR returns a standard Tcl completion code and
+leaves an error message in the interpreter result if an error occurs.
It must update the item's bounding box to reflect the new configuration
options.
.SS COORDPROC
.PP
-\fItypePtr->coordProc\fR is invoked by Tk to implement the \fBcoords\fR
+\fItypePtr\->coordProc\fR is invoked by Tk to implement the \fBcoords\fR
widget command for an item.
It must match the following prototype:
+.PP
.CS
-typedef int Tk_ItemCoordProc(
- Tcl_Interp *\fIinterp\fR,
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIobjc\fR,
- Tcl_Obj* const \fIobjv\fR[]);
+typedef int \fBTk_ItemCoordProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIobjc\fR,
+ Tcl_Obj *const \fIobjv\fR[]);
.CE
+.PP
The arguments \fIinterp\fR, \fIcanvas\fR, and \fIitemPtr\fR
all have the standard meanings, and \fIobjc\fR and \fIobjv\fR
describe the coordinate arguments.
+Note that if \fBTK_CONFIG_OBJS\fR is not set in the
+\fItypePtr\->alwaysRedraw\fR field, the \fIobjv\fR parameter will actually
+contain a pointer to an array of constant strings.
For example, if the following widget command is invoked:
+.PP
.CS
\fB\&.c coords 2 30 90\fR
.CE
+.PP
\fIobjc\fR will be \fB2\fR and \fBobjv\fR will contain the integer objects
\fB30\fR and \fB90\fR.
.PP
@@ -284,41 +338,45 @@ update the item appropriately (e.g., it must reset the bounding
box in the item's header), and return a standard Tcl completion
code.
If an error occurs, \fIcoordProc\fR must leave an error message in
-\fIinterp->result\fR.
+the interpreter result.
.SS DELETEPROC
.PP
-\fItypePtr->deleteProc\fR is invoked by Tk to delete an item
+\fItypePtr\->deleteProc\fR is invoked by Tk to delete an item
and free any resources allocated to it.
It must match the following prototype:
+.PP
.CS
-typedef void Tk_ItemDeleteProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- Display *\fIdisplay\fR);
+typedef void \fBTk_ItemDeleteProc\fR(
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ Display *\fIdisplay\fR);
.CE
+.PP
The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual
interpretations, and \fIdisplay\fR identifies the X display containing
the canvas.
\fIdeleteProc\fR must free up any resources allocated for the item,
so that Tk can free the item record.
-\fIdeleteProc\fR should not actually free the item record; this will
+\fIdeleteProc\fR should not actually free the item record; this will
be done by Tk when \fIdeleteProc\fR returns.
-.SS "DISPLAYPROC AND ALWAYSREDRAW"
+.SS "DISPLAYPROC"
.PP
-\fItypePtr->displayProc\fR is invoked by Tk to redraw an item
+\fItypePtr\->displayProc\fR is invoked by Tk to redraw an item
on the screen.
It must match the following prototype:
+.PP
.CS
-typedef void Tk_ItemDisplayProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- Display *\fIdisplay\fR,
- Drawable \fIdst\fR,
- int \fIx\fR,
- int \fIy\fR,
- int \fIwidth\fR,
- int \fIheight\fR);
+typedef void \fBTk_ItemDisplayProc\fR(
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ Display *\fIdisplay\fR,
+ Drawable \fIdst\fR,
+ int \fIx\fR,
+ int \fIy\fR,
+ int \fIwidth\fR,
+ int \fIheight\fR);
.CE
+.PP
The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual meaning.
\fIdisplay\fR identifies the display containing the canvas, and
\fIdst\fR specifies a drawable in which the item should be rendered;
@@ -340,25 +398,28 @@ of \fIdst\fR.
.PP
Normally an item's \fIdisplayProc\fR is only invoked if the item
overlaps the area being displayed.
-However, if \fItypePtr->alwaysRedraw\fR has a non-zero value, then
-\fIdisplayProc\fR is invoked during every redisplay operation,
-even if the item does not overlap the area of redisplay.
-\fIalwaysRedraw\fR should normally be set to 0; it is only
-set to 1 in special cases such as window items that need to be
-unmapped when they are off-screen.
+However, if bit zero of \fItypePtr\->alwaysRedraw\fR is 1,
+(i.e.\|
+.QW "\fItypePtr\->alwaysRedraw & 1 == 1\fR" )
+then \fIdisplayProc\fR is invoked during every redisplay operation,
+even if the item does not overlap the area of redisplay; this is useful for
+cases such as window items, where the subwindow needs to be unmapped when it
+is off the screen.
.SS POINTPROC
.PP
-\fItypePtr->pointProc\fR is invoked by Tk to find out how close
+\fItypePtr\->pointProc\fR is invoked by Tk to find out how close
a given point is to a canvas item.
Tk uses this procedure for purposes such as locating the item
under the mouse or finding the closest item to a given point.
The procedure must match the following prototype:
+.PP
.CS
-typedef double Tk_ItemPointProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- double *\fIpointPtr\fR);
+typedef double \fBTk_ItemPointProc\fR(
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ double *\fIpointPtr\fR);
.CE
+.PP
\fIcanvas\fR and \fIitemPtr\fR have the usual meaning.
\fIpointPtr\fR points to an array of two numbers giving
the x and y coordinates of a point.
@@ -367,15 +428,17 @@ from the point to the item, or 0 if the point lies inside
the item.
.SS AREAPROC
.PP
-\fItypePtr->areaProc\fR is invoked by Tk to find out the relationship
+\fItypePtr\->areaProc\fR is invoked by Tk to find out the relationship
between an item and a rectangular area.
It must match the following prototype:
+.PP
.CS
-typedef int Tk_ItemAreaProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- double *\fIrectPtr\fR);
+typedef int \fBTk_ItemAreaProc\fR(
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ double *\fIrectPtr\fR);
.CE
+.PP
\fIcanvas\fR and \fIitemPtr\fR have the usual meaning.
\fIrectPtr\fR points to an array of four real numbers;
the first two give the x and y coordinates of the upper left
@@ -386,26 +449,28 @@ the given area, 0 if it lies partially inside and partially
outside the area, and 1 if it lies entirely inside the area.
.SS POSTSCRIPTPROC
.PP
-\fItypePtr->postscriptProc\fR is invoked by Tk to generate
+\fItypePtr\->postscriptProc\fR is invoked by Tk to generate
Postscript for an item during the \fBpostscript\fR widget command.
If the type manager is not capable of generating Postscript then
-\fItypePtr->postscriptProc\fR should be NULL.
+\fItypePtr\->postscriptProc\fR should be NULL.
The procedure must match the following prototype:
+.PP
.CS
-typedef int Tk_ItemPostscriptProc(
- Tcl_Interp *\fIinterp\fR,
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIprepass\fR);
+typedef int \fBTk_ItemPostscriptProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIprepass\fR);
.CE
+.PP
The \fIinterp\fR, \fIcanvas\fR, and \fIitemPtr\fR arguments all have
-standard meanings; \fIprepass\fR will be described below.
+standard meanings; \fIprepass\fR will be described below.
If \fIpostscriptProc\fR completes successfully, it should append
-Postscript for the item to the information in \fIinterp->result\fR
+Postscript for the item to the information in the interpreter result
(e.g. by calling \fBTcl_AppendResult\fR, not \fBTcl_SetResult\fR)
and return \fBTCL_OK\fR.
If an error occurs, \fIpostscriptProc\fR should clear the result
-and replace its contents with an error message; then it should
+and replace its contents with an error message; then it should
return \fBTCL_ERROR\fR.
.PP
Tk provides a collection of utility procedures to simplify
@@ -427,26 +492,29 @@ In order to generate Postscript that complies with the Adobe Document
Structuring Conventions, Tk actually generates Postscript in two passes.
It calls each item's \fIpostscriptProc\fR in each pass.
The only purpose of the first pass is to collect font information
-(which is done by \fBTk_CanvasPsFont\fR); the actual Postscript is
+(which is done by \fBTk_CanvasPsFont\fR); the actual Postscript is
discarded.
Tk sets the \fIprepass\fR argument to \fIpostscriptProc\fR to 1
-during the first pass; the type manager can use \fIprepass\fR to skip
+during the first pass; the type manager can use \fIprepass\fR to skip
all Postscript generation except for calls to \fBTk_CanvasPsFont\fR.
During the second pass \fIprepass\fR will be 0, so the type manager
must generate complete Postscript.
.SS SCALEPROC
-\fItypePtr->scaleProc\fR is invoked by Tk to rescale a canvas item
+.PP
+\fItypePtr\->scaleProc\fR is invoked by Tk to rescale a canvas item
during the \fBscale\fR widget command.
The procedure must match the following prototype:
+.PP
.CS
-typedef void Tk_ItemScaleProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- double \fIoriginX\fR,
- double \fIoriginY\fR,
- double \fIscaleX\fR,
- double \fIscaleY\fR);
+typedef void \fBTk_ItemScaleProc\fR(
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ double \fIoriginX\fR,
+ double \fIoriginY\fR,
+ double \fIscaleX\fR,
+ double \fIscaleY\fR);
.CE
+.PP
The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual meaning.
\fIoriginX\fR and \fIoriginY\fR specify an origin relative to which
the item is to be scaled, and \fIscaleX\fR and \fIscaleY\fR give the
@@ -454,146 +522,171 @@ x and y scale factors.
The item should adjust its coordinates so that a point in the item
that used to have coordinates \fIx\fR and \fIy\fR will have new
coordinates \fIx\(fm\fR and \fIy\(fm\fR, where
+.PP
.CS
-\fIx\(fm = originX + scaleX*(x-originX)
-y\(fm = originY + scaleY*(y-originY)\fR
+\fIx\(fm\fR = \fIoriginX\fR + \fIscaleX\fR \(mu (\fIx\fR \(mi \fIoriginX\fR)
+\fIy\(fm\fR = \fIoriginY\fR + \fIscaleY\fR \(mu (\fIy\fR \(mi \fIoriginY\fR)
.CE
+.PP
\fIscaleProc\fR must also update the bounding box in the item's
header.
.SS TRANSLATEPROC
-\fItypePtr->translateProc\fR is invoked by Tk to translate a canvas item
+.PP
+\fItypePtr\->translateProc\fR is invoked by Tk to translate a canvas item
during the \fBmove\fR widget command.
The procedure must match the following prototype:
+.PP
.CS
-typedef void Tk_ItemTranslateProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- double \fIdeltaX\fR,
- double \fIdeltaY\fR);
+typedef void \fBTk_ItemTranslateProc\fR(
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ double \fIdeltaX\fR,
+ double \fIdeltaY\fR);
.CE
+.PP
The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual meaning,
and \fIdeltaX\fR and \fIdeltaY\fR give the amounts that should be
added to each x and y coordinate within the item.
The type manager should adjust the item's coordinates and
update the bounding box in the item's header.
.SS INDEXPROC
-\fItypePtr->indexProc\fR is invoked by Tk to translate a string
+.PP
+\fItypePtr\->indexProc\fR is invoked by Tk to translate a string
index specification into a numerical index, for example during the
\fBindex\fR widget command.
-It is only relevant for item types that support indexable text;
-\fItypePtr->indexProc\fR may be specified as NULL for non-textual
-item types.
+It is only relevant for item types that support indexable text or coordinates;
+\fItypePtr\->indexProc\fR may be specified as NULL for non-textual
+item types if they do not support detailed coordinate addressing.
The procedure must match the following prototype:
+.PP
.CS
-typedef int Tk_ItemIndexProc(
- Tcl_Interp *\fIinterp\fR,
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- char \fIindexString\fR,
- int *\fIindexPtr\fR);
+typedef int \fBTk_ItemIndexProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ Tcl_Obj *\fIindexObj\fR,
+ int *\fIindexPtr\fR);
.CE
+.PP
The \fIinterp\fR, \fIcanvas\fR, and \fIitemPtr\fR arguments all
have the usual meaning.
-\fIindexString\fR contains a textual description of an index,
+\fIindexObj\fR contains a textual description of an index,
and \fIindexPtr\fR points to an integer value that should be
filled in with a numerical index.
+Note that if \fBTK_CONFIG_OBJS\fR is not set in the
+\fItypePtr\->alwaysRedraw\fR field, the \fIindexObj\fR parameter will
+actually contain a pointer to a constant string.
It is up to the type manager to decide what forms of index
-are supported (e.g., numbers, \fBinsert\fR, \fBsel.first\fR,
+are supported (e.g., numbers, \fBinsert\fR, \fBsel.first\fR,
\fBend\fR, etc.).
\fIindexProc\fR should return a Tcl completion code and set
-\fIinterp->result\fR in the event of an error.
+the interpreter result in the event of an error.
.SS ICURSORPROC
.PP
-\fItypePtr->icursorProc\fR is invoked by Tk during
+\fItypePtr\->icursorProc\fR is invoked by Tk during
the \fBicursor\fR widget command to set the position of the
insertion cursor in a textual item.
It is only relevant for item types that support an insertion cursor;
-\fItypePtr->icursorProc\fR may be specified as NULL for item types
+\fItypePtr\->icursorProc\fR may be specified as NULL for item types
that do not support an insertion cursor.
The procedure must match the following prototype:
+.PP
.CS
-typedef void Tk_ItemCursorProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIindex\fR);
+typedef void \fBTk_ItemCursorProc\fR(
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIindex\fR);
.CE
+.PP
\fIcanvas\fR and \fIitemPtr\fR have the usual meanings, and
\fIindex\fR is an index into the item's text, as returned by a
-previous call to \fItypePtr->insertProc\fR.
+previous call to \fItypePtr\->insertProc\fR.
The type manager should position the insertion cursor in the
item just before the character given by \fIindex\fR.
Whether or not to actually display the insertion cursor is
determined by other information provided by \fBTk_CanvasGetTextInfo\fR.
.SS SELECTIONPROC
.PP
-\fItypePtr->selectionProc\fR is invoked by Tk during selection
-retrievals; it must return part or all of the selected text in
+\fItypePtr\->selectionProc\fR is invoked by Tk during selection
+retrievals; it must return part or all of the selected text in
the item (if any).
It is only relevant for item types that support text;
-\fItypePtr->selectionProc\fR may be specified as NULL for non-textual
+\fItypePtr\->selectionProc\fR may be specified as NULL for non-textual
item types.
The procedure must match the following prototype:
+.PP
.CS
-typedef int Tk_ItemSelectionProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIoffset\fR,
- char *\fIbuffer\fR,
- int \fImaxBytes\fR);
+typedef int \fBTk_ItemSelectionProc\fR(
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIoffset\fR,
+ char *\fIbuffer\fR,
+ int \fImaxBytes\fR);
.CE
+.PP
\fIcanvas\fR and \fIitemPtr\fR have the usual meanings.
\fIoffset\fR is an offset in bytes into the selection where 0 refers
-to the first byte of the selection; it identifies
+to the first byte of the selection; it identifies
the first character that is to be returned in this call.
\fIbuffer\fR points to an area of memory in which to store the
requested bytes, and \fImaxBytes\fR specifies the maximum number
of bytes to return.
\fIselectionProc\fR should extract up to \fImaxBytes\fR characters
-from the selection and copy them to \fImaxBytes\fR; it should
+from the selection and copy them to \fImaxBytes\fR; it should
return a count of the number of bytes actually copied, which may
be less than \fImaxBytes\fR if there are not \fIoffset+maxBytes\fR bytes
in the selection.
.SS INSERTPROC
.PP
-\fItypePtr->insertProc\fR is invoked by Tk during
-the \fBinsert\fR widget command to insert new text into a
+\fItypePtr\->insertProc\fR is invoked by Tk during
+the \fBinsert\fR widget command to insert new text or coordinates into a
canvas item.
-It is only relevant for item types that support text;
-\fItypePtr->insertProc\fR may be specified as NULL for non-textual
+It is only relevant for item types that support the \fBinsert\fR method;
+\fItypePtr\->insertProc\fR may be specified as NULL for other
item types.
The procedure must match the following prototype:
+.PP
.CS
-typedef void Tk_ItemInsertProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIindex\fR,
- char *\fIstring\fR);
+typedef void \fBTk_ItemInsertProc\fR(
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIindex\fR,
+ Tcl_Obj *\fIobj\fR);
.CE
+.PP
\fIcanvas\fR and \fIitemPtr\fR have the usual meanings.
\fIindex\fR is an index into the item's text, as returned by a
-previous call to \fItypePtr->insertProc\fR, and \fIstring\fR
+previous call to \fItypePtr\->insertProc\fR, and \fIobj\fR
contains new text to insert just before the character given
by \fIindex\fR.
+Note that if \fBTK_CONFIG_OBJS\fR is not set in the
+\fItypePtr\->alwaysRedraw\fR field, the \fIobj\fR parameter will
+actually contain a pointer to a constant string to be inserted.
+If the item supports modification of the coordinates list by this
+.PP
The type manager should insert the text and recompute the bounding
box in the item's header.
.SS DCHARSPROC
.PP
-\fItypePtr->dCharsProc\fR is invoked by Tk during the \fBdchars\fR
-widget command to delete a range of text from a canvas item.
+\fItypePtr\->dCharsProc\fR is invoked by Tk during the \fBdchars\fR
+widget command to delete a range of text from a canvas item or a range of
+coordinates from a pathed item.
It is only relevant for item types that support text;
-\fItypePtr->dCharsProc\fR may be specified as NULL for non-textual
-item types.
+\fItypePtr\->dCharsProc\fR may be specified as NULL for non-textual
+item types that do not want to support coordinate deletion.
The procedure must match the following prototype:
+.PP
.CS
-typedef void Tk_ItemDCharsProc(
- Tk_Canvas \fIcanvas\fR,
- Tk_Item *\fIitemPtr\fR,
- int \fIfirst\fR,
- int \fIlast\fR);
+typedef void \fBTk_ItemDCharsProc\fR(
+ Tk_Canvas \fIcanvas\fR,
+ Tk_Item *\fIitemPtr\fR,
+ int \fIfirst\fR,
+ int \fIlast\fR);
.CE
+.PP
\fIcanvas\fR and \fIitemPtr\fR have the usual meanings.
\fIfirst\fR and \fIlast\fR give the indices of the first and last bytes
-to be deleted, as returned by previous calls to \fItypePtr->indexProc\fR.
+to be deleted, as returned by previous calls to \fItypePtr\->indexProc\fR.
The type manager should delete the specified characters and update
the bounding box in the item's header.
.SH "SEE ALSO"
diff --git a/doc/CrtPhImgFmt.3 b/doc/CrtPhImgFmt.3
index 0575d40..68c9c56 100644
--- a/doc/CrtPhImgFmt.3
+++ b/doc/CrtPhImgFmt.3
@@ -20,11 +20,10 @@ Tk_CreatePhotoImageFormat \- define new file format for photo images
.sp
\fBTk_CreatePhotoImageFormat\fR(\fIformatPtr\fR)
.SH ARGUMENTS
-.AS Tk_PhotoImageFormat *formatPtr
-.AP Tk_PhotoImageFormat *formatPtr in
+.AS "const Tk_PhotoImageFormat" *formatPtr
+.AP "const Tk_PhotoImageFormat" *formatPtr in
Structure that defines the new file format.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_CreatePhotoImageFormat\fR is invoked to define a new file format
@@ -46,14 +45,14 @@ handler to deal with files and strings in this format. The
Tk_PhotoImageFormat structure contains the following fields:
.CS
typedef struct Tk_PhotoImageFormat {
- char *\fIname\fR;
+ const char *\fIname\fR;
Tk_ImageFileMatchProc *\fIfileMatchProc\fR;
Tk_ImageStringMatchProc *\fIstringMatchProc\fR;
Tk_ImageFileReadProc *\fIfileReadProc\fR;
Tk_ImageStringReadProc *\fIstringReadProc\fR;
Tk_ImageFileWriteProc *\fIfileWriteProc\fR;
Tk_ImageStringWriteProc *\fIstringWriteProc\fR;
-} Tk_PhotoImageFormat;
+} \fBTk_PhotoImageFormat\fR;
.CE
.PP
The handler need not provide implementations of all six procedures.
@@ -65,8 +64,7 @@ structure should be set to NULL. The handler must provide the
\fIfileMatchProc\fR procedure if it provides the \fIfileReadProc\fR
procedure, and the \fIstringMatchProc\fR procedure if it provides the
\fIstringReadProc\fR procedure.
-
-.SH NAME
+.SS NAME
.PP
\fIformatPtr->name\fR provides a name for the image type.
Once \fBTk_CreatePhotoImageFormat\fR returns, this name may be used
@@ -77,20 +75,20 @@ the \fB\-format\fR option. The first character of \fIformatPtr->name\fR
must not be an uppercase character from the ASCII character set
(that is, one of the characters \fBA\fR-\fBZ\fR). Such names are used
only for legacy interface support (see below).
-
-.SH FILEMATCHPROC
+.SS FILEMATCHPROC
+.PP
\fIformatPtr->fileMatchProc\fR provides the address of a procedure for
Tk to call when it is searching for an image file format handler
suitable for reading data in a given file.
\fIformatPtr->fileMatchProc\fR must match the following prototype:
.CS
-typedef int Tk_ImageFileMatchProc(
- Tcl_Channel \fIchan\fR,
- const char *\fIfileName\fR,
- Tcl_Obj *\fIformat\fR,
- int *\fIwidthPtr\fR,
- int *\fIheightPtr\fR,
- Tcl_Interp *\fIinterp\fR);
+typedef int \fBTk_ImageFileMatchProc\fR(
+ Tcl_Channel \fIchan\fR,
+ const char *\fIfileName\fR,
+ Tcl_Obj *\fIformat\fR,
+ int *\fIwidthPtr\fR,
+ int *\fIheightPtr\fR,
+ Tcl_Interp *\fIinterp\fR);
.CE
The \fIfileName\fR argument is the name of the file containing the
image data, which is open for reading as \fIchan\fR. The
@@ -100,19 +98,19 @@ If the data in the file appears to be in the format supported by this
handler, the \fIformatPtr->fileMatchProc\fR procedure should store the
width and height of the image in *\fIwidthPtr\fR and *\fIheightPtr\fR
respectively, and return 1. Otherwise it should return 0.
-
-.SH STRINGMATCHPROC
+.SS STRINGMATCHPROC
+.PP
\fIformatPtr->stringMatchProc\fR provides the address of a procedure for
Tk to call when it is searching for an image file format handler for
suitable for reading data from a given string.
\fIformatPtr->stringMatchProc\fR must match the following prototype:
.CS
-typedef int Tk_ImageStringMatchProc(
- Tcl_Obj *\fIdata\fR,
- Tcl_Obj *\fIformat\fR,
- int *\fIwidthPtr\fR,
- int *\fIheightPtr\fR,
- Tcl_Interp *\fIinterp\fR);
+typedef int \fBTk_ImageStringMatchProc\fR(
+ Tcl_Obj *\fIdata\fR,
+ Tcl_Obj *\fIformat\fR,
+ int *\fIwidthPtr\fR,
+ int *\fIheightPtr\fR,
+ Tcl_Interp *\fIinterp\fR);
.CE
The \fIdata\fR argument points to the object containing the image
data. The \fIformat\fR argument contains the value given for
@@ -122,21 +120,21 @@ this handler, the \fIformatPtr->stringMatchProc\fR procedure should
store the width and height of the image in *\fIwidthPtr\fR and
*\fIheightPtr\fR respectively, and return 1. Otherwise it should
return 0.
-
-.SH FILEREADPROC
+.SS FILEREADPROC
+.PP
\fIformatPtr->fileReadProc\fR provides the address of a procedure for
Tk to call to read data from an image file into a photo image.
\fIformatPtr->fileReadProc\fR must match the following prototype:
.CS
-typedef int Tk_ImageFileReadProc(
- Tcl_Interp *\fIinterp\fR,
- Tcl_Channel \fIchan\fR,
- const char *\fIfileName\fR,
- Tcl_Obj *\fIformat\fR,
- PhotoHandle \fIimageHandle\fR,
- int \fIdestX\fR, int \fIdestY\fR,
- int \fIwidth\fR, int \fIheight\fR,
- int \fIsrcX\fR, int \fIsrcY\fR);
+typedef int \fBTk_ImageFileReadProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ Tcl_Channel \fIchan\fR,
+ const char *\fIfileName\fR,
+ Tcl_Obj *\fIformat\fR,
+ PhotoHandle \fIimageHandle\fR,
+ int \fIdestX\fR, int \fIdestY\fR,
+ int \fIwidth\fR, int \fIheight\fR,
+ int \fIsrcX\fR, int \fIsrcY\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the command was
invoked to read the image; it should be used for reporting errors.
@@ -151,20 +149,20 @@ coordinates (\fIsrcX\fR,\fIsrcY\fR). It is to be stored in the photo
image with its top-left corner at coordinates
(\fIdestX\fR,\fIdestY\fR) using the \fBTk_PhotoPutBlock\fR procedure.
The return value is a standard Tcl return value.
-
-.SH STRINGREADPROC
+.SS STRINGREADPROC
+.PP
\fIformatPtr->stringReadProc\fR provides the address of a procedure for
Tk to call to read data from a string into a photo image.
\fIformatPtr->stringReadProc\fR must match the following prototype:
.CS
-typedef int Tk_ImageStringReadProc(
- Tcl_Interp *\fIinterp\fR,
- Tcl_Obj *\fIdata\fR,
- Tcl_Obj *\fIformat\fR,
- PhotoHandle \fIimageHandle\fR,
- int \fIdestX\fR, int \fIdestY\fR,
- int \fIwidth\fR, int \fIheight\fR,
- int \fIsrcX\fR, int \fIsrcY\fR);
+typedef int \fBTk_ImageStringReadProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ Tcl_Obj *\fIdata\fR,
+ Tcl_Obj *\fIformat\fR,
+ PhotoHandle \fIimageHandle\fR,
+ int \fIdestX\fR, int \fIdestY\fR,
+ int \fIwidth\fR, int \fIheight\fR,
+ int \fIsrcX\fR, int \fIsrcY\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the command was
invoked to read the image; it should be used for reporting errors.
@@ -179,17 +177,17 @@ coordinates (\fIsrcX\fR,\fIsrcY\fR). It is to be stored in the photo
image with its top-left corner at coordinates
(\fIdestX\fR,\fIdestY\fR) using the \fBTk_PhotoPutBlock\fR procedure.
The return value is a standard Tcl return value.
-
-.SH FILEWRITEPROC
+.SS FILEWRITEPROC
+.PP
\fIformatPtr->fileWriteProc\fR provides the address of a procedure for
Tk to call to write data from a photo image to a file.
\fIformatPtr->fileWriteProc\fR must match the following prototype:
.CS
-typedef int Tk_ImageFileWriteProc(
- Tcl_Interp *\fIinterp\fR,
- const char *\fIfileName\fR,
- Tcl_Obj *\fIformat\fR,
- Tk_PhotoImageBlock *\fIblockPtr\fR);
+typedef int \fBTk_ImageFileWriteProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ const char *\fIfileName\fR,
+ Tcl_Obj *\fIformat\fR,
+ Tk_PhotoImageBlock *\fIblockPtr\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the command was
invoked to write the image; it should be used for reporting errors.
@@ -204,16 +202,16 @@ after the name of the format. If appropriate, the
\fIformatPtr->fileWriteProc\fR procedure may interpret these
characters to specify further details about the image file.
The return value is a standard Tcl return value.
-
-.SH STRINGWRITEPROC
+.SS STRINGWRITEPROC
+.PP
\fIformatPtr->stringWriteProc\fR provides the address of a procedure for
Tk to call to translate image data from a photo image into a string.
\fIformatPtr->stringWriteProc\fR must match the following prototype:
.CS
-typedef int Tk_ImageStringWriteProc(
- Tcl_Interp *\fIinterp\fR,
- Tcl_Obj *\fIformat\fR,
- Tk_PhotoImageBlock *\fIblockPtr\fR);
+typedef int \fBTk_ImageStringWriteProc\fR(
+ Tcl_Interp *\fIinterp\fR,
+ Tcl_Obj *\fIformat\fR,
+ Tk_PhotoImageBlock *\fIblockPtr\fR);
.CE
The \fIinterp\fR argument is the interpreter in which the command was
invoked to convert the image; it should be used for reporting errors.
@@ -228,8 +226,8 @@ after the name of the format. If appropriate, the
\fIformatPtr->stringWriteProc\fR procedure may interpret these
characters to specify further details about the image file.
The return value is a standard Tcl return value.
-
.SH "LEGACY INTERFACE SUPPORT"
+.PP
In Tk 8.2 and earlier, the definition of all the function pointer
types stored in fields of a \fBTk_PhotoImageFormat\fR struct were
incompatibly different. Legacy programs and libraries dating from
@@ -266,9 +264,7 @@ use Tk 8.4 headers and stub libraries to do so.
.PP
Any new code written today should not make use of the legacy
interfaces. Expect their support to go away in Tk 9.
-
.SH "SEE ALSO"
Tk_FindPhoto, Tk_PhotoPutBlock
-
.SH KEYWORDS
photo image, image file
diff --git a/doc/CrtSelHdlr.3 b/doc/CrtSelHdlr.3
index c081c71..b7758df 100644
--- a/doc/CrtSelHdlr.3
+++ b/doc/CrtSelHdlr.3
@@ -54,11 +54,11 @@ the selection. The most common form is STRING.
\fIProc\fR should have arguments and result that match the
type \fBTk_SelectionProc\fR:
.CS
-typedef int Tk_SelectionProc(
- ClientData \fIclientData\fR,
- int \fIoffset\fR,
- char *\fIbuffer\fR,
- int \fImaxBytes\fR);
+typedef int \fBTk_SelectionProc\fR(
+ ClientData \fIclientData\fR,
+ int \fIoffset\fR,
+ char *\fIbuffer\fR,
+ int \fImaxBytes\fR);
.CE
The \fIclientData\fR parameter to \fIproc\fR is a copy of the
\fIclientData\fR argument given to \fBTk_CreateSelHandler\fR.
@@ -112,6 +112,5 @@ existing handler is replaced with a new one.
\fBTk_DeleteSelHandler\fR removes the handler given by \fItkwin\fR,
\fIselection\fR, and \fItarget\fR, if such a handler exists.
If there is no such handler then it has no effect.
-
.SH KEYWORDS
format, handler, selection, target
diff --git a/doc/CrtWindow.3 b/doc/CrtWindow.3
index 8e36cb0..43d323b 100644
--- a/doc/CrtWindow.3
+++ b/doc/CrtWindow.3
@@ -58,8 +58,8 @@ are used to create new windows for
use in Tk-based applications. Each of the procedures returns a token
that can be used to manipulate the window in other calls to the Tk
library. If the window could not be created successfully, then NULL
-is returned and \fIinterp->result\fR is modified to hold an error
-message.
+is returned and the result of interpreter \fIinterp\fR is modified to
+hold an error message.
.PP
Tk supports two different kinds of windows: internal
windows and top-level windows.
@@ -86,7 +86,7 @@ which would in turn be a child of the menu bar window. A dialog box might
have the application's main window as its parent.
.PP
\fBTk_CreateAnonymousWindow\fR differs from \fBTk_CreateWindow\fR in
-that it creates an unnamed window. This window will be manipulable
+that it creates an unnamed window. This window will be manipulatable
only using C interfaces, and will not be visible to Tcl scripts. Both
interior windows and top-level windows may be created with
\fBTk_CreateAnonymousWindow\fR.
@@ -141,7 +141,6 @@ but has not been mapped, so no X window exists, it is
possible to force the creation of the X window by
calling \fBTk_MakeWindowExist\fR. This procedure issues
the X commands to instantiate the window given by \fItkwin\fR.
-
.SH KEYWORDS
create, deferred creation, destroy, display, internal window,
screen, top-level window, window
diff --git a/doc/DeleteImg.3 b/doc/DeleteImg.3
index 2b9288e..5cde9e7 100644
--- a/doc/DeleteImg.3
+++ b/doc/DeleteImg.3
@@ -21,13 +21,11 @@ Interpreter for which the image was created.
.AP "const char" *name in
Name of the image.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_DeleteImage\fR deletes the image given by \fIinterp\fR
and \fIname\fR, if there is one. All instances of that image
will redisplay as empty regions. If the given image does not
exist then the procedure has no effect.
-
.SH KEYWORDS
delete image, image manager
diff --git a/doc/DrawFocHlt.3 b/doc/DrawFocHlt.3
index 688cfdb..cfe5ddd 100644
--- a/doc/DrawFocHlt.3
+++ b/doc/DrawFocHlt.3
@@ -27,12 +27,10 @@ Width of the highlight ring, in pixels.
Drawable in which to draw the highlight; usually an offscreen
pixmap for double buffering.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_DrawFocusHighlight\fR is a utility procedure that draws the
traversal highlight ring for a widget.
It is typically invoked by widgets during redisplay.
-
.SH KEYWORDS
focus, traversal highlight
diff --git a/doc/EventHndlr.3 b/doc/EventHndlr.3
index 2ea04ae..8da777d 100644
--- a/doc/EventHndlr.3
+++ b/doc/EventHndlr.3
@@ -30,7 +30,6 @@ in the window given by \fItkwin\fR.
.AP ClientData clientData in
Arbitrary one-word value to pass to \fIproc\fR.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_CreateEventHandler\fR arranges for \fIproc\fR to be
@@ -45,9 +44,9 @@ call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
\fIProc\fR should have arguments and result that match the
type \fBTk_EventProc\fR:
.CS
-typedef void Tk_EventProc(
- ClientData \fIclientData\fR,
- XEvent *\fIeventPtr\fR);
+typedef void \fBTk_EventProc\fR(
+ ClientData \fIclientData\fR,
+ XEvent *\fIeventPtr\fR);
.CE
The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR
argument given to \fBTk_CreateEventHandler\fR when the callback
@@ -72,6 +71,5 @@ automatically; in this case there is no need to call
If multiple handlers are declared for the same type of X event
on the same window, then the handlers will be invoked in the
order they were created.
-
.SH KEYWORDS
bind, callback, event, handler
diff --git a/doc/FindPhoto.3 b/doc/FindPhoto.3
index 08e0221..950d208 100644
--- a/doc/FindPhoto.3
+++ b/doc/FindPhoto.3
@@ -21,7 +21,6 @@ Tk_FindPhoto, Tk_PhotoPutBlock, Tk_PhotoPutZoomedBlock, Tk_PhotoGetImage, Tk_Pho
Tk_PhotoHandle
\fBTk_FindPhoto\fR(\fIinterp, imageName\fR)
.sp
-.VS 8.5
int
\fBTk_PhotoPutBlock\fR(\fIinterp, handle, blockPtr, x, y, width, height,\
compRule\fR)
@@ -29,7 +28,6 @@ compRule\fR)
int
\fBTk_PhotoPutZoomedBlock\fR(\fIinterp, handle, blockPtr, x, y, width, height,\
zoomX, zoomY, subsampleX, subsampleY, compRule\fR)
-.VE 8.5
.sp
int
\fBTk_PhotoGetImage\fR(\fIhandle, blockPtr\fR)
@@ -37,18 +35,14 @@ int
void
\fBTk_PhotoBlank\fR(\fIhandle\fR)
.sp
-.VS 8.5
int
\fBTk_PhotoExpand\fR(\fIinterp, handle, width, height\fR)
-.VE 8.5
.sp
void
\fBTk_PhotoGetSize\fR(\fIhandle, widthPtr, heightPtr\fR)
.sp
-.VS 8.5
int
\fBTk_PhotoSetSize\fR(\fIinterp. handle, width, height\fR)
-.VE 8.5
.SH ARGUMENTS
.AS Tk_PhotoImageBlock window_path
.AP Tcl_Interp *interp in
@@ -99,7 +93,6 @@ being written to the photo image.
Specifies the zoom factor to be applied in the Y direction to pixels
being written to the photo image.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_FindPhoto\fR returns an opaque handle that is used to identify a
@@ -128,8 +121,8 @@ typedef struct {
int \fIheight\fR;
int \fIpitch\fR;
int \fIpixelSize\fR;
- int \fIoffset[4]\fR;
-} Tk_PhotoImageBlock;
+ int \fIoffset\fR[4];
+} \fBTk_PhotoImageBlock\fR;
.CE
The \fIpixelPtr\fR field points to the first pixel, that is, the
top-left pixel in the block.
@@ -161,12 +154,10 @@ given are replicated (in a tiled fashion) to fill the specified area.
These rules operate independently in the horizontal and vertical
directions.
.PP
-.VS 8.5
\fBTk_PhotoPutBlock\fR normally returns \fBTCL_OK\fR, though if it cannot
allocate sufficient memory to hold the resulting image, \fBTCL_ERROR\fR is
returned instead and, if the \fIinterp\fR argument is non-NULL, an
error message is placed in the interpreter's result.
-.VE 8.5
.PP
\fBTk_PhotoPutZoomedBlock\fR works like \fBTk_PhotoPutBlock\fR except that
the image can be reduced or enlarged for display. The
@@ -207,12 +198,10 @@ are being supplied in many small blocks, it is more efficient to use
allowing the image to expand in many small increments as image blocks
are supplied.
.PP
-.VS 8.5
\fBTk_PhotoExpand\fR normally returns \fBTCL_OK\fR, though if it cannot
allocate sufficient memory to hold the resulting image, \fBTCL_ERROR\fR is
returned instead and, if the \fIinterp\fR argument is non-NULL, an
error message is placed in the interpreter's result.
-.VE 8.5
.PP
\fBTk_PhotoSetSize\fR specifies the size of the image, as if the user
had specified the given \fIwidth\fR and \fIheight\fR values to the
@@ -222,16 +211,13 @@ or height, but allows the width or height to be changed by subsequent
calls to \fBTk_PhotoPutBlock\fR, \fBTk_PhotoPutZoomedBlock\fR or
\fBTk_PhotoExpand\fR.
.PP
-.VS 8.5
\fBTk_PhotoSetSize\fR normally returns \fBTCL_OK\fR, though if it cannot
allocate sufficient memory to hold the resulting image, \fBTCL_ERROR\fR is
returned instead and, if the \fIinterp\fR argument is non-NULL, an
error message is placed in the interpreter's result.
-.VE 8.5
.PP
\fBTk_PhotoGetSize\fR returns the dimensions of the image in
*\fIwidthPtr\fR and *\fIheightPtr\fR.
-
.SH PORTABILITY
.PP
In Tk 8.3 and earlier, \fBTk_PhotoPutBlock\fR and
@@ -241,7 +227,6 @@ your code, compile it with the flag
-DUSE_COMPOSITELESS_PHOTO_PUT_BLOCK. Code linked using Stubs against
older versions of Tk will continue to work.
.PP
-.VS 8.5
In Tk 8.4, \fBTk_PhotoPutBlock\fR, \fBTk_PhotoPutZoomedBlock\fR,
\fBTk_PhotoExpand\fR and \fBTk_PhotoSetSize\fR did not take an
\fIinterp\fR argument or return any result code. If insufficient
@@ -249,12 +234,9 @@ memory was available for an image, Tk would panic. This behaviour is
still supported if you compile your extension with the additional flag
-DUSE_PANIC_ON_PHOTO_ALLOC_FAILURE. Code linked using Stubs against
older versions of Tk will continue to work.
-.VE 8.5
-
.SH CREDITS
.PP
The code for the photo image type was developed by Paul Mackerras,
based on his earlier photo widget code.
-
.SH KEYWORDS
photo, image
diff --git a/doc/FontId.3 b/doc/FontId.3
index 60905a7..69991fd 100644
--- a/doc/FontId.3
+++ b/doc/FontId.3
@@ -65,6 +65,7 @@ following screen font families should print correctly:
Any other font families may not print correctly because the computed
Postscript font name may be incorrect or not exist on the printer.
.SH "DATA STRUCTURES"
+.PP
The \fBTk_FontMetrics\fR data structure is used by \fBTk_GetFontMetrics\fR to
return information about a font and is defined as follows:
.CS
@@ -72,7 +73,7 @@ typedef struct Tk_FontMetrics {
int \fIascent\fR;
int \fIdescent\fR;
int \fIlinespace\fR;
-} Tk_FontMetrics;
+} \fBTk_FontMetrics\fR;
.CE
.PP
The \fIascent\fR field is the amount in pixels that the tallest
diff --git a/doc/GeomReq.3 b/doc/GeomReq.3
index 4d8e788..ed447b9 100644
--- a/doc/GeomReq.3
+++ b/doc/GeomReq.3
@@ -44,7 +44,6 @@ Space to leave for top side of internal border for \fItkwin\fR, in pixel units.
.AP int bottom in
Space to leave for bottom side of internal border for \fItkwin\fR, in pixel units.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_GeometryRequest\fR is called by widget code to indicate its
@@ -89,6 +88,5 @@ The information specified in calls to \fBTk_GeometryRequest\fR,
\fBTk_InternalBorderRight\fR, \fBTk_InternalBorderTop\fR and
\fBTk_InternalBorderBottom\fR.
See the \fBTk_WindowId\fR manual entry for details.
-
.SH KEYWORDS
geometry, request
diff --git a/doc/GetAnchor.3 b/doc/GetAnchor.3
index 8698353..2ed7627 100644
--- a/doc/GetAnchor.3
+++ b/doc/GetAnchor.3
@@ -28,17 +28,20 @@ const char *
Interpreter to use for error reporting, or NULL.
.AP Tcl_Obj *objPtr in/out
String value contains name of anchor point:
-.QW n ,
-.QW ne ,
-.QW e ,
-.QW se ,
-.QW s ,
-.QW sw ,
-.QW w ,
-.QW nw ,
+.QW \fBn\fR ,
+.QW \fBne\fR ,
+.QW \fBe\fR ,
+.QW \fBse\fR ,
+.QW \fBs\fR ,
+.QW \fBsw\fR ,
+.QW \fBw\fR ,
+.QW \fBnw\fR ,
or
-.QW center ;
-internal rep will be modified to cache corresponding Tk_Anchor.
+.QW \fBcenter\fR ;
+internal rep will be modified to cache corresponding Tk_Anchor. In the
+case of
+.QW \fBcenter\fR
+on input, a non-empty abbreviation of it may also be used on input.
.AP "const char" *string in
Same as \fIobjPtr\fR except description of anchor point is passed as
a string.
diff --git a/doc/GetBitmap.3 b/doc/GetBitmap.3
index a9bd2c2..d5482f6 100644
--- a/doc/GetBitmap.3
+++ b/doc/GetBitmap.3
@@ -49,7 +49,7 @@ Same as \fIobjPtr\fR except description of bitmap is passed as a string and
resulting Pixmap is not cached.
.AP "const char" *name in
Name for new bitmap to be defined.
-.AP "const char" *source in
+.AP "const void" *source in
Data for bitmap, in standard bitmap format.
Must be stored in static memory whose value will never change.
.AP "int" width in
@@ -66,7 +66,6 @@ Display for which \fIbitmap\fR was allocated.
Identifier for a bitmap allocated by \fBTk_AllocBitmapFromObj\fR or
\fBTk_GetBitmap\fR.
.BE
-
.SH DESCRIPTION
.PP
These procedures manage a collection of bitmaps (one-plane pixmaps)
@@ -82,7 +81,7 @@ of the following forms:
.TP 20
\fB@\fIfileName\fR
\fIFileName\fR must be the name of a file containing a bitmap
-description in the standard X11 or X10 format.
+description in the standard X11 format.
.TP 20
\fIname\fR
\fIName\fR must be the name of a bitmap defined previously with
@@ -210,7 +209,7 @@ describe the bitmap.
\fBTk_DefineBitmap\fR normally returns \fBTCL_OK\fR; if an error occurs
(e.g. a bitmap named \fInameId\fR has already been defined) then
\fBTCL_ERROR\fR is returned and an error message is left in
-\fIinterp->result\fR.
+interpreter \fIinterp\fR's result.
Note: \fBTk_DefineBitmap\fR expects the memory pointed to by
\fIsource\fR to be static: \fBTk_DefineBitmap\fR does not make
a private copy of this memory, but uses the bytes pointed to
@@ -282,8 +281,8 @@ with its Pixmap token.
There should be exactly one call to \fBTk_FreeBitmapFromObj\fR
or \fBTk_FreeBitmap\fR for each call to \fBTk_AllocBitmapFromObj\fR or
\fBTk_GetBitmap\fR.
-
.SH BUGS
+.PP
In determining whether an existing bitmap can be used to satisfy
a new request, \fBTk_AllocBitmapFromObj\fR and \fBTk_GetBitmap\fR
consider only the immediate value of the string description. For
@@ -293,6 +292,5 @@ bitmap created from the same file name: it will not check to
see whether the file itself has changed, or whether the current
directory has changed, thereby causing the name to refer to
a different file.
-
.SH KEYWORDS
bitmap, pixmap
diff --git a/doc/GetCapStyl.3 b/doc/GetCapStyl.3
index 5463f12..3c9dbb0 100644
--- a/doc/GetCapStyl.3
+++ b/doc/GetCapStyl.3
@@ -24,18 +24,18 @@ const char *
.AP Tcl_Interp *interp in
Interpreter to use for error reporting.
.AP "const char" *string in
-String containing name of cap style: one of
-.QW butt ,
-.QW projecting ,
+String containing name of cap style \- one of
+.QW \fBbutt\fR ,
+.QW \fBprojecting\fR ,
or
-.QW round .
+.QW \fBround\fR
+\- or a unique abbreviation of one.
.AP int *capPtr out
Pointer to location in which to store X cap style corresponding to
\fIstring\fR.
.AP int cap in
Cap style: one of \fBCapButt\fR, \fBCapProjecting\fR, or \fBCapRound\fR.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_GetCapStyle\fR places in \fI*capPtr\fR the X cap style
@@ -51,7 +51,7 @@ Under normal circumstances the return value is \fBTCL_OK\fR and
\fIinterp\fR is unused.
If \fIstring\fR does not contain a valid cap style
or an abbreviation of one of these names, then an error message is
-stored in \fIinterp->result\fR, \fBTCL_ERROR\fR is returned, and
+stored in interpreter \fIinterp\fR's result, \fBTCL_ERROR\fR is returned, and
\fI*capPtr\fR is unmodified.
.PP
\fBTk_NameOfCapStyle\fR is the logical inverse of \fBTk_GetCapStyle\fR.
@@ -60,6 +60,5 @@ statically-allocated string corresponding to \fIcap\fR.
If \fIcap\fR is not a legal cap style, then
.QW "unknown cap style"
is returned.
-
.SH KEYWORDS
butt, cap style, projecting, round
diff --git a/doc/GetColor.3 b/doc/GetColor.3
index 25fe16e..5b7a553 100644
--- a/doc/GetColor.3
+++ b/doc/GetColor.3
@@ -58,7 +58,6 @@ call to \fBTk_AllocColorFromObj\fR, \fBTk_GetColor\fR or
Drawable in which the result graphics context will be used. Must have
same screen and depth as the window for which the color was allocated.
.BE
-
.SH DESCRIPTION
.PP
These procedures manage the colors being used by a Tk application.
diff --git a/doc/GetCursor.3 b/doc/GetCursor.3
index 953252b..3946105 100644
--- a/doc/GetCursor.3
+++ b/doc/GetCursor.3
@@ -67,7 +67,6 @@ Opaque Tk identifier for cursor. If passed to \fBTk_FreeCursor\fR, must
have been returned by some previous call to \fBTk_GetCursor\fR or
\fBTk_GetCursorFromData\fR.
.BE
-
.SH DESCRIPTION
.PP
These procedures manage a collection of cursors
@@ -118,7 +117,7 @@ in preference to black and white cursors.
\fB@\fIsourceName\0maskName\0fgColor\0bgColor\fR
In this form, \fIsourceName\fR and \fImaskName\fR are the names of
files describing cursors for the cursor's source bits and mask.
-Each file must be in standard X11 or X10 cursor format.
+Each file must be in standard X11 cursor format.
\fIFgColor\fR and \fIbgColor\fR
indicate the colors to use for the
cursor, in any of the forms acceptable to \fBTk_GetColor\fR. This
@@ -213,8 +212,8 @@ with its Tk_Cursor token.
There should be exactly one call to \fBTk_FreeCursor\fR for
each call to \fBTk_AllocCursorFromObj\fR, \fBTk_GetCursor\fR,
or \fBTk_GetCursorFromData\fR.
-
.SH BUGS
+.PP
In determining whether an existing cursor can be used to satisfy
a new request, \fBTk_AllocCursorFromObj\fR, \fBTk_GetCursor\fR,
and \fBTk_GetCursorFromData\fR
@@ -228,6 +227,5 @@ a different file. Similarly, \fBTk_GetCursorFromData\fR assumes
that if the same \fIsource\fR pointer is used in two different calls,
then the pointers refer to the same data; it does not check to
see if the actual data values have changed.
-
.SH KEYWORDS
cursor
diff --git a/doc/GetDash.3 b/doc/GetDash.3
index cc54c5a..a0a4c81 100644
--- a/doc/GetDash.3
+++ b/doc/GetDash.3
@@ -13,28 +13,30 @@ Tk_GetDash \- convert from string to valid dash structure.
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
-.sp
+
int
\fBTk_GetDash\fR(\fIinterp, string, dashPtr\fR)
+.fi
.SH ARGUMENTS
.AS Tk_Dash *dashPtr
.AP Tcl_Interp *interp in
Interpreter to use for error reporting.
-.AP "const char *" string in
+.AP "const char" *string in
Textual value to be converted.
.AP Tk_Dash *dashPtr out
Points to place to store the dash pattern
-value converted from \fIstring\fR.
+value converted from \fIstring\fR. Must not be NULL.
.BE
-
.SH DESCRIPTION
.PP
These procedure parses the string and fills in the result in the
Tk_Dash structure. The string can be a list of integers or a
character string containing only
-.QW \fB.,\-_\fR
-or spaces. If all
-goes well, \fBTCL_OK\fR is returned. If \fIstring\fR does not have the
+.QW \fB.,-_\fR
+and spaces. If all
+goes well, \fBTCL_OK\fR is returned and a dash descriptor is stored
+in the variable pointed to by \fIdashPtr\fR.
+If \fIstring\fR does not have the
proper syntax then \fBTCL_ERROR\fR is returned, an error message is left
in the interpreter's result, and nothing is stored at *\fIdashPtr\fR.
.PP
@@ -46,33 +48,35 @@ color. The other segments are drawn transparent.
.PP
The second possible syntax is a character list containing only
5 possible characters
-.QW "\fB.,\-_ \fR" .
+.QW "\fB.,-_ \fR" .
The space can be used
to enlarge the space between other line elements, and can not
-occur as the first position in the string. Some examples:
+occur in the first position of the string. Some examples:
+.PP
.CS
\-dash . = \-dash {2 4}
- \-dash \- = \-dash {6 4}
- \-dash \-. = \-dash {6 4 2 4}
- \-dash \-.. = \-dash {6 4 2 4 2 4}
+ \-dash - = \-dash {6 4}
+ \-dash -. = \-dash {6 4 2 4}
+ \-dash -.. = \-dash {6 4 2 4 2 4}
\-dash {. } = \-dash {2 8}
\-dash , = \-dash {4 4}
.CE
.PP
-The main difference of this syntax with the previous is that it
+The main difference between this syntax and the numeric is that it
is shape-conserving. This means that all values in the dash
list will be multiplied by the line width before display. This
-assures that
+ensures that
.QW .
will always be displayed as a dot and
-.QW \-
+.QW -
always as a dash regardless of the line width.
.PP
On systems where only a limited set of dash patterns, the dash
pattern will be displayed as the most close dash pattern that
is available. For example, on Windows only the first 4 of the
-above examples are available. The last 2 examples will be
-displayed identically as the first one.
-
+above examples are available; the last 2 examples will be
+displayed identically to the first one.
+.SH "SEE ALSO"
+canvas(n), Tk_CreateItemType(3)
.SH KEYWORDS
dash, conversion
diff --git a/doc/GetFont.3 b/doc/GetFont.3
index 2ca1395..572b94f 100644
--- a/doc/GetFont.3
+++ b/doc/GetFont.3
@@ -31,7 +31,6 @@ Tk_Font
.sp
void
\fBTk_FreeFont(\fItkfont\fB)\fR
-
.SH ARGUMENTS
.AS "const char" *tkfont
.AP "Tcl_Interp" *interp in
@@ -105,7 +104,6 @@ with the same information used to create it; for
with its Tk_Font token. There should be
exactly one call to \fBTk_FreeFontFromObj\fR or \fBTk_FreeFont\fR
for each call to \fBTk_AllocFontFromObj\fR or \fBTk_GetFont\fR.
-
.SH "SEE ALSO"
Tk_FontId(3)
.SH KEYWORDS
diff --git a/doc/GetGC.3 b/doc/GetGC.3
index 146b527..4c6f9ff 100644
--- a/doc/GetGC.3
+++ b/doc/GetGC.3
@@ -34,7 +34,6 @@ Display for which \fIgc\fR was allocated.
X identifier for graphics context that is no longer needed.
Must have been allocated by \fBTk_GetGC\fR.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_GetGC\fR and \fBTk_FreeGC\fR manage a collection of graphics contexts
@@ -67,6 +66,5 @@ each call to \fBTk_GetGC\fR.
When a graphics context is no longer in use anywhere (i.e. it has
been freed as many times as it has been gotten) \fBTk_FreeGC\fR
will release it to the X server and delete it from the database.
-
.SH KEYWORDS
graphics context
diff --git a/doc/GetHWND.3 b/doc/GetHWND.3
index 06bdf37..c78df98 100644
--- a/doc/GetHWND.3
+++ b/doc/GetHWND.3
@@ -32,6 +32,5 @@ window given by \fIwindow\fR.
\fBTk_AttachHWND\fR binds the Windows HWND identifier to the
specified Tk_Window given by \fItkwin\fR. It returns an X Windows
window that encapsulates the HWND.
-
.SH KEYWORDS
identifier, window
diff --git a/doc/GetImage.3 b/doc/GetImage.3
index fb6e4c8..59232aa 100644
--- a/doc/GetImage.3
+++ b/doc/GetImage.3
@@ -63,7 +63,6 @@ Store width of \fIimage\fR (in pixels) here.
.AP "int" heightPtr out
Store height of \fIimage\fR (in pixels) here.
.BE
-
.SH DESCRIPTION
.PP
These procedures are invoked by widgets that wish to display images.
@@ -74,7 +73,7 @@ identifies the window where the image will be displayed.
\fBTk_GetImage\fR looks up the image in the table of existing
images and returns a token for a new instance of the image.
If the image does not exist then \fBTk_GetImage\fR returns NULL
-and leaves an error message in \fIinterp->result\fR.
+and leaves an error message in interpreter \fIinterp\fR's result.
.PP
When a widget wishes to actually display an image it must
call \fBTk_RedrawImage\fR, identifying the image (\fIimage\fR),
@@ -106,14 +105,14 @@ The \fIchangeProc\fR and \fIclientData\fR arguments to
\fIchangeProc\fR will be called by Tk whenever a change occurs
in the image; it must match the following prototype:
.CS
-typedef void Tk_ImageChangedProc(
- ClientData \fIclientData\fR,
- int \fIx\fR,
- int \fIy\fR,
- int \fIwidth\fR,
- int \fIheight\fR,
- int \fIimageWidth\fR,
- int \fIimageHeight\fR);
+typedef void \fBTk_ImageChangedProc\fR(
+ ClientData \fIclientData\fR,
+ int \fIx\fR,
+ int \fIy\fR,
+ int \fIwidth\fR,
+ int \fIheight\fR,
+ int \fIimageWidth\fR,
+ int \fIimageHeight\fR);
.CE
The \fIclientData\fR argument to \fIchangeProc\fR is the same as the
\fIclientData\fR argument to \fBTk_GetImage\fR.
@@ -125,9 +124,7 @@ they are specified in pixels measured from the upper-left
corner of the image.
The arguments \fIimageWidth\fR and \fIimageHeight\fR give
the image's (new) size.
-
.SH "SEE ALSO"
Tk_CreateImageType
-
.SH KEYWORDS
images, redisplay
diff --git a/doc/GetJoinStl.3 b/doc/GetJoinStl.3
index 1af1a06..5e527de 100644
--- a/doc/GetJoinStl.3
+++ b/doc/GetJoinStl.3
@@ -24,18 +24,18 @@ const char *
.AP Tcl_Interp *interp in
Interpreter to use for error reporting.
.AP "const char" *string in
-String containing name of join style: one of
-.QW bevel ,
-.QW miter ,
+String containing name of join style \- one of
+.QW \fBbevel\fR ,
+.QW \fBmiter\fR ,
or
-.QW round .
+.QW \fBround\fR
+\- or a unique abbreviation of one.
.AP int *joinPtr out
Pointer to location in which to store X join style corresponding to
\fIstring\fR.
.AP int join in
Join style: one of \fBJoinBevel\fR, \fBJoinMiter\fR, \fBJoinRound\fR.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_GetJoinStyle\fR places in \fI*joinPtr\fR the X join style
@@ -50,7 +50,7 @@ Under normal circumstances the return value is \fBTCL_OK\fR and
\fIinterp\fR is unused.
If \fIstring\fR does not contain a valid join style
or an abbreviation of one of these names, then an error message is
-stored in \fIinterp->result\fR, \fBTCL_ERROR\fR is returned, and
+stored in interpreter \fIinterp\fR's result, \fBTCL_ERROR\fR is returned, and
\fI*joinPtr\fR is unmodified.
.PP
\fBTk_NameOfJoinStyle\fR is the logical inverse of \fBTk_GetJoinStyle\fR.
@@ -59,6 +59,5 @@ statically-allocated string corresponding to \fIjoin\fR.
If \fIjoin\fR is not a legal join style, then
.QW "unknown join style"
is returned.
-
.SH KEYWORDS
bevel, join style, miter, round
diff --git a/doc/GetJustify.3 b/doc/GetJustify.3
index e8535e7..e9d59e9 100644
--- a/doc/GetJustify.3
+++ b/doc/GetJustify.3
@@ -27,11 +27,12 @@ const char *
.AP Tcl_Interp *interp in
Interpreter to use for error reporting, or NULL.
.AP Tcl_Obj *objPtr in/out
-String value contains name of justification style, one of
-.QW left ,
-.QW right ,
+String value contains name of justification style \- one of
+.QW \fBleft\fR ,
+.QW \fBright\fR ,
or
-.QW center .
+.QW \fBcenter\fR
+\- or a unique abbreviation of one.
The internal rep will be modified to cache corresponding justify value.
.AP "const char" *string in
Same as \fIobjPtr\fR except description of justification style is passed as
@@ -82,6 +83,5 @@ corresponding to \fIjustify\fR.
If \fIjustify\fR is not a legal justify value, then
.QW "unknown justification style"
is returned.
-
.SH KEYWORDS
center, fill, justification, string
diff --git a/doc/GetOption.3 b/doc/GetOption.3
index 79817b7..4e13b9b 100644
--- a/doc/GetOption.3
+++ b/doc/GetOption.3
@@ -26,7 +26,6 @@ Name of desired option.
Class of desired option. Null means there is no class for
this option; do lookup based on name only.
.BE
-
.SH DESCRIPTION
.PP
This procedure is invoked to retrieve an option from the database
@@ -39,6 +38,5 @@ is returned. If no option matches, then NULL is returned.
\fBTk_GetOption\fR caches options related to \fItkwin\fR so that
successive calls for the same \fItkwin\fR will execute much more
quickly than successive calls for different windows.
-
.SH KEYWORDS
class, name, option, retrieve
diff --git a/doc/GetPixels.3 b/doc/GetPixels.3
index 814c4eb..287e734 100644
--- a/doc/GetPixels.3
+++ b/doc/GetPixels.3
@@ -43,7 +43,6 @@ Pointer to location in which to store converted distance in pixels.
.AP double *doublePtr out
Pointer to location in which to store converted distance in millimeters.
.BE
-
.SH DESCRIPTION
.PP
These procedures take as argument a specification of distance on
@@ -85,13 +84,12 @@ value in \fIobjPtr\fR, which speeds up future calls to
\fBTk_GetPixels\fR is identical to \fBTk_GetPixelsFromObj\fR except
that the screen distance is specified with a string instead
of an object. This prevents \fBTk_GetPixels\fR from caching the
-return value, so \fBTk_GetAnchor\fR is less efficient than
+return value, so \fBTk_GetPixels\fR is less efficient than
\fBTk_GetPixelsFromObj\fR.
.PP
\fBTk_GetMMFromObj\fR and \fBTk_GetScreenMM\fR are similar to
\fBTk_GetPixelsFromObj\fR and \fBTk_GetPixels\fR (respectively) except
that they convert the screen distance to millimeters and
store a double-precision floating-point result at \fI*doublePtr\fR.
-
.SH KEYWORDS
centimeters, convert, inches, millimeters, pixels, points, screen units
diff --git a/doc/GetPixmap.3 b/doc/GetPixmap.3
index 9e9628a..63d7d62 100644
--- a/doc/GetPixmap.3
+++ b/doc/GetPixmap.3
@@ -33,7 +33,6 @@ Number of bits per pixel in pixmap.
.AP Pixmap pixmap in
Pixmap to destroy.
.BE
-
.SH DESCRIPTION
.PP
These procedures are identical to the Xlib procedures \fBXCreatePixmap\fR
@@ -49,6 +48,5 @@ with dimensions given by \fIwidth\fR, \fIheight\fR, and \fIdepth\fR,
and returns its identifier.
\fBTk_FreePixmap\fR destroys the pixmap given by \fIpixmap\fR and makes
its resource identifier available for reuse.
-
.SH KEYWORDS
pixmap, resource identifier
diff --git a/doc/GetRelief.3 b/doc/GetRelief.3
index b97a615..858c128 100644
--- a/doc/GetRelief.3
+++ b/doc/GetRelief.3
@@ -28,13 +28,14 @@ const char *
Interpreter to use for error reporting.
.AP Tcl_Obj *objPtr in/out
String value contains name of relief, one of
-.QW flat ,
-.QW groove ,
-.QW raised ,
-.QW ridge ,
-.QW solid ,
+.QW \fBflat\fR ,
+.QW \fBgroove\fR ,
+.QW \fBraised\fR ,
+.QW \fBridge\fR ,
+.QW \fBsolid\fR ,
or
-.QW sunken ;
+.QW \fBsunken\fR
+(or any unique abbreviation thereof on input);
the internal rep will be modified to cache corresponding relief value.
.AP char *string in
Same as \fIobjPtr\fR except description of relief is passed as
diff --git a/doc/GetScroll.3 b/doc/GetScroll.3
index 43fbab8..9c10450 100644
--- a/doc/GetScroll.3
+++ b/doc/GetScroll.3
@@ -9,46 +9,45 @@
.TH Tk_GetScrollInfo 3 8.0 Tk "Tk Library Procedures"
.BS
.SH NAME
-Tk_GetScrollInfo, Tk_GetScrollInfoObj \- parse arguments for scrolling commands
+Tk_GetScrollInfoObj, Tk_GetScrollInfo \- parse arguments for scrolling commands
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
.sp
int
-\fBTk_GetScrollInfo(\fIinterp, argc, argv, dblPtr, intPtr\fB)\fR
+\fBTk_GetScrollInfoObj(\fIinterp, objc, objv, dblPtr, intPtr\fB)\fR
.sp
int
-\fBTk_GetScrollInfoObj(\fIinterp, objc, objv, dblPtr, intPtr\fB)\fR
+\fBTk_GetScrollInfo(\fIinterp, argc, argv, dblPtr, intPtr\fB)\fR
.SH ARGUMENTS
-.AS "Tcl_Interp" *dblPtr
+.AS "Tcl_Interp" *fractionPtr
.AP Tcl_Interp *interp in
Interpreter to use for error reporting.
-.AP int argc in
-Number of strings in \fIargv\fR array.
-.AP "const char" *argv[] in
-Argument strings. These represent the entire widget command, of
-which the first word is typically the widget name and the second
-word is typically \fBxview\fR or \fByview\fR.
.AP int objc in
Number of Tcl_Obj's in \fIobjv\fR array.
.AP "Tcl_Obj *const" objv[] in
Argument objects. These represent the entire widget command, of
which the first word is typically the widget name and the second
word is typically \fBxview\fR or \fByview\fR.
-.AP double *dblPtr out
+.AP int argc in
+Number of strings in \fIargv\fR array.
+.AP "const char" *argv[] in
+Argument strings. These represent the entire widget command, of
+which the first word is typically the widget name and the second
+word is typically \fBxview\fR or \fByview\fR.
+.AP double *fractionPtr out
Filled in with fraction from \fBmoveto\fR option, if any.
-.AP int *intPtr out
+.AP int *stepsPtr out
Filled in with line or page count from \fBscroll\fR option, if any.
The value may be negative.
.BE
-
.SH DESCRIPTION
.PP
-\fBTk_GetScrollInfo\fR parses the arguments expected by widget
+\fBTk_GetScrollInfoObj\fR parses the arguments expected by widget
scrolling commands such as \fBxview\fR and \fByview\fR.
It receives the entire list of words that make up a widget command
-and parses the words starting with \fIargv\fR[2].
-The words starting with \fIargv\fR[2] must have one of the following forms:
+and parses the words starting with \fIobjv\fR[2].
+The words starting with \fIobjv\fR[2] must have one of the following forms:
.CS
\fBmoveto \fIfraction\fR
\fBscroll \fInumber\fB units\fR
@@ -57,20 +56,20 @@ The words starting with \fIargv\fR[2] must have one of the following forms:
.LP
Any of the \fBmoveto\fR, \fBscroll\fR, \fBunits\fR, and \fBpages\fR
keywords may be abbreviated.
-If \fIargv\fR has the \fBmoveto\fR form, \fBTK_SCROLL_MOVETO\fR
-is returned as result and \fI*dblPtr\fR is filled in with the
+If \fIobjv\fR has the \fBmoveto\fR form, \fBTK_SCROLL_MOVETO\fR
+is returned as result and \fI*fractionPtr\fR is filled in with the
\fIfraction\fR argument to the command, which must be a proper real
value.
-If \fIargv\fR has the \fBscroll\fR form, \fBTK_SCROLL_UNITS\fR
-or \fBTK_SCROLL_PAGES\fR is returned and \fI*intPtr\fR is filled
+If \fIobjv\fR has the \fBscroll\fR form, \fBTK_SCROLL_UNITS\fR
+or \fBTK_SCROLL_PAGES\fR is returned and \fI*stepsPtr\fR is filled
in with the \fInumber\fR value, which must be a proper integer.
If an error occurs in parsing the arguments, \fBTK_SCROLL_ERROR\fR
-is returned and an error message is left in \fIinterp->result\fR.
+is returned and an error message is left in interpreter
+\fIinterp\fR's result.
.PP
-\fBTk_GetScrollInfoObj\fR is identical in function to
-\fBTk_GetScrollInfo\fR. However, \fBTk_GetScrollInfoObj\fR accepts
-Tcl_Obj style arguments, making it more appropriate for use with new
-development.
-
+\fBTk_GetScrollInfo\fR is identical in function to
+\fBTk_GetScrollInfoObj\fR. However, \fBTk_GetScrollInfo\fR accepts
+string arguments, making it more appropriate for use with legacy
+widgets.
.SH KEYWORDS
parse, scrollbar, scrolling command, xview, yview
diff --git a/doc/GetSelect.3 b/doc/GetSelect.3
index 4f8fa8d..63f655a 100644
--- a/doc/GetSelect.3
+++ b/doc/GetSelect.3
@@ -33,7 +33,6 @@ are retrieved.
.AP ClientData clientData in
Arbitrary one-word value to pass to \fIproc\fR.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_GetSelection\fR retrieves the selection specified by the atom
@@ -42,13 +41,15 @@ selection may actually be retrieved in several pieces; as each piece
is retrieved, \fIproc\fR is called to process the piece. \fIProc\fR
should have arguments and result that match the type
\fBTk_GetSelProc\fR:
+.PP
.CS
-typedef int Tk_GetSelProc(
- ClientData \fIclientData\fR,
- Tcl_Interp *\fIinterp\fR,
- char *\fIportion\fR);
+typedef int \fBTk_GetSelProc\fR(
+ ClientData \fIclientData\fR,
+ Tcl_Interp *\fIinterp\fR,
+ char *\fIportion\fR);
.CE
-The \fIclientData\fR and \fIinterp\fR parameters to \fIproc\fR
+.PP
+The \fIclientData\fR and \fIinterp\fR parameters to \fIproc\fR
will be copies of the corresponding arguments to
\fBTk_GetSelection\fR. \fIPortion\fR will be a pointer to
a string containing part or all of the selection. For large
@@ -68,10 +69,10 @@ been completely retrieved and processed by \fIproc\fR, or when a
fatal error has occurred (e.g. the selection owner did not respond
promptly). \fBTk_GetSelection\fR normally returns \fBTCL_OK\fR; if
an error occurs, it returns \fBTCL_ERROR\fR and leaves an error message
-in \fIinterp->result\fR. \fIProc\fR should also return either
-\fBTCL_OK\fR or \fBTCL_ERROR\fR. If \fIproc\fR encounters an error in dealing with the
-selection, it should leave an error message in \fIinterp->result\fR
-and return \fBTCL_ERROR\fR; this will abort the selection retrieval.
-
+in interpreter \fIinterp\fR's result. \fIProc\fR should also return either
+\fBTCL_OK\fR or \fBTCL_ERROR\fR. If \fIproc\fR encounters an error in
+dealing with the selection, it should leave an error message in the
+interpreter result and return \fBTCL_ERROR\fR; this will abort the
+selection retrieval.
.SH KEYWORDS
format, get, selection retrieval
diff --git a/doc/GetUid.3 b/doc/GetUid.3
index 32d4cbf..677bbaa 100644
--- a/doc/GetUid.3
+++ b/doc/GetUid.3
@@ -21,7 +21,6 @@ Tk_Uid
String for which the corresponding unique identifier is
desired.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_GetUid\fR returns the unique identifier corresponding
@@ -42,6 +41,5 @@ Tk_Uid may be compared directly (x == y) without having to call
\fBstrcmp\fR.
In addition, the return value from \fBTk_GetUid\fR will have the
same string value as its argument (strcmp(Tk_GetUid(a), a) == 0).
-
.SH KEYWORDS
atom, unique identifier
diff --git a/doc/GetVRoot.3 b/doc/GetVRoot.3
index d95f3ee..7311e3b 100644
--- a/doc/GetVRoot.3
+++ b/doc/GetVRoot.3
@@ -28,7 +28,6 @@ Points to word in which to store width of virtual root.
.AP "int" heightPtr out
Points to word in which to store height of virtual root.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_GetVRootGeometry\fR returns geometry information about the virtual
@@ -43,6 +42,5 @@ If \fItkwin\fR is not associated with a virtual root (e.g.
because the window manager does not use virtual roots) then *\fIxPtr\fR and
*\fIyPtr\fR will be set to 0 and *\fIwidthPtr\fR and *\fIheightPtr\fR
will be set to the dimensions of the screen containing \fItkwin\fR.
-
.SH KEYWORDS
geometry, height, location, virtual root, width, window manager
diff --git a/doc/GetVisual.3 b/doc/GetVisual.3
index 2796660..8e022c0 100644
--- a/doc/GetVisual.3
+++ b/doc/GetVisual.3
@@ -39,7 +39,7 @@ It returns a pointer to the X Visual structure for the visual
and stores the number of bits per pixel for it at \fI*depthPtr\fR.
If \fIstring\fR is unrecognizable or if no suitable visual could
be found, then NULL is returned and \fBTk_GetVisual\fR leaves
-an error message in \fIinterp->result\fR.
+an error message in interpreter \fIinterp\fR's result.
If \fIcolormap\fR is non-NULL then \fBTk_GetVisual\fR
also locates an appropriate colormap for use with the result visual
and stores its X identifier at \fI*colormapPtr\fR.
diff --git a/doc/Grab.3 b/doc/Grab.3
index 6bf1b69..8c99fd5 100644
--- a/doc/Grab.3
+++ b/doc/Grab.3
@@ -16,7 +16,6 @@ int
.sp
void
\fBTk_Ungrab\fR(\fItkwin\fR)
-
.SH ARGUMENTS
.AP Tcl_Interp *interp in
Interpreter to use for error reporting
@@ -25,7 +24,6 @@ Window on whose behalf the pointer is to be grabbed or released
.AP int grabGlobal in
Boolean indicating whether the grab is global or application local
.BE
-
.SH DESCRIPTION
.PP
These functions are used to set or release a global or
@@ -39,7 +37,6 @@ intended for windows in other applications) will be redirected to
\fItkwin\fR. If the grab is application local, only mouse and
keyboard events intended for a windows within the same application
(but outside the tree rooted at \fItkwin\fR) will be redirected.
-
.PP
\fBTk_Grab\fR sets a grab on a particular window. \fITkwin\fR
specifies the window on whose behalf the pointer is to be grabbed.
@@ -52,12 +49,10 @@ successfully, no window outside the tree rooted at \fItkwin\fR will
receive pointer- or keyboard-related events until the next call to
Tk_Ungrab. If a previous grab was in effect within the application,
then it is replaced with a new one.
-
.PP
-\fBTcl_Ungrab\fR releases a grab on the mouse pointer and keyboard, if
+\fBTk_Ungrab\fR releases a grab on the mouse pointer and keyboard, if
there is one set on the window given by \fItkwin\fR. Once a grab is
released, pointer and keyboard events will start being delivered to
other windows again.
-
.SH KEYWORDS
grab, window
diff --git a/doc/HWNDToWindow.3 b/doc/HWNDToWindow.3
index 0478d78..684a4e7 100644
--- a/doc/HWNDToWindow.3
+++ b/doc/HWNDToWindow.3
@@ -17,12 +17,10 @@ Tk_Window
.AP HWND hwnd in
Windows handle for the window.
.BE
-
.SH DESCRIPTION
.PP
Given a Windows HWND window identifier, this procedure returns the
corresponding Tk_Window handle. If there is no Tk_Window corresponding
to \fIhwnd\fR then NULL is returned.
-
.SH KEYWORDS
Windows window id
diff --git a/doc/HandleEvent.3 b/doc/HandleEvent.3
index 4d24c14..7824c5c 100644
--- a/doc/HandleEvent.3
+++ b/doc/HandleEvent.3
@@ -21,12 +21,11 @@ Tk_HandleEvent \- invoke event handlers for window system events
Pointer to X event to dispatch to relevant handler(s). It is important
that all unused fields of the structure be set to zero.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_HandleEvent\fR is a lower-level procedure that deals with window
events. It is called by \fBTcl_ServiceEvent\fR (and indirectly by
-\fBTcl_DoOneEvent\fR), and in a few other cases within Tk.
+\fBTk_DoOneEvent\fR), and in a few other cases within Tk.
It makes callbacks to any window event
handlers (created by calls to \fBTk_CreateEventHandler\fR)
that match \fIeventPtr\fR and then returns. In some cases
@@ -43,6 +42,5 @@ as when a
notifier has been popped up and an application wishes to
wait for the user to click a button in the notifier before
doing anything else.
-
.SH KEYWORDS
callback, event, handler, window
diff --git a/doc/IdToWindow.3 b/doc/IdToWindow.3
index a913661..e04c290 100644
--- a/doc/IdToWindow.3
+++ b/doc/IdToWindow.3
@@ -22,13 +22,11 @@ X display containing the window.
.AP Window window in
X id for window.
.BE
-
.SH DESCRIPTION
.PP
Given an X window identifier and the X display it corresponds to,
this procedure returns the corresponding Tk_Window handle.
If there is no Tk_Window corresponding to \fIwindow\fR then
NULL is returned.
-
.SH KEYWORDS
X window id
diff --git a/doc/ImgChanged.3 b/doc/ImgChanged.3
index 3d6e823..55b24d4 100644
--- a/doc/ImgChanged.3
+++ b/doc/ImgChanged.3
@@ -35,7 +35,6 @@ Current width of image, in pixels.
.AP "int" imageHeight in
Current height of image, in pixels.
.BE
-
.SH DESCRIPTION
.PP
An image manager calls \fBTk_ImageChanged\fR for an image
@@ -59,9 +58,7 @@ that changed.
If the size of the image should change, then \fBTk_ImageChanged\fR
must be called to indicate the new size, even if no pixels
need to be redisplayed.
-
.SH "SEE ALSO"
Tk_CreateImageType
-
.SH KEYWORDS
images, redisplay, image size changes
diff --git a/doc/Inactive.3 b/doc/Inactive.3
index 8f37553..825fd8b 100644
--- a/doc/Inactive.3
+++ b/doc/Inactive.3
@@ -21,7 +21,6 @@ long
The display on which the user inactivity timer is to be queried or
reset.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_GetUserInactiveTime\fR returns the number of milliseconds that
@@ -31,6 +30,5 @@ support querying the user inactiviy time, \fB\-1\fR is returned.
\fBTk_GetUserInactiveTime\fR resets the user inactivity timer of the
given display to zero. On windowing systems that do not support
multiple displays \fIdisplay\fR can be passed as \fBNULL\fR.
-
.SH KEYWORDS
idle, inactive
diff --git a/doc/InternAtom.3 b/doc/InternAtom.3
index a4ca96c..37a6c3c 100644
--- a/doc/InternAtom.3
+++ b/doc/InternAtom.3
@@ -28,7 +28,6 @@ String name for which atom is desired.
.AP Atom atom in
Atom for which corresponding string name is desired.
.BE
-
.SH DESCRIPTION
.PP
These procedures are similar to the Xlib procedures
@@ -52,6 +51,5 @@ for the same information can be serviced from the cache without
contacting the server. Thus \fBTk_InternAtom\fR and \fBTk_GetAtomName\fR
are generally much faster than their Xlib counterparts, and they
should be used in place of the Xlib procedures.
-
.SH KEYWORDS
atom, cache, display
diff --git a/doc/MainLoop.3 b/doc/MainLoop.3
index 8653c17..ae38d6c 100644
--- a/doc/MainLoop.3
+++ b/doc/MainLoop.3
@@ -16,7 +16,6 @@ Tk_MainLoop \- loop for events until all windows are deleted
.sp
\fBTk_MainLoop\fR()
.BE
-
.SH DESCRIPTION
.PP
\fBTk_MainLoop\fR is a procedure that loops repeatedly calling
@@ -25,6 +24,5 @@ left in this process (i.e. no main windows exist anymore). Most
windowing applications will call \fBTk_MainLoop\fR after
initialization; the main execution of the application will consist
entirely of callbacks invoked via \fBTcl_DoOneEvent\fR.
-
.SH KEYWORDS
application, event, main loop
diff --git a/doc/MainWin.3 b/doc/MainWin.3
index 14acec7..536679a 100644
--- a/doc/MainWin.3
+++ b/doc/MainWin.3
@@ -9,8 +9,7 @@
.TH Tk_MainWindow 3 7.0 Tk "Tk Library Procedures"
.BS
.SH NAME
-Tk_MainWindow, Tk_GetNumMainWindows \- functions for querying main
-window information
+Tk_MainWindow, Tk_GetNumMainWindows \- functions for querying main window information
.SH SYNOPSIS
.nf
\fB#include <tk.h>\fR
@@ -20,13 +19,11 @@ Tk_Window
.sp
int
\fBTk_GetNumMainWindows\fR()
-
.SH ARGUMENTS
.AS Tcl_Interp *pathName
.AP Tcl_Interp *interp in/out
Interpreter associated with the application.
.BE
-
.SH DESCRIPTION
.PP
A main window is a special kind of toplevel window used as the
@@ -35,10 +32,9 @@ outermost window in an application.
If \fIinterp\fR is associated with a Tk application then \fBTk_MainWindow\fR
returns the application's main window. If there is no Tk application
associated with \fIinterp\fR then \fBTk_MainWindow\fR returns NULL and
-leaves an error message in \fIinterp->result\fR.
+leaves an error message in interpreter \fIinterp\fR's result.
.PP
\fBTk_GetNumMainWindows\fR returns a count of the number of main
-windows currently open in the process.
-
+windows currently open in the current thread.
.SH KEYWORDS
application, main window
diff --git a/doc/MaintGeom.3 b/doc/MaintGeom.3
index c96a646..13e35fe 100644
--- a/doc/MaintGeom.3
+++ b/doc/MaintGeom.3
@@ -36,7 +36,6 @@ Desired width for \fIslave\fR, in pixels.
.AP int height in
Desired height for \fIslave\fR, in pixels.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_MaintainGeometry\fR and \fBTk_UnmaintainGeometry\fR make it
diff --git a/doc/ManageGeom.3 b/doc/ManageGeom.3
index 5dcf688..2c6c534 100644
--- a/doc/ManageGeom.3
+++ b/doc/ManageGeom.3
@@ -45,7 +45,7 @@ typedef struct {
const char *\fIname\fR;
Tk_GeomRequestProc *\fIrequestProc\fR;
Tk_GeomLostSlaveProc *\fIlostSlaveProc\fR;
-} Tk_GeomMgr;
+} \fBTk_GeomMgr\fR;
.CE
The \fIname\fR field is the textual name for the geometry manager,
such as \fBpack\fR or \fBplace\fR; this value will be returned
@@ -57,9 +57,9 @@ slave to change its desired geometry.
\fIrequestProc\fR should have arguments and results that match the
type \fBTk_GeomRequestProc\fR:
.CS
-typedef void Tk_GeomRequestProc(
- ClientData \fIclientData\fR,
- Tk_Window \fItkwin\fR);
+typedef void \fBTk_GeomRequestProc\fR(
+ ClientData \fIclientData\fR,
+ Tk_Window \fItkwin\fR);
.CE
The parameters to \fIrequestProc\fR will be identical to the
corresponding parameters passed to \fBTk_ManageGeometry\fR.
@@ -80,12 +80,11 @@ is the same as the window's current geometry manager.
\fIlostSlaveProc\fR should have
arguments and results that match the following prototype:
.CS
-typedef void Tk_GeomLostSlaveProc(
- ClientData \fIclientData\fR,
- Tk_Window \fItkwin\fR);
+typedef void \fBTk_GeomLostSlaveProc\fR(
+ ClientData \fIclientData\fR,
+ Tk_Window \fItkwin\fR);
.CE
The parameters to \fIlostSlaveProc\fR will be identical to the
corresponding parameters passed to \fBTk_ManageGeometry\fR.
-
.SH KEYWORDS
callback, geometry, managed, request, unmanaged
diff --git a/doc/MapWindow.3 b/doc/MapWindow.3
index 25d7ff5..f876d24 100644
--- a/doc/MapWindow.3
+++ b/doc/MapWindow.3
@@ -23,7 +23,6 @@ Tk_Window
.AP Tk_Window tkwin in
Token for window.
.BE
-
.SH DESCRIPTION
.PP
These procedures may be used to map and unmap windows
@@ -46,6 +45,5 @@ These procedures should be used in place of the X procedures
Tk's local data structure for \fItkwin\fR. Applications
using Tk should not invoke \fBXMapWindow\fR and \fBXUnmapWindow\fR
directly.
-
.SH KEYWORDS
map, unmap, window
diff --git a/doc/MoveToplev.3 b/doc/MoveToplev.3
index 24653ab..4cd39e2 100644
--- a/doc/MoveToplev.3
+++ b/doc/MoveToplev.3
@@ -28,7 +28,6 @@ New y-coordinate for the top-left pixel of \fItkwin\fR's border, or the
top-left pixel of the decorative border supplied for \fItkwin\fR by the
window manager, if there is one.
.BE
-
.SH DESCRIPTION
.PP
In general, a window should never set its own position; this should be
@@ -48,6 +47,5 @@ When \fBTk_MoveToplevelWindow\fR is called it does not immediately
pass on the new desired location to the window manager; it defers
this action until all other outstanding work has been completed,
using the \fBTk_DoWhenIdle\fR mechanism.
-
.SH KEYWORDS
position, top-level window, window manager
diff --git a/doc/Name.3 b/doc/Name.3
index 73b09b1..697eae3 100644
--- a/doc/Name.3
+++ b/doc/Name.3
@@ -31,7 +31,6 @@ Interpreter to use for error reporting.
.AP "const char" *pathName in
Character string containing path name of window.
.BE
-
.SH DESCRIPTION
.PP
Each window managed by Tk has two names, a short name that identifies
@@ -49,8 +48,7 @@ as a Tk_Uid, which may be used just like a string pointer but also has
the properties of a unique identifier (see the manual entry for
\fBTk_GetUid\fR for details).
.PP
-The \fBTk_PathName\fR macro returns a
-hierarchical name for \fItkwin\fR.
+The \fBTk_PathName\fR macro returns a hierarchical name for \fItkwin\fR.
Path names have a structure similar to file names in Unix but with
dots between elements instead of slashes: the main window for
an application has the path name
@@ -75,7 +73,8 @@ The procedure \fBTk_NameToWindow\fR returns the token for a window
given its path name (the \fIpathName\fR argument) and another window
belonging to the same main window (\fItkwin\fR). It normally
returns a token for the named window, but if no such window exists
-\fBTk_NameToWindow\fR leaves an error message in \fIinterp->result\fR
+\fBTk_NameToWindow\fR leaves an error message in interpreter
+\fIinterp\fR's result
and returns NULL. The \fItkwin\fR argument to \fBTk_NameToWindow\fR
is needed because path names are only unique within a single
application hierarchy. If, for example, a single process has opened
@@ -83,6 +82,5 @@ two main windows, each will have a separate naming hierarchy and the
same path name might appear in each of the hierarchies. Normally
\fItkwin\fR is the main window of the desired hierarchy, but this
need not be the case: any window in the desired hierarchy may be used.
-
.SH KEYWORDS
name, path name, token, window
diff --git a/doc/NameOfImg.3 b/doc/NameOfImg.3
index a1a69a8..5461262 100644
--- a/doc/NameOfImg.3
+++ b/doc/NameOfImg.3
@@ -21,12 +21,10 @@ const char *
Token for image, which was passed to image manager's \fIcreateProc\fR when
the image was created.
.BE
-
.SH DESCRIPTION
.PP
This procedure is invoked by image managers to find out the name
of an image. Given the token for the image, it returns the
string name for the image.
-
.SH KEYWORDS
image manager, image name
diff --git a/doc/OwnSelect.3 b/doc/OwnSelect.3
index cf2559d..b0da542 100644
--- a/doc/OwnSelect.3
+++ b/doc/OwnSelect.3
@@ -26,7 +26,6 @@ Procedure to invoke when \fItkwin\fR loses selection ownership later.
.AP ClientData clientData in
Arbitrary one-word value to pass to \fIproc\fR.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_OwnSelection\fR arranges for \fItkwin\fR to become the
@@ -39,12 +38,12 @@ invoked so that the window can clean itself up (e.g. by
unhighlighting the selection). \fIProc\fR should have arguments and
result that match the type \fBTk_LostSelProc\fR:
.CS
-typedef void Tk_LostSelProc(ClientData \fIclientData\fR);
+typedef void \fBTk_LostSelProc\fR(
+ ClientData \fIclientData\fR);
.CE
The \fIclientData\fR parameter to \fIproc\fR is a copy of the
\fIclientData\fR argument given to \fBTk_OwnSelection\fR, and is
usually a pointer to a data structure containing application-specific
information about \fItkwin\fR.
-
.SH KEYWORDS
own, selection owner
diff --git a/doc/ParseArgv.3 b/doc/ParseArgv.3
index b7592b7..1681305 100644
--- a/doc/ParseArgv.3
+++ b/doc/ParseArgv.3
@@ -60,8 +60,8 @@ elements of \fIargv\fR.
.PP
\fBTk_ParseArgv\fR normally returns the value \fBTCL_OK\fR. If an error
occurs while parsing the arguments, then \fBTCL_ERROR\fR is returned and
-\fBTk_ParseArgv\fR will leave an error message in \fIinterp->result\fR
-in the standard Tcl fashion. In
+\fBTk_ParseArgv\fR will leave an error message in the result of
+interpreter \fIinterp\fR in the standard Tcl fashion. In
the event of an error return, \fI*argvPtr\fR will not have been
modified, but \fIargv\fR could have been partially modified. The
possible causes of errors are explained below.
@@ -70,12 +70,12 @@ The \fIargTable\fR array specifies the kinds of arguments that are
expected; each of its entries has the following structure:
.CS
typedef struct {
- char *\fIkey\fR;
+ const char *\fIkey\fR;
int \fItype\fR;
char *\fIsrc\fR;
char *\fIdst\fR;
- char *\fIhelp\fR;
-} Tk_ArgvInfo;
+ const char *\fIhelp\fR;
+} \fBTk_ArgvInfo\fR;
.CE
The \fIkey\fR field is a string such as
.QW \-display
@@ -186,7 +186,8 @@ specifiers of this type are ignored (as if they did not exist).
\fBTK_ARGV_HELP\fR
When this kind of option is encountered, \fBTk_ParseArgv\fR uses the
\fIhelp\fR fields of \fIargTable\fR to format a message describing
-all the valid arguments. The message is placed in \fIinterp->result\fR
+all the valid arguments. The message is placed in interpreter
+\fIinterp\fR's result
and \fBTk_ParseArgv\fR returns \fBTCL_ERROR\fR. When this happens, the
caller normally prints the help message and aborts. If the \fIkey\fR
field of a \fBTK_ARGV_HELP\fR specifier is NULL, then the specifier will
@@ -259,11 +260,12 @@ then return any that are left by compacting them to the beginning of
\fIargv\fR (starting at \fIargv\fR[0]). \fIGenfunc\fR
should return a count of how many arguments are left in \fIargv\fR;
\fBTk_ParseArgv\fR will process them. If \fIgenfunc\fR encounters
-an error then it should leave an error message in \fIinterp->result\fR,
+an error then it should leave an error message in interpreter
+\fIinterp\fR's result,
in the usual Tcl fashion, and return \-1; when this happens
\fBTk_ParseArgv\fR will abort its processing and return \fBTCL_ERROR\fR.
.RE
-.SH "FLAGS"
+.SS "FLAGS"
.TP
\fBTK_ARGV_DONT_SKIP_FIRST_ARG\fR
\fBTk_ParseArgv\fR normally treats \fIargv[0]\fR as a program
@@ -329,7 +331,7 @@ main(argc, argv)
\&...
if (Tk_ParseArgv(interp, tkwin, &argc, argv, argTable, 0) != TCL_OK) {
- fprintf(stderr, "%s\en", interp->result);
+ fprintf(stderr, "%s\en", Tcl_GetString(Tcl_GetObjResult(interp)));
exit(1);
}
diff --git a/doc/QWinEvent.3 b/doc/QWinEvent.3
index 5eada22..f98d29b 100644
--- a/doc/QWinEvent.3
+++ b/doc/QWinEvent.3
@@ -30,7 +30,6 @@ that all unused fields of the structure be set to zero.
Where to add the new event in the queue: \fBTCL_QUEUE_TAIL\fR,
\fBTCL_QUEUE_HEAD\fR, or \fBTCL_QUEUE_MARK\fR.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_QueueWindowEvent\fR places a window event on Tcl's internal event
@@ -47,6 +46,5 @@ returns the previous value for collapse behavior on the \fIdisplay\fR.
The \fIposition\fR argument to \fBTk_QueueWindowEvent\fR has
the same significance as for \fBTcl_QueueEvent\fR; see the
documentation for \fBTcl_QueueEvent\fR for details.
-
.SH KEYWORDS
callback, clock, handler, modal timeout, events
diff --git a/doc/Restack.3 b/doc/Restack.3
index a9a6c3a..49876b0 100644
--- a/doc/Restack.3
+++ b/doc/Restack.3
@@ -28,7 +28,6 @@ must be \fBAbove\fR or \fBBelow\fR.
Must be a sibling of \fItkwin\fR or a descendant of a sibling.
If NULL then \fItkwin\fR is restacked above or below all siblings.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_RestackWindow\fR changes the stacking order of \fIwindow\fR relative
@@ -42,6 +41,5 @@ just above or below \fIother\fR.
The \fIaboveBelow\fR argument must have one of the symbolic values
\fBAbove\fR or \fBBelow\fR.
Both of these values are defined by the include file <X11/Xlib.h>.
-
.SH KEYWORDS
above, below, obscure, stacking order
diff --git a/doc/RestrictEv.3 b/doc/RestrictEv.3
index da8b822..d208955 100644
--- a/doc/RestrictEv.3
+++ b/doc/RestrictEv.3
@@ -15,18 +15,17 @@ Tk_RestrictEvents \- filter and selectively delay X events
\fB#include <tk.h>\fR
.sp
Tk_RestrictProc *
-\fBTk_RestrictEvents\fR(\fIproc, clientData, prevClientDataPtr\fR)
+\fBTk_RestrictEvents\fR(\fIproc, arg, prevArgPtr\fR)
.SH ARGUMENTS
-.AS Tk_RestrictProc **prevClientDataPtr
+.AS Tk_RestrictProc **prevArgPtr
.AP Tk_RestrictProc *proc in
Predicate procedure to call to filter incoming X events.
NULL means do not restrict events at all.
-.AP ClientData clientData in
+.AP ClientData arg in
Arbitrary argument to pass to \fIproc\fR.
-.AP ClientData *prevClientDataPtr out
+.AP ClientData *prevArgPtr out
Pointer to place to save argument to previous restrict procedure.
.BE
-
.SH DESCRIPTION
.PP
This procedure is useful in certain situations where applications
@@ -40,11 +39,11 @@ later time (e.g. when the event restriction is lifted), or discarded.
is a procedure with arguments and result that match
the type \fBTk_RestrictProc\fR:
.CS
-typedef Tk_RestrictAction Tk_RestrictProc(
- ClientData \fIclientData\fR,
- XEvent *\fIeventPtr\fR);
+typedef Tk_RestrictAction \fBTk_RestrictProc\fR(
+ ClientData \fIarg\fR,
+ XEvent *\fIeventPtr\fR);
.CE
-The \fIclientData\fR argument is a copy of the \fIclientData\fR passed
+The \fIarg\fR argument is a copy of the \fIarg\fR passed
to \fBTk_RestrictEvents\fR; it may be used to provide \fIproc\fR with
information it needs to filter events. The \fIeventPtr\fR points to
an event under consideration. \fIProc\fR returns a restrict action
@@ -56,7 +55,7 @@ left on the event queue for later processing. If the return value is
\fBTK_DISCARD_EVENT\fR, then the event will be removed from the event
queue and discarded without being processed.
.PP
-\fBTk_RestrictEvents\fR uses its return value and \fIprevClientDataPtr\fR
+\fBTk_RestrictEvents\fR uses its return value and \fIprevArgPtr\fR
to return information about the current event restriction procedure
(a NULL return value means there are currently no restrictions).
These values may be used to restore the previous restriction state
diff --git a/doc/SetAppName.3 b/doc/SetAppName.3
index b2df656..60ac14f 100644
--- a/doc/SetAppName.3
+++ b/doc/SetAppName.3
@@ -24,7 +24,6 @@ application.
.AP "const char" *name in
Name under which to register the application.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_SetAppName\fR associates a name with a given application and
@@ -59,6 +58,5 @@ so applications do not normally need to call it explicitly.
.PP
The command \fBtk appname\fR provides Tcl-level access to the
functionality of \fBTk_SetAppName\fR.
-
.SH KEYWORDS
application, name, register, send command
diff --git a/doc/SetCaret.3 b/doc/SetCaret.3
index 210cb21..5fd4f1f 100644
--- a/doc/SetCaret.3
+++ b/doc/SetCaret.3
@@ -25,7 +25,6 @@ Window-relative y coordinate.
.AP int h in
Height of the caret in the window.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_SetCaretPos\fR sets the caret location for the display of the
@@ -33,6 +32,5 @@ specified Tk_Window \fItkwin\fR. The caret is the per-display cursor
location used for indicating global focus (e.g. to comply with Microsoft
Accessibility guidelines), as well as for location of the over-the-spot XIM
(X Input Methods) or Windows IME windows.
-
.SH KEYWORDS
caret, cursor
diff --git a/doc/SetClass.3 b/doc/SetClass.3
index a457777..46f3c1b 100644
--- a/doc/SetClass.3
+++ b/doc/SetClass.3
@@ -25,7 +25,6 @@ Token for window.
.AP char *class in
New class name for window.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_SetClass\fR is called to associate a class with a particular
@@ -54,6 +53,5 @@ the properties of a unique identifier (see the manual entry for
\fBTk_GetUid\fR for details).
If \fItkwin\fR has not yet been given a class, then
\fBTk_Class\fR will return NULL.
-
.SH KEYWORDS
class, unique identifier, window, window manager
diff --git a/doc/SetClassProcs.3 b/doc/SetClassProcs.3
index e8820b6..e0398f5 100644
--- a/doc/SetClassProcs.3
+++ b/doc/SetClassProcs.3
@@ -18,14 +18,13 @@ Tk_SetClassProcs \- register widget specific procedures
.AS Tk_ClassProc instanceData
.AP Tk_Window tkwin in
Token for window to modify.
-.AP Tk_ClassProcs *procs in
+.AP "const Tk_ClassProcs" *procs in
Pointer to data structure containing widget specific procedures.
The data structure pointed to by \fIprocs\fR must be static:
Tk keeps a reference to it as long as the window exists.
.AP ClientData instanceData in
Arbitrary one-word value to pass to widget callbacks.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_SetClassProcs\fR is called to register a set of procedures that
@@ -38,7 +37,7 @@ typedef struct Tk_ClassProcs {
Tk_ClassWorldChangedProc *\fIworldChangedProc\fR;
Tk_ClassCreateProc *\fIcreateProc\fR;
Tk_ClassModalProc *\fImodalProc\fR;
-} Tk_ClassProcs;
+} \fBTk_ClassProcs\fR;
.CE
The \fIsize\fR field is used to simplify future expansion of the
structure. It should always be set to (literally) \fBsizeof(Tk_ClassProcs)\fR.
@@ -50,8 +49,8 @@ widgets configured to use that font alias must update their display
accordingly. \fIworldChangedProc\fR should have arguments and results
that match the type \fBTk_ClassWorldChangedProc\fR:
.CS
-typedef void Tk_ClassWorldChangedProc(
- ClientData \fIinstanceData\fR);
+typedef void \fBTk_ClassWorldChangedProc\fR(
+ ClientData \fIinstanceData\fR);
.CE
The \fIinstanceData\fR parameter passed to the \fIworldChangedProc\fR
will be identical to the \fIinstanceData\fR parameter passed to
@@ -61,10 +60,10 @@ will be identical to the \fIinstanceData\fR parameter passed to
invoked by \fBTk_MakeWindowExist\fR. \fIcreateProc\fR should have
arguments and results that match the type \fBTk_ClassCreateProc\fR:
.CS
-typedef Window Tk_ClassCreateProc(
- Tk_Window \fItkwin\fR,
- Window \fIparent\fR,
- ClientData \fIinstanceData\fR);
+typedef Window \fBTk_ClassCreateProc\fR(
+ Tk_Window \fItkwin\fR,
+ Window \fIparent\fR,
+ ClientData \fIinstanceData\fR);
.CE
The \fItkwin\fR and \fIinstanceData\fR parameters will be identical to
the \fItkwin\fR and \fIinstanceData\fR parameters passed to
@@ -76,14 +75,13 @@ created window.
triggered in order to handle a modal loop. \fImodalProc\fR should
have arguments and results that match the type \fBTk_ClassModalProc\fR:
.CS
-typedef void Tk_ClassModalProc(
- Tk_Window \fItkwin\fR,
- XEvent *\fIeventPtr\fR);
+typedef void \fBTk_ClassModalProc\fR(
+ Tk_Window \fItkwin\fR,
+ XEvent *\fIeventPtr\fR);
.CE
The \fItkwin\fR parameter to \fImodalProc\fR will be identical to the
\fItkwin\fR parameter passed to \fBTk_SetClassProcs\fR. The
\fIeventPtr\fR parameter will be a pointer to an XEvent structure
describing the event being processed.
-
.SH KEYWORDS
callback, class
diff --git a/doc/SetGrid.3 b/doc/SetGrid.3
index c304ba2..5fe4509 100644
--- a/doc/SetGrid.3
+++ b/doc/SetGrid.3
@@ -32,7 +32,6 @@ Width of one grid unit, in pixels.
.AP int heightInc in
Height of one grid unit, in pixels.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_SetGrid\fR turns on gridded geometry management for \fItkwin\fR's
@@ -60,6 +59,5 @@ toplevel, the calls for the new window have no effect.
.PP
See the \fBwm\fR manual entry for additional information on gridded geometry
management.
-
.SH KEYWORDS
grid, window, window manager
diff --git a/doc/SetOptions.3 b/doc/SetOptions.3
index 6ce3db0..e9758ce 100644
--- a/doc/SetOptions.3
+++ b/doc/SetOptions.3
@@ -243,7 +243,6 @@ The \fBTk_Offset\fR macro is provided as a safe way of generating the
Tk_OptionSpec structures. It takes two arguments: the name of a type
of record, and the name of a field in that record. It returns the byte
offset of the named field in records of the given type.
-
.SH "TEMPLATES"
.PP
The array of Tk_OptionSpec structures passed to \fBTk_CreateOptionTable\fR
@@ -262,7 +261,7 @@ typedef struct {
int \fIflags\fR;
ClientData \fIclientData\fR;
int \fItypeMask\fR;
-} Tk_OptionSpec;
+} \fBTk_OptionSpec\fR;
.CE
The \fItype\fR field indicates what kind of configuration option this is
(e.g. \fBTK_OPTION_COLOR\fR for a color value, or \fBTK_OPTION_INT\fR for
@@ -434,7 +433,7 @@ suitable for passing to \fBTcl_GetIndexFromObj\fR. The value must
be one of the strings in the table, or a unique abbreviation of
one of the strings. The internal form is an integer giving the index
into the table of the matching string, like the return value
-from \fBTcl_GetStringFromObj\fR.
+from \fBTcl_GetStringFromObj\fR.
.TP
\fBTK_OPTION_SYNONYM\fR
This type is used to provide alternative names for an option (for
@@ -450,7 +449,6 @@ The value must be a window path name. The internal form is a
This option type requires \fItkwin\fR to be supplied to procedures
such as \fBTk_SetOptions\fR (in order to identify the application),
and it supports the \fBTK_OPTION_NULL_OK\fR flag.
-
.SH "STORAGE MANAGEMENT ISSUES"
.PP
If a field of a widget record has its offset stored in the \fIobjOffset\fR
@@ -474,7 +472,6 @@ However, the widget code is responsible for storing NULL or \fBNone\fR in
all pointer and token fields before invoking \fBTk_InitOptions\fR.
This is needed to allow proper cleanup in the rare case where
an error occurs in \fBTk_InitOptions\fR.
-
.SH "OBJOFFSET VS. INTERNALOFFSET"
.PP
In most cases it is simplest to use the \fIinternalOffset\fR field of
@@ -505,7 +502,6 @@ To implement a new type of option, you can use \fBTK_OPTION_STRING\fR as
the type in the Tk_OptionSpec structure and set the \fIobjOffset\fR field
but not the \fIinternalOffset\fR field. Then, after calling
\fBTk_SetOptions\fR, convert the object to internal form yourself.
-
.SH "CUSTOM OPTION TYPES"
.PP
Applications can extend the built-in configuration types with
@@ -520,34 +516,34 @@ typedef struct Tk_ObjCustomOption {
Tk_CustomOptionRestoreProc *\fIrestoreProc\fR;
Tk_CustomOptionFreeProc *\fIfreeProc\fR;
ClientData \fIclientData\fR;
-} Tk_ObjCustomOption;
+} \fBTk_ObjCustomOption\fR;
-typedef int Tk_CustomOptionSetProc(
- ClientData \fIclientData\fR,
- Tcl_Interp *\fIinterp\fR,
- Tk_Window \fItkwin\fR,
- Tcl_Obj **\fIvaluePtr\fR,
- char *\fIrecordPtr\fR,
- int \fIinternalOffset\fR,
- char *\fIsaveInternalPtr\fR,
- int \fIflags\fR);
+typedef int \fBTk_CustomOptionSetProc\fR(
+ ClientData \fIclientData\fR,
+ Tcl_Interp *\fIinterp\fR,
+ Tk_Window \fItkwin\fR,
+ Tcl_Obj **\fIvaluePtr\fR,
+ char *\fIrecordPtr\fR,
+ int \fIinternalOffset\fR,
+ char *\fIsaveInternalPtr\fR,
+ int \fIflags\fR);
-typedef Tcl_Obj *Tk_CustomOptionGetProc(
- ClientData \fIclientData\fR,
- Tk_Window \fItkwin\fR,
- char *\fIrecordPtr\fR,
- int \fIinternalOffset\fR);
+typedef Tcl_Obj *\fBTk_CustomOptionGetProc\fR(
+ ClientData \fIclientData\fR,
+ Tk_Window \fItkwin\fR,
+ char *\fIrecordPtr\fR,
+ int \fIinternalOffset\fR);
-typedef void Tk_CustomOptionRestoreProc(
- ClientData \fIclientData\fR,
- Tk_Window \fItkwin\fR,
- char *\fIinternalPtr\fR,
- char *\fIsaveInternalPtr\fR);
+typedef void \fBTk_CustomOptionRestoreProc\fR(
+ ClientData \fIclientData\fR,
+ Tk_Window \fItkwin\fR,
+ char *\fIinternalPtr\fR,
+ char *\fIsaveInternalPtr\fR);
-typedef void Tk_CustomOptionFreeProc(
- ClientData \fIclientData\fR,
- Tk_Window \fItkwin\fR,
- char *\fIinternalPtr\fR);
+typedef void \fBTk_CustomOptionFreeProc\fR(
+ ClientData \fIclientData\fR,
+ Tk_Window \fItkwin\fR,
+ char *\fIinternalPtr\fR);
.CE
.PP
The Tk_ObjCustomOption structure contains six fields: a name
@@ -645,8 +641,6 @@ structure. \fITkwin\fR is a copy of the \fItkwin\fR argument to
is a pointer to the location where the internal representation of the
option value is stored. The \fIfreeProc\fR must free any storage
associated with the option. \fIFreeProc\fR has no return value.
-
-
.SH KEYWORDS
anchor, bitmap, boolean, border, color, configuration option,
cursor, double, font, integer, justify,
diff --git a/doc/SetVisual.3 b/doc/SetVisual.3
index 2082220..e902ed4 100644
--- a/doc/SetVisual.3
+++ b/doc/SetVisual.3
@@ -28,7 +28,6 @@ Number of bits per pixel desired for \fItkwin\fR.
New colormap for \fItkwin\fR, which must be compatible with
\fIvisual\fR and \fIdepth\fR.
.BE
-
.SH DESCRIPTION
.PP
When Tk creates a new window it assigns it the default visual
@@ -47,6 +46,5 @@ completed successfully.
Note: \fBTk_SetWindowVisual\fR should not be called if you just want
to change a window's colormap without changing its visual or depth;
call \fBTk_SetWindowColormap\fR instead.
-
.SH KEYWORDS
colormap, depth, visual
diff --git a/doc/StrictMotif.3 b/doc/StrictMotif.3
index 770b335..4e898fd 100644
--- a/doc/StrictMotif.3
+++ b/doc/StrictMotif.3
@@ -20,7 +20,6 @@ int
.AP Tk_Window tkwin in
Token for window.
.BE
-
.SH DESCRIPTION
.PP
This procedure returns the current value of the \fBtk_strictMotif\fR
@@ -35,6 +34,5 @@ is good enough, and extra features are welcome.
This procedure uses a link to the Tcl variable to provide much
faster access to the variable's value than could be had by calling
\fBTcl_GetVar\fR.
-
.SH KEYWORDS
Motif compliance, tk_strictMotif variable
diff --git a/doc/TextLayout.3 b/doc/TextLayout.3
index 6c4da60..706eaf5 100644
--- a/doc/TextLayout.3
+++ b/doc/TextLayout.3
@@ -39,7 +39,6 @@ int
.sp
void
\fBTk_TextLayoutToPostscript(\fIinterp, layout\fB)\fR
-
.SH ARGUMENTS
.AS Tk_TextLayout "*xPtr, *yPtr"
.AP Tk_Font tkfont in
@@ -124,9 +123,8 @@ Specifies the width and height, in pixels, of the rectangular area to
compare for intersection against the text layout.
.AP Tcl_Interp *interp out
Postscript code that will print the text layout is appended to
-\fIinterp->result\fR.
+the result of interpreter \fIinterp\fR.
.BE
-
.SH DESCRIPTION
.PP
These routines are for measuring and displaying single-font, multi-line,
@@ -184,9 +182,11 @@ whose \fIx\fR-value is less than 0 will be considered closest to the first
character on that line; any point whose \fIx\fR-value is greater than the
width of the text layout will be considered closest to the last character on
that line. The return value is the index of the character that was closest
-to the point. Given a \fIlayout\fR with no characters, the value 0 will
-always be returned, referring to a hypothetical zero-width placeholder
-character.
+to the point, or one more than the index of any character (to indicate that
+the point was after the end of the string and that the corresponding caret
+would be at the end of the string). Given a \fIlayout\fR with no characters,
+the value 0 will always be returned, referring to a hypothetical zero-width
+placeholder character.
.PP
\fBTk_CharBbox\fR uses the information in \fIlayout\fR to return the
bounding box for the character specified by \fIindex\fR. The width of the
@@ -231,8 +231,9 @@ array of strings that represent the individual lines in \fIlayout\fR. It
is the responsibility of the caller to take the Postscript array of
strings and add some Postscript function operate on the array to render
each of the lines. The code that represents the Postscript array of
-strings is appended to \fIinterp->result\fR.
+strings is appended to interpreter \fIinterp\fR's result.
.SH "DISPLAY MODEL"
+.PP
When measuring a text layout, space characters that occur at the end of a
line are ignored. The space characters still exist and the insertion point
can be positioned amongst them, but their additional width is ignored when
diff --git a/doc/TkInitStubs.3 b/doc/TkInitStubs.3
index 3806f95..cc1bb36 100644
--- a/doc/TkInitStubs.3
+++ b/doc/TkInitStubs.3
@@ -34,7 +34,7 @@ as \fIversion\fR.
The Tcl stubs mechanism defines a way to dynamically bind
extensions to a particular Tcl implementation at run time.
the stubs mechanism requires no changes to applications
-incoporating Tcl/Tk interpreters. Only developers creating
+incorporating Tcl/Tk interpreters. Only developers creating
C-based Tcl/Tk extensions need to take steps to use the
stubs mechanism with their extensions.
See the \fBTcl_InitStubs\fR page for more information.
@@ -48,15 +48,19 @@ Tcl functions.
Call \fBTk_InitStubs\fR if the extension before calling any other
Tk functions.
.IP 2) 5
-Define the \fBUSE_TCL_STUBS\fR symbol. Typically, you would include the
-\fB\-DUSE_TCL_STUBS\fR flag when compiling the extension.
+Define the \fBUSE_TCL_STUBS\fR and the \fBUSE_TK_STUBS\fR
+symbols. Typically, you would include the \fB\-DUSE_TCL_STUBS\fR and
+the \fB\-DUSE_TK_STUBS\fR flags when compiling the extension.
.IP 3) 5
-Link the extension with the Tcl and Tk stubs libraries instead of
-the standard Tcl and Tk libraries. On Unix platforms, the library
-names are \fIlibtclstub8.4.a\fR and \fIlibtkstub8.4.a\fR; on Windows
-platforms, the library names are \fItclstub84.lib\fR and \fItkstub84.lib\fR
-(adjust names with appropriate version number).
+Link the extension with the Tcl and Tk stubs libraries instead of the
+standard Tcl and Tk libraries. On Unix platforms, the library names
+are \fIlibtclstub8.4.a\fR and \fIlibtkstub8.4.a\fR; on Windows
+platforms, the library names are \fItclstub84.lib\fR and
+\fItkstub84.lib\fR. Adjust the library names with appropriate version
+number but note that the extension may only be used with versions of
+Tcl/Tk that have that version number or higher.
.SH DESCRIPTION
+.PP
\fBTk_InitStubs\fR attempts to initialize the Tk stub table pointers
and ensure that the correct version of Tk is loaded. In addition
to an interpreter handle, it accepts as arguments a version number
diff --git a/doc/Tk_Init.3 b/doc/Tk_Init.3
index 65e2d0a..cf93e58 100644
--- a/doc/Tk_Init.3
+++ b/doc/Tk_Init.3
@@ -23,7 +23,6 @@ int
Interpreter in which to load Tk. Tk should not already be loaded
in this interpreter.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_Init\fR is the package initialization procedure for Tk.
@@ -34,7 +33,7 @@ and creates a new Tk application, including its main window.
If the initialization is successful \fBTk_Init\fR returns
\fBTCL_OK\fR; if there is an error it returns \fBTCL_ERROR\fR.
\fBTk_Init\fR also leaves a result or error message
-in \fIinterp->result\fR.
+in interpreter \fIinterp\fR's result.
.PP
If there is a variable \fBargv\fR in \fIinterp\fR, \fBTk_Init\fR
treats the contents of this variable as a list of options for the
@@ -82,6 +81,5 @@ from the user.
\fBwm\fR
If toplevels are ever allowed, wm can be used to remove decorations,
move windows around, etc.
-
.SH KEYWORDS
safe, application, initialization, load, main window
diff --git a/doc/Tk_Main.3 b/doc/Tk_Main.3
index e67cf00..5db887b 100644
--- a/doc/Tk_Main.3
+++ b/doc/Tk_Main.3
@@ -20,12 +20,12 @@ Tk_Main \- main program for Tk-based applications
.AP int argc in
Number of elements in \fIargv\fR.
.AP char *argv[] in
-Array of strings containing command-line arguments.
+Array of strings containing command-line arguments. On Windows, when
+using -DUNICODE, the parameter type changes to wchar_t *.
.AP Tcl_AppInitProc *appInitProc in
Address of an application-specific initialization procedure.
The value for this argument is usually \fBTcl_AppInit\fR.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_Main\fR acts as the main program for most Tk-based applications.
@@ -50,11 +50,21 @@ for the application to perform its own initialization, such as defining
application-specific commands. The procedure must have an interface
that matches the type \fBTcl_AppInitProc\fR:
.CS
-typedef int Tcl_AppInitProc(Tcl_Interp *\fIinterp\fR);
+typedef int \fBTcl_AppInitProc\fR(
+ Tcl_Interp *\fIinterp\fR);
.CE
\fIAppInitProc\fR is almost always a pointer to \fBTcl_AppInit\fR;
for more details on this procedure, see the documentation
for \fBTcl_AppInit\fR.
-
+.PP
+\fBTk_Main\fR functions much the same as \fBTcl_Main\fR. In particular,
+\fBTk_Main\fR supports both an interactive mode and a startup script
+mode, with the file name and encoding of a startup script under the
+control of the \fBTcl_SetStartupScript\fR and \fBTcl_GetStartupScript\fR
+routines. However it calls \fBTk_MainLoop\fR after processing any
+supplied script, and in interactive uses events registered with
+\fBTcl_CreateFileHandler\fR to process user input.
+.SH "SEE ALSO"
+Tcl_DoOneEvent(3)
.SH KEYWORDS
application-specific initialization, command-line arguments, main program
diff --git a/doc/WindowId.3 b/doc/WindowId.3
index efa326d..30f80a3 100644
--- a/doc/WindowId.3
+++ b/doc/WindowId.3
@@ -102,7 +102,6 @@ Tcl_Interp *
.AP Tk_Window tkwin in
Token for window.
.BE
-
.SH DESCRIPTION
.PP
\fBTk_WindowId\fR and the other names listed above are
@@ -183,7 +182,6 @@ and \fBTk_Colormap\fR returns the current
colormap for the window. The visual characteristics are
normally set from the defaults for the window's screen, but
they may be overridden by calling \fBTk_SetWindowVisual\fR.
-
.SH KEYWORDS
attributes, colormap, depth, display, height, geometry manager,
identifier, mapped, requested size, screen, top-level,
diff --git a/doc/bell.n b/doc/bell.n
index c9861bf..94d1545 100644
--- a/doc/bell.n
+++ b/doc/bell.n
@@ -15,7 +15,6 @@ bell \- Ring a display's bell
.SH SYNOPSIS
\fBbell \fR?\fB\-displayof \fIwindow\fR? ?\fB\-nice\fR?
.BE
-
.SH DESCRIPTION
.PP
This command rings the bell on the display for \fIwindow\fR and
@@ -28,6 +27,8 @@ may be modified with programs such as \fBxset\fR.
If \fB\-nice\fR is not specified, this command also resets the screen saver
for the screen. Some screen savers will ignore this, but others will reset
so that the screen becomes visible again.
-
.SH KEYWORDS
beep, bell, ring
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/bind.n b/doc/bind.n
index cd556e7..bccd6c8 100644
--- a/doc/bind.n
+++ b/doc/bind.n
@@ -151,7 +151,6 @@ requirement.
The \fBCommand\fR and \fBOption\fR modifiers are equivalents of \fBMod1\fR
resp. \fBMod2\fR, they correspond to Macintosh-specific modifier keys.
.PP
-.VS 8.5
The \fBExtended\fR modifier is, at present, specific to Windows. It
appears on events that are associated with the keys on the
.QW "extended keyboard" .
@@ -160,7 +159,6 @@ and \fBControl\fR keys at the right of the keyboard, the cursor keys
in the cluster to the left of the numeric pad, the \fBNumLock\fR key,
the \fBBreak\fR key, the \fBPrintScreen\fR key, and the \fB/\fR and
\fBEnter\fR keys in the numeric keypad.
-.VE 8.5
.SS "EVENT TYPES"
.PP
The \fItype\fR field may be any of the standard X event types, with a
@@ -429,10 +427,7 @@ The \fIcount\fR field from the event. Valid only for \fBExpose\fR events.
Indicates that there are \fIcount\fR pending \fBExpose\fR events which have not
yet been delivered to the window.
.IP \fB%d\fR 5
-The \fIdetail\fR
-.VS 8.5
-or \fIuser_data\fR
-.VE 8.5
+The \fIdetail\fR or \fIuser_data\fR
field from the event. The \fB%d\fR is replaced by
a string identifying the detail. For \fBEnter\fR,
\fBLeave\fR, \fBFocusIn\fR, and \fBFocusOut\fR events,
@@ -452,13 +447,11 @@ For \fBConfigureRequest\fR events, the string will be one of:
\fBBelow\fR \fBNone\fR
\fBBottomIf\fR \fBTopIf\fR
.DE
-.VS 8.5
For virtual events, the string will be whatever value is stored in the
\fIuser_data\fR field when the event was created (typically with
\fBevent generate\fR), or the empty string if the field is NULL.
Virtual events corresponding to key sequence presses (see \fBevent
add\fR for details) set the \fIuser_data\fR to NULL.
-.VE 8.5
For events other than these, the substituted string is undefined.
.RE
.IP \fB%f\fR 5
@@ -701,6 +694,7 @@ If an error occurs in executing the script for a binding then the
The \fBbgerror\fR command will be executed at global level
(outside the context of any Tcl procedure).
.SH "EXAMPLES"
+.PP
Arrange for a string describing the motion of the mouse to be printed
out when the mouse is double-clicked:
.CS
@@ -722,3 +716,6 @@ pack [label .l \-textvariable keysym \-padx 2m \-pady 1m]
bgerror(n), bindtags(n), event(n), focus(n), grab(n), keysyms(n)
.SH KEYWORDS
binding, event
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/bindtags.n b/doc/bindtags.n
index c5cf71b..74bd638 100644
--- a/doc/bindtags.n
+++ b/doc/bindtags.n
@@ -14,7 +14,6 @@ bindtags \- Determine which bindings apply to a window, and order of evaluation
.SH SYNOPSIS
\fBbindtags \fIwindow \fR?\fItagList\fR?
.BE
-
.SH DESCRIPTION
.PP
When a binding is created with the \fBbind\fR command, it is
@@ -73,6 +72,7 @@ associated with the \fBButton\fR tag, will no longer apply to \fB.b\fR,
but any bindings associated with \fBTrickyButton\fR (perhaps some
new button behavior) will apply.
.SH EXAMPLE
+.PP
If you have a set of nested \fBframe\fR widgets and you want events
sent to a \fBbutton\fR widget to also be delivered to all the widgets
up to the current \fBtoplevel\fR (in contrast to Tk's default
@@ -93,9 +93,10 @@ proc setupBindtagsForTreeDelivery {widget} {
\fBbindtags\fR $widget $tags
}
.CE
-
.SH "SEE ALSO"
bind(n)
-
.SH KEYWORDS
binding, event, tag
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/bitmap.n b/doc/bitmap.n
index 0dde8d5..968e6ea 100644
--- a/doc/bitmap.n
+++ b/doc/bitmap.n
@@ -12,9 +12,13 @@
.SH NAME
bitmap \- Images that display two colors
.SH SYNOPSIS
+.nf
\fBimage create bitmap \fR?\fIname\fR? ?\fIoptions\fR?
-.BE
+\fIimageName \fBcget\fR \fIoption\fR
+\fIimageName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+.fi
+.BE
.SH DESCRIPTION
.PP
A bitmap is an image whose pixels can display either of two colors
@@ -30,7 +34,6 @@ producing a transparent effect.
For other pixels, the image displays the foreground color if
the source data is one and the background color if the source
data is zero.
-
.SH "CREATING BITMAPS"
.PP
Like all images, bitmaps are created using the \fBimage create\fR
@@ -38,6 +41,7 @@ command.
Bitmaps support the following \fIoptions\fR:
.TP
\fB\-background \fIcolor\fR
+.
Specifies a background color for the image in any of the standard
ways accepted by Tk. If this option is set to an empty string
then the background pixels will be transparent. This effect
@@ -45,6 +49,7 @@ is achieved by using the source bitmap as the mask bitmap, ignoring
any \fB\-maskdata\fR or \fB\-maskfile\fR options.
.TP
\fB\-data \fIstring\fR
+.
Specifies the contents of the source bitmap as a string.
The string must adhere to X11 bitmap format (e.g., as generated
by the \fBbitmap\fR program).
@@ -52,16 +57,19 @@ If both the \fB\-data\fR and \fB\-file\fR options are specified,
the \fB\-data\fR option takes precedence.
.TP
\fB\-file \fIname\fR
+.
\fIname\fR gives the name of a file whose contents define the
source bitmap.
The file must adhere to X11 bitmap format (e.g., as generated
by the \fBbitmap\fR program).
.TP
\fB\-foreground \fIcolor\fR
+.
Specifies a foreground color for the image in any of the standard
ways accepted by Tk.
.TP
\fB\-maskdata \fIstring\fR
+.
Specifies the contents of the mask as a string.
The string must adhere to X11 bitmap format (e.g., as generated
by the \fBbitmap\fR program).
@@ -69,11 +77,11 @@ If both the \fB\-maskdata\fR and \fB\-maskfile\fR options are specified,
the \fB\-maskdata\fR option takes precedence.
.TP
\fB\-maskfile \fIname\fR
+.
\fIname\fR gives the name of a file whose contents define the
mask.
The file must adhere to X11 bitmap format (e.g., as generated
by the \fBbitmap\fR program).
-
.SH "IMAGE COMMAND"
.PP
When a bitmap image is created, Tk also creates a new command
@@ -89,12 +97,14 @@ determine the exact behavior of the command. The following
commands are possible for bitmap images:
.TP
\fIimageName \fBcget\fR \fIoption\fR
+.
Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the
-\fBimage create bitmap\fR command.
+\fBimage create\fR \fBbitmap\fR command.
.TP
\fIimageName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+.
Query or modify the configuration options for the image.
If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIimageName\fR (see \fBTk_ConfigureInfo\fR for
@@ -106,7 +116,9 @@ one or more \fIoption\-value\fR pairs are specified, then the command
modifies the given option(s) to have the given value(s); in
this case the command returns an empty string.
\fIOption\fR may have any of the values accepted by the
-\fBimage create bitmap\fR command.
-
+\fBimage create\fR \fBbitmap\fR command.
.SH KEYWORDS
bitmap, image
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/busy.n b/doc/busy.n
new file mode 100644
index 0000000..8821f95
--- /dev/null
+++ b/doc/busy.n
@@ -0,0 +1,267 @@
+'\"
+'\" Copyright (c) 1993-1998 Lucent Technologies, Inc.
+'\" Copyright (c) 2008 Jos Decoster
+'\"
+'\" Permission to use, copy, modify, and distribute this software and its
+'\" documentation for any purpose and without fee is hereby granted, provided
+'\" that the above copyright notice appear in all copies and that both that
+'\" the copyright notice and warranty disclaimer appear in supporting
+'\" documentation, and that the names of Lucent Technologies any of their
+'\" entities not be used in advertising or publicity pertaining to
+'\" distribution of the software without specific, written prior permission.
+'\"
+'\" Lucent Technologies disclaims all warranties with regard to this software,
+'\" including all implied warranties of merchantability and fitness. In no
+'\" event shall Lucent Technologies be liable for any special, indirect or
+'\" consequential damages or any damages whatsoever resulting from loss of
+'\" use, data or profits, whether in an action of contract, negligence or
+'\" other tortuous action, arising out of or in connection with the use or
+'\" performance of this software.
+'\"
+'\" BLT::busy command created by George Howlett.
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH busy n "" Tk "Tk Built-In Commands"
+.BS
+'\" Note: do not modify the .SH NAME line immediately below!
+.SH NAME
+busy \- confine pointer and keyboard events to a window sub-tree
+.SH SYNOPSIS
+\fBtk busy\fR \fIwindow \fR?\fIoptions\fR?
+.sp
+\fBtk busy hold\fR \fIwindow \fR?\fIoptions\fR?
+.sp
+\fBtk busy configure \fIwindow\fR ?\fIoption value\fR?...
+.sp
+\fBtk busy forget\fR \fIwindow \fR?\fIwindow \fR?...
+.sp
+\fBtk busy current\fR ?\fIpattern\fR?
+.sp
+\fBtk busy status \fIwindow\fR
+.BE
+.SH DESCRIPTION
+.PP
+The \fBtk busy\fR command provides a simple means to block keyboard, button,
+and pointer events from Tk widgets, while overriding the widget's cursor with
+a configurable busy cursor.
+.SH INTRODUCTION
+.PP
+There are many times in applications where you want to temporarily restrict
+what actions the user can take. For example, an application could have a
+.QW Run
+button that when pressed causes some processing to occur. However, while the
+application is busy processing, you probably don't want the user to be
+able to click the
+.QW Run
+button again. You may also want restrict the user from other tasks such as
+clicking a
+.QW Print
+button.
+.PP
+The \fBtk busy\fR command lets you make Tk widgets busy. This means that user
+interactions such as button clicks, moving the mouse, typing at the keyboard,
+etc.\0are ignored by the widget. You can set a special cursor (like a watch)
+that overrides the widget's normal cursor, providing feedback that the
+application (widget) is temporarily busy.
+.PP
+When a widget is made busy, the widget and all of its descendants will ignore
+events. It's easy to make an entire panel of widgets busy. You can simply make
+the toplevel widget (such as
+.QW . )
+busy. This is easier and far much more efficient than recursively traversing
+the widget hierarchy, disabling each widget and re-configuring its cursor.
+.PP
+Often, the \fBtk busy\fR command can be used instead of Tk's \fBgrab\fR
+command. Unlike \fBgrab\fR which restricts all user interactions to one
+widget, with the \fBtk busy\fR command you can have more than one widget
+active (for example, a
+.QW Cancel
+dialog and a
+.QW Help
+button).
+.SS EXAMPLE
+.PP
+You can make several widgets busy by simply making its ancestor widget busy
+using the \fBhold\fR operation.
+.PP
+.CS
+frame .top
+button .top.button; canvas .top.canvas
+pack .top.button .top.canvas
+pack .top
+# . . .
+\fBtk busy\fR hold .top
+update
+.CE
+.PP
+All the widgets within \fB.top\fR (including \fB.top\fR) are now busy. Using
+\fBupdate\fR insures that \fBtk busy\fR command will take effect before any
+other user events can occur.
+.PP
+When the application is no longer busy processing, you can allow user
+interactions again and free any resources it allocated by the \fBforget\fR
+operation.
+.PP
+.CS
+\fBtk busy\fR forget .top
+.CE
+.PP
+The busy window has a configurable cursor. You can change the busy cursor
+using the \fBconfigure\fR operation.
+.PP
+.CS
+\fBtk busy\fR configure .top \-cursor "watch"
+.CE
+.PP
+Destroying the widget will also clean up any resources allocated by the \fBtk
+busy\fR command.
+.PP
+.SH OPERATIONS
+.PP
+The following operations are available for the \fBtk busy\fR command:
+.TP
+\fBtk busy \fIwindow\fR ?\fIoption value\fR?...
+.
+Shortcut for \fBtk busy hold\fR command.
+.TP
+\fBtk busy hold \fIwindow\fR ?\fIoption value\fR?...
+.
+Makes the specified \fIwindow\fR (and its descendants in the Tk window
+hierarchy) appear busy. \fIWindow\fR must be a valid path name of a Tk widget.
+A transparent window is put in front of the specified window. This transparent
+window is mapped the next time idle tasks are processed, and the specified
+window and its descendants will be blocked from user interactions. Normally
+\fBupdate\fR should be called immediately afterward to insure that the hold
+operation is in effect before the application starts its processing. The
+following configuration options are valid:
+.RS
+.TP
+\fB\-cursor \fIcursorName\fR
+.
+Specifies the cursor to be displayed when the widget is made busy.
+\fICursorName\fR can be in any form accepted by \fBTk_GetCursor\fR. The
+default cursor is \fBwait\fR on Windows and \fBwatch\fR on other platforms.
+.RE
+.TP
+\fBtk busy cget \fIwindow\fR \fIoption\fR
+.
+Queries the \fBtk busy\fR command configuration options for \fIwindow\fR.
+\fIWindow\fR must be the path name of a widget previously made busy by the
+\fBhold\fR operation. The command returns the present value of the specified
+\fIoption\fR. \fIOption\fR may have any of the values accepted by the
+\fBhold\fR operation.
+.TP
+\fBtk busy configure \fIwindow\fR ?\fIoption value\fR?...
+.
+Queries or modifies the \fBtk busy\fR command configuration options for
+\fIwindow\fR. \fIWindow\fR must be the path name of a widget previously made
+busy by the \fBhold\fR operation. If no options are specified, a list
+describing all of the available options for \fIwindow\fR (see
+\fBTk_ConfigureInfo\fR for information on the format of this list) is
+returned. If \fIoption\fR is specified with no \fIvalue\fR, then the command
+returns a list describing the one named option (this list will be identical to
+the corresponding sublist of the value returned if no \fIoption\fR is
+specified). If one or more \fIoption\-value\fR pairs are specified, then the
+command modifies the given widget option(s) to have the given value(s); in
+this case the command returns the empty string. \fIOption\fR may have any of
+the values accepted by the \fBhold\fR operation.
+.RS
+.PP
+Please note that the option database is referenced through \fIwindow\fR. For
+example, if the widget \fB.frame\fR is to be made busy, the busy cursor can be
+specified for it by either \fBoption\fR command:
+.PP
+.CS
+option add *frame.busyCursor gumby
+option add *Frame.BusyCursor gumby
+.CE
+.RE
+.TP
+\fBtk busy forget \fIwindow\fR ?\fIwindow\fR?...
+.
+Releases resources allocated by the \fBtk busy\fR command for \fIwindow\fR,
+including the transparent window. User events will again be received by
+\fIwindow\fR. Resources are also released when \fIwindow\fR is destroyed.
+\fIWindow\fR must be the name of a widget specified in the \fBhold\fR
+operation, otherwise an error is reported.
+.TP
+\fBtk busy current \fR?\fIpattern\fR?
+.
+Returns the pathnames of all widgets that are currently busy. If a
+\fIpattern\fR is given, only the path names of busy widgets matching
+\fIpattern\fR are returned.
+.TP
+\fBtk busy status \fIwindow\fR
+.
+Returns the status of a widget \fIwindow\fR. If \fIwindow\fR presently can not
+receive user interactions, \fB1\fR is returned, otherwise \fB0\fR.
+.SH "EVENT HANDLING"
+.SS BINDINGS
+.PP
+The event blocking feature is implemented by creating and mapping a
+transparent window that completely covers the widget. When the busy window is
+mapped, it invisibly shields the widget and its hierarchy from all events that
+may be sent. Like Tk widgets, busy windows have widget names in the Tk window
+hierarchy. This means that you can use the \fBbind\fR command, to handle
+events in the busy window.
+.PP
+.CS
+\fBtk busy\fR hold .frame.canvas
+bind .frame.canvas_Busy <Enter> { ... }
+.CE
+.PP
+Normally the busy window is a sibling of the widget. The name of the busy
+window is
+.QW \fIwidget\fB_Busy\fR
+where \fIwidget\fR is the name of the widget to be made busy. In the previous
+example, the pathname of the busy window is
+.QW \fB.frame.canvas_Busy\fR .
+The exception is when the widget is a toplevel widget (such as
+.QW . )
+where the busy window can't be made a sibling. The busy window is then a child
+of the widget named
+.QW \fIwidget\fB._Busy\fR
+where \fIwidget\fR is the name of the toplevel widget. In the following
+example, the pathname of the busy window is
+.QW \fB._Busy\fR .
+.PP
+.CS
+\fBtk busy\fR hold .
+bind ._Busy <Enter> { ... }
+.CE
+.SS "ENTER/LEAVE EVENTS"
+.PP
+Mapping and unmapping busy windows generates Enter/Leave events for all
+widgets they cover. Please note this if you are tracking Enter/Leave events in
+widgets.
+.SS "KEYBOARD EVENTS"
+.PP
+When a widget is made busy, the widget is prevented from gaining the keyboard
+focus by the busy window. But if the widget already had focus, it still may
+received keyboard events. To prevent this, you must move focus to another
+window.
+.PP
+.CS
+\fBtk busy\fR hold .frame
+label .dummy
+focus .dummy
+update
+.CE
+.PP
+The above example moves the focus from .frame immediately after invoking the
+\fBhold\fR so that no keyboard events will be sent to \fB.frame\fR or any of
+its descendants.
+.SH PORTABILITY
+.PP
+Note that the \fBtk busy\fR command does not currently have any effect on OSX
+when Tk is built using Aqua support.
+.SH "SEE ALSO"
+grab(n)
+.SH KEYWORDS
+busy, keyboard events, pointer events, window
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/button.n b/doc/button.n
index 4b655a4..d4f1af3 100644
--- a/doc/button.n
+++ b/doc/button.n
@@ -57,14 +57,14 @@ The empty string is the default value.
.OP \-state state State
Specifies one of three states for the button: \fBnormal\fR, \fBactive\fR,
or \fBdisabled\fR. In normal state the button is displayed using the
-\fBforeground\fR and \fBbackground\fR options. The active state is
+\fB\-foreground\fR and \fB\-background\fR options. The active state is
typically used when the pointer is over the button. In active state
-the button is displayed using the \fBactiveForeground\fR and
-\fBactiveBackground\fR options. Disabled state means that the button
+the button is displayed using the \fB\-activeforeground\fR and
+\fB\-activebackground\fR options. Disabled state means that the button
should be insensitive: the default bindings will refuse to activate
the widget and will ignore mouse button presses.
-In this state the \fBdisabledForeground\fR and
-\fBbackground\fR options determine how the button is displayed.
+In this state the \fB\-disabledforeground\fR and
+\fB\-background\fR options determine how the button is displayed.
.OP \-width width Width
Specifies a desired width for the button.
If an image or bitmap is being displayed in the button then the value is in
@@ -75,7 +75,6 @@ If the width is negative then this specifies a minimum width.
If this option is not specified, the button's desired width is computed
from the size of the image or bitmap or text being displayed in it.
.BE
-
.SH DESCRIPTION
.PP
The \fBbutton\fR command creates a new window (given by the
@@ -92,18 +91,17 @@ there must not exist a window named \fIpathName\fR, but
A button is a widget that displays a textual string, bitmap or image.
If text is displayed, it must all be in a single font, but it
can occupy multiple lines on the screen (if it contains newlines
-or if wrapping occurs because of the \fBwrapLength\fR option) and
+or if wrapping occurs because of the \fB\-wraplength\fR option) and
one of the characters may optionally be underlined using the
-\fBunderline\fR option.
+\fB\-underline\fR option.
It can display itself in either of three different ways, according
to
-the \fBstate\fR option;
+the \fB\-state\fR option;
it can be made to appear raised, sunken, or flat;
and it can be made to flash. When a user invokes the
button (by pressing mouse button 1 with the cursor over the
button), then the Tcl command specified in the \fB\-command\fR
option is invoked.
-
.SH "WIDGET COMMAND"
.PP
The \fBbutton\fR command creates a new Tcl command whose
@@ -139,9 +137,9 @@ command.
.TP
\fIpathName \fBflash\fR
Flash the button. This is accomplished by redisplaying the button
-several times, alternating between active and normal colors. At
-the end of the flash the button is left in the same normal/active
-state as when the command was invoked.
+several times, alternating between the configured activebackground
+and background colors. At the end of the flash the button is left
+in the same normal/active state as when the command was invoked.
This command is ignored if the button's state is \fBdisabled\fR.
.TP
\fIpathName \fBinvoke\fR
@@ -149,7 +147,6 @@ Invoke the Tcl command associated with the button, if there is one.
The return value is the return value from the Tcl command, or an
empty string if there is no command associated with the button.
This command is ignored if the button's state is \fBdisabled\fR.
-
.SH "DEFAULT BINDINGS"
.PP
Tk automatically creates class bindings for buttons that give them
@@ -176,27 +173,38 @@ actions occur: the button is completely non-responsive.
.PP
The behavior of buttons can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
-
+.SH "PLATFORM NOTES"
+.PP
+On Aqua/Mac OS X, some configuration options are ignored for the purpose of
+drawing of the widget because they would otherwise conflict with platform
+guidelines. The \fBconfigure\fR and \fBcget\fR subcommands can still
+manipulate the values, but do not cause any variation to the look of the
+widget. The options affected notably include \fB\-background\fR and
+\fB\-relief\fR.
.SH EXAMPLES
+.PP
This is the classic Tk
.QW "Hello, World!"
demonstration:
.PP
.CS
- \fBbutton\fR .b \-text "Hello, World!" \-command exit
- pack .b
+\fBbutton\fR .b \-text "Hello, World!" \-command exit
+pack .b
.CE
.PP
This example demonstrates how to handle button accelerators:
.PP
.CS
- \fBbutton\fR .b1 \-text Hello \-underline 0
- \fBbutton\fR .b2 \-text World \-underline 0
- bind . <Key\-h> {.b1 flash; .b1 invoke}
- bind . <Key\-w> {.b2 flash; .b2 invoke}
- pack .b1 .b2
+\fBbutton\fR .b1 \-text Hello \-underline 0
+\fBbutton\fR .b2 \-text World \-underline 0
+bind . <Key\-h> {.b1 flash; .b1 invoke}
+bind . <Key\-w> {.b2 flash; .b2 invoke}
+pack .b1 .b2
.CE
.SH "SEE ALSO"
ttk::button(n)
.SH KEYWORDS
button, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/canvas.n b/doc/canvas.n
index 9338b8d..9eb0ec0 100644
--- a/doc/canvas.n
+++ b/doc/canvas.n
@@ -36,7 +36,7 @@ Defaults to true, which means that the view will
be constrained within the scroll region.
.OP \-height height Height
Specifies a desired window height that the canvas widget should request from
-its geometry manager. The value may be specified in any
+its geometry manager. The value may be specified in any
of the forms described in the \fBCOORDINATES\fR section below.
.OP \-scrollregion scrollRegion ScrollRegion
Specifies a list with four coordinates describing the left, top, right, and
@@ -49,34 +49,34 @@ in any of the forms given in the \fBCOORDINATES\fR section below.
Modifies the default state of the canvas where \fIstate\fR may be set to
one of: \fBnormal\fR, \fBdisabled\fR, or \fBhidden\fR. Individual canvas
objects all have their own state option which may override the default
-state. Many options can take separate specifications such that the
+state. Many options can take separate specifications such that the
appearance of the item can be different in different situations. The
options that start with \fBactive\fR control the appearance when the mouse
pointer is over it, while the option starting with \fBdisabled\fR controls
-the appearance when the state is disabled. Canvas items which are
+the appearance when the state is disabled. Canvas items which are
\fBdisabled\fR will not react to canvas bindings.
.OP \-width width width
Specifies a desired window width that the canvas widget should request from
-its geometry manager. The value may be specified in any
+its geometry manager. The value may be specified in any
of the forms described in the \fBCOORDINATES\fR section below.
.OP \-xscrollincrement xScrollIncrement ScrollIncrement
Specifies an increment for horizontal scrolling, in any of the usual forms
-permitted for screen distances. If the value of this option is greater
+permitted for screen distances. If the value of this option is greater
than zero, the horizontal view in the window will be constrained so that
the canvas x coordinate at the left edge of the window is always an even
-multiple of \fBxScrollIncrement\fR; furthermore, the units for scrolling
+multiple of \fBxScrollIncrement\fR; furthermore, the units for scrolling
(e.g., the change in view when the left and right arrows of a scrollbar
-are selected) will also be \fBxScrollIncrement\fR. If the value of
+are selected) will also be \fBxScrollIncrement\fR. If the value of
this option is less than or equal to zero, then horizontal scrolling
is unconstrained.
.OP \-yscrollincrement yScrollIncrement ScrollIncrement
Specifies an increment for vertical scrolling, in any of the usual forms
-permitted for screen distances. If the value of this option is greater
+permitted for screen distances. If the value of this option is greater
than zero, the vertical view in the window will be constrained so that
the canvas y coordinate at the top edge of the window is always an even
-multiple of \fByScrollIncrement\fR; furthermore, the units for scrolling
+multiple of \fByScrollIncrement\fR; furthermore, the units for scrolling
(e.g., the change in view when the top and bottom arrows of a scrollbar
-are selected) will also be \fByScrollIncrement\fR. If the value of
+are selected) will also be \fByScrollIncrement\fR. If the value of
this option is less than or equal to zero, then vertical scrolling
is unconstrained.
.BE
@@ -88,7 +88,7 @@ Additional options, described above, may be specified on the
command line or in the option database
to configure aspects of the canvas such as its colors and 3-D relief.
The \fBcanvas\fR command returns its
-\fIpathName\fR argument. At the time this command is invoked,
+\fIpathName\fR argument. At the time this command is invoked,
there must not exist a window named \fIpathName\fR, but
\fIpathName\fR's parent must exist.
.PP
@@ -97,7 +97,7 @@ A canvas displays any number of \fIitems\fR, which may be things like
rectangles, circles, lines, and text.
Items may be manipulated (e.g. moved or re-colored) and commands may
be associated with items in much the same way that the \fBbind\fR
-command allows commands to be bound to widgets. For example,
+command allows commands to be bound to widgets. For example,
a particular command may be associated with the <Button-1> event
so that the command is invoked whenever button 1 is pressed with
the mouse cursor over an item.
@@ -117,22 +117,22 @@ display list, on top of everything else.
Widget commands may be used to re-arrange the order of the
display list.
.PP
-Window items are an exception to the above rules. The underlying
+Window items are an exception to the above rules. The underlying
window systems require them always to be drawn on top of other items.
In addition, the stacking order of window items
is not affected by any of the canvas widget commands; you must use
-the \fBraise\fR and \fBlower\fR Tk commands instead.
+the Tk \fBraise\fR command and \fBlower\fR command instead.
.SH "ITEM IDS AND TAGS"
.PP
Items in a canvas widget may be named in either of two ways:
by id or by tag.
Each item has a unique identifying number, which is assigned to
-that item when it is created. The id of an item never changes
+that item when it is created. The id of an item never changes
and id numbers are never re-used within the lifetime of a
canvas widget.
.PP
Each item may also have any number of \fItags\fR associated
-with it. A tag is just a string of characters, and it may
+with it. A tag is just a string of characters, and it may
take any form except that of an integer.
For example,
.QW x123
@@ -141,11 +141,11 @@ is OK but
is not.
The same tag may be associated with many different items.
This is commonly done to group items in various interesting
-ways; for example, all selected items might be given the tag
+ways; for example, all selected items might be given the tag
.QW selected .
.PP
The tag \fBall\fR is implicitly associated with every item
-in the canvas; it may be used to invoke operations on
+in the canvas; it may be used to invoke operations on
all the items in the canvas.
.PP
The tag \fBcurrent\fR is managed automatically by Tk;
@@ -172,7 +172,7 @@ tags by using operators:
.QW \fB||\fR ,
.QW \fB^\fR ,
.QW \fB!\fR ,
-and parenthesized subexpressions. For example:
+and parenthesized subexpressions. For example:
.CS
.c find withtag {(a&&!b)||(!a&&b)}
.CE
@@ -187,7 +187,7 @@ or
tags, but not both.
.PP
Some widget commands only operate on a single item at a
-time; if \fItagOrId\fR is specified in a way that
+time; if \fItagOrId\fR is specified in a way that
names multiple items, then the normal behavior is for
the command to use the first (lowest) of these items in
the display list that is suitable for the command.
@@ -202,9 +202,9 @@ which are floating-point numbers optionally followed
by one of several letters.
If no letter is supplied then the distance is in pixels.
If the letter is \fBm\fR then the distance is in millimeters on
-the screen; if it is \fBc\fR then the distance is in centimeters;
+the screen; if it is \fBc\fR then the distance is in centimeters;
\fBi\fR means inches, and \fBp\fR means printers points (1/72 inch).
-Larger y-coordinates refer to points lower on the screen; larger
+Larger y-coordinates refer to points lower on the screen; larger
x-coordinates refer to points farther to the right.
Coordinates can be specified either as an even number of parameters,
or as a single list parameter containing an even number of x and y
@@ -215,7 +215,7 @@ Normally the origin of the canvas coordinate system is at the
upper-left corner of the window containing the canvas.
It is possible to adjust the origin of the canvas
coordinate system relative to the origin of the window using the
-\fBxview\fR and \fByview\fR widget commands; this is typically used
+\fBxview\fR and \fByview\fR widget commands; this is typically used
for scrolling.
Canvases do not support scaling or rotation of the canvas coordinate
system relative to the window coordinate system.
@@ -227,7 +227,7 @@ Note that the default origin of the canvas's visible area is
coincident with the origin for the whole window as that makes bindings
using the mouse position easier to work with; you only need to use the
\fBcanvasx\fR and \fBcanvasy\fR widget commands if you adjust the
-origin of the visible area. However, this also means that any focus
+origin of the visible area. However, this also means that any focus
ring (as controlled by the \fB\-highlightthickness\fR option) and
window border (as controlled by the \fB\-borderwidth\fR option) must
be taken into account before you get to the visible area of the
@@ -243,17 +243,18 @@ a range of characters or coordinates, and setting the insertion
cursor position. An index may be specified in any of a number
of ways, and different types of items may support different forms
for specifying indices.
-Text items support the following forms for an index; if you
+Text items support the following forms for an index; if you
define new types of text-like items, it would be advisable to
support as many of these forms as practical.
Note that it is possible to refer to the character just after
-the last one in the text item; this is necessary for such
+the last one in the text item; this is necessary for such
tasks as inserting new text at the end of the item.
Lines and Polygons do not support the insertion cursor
and the selection. Their indices are supposed to be even
always, because coordinates always appear in pairs.
.TP 10
\fInumber\fR
+.
A decimal number giving the position of the desired character
within the text item.
0 refers to the first character, 1 to the next character, and
@@ -268,23 +269,28 @@ the length until the result is between zero and the length,
inclusive.
.TP 10
\fBend\fR
+.
Refers to the character or coordinate just after the last one
in the item (same as the number of characters or coordinates
in the item).
.TP 10
\fBinsert\fR
+.
Refers to the character just before which the insertion cursor
is drawn in this item. Not valid for lines and polygons.
.TP 10
\fBsel.first\fR
+.
Refers to the first selected character in the item.
If the selection is not in this item then this form is illegal.
.TP 10
\fBsel.last\fR
+.
Refers to the last selected character in the item.
If the selection is not in this item then this form is illegal.
.TP 10
\fB@\fIx,y\fR
+.
Refers to the character or coordinate at the point given by \fIx\fR and
\fIy\fR, where \fIx\fR and \fIy\fR are specified in the coordinate
system of the canvas.
@@ -303,15 +309,15 @@ color. The other segments are drawn transparent.
.PP
The second possible syntax is a character list containing only
5 possible characters
-.QW "\fB.,\-_ \fR" .
+.QW "\fB.,-_ \fR" .
The space can be used
to enlarge the space between other line elements, and cannot
occur as the first position in the string. Some examples:
.CS
\-dash . \(-> \-dash {2 4}
-\-dash \- \(-> \-dash {6 4}
-\-dash \-. \(-> \-dash {6 4 2 4}
-\-dash \-.. \(-> \-dash {6 4 2 4 2 4}
+\-dash - \(-> \-dash {6 4}
+\-dash -. \(-> \-dash {6 4 2 4}
+\-dash -.. \(-> \-dash {6 4 2 4 2 4}
\-dash {. } \(-> \-dash {2 8}
\-dash , \(-> \-dash {4 4}
.CE
@@ -322,20 +328,20 @@ list will be multiplied by the line width before display. This
assures that
.QW .
will always be displayed as a dot and
-.QW \-
+.QW -
always as a dash regardless of the line width.
.PP
On systems which support only a limited set of dash patterns, the dash
pattern will be displayed as the closest dash pattern that is available.
For example, on Windows only the first 4 of the above examples are
-available. The last 2 examples will be displayed identically to the first
+available. The last 2 examples will be displayed identically to the first
one.
.SH "WIDGET COMMAND"
.PP
The \fBcanvas\fR command creates a new Tcl command whose
-name is \fIpathName\fR. This
+name is \fIpathName\fR. This
command may be used to invoke various
-operations on the widget. It has the following general form:
+operations on the widget. It has the following general form:
.CS
\fIpathName option \fR?\fIarg arg ...\fR?
.CE
@@ -344,6 +350,7 @@ determine the exact behavior of the command.
The following widget commands are possible for canvas widgets:
.TP
\fIpathName \fBaddtag \fItag searchSpec \fR?\fIarg arg ...\fR?
+.
For each item that meets the constraints specified by
\fIsearchSpec\fR and the \fIarg\fRs, add
\fItag\fR to the list of tags associated with the item if it
@@ -357,21 +364,25 @@ forms:
.RS
.TP
\fBabove \fItagOrId\fR
+.
Selects the item just after (above) the one given by \fItagOrId\fR
in the display list.
If \fItagOrId\fR denotes more than one item, then the last (topmost)
of these items in the display list is used.
.TP
\fBall\fR
+.
Selects all the items in the canvas.
.TP
\fBbelow \fItagOrId\fR
+.
Selects the item just before (below) the one given by \fItagOrId\fR
in the display list.
If \fItagOrId\fR denotes more than one item, then the first (lowest)
of these items in the display list is used.
.TP
\fBclosest \fIx y \fR?\fIhalo\fR? ?\fIstart\fR?
+.
Selects the item closest to the point given by \fIx\fR and \fIy\fR.
If more than one item is at the same closest distance (e.g. two
items overlap the point), then the top-most of these items (the
@@ -387,16 +398,18 @@ If \fIstart\fR is specified, it names an item using a tag or id
the given tag).
Instead of selecting the topmost closest item, this form will
select the topmost closest item that is below \fIstart\fR in
-the display list; if no such item exists, then the selection
+the display list; if no such item exists, then the selection
behaves as if the \fIstart\fR argument had not been specified.
.TP
\fBenclosed\fR \fIx1\fR \fIy1\fR \fIx2\fR \fIy2\fR
+.
Selects all the items completely enclosed within the rectangular
region given by \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR.
\fIX1\fR must be no greater then \fIx2\fR and \fIy1\fR must be
no greater than \fIy2\fR.
.TP
\fBoverlapping\fR \fIx1\fR \fIy1\fR \fIx2\fR \fIy2\fR
+.
Selects all the items that overlap or are enclosed within the
rectangular region given by \fIx1\fR, \fIy1\fR, \fIx2\fR,
and \fIy2\fR.
@@ -404,10 +417,12 @@ and \fIy2\fR.
no greater than \fIy2\fR.
.TP
\fBwithtag \fItagOrId\fR
+.
Selects all the items given by \fItagOrId\fR.
.RE
.TP
\fIpathName \fBbbox \fItagOrId\fR ?\fItagOrId tagOrId ...\fR?
+.
Returns a list with four elements giving an approximate bounding box
for all the items named by the \fItagOrId\fR arguments.
The list has the form
@@ -424,6 +439,7 @@ to display)
then an empty string is returned.
.TP
\fIpathName \fBbind \fItagOrId\fR ?\fIsequence\fR? ?\fIcommand\fR?
+.
This command associates \fIcommand\fR with all the items given by
\fItagOrId\fR such that whenever the event sequence given by
\fIsequence\fR occurs for one of the items the command will
@@ -451,13 +467,13 @@ The only events for which bindings may be specified are those related to
the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR,
\fBButtonPress\fR, \fBMotion\fR, and \fBKeyPress\fR) or virtual events.
The handling of events in canvases uses the current item defined in
-\fBITEM IDS AND TAGS\fR above. \fBEnter\fR and \fBLeave\fR events
+\fBITEM IDS AND TAGS\fR above. \fBEnter\fR and \fBLeave\fR events
trigger for an
item when it becomes the current item or ceases to be the current item;
note that these events are different than \fBEnter\fR and \fBLeave\fR
-events for windows. Mouse-related events are directed to the current
-item, if any. Keyboard-related events are directed to the focus item, if
-any (see the \fBfocus\fR widget command below for more on this). If a
+events for windows. Mouse-related events are directed to the current
+item, if any. Keyboard-related events are directed to the focus item, if
+any (see the \fBfocus\fR widget command below for more on this). If a
virtual event is used in a binding, that binding can trigger only if the
virtual event is defined by an underlying mouse-related or
keyboard-related event.
@@ -484,33 +500,37 @@ for the window as a whole.
.RE
.TP
\fIpathName \fBcanvasx \fIscreenx\fR ?\fIgridspacing\fR?
+.
Given a window x-coordinate in the canvas \fIscreenx\fR, this command returns
the canvas x-coordinate that is displayed at that location.
If \fIgridspacing\fR is specified, then the canvas coordinate is
rounded to the nearest multiple of \fIgridspacing\fR units.
.TP
\fIpathName \fBcanvasy \fIscreeny\fR ?\fIgridspacing\fR?
+.
Given a window y-coordinate in the canvas \fIscreeny\fR this command returns
the canvas y-coordinate that is displayed at that location.
If \fIgridspacing\fR is specified, then the canvas coordinate is
rounded to the nearest multiple of \fIgridspacing\fR units.
.TP
\fIpathName \fBcget\fR \fIoption\fR
+.
Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBcanvas\fR
command.
.TP
\fIpathName \fBconfigure ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR?
+.
Query or modify the configuration options of the widget.
If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
-information on the format of this list). If \fIoption\fR is specified
+information on the format of this list). If \fIoption\fR is specified
with no \fIvalue\fR, then the command returns a list describing the
one named option (this list will be identical to the corresponding
-sublist of the value returned if no \fIoption\fR is specified). If
+sublist of the value returned if no \fIoption\fR is specified). If
one or more \fIoption\-value\fR pairs are specified, then the command
-modifies the given widget option(s) to have the given value(s); in
+modifies the given widget option(s) to have the given value(s); in
this case the command returns an empty string.
\fIOption\fR may have any of the values accepted by the \fBcanvas\fR
command.
@@ -518,6 +538,7 @@ command.
\fIpathName\fR \fBcoords \fItagOrId \fR?\fIx0 y0 ...\fR?
.TP
\fIpathName\fR \fBcoords \fItagOrId \fR?\fIcoordList\fR?
+.
Query or modify the coordinates that define an item.
If no coordinates are specified, this command returns a list
whose elements are the coordinates of the item named by
@@ -530,9 +551,10 @@ the first one in the display list is used.
\fIpathName \fBcreate \fItype x y \fR?\fIx y ...\fR? ?\fIoption value ...\fR?
.TP
\fIpathName \fBcreate \fItype coordList \fR?\fIoption value ...\fR?
+.
Create a new item in \fIpathName\fR of type \fItype\fR.
-The exact format of the arguments after \fBtype\fR depends
-on \fBtype\fR, but usually they consist of the coordinates for
+The exact format of the arguments after \fItype\fR depends
+on \fItype\fR, but usually they consist of the coordinates for
one or more points, followed by specifications for zero or
more item options.
See the subsections on individual item types below for more
@@ -540,21 +562,24 @@ on the syntax of this command.
This command returns the id for the new item.
.TP
\fIpathName \fBdchars \fItagOrId first \fR?\fIlast\fR?
+.
For each item given by \fItagOrId\fR, delete the characters, or coordinates,
in the range given by \fIfirst\fR and \fIlast\fR, inclusive.
If some of the items given by \fItagOrId\fR do not support
-indexing operations then they ignore dchars.
+indexing operations then they ignore this operation.
Text items interpret \fIfirst\fR and \fIlast\fR as indices to a character,
-line and polygon items interpret them indices to a coordinate (an x,y pair).
+line and polygon items interpret them as indices to a coordinate (an x,y pair).
Indices are described in \fBINDICES\fR above.
If \fIlast\fR is omitted, it defaults to \fIfirst\fR.
This command returns an empty string.
.TP
\fIpathName \fBdelete \fR?\fItagOrId tagOrId ...\fR?
+.
Delete each of the items given by each \fItagOrId\fR, and return
an empty string.
.TP
\fIpathName \fBdtag \fItagOrId \fR?\fItagToDelete\fR?
+.
For each of the items given by \fItagOrId\fR, delete the
tag given by \fItagToDelete\fR from the list of those
associated with the item.
@@ -564,6 +589,7 @@ If \fItagToDelete\fR is omitted then it defaults to \fItagOrId\fR.
This command returns an empty string.
.TP
\fIpathName \fBfind \fIsearchCommand \fR?\fIarg arg ...\fR?
+.
This command returns a list consisting of all the items that
meet the constraints specified by \fIsearchCommand\fR and
\fIarg\fR's.
@@ -572,6 +598,7 @@ accepted by the \fBaddtag\fR command.
The items are returned in stacking order, with the lowest item first.
.TP
\fIpathName \fBfocus \fR?\fItagOrId\fR?
+.
Set the keyboard focus for the canvas widget to the item given by
\fItagOrId\fR.
If \fItagOrId\fR refers to several items, then the focus is set
@@ -600,6 +627,7 @@ the canvas (if it was not there already).
.RE
.TP
\fIpathName \fBgettags\fR \fItagOrId\fR
+.
Return a list whose elements are the tags associated with the
item given by \fItagOrId\fR.
If \fItagOrId\fR refers to more than one item, then the tags
@@ -608,24 +636,35 @@ If \fItagOrId\fR does not refer to any items, or if the item
contains no tags, then an empty string is returned.
.TP
\fIpathName \fBicursor \fItagOrId index\fR
+.
Set the position of the insertion cursor for the item(s) given by \fItagOrId\fR
to just before the character whose position is given by \fIindex\fR.
If some or all of the items given by \fItagOrId\fR do not support
an insertion cursor then this command has no effect on them.
See \fBINDICES\fR above for a description of the
legal forms for \fIindex\fR.
-Note: the insertion cursor is only displayed in an item if
-that item currently has the keyboard focus (see the widget
-command \fBfocus\fR, below), but the cursor position may
+Note: the insertion cursor is only displayed in an item if
+that item currently has the keyboard focus (see the \fBfocus\fR widget
+command, above), but the cursor position may
be set even when the item does not have the focus.
This command returns an empty string.
.TP
+\fIpathName \fBimove \fItagOrId index x y\fR
+.VS 8.6
+This command causes the \fIindex\fR'th coordinate of each of the items
+indicated by \fItagOrId\fR to be relocated to the location (\fIx\fR,\fIy\fR).
+Each item interprets \fIindex\fR independently according to the rules
+described in \fBINDICES\fR above. Out of the standard set of items, only line
+and polygon items may have their coordinates relocated this way.
+.VE 8.6
+.TP
\fIpathName \fBindex \fItagOrId index\fR
+.
This command returns a decimal string giving the numerical index
within \fItagOrId\fR corresponding to \fIindex\fR.
\fIIndex\fR gives a textual description of the desired position
as described in \fBINDICES\fR above.
-Text items interpret \fIindex\fR as an index to a character,
+Text items interpret \fIindex\fR as an index to a character,
line and polygon items interpret it as an index to a coordinate (an x,y pair).
The return value is guaranteed to lie between 0 and the number
of characters, or coordinates, within the item, inclusive.
@@ -634,10 +673,11 @@ is processed in the first of these items that supports indexing
operations (in display list order).
.TP
\fIpathName \fBinsert \fItagOrId beforeThis string\fR
+.
For each of the items given by \fItagOrId\fR, if the item supports
text or coordinate, insertion then \fIstring\fR is inserted into the item's
text just before the character, or coordinate, whose index is \fIbeforeThis\fR.
-Text items interpret \fIbeforeThis\fR as an index to a character,
+Text items interpret \fIbeforeThis\fR as an index to a character,
line and polygon items interpret it as an index to a coordinate (an x,y pair).
For lines and polygons the \fIstring\fR must be a valid coordinate
sequence.
@@ -646,6 +686,7 @@ for \fIbeforeThis\fR.
This command returns an empty string.
.TP
\fIpathName \fBitemcget\fR \fItagOrId\fR \fIoption\fR
+.
Returns the current value of the configuration option for the
item given by \fItagOrId\fR whose name is \fIoption\fR.
This command is similar to the \fBcget\fR widget command except that
@@ -656,6 +697,7 @@ If \fItagOrId\fR is a tag that refers to more than one item,
the first (lowest) such item is used.
.TP
\fIpathName \fBitemconfigure \fItagOrId\fR ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR?
+.
This command is similar to the \fBconfigure\fR widget command except
that it modifies item-specific options for the items given by
\fItagOrId\fR instead of modifying options for the overall
@@ -663,13 +705,13 @@ canvas widget.
If no \fIoption\fR is specified, returns a list describing all of
the available options for the first item given by \fItagOrId\fR
(see \fBTk_ConfigureInfo\fR for
-information on the format of this list). If \fIoption\fR is specified
+information on the format of this list). If \fIoption\fR is specified
with no \fIvalue\fR, then the command returns a list describing the
one named option (this list will be identical to the corresponding
-sublist of the value returned if no \fIoption\fR is specified). If
+sublist of the value returned if no \fIoption\fR is specified). If
one or more \fIoption\-value\fR pairs are specified, then the command
modifies the given widget option(s) to have the given value(s) in
-each of the items given by \fItagOrId\fR; in
+each of the items given by \fItagOrId\fR; in
this case the command returns an empty string.
The \fIoption\fRs and \fIvalue\fRs are the same as those permissible
in the \fBcreate\fR widget command when the item(s) were created;
@@ -677,30 +719,45 @@ see the sections describing individual item types below for details
on the legal options.
.TP
\fIpathName \fBlower \fItagOrId \fR?\fIbelowThis\fR?
+.
Move all of the items given by \fItagOrId\fR to a new position
in the display list just before the item given by \fIbelowThis\fR.
If \fItagOrId\fR refers to more than one item then all are moved
but the relative order of the moved items will not be changed.
-\fIBelowThis\fR is a tag or id; if it refers to more than one
+\fIBelowThis\fR is a tag or id; if it refers to more than one
item then the first (lowest) of these items in the display list is used
as the destination location for the moved items.
-Note: this command has no effect on window items. Window items always
+Note: this command has no effect on window items. Window items always
obscure other item types, and the stacking order of window items is
-determined by the \fBraise\fR and \fBlower\fR commands, not the
-\fBraise\fR and \fBlower\fR widget commands for canvases.
+determined by the \fBraise\fR command and \fBlower\fR command, not the
+\fBraise\fR widget command and \fBlower\fR widget command for canvases.
This command returns an empty string.
.TP
\fIpathName \fBmove \fItagOrId xAmount yAmount\fR
+.
Move each of the items given by \fItagOrId\fR in the canvas coordinate
space by adding \fIxAmount\fR to the x-coordinate of each point
associated with the item and \fIyAmount\fR to the y-coordinate of
each point associated with the item.
This command returns an empty string.
.TP
+\fIpathName \fBmoveto \fItagOrId xPos yPos\fR
+.VS 8.6
+Move the items given by \fItagOrId\fR in the canvas coordinate
+space so that the first coordinate pair of the bottommost item with
+tag \fItagOrId\fR is located at
+position (\fIxPos\fR,\fIyPos\fR). \fIxPos\fR and \fIyPos\fR may be
+the empty string, in which case the corresponding coordinate
+will be unchanged. All items matching
+\fItagOrId\fR remain in the same positions relative to each other.
+This command returns an empty string.
+.VE 8.6
+.TP
\fIpathName \fBpostscript \fR?\fIoption value option value ...\fR?
+.
Generate a Postscript representation for part or all of the canvas.
If the \fB\-file\fR option is specified then the Postscript is written
-to a file and an empty string is returned; otherwise the Postscript
+to a file and an empty string is returned; otherwise the Postscript
is returned as the result of the command.
If the interpreter that owns the canvas is marked as safe, the operation
will fail because safe interpreters are not allowed to write files.
@@ -711,18 +768,26 @@ of the operation.
The Postscript is created in Encapsulated Postscript form using
version 3.0 of the Document Structuring Conventions.
Note: by default Postscript is only generated for information that
-appears in the canvas's window on the screen. If the canvas is
+appears in the canvas's window on the screen. If the canvas is
freshly created it may still have its initial size of 1x1 pixel
-so nothing will appear in the Postscript. To get around this problem
+so nothing will appear in the Postscript. To get around this problem
either invoke the \fBupdate\fR command to wait for the canvas window
to reach its final size, or else use the \fB\-width\fR and \fB\-height\fR
options to specify the area of the canvas to print.
The \fIoption\fR\-\fIvalue\fR argument pairs provide additional
-information to control the generation of Postscript. The following
+information to control the generation of Postscript. The following
options are supported:
.RS
.TP
+\fB\-channel \fIchannelName\fR
+.
+Specifies the name of the channel to which to write the Postscript.
+If this option and the \fB\-file\fR option are
+not specified then the Postscript is returned as the
+result of the command.
+.TP
\fB\-colormap \fIvarName\fR
+.
\fIVarName\fR must be the name of an array variable
that specifies a color mapping to use in the Postscript.
Each element of \fIvarName\fR must consist of Postscript
@@ -738,17 +803,21 @@ in \fIvarName\fR for a given color, then Tk uses the red, green,
and blue intensities from the X color.
.TP
\fB\-colormode \fImode\fR
-Specifies how to output color information. \fIMode\fR must be either
+.
+Specifies how to output color information. \fIMode\fR must be either
\fBcolor\fR (for full color output), \fBgray\fR (convert all colors
to their gray-scale equivalents) or \fBmono\fR (convert all colors
to black or white).
.TP
\fB\-file \fIfileName\fR
+.
Specifies the name of the file in which to write the Postscript.
-If this option is not specified then the Postscript is returned as the
-result of the command instead of being written to a file.
+If this option and the \fB\-channel\fR option are
+not specified then the Postscript is returned as the
+result of the command.
.TP
\fB\-fontmap \fIvarName\fR
+.
\fIVarName\fR must be the name of an array variable
that specifies a font mapping to use in the Postscript.
Each element of \fIvarName\fR must consist of a Tcl list with
@@ -763,14 +832,16 @@ Tk's guesses generally only work for well-known fonts such as
Times and Helvetica and Courier, and only if the X font name does not
omit any dashes up through the point size.
For example, \fB\-*\-Courier\-Bold\-R\-Normal\-\-*\-120\-*\fR will work but
-\fB*Courier\-Bold\-R\-Normal*120*\fR will not; Tk needs the dashes to
+\fB*Courier\-Bold\-R\-Normal*120*\fR will not; Tk needs the dashes to
parse the font name).
.TP
\fB\-height \fIsize\fR
+.
Specifies the height of the area of the canvas to print.
Defaults to the height of the canvas window.
.TP
\fB\-pageanchor \fIanchor\fR
+.
Specifies which point of the printed area of the canvas should appear over
the positioning point on the page (which is given by the \fB\-pagex\fR
and \fB\-pagey\fR options).
@@ -779,6 +850,7 @@ area of the canvas being printed (as it appears in the canvas window)
should be over the positioning point. Defaults to \fBcenter\fR.
.TP
\fB\-pageheight \fIsize\fR
+.
Specifies that the Postscript should be scaled in both x and y so
that the printed area is \fIsize\fR high on the Postscript page.
\fISize\fR consists of a floating-point number followed by
@@ -790,15 +862,17 @@ the scale factor from \fB\-pagewidth\fR is used (non-uniform scaling
is not implemented).
.TP
\fB\-pagewidth \fIsize\fR
+.
Specifies that the Postscript should be scaled in both x and y so
that the printed area is \fIsize\fR wide on the Postscript page.
\fISize\fR has the same form as for \fB\-pageheight\fR.
Defaults to the width of the printed area on the screen.
If both \fB\-pageheight\fR and \fB\-pagewidth\fR are specified then
-the scale factor from \fB\-pagewidth\fR is used (non-uniform scaling
+the scale factor from \fB\-pagewidth\fR is used (non-uniform scaling
is not implemented).
.TP
\fB\-pagex \fIposition\fR
+.
\fIPosition\fR gives the x-coordinate of the positioning point on
the Postscript page, using any of the forms allowed for \fB\-pageheight\fR.
Used in conjunction with the \fB\-pagey\fR and \fB\-pageanchor\fR options
@@ -806,6 +880,7 @@ to determine where the printed area appears on the Postscript page.
Defaults to the center of the page.
.TP
\fB\-pagey \fIposition\fR
+.
\fIPosition\fR gives the y-coordinate of the positioning point on
the Postscript page, using any of the forms allowed for \fB\-pageheight\fR.
Used in conjunction with the \fB\-pagex\fR and \fB\-pageanchor\fR options
@@ -813,26 +888,30 @@ to determine where the printed area appears on the Postscript page.
Defaults to the center of the page.
.TP
\fB\-rotate \fIboolean\fR
+.
\fIBoolean\fR specifies whether the printed area is to be rotated 90
degrees.
In non-rotated output the x-axis of the printed area runs along
the short dimension of the page
-.PQ portrait orientation ;
+.PQ portrait " orientation" ;
in rotated output the x-axis runs along the long dimension of the page
-.PQ landscape orientation .
+.PQ landscape " orientation" .
Defaults to non-rotated.
.TP
\fB\-width \fIsize\fR
+.
Specifies the width of the area of the canvas to print.
Defaults to the width of the canvas window.
.TP
\fB\-x \fIposition\fR
+.
Specifies the x-coordinate of the left edge of the area of the
canvas that is to be printed, in canvas coordinates, not window
coordinates.
Defaults to the coordinate of the left edge of the window.
.TP
\fB\-y \fIposition\fR
+.
Specifies the y-coordinate of the top edge of the area of the
canvas that is to be printed, in canvas coordinates, not window
coordinates.
@@ -840,22 +919,39 @@ Defaults to the coordinate of the top edge of the window.
.RE
.TP
\fIpathName \fBraise \fItagOrId \fR?\fIaboveThis\fR?
+.
Move all of the items given by \fItagOrId\fR to a new position
in the display list just after the item given by \fIaboveThis\fR.
If \fItagOrId\fR refers to more than one item then all are moved
but the relative order of the moved items will not be changed.
-\fIAboveThis\fR is a tag or id; if it refers to more than one
+\fIAboveThis\fR is a tag or id; if it refers to more than one
item then the last (topmost) of these items in the display list is used
as the destination location for the moved items.
-Note: this command has no effect on window items. Window items always
-obscure other item types, and the stacking order of window items is
-determined by the \fBraise\fR and \fBlower\fR commands, not the
-\fBraise\fR and \fBlower\fR widget commands for canvases.
This command returns an empty string.
+.RS
+.PP
+Note: this command has no effect on window items. Window items always
+obscure other item types, and the stacking order of window items is
+determined by the \fBraise\fR command and \fBlower\fR command, not the
+\fBraise\fR widget command and \fBlower\fR widget command for canvases.
+.RE
+.TP
+\fIpathName \fBrchars \fItagOrId first last string\fR
+.VS 8.6
+This command causes the text or coordinates between \fIfirst\fR and \fIlast\fR
+for each of the items indicated by \fItagOrId\fR to be replaced by
+\fIstring\fR. Each item interprets \fIfirst\fR and \fIlast\fR independently
+according to the rules described in \fBINDICES\fR above. Out of the standard
+set of items, text items support this operation by altering their text as
+directed, and line and polygon items support this operation by altering their
+coordinate list (in which case \fIstring\fR should be a list of coordinates to
+use as a replacement). The other items ignore this operation.
+.VE 8.6
.TP
\fIpathName \fBscale \fItagOrId xOrigin yOrigin xScale yScale\fR
-Rescale all of the items given by \fItagOrId\fR in canvas coordinate
-space.
+.
+Rescale the coordinates of all of the items given by \fItagOrId\fR in canvas
+coordinate space.
\fIXOrigin\fR and \fIyOrigin\fR identify the origin for the scaling
operation and \fIxScale\fR and \fIyScale\fR identify the scale
factors for x- and y-coordinates, respectively (a scale factor of
@@ -866,20 +962,29 @@ of \fIxScale\fR.
Similarly, each y-coordinate is adjusted to change the distance
from \fIyOrigin\fR by a factor of \fIyScale\fR.
This command returns an empty string.
+.RS
+.PP
+Note that some items have only a single pair of coordinates (e.g., text,
+images and windows) and so scaling of them by this command can only move them
+around.
+.RE
.TP
\fIpathName \fBscan\fR \fIoption args\fR
-This command is used to implement scanning on canvases. It has
+.
+This command is used to implement scanning on canvases. It has
two forms, depending on \fIoption\fR:
.RS
.TP
\fIpathName \fBscan mark \fIx y\fR
-Records \fIx\fR and \fIy\fR and the canvas's current view; used
+.
+Records \fIx\fR and \fIy\fR and the canvas's current view; used
in conjunction with later \fBscan dragto\fR commands.
Typically this command is associated with a mouse button press in
the widget and \fIx\fR and \fIy\fR are the coordinates of the
-mouse. It returns an empty string.
+mouse. It returns an empty string.
.TP
-\fIpathName \fBscan dragto \fIx y ?gain?\fR.
+\fIpathName \fBscan dragto \fIx y ?gain?\fR
+.
This command computes the difference between its \fIx\fR and \fIy\fR
arguments (which are typically mouse coordinates) and the \fIx\fR and
\fIy\fR arguments to the last \fBscan mark\fR command for the widget.
@@ -887,16 +992,17 @@ It then adjusts the view by \fIgain\fR times the
difference in coordinates, where \fIgain\fR defaults to 10.
This command is typically associated
with mouse motion events in the widget, to produce the effect of
-dragging the canvas at high speed through its window. The return
+dragging the canvas at high speed through its window. The return
value is an empty string.
.RE
.TP
\fIpathName \fBselect \fIoption\fR ?\fItagOrId arg\fR?
+.
Manipulates the selection in one of several ways, depending on
\fIoption\fR.
The command may take any of the forms described below.
In all of the descriptions below, \fItagOrId\fR must refer to
-an item that supports indexing and selection; if it refers to
+an item that supports indexing and selection; if it refers to
multiple items then the first of
these that supports indexing and the selection is used.
\fIIndex\fR gives a textual description of a position
@@ -904,6 +1010,7 @@ within \fItagOrId\fR, as described in \fBINDICES\fR above.
.RS
.TP
\fIpathName \fBselect adjust \fItagOrId index\fR
+.
Locate the end of the selection in \fItagOrId\fR nearest
to the character given by \fIindex\fR, and adjust that
end of the selection to be at \fIindex\fR (i.e. including
@@ -916,27 +1023,31 @@ command.
Returns an empty string.
.TP
\fIpathName \fBselect clear\fR
+.
Clear the selection if it is in this widget.
If the selection is not in this widget then the command
has no effect.
Returns an empty string.
.TP
\fIpathName \fBselect from \fItagOrId index\fR
+.
Set the selection anchor point for the widget to be just
before the character
given by \fIindex\fR in the item given by \fItagOrId\fR.
-This command does not change the selection; it just sets
+This command does not change the selection; it just sets
the fixed end of the selection for future \fBselect to\fR
commands.
Returns an empty string.
.TP
\fIpathName \fBselect item\fR
+.
Returns the id of the selected item, if the selection is in an
item in this canvas.
If the selection is not in this canvas then an empty string
is returned.
.TP
\fIpathName \fBselect to \fItagOrId index\fR
+.
Set the selection to consist of those characters of \fItagOrId\fR
between the selection anchor point and
\fIindex\fR.
@@ -952,6 +1063,7 @@ Returns an empty string.
.RE
.TP
\fIpathName \fBtype\fI tagOrId\fR
+.
Returns the type of the item given by \fItagOrId\fR, such as
\fBrectangle\fR or \fBtext\fR.
If \fItagOrId\fR refers to more than one item, then the type
@@ -959,15 +1071,17 @@ of the first item in the display list is returned.
If \fItagOrId\fR does not refer to any items at all then
an empty string is returned.
.TP
-\fIpathName \fBxview \fR?\fIargs\fR?
+\fIpathName \fBxview \fR?\fIargs\fR?
+.
This command is used to query and change the horizontal position of the
information displayed in the canvas's window.
It can take any of the following forms:
.RS
.TP
\fIpathName \fBxview\fR
+.
Returns a list containing two elements.
-Each element is a real fraction between 0 and 1; together they describe
+Each element is a real fraction between 0 and 1; together they describe
the horizontal span that is visible in the window.
For example, if the first element is .2 and the second element is .6,
20% of the canvas's area (as defined by the \fB\-scrollregion\fR option)
@@ -977,11 +1091,13 @@ These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR
option.
.TP
\fIpathName \fBxview moveto\fI fraction\fR
+.
Adjusts the view in the window so that \fIfraction\fR of the
total width of the canvas is off-screen to the left.
\fIFraction\fR must be a fraction between 0 and 1.
.TP
\fIpathName \fBxview scroll \fInumber what\fR
+.
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR.
\fINumber\fR must be an integer.
@@ -993,19 +1109,21 @@ or in units of one-tenth the window's width otherwise.
If \fIwhat is \fBpages\fR then the view
adjusts in units of nine-tenths the window's width.
If \fInumber\fR is negative then information farther to the left
-becomes visible; if it is positive then information farther to the right
+becomes visible; if it is positive then information farther to the right
becomes visible.
.RE
.TP
\fIpathName \fByview \fI?args\fR?
+.
This command is used to query and change the vertical position of the
information displayed in the canvas's window.
It can take any of the following forms:
.RS
.TP
\fIpathName \fByview\fR
+.
Returns a list containing two elements.
-Each element is a real fraction between 0 and 1; together they describe
+Each element is a real fraction between 0 and 1; together they describe
the vertical span that is visible in the window.
For example, if the first element is .6 and the second element is 1.0,
the lowest 40% of the canvas's area (as defined by the \fB\-scrollregion\fR
@@ -1014,11 +1132,13 @@ These are the same values passed to scrollbars via the \fB\-yscrollcommand\fR
option.
.TP
\fIpathName \fByview moveto\fI fraction\fR
+.
Adjusts the view in the window so that \fIfraction\fR of the canvas's
area is off-screen to the top.
\fIFraction\fR is a fraction between 0 and 1.
.TP
\fIpathName \fByview scroll \fInumber what\fR
+.
This command adjusts the view in the window up or down according to
\fInumber\fR and \fIwhat\fR.
\fINumber\fR must be an integer.
@@ -1029,15 +1149,15 @@ or in units of one-tenth the window's height otherwise.
If \fIwhat\fR is \fBpages\fR then
the view adjusts in units of nine-tenths the window's height.
If \fInumber\fR is negative then higher information becomes
-visible; if it is positive then lower information
+visible; if it is positive then lower information
becomes visible.
.RE
.SH "OVERVIEW OF ITEM TYPES"
.PP
The sections below describe the various types of items supported
-by canvas widgets. Each item type is characterized by two things:
+by canvas widgets. Each item type is characterized by two things:
first, the form of the \fBcreate\fR command used to create
-instances of the type; and second, a set of configuration options
+instances of the type; and second, a set of configuration options
for items of that type, which may be used in the
\fBcreate\fR and \fBitemconfigure\fR widget commands.
Most items do not support indexing or selection or the commands
@@ -1049,15 +1169,25 @@ For lines and polygons the indexing facility is used to manipulate
the coordinates of the item.
.SS "COMMON ITEM OPTIONS"
.PP
-Many items share a common set of options. These options are
+Many items share a common set of options. These options are
explained here, and then referred to be each widget type for brevity.
-.PP
+.TP
+\fB\-anchor \fIanchorPos\fR
+.
+\fIAnchorPos\fR tells how to position the item relative to the
+positioning point for the item; it may have any of the forms
+accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR
+is \fBcenter\fR then the item is centered on the point; if
+\fIanchorPos\fR is \fBn\fR then the item will be drawn so that
+its top center point is at the positioning point.
+This option defaults to \fBcenter\fR.
.TP
\fB\-dash \fIpattern\fR
.TP
\fB\-activedash \fIpattern\fR
.TP
\fB\-disableddash \fIpattern\fR
+.
This option specifies dash patterns for the normal, active
state, and disabled state of an item.
\fIpattern\fR may have any of the forms accepted by \fBTk_GetDash\fR.
@@ -1065,9 +1195,10 @@ If the dash options are omitted then the default is a solid outline.
See \fBDASH PATTERNS\fR for more information.
.TP
\fB\-dashoffset \fIoffset\fR
+.
The starting \fIoffset\fR in pixels into the pattern provided by the
-\fB\-dash\fR option. \fB\-dashoffset\fR is ignored if there is no
-\fB\-dash\fR pattern. The \fIoffset\fR may have any of the forms described
+\fB\-dash\fR option. \fB\-dashoffset\fR is ignored if there is no
+\fB\-dash\fR pattern. The \fIoffset\fR may have any of the forms described
in the \fBCOORDINATES\fR section above.
.TP
\fB\-fill \fIcolor\fR
@@ -1075,6 +1206,7 @@ in the \fBCOORDINATES\fR section above.
\fB\-activefill \fIcolor\fR
.TP
\fB\-disabledfill \fIcolor\fR
+.
Specifies the color to be used to fill item's area.
in its normal, active, and disabled states,
\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR.
@@ -1088,29 +1220,33 @@ For the text item, it specifies the foreground color of the text.
\fB\-activeoutline \fIcolor\fR
.TP
\fB\-disabledoutline \fIcolor\fR
+.
This option specifies the color that should be used to draw the
outline of the item in its normal, active and disabled states.
\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR.
-This option defaults to \fBblack\fR. If \fIcolor\fR is specified
+This option defaults to \fBblack\fR. If \fIcolor\fR is specified
as an empty string then no outline is drawn for the item.
.TP
\fB\-offset \fIoffset\fR
-Specifies the offset of stipples. The offset value can be of the form
-\fBx,y\fR or \fBside\fR, where side can be \fBn\fR, \fBne\fR, \fBe\fR,
+.
+Specifies the offset of stipples. The offset value can be of the form
+\fBx,y\fR or \fIside\fR, where side can be \fBn\fR, \fBne\fR, \fBe\fR,
\fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR. In the
first case the origin is the origin of the toplevel of the current window.
For the canvas itself and canvas objects the origin is the canvas origin,
but putting \fB#\fR in front of the coordinate pair indicates using the
toplevel origin instead. For canvas objects, the \fB\-offset\fR option is
-used for stippling as well. For the line and polygon canvas items you can
+used for stippling as well. For the line and polygon canvas items you can
also specify an index as argument, which connects the stipple origin to one
-of the coordinate points of the line/polygon.
+of the coordinate points of the line/polygon. Note that stipple offsets are
+\fIonly supported on X11\fR; they are silently ignored on other platforms.
.TP
\fB\-outlinestipple \fIbitmap\fR
.TP
\fB\-activeoutlinestipple \fIbitmap\fR
.TP
\fB\-disabledoutlinestipple \fIbitmap\fR
+.
This option specifies stipple patterns that should be used to draw the
outline of the item in its normal, active and disabled states.
Indicates that the outline for the item should be drawn with a stipple pattern;
@@ -1125,20 +1261,16 @@ use X11 as their drawing API.\fR
.TP
\fB\-outlineoffset \fIoffset\fR
.
-Specifies the offset of the stipple pattern used for outlines. The
-offset value can be of the form
-.QW \fIx\fB,\fIy\fR
-or the description of a side (one of \fBn\fR, \fBne\fR, \fBe\fR,
-\fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR). This
-option only has an effect when the outline is drawn as a stipple
-pattern, and is only supported under X11.
-.\" TODO: What does this actually do? What do the acceptable forms mean?!
+Specifies the offset of the stipple pattern used for outlines, in the same way
+that the \fB\-outline\fR option controls fill stipples. (See the
+\fB\-outline\fR option for a description of the syntax of \fIoffset\fR.)
.TP
\fB\-stipple \fIbitmap\fR
.TP
\fB\-activestipple \fIbitmap\fR
.TP
\fB\-disabledstipple \fIbitmap\fR
+.
This option specifies stipple patterns that should be used to fill
the item in its normal, active and disabled states.
\fIbitmap\fR specifies the stipple pattern to use, in any of the
@@ -1152,29 +1284,33 @@ For the text item, it affects the actual text.
use X11 as their drawing API.\fR
.TP
\fB\-state \fIstate\fR
+.
This allows an item to override the canvas widget's global \fIstate\fR
-option. It takes the same values:
+option. It takes the same values:
\fInormal\fR, \fIdisabled\fR or \fIhidden\fR.
.TP
\fB\-tags \fItagList\fR
+.
Specifies a set of tags to apply to the item.
\fITagList\fR consists of a list of tag names, which replace any
-existing tags for the item. \fITagList\fR may be an empty list.
+existing tags for the item. \fITagList\fR may be an empty list.
.TP
\fB\-width \fIoutlineWidth\fR
.TP
\fB\-activewidth \fIoutlineWidth\fR
.TP
\fB\-disabledwidth \fIoutlineWidth\fR
+.
Specifies the width of the outline to be drawn around
the item's region, in its normal, active and disabled states.
\fIoutlineWidth\fR may be in any of the forms described in the
\fBCOORDINATES\fR section above.
If the \fB\-outline\fR option has been specified as an empty string then
-this option has no effect. This option defaults to 1.0.
+this option has no effect. This option defaults to 1.0.
For arcs, wide outlines will be drawn centered on the edges of the
arc's region.
-.SH "ARC ITEMS"
+.SH "STANDARD ITEM TYPES"
+.SS "ARC ITEMS"
.PP
Items of type \fBarc\fR appear on the display as arc-shaped regions.
An arc is a section of an oval delimited by two angles (specified
@@ -1182,46 +1318,36 @@ by the \fB\-start\fR and \fB\-extent\fR options) and displayed in
one of several ways (specified by the \fB\-style\fR option).
Arcs are created with widget commands of the following form:
.CS
-\fIpathName \fBcreate arc \fIx1 y1 x2 y2 \fR?\fIoption value option value ...\fR?
-\fIpathName \fBcreate arc \fIcoordList\fR ?\fIoption value option value ...\fR?
+\fIpathName \fBcreate arc \fIx1 y1 x2 y2 \fR?\fIoption value ...\fR?
+\fIpathName \fBcreate arc \fIcoordList\fR ?\fIoption value ...\fR?
.CE
The arguments \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR or \fIcoordList\fR give
the coordinates of two diagonally opposite corners of a
rectangular region enclosing the oval that defines the arc.
After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
-for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
+for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
configuration. An arc item becomes the current item when the mouse pointer is
over any part that is painted or (when fully transparent) that would be
painted if both the \fB\-fill\fR and \fB\-outline\fR options were non-empty.
.PP
The following standard options are supported by arcs:
-.CS
-\-dash
-\-activedash
-\-disableddash
-\-dashoffset
-\-fill
-\-activefill
-\-disabledfill
-\-offset
-\-outline
-\-activeoutline
-\-disabledoutline
-\-outlineoffset
-\-outlinestipple
-\-activeoutlinestipple
-\-disabledoutlinestipple
-\-stipple
-\-activestipple
-\-disabledstipple
-\-state
-\-tags
-\-width
-\-activewidth
-\-disabledwidth
-.CE
+.DS
+.ta 3i
+\fB\-dash\fR \fB\-activedash\fR
+\fB\-disableddash\fR \fB\-dashoffset\fR
+\fB\-fill\fR \fB\-activefill\fR
+\fB\-disabledfill\fR \fB\-offset\fR
+\fB\-outline\fR \fB\-activeoutline\fR
+\fB\-disabledoutline\fR \fB\-outlineoffset\fR
+\fB\-outlinestipple\fR \fB\-activeoutlinestipple\fR
+\fB\-disabledoutlinestipple\fR \fB\-stipple\fR
+\fB\-activestipple\fR \fB\-disabledstipple\fR
+\fB\-state\fR \fB\-tags\fR
+\fB\-width\fR \fB\-activewidth\fR
+\fB\-disabledwidth\fR
+.DE
The following extra options are supported for arcs:
.TP
\fB\-extent \fIdegrees\fR
@@ -1236,10 +1362,10 @@ modulo 360 is used as the extent.
Specifies the beginning of the angular range occupied by the
arc.
\fIDegrees\fR is given in units of degrees measured counter-clockwise
-from the 3-o'clock position; it may be either positive or negative.
+from the 3-o'clock position; it may be either positive or negative.
.TP
\fB\-style \fItype\fR
-Specifies how to draw the arc. If \fItype\fR is \fBpieslice\fR
+Specifies how to draw the arc. If \fItype\fR is \fBpieslice\fR
(the default) then the arc's region is defined by a section
of the oval's perimeter plus two line segments, one between the center
of the oval and each end of the perimeter section.
@@ -1249,42 +1375,34 @@ connecting the two end points of the perimeter section.
If \fItype\fR is \fBarc\fR then the arc's region consists of
a section of the perimeter alone.
In this last case the \fB\-fill\fR option is ignored.
-.SH "BITMAP ITEMS"
+.SS "BITMAP ITEMS"
.PP
Items of type \fBbitmap\fR appear on the display as images with
two colors, foreground and background.
Bitmaps are created with widget commands of the following form:
.CS
-\fIpathName \fBcreate bitmap \fIx y \fR?\fIoption value option value ...\fR?
-\fIpathName \fBcreate bitmap \fIcoordList\fR ?\fIoption value option value ...\fR?
+\fIpathName \fBcreate bitmap \fIx y \fR?\fIoption value ...\fR?
+\fIpathName \fBcreate bitmap \fIcoordList\fR ?\fIoption value ...\fR?
.CE
The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR (which must have two
elements) specify the coordinates of a
-point used to position the bitmap on the display (see the \fB\-anchor\fR
-option below for more information on how bitmaps are displayed).
+point used to position the bitmap on the display, as controlled by the
+\fB\-anchor\fR option.
After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
-for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
+for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
configuration. A bitmap item becomes the current item when the mouse pointer
is over any part of its bounding box.
.PP
The following standard options are supported by bitmaps:
-.CS
-\-state
-\-tags
-.CE
+.DS
+.ta 3i
+\fB\-anchor\fR \fB\-state\fR
+\fB\-tags\fR
+.DE
The following extra options are supported for bitmaps:
.TP
-\fB\-anchor \fIanchorPos\fR
-\fIAnchorPos\fR tells how to position the bitmap relative to the
-positioning point for the item; it may have any of the forms
-accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR
-is \fBcenter\fR then the bitmap is centered on the point; if
-\fIanchorPos\fR is \fBn\fR then the bitmap will be drawn so that
-its top center point is at the positioning point.
-This option defaults to \fBcenter\fR.
-.TP
\fB\-background \fIcolor\fR
.TP
\fB\-activebackground \fIcolor\fR
@@ -1295,7 +1413,7 @@ Specifies the color to use for each of the bitmap's
valued pixels in its normal, active and disabled states.
\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR.
If this option is not specified, or if it is specified as an empty
-string, then nothing is displayed where the bitmap pixels are 0; this
+string, then nothing is displayed where the bitmap pixels are 0; this
produces a transparent effect.
.TP
\fB\-bitmap \fIbitmap\fR
@@ -1317,41 +1435,33 @@ Specifies the color to use for each of the bitmap's
valued pixels in its normal, active and disabled states.
\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR and
defaults to \fBblack\fR.
-.SH "IMAGE ITEMS"
+.SS "IMAGE ITEMS"
.PP
Items of type \fBimage\fR are used to display images on a
canvas.
Images are created with widget commands of the following form:
.CS
-\fIpathName \fBcreate image \fIx y \fR?\fIoption value option value ...\fR?
-\fIpathName \fBcreate image \fIcoordList\fR ?\fIoption value option value ...\fR?
+\fIpathName \fBcreate image \fIx y \fR?\fIoption value ...\fR?
+\fIpathName \fBcreate image \fIcoordList\fR ?\fIoption value ...\fR?
.CE
The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR specify the coordinates of a
-point used to position the image on the display (see the \fB\-anchor\fR
-option below for more information).
+point used to position the image on the display, as controlled by the
+\fB\-anchor\fR option.
After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
-for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
+for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
configuration. An image item becomes the current item when the mouse pointer
is over any part of its bounding box.
.PP
The following standard options are supported by images:
-.CS
-\-state
-\-tags
-.CE
+.DS
+.ta 3i
+\fB\-anchor\fR \fB\-state\fR
+\fB\-tags\fR
+.DE
The following extra options are supported for images:
.TP
-\fB\-anchor \fIanchorPos\fR
-\fIAnchorPos\fR tells how to position the image relative to the
-positioning point for the item; it may have any of the forms
-accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR
-is \fBcenter\fR then the image is centered on the point; if
-\fIanchorPos\fR is \fBn\fR then the image will be drawn so that
-its top center point is at the positioning point.
-This option defaults to \fBcenter\fR.
-.TP
\fB\-image \fIname\fR
.TP
\fB\-activeimage \fIname\fR
@@ -1361,46 +1471,40 @@ Specifies the name of the images to display in the item in is normal,
active and disabled states.
This image must have been created previously with the
\fBimage create\fR command.
-.SH "LINE ITEMS"
+.SS "LINE ITEMS"
.PP
Items of type \fBline\fR appear on the display as one or more connected
line segments or curves.
-Line items support coordinate indexing operations using the canvas
-widget commands: \fBdchars, index, insert.\fR
+Line items support coordinate indexing operations using the \fBdchars\fR,
+\fBindex\fR and \fBinsert\fR widget commands.
Lines are created with widget commands of the following form:
.CS
-\fIpathName \fBcreate line \fIx1 y1... xn yn \fR?\fIoption value option value ...\fR?
-\fIpathName \fBcreate line \fIcoordList\fR ?\fIoption value option value ...\fR?
+\fIpathName \fBcreate line \fIx1 y1... xn yn \fR?\fIoption value ...\fR?
+\fIpathName \fBcreate line \fIcoordList\fR ?\fIoption value ...\fR?
.CE
The arguments \fIx1\fR through \fIyn\fR or \fIcoordList\fR give
the coordinates for a series of two or more points that describe
a series of connected line segments.
After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
-for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
+for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
configuration. A line item is the current item whenever the mouse pointer is
over any segment of the line, whether drawn or not and whether or not the line
is smoothed.
.PP
The following standard options are supported by lines:
-.CS
-\-dash
-\-activedash
-\-disableddash
-\-dashoffset
-\-fill
-\-activefill
-\-disabledfill
-\-stipple
-\-activestipple
-\-disabledstipple
-\-state
-\-tags
-\-width
-\-activewidth
-\-disabledwidth
-.CE
+.DS
+.ta 3i
+\fB\-dash\fR \fB\-activedash\fR
+\fB\-disableddash\fR \fB\-dashoffset\fR
+\fB\-fill\fR \fB\-activefill\fR
+\fB\-disabledfill\fR \fB\-stipple\fR
+\fB\-activestipple\fR \fB\-disabledstipple\fR
+\fB\-state\fR \fB\-tags\fR
+\fB\-width\fR \fB\-activewidth\fR
+\fB\-disabledwidth\fR
+.DE
The following extra options are supported for lines:
.TP
\fB\-arrow \fIwhere\fR
@@ -1438,7 +1542,7 @@ Where arrowheads are drawn the cap style is ignored.
\fB\-joinstyle \fIstyle\fR
Specifies the ways in which joints are to be drawn at the vertices
of the line.
-\fIStyle\fR may have any of the forms accepted by \fBTk_GetCapStyle\fR
+\fIStyle\fR may have any of the forms accepted by \fBTk_GetJoinStyle\fR
(\fBbevel\fR, \fBmiter\fR, or \fBround\fR).
If this option is not specified then it defaults to \fBround\fR.
If the line only contains two points then this option is
@@ -1447,40 +1551,38 @@ irrelevant.
\fB\-smooth \fIsmoothMethod\fR
\fIsmoothMethod\fR must have one of the forms accepted by
\fBTcl_GetBoolean\fR or a line smoothing method.
-.VS 8.5
Only \fBtrue\fR and \fBraw\fR are
-supported in the core (with \fBbezier\fR being an alias for \fBtrue\fR), but more can be added at runtime. If a boolean
-false value or empty string is given, no smoothing is applied. A boolean
+supported in the core (with \fBbezier\fR being an alias for \fBtrue\fR), but more can be added at runtime. If a boolean
+false value or empty string is given, no smoothing is applied. A boolean
truth value assumes \fBtrue\fR smoothing.
If the smoothing method is \fBtrue\fR, this indicates that the line
should be drawn as a curve, rendered as a set of quadratic splines: one spline
is drawn for the first and second line segments, one for the second
-and third, and so on. Straight-line segments can be generated within
+and third, and so on. Straight-line segments can be generated within
a curve by duplicating the end-points of the desired line segment.
If the smoothing method is \fBraw\fR, this indicates that the line
should also be drawn as a curve but where the list of coordinates is
such that the first coordinate pair (and every third coordinate pair
thereafter) is a knot point on a cubic Bezier curve, and the other
-coordinates are control points on the cubic Bezier curve. Straight
+coordinates are control points on the cubic Bezier curve. Straight
line segments can be generated within a curve by making control points
-equal to their neighbouring knot points. If the last point is a
+equal to their neighbouring knot points. If the last point is a
control point and not a knot point, the point is repeated (one or two
times) so that it also becomes a knot point.
-.VE 8.5
.TP
\fB\-splinesteps \fInumber\fR
-Specifies the degree of smoothness desired for curves: each spline
-will be approximated with \fInumber\fR line segments. This
+Specifies the degree of smoothness desired for curves: each spline
+will be approximated with \fInumber\fR line segments. This
option is ignored unless the \fB\-smooth\fR option is true or \fBraw\fR.
-.SH "OVAL ITEMS"
+.SS "OVAL ITEMS"
.PP
Items of type \fBoval\fR appear as circular or oval regions on
-the display. Each oval may have an outline, a fill, or
-both. Ovals are created with widget commands of the
+the display. Each oval may have an outline, a fill, or
+both. Ovals are created with widget commands of the
following form:
.CS
-\fIpathName \fBcreate oval \fIx1 y1 x2 y2 \fR?\fIoption value option value ...\fR?
-\fIpathName \fBcreate oval \fIcoordList\fR ?\fIoption value option value ...\fR?
+\fIpathName \fBcreate oval \fIx1 y1 x2 y2 \fR?\fIoption value ...\fR?
+\fIpathName \fBcreate oval \fIcoordList\fR ?\fIoption value ...\fR?
.CE
The arguments \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR or \fIcoordList\fR give
the coordinates of two diagonally opposite corners of a
@@ -1491,48 +1593,39 @@ If the region is square then the resulting oval is circular;
otherwise it is elongated in shape.
After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
-for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
+for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
configuration. An oval item becomes the current item when the mouse pointer is
over any part that is painted or (when fully transparent) that would be
painted if both the \fB\-fill\fR and \fB\-outline\fR options were non-empty.
.PP
The following standard options are supported by ovals:
-.CS
-\-dash
-\-activedash
-\-disableddash
-\-dashoffset
-\-fill
-\-activefill
-\-disabledfill
-\-offset
-\-outline
-\-activeoutline
-\-disabledoutline
-\-outlineoffset
-\-outlinestipple
-\-activeoutlinestipple
-\-disabledoutlinestipple
-\-stipple
-\-activestipple
-\-disabledstipple
-\-state
-\-tags
-\-width
-\-activewidth
-\-disabledwidth
-.CE
-.SH "POLYGON ITEMS"
+.DS
+.ta 3i
+\fB\-dash\fR \fB\-activedash\fR
+\fB\-disableddash\fR \fB\-dashoffset\fR
+\fB\-fill\fR \fB\-activefill\fR
+\fB\-disabledfill\fR \fB\-offset\fR
+\fB\-outline\fR \fB\-activeoutline\fR
+\fB\-disabledoutline\fR \fB\-outlineoffset\fR
+\fB\-outlinestipple\fR \fB\-activeoutlinestipple\fR
+\fB\-disabledoutlinestipple\fR \fB\-stipple\fR
+\fB\-activestipple\fR \fB\-disabledstipple\fR
+\fB\-state\fR \fB\-tags\fR
+\fB\-width\fR \fB\-activewidth\fR
+\fB\-disabledwidth\fR
+.DE
+There are no oval-specific options.
+.SS "POLYGON ITEMS"
.PP
Items of type \fBpolygon\fR appear as polygonal or curved filled regions
on the display.
-Polygon items support coordinate indexing operations using the canvas
-widget commands: \fBdchars, index, insert.\fR
+Polygon items support coordinate indexing operations using the \fBdchars\fR,
+\fBindex\fR and \fBinsert\fR widget commands.
Polygons are created with widget commands of the following form:
.CS
-\fIpathName \fBcreate polygon \fIx1 y1 ... xn yn \fR?\fIoption value option value ...\fR?
-\fIpathName \fBcreate polygon \fIcoordList\fR ?\fIoption value option value ...\fR?
+\fIpathName \fBcreate polygon \fIx1 y1 ... xn yn \fR?\fIoption value ...\fR?
+\fIpathName \fBcreate polygon \fIcoordList\fR ?\fIoption value ...\fR?
.CE
The arguments \fIx1\fR through \fIyn\fR or \fIcoordList\fR specify the coordinates for
three or more points that define a polygon.
@@ -1541,73 +1634,62 @@ close the shape; Tk will automatically close the periphery between
the first and last points.
After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
-for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
+for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
configuration. A polygon item is the current item whenever the mouse pointer
is over any part of the polygon, whether drawn or not and whether or not the
outline is smoothed.
.PP
The following standard options are supported by polygons:
-.CS
-\-dash
-\-activedash
-\-disableddash
-\-dashoffset
-\-fill
-\-activefill
-\-disabledfill
-\-offset
-\-outline
-\-activeoutline
-\-disabledoutline
-\-outlinestipple
-\-activeoutlinestipple
-\-disabledoutlinestipple
-\-stipple
-\-activestipple
-\-disabledstipple
-\-state
-\-tags
-\-width
-\-activewidth
-\-disabledwidth
-.CE
+.DS
+.ta 3i
+\fB\-dash\fR \fB\-activedash\fR
+\fB\-disableddash\fR \fB\-dashoffset\fR
+\fB\-fill\fR \fB\-activefill\fR
+\fB\-disabledfill\fR \fB\-offset\fR
+\fB\-outline\fR \fB\-activeoutline\fR
+\fB\-disabledoutline\fR \fB\-outlineoffset\fR
+\fB\-outlinestipple\fR \fB\-activeoutlinestipple\fR
+\fB\-disabledoutlinestipple\fR \fB\-stipple\fR
+\fB\-activestipple\fR \fB\-disabledstipple\fR
+\fB\-state\fR \fB\-tags\fR
+\fB\-width\fR \fB\-activewidth\fR
+\fB\-disabledwidth\fR
+.DE
The following extra options are supported for polygons:
.TP
\fB\-joinstyle \fIstyle\fR
Specifies the ways in which joints are to be drawn at the vertices
of the outline.
-\fIStyle\fR may have any of the forms accepted by \fBTk_GetCapStyle\fR
+\fIStyle\fR may have any of the forms accepted by \fBTk_GetJoinStyle\fR
(\fBbevel\fR, \fBmiter\fR, or \fBround\fR).
If this option is not specified then it defaults to \fBround\fR.
.TP
\fB\-smooth \fIboolean\fR
\fIBoolean\fR must have one of the forms accepted by \fBTcl_GetBoolean\fR
-.VS 8.5
or a line smoothing method. Only \fBtrue\fR and \fBraw\fR are
-supported in the core (with \fBbezier\fR being an alias for \fBtrue\fR), but more can be added at runtime. If a boolean
-false value or empty string is given, no smoothing is applied. A boolean
+supported in the core (with \fBbezier\fR being an alias for \fBtrue\fR), but more can be added at runtime. If a boolean
+false value or empty string is given, no smoothing is applied. A boolean
truth value assumes \fBtrue\fR smoothing.
If the smoothing method is \fBtrue\fR, this indicates that the polygon
should be drawn as a curve, rendered as a set of quadratic splines: one spline
is drawn for the first and second line segments, one for the second
-and third, and so on. Straight-line segments can be generated within
+and third, and so on. Straight-line segments can be generated within
a curve by duplicating the end-points of the desired line segment.
If the smoothing method is \fBraw\fR, this indicates that the polygon
should also be drawn as a curve but where the list of coordinates is
such that the first coordinate pair (and every third coordinate pair
thereafter) is a knot point on a cubic Bezier curve, and the other
-coordinates are control points on the cubic Bezier curve. Straight
+coordinates are control points on the cubic Bezier curve. Straight
line segments can be venerated within a curve by making control points
-equal to their neighbouring knot points. If the last point is not the
+equal to their neighbouring knot points. If the last point is not the
second point of a pair of control points, the point is repeated (one or two
times) so that it also becomes the second point of a pair of control
points (the associated knot point will be the first control point).
-.VE 8.5
.TP
\fB\-splinesteps \fInumber\fR
-Specifies the degree of smoothness desired for curves: each spline
-will be approximated with \fInumber\fR line segments. This
+Specifies the degree of smoothness desired for curves: each spline
+will be approximated with \fInumber\fR line segments. This
option is ignored unless the \fB\-smooth\fR option is true or \fBraw\fR.
.PP
Polygon items are different from other items such as rectangles, ovals
@@ -1617,18 +1699,18 @@ a polygon (e.g. for purposes of the \fBfind closest\fR and
\fBfind overlapping\fR widget commands) even if it is not filled.
For most other item types, an
interior point is considered to be inside the item only if the item
-is filled or if it has neither a fill nor an outline. If you would
+is filled or if it has neither a fill nor an outline. If you would
like an unfilled polygon whose interior points are not considered
to be inside the polygon, use a line item instead.
-.SH "RECTANGLE ITEMS"
+.SS "RECTANGLE ITEMS"
.PP
Items of type \fBrectangle\fR appear as rectangular regions on
-the display. Each rectangle may have an outline, a fill, or
-both. Rectangles are created with widget commands of the
+the display. Each rectangle may have an outline, a fill, or
+both. Rectangles are created with widget commands of the
following form:
.CS
-\fIpathName \fBcreate rectangle \fIx1 y1 x2 y2 \fR?\fIoption value option value ...\fR?
-\fIpathName \fBcreate rectangle \fIcoordList\fR ?\fIoption value option value ...\fR?
+\fIpathName \fBcreate rectangle \fIx1 y1 x2 y2 \fR?\fIoption value ...\fR?
+\fIpathName \fBcreate rectangle \fIcoordList\fR ?\fIoption value ...\fR?
.CE
The arguments \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR or \fIcoordList\fR
(which must have four elements) give
@@ -1637,7 +1719,7 @@ the coordinates of two diagonally opposite corners of the rectangle
its lower or right edges).
After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
-for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
+for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
configuration. A rectangle item becomes the current item when the mouse
pointer is over any part that is painted or (when fully transparent) that
@@ -1645,44 +1727,35 @@ would be painted if both the \fB\-fill\fR and \fB\-outline\fR options were
non-empty.
.PP
The following standard options are supported by rectangles:
-.CS
-\-dash
-\-activedash
-\-disableddash
-\-dashoffset
-\-fill
-\-activefill
-\-disabledfill
-\-offset
-\-outline
-\-activeoutline
-\-disabledoutline
-\-outlineoffset
-\-outlinestipple
-\-activeoutlinestipple
-\-disabledoutlinestipple
-\-stipple
-\-activestipple
-\-disabledstipple
-\-state
-\-tags
-\-width
-\-activewidth
-\-disabledwidth
-.CE
-.SH "TEXT ITEMS"
+.DS
+.ta 3i
+\fB\-dash\fR \fB\-activedash\fR
+\fB\-disableddash\fR \fB\-dashoffset\fR
+\fB\-fill\fR \fB\-activefill\fR
+\fB\-disabledfill\fR \fB\-offset\fR
+\fB\-outline\fR \fB\-activeoutline\fR
+\fB\-disabledoutline\fR \fB\-outlineoffset\fR
+\fB\-outlinestipple\fR \fB\-activeoutlinestipple\fR
+\fB\-disabledoutlinestipple\fR \fB\-stipple\fR
+\fB\-activestipple\fR \fB\-disabledstipple\fR
+\fB\-state\fR \fB\-tags\fR
+\fB\-width\fR \fB\-activewidth\fR
+\fB\-disabledwidth\fR
+.DE
+There are no rectangle-specific options.
+.SS "TEXT ITEMS"
.PP
A text item displays a string of characters on the screen in one
or more lines.
-Text items support indexing and selection, along with the
-following text-related canvas widget commands: \fBdchars\fR,
-\fBfocus\fR, \fBicursor\fR, \fBindex\fR, \fBinsert\fR,
-\fBselect\fR.
+Text items support indexing, editing and selection through the \fBdchars\fR
+widget command, the \fBfocus\fR widget command, the \fBicursor\fR widget
+command, the \fBindex\fR widget command, the \fBinsert\fR widget command, and
+the \fBselect\fR widget command.
Text items are created with widget commands of the following
form:
.CS
-\fIpathName \fBcreate text \fIx y \fR?\fIoption value option value ...\fR?
-\fIpathName \fBcreate text \fIcoordList\fR ?\fIoption value option value ...\fR?
+\fIpathName \fBcreate text \fIx y \fR?\fIoption value ...\fR?
+\fIpathName \fBcreate text \fIcoordList\fR ?\fIoption value ...\fR?
.CE
The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR (which must have two
elements) specify the coordinates of a
@@ -1690,33 +1763,30 @@ point used to position the text on the display (see the options
below for more information on how text is displayed).
After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
-for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
+for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
configuration. A text item becomes the current item when the mouse pointer
is over any part of its bounding box.
.PP
The following standard options are supported by text items:
-.CS
-\-fill
-\-activefill
-\-disabledfill
-\-stipple
-\-activestipple
-\-disabledstipple
-\-state
-\-tags
-.CE
+.DS
+.ta 3i
+\fB\-anchor\fR \fB\-fill\fR
+\fB\-activefill\fR \fB\-disabledfill\fR
+\fB\-stipple\fR \fB\-activestipple\fR
+\fB\-disabledstipple\fR \fB\-state\fR
+\fB\-tags\fR
+.DE
The following extra options are supported for text items:
.TP
-\fB\-anchor \fIanchorPos\fR
-\fIAnchorPos\fR tells how to position the text relative to the
-positioning point for the text; it may have any of the forms
-accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR
-is \fBcenter\fR then the text is centered on the point; if
-\fIanchorPos\fR is \fBn\fR then the text will be drawn such that
-the top center point of the rectangular region occupied by the
-text will be at the positioning point.
-This option defaults to \fBcenter\fR.
+\fB\-angle \fIrotationDegrees\fR
+.VS 8.6
+\fIRotationDegrees\fR tells how many degrees to rotate the text anticlockwise
+about the positioning point for the text; it may have any floating-point value
+from 0.0 to 360.0. For example, if \fIrotationDegrees\fR is \fB90\fR, then the
+text will be drawn vertically from bottom to top.
+This option defaults to \fB0.0\fR.
+.VE 8.6
.TP
\fB\-font \fIfontName\fR
Specifies the font to use for the text item.
@@ -1738,7 +1808,6 @@ Newline characters cause line breaks.
The characters in the item may also be changed with the
\fBinsert\fR and \fBdelete\fR widget commands.
This option defaults to an empty string.
-.VS 8.5
.TP
\fB\-underline \fI\fR
Specifies the integer index of a character within the text to be
@@ -1746,7 +1815,6 @@ underlined. 0 corresponds to the first character of the text
displayed, 1 to the next character, and so on. \-1 means that no
underline should be drawn (if the whole text item is to be underlined,
the appropriate font should be used instead).
-.VE 8.5
.TP
\fB\-width \fIlineLength\fR
Specifies a maximum line length for the text, in any of the forms
@@ -1755,25 +1823,25 @@ If this option is zero (the default) the text is broken into
lines only at newline characters.
However, if this option is non-zero then any line that would
be longer than \fIlineLength\fR is broken just before a space
-character to make the line shorter than \fIlineLength\fR; the
+character to make the line shorter than \fIlineLength\fR; the
space character is treated as if it were a newline
character.
-.SH "WINDOW ITEMS"
+.SS "WINDOW ITEMS"
.PP
Items of type \fBwindow\fR cause a particular window to be displayed
at a given position on the canvas.
Window items are created with widget commands of the following form:
.CS
-\fIpathName \fBcreate window \fIx y \fR?\fIoption value option value ...\fR?
-\fIpathName \fBcreate window \fIcoordList\fR ?\fIoption value option value ...\fR?
+\fIpathName \fBcreate window \fIx y \fR?\fIoption value ...\fR?
+\fIpathName \fBcreate window \fIcoordList\fR ?\fIoption value ...\fR?
.CE
The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR (which must have two
elements) specify the coordinates of a
-point used to position the window on the display (see the \fB\-anchor\fR
-option below for more information on how bitmaps are displayed).
+point used to position the window on the display, as controlled by the
+\fB\-anchor\fR option.
After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
pairs, each of which sets one of the configuration options
-for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
+for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
used in \fBitemconfigure\fR widget commands to change the item's
configuration. Theoretically, a window item becomes the current item when the
mouse pointer is over any part of its bounding box, but in practice this
@@ -1781,22 +1849,13 @@ typically does not happen because the mouse pointer ceases to be over the
canvas at that point.
.PP
The following standard options are supported by window items:
-.CS
-\-state
-\-tags
-.CE
+.DS
+.ta 3i
+\fB\-anchor\fR \fB\-state\fR
+\fB\-tags\fR
+.DE
The following extra options are supported for window items:
.TP
-\fB\-anchor \fIanchorPos\fR
-.
-\fIAnchorPos\fR tells how to position the window relative to the
-positioning point for the item; it may have any of the forms
-accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR
-is \fBcenter\fR then the window is centered on the point; if
-\fIanchorPos\fR is \fBn\fR then the window will be drawn so that
-its top center point is at the positioning point.
-This option defaults to \fBcenter\fR.
-.TP
\fB\-height \fIpixels\fR
.
Specifies the height to assign to the item's window.
@@ -1820,9 +1879,9 @@ The window specified by \fIpathName\fR must either be a child of
the canvas widget or a child of some ancestor of the canvas widget.
\fIPathName\fR may not refer to a top-level window.
.PP
-Note: due to restrictions in the ways that windows are managed, it is not
+Note: due to restrictions in the ways that windows are managed, it is not
possible to draw other graphical items (such as lines and images) on top
-of window items. A window item always obscures any graphics that
+of window items. A window item always obscures any graphics that
overlap it, regardless of their order in the display list. Also note that
window items, unlike other canvas items, are not clipped for display by their
containing canvas's border, and are instead clipped by the parent widget of
@@ -1836,16 +1895,20 @@ See the documentation for \fBTk_CreateItemType\fR.
.SH BINDINGS
.PP
In the current implementation, new canvases are not given any
-default behavior: you will have to execute explicit Tcl commands
+default behavior: you will have to execute explicit Tcl commands
to give the canvas its behavior.
.SH CREDITS
.PP
Tk's canvas widget is a blatant ripoff of ideas from Joel Bartlett's
-\fIezd\fR program. \fIEzd\fR provides structured graphics in a Scheme
-environment and preceded canvases by a year or two. Its simple
+\fIezd\fR program. \fIEzd\fR provides structured graphics in a Scheme
+environment and preceded canvases by a year or two. Its simple
mechanisms for placing and animating graphical objects inspired the
functions of canvases.
.SH "SEE ALSO"
bind(n), font(n), image(n), scrollbar(n)
.SH KEYWORDS
canvas, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" fill-column: 78
+'\" End:
diff --git a/doc/checkbutton.n b/doc/checkbutton.n
index 1e05c96..4d06c68 100644
--- a/doc/checkbutton.n
+++ b/doc/checkbutton.n
@@ -38,7 +38,7 @@ If this option is not specified, the button's desired height is computed
from the size of the image or bitmap or text being displayed in it.
.OP \-indicatoron indicatorOn IndicatorOn
Specifies whether or not the indicator should be drawn. Must be a
-proper boolean value. If false, the \fBrelief\fR option is
+proper boolean value. If false, the \fB\-relief\fR option is
ignored and the widget's relief is always sunken if the widget is
selected and raised otherwise.
.OP \-offrelief offRelief OffRelief
@@ -79,34 +79,30 @@ whenever the widget is selected.
If specified as an empty string then no special color is used for
displaying when the widget is selected.
.OP \-selectimage selectImage SelectImage
-Specifies an image to display (in place of the \fBimage\fR option)
+Specifies an image to display (in place of the \fB\-image\fR option)
when the checkbutton is selected.
-This option is ignored unless the \fBimage\fR option has been
+This option is ignored unless the \fB\-image\fR option has been
specified.
.OP \-state state State
Specifies one of three states for the checkbutton: \fBnormal\fR, \fBactive\fR,
or \fBdisabled\fR. In normal state the checkbutton is displayed using the
-\fBforeground\fR and \fBbackground\fR options. The active state is
+\fB\-foreground\fR and \fB\-background\fR options. The active state is
typically used when the pointer is over the checkbutton. In active state
-the checkbutton is displayed using the \fBactiveForeground\fR and
-\fBactiveBackground\fR options. Disabled state means that the checkbutton
+the checkbutton is displayed using the \fB\-activeforeground\fR and
+\fB\-activebackground\fR options. Disabled state means that the checkbutton
should be insensitive: the default bindings will refuse to activate
the widget and will ignore mouse button presses.
-In this state the \fBdisabledForeground\fR and
-\fBbackground\fR options determine how the checkbutton is displayed.
+In this state the \fB\-disabledforeground\fR and
+\fB\-background\fR options determine how the checkbutton is displayed.
.OP \-tristateimage tristateImage TristateImage
-.VS 8.5
-Specifies an image to display (in place of the \fBimage\fR option)
+Specifies an image to display (in place of the \fB\-image\fR option)
when the checkbutton is in tri-state mode.
-This option is ignored unless the \fBimage\fR option has been
+This option is ignored unless the \fB\-image\fR option has been
specified.
-.VE 8.5
.OP \-tristatevalue tristateValue Value
-.VS 8.5
-Specifies the value that causes the checkbutton to display the multi-value
+Specifies the value that causes the checkbutton to display the multi-value
selection, also known as the tri-state mode. Defaults to
.QW "" .
-.VE 8.5
.OP \-variable variable Variable
Specifies the name of a global variable to set to indicate whether
or not this button is selected. Defaults to the name of the
@@ -138,13 +134,13 @@ that displays a textual string, bitmap or image
and a square called an \fIindicator\fR.
If text is displayed, it must all be in a single font, but it
can occupy multiple lines on the screen (if it contains newlines
-or if wrapping occurs because of the \fBwrapLength\fR option) and
+or if wrapping occurs because of the \fB\-wraplength\fR option) and
one of the characters may optionally be underlined using the
-\fBunderline\fR option.
+\fB\-underline\fR option.
A checkbutton has
all of the behavior of a simple button, including the
following: it can display itself in either of three different
-ways, according to the \fBstate\fR option;
+ways, according to the \fB\-state\fR option;
it can be made to appear
raised, sunken, or flat; it can be made to flash; and it invokes
a Tcl command whenever mouse button 1 is clicked over the
@@ -155,17 +151,16 @@ If a checkbutton is selected then the indicator is normally
drawn with a selected appearance, and
a Tcl variable associated with the checkbutton is set to a particular
value (normally 1).
-.VS 8.5
The indicator is drawn with a check mark inside.
If the checkbutton is not selected, then the indicator is drawn with a
deselected appearance, and the associated variable is
set to a different value (typically 0).
-The indicator is drawn without a check mark inside. In the special case
-where the variable (if specified) has a value that matches the tristatevalue,
-the indicator is drawn with a tri-state appearance and is in the tri-state
-mode indicating mixed or multiple values. (This is used when the check
+The indicator is drawn without a check mark inside. In the special case
+where the variable (if specified) has a value that matches the tristatevalue,
+the indicator is drawn with a tri-state appearance and is in the tri-state
+mode indicating mixed or multiple values. (This is used when the check
box represents the state of multiple items.)
-The indicator is drawn in a platform dependent manner. Under Unix and
+The indicator is drawn in a platform dependent manner. Under Unix and
Windows, the background interior of the box is
.QW grayed .
Under Mac, the indicator is drawn with a dash mark inside.
@@ -190,7 +185,6 @@ changes to and from the button's
and
.QW tristate
values.
-.VE 8.5
.SH "WIDGET COMMAND"
.PP
The \fBcheckbutton\fR command creates a new Tcl command whose
@@ -270,7 +264,8 @@ invoked, if there is one).
.IP [3]
When a checkbutton has the input focus, the space key causes the checkbutton
to be invoked. Under Windows, there are additional key bindings; plus
-(+) and equal (=) select the button, and minus (\-) deselects the button.
+(\fB+\fR) and equal (\fB=\fR) select the button, and minus (\fB\-\fR)
+deselects the button.
.PP
If the checkbutton's state is \fBdisabled\fR then none of the above
actions occur: the checkbutton is completely non-responsive.
@@ -278,17 +273,21 @@ actions occur: the checkbutton is completely non-responsive.
The behavior of checkbuttons can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
.SH EXAMPLE
+.PP
This example shows a group of uncoupled checkbuttons.
.PP
.CS
- labelframe .lbl \-text "Steps:"
- \fBcheckbutton\fR .c1 \-text Lights \-variable lights
- \fBcheckbutton\fR .c2 \-text Cameras \-variable cameras
- \fBcheckbutton\fR .c3 \-text Action! \-variable action
- pack .c1 .c2 .c3 \-in .lbl
- pack .lbl
+labelframe .lbl \-text "Steps:"
+\fBcheckbutton\fR .c1 \-text Lights \-variable lights
+\fBcheckbutton\fR .c2 \-text Cameras \-variable cameras
+\fBcheckbutton\fR .c3 \-text Action! \-variable action
+pack .c1 .c2 .c3 \-in .lbl
+pack .lbl
.CE
.SH "SEE ALSO"
button(n), options(n), radiobutton(n), ttk::checkbutton(n)
.SH KEYWORDS
checkbutton, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/chooseColor.n b/doc/chooseColor.n
index 565934c..645b9c1 100644
--- a/doc/chooseColor.n
+++ b/doc/chooseColor.n
@@ -13,7 +13,6 @@ tk_chooseColor \- pops up a dialog box for the user to select a color.
.SH SYNOPSIS
\fBtk_chooseColor \fR?\fIoption value ...\fR?
.BE
-
.SH DESCRIPTION
.PP
The procedure \fBtk_chooseColor\fR pops up a dialog box for the
@@ -38,9 +37,12 @@ name of the color in a form acceptable to \fBTk_GetColor\fR. If the
user cancels the operation, both commands will return the empty
string.
.SH EXAMPLE
+.PP
.CS
button .b \-bg [tk_chooseColor \-initialcolor gray \-title "Choose color"]
.CE
-
.SH KEYWORDS
-color selection dialog
+color, color selection, dialog
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/chooseDirectory.n b/doc/chooseDirectory.n
index c380ccf..2d96825 100644
--- a/doc/chooseDirectory.n
+++ b/doc/chooseDirectory.n
@@ -38,6 +38,7 @@ turns the file dialog into a sheet attached to the parent window.
Specifies a string to display as the title of the dialog box. If this
option is not specified, then a default title will be displayed.
.SH EXAMPLE
+.PP
.CS
set dir [\fBtk_chooseDirectory\fR \e
\-initialdir ~ \-title "Choose a directory"]
@@ -47,8 +48,10 @@ if {$dir eq ""} {
label .l \-text "Selected $dir"
}
.CE
-
.SH "SEE ALSO"
tk_getOpenFile(n), tk_getSaveFile(n)
.SH KEYWORDS
directory, selection, dialog, platform-specific
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/clipboard.n b/doc/clipboard.n
index b689328..c987b38 100644
--- a/doc/clipboard.n
+++ b/doc/clipboard.n
@@ -14,7 +14,6 @@ clipboard \- Manipulate Tk clipboard
.SH SYNOPSIS
\fBclipboard \fIoption\fR ?\fIarg arg ...\fR?
.BE
-
.SH DESCRIPTION
.PP
This command provides a Tcl interface to the Tk clipboard,
@@ -28,15 +27,9 @@ appends should be completed before returning to the event loop.
The first argument to \fBclipboard\fR determines the format of the
rest of the arguments and the behavior of the command. The following
forms are currently supported:
-.PP
-.TP
-\fBclipboard clear\fR ?\fB\-displayof\fR \fIwindow\fR?
-Claims ownership of the clipboard on \fIwindow\fR's display and removes
-any previous contents. \fIWindow\fR defaults to
-.QW . .
-Returns an empty string.
.TP
\fBclipboard append\fR ?\fB\-displayof\fR \fIwindow\fR? ?\fB\-format\fR \fIformat\fR? ?\fB\-type\fR \fItype\fR? ?\fB\-\|\-\fR? \fIdata\fR
+.
Appends \fIdata\fR to the clipboard on \fIwindow\fR's
display in the form given by \fItype\fR with the representation given
by \fIformat\fR and claims ownership of the clipboard on \fIwindow\fR's
@@ -47,15 +40,15 @@ display.
(the desired
.QW target
for conversion, in ICCCM terminology), and
-should be an atom name such as STRING or FILE_NAME; see the
+should be an atom name such as \fBSTRING\fR or \fBFILE_NAME\fR; see the
Inter-Client Communication Conventions Manual for complete details.
-\fIType\fR defaults to STRING.
+\fIType\fR defaults to \fBSTRING\fR.
.PP
The \fIformat\fR argument specifies the representation that should be
used to transmit the selection to the requester (the second column of
-Table 2 of the ICCCM), and defaults to STRING. If \fIformat\fR is
-STRING, the selection is transmitted as 8-bit ASCII characters. If
-\fIformat\fR is ATOM, then the \fIdata\fR is
+Table 2 of the ICCCM), and defaults to \fBSTRING\fR. If \fIformat\fR is
+\fBSTRING\fR, the selection is transmitted as 8-bit ASCII characters. If
+\fIformat\fR is \fBATOM\fR, then the \fIdata\fR is
divided into fields separated by white space; each field is converted
to its atom value, and the 32-bit atom value is transmitted instead of
the atom name. For any other \fIformat\fR, \fIdata\fR is divided
@@ -69,8 +62,8 @@ boundaries. All items appended to the clipboard with the same
.PP
The \fIformat\fR argument is needed only for compatibility with
clipboard requesters that do not use Tk. If the Tk toolkit is being
-used to retrieve the CLIPBOARD selection then the value is converted back to
-a string at the requesting end, so \fIformat\fR is
+used to retrieve the \fBCLIPBOARD\fR selection then the value is
+converted back to a string at the requesting end, so \fIformat\fR is
irrelevant.
.PP
A \fB\-\|\-\fR argument may be specified to mark the end of options: the
@@ -79,21 +72,30 @@ This feature may be convenient if, for example, \fIdata\fR starts
with a \fB\-\fR.
.RE
.TP
+\fBclipboard clear\fR ?\fB\-displayof\fR \fIwindow\fR?
+.
+Claims ownership of the clipboard on \fIwindow\fR's display and removes
+any previous contents. \fIWindow\fR defaults to
+.QW . .
+Returns an empty string.
+.TP
\fBclipboard get\fR ?\fB\-displayof\fR \fIwindow\fR? ?\fB\-type\fR \fItype\fR?
+.
Retrieve data from the clipboard on \fIwindow\fR's display.
\fIWindow\fR defaults to
.QW . .
\fIType\fR specifies the form in which
-the data is to be returned and should be an atom name such as STRING
-or FILE_NAME. \fIType\fR defaults to STRING. This command is
+the data is to be returned and should be an atom name such as \fBSTRING\fR
+or \fBFILE_NAME\fR. \fIType\fR defaults to \fBSTRING\fR. This command is
equivalent to
-.QW "\fBselection get \-selection CLIPBOARD\fR" .
+.QW "\fBselection get\fR \fB\-selection CLIPBOARD\fR" .
.RS
.PP
Note that on modern X11 systems, the most useful type to retrieve for
transferred strings is not \fBSTRING\fR, but rather \fBUTF8_STRING\fR.
.RE
.SH EXAMPLES
+.PP
Get the current contents of the clipboard.
.CS
if {[catch {\fBclipboard get\fR} contents]} {
@@ -146,9 +148,10 @@ bind $c <<Paste>> {
}
}
.CE
-
.SH "SEE ALSO"
interp(n), selection(n)
-
.SH KEYWORDS
clear, format, clipboard, append, selection, type
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/colors.n b/doc/colors.n
index 4b8cda1..80567c3 100644
--- a/doc/colors.n
+++ b/doc/colors.n
@@ -3,6 +3,8 @@
'\" Copyright (c) 2003 ActiveState Corporation.
'\" Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net>
'\" Copyright (c) 2008 Donal K. Fellows
+'\"
+'\"
'\"
.so man.macros
.TH colors n 8.3 Tk "Tk Built-In Commands"
@@ -944,3 +946,6 @@ GrayText WindowText
options(n), Tk_GetColor(3)
.SH KEYWORDS
color, option
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/console.n b/doc/console.n
index 8e0691c..fa9463d 100644
--- a/doc/console.n
+++ b/doc/console.n
@@ -25,7 +25,7 @@ the Tk library. Except for TkAqua, this command is not available when
Tk is loaded into a tclsh interpreter with
.QW "\fBpackage require Tk\fR" ,
as a conventional terminal is expected to be present in that case.
-In TkAqua, this command is ony available when stdin is \fB/dev/null\fR
+In TkAqua, this command is only available when stdin is \fB/dev/null\fR
(as is the case e.g. when the application embedding Tk is started
from the Mac OS X Finder).
.PP
@@ -129,6 +129,7 @@ Most other behaviour is the same as a conventional text widget except
for the way that the \fI<<Cut>>\fR event is handled identically to the
\fI<<Copy>>\fR event.
.SH EXAMPLE
+.PP
Not all platforms have the \fBconsole\fR command, so debugging code
often has the following code fragment in it so output produced by
\fBputs\fR can be seen while during development:
@@ -139,3 +140,6 @@ catch {\fBconsole show\fR}
destroy(n), fconfigure(n), history(n), interp(n), puts(n), text(n), wm(n)
.SH KEYWORDS
console, interpreter, window, interactive, output channels
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/cursors.n b/doc/cursors.n
index 8bc2a8f..57b1399 100644
--- a/doc/cursors.n
+++ b/doc/cursors.n
@@ -135,12 +135,13 @@ On Mac OS X systems, the following cursors are mapped to native cursors:
.RS
.CS
arrow
+top_left_arrow
+left_ptr
cross
crosshair
+tcross
ibeam
none
-plus
-watch
xterm
.CE
And the following additional native cursors are available:
@@ -148,24 +149,43 @@ And the following additional native cursors are available:
copyarrow
aliasarrow
contextualmenuarrow
+movearrow
text
cross-hair
-closedhand
+hand
openhand
+closedhand
+fist
pointinghand
+resize
resizeleft
resizeright
resizeleftright
resizeup
resizedown
resizeupdown
+resizebottomleft
+resizetopleft
+resizebottomright
+resizetopright
notallowed
poof
+wait
countinguphand
countingdownhand
countingupanddownhand
spinning
+help
+bucket
+cancel
+eyedrop
+eyedrop-full
+zoom-in
+zoom-out
.CE
.RE
.SH KEYWORDS
cursor, option
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/destroy.n b/doc/destroy.n
index 93aedd5..ee56754 100644
--- a/doc/destroy.n
+++ b/doc/destroy.n
@@ -27,6 +27,7 @@ in destroying a window the command aborts without destroying the
remaining windows.
No error is returned if \fIwindow\fR does not exist.
.SH EXAMPLE
+.PP
Destroy all checkbuttons that are direct children of the given widget:
.CS
proc killCheckbuttonChildren {parent} {
@@ -37,6 +38,8 @@ proc killCheckbuttonChildren {parent} {
}
}
.CE
-
.SH KEYWORDS
application, destroy, window
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/dialog.n b/doc/dialog.n
index e72cbac..bd40321 100644
--- a/doc/dialog.n
+++ b/doc/dialog.n
@@ -14,7 +14,6 @@ tk_dialog \- Create modal dialog and wait for response
.SH SYNOPSIS
\fBtk_dialog \fIwindow title text bitmap default string string ...\fR
.BE
-
.SH DESCRIPTION
.PP
This procedure is part of the Tk script library.
@@ -31,7 +30,8 @@ Text to appear in the window manager's title bar for the dialog.
Message to appear in the top portion of the dialog box.
.TP
\fIbitmap\fR
-If non-empty, specifies a bitmap to display in the top portion of
+If non-empty, specifies a bitmap (in a form suitable for Tk_GetBitmap)
+to display in the top portion of
the dialog, to the left of the text.
If this is an empty string then no bitmap is displayed in the dialog.
.TP
@@ -59,13 +59,15 @@ While waiting for the user to respond, \fBtk_dialog\fR sets a local
grab. This prevents the user from interacting with the application
in any way except to invoke the dialog box.
.SH EXAMPLE
+.PP
.CS
set reply [\fBtk_dialog\fR .foo "The Title" "Do you want to say yes?" \e
questhead 0 Yes No "I'm not sure"]
.CE
-
.SH "SEE ALSO"
tk_messageBox(n)
-
.SH KEYWORDS
bitmap, dialog, modal
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/entry.n b/doc/entry.n
index 58c5d64..b115268 100644
--- a/doc/entry.n
+++ b/doc/entry.n
@@ -32,9 +32,9 @@ this option is the empty string, the normal background color is used.
Specifies the foreground color to use when the entry is disabled. If
this option is the empty string, the normal foreground color is used.
.OP "\-invalidcommand or \-invcmd" invalidCommand InvalidCommand
-Specifies a script to eval when \fBvalidateCommand\fR returns 0.
+Specifies a script to eval when \fB\-validatecommand\fR returns 0.
Setting it to {} disables this feature (the default). The best use
-of this option is to set it to \fIbell\fR. See \fBValidation\fR
+of this option is to set it to \fIbell\fR. See \fBVALIDATION\fR
below for more information.
.OP \-readonlybackground readonlyBackground ReadonlyBackground
Specifies the background color to use when the entry is readonly. If
@@ -64,15 +64,15 @@ be displayed in a different color, depending on the values of the
Specifies the mode in which validation should operate: \fBnone\fR,
\fBfocus\fR, \fBfocusin\fR, \fBfocusout\fR, \fBkey\fR, or \fBall\fR.
It defaults to \fBnone\fR. When you want validation, you must explicitly
-state which mode you wish to use. See \fBValidation\fR below for more.
+state which mode you wish to use. See \fBVALIDATION\fR below for more.
.OP "\-validatecommand or \-vcmd" validateCommand ValidateCommand
Specifies a script to eval when you want to validate the input into
the entry widget. Setting it to {} disables this feature (the default).
This command must return a valid Tcl boolean value. If it returns 0 (or
the valid Tcl boolean equivalent) then it means you reject the new edition
-and it will not occur and the \fBinvalidCommand\fR will be evaluated if it
+and it will not occur and the \fB\-invalidcommand\fR will be evaluated if it
is set. If it returns 1, then the new edition occurs.
-See \fBValidation\fR below for more information.
+See \fBVALIDATION\fR below for more information.
.OP \-width width Width
Specifies an integer value indicating the desired width of the entry window,
in average-size characters of the widget's font.
@@ -96,7 +96,7 @@ allows that string to be edited using widget commands described below, which
are typically bound to keystrokes and mouse actions.
When first created, an entry's string is empty.
A portion of the entry may be selected as described below.
-If an entry is exporting its selection (see the \fBexportSelection\fR
+If an entry is exporting its selection (see the \fB\-exportselection\fR
option), then it will observe the standard X11 protocols for handling the
selection; entry selections are available as type \fBSTRING\fR.
Entries also observe the standard Tk rules for dealing with the
@@ -108,31 +108,31 @@ Entries are capable of displaying strings that are too long to
fit entirely within the widget's window. In this case, only a
portion of the string will be displayed; commands described below
may be used to change the view in the window. Entries use
-the standard \fBxScrollCommand\fR mechanism for interacting with
-scrollbars (see the description of the \fBxScrollCommand\fR option
+the standard \fB\-xscrollcommand\fR mechanism for interacting with
+scrollbars (see the description of the \fB\-xscrollcommand\fR option
for details). They also support scanning, as described below.
.SH VALIDATION
.PP
-Validation works by setting the \fBvalidateCommand\fR
-option to a script which will be evaluated according to the \fBvalidate\fR
-option as follows:
+Validation works by setting the \fB\-validatecommand\fR option to a
+script (\fIvalidateCommand\fR) which will be evaluated according to
+the \fB\-validate\fR option as follows:
.PP
.IP \fBnone\fR 10
Default. This means no validation will occur.
.IP \fBfocus\fR 10
-\fBvalidateCommand\fR will be called when the entry receives or
+\fIvalidateCommand\fR will be called when the entry receives or
loses focus.
.IP \fBfocusin\fR 10
-\fBvalidateCommand\fR will be called when the entry receives focus.
+\fIvalidateCommand\fR will be called when the entry receives focus.
.IP \fBfocusout\fR 10
-\fBvalidateCommand\fR will be called when the entry loses focus.
+\fIvalidateCommand\fR will be called when the entry loses focus.
.IP \fBkey\fR 10
-\fBvalidateCommand\fR will be called when the entry is edited.
+\fIvalidateCommand\fR will be called when the entry is edited.
.IP \fBall\fR 10
-\fBvalidateCommand\fR will be called for all above conditions.
+\fIvalidateCommand\fR will be called for all above conditions.
.PP
-It is possible to perform percent substitutions on the \fBvalidateCommand\fR
-and \fBinvalidCommand\fR,
+It is possible to perform percent substitutions on the value of the
+\fB\-validatecommand\fR and \fB\-invalidcommand\fR options,
just as you would in a \fBbind\fR script. The following substitutions
are recognized:
.PP
@@ -157,32 +157,32 @@ The type of validation that triggered the callback
.IP \fB%W\fR 5
The name of the entry widget.
.PP
-In general, the \fBtextVariable\fR and \fBvalidateCommand\fR can be
+In general, the \fB\-textvariable\fR and \fB\-validatecommand\fR options can be
dangerous to mix. Any problems have been overcome so that using the
-\fBvalidateCommand\fR will not interfere with the traditional behavior of
-the entry widget. Using the \fBtextVariable\fR for read-only purposes will
+\fB\-validatecommand\fR will not interfere with the traditional behavior of
+the entry widget. Using the \fB\-textvariable\fR for read-only purposes will
never cause problems. The danger comes when you try set the
-\fBtextVariable\fR to something that the \fBvalidateCommand\fR would not
-accept, which causes \fBvalidate\fR to become \fInone\fR (the
-\fBinvalidCommand\fR will not be triggered). The same happens
-when an error occurs evaluating the \fBvalidateCommand\fR.
+\fB\-textvariable\fR to something that the \fB\-validatecommand\fR would not
+accept, which causes \fB\-validate\fR to become \fInone\fR (the
+\fB\-invalidcommand\fR will not be triggered). The same happens
+when an error occurs evaluating the \fB\-validatecommand\fR.
.PP
-Primarily, an error will occur when the \fBvalidateCommand\fR or
-\fBinvalidCommand\fR encounters an error in its script while evaluating or
-\fBvalidateCommand\fR does not return a valid Tcl boolean value. The
-\fBvalidate\fR option will also set itself to \fBnone\fR when you edit the
-entry widget from within either the \fBvalidateCommand\fR or the
-\fBinvalidCommand\fR. Such editions will override the one that was being
+Primarily, an error will occur when the \fB\-validatecommand\fR or
+\fB\-invalidcommand\fR encounters an error in its script while evaluating or
+\fB\-validatecommand\fR does not return a valid Tcl boolean value. The
+\fB\-validate\fR option will also set itself to \fBnone\fR when you edit the
+entry widget from within either the \fB\-validatecommand\fR or the
+\fB\-invalidcommand\fR. Such editions will override the one that was being
validated. If you wish to edit the entry widget (for example set it to {})
-during validation and still have the \fBvalidate\fR option set, you should
+during validation and still have the \fB\-validate\fR option set, you should
include the command
.CS
after idle {%W config \-validate %v}
.CE
-in the \fBvalidateCommand\fR or \fBinvalidCommand\fR (whichever one you
+in the \fB\-validatecommand\fR or \fB\-invalidcommand\fR (whichever one you
were editing the entry widget from). It is also recommended to not set an
-associated \fBtextVariable\fR during validation, as that can cause the
-entry widget to become out of sync with the \fBtextVariable\fR.
+associated \fB\-textvariable\fR during validation, as that can cause the
+entry widget to become out of sync with the \fB\-textvariable\fR.
.SH "WIDGET COMMAND"
.PP
The \fBentry\fR command creates a new Tcl command whose
@@ -369,9 +369,9 @@ Returns an empty string.
.RE
.TP
\fIpathName \fBvalidate\fR
-This command is used to force an evaluation of the \fBvalidateCommand\fR
-independent of the conditions specified by the \fBvalidate\fR option.
-This is done by temporarily setting the \fBvalidate\fR option to \fBall\fR.
+This command is used to force an evaluation of the \fB\-validatecommand\fR
+independent of the conditions specified by the \fB\-validate\fR option.
+This is done by temporarily setting the \fB\-validate\fR option to \fBall\fR.
It returns 0 or 1.
.TP
\fIpathName \fBxview \fIargs\fR
@@ -534,3 +534,6 @@ individual widgets or by redefining the class bindings.
ttk::entry(n)
.SH KEYWORDS
entry, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/event.n b/doc/event.n
index 69f336a..214e6b7 100644
--- a/doc/event.n
+++ b/doc/event.n
@@ -76,7 +76,7 @@ defined for the given virtual event; if the virtual event is
not defined then an empty string is returned.
.RS
.PP
-Note that virtual events that that are not bound to physical event
+Note that virtual events that are not bound to physical event
sequences are \fInot\fR returned by \fBevent info\fR.
.RE
.SH "EVENT FIELDS"
@@ -108,13 +108,11 @@ Corresponds to the \fB%b\fR substitution for binding scripts.
\fINumber\fR must be an integer; it specifies the \fIcount\fR field
for the event. Valid for \fBExpose\fR events.
Corresponds to the \fB%c\fR substitution for binding scripts.
-.VS 8.5
.TP
\fB\-data\fI string\fR
\fIString\fR may be any value; it specifies the \fIuser_data\fR field
for the event. Only valid for virtual events. Corresponds to the
\fB%d\fR substitution for virtual events in binding scripts.
-.VE 8.5
.TP
\fB\-delta\fI number\fR
\fINumber\fR must be an integer; it specifies the \fIdelta\fR field
@@ -308,6 +306,7 @@ Any options that are not specified when generating an event are filled
with the value 0, except for \fIserial\fR, which is filled with the
next X event serial number.
.SH "PREDEFINED VIRTUAL EVENTS"
+.PP
Tk defines the following virtual events for the purposes of
notification:
.TP
@@ -359,6 +358,26 @@ Copy the currently selected widget contents to the clipboard.
\fB<<Cut>>\fR
Move the currently selected widget contents to the clipboard.
.TP
+\fB<<LineEnd>>\fR
+.
+Move to the end of the line in the current widget while deselecting any
+selected contents.
+.TP
+\fB<<LineStart>>\fR
+.
+Move to the start of the line in the current widget while deselecting any
+selected contents.
+.TP
+\fB<<NextChar>>\fR
+.
+Move to the next item (i.e., visible character) in the current widget while
+deselecting any selected contents.
+.TP
+\fB<<NextWord>>\fR
+.
+Move to the next group of items (i.e., visible word) in the current widget
+while deselecting any selected contents.
+.TP
\fB<<Paste>>\fR
Replace the currently selected widget contents with the contents of
the clipboard.
@@ -367,32 +386,80 @@ the clipboard.
Insert the contents of the selection at the mouse location. (This
event has meaningful \fB%x\fR and \fB%y\fR substitutions).
.TP
+\fB<<PrevChar>>\fR
+.
+Move to the previous item (i.e., visible character) in the current widget
+while deselecting any selected contents.
+.TP
\fB<<PrevWindow>>\fR
Traverse to the previous window.
.TP
+\fB<<PrevWord>>\fR
+.
+Move to the previous group of items (i.e., visible word) in the current widget
+while deselecting any selected contents.
+.TP
\fB<<Redo>>\fR
Redo one undone action.
.TP
+\fB<<SelectLineEnd>>\fR
+.
+Move to the end of the line in the current widget while extending the range
+of selected contents.
+.TP
+\fB<<SelectLineStart>>\fR
+.
+Move to the start of the line in the current widget while extending the range
+of selected contents.
+.TP
+\fB<<SelectNextChar>>\fR
+.
+Move to the next item (i.e., visible character) in the current widget while
+extending the range of selected contents.
+.TP
+\fB<<SelectNextWord>>\fR
+.
+Move to the next group of items (i.e., visible word) in the current widget
+while extending the range of selected contents.
+.TP
+\fB<<SelectPrevChar>>\fR
+.
+Move to the previous item (i.e., visible character) in the current widget
+while extending the range of selected contents.
+.TP
+\fB<<SelectPrevWord>>\fR
+.
+Move to the previous group of items (i.e., visible word) in the current widget
+while extending the range of selected contents.
+.TP
\fB<<Undo>>\fR
Undo the last action.
-.SH "VIRTUAL EVENT EXAMPLES"
+.SH EXAMPLES
+.SS "MAPPING KEYS TO VIRTUAL EVENTS"
.PP
In order for a virtual event binding to trigger, two things must
happen. First, the virtual event must be defined with the
\fBevent add\fR command. Second, a binding must be created for
the virtual event with the \fBbind\fR command.
Consider the following virtual event definitions:
+.PP
.CS
-event add <<Paste>> <Control-y>
-event add <<Paste>> <Button-2>
-event add <<Save>> <Control-X><Control-S>
-event add <<Save>> <Shift-F12>
+\fBevent add\fR <<Paste>> <Control-y>
+\fBevent add\fR <<Paste>> <Button-2>
+\fBevent add\fR <<Save>> <Control-X><Control-S>
+\fBevent add\fR <<Save>> <Shift-F12>
+if {[tk windowingsystem] eq "aqua"} {
+ \fBevent add\fR <<Save>> <Command-s>
+}
.CE
+.PP
In the \fBbind\fR command, a virtual event can be bound like any other
builtin event type as follows:
+.PP
.CS
bind Entry <<Paste>> {%W insert [selection get]}
.CE
+.PP
The double angle brackets are used to specify that a virtual event is being
bound. If the user types Control-y or presses button 2, or if
a \fB<<Paste>>\fR virtual event is synthesized with \fBevent generate\fR,
@@ -401,11 +468,13 @@ then the \fB<<Paste>>\fR binding will be invoked.
If a virtual binding has the exact same sequence as a separate
physical binding, then the physical binding will take precedence.
Consider the following example:
+.PP
.CS
-event add <<Paste>> <Control-y> <Meta-Control-y>
+\fBevent add\fR <<Paste>> <Control-y> <Meta-Control-y>
bind Entry <Control-y> {puts Control-y}
bind Entry <<Paste>> {puts Paste}
.CE
+.PP
When the user types Control-y the \fB<Control-y>\fR binding
will be invoked, because a physical event is considered
more specific than a virtual event, all other things being equal.
@@ -423,18 +492,41 @@ ungeneratable.
When a definition of a virtual event changes at run time, all windows
will respond immediately to the new definition.
Starting from the preceding example, if the following code is executed:
+.PP
.CS
-bind <Entry> <Control-y> {}
-event add <<Paste>> <Key-F6>
+bind Entry <Control-y> {}
+\fBevent add\fR <<Paste>> <Key-F6>
.CE
+.PP
the behavior will change such in two ways. First, the shadowed
\fB<<Paste>>\fR binding will emerge.
Typing Control-y will no longer invoke the \fB<Control-y>\fR binding,
but instead invoke the virtual event \fB<<Paste>>\fR. Second,
pressing the F6 key will now also invoke the \fB<<Paste>>\fR binding.
-
+.SS "MOVING THE MOUSE POINTER"
+.PP
+Sometimes it is useful to be able to really move the mouse pointer. For
+example, if you have some software that is capable of demonstrating directly
+to the user how to use the program. To do this, you need to
+.QW warp
+the mouse around by using \fBevent generate\fR, like this:
+.PP
+.CS
+for {set xy 0} {$xy < 200} {incr xy} {
+ \fBevent generate\fR . <Motion> -x $xy -y $xy -warp 1
+ update
+ after 50
+}
+.CE
+.PP
+Note that it is usually considered bad style to move the mouse pointer for the
+user because it removes control from them. Therefore this technique should be
+used with caution. Also note that it is not guaranteed to function on all
+platforms.
.SH "SEE ALSO"
bind(n)
-
.SH KEYWORDS
event, binding, define, handle, virtual event
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/focus.n b/doc/focus.n
index f37e1cd..576db30 100644
--- a/doc/focus.n
+++ b/doc/focus.n
@@ -18,7 +18,6 @@ focus \- Manage the input focus
\fBfocus \fIoption\fR ?\fIarg arg ...\fR?
.fi
.BE
-
.SH DESCRIPTION
.PP
The \fBfocus\fR command is used to manage the Tk input focus.
@@ -106,6 +105,7 @@ number of problems that would occur if the X focus were actually moved;
the fact that the X focus is on the top-level is invisible unless
you use C code to query the X server directly.
.SH "EXAMPLE"
+.PP
To make a window that only participates in the focus traversal ring
when a variable is set, add the following bindings to the widgets
\fIbefore\fR and \fIafter\fR it in that focus ring:
@@ -130,6 +130,8 @@ bind .after <Shift\-Tab> {
}
\fBfocus\fR .before
.CE
-
.SH KEYWORDS
events, focus, keyboard, top-level, window manager
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/focusNext.n b/doc/focusNext.n
index ede496f..cef5ce2 100644
--- a/doc/focusNext.n
+++ b/doc/focusNext.n
@@ -18,7 +18,6 @@ tk_focusNext, tk_focusPrev, tk_focusFollowsMouse \- Utility procedures for manag
.sp
\fBtk_focusFollowsMouse\fR
.BE
-
.SH DESCRIPTION
.PP
\fBtk_focusNext\fR is a utility procedure used for keyboard traversal.
@@ -54,6 +53,8 @@ Note: at present there is no built-in support for returning the
application to an explicit focus model; to do this you will have
to write a script that deletes the bindings created by
\fBtk_focusFollowsMouse\fR.
-
.SH KEYWORDS
focus, keyboard traversal, top-level
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/font.n b/doc/font.n
index 124fc43..6b9295d 100644
--- a/doc/font.n
+++ b/doc/font.n
@@ -26,7 +26,7 @@ first argument. The following forms are currently supported:
Returns information about the actual attributes that are obtained when
\fIfont\fR is used on \fIwindow\fR's display; the actual attributes obtained
may differ from the attributes requested due to platform-dependent
-limitations, such as the availability of font families and pointsizes.
+limitations, such as the availability of font families and point sizes.
\fIfont\fR is a font description; see \fBFONT DESCRIPTIONS\fR below. If the
\fIwindow\fR argument is omitted, it defaults to the main window. If
\fIoption\fR is specified, returns the value of that attribute; if it is
@@ -50,6 +50,14 @@ then the command modifies the given named font to have the given values; in
this case, all widgets using that font will redisplay themselves using the
new attributes for the font. See \fBFONT OPTIONS\fR below for a list of the
possible attributes.
+.RS
+.PP
+Note that on Aqua/Mac OS X, the system fonts (see
+\fBPLATFORM SPECIFIC FONTS\fR below) may not be actually altered because they
+are implemented by the system theme. To achieve the effect of modification,
+use \fBfont actual\fR to get their configuration and \fBfont create\fR to
+synthesize a copy of the font which can be modified.
+.RE
.TP
\fBfont create\fR ?\fIfontname\fR? ?\fIoption value ...\fR?
.
@@ -102,7 +110,7 @@ below for a list of the possible metrics.
.TP
\fBfont names\fR
The return value is a list of all the named fonts that are currently defined.
-.SH "FONT DESCRIPTION"
+.SH "FONT DESCRIPTIONS"
.PP
The following formats are accepted as a font description anywhere
\fIfont\fR is specified as an argument above; these same forms are also
@@ -123,7 +131,7 @@ The platform-specific name of a font, interpreted by the graphics server.
This also includes, under X, an XLFD (see [4]) for which a single
.QW \fB*\fR
character was used to elide more than one field in the middle of the
-name. See \fBPLATFORM-SPECIFIC\fR issues for a list of the system fonts.
+name. See \fBPLATFORM SPECIFIC FONTS\fR for a list of the system fonts.
.TP
[3] \fIfamily \fR?\fIsize\fR? ?\fIstyle\fR? ?\fIstyle ...\fR?
.
@@ -181,7 +189,7 @@ a garbage value); in that case, some system-dependent default font is
chosen. If the font description does not match any of the above patterns,
an error is generated.
.SH "FONT METRICS"
-.
+.PP
The following options are used by the \fBfont metrics\fR command to query
font-specific data determined when the font was created. These properties are
for the whole font itself and not for individual characters drawn in that
@@ -223,6 +231,7 @@ individual characters have different widths. The widths of control
characters, tab characters, and other non-printing characters are not
included when calculating this value.
.SH "FONT OPTIONS"
+.PP
The following options are supported on all platforms, and are used when
constructing a named font or when specifying a font using style [5] as
above:
@@ -286,7 +295,7 @@ The value is a boolean flag that specifies whether a horizontal line should
be drawn through the middle of characters in this font. The default value
for overstrike is \fBfalse\fR.
.SH "STANDARD FONTS"
-.LP
+.PP
The following named fonts are supported on all systems, and default to values
that match appropriate system defaults.
.TP
@@ -329,7 +338,7 @@ This font should be used for tooltip windows (transient information windows).
It is \fInot\fR advised to change these fonts, as they may be modified by Tk
itself in response to system changes. Instead, make a copy of the font and
modify that.
-.SH "PLATFORM-SPECIFIC FONTS"
+.SH "PLATFORM SPECIFIC FONTS"
.PP
The following system fonts are supported:
.TP
@@ -373,6 +382,7 @@ theme fonts:
.DE
.RE
.SH EXAMPLE
+.PP
Fill a text widget with lots of font demonstrators, one for every font
family installed on your system:
.CS
@@ -390,9 +400,10 @@ foreach family [lsort \-dictionary [\fBfont families\fR]] {
}
}
.CE
-
.SH "SEE ALSO"
options(n)
-
.SH KEYWORDS
font
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/fontchooser.n b/doc/fontchooser.n
new file mode 100644
index 0000000..65c3128
--- /dev/null
+++ b/doc/fontchooser.n
@@ -0,0 +1,181 @@
+'\"
+'\" Copyright (c) 2008 Daniel A. Steffen <das@users.sourceforge.net>
+'\"
+'\" See the file "license.terms" for information on usage and redistribution
+'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+'\"
+.so man.macros
+.TH fontchooser n "" Tk "Tk Built-In Commands"
+.BS
+'\" Note: do not modify the .SH NAME line immediately below!
+.SH NAME
+fontchooser \- control font selection dialog
+.SH SYNOPSIS
+\fBtk fontchooser\fR \fBconfigure\fR ?\fI\-option value \-option value ...\fR?
+.sp
+\fBtk fontchooser\fR \fBshow\fR
+.sp
+\fBtk fontchooser\fR \fBhide\fR
+.BE
+.SH DESCRIPTION
+.PP
+The \fBtk fontchooser\fR command controls the Tk font selection dialog. It uses
+the native platform font selection dialog where available, or a dialog
+implemented in Tcl otherwise.
+.PP
+Unlike most of the other Tk dialog commands, \fBtk fontchooser\fR does not
+return an immediate result, as on some platforms (Mac OS X) the standard font
+dialog is modeless while on others (Windows) it is modal. To accommodate this
+difference, all user interaction with the dialog will be communicated to the
+caller via callbacks or virtual events.
+.PP
+The \fBtk fontchooser\fR command can have one of the following forms:
+.TP
+\fBtk fontchooser\fR \fBconfigure \fR?\fI\-option value \-option value ...\fR?
+.
+Set or query one or more of the configurations options below (analogous to Tk
+widget configuration).
+.TP
+\fBtk fontchooser\fR \fBshow\fR
+.
+Show the font selection dialog. Depending on the platform, may return
+immediately or only once the dialog has been withdrawn.
+.TP
+\fBtk fontchooser\fR \fBhide\fR
+.
+Hide the font selection dialog if it is visible and cause any pending
+\fBtk fontchooser\fR \fBshow\fR command to return.
+.PP
+.SH "CONFIGURATION OPTIONS"
+.TP
+\fB\-parent\fR
+Specifies/returns the logical parent window of the font selection dialog
+(similar to the \fB\-parent\fR option to other dialogs). The font selection
+dialog is hidden if it is visible when the parent window is destroyed.
+.TP
+\fB\-title\fR
+Specifies/returns the title of the dialog. Has no effect on platforms where the
+font selection dialog does not support titles.
+.TP
+\fB\-font\fR
+Specifies/returns the font that is currently selected in the dialog if it is
+visible, or that will be initially selected when the dialog is shown (if
+supported by the platform). Can be set to the empty string to indicate that no
+font should be selected. Fonts can be specified in any form given by the "FONT
+DESCRIPTION" section in the \fBfont\fR manual page.
+.TP
+\fB\-command\fR
+Specifies/returns the command prefix to be called when a font selection has
+been made by the user. The command prefix is evaluated at the global level
+after having the specification of the selected font appended. On platforms
+where the font selection dialog offers the user control of further font
+attributes (such as color), additional key/value pairs may be appended before
+evaluation. Can be set to the empty string to indicate that no callback should
+be invoked. Fonts are specified by a list of form [3] of the "FONT DESCRIPTION"
+section in the \fBfont\fR manual page (i.e. a list of the form
+\fI{family size style ?style ...?}\fR).
+.TP
+\fB\-visible\fR
+Read-only option that returns a boolean indicating whether the font selection
+dialog is currently visible. Attempting to set this option results in an error.
+
+.PP
+.SH "VIRTUAL EVENTS"
+.TP
+\fB<<TkFontchooserVisibility>>\fR
+Sent to the dialog parent whenever the visibility of the font selection dialog
+changes, both as a result of user action (e.g. disposing of the dialog via
+OK/Cancel button or close box) and of the \fBtk fontchooser\fR
+\fBshow\fR/\fBhide\fR commands being called. Binding scripts can determine the
+current visibility of the dialog by querying the \fB\-visible\fR configuration
+option.
+.TP
+\fB<<TkFontchooserFontChanged>>\fR
+Sent to the dialog parent whenever the font selection dialog is visible and the
+selected font changes, both as a result of user action and of the \fB\-font\fR
+configuration option being set. Binding scripts can determine the currently
+selected font by querying the \fB\-font\fR configuration option.
+.PP
+.SH NOTES
+.PP
+Callers should not expect a result from \fBtk fontchooser\fR \fBshow\fR and may
+not assume that the dialog has been withdrawn or closed when the command
+returns. All user interaction with the dialog is communicated to the caller via
+the \fB\-command\fR callback and the \fB<<TkFontchooser*>>\fR virtual events.
+It is implementation dependent which exact user actions result in the callback
+being called resp. the virtual events being sent. Where an Apply or OK button
+is present in the dialog, that button will trigger the \fB\-command\fR callback
+and \fB<<TkFontchooserFontChanged>>\fR virtual event. On some implementations
+other user actions may also have that effect; on Mac OS X for instance, the
+standard font selection dialog immediately reflects all user choices to the
+caller.
+.PP
+In the presence of multiple widgets intended to be influenced by the font
+selection dialog, care needs to be taken to correctly handle focus changes: the
+font selected in the dialog should always match the current font of the widget
+with the focus, and the \fB\-command\fR callback should only act on the widget
+with the focus. The recommended practice is to set font dialog \fB\-font\fR and
+\fB\-command\fR configuration options in per\-widget \fB<FocusIn>\fR handlers
+(and if necessary to unset them \- i.e. set to the empty string \- in
+corresponding \fB<FocusOut>\fR handlers). This is particularly important for
+implementers of library code using the font selection dialog, to avoid
+conflicting with application code that may also want to use the dialog.
+.PP
+Because the font selection dialog is application-global, in the presence of
+multiple interpreters calling \fBtk fontchooser\fR, only the \fB\-command\fR
+callback set by the interpreter that most recently called \fBtk fontchooser\fR
+\fBconfigure\fR or \fBtk fontchooser\fR \fBshow\fR will be invoked in response
+to user action and only the \fB\-parent\fR set by that interpreter will receive
+\fB<<TkFontchooser*>>\fR virtual events.
+.PP
+The font dialog implementation may only store (and return) \fBfont\fR
+\fBactual\fR data as the value of the \fB\-font\fR configuration option. This
+can be an issue when \fB\-font\fR is set to a named font, if that font is
+subsequently changed, the font dialog \fB\-font\fR option needs to be set again
+to ensure its selected font matches the new value of the named font.
+.PP
+.SH EXAMPLE
+.PP
+.CS
+proc fontchooserDemo {} {
+ wm title . "Font Chooser Demo"
+ \fBtk fontchooser\fR \fBconfigure\fR \-parent .
+ button .b \-command fontchooserToggle \-takefocus 0
+ fontchooserVisibility .b
+ bind . \fB<<TkFontchooserVisibility>>\fR \\
+ [list fontchooserVisibility .b]
+ foreach w {.t1 .t2} {
+ text $w \-width 20 \-height 4 \-borderwidth 1 \-relief solid
+ bind $w <FocusIn> [list fontchooserFocus $w]
+ $w insert end "Text Widget $w"
+ }
+ .t1 configure \-font {Courier 14}
+ .t2 configure \-font {Times 16}
+ pack .b .t1 .t2; focus .t1
+}
+proc fontchooserToggle {} {
+ \fBtk fontchooser\fR [expr {
+ [\fBtk fontchooser\fR \fBconfigure\fR \-visible] ?
+ "\fBhide\fR" : "\fBshow\fR"}]
+}
+proc fontchooserVisibility {w} {
+ $w configure \-text [expr {
+ [\fBtk fontchooser\fR \fBconfigure\fR \-visible] ?
+ "Hide Font Dialog" : "Show Font Dialog"}]
+}
+proc fontchooserFocus {w} {
+ \fBtk fontchooser\fR \fBconfigure\fR \-font [$w cget \-font] \\
+ \-command [list fontchooserFontSelection $w]
+}
+proc fontchooserFontSelection {w font args} {
+ $w configure \-font [font actual $font]
+}
+fontchooserDemo
+.CE
+.SH "SEE ALSO"
+font(n), tk(n)
+.SH KEYWORDS
+dialog, font, font selection, font chooser, font panel
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/frame.n b/doc/frame.n
index 208e414..6bf4a1b 100644
--- a/doc/frame.n
+++ b/doc/frame.n
@@ -20,7 +20,7 @@ frame \- Create and manipulate frame widgets
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-background background Background
-This option is the same as the standard \fBbackground\fR option
+This option is the same as the standard \fB\-background\fR option
except that its value may also be specified as an empty string.
In this case, the widget will display no background or border, and
no colors will be consumed from its colormap for its background
@@ -30,7 +30,7 @@ Specifies a class for the window.
This class will be used when querying the option database for
the window's other options, and it will also be used later for
other purposes such as bindings.
-The \fBclass\fR option may not be changed with the \fBconfigure\fR
+The \fB\-class\fR option may not be changed with the \fBconfigure\fR
widget command.
.OP \-colormap colormap Colormap
Specifies a colormap to use for the window.
@@ -39,7 +39,7 @@ created for the window and its children, or the name of another
window (which must be on the same screen and have the same visual
as \fIpathName\fR), in which case the new window will use the colormap
from the specified window.
-If the \fBcolormap\fR option is not specified, the new window
+If the \fB\-colormap\fR option is not specified, the new window
uses the same colormap as its parent.
This option may not be changed with the \fBconfigure\fR
widget command.
@@ -52,7 +52,7 @@ things like geometry requests. The window should not have any
children of its own in this application.
This option may not be changed with the \fBconfigure\fR
widget command.
-Note that \fB-borderwidth\fR, \fB-padx\fR and \fB-pady\fR are ignored when
+Note that \fB\-borderwidth\fR, \fB\-padx\fR and \fB\-pady\fR are ignored when
configured as a container since a container has no border.
.OP \-height height Height
Specifies the desired height for the window in any of the forms
@@ -67,7 +67,7 @@ Specifies visual information for the new window in any of the
forms accepted by \fBTk_GetVisual\fR.
If this option is not specified, the new window will use the same
visual as its parent.
-The \fBvisual\fR option may not be modified with the \fBconfigure\fR
+The \fB\-visual\fR option may not be modified with the \fBconfigure\fR
widget command.
.OP \-width width Width
Specifies the desired width for the window in any of the forms
@@ -134,3 +134,6 @@ frames are not intended to be interactive.
labelframe(n), toplevel(n), ttk::frame(n)
.SH KEYWORDS
frame, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/getOpenFile.n b/doc/getOpenFile.n
index 8162078..8274259 100644
--- a/doc/getOpenFile.n
+++ b/doc/getOpenFile.n
@@ -42,6 +42,7 @@ confirmation dialog be presented to the user. A false value requests
that the overwrite take place without confirmation. Default value is true.
.TP
\fB\-defaultextension\fR \fIextension\fR
+.
Specifies a string that will be appended to the filename if the user
enters a filename without an extension. The default value is the empty
string, which means no extension will be appended to the filename in
@@ -51,6 +52,7 @@ and the UNIX implementation guesses reasonable values for this from
the \fB\-filetypes\fR option when this is not supplied.
.TP
\fB\-filetypes\fR \fIfilePatternList\fR
+.
If a \fBFile types\fR listbox exists in the file dialog on the particular
platform, this option gives the \fIfiletype\fRs in this listbox. When
the user choose a filetype in the listbox, only the files of that type
@@ -61,6 +63,7 @@ types. See the section \fBSPECIFYING FILE PATTERNS\fR below for a
discussion on the contents of \fIfilePatternList\fR.
.TP
\fB\-initialdir\fR \fIdirectory\fR
+.
Specifies that the files in \fIdirectory\fR should be displayed
when the dialog pops up. If this parameter is not specified, then
the files in the current working directory are displayed. If the
@@ -68,25 +71,31 @@ parameter specifies a relative path, the return value will convert the
relative path to an absolute path.
.TP
\fB\-initialfile\fR \fIfilename\fR
+.
Specifies a filename to be displayed in the dialog when it pops up.
.TP
\fB\-message\fR \fIstring\fR
+.
Specifies a message to include in the client area of the dialog.
This is only available on Mac OS X.
.TP
\fB\-multiple\fR \fIboolean\fR
+.
Allows the user to choose multiple files from the Open dialog.
.TP
\fB\-parent\fR \fIwindow\fR
+.
Makes \fIwindow\fR the logical parent of the file dialog. The file
dialog is displayed on top of its parent window. On Mac OS X, this
turns the file dialog into a sheet attached to the parent window.
.TP
\fB\-title\fR \fItitleString\fR
+.
Specifies a string to display as the title of the dialog box. If this
option is not specified, then a default title is displayed.
.TP
\fB\-typevariable\fR \fIvariableName\fR
+.
The global variable \fIvariableName\fR is used to preselect which filter is
used from \fIfilterList\fR when the dialog box is opened and is
updated when the dialog box is closed, to the last selected
@@ -163,6 +172,7 @@ Extensions without a full stop character (e.g.
.QW ~ )
are allowed but may not work on all platforms.
.SH EXAMPLE
+.PP
.CS
set types {
{{Text Files} {.txt} }
@@ -172,9 +182,9 @@ set types {
{{GIF Files} {} GIFF}
{{All Files} * }
}
-set filename [tk_getOpenFile \-filetypes $types]
+set filename [\fBtk_getOpenFile\fR \-filetypes $types]
-if {$filename != ""} {
+if {$filename ne ""} {
# Open the file ...
}
.CE
@@ -182,3 +192,6 @@ if {$filename != ""} {
tk_chooseDirectory
.SH KEYWORDS
file selection dialog
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/grab.n b/doc/grab.n
index 2f7e2f1..1b4857e 100644
--- a/doc/grab.n
+++ b/doc/grab.n
@@ -16,7 +16,6 @@ grab \- Confine pointer and keyboard events to a window sub-tree
.sp
\fBgrab \fIoption \fR?\fIarg arg \fR...?
.BE
-
.SH DESCRIPTION
.PP
This command implements simple pointer and keyboard grabs for Tk.
@@ -102,6 +101,7 @@ Returns \fBnone\fR if no grab is currently set on \fIwindow\fR,
\fBlocal\fR if a local grab is set on \fIwindow\fR, and
\fBglobal\fR if a global grab is set.
.SH WARNING
+.PP
It is very easy to use global grabs to render a display completely
unusable (e.g. by setting a grab on a widget which does not respond to
events and not providing any mechanism for releasing the grab). Take
@@ -121,6 +121,7 @@ only one of those applications can have a local grab for a given
display at any given time. If the applications are in different
processes, this restriction does not exist.
.SH EXAMPLE
+.PP
Set a grab so that only one button may be clicked out of a group. The
other buttons are unresponsive to the mouse until the middle button is
clicked.
@@ -130,6 +131,10 @@ pack [button .b2 \-text "Click me! #2" \-command {destroy .b2}]
pack [button .b3 \-text "Click me! #3" \-command {destroy .b3}]
\fBgrab\fR .b2
.CE
-
+.SH "SEE ALSO"
+busy(n)
.SH KEYWORDS
grab, keyboard events, pointer events, window
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/grid.n b/doc/grid.n
index 5c1c3ba..aa949c5 100644
--- a/doc/grid.n
+++ b/doc/grid.n
@@ -22,44 +22,44 @@ The \fBgrid\fR command can have any of several forms, depending
on the \fIoption\fR argument:
.TP
\fBgrid \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
+.
If the first argument to \fBgrid\fR is suitable as the first slave
argument to \fBgrid configure\fR, either a window name (any value
-starting with \fB.\fR) or one of the characters \fBx\fR or \fB^\fR
+starting with \fB.\fR) or one of the characters \fBx\fR or \fB^\fR
(see the \fBRELATIVE PLACEMENT\fR section below), then the command is
processed in the same way as \fBgrid configure\fR.
-.VS 8.5
.TP
\fBgrid anchor \fImaster\fR ?\fIanchor\fR?
+.
The anchor value controls how to place the grid within the master
when no row/column has any weight. See \fBTHE GRID ALGORITHM\fR below
for further details. The default \fIanchor\fR is \fInw\fR.
-.VE 8.5
.TP
\fBgrid bbox \fImaster\fR ?\fIcolumn row\fR? ?\fIcolumn2 row2\fR?
-With no arguments,
+.
+With no arguments,
the bounding box (in pixels) of the grid is returned.
The return value consists of 4 integers. The first two are the pixel
offset from the master window (x then y) of the top-left corner of the
grid, and the second two integers are the width and height of the grid,
-also in pixels. If a single \fIcolumn\fR and \fIrow\fR is specified on
+also in pixels. If a single \fIcolumn\fR and \fIrow\fR is specified on
the command line, then the bounding box for that cell is returned, where the
top left cell is numbered from zero. If both \fIcolumn\fR and \fIrow\fR
arguments are specified, then the bounding box spanning the rows and columns
indicated is returned.
.TP
\fBgrid columnconfigure \fImaster index \fR?\fI\-option value...\fR?
-Query or set the column properties of the \fIindex\fR column of the
+.
+Query or set the column properties of the \fIindex\fR column of the
geometry master, \fImaster\fR.
The valid options are \fB\-minsize\fR, \fB\-weight\fR, \fB\-uniform\fR
and \fB\-pad\fR.
-If one or more options are provided, then \fIindex\fR may be given as
+If one or more options are provided, then \fIindex\fR may be given as
a list of column indices to which the configuration options will operate on.
-.VS 8.5
Indices may be integers, window names or the keyword \fIall\fR. For \fIall\fR
the options apply to all columns currently occupied be slave windows. For
a window name, that window must be a slave of this master and the options
apply to all columns currently occupied be the slave.
-.VE 8.5
The \fB\-minsize\fR option sets the minimum size, in screen units,
that will be permitted for this column.
The \fB\-weight\fR option (an integer value)
@@ -86,10 +86,11 @@ are returned in a list of
pairs.
.TP
\fBgrid configure \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR?
+.
The arguments consist of the names of one or more slave windows
followed by pairs of arguments that specify how
to manage the slaves.
-The characters \fB\-\fR, \fBx\fR and \fB^\fR,
+The characters \fB\-\fR, \fBx\fR and \fB^\fR,
can be specified instead of a window name to alter the default
location of a \fIslave\fR, as described in the \fBRELATIVE PLACEMENT\fR
section, below.
@@ -97,6 +98,7 @@ The following options are supported:
.RS
.TP
\fB\-column \fIn\fR
+.
Insert the slave so that it occupies the \fIn\fRth column in the grid.
Column numbers start with 0. If this option is not supplied, then the
slave is arranged just to the right of previous slave specified on this
@@ -108,17 +110,20 @@ is incremented by one. Thus the \fBx\fR represents a blank column
for this row in the grid.
.TP
\fB\-columnspan \fIn\fR
+.
Insert the slave so that it occupies \fIn\fR columns in the grid.
The default is one column, unless the window name is followed by a
\fB\-\fR, in which case the columnspan is incremented once for each immediately
following \fB\-\fR.
.TP
\fB\-in \fIother\fR
+.
Insert the slave(s) in the master
window given by \fIother\fR. The default is the first slave's
parent window.
.TP
\fB\-ipadx \fIamount\fR
+.
The \fIamount\fR specifies how much horizontal internal padding to
leave on each side of the slave(s). This is space is added
inside the slave(s) border.
@@ -126,12 +131,14 @@ The \fIamount\fR must be a valid screen distance, such as \fB2\fR or \fB.5c\fR.
It defaults to 0.
.TP
\fB\-ipady \fIamount\fR
+.
The \fIamount\fR specifies how much vertical internal padding to
leave on the top and bottom of the slave(s).
This space is added inside the slave(s) border.
The \fIamount\fR defaults to 0.
.TP
\fB\-padx \fIamount\fR
+.
The \fIamount\fR specifies how much horizontal external padding to
leave on each side of the slave(s), in screen units.
\fIAmount\fR may be a list
@@ -140,6 +147,7 @@ The \fIamount\fR defaults to 0.
This space is added outside the slave(s) border.
.TP
\fB\-pady \fIamount\fR
+.
The \fIamount\fR specifies how much vertical external padding to
leave on the top and bottom of the slave(s), in screen units.
\fIAmount\fR may be a list
@@ -148,12 +156,14 @@ The \fIamount\fR defaults to 0.
This space is added outside the slave(s) border.
.TP
\fB\-row \fIn\fR
+.
Insert the slave so that it occupies the \fIn\fRth row in the grid.
Row numbers start with 0. If this option is not supplied, then the
slave is arranged on the same row as the previous slave specified on this
call to \fBgrid\fR, or the first unoccupied row if this is the first slave.
.TP
\fB\-rowspan \fIn\fR
+.
Insert the slave so that it occupies \fIn\fR rows in the grid.
The default is one row. If the next \fBgrid\fR command contains
\fB^\fR characters instead of \fIslaves\fR that line up with the columns
@@ -161,6 +171,7 @@ of this \fIslave\fR, then the \fBrowspan\fR of this \fIslave\fR is
extended by one.
.TP
\fB\-sticky \fIstyle\fR
+.
If a slave's cell is larger than its requested dimensions, this
option may be used to position (or stretch) the slave within its cell.
\fIStyle\fR is a string that contains zero or more of the characters
@@ -171,7 +182,7 @@ east, or west) that the slave will
.QW stick
to. If both \fBn\fR and \fBs\fR (or \fBe\fR and \fBw\fR) are
specified, the slave will be stretched to fill the entire
-height (or width) of its cavity. The \fBsticky\fR option subsumes the
+height (or width) of its cavity. The \fB\-sticky\fR option subsumes the
combination of \fB\-anchor\fR and \fB\-fill\fR that is used by \fBpack\fR.
The default is
.QW "" ,
@@ -183,6 +194,7 @@ than receiving default values.
.RE
.TP
\fBgrid forget \fIslave \fR?\fIslave ...\fR?
+.
Removes each of the \fIslave\fRs from grid for its
master and unmaps their windows.
The slaves will no longer be managed by the grid geometry manager.
@@ -191,6 +203,7 @@ slave is managed once more by the grid geometry manager, the initial
default settings are used.
.TP
\fBgrid info \fIslave\fR
+.
Returns a list whose elements are the current configuration state of
the slave given by \fIslave\fR in the same option-value form that
might be specified to \fBgrid configure\fR.
@@ -199,12 +212,14 @@ The first two elements of the list are
where \fImaster\fR is the slave's master.
.TP
\fBgrid location \fImaster x y\fR
-Given \fIx\fR and \fIy\fR values in screen units relative to the master window,
+.
+Given \fIx\fR and \fIy\fR values in screen units relative to the master window,
the column and row number at that \fIx\fR and \fIy\fR location is returned.
For locations that are above or to the left of the grid, \fB\-1\fR is
returned.
.TP
\fBgrid propagate \fImaster\fR ?\fIboolean\fR?
+.
If \fIboolean\fR has a true boolean value such as \fB1\fR or \fBon\fR
then propagation is enabled for \fImaster\fR, which must be a window
name (see \fBGEOMETRY PROPAGATION\fR below).
@@ -217,18 +232,17 @@ for \fImaster\fR.
Propagation is enabled by default.
.TP
\fBgrid rowconfigure \fImaster index \fR?\fI\-option value...\fR?
-Query or set the row properties of the \fIindex\fR row of the
+.
+Query or set the row properties of the \fIindex\fR row of the
geometry master, \fImaster\fR.
The valid options are \fB\-minsize\fR, \fB\-weight\fR, \fB\-uniform\fR
and \fB\-pad\fR.
-If one or more options are provided, then \fIindex\fR may be given as
+If one or more options are provided, then \fIindex\fR may be given as
a list of row indices to which the configuration options will operate on.
-.VS 8.5
Indices may be integers, window names or the keyword \fIall\fR. For \fIall\fR
the options apply to all rows currently occupied be slave windows. For
a window name, that window must be a slave of this master and the options
apply to all rows currently occupied be the slave.
-.VE 8.5
The \fB\-minsize\fR option sets the minimum size, in screen units,
that will be permitted for this row.
The \fB\-weight\fR option (an integer value)
@@ -255,6 +269,7 @@ are returned in a list of
pairs.
.TP
\fBgrid remove \fIslave \fR?\fIslave ...\fR?
+.
Removes each of the \fIslave\fRs from grid for its
master and unmaps their windows.
The slaves will no longer be managed by the grid geometry manager.
@@ -264,12 +279,14 @@ slave is managed once more by the grid geometry manager, the previous
values are retained.
.TP
\fBgrid size \fImaster\fR
+.
Returns the size of the grid (in columns then rows) for \fImaster\fR.
The size is determined either by the \fIslave\fR occupying the largest
-row or column, or the largest column or row with a \fBminsize\fR,
-\fBweight\fR, or \fBpad\fR that is non-zero.
+row or column, or the largest column or row with a \fB\-minsize\fR,
+\fB\-weight\fR, or \fB\-pad\fR that is non-zero.
.TP
\fBgrid slaves \fImaster\fR ?\fI\-option value\fR?
+.
If no options are supplied, a list of all of the slaves in \fImaster\fR
are returned, most recently manages first.
\fIOption\fR can be either \fB\-row\fR or \fB\-column\fR which
@@ -278,13 +295,13 @@ to be returned.
.SH "RELATIVE PLACEMENT"
.PP
The \fBgrid\fR command contains a limited set of capabilities that
-permit layouts to be created without specifying the row and column
-information for each slave. This permits slaves to be rearranged,
+permit layouts to be created without specifying the row and column
+information for each slave. This permits slaves to be rearranged,
added, or removed without the need to explicitly specify row and
column information.
-When no column or row information is specified for a \fIslave\fR,
+When no column or row information is specified for a \fIslave\fR,
default values are chosen for
-\fBcolumn\fR, \fBrow\fR, \fBcolumnspan\fR and \fBrowspan\fR
+\fB\-column\fR, \fB\-row\fR, \fB\-columnspan\fR and \fB\-rowspan\fR
at the time the \fIslave\fR is managed. The values are chosen
based upon the current layout of the grid, the position of the \fIslave\fR
relative to other \fIslave\fRs in the same grid command, and the presence
@@ -293,17 +310,20 @@ command where \fIslave\fR names are normally expected.
.RS
.TP
\fB\-\fR
-This increases the columnspan of the \fIslave\fR to the left. Several
-\fB\-\fR's in a row will successively increase the columnspan. A \fB\-\fR
+.
+This increases the \fB\-columnspan\fR of the \fIslave\fR to the left. Several
+\fB\-\fR's in a row will successively increase the number of columns spanned. A \fB\-\fR
may not follow a \fB^\fR or a \fBx\fR, nor may it be the first \fIslave\fR
argument to \fBgrid configure\fR.
.TP
\fBx\fR
+.
This leaves an empty column between the \fIslave\fR on the left and
the \fIslave\fR on the right.
.TP
\fB^\fR
-This extends the \fBrowspan\fR of the \fIslave\fR above the \fB^\fR's
+.
+This extends the \fB\-rowspan\fR of the \fIslave\fR above the \fB^\fR's
in the grid. The number of \fB^\fR's in a row must match the number of
columns spanned by the \fIslave\fR above it.
.RE
@@ -320,12 +340,12 @@ For the final step, each slave is positioned in its row(s) and column(s)
based on the setting of its \fIsticky\fR flag.
.PP
To compute the minimum size of a layout, the grid geometry manager
-first looks at all slaves whose columnspan and rowspan values are one,
+first looks at all slaves whose \fB\-columnspan\fR and \fB\-rowspan\fR values are one,
and computes the nominal size of each row or column to be either the
\fIminsize\fR for that row or column, or the sum of the \fIpad\fRding
plus the size of the largest slave, whichever is greater. After that
the rows or columns in each uniform group adapt to each other. Then
-the slaves whose rowspans or columnspans are greater than one are
+the slaves whose row-spans or column-spans are greater than one are
examined. If a group of rows or columns need to be increased in size
in order to accommodate these slaves, then extra space is added to each
row or column in the group according to its \fIweight\fR. For each
@@ -337,9 +357,9 @@ allocated to them is always in proportion to their weights. (A weight
of zero is considered to be 1.) In other words, a row or column
configured with \fB\-weight 1 \-uniform a\fR will have exactly the same
size as any other row or column configured with \fB\-weight 1 \-uniform
-a\fR. A row or column configured with \fB\-weight 2 \-uniform b\fR will
+a\fR. A row or column configured with \fB\-weight 2 \-uniform b\fR will
be exactly twice as large as one that is configured with \fB\-weight 1
-\-uniform b\fR.
+\-uniform b\fR.
.PP
More technically, each row or column in the group will have a size
equal to \fIk*weight\fR for some constant \fIk\fR. The constant
@@ -348,18 +368,16 @@ minimum size. For example, if all rows or columns in a group have the
same weight, then each row or column will have the same size as the
largest row or column in the group.
.PP
-.VS 8.5
For masters whose size is larger than the requested layout, the additional
space is apportioned according to the row and column weights. If all of
the weights are zero, the layout is placed within its master according to
the \fIanchor\fR value.
For masters whose size is smaller than the requested layout, space is taken
-away from columns and rows according to their weights. However, once a
+away from columns and rows according to their weights. However, once a
column or row shrinks to its minsize, its weight is taken to be zero.
If more space needs to be removed from a layout than would be permitted, as
when all the rows or columns are at their minimum sizes, the layout is
placed and clipped according to the \fIanchor\fR value.
-.VE 8.5
.SH "GEOMETRY PROPAGATION"
.PP
The grid geometry manager normally computes how large a master must be to
@@ -397,7 +415,9 @@ The \fBgrid\fR command is based on ideas taken from the \fIGridBag\fR
geometry manager written by Doug. Stein, and the \fBblt_table\fR geometry
manager, written by George Howlett.
.SH EXAMPLES
+.PP
A toplevel window containing a text widget and two scrollbars:
+.PP
.CS
# Make the widgets
toplevel .t
@@ -417,6 +437,7 @@ scrollbar .t.h \-orient horizontal \-command {.t.txt xview}
Three widgets of equal width, despite their different
.QW natural
widths:
+.PP
.CS
button .b \-text "Foo"
entry .e \-variable foo
@@ -429,3 +450,6 @@ label .l \-text "This is a fairly long piece of text"
pack(n), place(n)
.SH KEYWORDS
geometry manager, location, grid, cell, propagation, size, pack
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/image.n b/doc/image.n
index e536916..ef547b9 100644
--- a/doc/image.n
+++ b/doc/image.n
@@ -14,7 +14,6 @@ image \- Create and manipulate images
.SH SYNOPSIS
\fBimage\fR \fIoption \fR?\fIarg arg ...\fR?
.BE
-
.SH DESCRIPTION
.PP
The \fBimage\fR command is used to create, delete, and query images.
@@ -94,9 +93,10 @@ See the \fBbitmap\fR manual entry for more information.
Displays a variety of full-color images, using dithering to
approximate colors on displays with limited color capabilities.
See the \fBphoto\fR manual entry for more information.
-
.SH "SEE ALSO"
bitmap(n), options(n), photo(n)
-
.SH KEYWORDS
height, image, types of images, width
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/keysyms.n b/doc/keysyms.n
index bab9d16..e85da8c 100644
--- a/doc/keysyms.n
+++ b/doc/keysyms.n
@@ -9,11 +9,11 @@
.SH NAME
keysyms \- keysyms recognized by Tk
.BE
-
.SH DESCRIPTION
.PP
-Tk recognizes many keysyms when specifying key bindings (e.g.
-\fBbind . <Key-\fR\fIkeysym\fR\fB>\fR). The following list enumerates the
+Tk recognizes many keysyms when specifying key bindings (e.g.,
+.QW "\fBbind\fR \fB. <Key-\fR\fIkeysym\fR\fB>\fR" ).
+The following list enumerates the
keysyms that will be recognized by Tk. Note that not all keysyms will
be valid on all platforms. For example, on Unix systems, the presence
of a particular keysym is dependant on the configuration of the
@@ -919,9 +919,10 @@ Hyper_L 65517 0xffed
Hyper_R 65518 0xffee
Delete 65535 0xffff
.CE
-
.SH "SEE ALSO"
-bind
-
+bind(n), event(n)
.SH KEYWORDS
-keysym, bind, binding
+bind, binding, event, keysym
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/label.n b/doc/label.n
index ef121cb..e445ebb 100644
--- a/doc/label.n
+++ b/doc/label.n
@@ -34,10 +34,10 @@ from the size of the image or bitmap or text being displayed in it.
.OP \-state state State
Specifies one of three states for the label: \fBnormal\fR, \fBactive\fR,
or \fBdisabled\fR. In normal state the button is displayed using the
-\fBforeground\fR and \fBbackground\fR options. In active state
-the label is displayed using the \fBactiveForeground\fR and
-\fBactiveBackground\fR options. In the disabled state the
-\fBdisabledForeground\fR and \fBbackground\fR options determine how
+\fB\-foreground\fR and \fB\-background\fR options. In active state
+the label is displayed using the \fB\-activeforeground\fR and
+\fB\-activebackground\fR options. In the disabled state the
+\fB\-disabledforeground\fR and \fB\-background\fR options determine how
the button is displayed.
.OP \-width width Width
Specifies a desired width for the label.
@@ -63,9 +63,9 @@ there must not exist a window named \fIpathName\fR, but
A label is a widget that displays a textual string, bitmap or image.
If text is displayed, it must all be in a single font, but it
can occupy multiple lines on the screen (if it contains newlines
-or if wrapping occurs because of the \fBwrapLength\fR option) and
+or if wrapping occurs because of the \fB\-wraplength\fR option) and
one of the characters may optionally be underlined using the
-\fBunderline\fR option.
+\fB\-underline\fR option.
The label can be manipulated in a few simple ways, such as
changing its relief or text, using the commands described below.
.SH "WIDGET COMMAND"
@@ -105,6 +105,7 @@ command.
When a new label is created, it has no default event bindings:
labels are not intended to be interactive.
.SH EXAMPLE
+.PP
.CS
# Make the widgets
\fBlabel\fR .t \-text "This widget is at the top" \-bg red
@@ -124,3 +125,6 @@ pack .mid \-expand 1 \-fill both
labelframe(n), button(n), ttk::label(n)
.SH KEYWORDS
label, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/labelframe.n b/doc/labelframe.n
index 70d04cb..2bb865d 100644
--- a/doc/labelframe.n
+++ b/doc/labelframe.n
@@ -21,7 +21,7 @@ labelframe \- Create and manipulate labelframe widgets
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-background background Background
-This option is the same as the standard \fBbackground\fR option
+This option is the same as the standard \fB\-background\fR option
except that its value may also be specified as an empty string.
In this case, the widget will display no background or border, and
no colors will be consumed from its colormap for its background
@@ -31,7 +31,7 @@ Specifies a class for the window.
This class will be used when querying the option database for
the window's other options, and it will also be used later for
other purposes such as bindings.
-The \fBclass\fR option may not be changed with the \fBconfigure\fR
+The \fB\-class\fR option may not be changed with the \fBconfigure\fR
widget command.
.OP \-colormap colormap Colormap
Specifies a colormap to use for the window.
@@ -40,7 +40,7 @@ created for the window and its children, or the name of another
window (which must be on the same screen and have the same visual
as \fIpathName\fR), in which case the new window will use the colormap
from the specified window.
-If the \fBcolormap\fR option is not specified, the new window
+If the \fB\-colormap\fR option is not specified, the new window
uses the same colormap as its parent.
This option may not be changed with the \fBconfigure\fR
widget command.
@@ -66,7 +66,7 @@ Specifies visual information for the new window in any of the
forms accepted by \fBTk_GetVisual\fR.
If this option is not specified, the new window will use the same
visual as its parent.
-The \fBvisual\fR option may not be modified with the \fBconfigure\fR
+The \fB\-visual\fR option may not be modified with the \fBconfigure\fR
widget command.
.OP \-width width Width
Specifies the desired width for the window in any of the forms
@@ -126,6 +126,7 @@ command.
When a new labelframe is created, it has no default event bindings:
labelframes are not intended to be interactive.
.SH EXAMPLE
+.PP
This shows how to build part of a GUI for a hamburger vendor. The
\fBlabelframe\fR widgets are used to organize the available choices by
the kinds of things that the choices are being made over.
@@ -169,3 +170,6 @@ set pickle none
frame(n), label(n), ttk::labelframe(n)
.SH KEYWORDS
labelframe, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/listbox.n b/doc/listbox.n
index 341ce9a..709b702 100644
--- a/doc/listbox.n
+++ b/doc/listbox.n
@@ -75,7 +75,7 @@ When first created, a new listbox has no elements.
Elements may be added or deleted using widget commands described
below. In addition, one or more elements may be selected as described
below.
-If a listbox is exporting its selection (see \fBexportSelection\fR
+If a listbox is exporting its selection (see \fB\-exportselection\fR
option), then it will observe the standard X11 protocols
for handling the selection.
Listbox selections are available as type \fBSTRING\fR;
@@ -85,8 +85,8 @@ newlines separating the elements.
It is not necessary for all the elements to be
displayed in the listbox window at once; commands described below
may be used to change the view in the window. Listboxes allow
-scrolling in both directions using the standard \fBxScrollCommand\fR
-and \fByScrollCommand\fR options.
+scrolling in both directions using the standard \fB\-xscrollcommand\fR
+and \fB\-yscrollcommand\fR options.
They also support scanning, as described below.
.SH "INDICES"
.PP
@@ -96,20 +96,24 @@ An index specifies a particular element of the listbox, in any of
the following ways:
.TP 12
\fInumber\fR
+.
Specifies the element as a numerical index, where 0 corresponds
to the first element in the listbox.
.TP 12
\fBactive\fR
+.
Indicates the element that has the location cursor. This element
will be displayed as specified by \fB\-activestyle\fR when the listbox
has the keyboard focus, and it is specified with the \fBactivate\fR
widget command.
.TP 12
\fBanchor\fR
+.
Indicates the anchor point for the selection, which is set with the
\fBselection anchor\fR widget command.
.TP 12
\fBend\fR
+.
Indicates the end of the listbox.
For most commands this refers to the last element in the listbox,
but for a few commands such as \fBindex\fR and \fBinsert\fR
@@ -138,6 +142,7 @@ determine the exact behavior of the command. The following
commands are possible for listbox widgets:
.TP
\fIpathName \fBactivate\fR \fIindex\fR
+.
Sets the active element to the one indicated by \fIindex\fR.
If \fIindex\fR is outside the range of elements in the listbox
then the closest element is activated.
@@ -146,6 +151,7 @@ widget has the input focus, and its index may be retrieved with the
index \fBactive\fR.
.TP
\fIpathName \fBbbox\fR \fIindex\fR
+.
Returns a list of four numbers describing the bounding box of
the text in the element given by \fIindex\fR.
The first two elements of the list give the x and y coordinates
@@ -160,12 +166,14 @@ partially visible, the result gives the full area of the element,
including any parts that are not visible.
.TP
\fIpathName \fBcget\fR \fIoption\fR
+.
Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBlistbox\fR
command.
.TP
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+.
Query or modify the configuration options of the widget.
If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
@@ -180,18 +188,21 @@ this case the command returns an empty string.
command.
.TP
\fIpathName \fBcurselection\fR
+.
Returns a list containing the numerical indices of
all of the elements in the listbox that are currently selected.
If there are no elements selected in the listbox then an empty
string is returned.
.TP
\fIpathName \fBdelete \fIfirst \fR?\fIlast\fR?
+.
Deletes one or more elements of the listbox. \fIFirst\fR and \fIlast\fR
are indices specifying the first and last elements in the range
to delete. If \fIlast\fR is not specified it defaults to
\fIfirst\fR, i.e. a single element is deleted.
.TP
\fIpathName \fBget \fIfirst\fR ?\fIlast\fR?
+.
If \fIlast\fR is omitted, returns the contents of the listbox
element indicated by \fIfirst\fR,
or an empty string if \fIfirst\fR refers to a non-existent element.
@@ -202,22 +213,26 @@ Both \fIfirst\fR and \fIlast\fR may have any of the standard
forms for indices.
.TP
\fIpathName \fBindex \fIindex\fR
+.
Returns the integer index value that corresponds to \fIindex\fR.
If \fIindex\fR is \fBend\fR the return value is a count of the number
of elements in the listbox (not the index of the last element).
.TP
\fIpathName \fBinsert \fIindex \fR?\fIelement element ...\fR?
+.
Inserts zero or more new elements in the list just before the
element given by \fIindex\fR. If \fIindex\fR is specified as
\fBend\fR then the new elements are added to the end of the
list. Returns an empty string.
.TP
\fIpathName \fBitemcget \fIindex option\fR
+.
Returns the current value of the item configuration option given
by \fIoption\fR. \fIOption\fR may have any of the values accepted
-by the \fBlistbox itemconfigure\fR command.
+by the \fBitemconfigure\fR command.
.TP
\fIpathName \fBitemconfigure \fIindex\fR ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR?
+.
Query or modify the configuration options of an item in the listbox.
If no \fIoption\fR is specified, returns a list describing all of
the available options for the item (see \fBTk_ConfigureInfo\fR for
@@ -232,40 +247,48 @@ are currently supported for items:
.RS
.TP
\fB\-background \fIcolor\fR
+.
\fIColor\fR specifies the background color to use when displaying the
item. It may have any of the forms accepted by \fBTk_GetColor\fR.
.TP
\fB\-foreground \fIcolor\fR
+.
\fIColor\fR specifies the foreground color to use when displaying the
item. It may have any of the forms accepted by \fBTk_GetColor\fR.
.TP
\fB\-selectbackground \fIcolor\fR
+.
\fIcolor\fR specifies the background color to use when displaying the
item while it is selected. It may have any of the forms accepted by
\fBTk_GetColor\fR.
.TP
\fB\-selectforeground \fIcolor\fR
+.
\fIcolor\fR specifies the foreground color to use when displaying the
item while it is selected. It may have any of the forms accepted by
\fBTk_GetColor\fR.
.RE
.TP
\fIpathName \fBnearest \fIy\fR
+.
Given a y-coordinate within the listbox window, this command returns
the index of the (visible) listbox element nearest to that y-coordinate.
.TP
\fIpathName \fBscan\fR \fIoption args\fR
+.
This command is used to implement scanning on listboxes. It has
two forms, depending on \fIoption\fR:
.RS
.TP
\fIpathName \fBscan mark \fIx y\fR
+.
Records \fIx\fR and \fIy\fR and the current view in the listbox
window; used in conjunction with later \fBscan dragto\fR commands.
Typically this command is associated with a mouse button press in
the widget. It returns an empty string.
.TP
\fIpathName \fBscan dragto \fIx y\fR.
+.
This command computes the difference between its \fIx\fR and \fIy\fR
arguments and the \fIx\fR and \fIy\fR arguments to the last
\fBscan mark\fR command for the widget.
@@ -277,6 +300,7 @@ value is an empty string.
.RE
.TP
\fIpathName \fBsee \fIindex\fR
+.
Adjust the view in the listbox so that the element given by \fIindex\fR
is visible.
If the element is already visible then the command has no effect;
@@ -285,11 +309,13 @@ scrolls to bring the element into view at the edge; otherwise
the listbox scrolls to center the element.
.TP
\fIpathName \fBselection \fIoption arg\fR
+.
This command is used to adjust the selection within a listbox. It
has several forms, depending on \fIoption\fR:
.RS
.TP
\fIpathName \fBselection anchor \fIindex\fR
+.
Sets the selection anchor to the element given by \fIindex\fR.
If \fIindex\fR refers to a non-existent element, then the closest
element is used.
@@ -299,32 +325,38 @@ The index \fBanchor\fR may be used to refer to the anchor
element.
.TP
\fIpathName \fBselection clear \fIfirst \fR?\fIlast\fR?
+.
If any of the elements between \fIfirst\fR and \fIlast\fR
(inclusive) are selected, they are deselected.
The selection state is not changed for elements outside
this range.
.TP
\fIpathName \fBselection includes \fIindex\fR
+.
Returns 1 if the element indicated by \fIindex\fR is currently
selected, 0 if it is not.
.TP
\fIpathName \fBselection set \fIfirst \fR?\fIlast\fR?
+.
Selects all of the elements in the range between
\fIfirst\fR and \fIlast\fR, inclusive, without affecting
the selection state of elements outside that range.
.RE
.TP
\fIpathName \fBsize\fR
+.
Returns a decimal string indicating the total number of elements
in the listbox.
.TP
-\fIpathName \fBxview \fIargs\fR
+\fIpathName \fBxview \fR?\fIargs\fR
+.
This command is used to query and change the horizontal position of the
information in the widget's window. It can take any of the following
forms:
.RS
.TP
\fIpathName \fBxview\fR
+.
Returns a list containing two elements.
Each element is a real fraction between 0 and 1; together they describe
the horizontal span that is visible in the window.
@@ -334,17 +366,20 @@ in the window, and 40% of the text is off-screen to the right.
These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR
option.
.TP
-\fIpathName \fBxview\fR \fIindex\fR
+\fIpathName \fBxview \fIindex\fR
+.
Adjusts the view in the window so that the character position given by
\fIindex\fR is displayed at the left edge of the window.
Character positions are defined by the width of the character \fB0\fR.
.TP
\fIpathName \fBxview moveto\fI fraction\fR
+.
Adjusts the view in the window so that \fIfraction\fR of the
total width of the listbox text is off-screen to the left.
\fIfraction\fR must be a fraction between 0 and 1.
.TP
\fIpathName \fBxview scroll \fInumber what\fR
+.
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR.
\fINumber\fR must be an integer.
@@ -359,7 +394,8 @@ become visible; if it is positive then characters farther to the right
become visible.
.RE
.TP
-\fIpathName \fByview \fI?args\fR?
+\fIpathName \fByview \fR?\fIargs\fR?
+.
This command is used to query and change the vertical position of the
text in the widget's window.
It can take any of the following forms:
@@ -376,11 +412,13 @@ the last one in the window, relative to the listbox as a whole.
These are the same values passed to scrollbars via the \fB\-yscrollcommand\fR
option.
.TP
-\fIpathName \fByview\fR \fIindex\fR
+\fIpathName \fByview \fIindex\fR
+.
Adjusts the view in the window so that the element given by
\fIindex\fR is displayed at the top of the window.
.TP
\fIpathName \fByview moveto\fI fraction\fR
+.
Adjusts the view in the window so that the element given by \fIfraction\fR
appears at the top of the window.
\fIFraction\fR is a fraction between 0 and 1; 0 indicates the first
@@ -388,6 +426,7 @@ element in the listbox, 0.33 indicates the element one-third the
way through the listbox, and so on.
.TP
\fIpathName \fByview scroll \fInumber what\fR
+.
This command adjusts the view in the window up or down according to
\fInumber\fR and \fIwhat\fR.
\fINumber\fR must be an integer.
@@ -403,7 +442,7 @@ become visible.
.PP
Tk automatically creates class bindings for listboxes that give them
Motif-like behavior. Much of the behavior of a listbox is determined
-by its \fBselectMode\fR option, which selects one of four ways
+by its \fB\-selectmode\fR option, which selects one of four ways
of dealing with the selection.
.PP
If the selection mode is \fBsingle\fR or \fBbrowse\fR, at most one
@@ -412,10 +451,8 @@ In both modes, clicking button 1 on an element selects
it and deselects any other selected item.
In \fBbrowse\fR mode it is also possible to drag the selection
with button 1.
-.VS 8.5
On button 1, the listbox will also take focus if it has a \fBnormal\fR
state and \fB\-takefocus\fR is true.
-.VE 8.5
.PP
If the selection mode is \fBmultiple\fR or \fBextended\fR,
any number of elements may be selected at once, including discontiguous
@@ -533,6 +570,9 @@ a selection.
The behavior of listboxes can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
.SH "SEE ALSO"
-ttk_treeview(n)
+ttk::treeview(n)
.SH KEYWORDS
listbox, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/loadTk.n b/doc/loadTk.n
index e1fecf6..6d4b070 100644
--- a/doc/loadTk.n
+++ b/doc/loadTk.n
@@ -9,73 +9,61 @@
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
-loadTk \- Load Tk into a safe interpreter.
+safe::loadTk \- Load Tk into a safe interpreter.
.SH SYNOPSIS
-\fB::safe::loadTk \fIslave\fR ?\fB\-use\fR \fIwindowId\fR? ?\fB\-display\fR \fIdisplayName\fR?
+\fBsafe::loadTk \fIslave\fR ?\fB\-use\fR \fIwindowId\fR? ?\fB\-display\fR \fIdisplayName\fR?
.BE
.SH DESCRIPTION
-Safe Tk is based on Safe Tcl, which provides a mechanism
-that allows restricted and mediated
-access to auto-loading and packages for safe interpreters.
-Safe Tk adds the ability to configure the interpreter
-for safe Tk operations and load Tk into safe
-interpreters.
.PP
-The \fB::safe::loadTk\fR command initializes the required data structures
-in the named safe interpreter and then loads Tk into it.
-The interpreter must have been created with \fB::safe::interpCreate\fR
-or have been initialized with \fB::safe::interpInit\fR.
-The command returns the name of the safe interpreter.
-If \fB\-use\fR is specified, the window identified by the specified system
-dependent identifier \fIwindowId\fR is used to contain the
+Safe Tk is based on Safe Tcl, which provides a mechanism that allows
+restricted and mediated access to auto-loading and packages for safe
+interpreters. Safe Tk adds the ability to configure the interpreter for safe
+Tk operations and load Tk into safe interpreters.
+.PP
+The \fBsafe::loadTk\fR command initializes the required data structures in
+the named safe interpreter and then loads Tk into it. The interpreter must
+have been created with \fBsafe::interpCreate\fR or have been initialized
+with \fBsafe::interpInit\fR. The command returns the name of the safe
+interpreter. If \fB\-use\fR is specified, the window identified by the
+specified system dependent identifier \fIwindowId\fR is used to contain the
.QW .
-window of the safe interpreter; it can be any valid id, eventually
-referencing a window belonging to another application. As a convenience,
-if the window you plan to use is a Tk Window of the application you
-can use the window name (e.g. \fB.x.y\fR) instead of its window Id
-(\fB[winfo id .x.y]\fR).
-When \fB\-use\fR is not specified,
-a new toplevel window is created for the
+window of the safe interpreter; it can be any valid id, eventually referencing
+a window belonging to another application. As a convenience, if the window you
+plan to use is a Tk Window of the application you can use the window name
+(e.g.,
+.QW \fB.x.y\fR )
+instead of its window Id (e.g., from \fBwinfo id\fR \fB.x.y\fR).
+When \fB\-use\fR is not specified, a new toplevel window is created for the
.QW .
-window of
-the safe interpreter. On X11 if you want the embedded window
-to use another display than the default one, specify it with
-\fB\-display\fR.
-See the \fBSECURITY ISSUES\fR section below for implementation details.
-
+window of the safe interpreter. On X11 if you want the embedded window to use
+another display than the default one, specify it with \fB\-display\fR. See
+the \fBSECURITY ISSUES\fR section below for implementation details.
.SH "SECURITY ISSUES"
.PP
Please read the \fBsafe\fR manual page for Tcl to learn about the basic
security considerations for Safe Tcl.
.PP
-\fB::safe::loadTk\fR adds the value of \fBtk_library\fR taken from the master
+\fBsafe::loadTk\fR adds the value of \fBtk_library\fR taken from the master
interpreter to the virtual access path of the safe interpreter so that
auto-loading will work in the safe interpreter.
.PP
+Tk initialization is now safe with respect to not trusting the slave's state
+for startup. \fBsafe::loadTk\fR registers the slave's name so when the Tk
+initialization (\fBTk_SafeInit\fR) is called and in turn calls the master's
+\fBsafe::InitTk\fR it will return the desired \fBargv\fR equivalent
+(\fB\-use\fR \fIwindowId\fR, correct \fB\-display\fR, etc.)
.PP
-Tk initialization is now safe with respect to not trusting
-the slave's state for startup. \fB::safe::loadTk\fR
-registers the slave's name so
-when the Tk initialization (\fBTk_SafeInit\fR) is called
-and in turn calls the master's \fB::safe::InitTk\fR it will
-return the desired \fBargv\fR equivalent (\fB\-use\fR
-\fIwindowId\fR, correct \fB\-display\fR, etc.)
-.PP
-When \fB\-use\fR is not used, the new toplevel created is specially
-decorated so the user is always aware that the user interface presented comes
-from a potentially unsafe code and can easily delete the corresponding
-interpreter.
+When \fB\-use\fR is not used, the new toplevel created is specially decorated
+so the user is always aware that the user interface presented comes from a
+potentially unsafe code and can easily delete the corresponding interpreter.
.PP
-On X11, conflicting \fB\-use\fR and \fB\-display\fR are likely
-to generate a fatal X error.
-
+On X11, conflicting \fB\-use\fR and \fB\-display\fR are likely to generate a
+fatal X error.
.SH "SEE ALSO"
safe(n), interp(n), library(n), load(n), package(n), source(n), unknown(n)
-
.SH KEYWORDS
-alias, auto\-loading, auto_mkindex, load, master interpreter, safe
+alias, auto-loading, auto_mkindex, load, master interpreter, safe
interpreter, slave interpreter, source
-
'\" Local Variables:
'\" mode: nroff
'\" End:
diff --git a/doc/lower.n b/doc/lower.n
index be8ca4e..0d8f252 100644
--- a/doc/lower.n
+++ b/doc/lower.n
@@ -14,7 +14,6 @@ lower \- Change a window's position in the stacking order
.SH SYNOPSIS
\fBlower \fIwindow \fR?\fIbelowThis\fR?
.BE
-
.SH DESCRIPTION
.PP
If the \fIbelowThis\fR argument is omitted then the command lowers
@@ -28,9 +27,14 @@ In this case the \fBlower\fR command will insert
\fIwindow\fR into the stacking order just below \fIbelowThis\fR
(or the ancestor of \fIbelowThis\fR that is a sibling of \fIwindow\fR);
this could end up either raising or lowering \fIwindow\fR.
-
+.PP
+All \fBtoplevel\fR windows may be restacked with respect to each
+other, whatever their relative path names, but the window manager is
+not obligated to strictly honor requests to restack.
.SH "SEE ALSO"
raise
-
.SH KEYWORDS
lower, obscure, stacking order
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/menu.n b/doc/menu.n
index 7a92002..c6f74dc 100644
--- a/doc/menu.n
+++ b/doc/menu.n
@@ -40,6 +40,8 @@ top. If so, it will exist as entry 0 of the menu and the other
entries will number starting at 1. The default
menu bindings arrange for the menu to be torn off when the tear-off
entry is invoked.
+This option is ignored under Aqua/Mac OS X, where menus cannot
+be torn off.
.OP \-tearoffcommand tearOffCommand TearOffCommand
If this option has a non-empty value, then it specifies a Tcl command
to invoke whenever the menu is torn off. The actual command will
@@ -52,6 +54,8 @@ and menu \fB.x.y\fR is torn off to
create a new menu \fB.x.tearoff1\fR, then the command
.QW "\fBa b .x.y .x.tearoff1\fR"
will be invoked.
+This option is ignored under Aqua/Mac OS X, where menus cannot
+be torn off.
.OP \-title title Title
The string will be used to title the window created when this menu is
torn off. If the title is NULL, then the window will have the title
@@ -203,7 +207,7 @@ supported on Windows.
.SS "TEAR-OFF ENTRIES"
.PP
A tear-off entry appears at the top of the menu if enabled with the
-\fBtearOff\fR option. It is not like other menu entries in that
+\fB\-tearoff\fR option. It is not like other menu entries in that
it cannot be created with the \fBadd\fR widget command and
cannot be deleted with the \fBdelete\fR widget command.
When a tear-off entry is created it appears as a dashed line at
@@ -228,31 +232,43 @@ menubars, they may not be drawn with indicators on some platforms, due
to system restrictions.
.SS "SPECIAL MENUS IN MENUBARS"
.PP
-Certain menus in a menubar will be treated specially. On the
-Macintosh, access to the special Application and Help menus is
-provided. On Windows, access to the Windows System menu in each window
-is provided. On X Windows, a special right-justified help menu may be
-provided if Motif menu compatibility is enabled. In all cases, these
-menus must be created with the command name of the menubar menu
-concatenated with the special name. So for a menubar named .menubar,
-on the Macintosh, the special menus would be .menubar.apple
-and .menubar.help; on Windows, the special menu would be .menubar.system;
-on X Windows, the help menu would be .menubar.help.
-.PP
-When Tk sees a .menubar.apple menu on the Macintosh, that menu's contents
-make up the first items of the Application menu whenever the window
-containing the menubar is in front.
+Certain menus in a menubar will be treated specially. On the Macintosh,
+access to the special Application, Window and Help menus is provided. On
+Windows, access to the Windows System menu in each window is provided.
+On X Windows, a special right-justified help menu may be provided if
+Motif menu compatibility is enabled. In all cases, these menus must be
+created with the command name of the menubar menu concatenated with the
+special name. So for a menubar named .menubar, on the Macintosh, the
+special menus would be .menubar.apple, .menubar.window and .menubar.help;
+on Windows, the special menu would be .menubar.system; on X Windows,
+the help menu would be .menubar.help.
+.PP
+When Tk sees a .menubar.apple menu as the first menu in a menubar on the
+Macintosh, that menu's contents make up the first items of the
+Application menu whenever the window containing the menubar is in front.
After all of the Tk-defined items, the menu will have a separator,
followed by all standard Application menu items.
+Such a .apple menu must be present in a menu when that menu is first
+configured as a toplevel's menubar, otherwise a default application menu
+(hidden from Tk) will be inserted into the menubar at that time and
+subsequent addition of a .apple menu will no longer result in it
+becoming the Application menu.
+.PP
+When Tk sees a .menubar.window menu on the Macintosh, the menu's
+contents are inserted into the standard Window menu of the user's
+menubar whenever the window's menubar is in front. The first items in
+the menu are provided by Mac OS X, and the names of the current
+toplevels are automatically appended after all the Tk-defined items and
+a separator.
.PP
-When Tk sees a Help menu on the Macintosh, the menu's contents are
-appended to the standard Help menu on the right of the user's menubar
-whenever the window's menubar is in front. The first items in the menu
+When Tk sees a .menubar.help menu on the Macintosh, the menu's contents
+are appended to the standard Help menu of the user's menubar whenever
+the window's menubar is in front. The first items in the menu
are provided by Mac OS X.
.PP
When Tk sees a System menu on Windows, its items are appended to the
-system menu that the menubar is attached to. This menu has an icon
-representing a spacebar, and can be invoked with the mouse or by typing
+system menu that the menubar is attached to. This menu is tied to the
+application icon and can be invoked with the mouse or by typing
Alt+Spacebar. Due to limitations in the Windows API, any font changes,
colors, images, bitmaps, or tearoff images will not appear in the
system menu.
@@ -290,24 +306,29 @@ indicators are called \fIindex\fRes and may be specified in
any of the following forms:
.TP 12
\fInumber\fR
+.
Specifies the entry numerically, where 0 corresponds
to the top-most entry of the menu, 1 to the entry below it, and
so on.
.TP 12
\fBactive\fR
+.
Indicates the entry that is currently active. If no entry is
active then this form is equivalent to \fBnone\fR. This form may
not be abbreviated.
.TP 12
\fBend\fR
+.
Indicates the bottommost entry in the menu. If there are no
entries in the menu then this form is equivalent to \fBnone\fR.
This form may not be abbreviated.
.TP 12
\fBlast\fR
+.
Same as \fBend\fR.
.TP 12
\fBnone\fR
+.
Indicates
.QW "no entry at all" ;
this is used most commonly with
@@ -317,6 +338,7 @@ nothing to happen in the widget command.
This form may not be abbreviated.
.TP 12
\fB@\fInumber\fR
+.
In this form, \fInumber\fR is treated as a y-coordinate in the
menu's window; the entry closest to that y-coordinate is used.
For example,
@@ -324,15 +346,17 @@ For example,
indicates the top-most entry in the window.
.TP 12
\fIpattern\fR
+.
If the index does not satisfy one of the above forms then this
form is used. \fIPattern\fR is pattern-matched against the label of
each entry in the menu, in order from the top down, until a
-matching entry is found. The rules of \fBTcl_StringMatch\fR
+matching entry is found. The rules of \fBstring match\fR
are used.
.PP
The following widget commands are possible for menu widgets:
.TP
\fIpathName \fBactivate \fIindex\fR
+.
Change the state of the entry indicated by \fIindex\fR to \fBactive\fR
and redisplay it using its active colors.
Any previously-active entry is deactivated. If \fIindex\fR
@@ -341,44 +365,185 @@ disabled, then the menu ends up with no active entry.
Returns an empty string.
.TP
\fIpathName \fBadd \fItype \fR?\fIoption value option value ...\fR?
+.
Add a new entry to the bottom of the menu. The new entry's type
is given by \fItype\fR and must be one of \fBcascade\fR,
\fBcheckbutton\fR, \fBcommand\fR, \fBradiobutton\fR, or \fBseparator\fR,
or a unique abbreviation of one of the above. If additional arguments
-are present, they specify any of the following options:
-.RS
+are present, they specify the options listed in the \fBMENU ENTRY OPTIONS\fR
+section below.
+The \fBadd\fR widget command returns an empty string.
+.TP
+\fIpathName \fBcget \fIoption\fR
+.
+Returns the current value of the configuration option given
+by \fIoption\fR.
+\fIOption\fR may have any of the values accepted by the \fBmenu\fR
+command.
+.TP
+\fIpathName \fBclone \fInewPathname\fR ?\fIcloneType\fR?
+.
+Makes a clone of the current menu named \fInewPathName\fR. This clone
+is a menu in its own right, but any changes to the clone are
+propagated to the original menu and vice versa. \fIcloneType\fR can be
+\fBnormal\fR, \fBmenubar\fR, or \fBtearoff\fR. Should not normally be
+called outside of the Tk library. See the \fBCLONES\fR section for
+more information.
+.TP
+\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+.
+Query or modify the configuration options of the widget.
+If no \fIoption\fR is specified, returns a list describing all of
+the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
+information on the format of this list). If \fIoption\fR is specified
+with no \fIvalue\fR, then the command returns a list describing the
+one named option (this list will be identical to the corresponding
+sublist of the value returned if no \fIoption\fR is specified). If
+one or more \fIoption\-value\fR pairs are specified, then the command
+modifies the given widget option(s) to have the given value(s); in
+this case the command returns an empty string.
+\fIOption\fR may have any of the values accepted by the \fBmenu\fR
+command.
+.TP
+\fIpathName \fBdelete \fIindex1\fR ?\fIindex2\fR?
+.
+Delete all of the menu entries between \fIindex1\fR and
+\fIindex2\fR inclusive.
+If \fIindex2\fR is omitted then it defaults to \fIindex1\fR.
+Attempts to delete a tear-off menu entry are ignored (instead, you
+should change the \fB\-tearoff\fR option to remove the tear-off entry).
+.TP
+\fIpathName \fBentrycget \fIindex option\fR
+.
+Returns the current value of a configuration option for
+the entry given by \fIindex\fR.
+\fIOption\fR may have any of the names described in the
+\fBMENU ENTRY OPTIONS\fR section below.
+.TP
+\fIpathName \fBentryconfigure \fIindex \fR?\fIoptions...\fR?
+.
+This command is similar to the \fBconfigure\fR command, except that
+it applies to the options for an individual entry, whereas \fBconfigure\fR
+applies to the options for the menu as a whole.
+\fIOptions\fR may have any of the values described in the
+\fBMENU ENTRY OPTIONS\fR
+section below. If \fIoptions\fR are specified, options are
+modified as indicated in the command and the command returns an empty string.
+If no \fIoptions\fR are specified, returns a list describing
+the current options for entry \fIindex\fR (see \fBTk_ConfigureInfo\fR for
+information on the format of this list).
+.TP
+\fIpathName \fBindex \fIindex\fR
+.
+Returns the numerical index corresponding to \fIindex\fR, or
+\fBnone\fR if \fIindex\fR was specified as \fBnone\fR.
+.TP
+\fIpathName \fBinsert \fIindex type \fR?\fIoption value option value ...\fR?
+.
+Same as the \fBadd\fR widget command except that it inserts the new
+entry just before the entry given by \fIindex\fR, instead of appending
+to the end of the menu. The \fItype\fR, \fIoption\fR, and \fIvalue\fR
+arguments have the same interpretation as for the \fBadd\fR widget
+command. It is not possible to insert new menu entries before the
+tear-off entry, if the menu has one.
+.TP
+\fIpathName \fBinvoke \fIindex\fR
+.
+Invoke the action of the menu entry. See the sections on the
+individual entries above for details on what happens. If the
+menu entry is disabled then nothing happens. If the
+entry has a command associated with it then the result of that
+command is returned as the result of the \fBinvoke\fR widget
+command. Otherwise the result is an empty string. Note: invoking
+a menu entry does not automatically unpost the menu; the default
+bindings normally take care of this before invoking the \fBinvoke\fR
+widget command.
+.TP
+\fIpathName \fBpost \fIx y\fR
+.
+Arrange for the menu to be displayed on the screen at the root-window
+coordinates given by \fIx\fR and \fIy\fR. These coordinates are
+adjusted if necessary to guarantee that the entire menu is visible on
+the screen. This command normally returns an empty string.
+If the \fB\-postcommand\fR option has been specified, then its value is
+executed as a Tcl script before posting the menu and the result of
+that script is returned as the result of the \fBpost\fR widget
+command.
+If an error returns while executing the command, then the error is
+returned without posting the menu.
+.TP
+\fIpathName \fBpostcascade \fIindex\fR
+.
+Posts the submenu associated with the cascade entry given by
+\fIindex\fR, and unposts any previously posted submenu.
+If \fIindex\fR does not correspond to a cascade entry,
+or if \fIpathName\fR is not posted,
+the command has no effect except to unpost any currently posted
+submenu.
+.TP
+\fIpathName \fBtype \fIindex\fR
+.
+Returns the type of the menu entry given by \fIindex\fR.
+This is the \fItype\fR argument passed to the \fBadd\fR or \fBinsert\fR widget
+command when the entry was created, such as \fBcommand\fR
+or \fBseparator\fR, or \fBtearoff\fR for a tear-off entry.
+.TP
+\fIpathName \fBunpost\fR
+.
+Unmap the window so that it is no longer displayed. If a
+lower-level cascaded menu is posted, unpost that menu. Returns an
+empty string. This subcommand does not work on Windows and the
+Macintosh, as those platforms have their own way of unposting menus.
+.TP
+\fIpathName \fBxposition \fIindex\fR
+.
+Returns a decimal string giving the x-coordinate within the menu
+window of the leftmost pixel in the entry specified by \fIindex\fR.
+.TP
+\fIpathName \fByposition \fIindex\fR
+.
+Returns a decimal string giving the y-coordinate within the menu
+window of the topmost pixel in the entry specified by \fIindex\fR.
+.SH "MENU ENTRY OPTIONS"
+The following options are allowed on menu entries. Most options are not
+supported by all entry types.
.TP
\fB\-activebackground \fIvalue\fR
+.
Specifies a background color to use for displaying this entry when it
is active.
If this option is specified as an empty string (the default), then the
-\fBactiveBackground\fR option for the overall menu is used.
+\fB\-activebackground\fR option for the overall menu is used.
If the \fBtk_strictMotif\fR variable has been set to request strict
Motif compliance, then this option is ignored and the \fB\-background\fR
option is used in its place.
This option is not available for separator or tear-off entries.
.TP
\fB\-activeforeground \fIvalue\fR
+.
Specifies a foreground color to use for displaying this entry when it
is active.
If this option is specified as an empty string (the default), then the
-\fBactiveForeground\fR option for the overall menu is used.
+\fB\-activeforeground\fR option for the overall menu is used.
This option is not available for separator or tear-off entries.
.TP
\fB\-accelerator \fIvalue\fR
+.
Specifies a string to display at the right side of the menu entry.
Normally describes an accelerator keystroke sequence that may be
typed to invoke the same function as the menu entry. This option
is not available for separator or tear-off entries.
.TP
\fB\-background \fIvalue\fR
+.
Specifies a background color to use for displaying this entry when it
is in the normal state (neither active nor disabled).
If this option is specified as an empty string (the default), then the
-\fBbackground\fR option for the overall menu is used.
+\fB\-background\fR option for the overall menu is used.
This option is not available for separator or tear-off entries.
.TP
\fB\-bitmap \fIvalue\fR
+.
Specifies a bitmap to display in the menu instead of a textual
label, in any of the forms accepted by \fBTk_GetBitmap\fR.
This option overrides the \fB\-label\fR option
@@ -390,15 +555,20 @@ If a \fB\-image\fR option has been specified, it overrides
This option is not available for separator or tear-off entries.
.TP
\fB\-columnbreak \fIvalue\fR
+.
When this option is zero, the entry appears below the previous entry. When
this option is one, the entry appears at the top of a new column in the
menu.
+This option is ignored on Aqua/Mac OS X, where menus are always a single
+column.
.TP
\fB\-command \fIvalue\fR
+.
Specifies a Tcl command to execute when the menu entry is invoked.
Not available for separator or tear-off entries.
.TP
\fB\-compound \fIvalue\fR
+.
Specifies whether the menu entry should display both an image and text,
and if so, where the image should be placed relative to the text.
Valid values for this option are \fBbottom\fR, \fBcenter\fR,
@@ -408,26 +578,30 @@ text, depending on the values of the \fB\-image\fR and \fB\-bitmap\fR
options.
.TP
\fB\-font \fIvalue\fR
+.
Specifies the font to use when drawing the label or accelerator
string in this entry.
If this option is specified as an empty string (the default) then
-the \fBfont\fR option for the overall menu is used.
+the \fB\-font\fR option for the overall menu is used.
This option is not available for separator or tear-off entries.
.TP
\fB\-foreground \fIvalue\fR
+.
Specifies a foreground color to use for displaying this entry when it
is in the normal state (neither active nor disabled).
If this option is specified as an empty string (the default), then the
-\fBforeground\fR option for the overall menu is used.
+\fB\-foreground\fR option for the overall menu is used.
This option is not available for separator or tear-off entries.
.TP
\fB\-hidemargin \fIvalue\fR
+.
Specifies whether the standard margins should be drawn for this menu
entry. This is useful when creating palette with images in them, i.e.,
color palettes, pattern palettes, etc. 1 indicates that the margin for
the entry is hidden; 0 means that the margin is used.
.TP
\fB\-image \fIvalue\fR
+.
Specifies an image to display in the menu instead of a text string
or bitmap.
The image must have been created by some previous invocation of
@@ -439,36 +613,43 @@ bitmap label to be displayed.
This option is not available for separator or tear-off entries.
.TP
\fB\-indicatoron \fIvalue\fR
+.
Available only for checkbutton and radiobutton entries.
\fIValue\fR is a boolean that determines whether or not the
indicator should be displayed.
.TP
\fB\-label \fIvalue\fR
+.
Specifies a string to display as an identifying label in the menu
entry. Not available for separator or tear-off entries.
.TP
\fB\-menu \fIvalue\fR
+.
Available only for cascade entries. Specifies the path name of
the submenu associated with this entry.
The submenu must be a child of the menu.
.TP
\fB\-offvalue \fIvalue\fR
+.
Available only for checkbutton entries. Specifies the value to
store in the entry's associated variable when the entry is
deselected.
.TP
\fB\-onvalue \fIvalue\fR
+.
Available only for checkbutton entries. Specifies the value to
store in the entry's associated variable when the entry is selected.
.TP
\fB\-selectcolor \fIvalue\fR
+.
Available only for checkbutton and radiobutton entries.
Specifies the color to display in the indicator when the entry is
selected.
-If the value is an empty string (the default) then the \fBselectColor\fR
+If the value is an empty string (the default) then the \fB\-selectcolor\fR
option for the menu determines the indicator color.
.TP
\fB\-selectimage \fIvalue\fR
+.
Available only for checkbutton and radiobutton entries.
Specifies an image to display in the entry (in place of
the \fB\-image\fR option) when it is selected.
@@ -478,22 +659,24 @@ This option is ignored unless the \fB\-image\fR option has
been specified.
.TP
\fB\-state \fIvalue\fR
+.
Specifies one of three states for the entry: \fBnormal\fR, \fBactive\fR,
or \fBdisabled\fR. In normal state the entry is displayed using the
-\fBforeground\fR option for the menu and the \fBbackground\fR
+\fB\-foreground\fR option for the menu and the \fB\-background\fR
option from the entry or the menu.
The active state is typically used when the pointer is over the entry.
-In active state the entry is displayed using the \fBactiveForeground\fR
-option for the menu along with the \fBactivebackground\fR option from
+In active state the entry is displayed using the \fB\-activeforeground\fR
+option for the menu along with the \fB\-activebackground\fR option from
the entry. Disabled state means that the entry
should be insensitive: the default bindings will refuse to activate
or invoke the entry.
In this state the entry is displayed according to the
-\fBdisabledForeground\fR option for the menu and the
-\fBbackground\fR option from the entry.
+\fB\-disabledforeground\fR option for the menu and the
+\fB\-background\fR option from the entry.
This option is not available for separator entries.
.TP
\fB\-underline \fIvalue\fR
+.
Specifies the integer index of a character to underline in the entry.
This option is also queried by the default bindings and used to
implement keyboard traversal.
@@ -503,143 +686,32 @@ If a bitmap or image is displayed in the entry then this option is ignored.
This option is not available for separator or tear-off entries.
.TP
\fB\-value \fIvalue\fR
+.
Available only for radiobutton entries. Specifies the value to
store in the entry's associated variable when the entry is selected.
If an empty string is specified, then the \fB\-label\fR option
for the entry as the value to store in the variable.
.TP
\fB\-variable \fIvalue\fR
+.
Available only for checkbutton and radiobutton entries. Specifies
the name of a global variable to set when the entry is selected.
For checkbutton entries the variable is also set when the entry
is deselected. For radiobutton entries, changing the variable
causes the currently-selected entry to deselect itself.
-.LP
-The \fBadd\fR widget command returns an empty string.
+.RS
+.PP
+For checkbutton entries, the default value of this option is taken from the
+\fB\-label\fR option, and for radiobutton entries a single fixed value is
+used. It is recommended that you always set the \fB\-variable\fR option when
+creating either a checkbutton or a radiobutton.
.RE
-.TP
-\fIpathName \fBcget\fR \fIoption\fR
-Returns the current value of the configuration option given
-by \fIoption\fR.
-\fIOption\fR may have any of the values accepted by the \fBmenu\fR
-command.
-.TP
-\fIpathName\fR \fBclone\fR \fInewPathname ?cloneType?\fR
-Makes a clone of the current menu named \fInewPathName\fR. This clone
-is a menu in its own right, but any changes to the clone are
-propagated to the original menu and vice versa. \fIcloneType\fR can be
-\fBnormal\fR, \fBmenubar\fR, or \fBtearoff\fR. Should not normally be
-called outside of the Tk library. See the \fBCLONES\fR section for
-more information.
-.TP
-\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
-Query or modify the configuration options of the widget.
-If no \fIoption\fR is specified, returns a list describing all of
-the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
-information on the format of this list). If \fIoption\fR is specified
-with no \fIvalue\fR, then the command returns a list describing the
-one named option (this list will be identical to the corresponding
-sublist of the value returned if no \fIoption\fR is specified). If
-one or more \fIoption\-value\fR pairs are specified, then the command
-modifies the given widget option(s) to have the given value(s); in
-this case the command returns an empty string.
-\fIOption\fR may have any of the values accepted by the \fBmenu\fR
-command.
-.TP
-\fIpathName \fBdelete \fIindex1\fR ?\fIindex2\fR?
-Delete all of the menu entries between \fIindex1\fR and
-\fIindex2\fR inclusive.
-If \fIindex2\fR is omitted then it defaults to \fIindex1\fR.
-Attempts to delete a tear-off menu entry are ignored (instead, you
-should change the \fBtearOff\fR option to remove the tear-off entry).
-.TP
-\fIpathName \fBentrycget\fR \fIindex option\fR
-Returns the current value of a configuration option for
-the entry given by \fIindex\fR.
-\fIOption\fR may have any of the values accepted by the \fBadd\fR
-widget command.
-.TP
-\fIpathName \fBentryconfigure \fIindex \fR?\fIoptions\fR?
-This command is similar to the \fBconfigure\fR command, except that
-it applies to the options for an individual entry, whereas \fBconfigure\fR
-applies to the options for the menu as a whole.
-\fIOptions\fR may have any of the values accepted by the \fBadd\fR
-widget command. If \fIoptions\fR are specified, options are modified
-as indicated
-in the command and the command returns an empty string.
-If no \fIoptions\fR are specified, returns a list describing
-the current options for entry \fIindex\fR (see \fBTk_ConfigureInfo\fR for
-information on the format of this list).
-.TP
-\fIpathName \fBindex \fIindex\fR
-Returns the numerical index corresponding to \fIindex\fR, or
-\fBnone\fR if \fIindex\fR was specified as \fBnone\fR.
-.TP
-\fIpathName \fBinsert \fIindex\fR \fItype \fR?\fIoption value option value ...\fR?
-Same as the \fBadd\fR widget command except that it inserts the new
-entry just before the entry given by \fIindex\fR, instead of appending
-to the end of the menu. The \fItype\fR, \fIoption\fR, and \fIvalue\fR
-arguments have the same interpretation as for the \fBadd\fR widget
-command. It is not possible to insert new menu entries before the
-tear-off entry, if the menu has one.
-.TP
-\fIpathName \fBinvoke \fIindex\fR
-Invoke the action of the menu entry. See the sections on the
-individual entries above for details on what happens. If the
-menu entry is disabled then nothing happens. If the
-entry has a command associated with it then the result of that
-command is returned as the result of the \fBinvoke\fR widget
-command. Otherwise the result is an empty string. Note: invoking
-a menu entry does not automatically unpost the menu; the default
-bindings normally take care of this before invoking the \fBinvoke\fR
-widget command.
-.TP
-\fIpathName \fBpost \fIx y\fR
-Arrange for the menu to be displayed on the screen at the root-window
-coordinates given by \fIx\fR and \fIy\fR. These coordinates are
-adjusted if necessary to guarantee that the entire menu is visible on
-the screen. This command normally returns an empty string.
-If the \fBpostCommand\fR option has been specified, then its value is
-executed as a Tcl script before posting the menu and the result of
-that script is returned as the result of the \fBpost\fR widget
-command.
-If an error returns while executing the command, then the error is
-returned without posting the menu.
-.TP
-\fIpathName \fBpostcascade \fIindex\fR
-Posts the submenu associated with the cascade entry given by
-\fIindex\fR, and unposts any previously posted submenu.
-If \fIindex\fR does not correspond to a cascade entry,
-or if \fIpathName\fR is not posted,
-the command has no effect except to unpost any currently posted
-submenu.
-.TP
-\fIpathName \fBtype \fIindex\fR
-Returns the type of the menu entry given by \fIindex\fR.
-This is the \fItype\fR argument passed to the \fBadd\fR widget
-command when the entry was created, such as \fBcommand\fR
-or \fBseparator\fR, or \fBtearoff\fR for a tear-off entry.
-.TP
-\fIpathName \fBunpost\fR
-Unmap the window so that it is no longer displayed. If a
-lower-level cascaded menu is posted, unpost that menu. Returns an
-empty string. This subcommand does not work on Windows and the
-Macintosh, as those platforms have their own way of unposting menus.
-.TP
-\fIpathName \fBxposition \fIindex\fR
-.VS 8.5
-Returns a decimal string giving the x-coordinate within the menu
-window of the leftmost pixel in the entry specified by \fIindex\fR.
-.VE 8.5
-.TP
-\fIpathName \fByposition \fIindex\fR
-Returns a decimal string giving the y-coordinate within the menu
-window of the topmost pixel in the entry specified by \fIindex\fR.
.SH "MENU CONFIGURATIONS"
.PP
The default bindings support four different ways of using menus:
.TP
\fBPulldown Menus in Menubar\fR
+.
This is the most common case. You create a menu widget that will become the
menu bar. You then add cascade entries to this menu, specifying the
pull down menus you wish to use in your menu bar. You then create all
@@ -648,6 +720,7 @@ of the pulldowns. Once you have done this, specify the menu using the
\fBtoplevel\fR manual entry for details.
.TP
\fBPulldown Menus in Menu Buttons\fR
+.
This is the compatible way to do menu bars. You create one menubutton
widget for each top-level menu, and typically you arrange a series of
menubuttons in a row in a menubar window. You also create the top-level menus
@@ -659,12 +732,14 @@ will allow users to traverse and invoke the tree of menus via its
menubutton; see the \fBmenubutton\fR manual entry for details.
.TP
\fBPopup Menus\fR
+.
Popup menus typically post in response to a mouse button press or
keystroke. You create the popup menus and any cascaded submenus,
then you call the \fBtk_popup\fR procedure at the appropriate time
to post the top-level menu.
.TP
\fBOption Menus\fR
+.
An option menu consists of a menubutton with an associated menu
that allows you to select one of several values. The current value
is displayed in the menubutton and is also stored in a global
@@ -672,6 +747,7 @@ variable. Use the \fBtk_optionMenu\fR procedure to create option
menubuttons and their menus.
.TP
\fBTorn-off Menus\fR
+.
You create a torn-off menu by invoking the tear-off entry at
the top of an existing menu. The default bindings will create a new menu
that is a copy of the original menu and leave it permanently
@@ -746,3 +822,6 @@ entries.
bind(n), menubutton(n), ttk::menubutton(n), toplevel(n)
.SH KEYWORDS
menu, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/menubar.n b/doc/menubar.n
index 34fd2e7..0f6dd83 100644
--- a/doc/menubar.n
+++ b/doc/menubar.n
@@ -16,7 +16,6 @@ tk_menuBar, tk_bindForTraversal \- Obsolete support for menu bars
.sp
\fBtk_bindForTraversal \fIarg arg ... \fR
.BE
-
.SH DESCRIPTION
.PP
These procedures were used in Tk 3.6 and earlier releases to help
@@ -30,9 +29,10 @@ procedures will go away.
From Tk 8.0 onwards, you should instead construct your menubar as a
normal \fBmenu\fR and then attach it to the \fBtoplevel\fR of your
choice using the \fB\-menu\fR option of that widget.
-
.SH "SEE ALSO"
menu(n), toplevel(n)
-
.SH KEYWORDS
keyboard traversal, menu, menu bar, post
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/menubutton.n b/doc/menubutton.n
index ade9523..c8b0958 100644
--- a/doc/menubutton.n
+++ b/doc/menubutton.n
@@ -53,12 +53,12 @@ Specifies one of three states for the menubutton: \fBnormal\fR, \fBactive\fR,
or \fBdisabled\fR. In normal state the menubutton is displayed using the
\fBforeground\fR and \fBbackground\fR options. The active state is
typically used when the pointer is over the menubutton. In active state
-the menubutton is displayed using the \fBactiveForeground\fR and
-\fBactiveBackground\fR options. Disabled state means that the menubutton
+the menubutton is displayed using the \fB\-activeforeground\fR and
+\fB\-activebackground\fR options. Disabled state means that the menubutton
should be insensitive: the default bindings will refuse to activate
the widget and will ignore mouse button presses.
-In this state the \fBdisabledForeground\fR and
-\fBbackground\fR options determine how the button is displayed.
+In this state the \fB\-disabledforeground\fR and
+\fB\-background\fR options determine how the button is displayed.
.OP \-width width Width
Specifies a desired width for the menubutton.
If an image or bitmap is being displayed in the menubutton then the value is in
@@ -84,9 +84,9 @@ A menubutton is a widget that displays a textual string, bitmap, or image
and is associated with a menu widget.
If text is displayed, it must all be in a single font, but it
can occupy multiple lines on the screen (if it contains newlines
-or if wrapping occurs because of the \fBwrapLength\fR option) and
+or if wrapping occurs because of the \fB\-wraplength\fR option) and
one of the characters may optionally be underlined using the
-\fBunderline\fR option. In normal usage, pressing
+\fB\-underline\fR option. In normal usage, pressing
mouse button 1 over the menubutton causes the associated menu to
be posted just underneath the menubutton. If the mouse is moved over
the menu before releasing the mouse button, the button release
@@ -117,7 +117,7 @@ operations on the widget. It has the following general form:
determine the exact behavior of the command. The following
commands are possible for menubutton widgets:
.TP
-\fIpathName \fBcget\fR \fIoption\fR
+\fIpathName \fBcget \fIoption\fR
Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBmenubutton\fR
@@ -168,7 +168,7 @@ When a menubutton is posted, its associated menu claims the input
focus to allow keyboard traversal of the menu and its submenus.
See the \fBmenu\fR manual entry for details on these bindings.
.IP [7]
-If the \fBunderline\fR option has been specified for a menubutton
+If the \fB\-underline\fR option has been specified for a menubutton
then keyboard traversal may be used to post the menubutton:
Alt+\fIx\fR, where \fIx\fR is the underlined character (or its
lower-case or upper-case equivalent), may be typed in any window
@@ -189,3 +189,6 @@ individual widgets or by redefining the class bindings.
ttk::menubutton(n), menu(n)
.SH KEYWORDS
menubutton, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/message.n b/doc/message.n
index 92434f0..61be2f0 100644
--- a/doc/message.n
+++ b/doc/message.n
@@ -28,37 +28,37 @@ aspect ratio for the text. The aspect ratio is specified as
be as wide as it is tall, 200 means the text should
be twice as wide as it is tall, 50 means the text should
be twice as tall as it is wide, and so on.
-Used to choose line length for text if \fBwidth\fR option
+Used to choose line length for text if \fB\-width\fR option
is not specified.
Defaults to 150.
.OP \-justify justify Justify
Specifies how to justify lines of text.
Must be one of \fBleft\fR, \fBcenter\fR, or \fBright\fR. Defaults
to \fBleft\fR.
-This option works together with the \fBanchor\fR, \fBaspect\fR,
-\fBpadX\fR, \fBpadY\fR, and \fBwidth\fR options to provide a variety
+This option works together with the \fB\-anchor\fR, \fB\-aspect\fR,
+\fB\-padx\fR, \fB\-pady\fR, and \fB\-width\fR options to provide a variety
of arrangements of the text within the window.
-The \fBaspect\fR and \fBwidth\fR options determine the amount of
+The \fB\-aspect\fR and \fB\-width\fR options determine the amount of
screen space needed to display the text.
-The \fBanchor\fR, \fBpadX\fR, and \fBpadY\fR options determine where this
+The \fB\-anchor\fR, \fB\-padx\fR, and \fB\-pady\fR options determine where this
rectangular area is displayed within the widget's window, and the
-\fBjustify\fR option determines how each line is displayed within that
+\fB\-justify\fR option determines how each line is displayed within that
rectangular region.
-For example, suppose \fBanchor\fR is \fBe\fR and \fBjustify\fR is
+For example, suppose \fB\-anchor\fR is \fBe\fR and \fB\-justify\fR is
\fBleft\fR, and that the message window is much larger than needed
for the text.
The text will be displayed so that the left edges of all the lines
-line up and the right edge of the longest line is \fBpadX\fR from
+line up and the right edge of the longest line is \fB\-padx\fR from
the right side of the window; the entire text block will be centered
in the vertical span of the window.
.OP \-width width Width
Specifies the length of lines in the window.
The value may have any of the forms acceptable to \fBTk_GetPixels\fR.
-If this option has a value greater than zero then the \fBaspect\fR
-option is ignored and the \fBwidth\fR option determines the line
+If this option has a value greater than zero then the \fB\-aspect\fR
+option is ignored and the \fB\-width\fR option determines the line
length.
If this option has a value less than or equal to zero, then
-the \fBaspect\fR option determines the line length.
+the \fB\-aspect\fR option determines the line length.
.BE
.SH DESCRIPTION
.PP
@@ -111,7 +111,7 @@ operations on the widget. It has the following general form:
determine the exact behavior of the command. The following
commands are possible for message widgets:
.TP
-\fIpathName \fBcget\fR \fIoption\fR
+\fIpathName \fBcget \fIoption\fR
Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBmessage\fR
@@ -142,3 +142,6 @@ The most common result is that the line is justified wrong.
label(n)
.SH KEYWORDS
message, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/messageBox.n b/doc/messageBox.n
index 5cdd26e..db24f76 100644
--- a/doc/messageBox.n
+++ b/doc/messageBox.n
@@ -13,7 +13,6 @@ tk_messageBox \- pops up a message window and waits for user response.
.SH SYNOPSIS
\fBtk_messageBox \fR?\fIoption value ...\fR?
.BE
-
.SH DESCRIPTION
.PP
This procedure creates and displays a message window with an
@@ -22,70 +21,84 @@ the buttons in the message window is identified by a unique symbolic
name (see the \fB\-type\fR options). After the message window is
popped up, \fBtk_messageBox\fR waits for the user to select one of the
buttons. Then it returns the symbolic name of the selected button.
-
+.PP
The following option-value pairs are supported:
.TP
\fB\-default\fR \fIname\fR
+.
\fIName\fR gives the symbolic name of the default button for
this message window (
.QW ok ,
.QW cancel ,
-and so on). See \fB\-type\fR
+and so on). See \fB\-type\fR
for a list of the symbolic names. If this option is not specified,
the first button in the dialog will be made the default.
.TP
\fB\-detail\fR \fIstring\fR
-.VS 8.5
+.
Specifies an auxiliary message to the main message given by the
-\fB\-message\fR option. Where supported by the underlying OS, the
-message detail will be presented in a less emphasized font than the
+\fB\-message\fR option. The message detail will be presented beneath the main
+message and, where supported by the OS, in a less emphasized font than the
main message.
-.VE 8.5
.TP
\fB\-icon\fR \fIiconImage\fR
+.
Specifies an icon to display. \fIIconImage\fR must be one of the
following: \fBerror\fR, \fBinfo\fR, \fBquestion\fR or
\fBwarning\fR. If this option is not specified, then the info icon will be
displayed.
.TP
\fB\-message\fR \fIstring\fR
-Specifies the message to display in this message box.
+.
+Specifies the message to display in this message box. This option is ignored
+on Mac OS X, where platform guidelines forbid the use of a title on this kind
+of dialog.
.TP
\fB\-parent\fR \fIwindow\fR
+.
Makes \fIwindow\fR the logical parent of the message box. The message
box is displayed on top of its parent window.
.TP
\fB\-title\fR \fItitleString\fR
+.
Specifies a string to display as the title of the message box. The
default value is an empty string.
.TP
\fB\-type\fR \fIpredefinedType\fR
+.
Arranges for a predefined set of buttons to be displayed. The
following values are possible for \fIpredefinedType\fR:
.RS
.TP 18
\fBabortretryignore\fR
+.
Displays three buttons whose symbolic names are \fBabort\fR,
\fBretry\fR and \fBignore\fR.
.TP 18
\fBok\fR
+.
Displays one button whose symbolic name is \fBok\fR.
.TP 18
\fBokcancel\fR
+.
Displays two buttons whose symbolic names are \fBok\fR and \fBcancel\fR.
.TP 18
\fBretrycancel\fR
+.
Displays two buttons whose symbolic names are \fBretry\fR and \fBcancel\fR.
.TP 18
\fByesno\fR
+.
Displays two buttons whose symbolic names are \fByes\fR and \fBno\fR.
.TP 18
\fByesnocancel\fR
+.
Displays three buttons whose symbolic names are \fByes\fR, \fBno\fR
and \fBcancel\fR.
.RE
.PP
.SH EXAMPLE
+.PP
.CS
set answer [\fBtk_messageBox\fR \-message "Really quit?" \e
\-icon question \-type yesno \e
@@ -96,6 +109,8 @@ switch \-\- $answer {
\-type ok}
}
.CE
-
.SH KEYWORDS
message box
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/option.n b/doc/option.n
index b7342e2..4b9a5a7 100644
--- a/doc/option.n
+++ b/doc/option.n
@@ -26,8 +26,8 @@ database or to retrieve options from the database. The \fBadd\fR
form of the command adds a new option to the database.
\fIPattern\fR contains
the option being specified, and consists of names and/or classes
-separated by asterisks or dots, in the usual X format (see \fBPATTERN
-FORMAT\fR). \fIValue\fR
+separated by asterisks or dots, in the usual X format (see
+\fBPATTERN FORMAT\fR). \fIValue\fR
contains a text string to associate with \fIpattern\fR; this is the
value that will be returned in calls to \fBTk_GetOption\fR or by
invocations of the \fBoption get\fR command. If \fIpriority\fR
@@ -63,22 +63,18 @@ The \fIpriority\fR arguments to the \fBoption\fR command are
normally specified symbolically using one of the following values:
.TP
\fBwidgetDefault\fR
-.
Level 20. Used for default values hard-coded into widgets.
.TP
\fBstartupFile\fR
-.
Level 40. Used for options specified in application-specific
startup files.
.TP
\fBuserDefault\fR
-.
Level 60. Used for options specified in user-specific defaults
files, such as \fB.Xdefaults\fR, resource databases loaded into
the X server, or user-specific startup files.
.TP
\fBinteractive\fR
-.
Level 80. Used for options specified interactively after the application
starts running. If \fIpriority\fR is not specified, it defaults to
this level.
@@ -113,8 +109,10 @@ first word of the pattern is matched against the name and class of the
.QW \fB.\fR
\fBtoplevel\fR, which are usually set by options to \fBwish\fR.
.SH EXAMPLES
+.PP
Instruct every button in the application to have red text on it unless
-explicitly overridden (note that on some platforms the option is ignored):
+explicitly overridden, by setting the \fBforeground\fR for the \fBButton\fR
+class (note that on some platforms the option is ignored):
.CS
\fBoption add\fR *Button.foreground red startupFile
.CE
diff --git a/doc/optionMenu.n b/doc/optionMenu.n
index 1f9f831..1c01eb0 100644
--- a/doc/optionMenu.n
+++ b/doc/optionMenu.n
@@ -33,9 +33,13 @@ The return value from \fBtk_optionMenu\fR is the name of the menu
associated with \fIpathName\fR, so that the caller can change its
configuration options or manipulate it in other ways.
.SH EXAMPLE
+.PP
.CS
tk_optionMenu .foo myVar Foo Bar Boo Spong Wibble
pack .foo
.CE
.SH KEYWORDS
option menu
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/options.n b/doc/options.n
index 25b0c9d..456e1fd 100644
--- a/doc/options.n
+++ b/doc/options.n
@@ -12,8 +12,8 @@
.SH NAME
options \- Standard options supported by widgets
.BE
-
.SH DESCRIPTION
+.PP
This manual entry describes the common configuration options supported
by widgets in the Tk toolkit. Every widget does not necessarily support
every option (see the manual entries for individual widgets for a list
@@ -72,18 +72,18 @@ widget.
Specifies a bitmap to display in the widget, in any of the forms
acceptable to \fBTk_GetBitmap\fR.
The exact way in which the bitmap is displayed may be affected by
-other options such as \fBanchor\fR or \fBjustify\fR.
+other options such as \fB\-anchor\fR or \fB\-justify\fR.
Typically, if this option is specified then it overrides other
options that specify a textual value to display in the widget
-but this is controlled by the \fBcompound\fR option;
-the \fBbitmap\fR option may be reset to an empty string to re-enable
+but this is controlled by the \fB\-compound\fR option;
+the \fB\-bitmap\fR option may be reset to an empty string to re-enable
a text display.
-In widgets that support both \fBbitmap\fR and \fBimage\fR options,
-\fBimage\fR will usually override \fBbitmap\fR.
+In widgets that support both \fB\-bitmap\fR and \fB\-image\fR options,
+\fB\-image\fR will usually override \fB\-bitmap\fR.
.OP "\-borderwidth or \-bd" borderWidth BorderWidth
Specifies a non-negative value indicating the width
of the 3-D border to draw around the outside of the widget (if such a
-border is being drawn; the \fBrelief\fR option typically determines
+border is being drawn; the \fB\-relief\fR option typically determines
this). The value may also be used when drawing 3-D effects in the
interior of the widget.
The value may have any of the forms acceptable to \fBTk_GetPixels\fR.
@@ -139,10 +139,10 @@ If the value is zero, no focus highlight is drawn around the widget.
.OP \-image image Image
Specifies an image to display in the widget, which must have been
created with the \fBimage create\fR command.
-Typically, if the \fBimage\fR option is specified then it overrides other
+Typically, if the \fB\-image\fR option is specified then it overrides other
options that specify a bitmap or textual value to display in the
-widget, though this is controlled by the \fBcompound\fR option;
-the \fBimage\fR option may be reset to an empty string to re-enable
+widget, though this is controlled by the \fB\-compound\fR option;
+the \fB\-image\fR option may be reset to an empty string to re-enable
a bitmap or text display.
.OP \-insertbackground insertBackground Foreground
Specifies the color to use as background in the area covered by the
@@ -169,8 +169,8 @@ in each blink cycle.
Specifies a value indicating the total width of the insertion cursor.
The value may have any of the forms acceptable to \fBTk_GetPixels\fR.
If a border has been specified for the insertion
-cursor (using the \fBinsertBorderWidth\fR option), the border
-will be drawn inside the width specified by the \fBinsertWidth\fR
+cursor (using the \fB\-insertborderwidth\fR option), the border
+will be drawn inside the width specified by the \fB\-insertwidth\fR
option.
.OP \-jump jump Jump
For widgets with a slider that can be dragged to adjust a value,
@@ -235,7 +235,7 @@ Specifies the number of milliseconds a button or key must be held
down before it begins to auto-repeat. Used, for example, on the
up- and down-arrows in scrollbars.
.OP \-repeatinterval repeatInterval RepeatInterval
-Used in conjunction with \fBrepeatDelay\fR: once auto-repeat
+Used in conjunction with \fB\-repeatdelay\fR: once auto-repeat
begins, this option determines the number of milliseconds between
auto-repeats.
.OP \-selectbackground selectBackground Foreground
@@ -255,7 +255,7 @@ This option is typically used in text widgets, where the information
in the widget has a natural size (the size of a character) and it makes
sense for the window's dimensions to be integral numbers of these units.
These natural window sizes form a grid.
-If the \fBsetGrid\fR option is set to true then the widget will
+If the \fB\-setgrid\fR option is set to true then the widget will
communicate with the window manager so that when the user interactively
resizes the top-level window that contains the widget, the dimensions of
the window will be displayed to the user in grid units and the window
@@ -266,7 +266,7 @@ entry for more details.
Determines whether the window accepts the focus during keyboard
traversal (e.g., Tab and Shift-Tab).
Before setting the focus to a window, the traversal scripts
-consult the value of the \fBtakeFocus\fR option.
+consult the value of the \fB\-takefocus\fR option.
A value of \fB0\fR means that the window should be skipped entirely
during keyboard traversal.
\fB1\fR means that the window should receive the input
@@ -289,14 +289,14 @@ redefine the keyboard traversal scripts.
.OP \-text text Text
Specifies a string to be displayed inside the widget. The way in which
the string is displayed depends on the particular widget and may be
-determined by other options, such as \fBanchor\fR or \fBjustify\fR.
+determined by other options, such as \fB\-anchor\fR or \fB\-justify\fR.
.OP \-textvariable textVariable Variable
Specifies the name of a global variable. The value of the variable is a text
string to be displayed inside the widget; if the variable value changes
then the widget will automatically update itself to reflect the new value.
The way in which the string is displayed in the widget depends on the
particular widget and may be determined by other options, such as
-\fBanchor\fR or \fBjustify\fR.
+\fB\-anchor\fR or \fB\-justify\fR.
.OP \-troughcolor troughColor Background
Specifies the color to use for the rectangular trough areas
in widgets such as scrollbars and scales. This option is ignored for
@@ -334,7 +334,7 @@ that is visible in the window, and the second fraction indicates
the information just after the last portion that is visible.
The command is
then passed to the Tcl interpreter for execution. Typically the
-\fBxScrollCommand\fR option consists of the path name of a scrollbar
+\fB\-xscrollcommand\fR option consists of the path name of a scrollbar
widget followed by
.QW set ,
e.g.
@@ -345,13 +345,14 @@ If this option is not specified, then no command will be executed.
.OP \-yscrollcommand yScrollCommand ScrollCommand
Specifies the prefix for a command used to communicate with vertical
scrollbars. This option is treated in the same way as the
-\fBxScrollCommand\fR option, except that it is used for vertical
+\fB\-xscrollcommand\fR option, except that it is used for vertical
scrollbars and is provided by widgets that support vertical scrolling.
-See the description of \fBxScrollCommand\fR for details
+See the description of \fB\-xscrollcommand\fR for details
on how this option is used.
-
.SH "SEE ALSO"
colors, cursors, font
-
.SH KEYWORDS
class, name, standard option, switch
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/pack-old.n b/doc/pack-old.n
index 532b4ae..a027b1f 100644
--- a/doc/pack-old.n
+++ b/doc/pack-old.n
@@ -20,7 +20,6 @@ pack-old \- Obsolete syntax for packer geometry manager
.sp
\fBpack unpack \fIwindow\fR
.BE
-
.SH DESCRIPTION
.PP
\fINote: this manual entry describes the syntax for the \fBpack\fI
@@ -189,6 +188,8 @@ The packer makes geometry requests on behalf of the parent windows
it manages. For each parent window it requests a size large enough
to accommodate all the options specified by all the packed children,
such that zero space would be leftover for \fBexpand\fR options.
-
.SH KEYWORDS
geometry manager, location, packer, parcel, size
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/pack.n b/doc/pack.n
index 73e4872..acb2957 100644
--- a/doc/pack.n
+++ b/doc/pack.n
@@ -14,7 +14,6 @@ pack \- Geometry manager that packs around edges of cavity
.SH SYNOPSIS
\fBpack \fIoption arg \fR?\fIarg ...\fR?
.BE
-
.SH DESCRIPTION
.PP
The \fBpack\fR command is used to communicate with the packer,
@@ -259,6 +258,7 @@ will be highest in the stacking order.
Or, you can use the \fBraise\fR and \fBlower\fR commands to change
the stacking order of either the master or the slave.
.SH EXAMPLE
+.PP
.CS
# Make the widgets
label .t \-text "This widget is at the top" \-bg red
@@ -274,9 +274,10 @@ text .mid
\fBpack\fR .r \-side right \-fill y
\fBpack\fR .mid \-expand 1 \-fill both
.CE
-
.SH "SEE ALSO"
grid(n), place(n)
-
.SH KEYWORDS
geometry manager, location, packer, parcel, propagation, size
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/palette.n b/doc/palette.n
index 4b1dcff..d654959 100644
--- a/doc/palette.n
+++ b/doc/palette.n
@@ -17,7 +17,6 @@ tk_setPalette, tk_bisque \- Modify the Tk color palette
.sp
\fBtk_bisque\fR
.BE
-
.SH DESCRIPTION
.PP
The \fBtk_setPalette\fR procedure changes the color scheme for Tk.
@@ -67,6 +66,8 @@ The procedure \fBtk_bisque\fR is provided for backward compatibility:
it restores the application's colors to the light brown
.PQ bisque
color scheme used in Tk 3.6 and earlier versions.
-
.SH KEYWORDS
bisque, color, palette
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/panedwindow.n b/doc/panedwindow.n
index ccc87e7..17d5730 100644
--- a/doc/panedwindow.n
+++ b/doc/panedwindow.n
@@ -81,7 +81,8 @@ the panedwindow widget's path name. \fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command. The following
commands are possible for panedwindow widgets:
.TP
-\fIpathName \fBadd \fIwindow ?window ...? ?option value ...?\fR
+\fIpathName \fBadd \fIwindow \fR?\fIwindow ...\fR? ?\fIoption value ...\fR?
+.
Add one or more windows to the panedwindow, each in a separate pane.
The arguments consist of the names of one or more windows
followed by pairs of arguments that specify how to manage the windows.
@@ -89,11 +90,13 @@ followed by pairs of arguments that specify how to manage the windows.
\fBconfigure\fR subcommand.
.TP
\fIpathName \fBcget \fIoption\fR
+.
Returns the current value of the configuration option given by
\fIoption\fR. \fIOption\fR may have any of the values accepted by the
\fBpanedwindow\fR command.
.TP
-\fIpathName \fBconfigure \fI?option? ?value option value ...?\fR
+\fIpathName \fBconfigure \fR?\fIoption\fR? ?\fIvalue option value ...\fR?
+.
Query or modify the configuration options of the widget. If no
\fIoption\fR is specified, returns a list describing all of the
available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
@@ -106,11 +109,13 @@ modifies the given widget option(s) to have the given value(s); in
this case the command returns an empty string. \fIOption\fR may have
any of the values accepted by the \fBpanedwindow\fR command.
.TP
-\fIpathName \fBforget \fIwindow ?window ...?\fR
+\fIpathName \fBforget \fIwindow \fR?\fIwindow ...\fR?
+.
Remove the pane containing \fIwindow\fR from the panedwindow. All
geometry management options for \fIwindow\fR will be forgotten.
.TP
\fIpathName \fBidentify \fIx y\fR
+.
Identify the panedwindow component underneath the point given by
\fIx\fR and \fIy\fR, in window coordinates. If the point is over a
sash or a sash handle, the result is a two element list containing the
@@ -118,53 +123,63 @@ index of the sash or handle, and a word indicating whether it is over
a sash or a handle, such as {0 sash} or {2 handle}. If the point is
over any other part of the panedwindow, the result is an empty list.
.TP
-\fIpathName \fBproxy \fI?args?\fR
+\fIpathName \fBproxy \fR?\fIargs\fR?
+.
This command is used to query and change the position of the sash
proxy, used for rubberband-style pane resizing. It can take any of
the following forms:
.RS
.TP
\fIpathName \fBproxy coord\fR
+.
Return a list containing the x and y coordinates of the most recent
proxy location.
.TP
\fIpathName \fBproxy forget\fR
+.
Remove the proxy from the display.
.TP
\fIpathName \fBproxy place \fIx y\fR
+.
Place the proxy at the given \fIx\fR and \fIy\fR coordinates.
.RE
.TP
-\fIpathName \fBsash \fI?args?\fR
+\fIpathName \fBsash \fR?\fIargs\fR?
This command is used to query and change the position of sashes in the
panedwindow. It can take any of the following forms:
.RS
.TP
\fIpathName \fBsash coord \fIindex\fR
+.
Return the current x and y coordinate pair for the sash given by
\fIindex\fR. \fIIndex\fR must be an integer between 0 and 1 less than
the number of panes in the panedwindow. The coordinates given are
those of the top left corner of the region containing the sash.
.TP
\fIpathName \fBsash dragto \fIindex x y\fR
+.
This command computes the difference between the given coordinates and the
coordinates given to the last \fBsash mark\fR command for the given
sash. It then moves that sash the computed difference. The return
value is the empty string.
.TP
\fIpathName \fBsash mark \fIindex x y\fR
+.
Records \fIx\fR and \fIy\fR for the sash given by \fIindex\fR; used in
conjunction with later \fBsash dragto\fR commands to move the sash.
.TP
\fIpathName \fBsash place \fIindex x y\fR
+.
Place the sash given by \fIindex\fR at the given coordinates.
.RE
.TP
\fIpathName \fBpanecget \fIwindow option\fR
+.
Query a management option for \fIwindow\fR. \fIOption\fR may be any
value allowed by the \fBpaneconfigure\fR subcommand.
.TP
-\fIpathName \fBpaneconfigure \fIwindow ?option? ?value option value ...?\fR
+\fIpathName \fBpaneconfigure \fIwindow \fR?\fIoption\fR? ?\fIvalue option value ...\fR?
+.
Query or modify the management options for \fIwindow\fR. If no
\fIoption\fR is specified, returns a list describing all of the
available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
@@ -179,14 +194,17 @@ are supported:
.RS
.TP
\fB\-after \fIwindow\fR
+.
Insert the window after the window specified. \fIwindow\fR should be the
name of a window already managed by \fIpathName\fR.
.TP
\fB\-before \fIwindow\fR
+.
Insert the window before the window specified. \fIwindow\fR should be
the name of a window already managed by \fIpathName\fR.
.TP
\fB\-height \fIsize\fR
+.
Specify a height for the window. The height will be the outer
dimension of the window including its border, if any. If \fIsize\fR
is an empty string, or if \fB\-height\fR is not specified, then the
@@ -195,13 +213,13 @@ height may later be adjusted by the movement of sashes in the
panedwindow. \fISize\fR may be any value accepted by \fBTk_GetPixels\fR.
.TP
\fB\-hide \fIboolean\fR
-.VS 8.5
+.
Controls the visibility of a pane. When the \fIboolean\fR is true
(according to \fBTcl_GetBoolean\fR) the pane will not be visible, but
it will still be maintained in the list of panes.
-.VE 8.5
.TP
\fB\-minsize \fIn\fR
+.
Specifies that the size of the window cannot be made less than
\fIn\fR. This constraint only affects the size of the widget in the
paned dimension \(em the x dimension for horizontal panedwindows, the y
@@ -209,16 +227,19 @@ dimension for vertical panedwindows. May be any value accepted by
\fBTk_GetPixels\fR.
.TP
\fB\-padx \fIn\fR
+.
Specifies a non-negative value indicating how much extra space to
leave on each side of the window in the X-direction. The value may
have any of the forms accepted by \fBTk_GetPixels\fR.
.TP
\fB\-pady \fIn\fR
+.
Specifies a non-negative value indicating how much extra space to
leave on each side of the window in the Y-direction. The value may
have any of the forms accepted by \fBTk_GetPixels\fR.
.TP
\fB\-sticky \fIstyle\fR
+.
If a window's pane is larger than the requested dimensions of the
window, this option may be used to position (or stretch) the window
within its pane. \fIStyle\fR is a string that contains zero or more
@@ -232,7 +253,7 @@ are specified, the window will be stretched to fill the entire height
(or width) of its cavity.
.TP
\fB\-stretch \fIwhen\fR
-.VS 8.5
+.
Controls how extra space is allocated to each of the panes.
\fIWhen\fR is one of \fBalways\fR, \fBfirst\fR, \fBlast\fR,
\fBmiddle\fR, and \fBnever\fR.
@@ -244,25 +265,30 @@ definition:
.RS
.TP
\fBalways\fR
+.
This pane will always stretch.
.TP
\fBfirst\fR
-Only if this pane is the first pane (left-most or top-most) will it
+.
+Only if this pane is the first pane (left-most or top-most) will it
stretch.
.TP
\fBlast\fR
-Only if this pane is the last pane (right-most or bottom-most) will it
+.
+Only if this pane is the last pane (right-most or bottom-most) will it
stretch. This is the default value.
.TP
\fBmiddle\fR
+.
Only if this pane is not the first or last pane will it stretch.
.TP
\fBnever\fR
+.
This pane will never stretch.
.RE
-.VE 8.5
.TP
\fB\-width \fIsize\fR
+.
Specify a width for the window. The width will be the outer
dimension of the window including its border, if any. If \fIsize\fR
is an empty string, or if \fB\-width\fR is not specified, then the
@@ -272,8 +298,10 @@ panedwindow. \fISize\fR may be any value accepted by \fBTk_GetPixels\fR.
.RE
.TP
\fIpathName \fBpanes\fR
+.
Returns an ordered list of the widgets managed by \fIpathName\fR.
.SH "RESIZING PANES"
+.PP
A pane is resized by grabbing the sash (or sash handle if present) and
dragging with the mouse. This is accomplished via mouse motion
bindings on the widget. When a sash is moved, the sizes of the panes
@@ -287,3 +315,6 @@ fill, and the containing toplevel is resized), space is added to the final
ttk::panedwindow(n)
.SH KEYWORDS
panedwindow, widget, geometry management
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/photo.n b/doc/photo.n
index c14abe3..f54dc2e 100644
--- a/doc/photo.n
+++ b/doc/photo.n
@@ -16,9 +16,22 @@
.SH NAME
photo \- Full-color images
.SH SYNOPSIS
+.nf
\fBimage create photo \fR?\fIname\fR? ?\fIoptions\fR?
-.BE
+\fIimageName \fBblank\fR
+\fIimageName \fBcget \fIoption\fR
+\fIimageName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+\fIimageName \fBcopy \fIsourceImage\fR ?\fIoption value(s) ...\fR?
+\fIimageName \fBdata\fR ?\fIoption value(s) ...\fR?
+\fIimageName \fBget \fIx y\fR
+\fIimageName \fBput \fIdata\fR ?\fIoption value(s) ...\fR?
+\fIimageName \fBread \fIfilename\fR ?\fIoption value(s) ...\fR?
+\fIimageName \fBredither\fR
+\fIimageName \fBtransparency \fIsubcommand \fR?\fIarg arg ...\fR?
+\fIimageName \fBwrite \fIfilename\fR ?\fIoption value(s) ...\fR?
+.fi
+.BE
.SH DESCRIPTION
.PP
A photo is an image whose pixels can display any color or be
@@ -26,7 +39,11 @@ transparent. A photo image is stored internally in full color (32
bits per pixel), and is displayed using dithering if necessary. Image
data for a photo image can be obtained from a file or a string, or it
can be supplied from
-C code through a procedural interface. At present, only GIF and PPM/PGM
+C code through a procedural interface. At present, only
+.VS 8.6
+PNG,
+.VE 8.6
+GIF and PPM/PGM
formats are supported, but an interface exists to allow additional
image file formats to be added easily. A photo image is transparent
in regions where no image data has been supplied
@@ -39,24 +56,29 @@ command.
Photos support the following \fIoptions\fR:
.TP
\fB\-data \fIstring\fR
+.
Specifies the contents of the image as a string. The string should
contain binary data or, for some formats, base64-encoded data (this is
-currently guaranteed to be supported for GIF images). The format of the
+currently guaranteed to be supported for PNG and GIF images). The
+format of the
string must be one of those for which there is an image file format
handler that will accept string data. If both the \fB\-data\fR
and \fB\-file\fR options are specified, the \fB\-file\fR option takes
precedence.
.TP
\fB\-format \fIformat-name\fR
+.
Specifies the name of the file format for the data specified with the
\fB\-data\fR or \fB\-file\fR option.
.TP
\fB\-file \fIname\fR
+.
\fIname\fR gives the name of a file that is to be read to supply data
for the photo image. The file format must be one of those for which
there is an image file format handler that can read data.
.TP
\fB\-gamma \fIvalue\fR
+.
Specifies that the colors allocated for displaying this image in a
window should be corrected for a non-linear display with the specified
gamma exponent value. (The intensity produced by most
@@ -68,12 +90,14 @@ will make the image lighter, and values less than one will make it
darker.
.TP
\fB\-height \fInumber\fR
+.
Specifies the height of the image, in pixels. This option is useful
primarily in situations where the user wishes to build up the contents
of the image piece by piece. A value of zero (the default) allows the
image to expand or shrink vertically to fit the data stored in it.
.TP
\fB\-palette \fIpalette-spec\fR
+.
Specifies the resolution of the color cube to be allocated for
displaying this image, and thus the number of colors used from the
colormaps of the windows where it is displayed. The
@@ -85,6 +109,7 @@ number) is used, the image will be displayed in monochrome (i.e.,
grayscale).
.TP
\fB\-width \fInumber\fR
+.
Specifies the width of the image, in pixels. This option is useful
primarily in situations where the user wishes to build up the contents
of the image piece by piece. A value of zero (the default) allows the
@@ -112,17 +137,20 @@ changed.
The following commands are possible for photo images:
.TP
\fIimageName \fBblank\fR
+.
Blank the image; that is, set the entire image to have no data, so it
will be displayed as transparent, and the background of whatever
window it is displayed in will show through.
.TP
\fIimageName \fBcget\fR \fIoption\fR
+.
Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the
-\fBimage create photo\fR command.
+\fBimage create\fR \fBphoto\fR command.
.TP
\fIimageName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+.
Query or modify the configuration options for the image.
If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIimageName\fR (see \fBTk_ConfigureInfo\fR for
@@ -134,9 +162,10 @@ one or more \fIoption\-value\fR pairs are specified, then the command
modifies the given option(s) to have the given value(s); in
this case the command returns an empty string.
\fIOption\fR may have any of the values accepted by the
-\fBimage create photo\fR command.
+\fBimage create\fR \fBphoto\fR command.
.TP
\fIimageName \fBcopy\fR \fIsourceImage\fR ?\fIoption value(s) ...\fR?
+.
Copies a region from the image called \fIsourceImage\fR (which must
be a photo image) to the image called \fIimageName\fR, possibly with
pixel zooming and/or subsampling. If no options are specified, this
@@ -146,6 +175,7 @@ options may be specified:
.RS
.TP
\fB\-from \fIx1 y1 x2 y2\fR
+.
Specifies a rectangular sub-region of the source image to be copied.
(\fIx1,y1\fR) and (\fIx2,y2\fR) specify diagonally opposite corners of
the rectangle. If \fIx2\fR and \fIy2\fR are not specified, the
@@ -155,6 +185,7 @@ rectangle but not the bottom or right edges. If the \fB\-from\fR
option is not given, the default is the whole source image.
.TP
\fB\-to \fIx1 y1 x2 y2\fR
+.
Specifies a rectangular sub-region of the destination image to be
affected. (\fIx1,y1\fR) and (\fIx2,y2\fR) specify diagonally opposite
corners of the rectangle. If \fIx2\fR and \fIy2\fR are not specified,
@@ -164,6 +195,7 @@ region (after subsampling and zooming, if specified). If \fIx2\fR and
necessary to fill the destination region in a tiled fashion.
.TP
\fB\-shrink\fR
+.
Specifies that the size of the destination image should be reduced, if
necessary, so that the region being copied into is at the bottom-right
corner of the image. This option will not affect the width or height
@@ -171,6 +203,7 @@ of the image if the user has specified a non-zero value for the
\fB\-width\fR or \fB\-height\fR configuration option, respectively.
.TP
\fB\-zoom \fIx y\fR
+.
Specifies that the source region should be magnified by a factor of
\fIx\fR in the X direction and \fIy\fR in the Y direction. If \fIy\fR
is not given, the default value is the same as \fIx\fR. With this
@@ -179,6 +212,7 @@ of \fIx\fR x \fIy\fR pixels in the destination image, all the same
color. \fIx\fR and \fIy\fR must be greater than 0.
.TP
\fB\-subsample \fIx y\fR
+.
Specifies that the source image should be reduced in size by using
only every \fIx\fRth pixel in the X direction and \fIy\fRth pixel in
the Y direction. Negative values will cause the image to be flipped
@@ -186,6 +220,7 @@ about the Y or X axes, respectively. If \fIy\fR is not given, the
default value is the same as \fIx\fR.
.TP
\fB\-compositingrule \fIrule\fR
+.
Specifies how transparent pixels in the source image are combined with
the destination image. When a compositing rule of \fIoverlay\fR is
set, the old contents of the destination image are visible, as if the
@@ -196,17 +231,20 @@ the source image is used as-is. The default compositing rule is
\fIoverlay\fR.
.RE
.TP
-\fIimageName \fBdata ?\fIoption value(s) ...\fR?
+\fIimageName \fBdata\fR ?\fIoption value(s) ...\fR?
+.
Returns image data in the form of a string. The following options
may be specified:
.RS
.TP
\fB\-background\fI color\fR
+.
If the color is specified, the data will not contain any transparency
information. In all transparent pixels the color will be replaced by
the specified color.
.TP
\fB\-format\fI format-name\fR
+.
Specifies the name of the image file format handler to be used.
Specifically, this subcommand searches
for the first handler whose name matches an initial substring of
@@ -220,6 +258,7 @@ format (where \fIrr\fR is a pair of hexadecimal digits for the red
channel, \fIgg\fR for green, and \fIbb\fR for blue).
.TP
\fB\-from \fIx1 y1 x2 y2\fR
+.
Specifies a rectangular region of \fIimageName\fR to be returned.
If only \fIx1\fR and \fIy1\fR are specified, the region
extends from \fI(x1,y1)\fR to the bottom-right corner of
@@ -229,16 +268,19 @@ and excluding x2,y2. The default, if this option is not given, is the
whole image.
.TP
\fB\-grayscale\fR
+.
If this options is specified, the data will not contain color
information. All pixel data will be transformed into grayscale.
.RE
.TP
\fIimageName \fBget\fR \fIx y\fR
+.
Returns the color of the pixel at coordinates (\fIx\fR,\fIy\fR) in the
image as a list of three integers between 0 and 255, representing the
red, green and blue components respectively.
.TP
\fIimageName \fBput\fR \fIdata\fR ?\fIoption value(s) ...\fR?
+.
Sets pixels in \fI imageName\fR to the data specified in \fIdata\fR.
This command first searches the list of image file format handlers for
a handler that can interpret the data in \fIdata\fR, and then reads
@@ -253,12 +295,14 @@ that color. The following options may be specified:
.RS
.TP
\fB\-format \fIformat-name\fR
+.
Specifies the format of the image data in \fIdata\fR.
Specifically, only image file format handlers whose names begin with
\fIformat-name\fR will be used while searching for an image data
format handler to read the data.
.TP
\fB\-to \fIx1 y1\fR ?\fIx2 y2\fR?
+.
Specifies the coordinates of the top-left corner (\fIx1\fR,\fIy1\fR)
of the region of \fIimageName\fR into which the image data will be
copied. The default position is (0,0). If \fIx2\fR,\fIy2\fR is given
@@ -270,6 +314,7 @@ represented by (\fIx2\fR,\fIy2\fR) will be filled with that color.
.RE
.TP
\fIimageName \fBread\fR \fIfilename\fR ?\fIoption value(s) ...\fR?
+.
Reads image data from the file named \fIfilename\fR into the image.
This command first searches the list of
image file format handlers for a handler that can interpret the data
@@ -279,12 +324,14 @@ specified:
.RS
.TP
\fB\-format \fIformat-name\fR
+.
Specifies the format of the image data in \fIfilename\fR.
Specifically, only image file format handlers whose names begin with
\fIformat-name\fR will be used while searching for an image data
format handler to read the data.
.TP
\fB\-from \fIx1 y1 x2 y2\fR
+.
Specifies a rectangular sub-region of the image file data to be copied
to the destination image. If only \fIx1\fR and \fIy1\fR are
specified, the region extends from (\fIx1,y1\fR) to the bottom-right
@@ -294,6 +341,7 @@ The default, if this option is not specified, is the whole of the
image in the image file.
.TP
\fB\-shrink\fR
+.
If this option, the size of \fIimageName\fR will be reduced, if
necessary, so that the region into which the image file data are read
is at the bottom-right corner of the \fIimageName\fR. This option
@@ -302,12 +350,14 @@ specified a non-zero value for the \fB\-width\fR or \fB\-height\fR
configuration option, respectively.
.TP
\fB\-to \fIx y\fR
+.
Specifies the coordinates of the top-left corner of the region of
\fIimageName\fR into which data from \fIfilename\fR are to be read.
The default is (0,0).
.RE
.TP
\fIimageName \fBredither\fR
+.
The dithering algorithm used in displaying photo images propagates
quantization errors from one pixel to its neighbors.
If the image data for \fIimageName\fR is supplied in pieces, the
@@ -316,39 +366,47 @@ not noticeable, but if it is a problem, this command can be used to
recalculate the dithered image in each window where the image is
displayed.
.TP
-\fIimageName \fBtransparency \fIsubcommand ?arg arg ...?\fR
+\fIimageName \fBtransparency \fIsubcommand \fR?\fIarg arg ...\fR?
+.
Allows examination and manipulation of the transparency information in
the photo image. Several subcommands are available:
.RS
.TP
\fIimageName \fBtransparency get \fIx y\fR
+.
Returns a boolean indicating if the pixel at (\fIx\fR,\fIy\fR) is
transparent.
.TP
\fIimageName \fBtransparency set \fIx y boolean\fR
+.
Makes the pixel at (\fIx\fR,\fIy\fR) transparent if \fIboolean\fR is
true, and makes that pixel opaque otherwise.
.RE
.TP
\fIimageName \fBwrite \fIfilename\fR ?\fIoption value(s) ...\fR?
+.
Writes image data from \fIimageName\fR to a file named \fIfilename\fR.
The following options may be specified:
.RS
.TP
\fB\-background\fI color\fR
+.
If the color is specified, the data will not contain any transparency
information. In all transparent pixels the color will be replaced by
the specified color.
.TP
\fB\-format\fI format-name\fR
+.
Specifies the name of the image file format handler to be used to
write the data to the file. Specifically, this subcommand searches
for the first handler whose name matches an initial substring of
\fIformat-name\fR and which has the capability to write an image
-file. If this option is not given, this subcommand uses the first
-handler that has the capability to write an image file.
+file. If this option is not given, the format is guessed from
+the file extension. If that cannot be determined, this subcommand
+uses the first handler that has the capability to write an image file.
.TP
\fB\-from \fIx1 y1 x2 y2\fR
+.
Specifies a rectangular region of \fIimageName\fR to be written to the
image file. If only \fIx1\fR and \fIy1\fR are specified, the region
extends from \fI(x1,y1)\fR to the bottom-right corner of
@@ -357,6 +415,7 @@ diagonally opposite corners of the rectangular region. The default,
if this option is not given, is the whole image.
.TP
\fB\-grayscale\fR
+.
If this options is specified, the data will not contain color
information. All pixel data will be transformed into grayscale.
.RE
@@ -366,8 +425,8 @@ The photo image code is structured to allow handlers for additional
image file formats to be added easily. The photo image code maintains
a list of these handlers. Handlers are added to the list by
registering them with a call to \fBTk_CreatePhotoImageFormat\fR. The
-standard Tk distribution comes with handlers for PPM/PGM and GIF formats,
-which are automatically registered on initialization.
+standard Tk distribution comes with handlers for PPM/PGM, PNG and GIF
+formats, which are automatically registered on initialization.
.PP
When reading an image file or processing
string data specified with the \fB\-data\fR configuration option, the
@@ -391,6 +450,27 @@ that, which the handler can use, for example, to specify which variant
to use of the formats supported by the handler.
Note that not all image handlers may support writing transparency data
to a file, even where the target image format does.
+.SS "FORMAT SUBOPTIONS"
+.PP
+.VS 8.6
+Some image formats support sub-options, which are specified at the time that
+the image is loaded using additional words in the \fB\-format\fR option. At
+the time of writing, the following are supported:
+.TP
+\fBgif \-index\fI indexValue\fR
+.
+When parsing a multi-part GIF image, Tk normally only accesses the first
+image. By giving the \fB\-index\fR sub-option, the \fIindexValue\fR'th value
+may be used instead. The \fIindexValue\fR must be an integer from 0 up to the
+number of image parts in the GIF data.
+.TP
+\fBpng \-alpha\fI alphaValue\fR
+.
+An additional alpha filtering for the overall image, which allows the
+background on which the image is displayed to show through. This usually also
+has the effect of desaturating the image. The \fIalphaValue\fR must be between
+0.0 and 1.0.
+.VE 8.6
.SH "COLOR ALLOCATION"
.PP
When a photo image is displayed in a window, the photo image code
@@ -426,8 +506,10 @@ The photo image type was designed and implemented by Paul Mackerras,
based on his earlier photo widget and some suggestions from
John Ousterhout.
.SH EXAMPLE
+.PP
Load an image from a file and tile it to the size of a window, which
is useful for producing a tiled background:
+.PP
.CS
# These lines should be called once
\fBimage create photo\fR untiled \-file "theFile.ppm"
@@ -439,9 +521,23 @@ set width [winfo width .someWidget]
set height [winfo height .someWidget]
tiled \fBcopy\fR untiled \-to 0 0 $width $height \-shrink
.CE
-
+.PP
+.VS 8.6
+The PNG image loader allows the application of an additional alpha factor
+during loading, which is useful for generating images suitable for disabled
+buttons:
+.PP
+.CS
+\fBimage create photo\fR icon \-file "icon.png"
+\fBimage create photo\fR iconDisabled \-file "icon.png" \e
+ \-format "png \-alpha 0.5"
+button .b \-image icon \-disabledimage iconDisabled
+.CE
+.VE 8.6
.SH "SEE ALSO"
image(n)
-
.SH KEYWORDS
photo, image, color
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/place.n b/doc/place.n
index fc7e0fb..af1ea43 100644
--- a/doc/place.n
+++ b/doc/place.n
@@ -14,7 +14,6 @@ place \- Geometry manager for fixed or rubber-sheet placement
.SH SYNOPSIS
\fBplace \fIoption arg \fR?\fIarg ...\fR?
.BE
-
.SH DESCRIPTION
.PP
The placer is a geometry manager for Tk.
@@ -48,9 +47,9 @@ sublist of the value returned if no \fIoption\fR is specified). If
one or more \fIoption\-value\fR pairs are specified, then the command
modifies the given option(s) to have the given value(s); in this case
the command returns an empty string.
-
-The following \fIoption\-value\fR pairs are supported:
.RS
+.PP
+The following \fIoption\-value\fR pairs are supported:
.TP
\fB\-anchor \fIwhere\fR
\fIWhere\fR specifies which point of \fIwindow\fR is to be positioned
@@ -73,7 +72,8 @@ an option of \fB\-x 0\fR corresponds to an x-coordinate just
inside the border and an option of \fB\-relwidth 1.0\fR
means \fIwindow\fR will fill the area inside the master's
border.
-
+.RS
+.PP
If \fImode\fR is \fBoutside\fR then the placer considers
the area of the master to include its border;
this mode is typically used when placing \fIwindow\fR
@@ -83,6 +83,7 @@ case borders are ignored: the area of the master is considered
to be its official X area, which includes any internal border but
no external border. A bordermode of \fBignore\fR is probably
not very useful.
+.RE
.TP
\fB\-height \fIsize\fR
\fISize\fR specifies the height for \fIwindow\fR in screen units
@@ -238,15 +239,17 @@ set their requested sizes).
To control the sizes of these windows, make them windows like
frames and canvases that provide configuration options for this purpose.
.SH EXAMPLE
+.PP
Make the label occupy the middle bit of the toplevel, no matter how it
is resized:
.CS
label .l \-text "In the\enMiddle!" \-bg black \-fg white
\fBplace\fR .l \-relwidth .3 \-relx .35 \-relheight .3 \-rely .35
.CE
-
.SH "SEE ALSO"
grid(n), pack(n)
-
.SH KEYWORDS
geometry manager, height, location, master, place, rubber sheet, slave, width
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/popup.n b/doc/popup.n
index 7b7d69f..2dea83f 100644
--- a/doc/popup.n
+++ b/doc/popup.n
@@ -13,7 +13,6 @@ tk_popup \- Post a popup menu
.SH SYNOPSIS
\fBtk_popup \fImenu x y \fR?\fIentry\fR?
.BE
-
.SH DESCRIPTION
.PP
This procedure posts a menu at a given position on the screen and
@@ -27,6 +26,7 @@ Otherwise \fIentry\fR gives the index of an entry in \fImenu\fR and
the menu will be positioned so that the entry is positioned over
the given point.
.SH EXAMPLE
+.PP
How to attach a simple popup menu to a widget.
.CS
# Create a menu
@@ -40,9 +40,10 @@ pack [label .l \-text "Click me!"]
# Arrange for the menu to pop up when the label is clicked
bind .l <1> {\fBtk_popup\fR .popupMenu %X %Y}
.CE
-
.SH "SEE ALSO"
bind(n), menu(n), tk_optionMenu(n)
-
.SH KEYWORDS
menu, popup
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/radiobutton.n b/doc/radiobutton.n
index 29c2eec..983b43e 100644
--- a/doc/radiobutton.n
+++ b/doc/radiobutton.n
@@ -38,16 +38,16 @@ If this option is not specified, the button's desired height is computed
from the size of the image or bitmap or text being displayed in it.
.OP \-indicatoron indicatorOn IndicatorOn
Specifies whether or not the indicator should be drawn. Must be a
-proper boolean value. If false, the \fBrelief\fR option is
+proper boolean value. If false, the \fB\-relief\fR option is
ignored and the widget's relief is always sunken if the widget is
selected and raised otherwise.
.OP \-selectcolor selectColor Background
Specifies a background color to use when the button is selected.
-If \fBindicatorOn\fR is true then the color applies to the indicator.
+If \fB\-indicatoron\fR is true then the color applies to the indicator.
Under Windows, this color is used as the background for the indicator
regardless of the select state.
-If \fBindicatorOn\fR is false, this color is used as the background
-for the entire widget, in place of \fBbackground\fR or \fBactiveBackground\fR,
+If \fB\-indicatoron\fR is false, this color is used as the background
+for the entire widget, in place of \fB\-background\fR or \fB\-activeBackground\fR,
whenever the widget is selected.
If specified as an empty string then no special color is used for
displaying when the widget is selected.
@@ -72,34 +72,30 @@ raised\fR. If the value of this option is the empty string, then no
alternative relief is used when the mouse cursor is over the radiobutton.
The empty string is the default value.
.OP \-selectimage selectImage SelectImage
-Specifies an image to display (in place of the \fBimage\fR option)
+Specifies an image to display (in place of the \fB\-image\fR option)
when the radiobutton is selected.
-This option is ignored unless the \fBimage\fR option has been
+This option is ignored unless the \fB\-image\fR option has been
specified.
.OP \-state state State
Specifies one of three states for the radiobutton: \fBnormal\fR, \fBactive\fR,
or \fBdisabled\fR. In normal state the radiobutton is displayed using the
-\fBforeground\fR and \fBbackground\fR options. The active state is
+\fB\-foreground\fR and \fB\-background\fR options. The active state is
typically used when the pointer is over the radiobutton. In active state
-the radiobutton is displayed using the \fBactiveForeground\fR and
-\fBactiveBackground\fR options. Disabled state means that the radiobutton
+the radiobutton is displayed using the \fB\-activeforeground\fR and
+\fB\-activebackground\fR options. Disabled state means that the radiobutton
should be insensitive: the default bindings will refuse to activate
the widget and will ignore mouse button presses.
-In this state the \fBdisabledForeground\fR and
-\fBbackground\fR options determine how the radiobutton is displayed.
+In this state the \fB\-disabledforeground\fR and
+\fB\-background\fR options determine how the radiobutton is displayed.
.OP \-tristateimage tristateImage TristateImage
-.VS 8.5
-Specifies an image to display (in place of the \fBimage\fR option)
+Specifies an image to display (in place of the \fB\-image\fR option)
when the radiobutton is selected.
-This option is ignored unless the \fBimage\fR option has been
+This option is ignored unless the \fB\-image\fR option has been
specified.
-.VE 8.5
.OP \-tristatevalue tristateValue Value
-.VS 8.5
-Specifies the value that causes the radiobutton to display the multi-value
+Specifies the value that causes the radiobutton to display the multi-value
selection, also known as the tri-state mode. Defaults to
.QW "" .
-.VE 8.5
.OP \-value value Value
Specifies value to store in the button's associated variable whenever
this button is selected.
@@ -133,11 +129,11 @@ A radiobutton is a widget that displays a textual string, bitmap or image
and a diamond or circle called an \fIindicator\fR.
If text is displayed, it must all be in a single font, but it
can occupy multiple lines on the screen (if it contains newlines
-or if wrapping occurs because of the \fBwrapLength\fR option) and
+or if wrapping occurs because of the \fB\-wraplength\fR option) and
one of the characters may optionally be underlined using the
-\fBunderline\fR option. A radiobutton has
+\fB\-underline\fR option. A radiobutton has
all of the behavior of a simple button: it can display itself in either
-of three different ways, according to the \fBstate\fR option;
+of three different ways, according to the \fB\-state\fR option;
it can be made to appear
raised, sunken, or flat; it can be made to flash; and it invokes
a Tcl command whenever mouse button 1 is clicked over the
@@ -160,12 +156,10 @@ When a radiobutton is selected it sets the value of the variable to
indicate that fact; each radiobutton also monitors the value of
the variable and automatically selects and deselects itself when the
variable's value changes.
-.VS 8.5
-If the variable's value matches the \fBtristateValue\fR, then the radiobutton is
-drawn using the tri-state mode. This mode is used to indicate mixed or
-multiple values. (This is used when the radiobutton represents the state
+If the variable's value matches the \fB\-tristatevalue\fR, then the radiobutton
+is drawn using the tri-state mode. This mode is used to indicate mixed or
+multiple values. (This is used when the radiobutton represents the state
of multiple items.)
-.VE 8.5
By default the variable \fBselectedButton\fR
is used; its contents give the name of the button that is
selected, or the empty string if no button associated with that
@@ -190,12 +184,14 @@ determine the exact behavior of the command. The following
commands are possible for radiobutton widgets:
.TP
\fIpathName \fBcget\fR \fIoption\fR
+.
Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBradiobutton\fR
command.
.TP
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+.
Query or modify the configuration options of the widget.
If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
@@ -210,12 +206,14 @@ this case the command returns an empty string.
command.
.TP
\fIpathName \fBdeselect\fR
+.
Deselects the radiobutton and sets the associated variable to an
empty string.
If this radiobutton was not currently selected, the command has
no effect.
.TP
\fIpathName \fBflash\fR
+.
Flashes the radiobutton. This is accomplished by redisplaying the radiobutton
several times, alternating between active and normal colors. At
the end of the flash the radiobutton is left in the same normal/active
@@ -223,6 +221,7 @@ state as when the command was invoked.
This command is ignored if the radiobutton's state is \fBdisabled\fR.
.TP
\fIpathName \fBinvoke\fR
+.
Does just what would have happened if the user invoked the radiobutton
with the mouse: selects the button and invokes
its associated Tcl command, if there is one.
@@ -231,6 +230,7 @@ empty string if there is no command associated with the radiobutton.
This command is ignored if the radiobutton's state is \fBdisabled\fR.
.TP
\fIpathName \fBselect\fR
+.
Selects the radiobutton and sets the associated variable to the
value corresponding to this widget.
.SH BINDINGS
@@ -261,3 +261,6 @@ individual widgets or by redefining the class bindings.
checkbutton(n), labelframe(n), listbox(n), options(n), scale(n), ttk::radiobutton(n)
.SH KEYWORDS
radiobutton, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/raise.n b/doc/raise.n
index 02f805f..b2856c1 100644
--- a/doc/raise.n
+++ b/doc/raise.n
@@ -14,7 +14,6 @@ raise \- Change a window's position in the stacking order
.SH SYNOPSIS
\fBraise \fIwindow \fR?\fIaboveThis\fR?
.BE
-
.SH DESCRIPTION
.PP
If the \fIaboveThis\fR argument is omitted then the command raises
@@ -28,7 +27,12 @@ In this case the \fBraise\fR command will insert
\fIwindow\fR into the stacking order just above \fIaboveThis\fR
(or the ancestor of \fIaboveThis\fR that is a sibling of \fIwindow\fR);
this could end up either raising or lowering \fIwindow\fR.
+.PP
+All \fBtoplevel\fR windows may be restacked with respect to each
+other, whatever their relative path names, but the window manager is
+not obligated to strictly honor requests to restack.
.SH EXAMPLE
+.PP
Make a button appear to be in a sibling frame that was created after
it. This is is often necessary when building GUIs in the style where
you create your activity widgets first before laying them out on the
@@ -41,9 +45,10 @@ pack .b \-in .f
pack [label .f.l2 \-text "This is below"]
\fBraise\fR .b
.CE
-
.SH "SEE ALSO"
lower(n)
-
.SH KEYWORDS
obscure, raise, stacking order
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/scale.n b/doc/scale.n
index e750fdd..c8e722a 100644
--- a/doc/scale.n
+++ b/doc/scale.n
@@ -74,7 +74,7 @@ Specifies one of three states for the scale: \fBnormal\fR,
If the scale is disabled then the value may not be changed and the scale
will not activate.
If the scale is active, the slider is displayed using the color
-specified by the \fBactiveBackground\fR option.
+specified by the \fB\-activebackground\fR option.
.OP \-tickinterval tickInterval TickInterval
Must be a real value.
Determines the spacing between numerical
@@ -83,7 +83,7 @@ If 0, no tick marks will be displayed.
.OP \-to to To
Specifies a real value corresponding
to the right or bottom end of the scale.
-This value may be either less than or greater than the \fBfrom\fR option.
+This value may be either less than or greater than the \fB\-from\fR option.
.OP \-variable variable Variable
Specifies the name of a global variable to link to the scale. Whenever the
value of the variable changes, the scale will update to reflect this
@@ -96,7 +96,6 @@ Specifies the desired narrow dimension of the trough in screen units
For vertical scales this is the trough's width; for horizontal scales
this is the trough's height.
.BE
-
.SH DESCRIPTION
.PP
The \fBscale\fR command creates a new window (given by the
@@ -112,16 +111,16 @@ there must not exist a window named \fIpathName\fR, but
.PP
A scale is a widget that displays a rectangular \fItrough\fR and a
small \fIslider\fR. The trough corresponds to a range
-of real values (determined by the \fBfrom\fR, \fBto\fR, and
-\fBresolution\fR options),
+of real values (determined by the \fB\-from\fR, \fB\-to\fR, and
+\fB\-resolution\fR options),
and the position of the slider selects a particular real value.
The slider's position (and hence the scale's value) may be adjusted
with the mouse or keyboard as described in the \fBBINDINGS\fR
section below. Whenever the scale's value is changed, a Tcl
-command is invoked (using the \fBcommand\fR option) to notify
+command is invoked (using the \fB\-command\fR option) to notify
other interested widgets of the change.
In addition, the value
-of the scale can be linked to a Tcl variable (using the \fBvariable\fR
+of the scale can be linked to a Tcl variable (using the \fB\-variable\fR
option), so that changes in either are reflected in the other.
.PP
Three annotations may be displayed in a scale widget: a label
@@ -146,12 +145,14 @@ determine the exact behavior of the command. The following
commands are possible for scale widgets:
.TP
\fIpathName \fBcget\fR \fIoption\fR
+.
Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBscale\fR
command.
.TP
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+.
Query or modify the configuration options of the widget.
If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
@@ -166,12 +167,14 @@ this case the command returns an empty string.
command.
.TP
\fIpathName \fBcoords \fR?\fIvalue\fR?
+.
Returns a list whose elements are the x and y coordinates of
the point along the centerline of the trough that corresponds
to \fIvalue\fR.
If \fIvalue\fR is omitted then the scale's current value is used.
.TP
\fIpathName \fBget\fR ?\fIx y\fR?
+.
If \fIx\fR and \fIy\fR are omitted, returns the current value
of the scale. If \fIx\fR and \fIy\fR are specified, they give
pixel coordinates within the widget; the command returns
@@ -179,7 +182,8 @@ the scale value corresponding to the given pixel.
Only one of \fIx\fR or \fIy\fR is used: for horizontal scales
\fIy\fR is ignored, and for vertical scales \fIx\fR is ignored.
.TP
-\fIpathName \fBidentify\fR \fIx y\fR
+\fIpathName \fBidentify \fIx y\fR
+.
Returns a string indicating what part of the scale lies under
the coordinates given by \fIx\fR and \fIy\fR.
A return value of \fBslider\fR means that the point is over
@@ -190,7 +194,8 @@ of the slider below or to the right of the slider.
If the point is not over one of these elements, an empty string
is returned.
.TP
-\fIpathName \fBset\fR \fIvalue\fR
+\fIpathName \fBset \fIvalue\fR
+.
This command is invoked to change the current value of the scale,
and hence the position at which the slider is displayed. \fIValue\fR
gives the new value for the scale.
@@ -203,7 +208,7 @@ Where the behavior is different for vertical and horizontal scales,
the horizontal behavior is described in parentheses.
.IP [1]
If button 1 is pressed in the trough, the scale's value will
-be incremented or decremented by the value of the \fBresolution\fR
+be incremented or decremented by the value of the \fB\-resolution\fR
option so that the slider moves in the direction of the cursor.
If the button is held down, the action auto-repeats.
.IP [2]
@@ -219,26 +224,30 @@ position. If the mouse is dragged with button 2 down, the scale's
value changes with the drag.
.IP [5]
The Up and Left keys move the slider up (left) by the value
-of the \fBresolution\fR option.
+of the \fB\-resolution\fR option.
.IP [6]
The Down and Right keys move the slider down (right) by the value
-of the \fBresolution\fR option.
+of the \fB\-resolution\fR option.
.IP [7]
Control-Up and Control-Left move the slider up (left) by the
-value of the \fBbigIncrement\fR option.
+value of the \fB\-bigincrement\fR option.
.IP [8]
Control-Down and Control-Right move the slider down (right) by the
-value of the \fBbigIncrement\fR option.
+value of the \fB\-bigincrement\fR option.
.IP [9]
Home moves the slider to the top (left) end of its range.
.IP [10]
End moves the slider to the bottom (right) end of its range.
.PP
-If the scale is disabled using the \fBstate\fR option then
+If the scale is disabled using the \fB\-state\fR option then
none of the above bindings have any effect.
.PP
The behavior of scales can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
-
+.SH "SEE ALSO"
+ttk::scale(n)
.SH KEYWORDS
scale, slider, trough, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/scrollbar.n b/doc/scrollbar.n
index a13574b..74fb977 100644
--- a/doc/scrollbar.n
+++ b/doc/scrollbar.n
@@ -42,7 +42,7 @@ as described in \fBSCROLLING COMMANDS\fR below.
Specifies the width of borders drawn around the internal elements
of the scrollbar (the two arrows and the slider). The value may
have any of the forms acceptable to \fBTk_GetPixels\fR.
-If this value is less than zero, the value of the \fBborderWidth\fR
+If this value is less than zero, the value of the \fB\-borderwidth\fR
option is used in its place.
.OP \-width width Width
Specifies the desired narrow dimension of the scrollbar window,
@@ -110,9 +110,10 @@ determine the exact behavior of the command. The following
commands are possible for scrollbar widgets:
.TP
\fIpathName \fBactivate \fR?\fIelement\fR?
+.
Marks the element indicated by \fIelement\fR as active, which
-causes it to be displayed as specified by the \fBactiveBackground\fR
-and \fBactiveRelief\fR options.
+causes it to be displayed as specified by the \fB\-activebackground\fR
+and \fB\-activerelief\fR options.
The only element values understood by this command are \fBarrow1\fR,
\fBslider\fR, or \fBarrow2\fR.
If any other value is specified then no element of the scrollbar
@@ -121,13 +122,15 @@ If \fIelement\fR is not specified, the command returns
the name of the element that is currently active, or an empty string
if no element is active.
.TP
-\fIpathName \fBcget\fR \fIoption\fR
+\fIpathName \fBcget \fIoption\fR
+.
Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBscrollbar\fR
command.
.TP
\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
+.
Query or modify the configuration options of the widget.
If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
@@ -142,6 +145,7 @@ this case the command returns an empty string.
command.
.TP
\fIpathName \fBdelta \fIdeltaX deltaY\fR
+.
Returns a real number indicating the fractional change in
the scrollbar setting that corresponds to a given change
in slider position. For example, if the scrollbar is horizontal,
@@ -153,6 +157,7 @@ scrollbar setting must change to move the slider \fIdeltaY\fR pixels
down. The arguments and the result may be zero or negative.
.TP
\fIpathName \fBfraction \fIx y\fR
+.
Returns a real number between 0 and 1 indicating where the point
given by \fIx\fR and \fIy\fR lies in the trough area of the scrollbar.
The value 0 corresponds to the top or left of the trough, the
@@ -164,17 +169,20 @@ If \fIx\fR and \fIy\fR refer to a point outside the trough, the closest
point in the trough is used.
.TP
\fIpathName \fBget\fR
+.
Returns the scrollbar settings in the form of a list whose
elements are the arguments to the most recent \fBset\fR widget command.
.TP
-\fIpathName \fBidentify\fR \fIx y\fR
+\fIpathName \fBidentify \fIx y\fR
+.
Returns the name of the element under the point given by \fIx\fR and
\fIy\fR (such as \fBarrow1\fR), or an empty string if the point does
not lie in any element of the scrollbar.
\fIX\fR and \fIy\fR must be pixel coordinates relative to the scrollbar
widget.
.TP
-\fIpathName \fBset\fR \fIfirst last\fR
+\fIpathName \fBset \fIfirst last\fR
+.
This command is invoked by the scrollbar's associated widget to
tell the scrollbar about the current view in the widget.
The command takes two arguments, each of which is a real fraction
@@ -194,9 +202,11 @@ The scrollbar makes the notification by evaluating a Tcl command
generated from the scrollbar's \fB\-command\fR option.
The command may take any of the following forms.
In each case, \fIprefix\fR is the contents of the
-\fB\-command\fR option, which usually has a form like \fB.t yview\fR
+\fB\-command\fR option, which usually has a form like
+.QW \fB.t yview\fR .
.TP
\fIprefix \fBmoveto \fIfraction\fR
+.
\fIFraction\fR is a real number between 0 and 1.
The widget should adjust its view so that the point given
by \fIfraction\fR appears at the beginning of the widget.
@@ -206,6 +216,7 @@ refers to a point one-third of the way through the document,
and so on.
.TP
\fIprefix \fBscroll \fInumber \fBunits\fR
+.
The widget should adjust its view by \fInumber\fR units.
The units are defined in whatever way makes sense for the widget,
such as characters or lines in a text widget.
@@ -214,6 +225,7 @@ the top or left of the window, or \-1, which means that one unit
should scroll off the bottom or right of the window.
.TP
\fIprefix \fBscroll \fInumber \fBpages\fR
+.
The widget should adjust its view by \fInumber\fR pages.
It is up to the widget to define the meaning of a page; typically
it is slightly less than what fits in the window, so that there
@@ -230,7 +242,7 @@ is deprecated.
In the old command syntax, the \fBset\fR widget command has the
following form:
.TP
-\fIpathName \fBset\fR \fItotalUnits windowUnits firstUnit lastUnit\fR
+\fIpathName \fBset \fItotalUnits windowUnits firstUnit lastUnit\fR
In this form the arguments are all integers.
\fITotalUnits\fR gives the total size of the object being displayed in the
associated widget. The meaning of one unit depends on the associated
@@ -262,6 +274,7 @@ If it is given two real arguments then the new syntax will be
used in the future, and if it is given four integer arguments then
the old syntax will be used.
.SH BINDINGS
+.PP
Tk automatically creates class bindings for scrollbars that give them
the following default behavior.
If the behavior is different for vertical and horizontal scrollbars,
@@ -328,6 +341,7 @@ The Home key adjusts the view to the top (left edge) of the document.
.IP [14]
The End key adjusts the view to the bottom (right edge) of the document.
.SH EXAMPLE
+.PP
Create a window with a scrollable \fBtext\fR widget:
.CS
toplevel .tl
@@ -341,3 +355,6 @@ grid rowconfigure .tl 0 \-weight 1
ttk:scrollbar(n)
.SH KEYWORDS
scrollbar, widget
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/selection.n b/doc/selection.n
index 8aee321..69f6245 100644
--- a/doc/selection.n
+++ b/doc/selection.n
@@ -14,65 +14,66 @@ selection \- Manipulate the X selection
.SH SYNOPSIS
\fBselection \fIoption\fR ?\fIarg arg ...\fR?
.BE
-
.SH DESCRIPTION
.PP
This command provides a Tcl interface to the X selection mechanism and
implements the full selection functionality described in the
X Inter-Client Communication Conventions Manual (ICCCM).
.PP
-Note that for management of the CLIPBOARD selection (see below), the
+Note that for management of the \fBCLIPBOARD\fR selection (see below), the
\fBclipboard\fR command may also be used.
.PP
The first argument to \fBselection\fR determines the format of the
rest of the arguments and the behavior of the command. The following
forms are currently supported:
-.PP
.TP
\fBselection clear\fR ?\fB\-displayof\fR \fIwindow\fR? ?\fB\-selection\fR \fIselection\fR?
+.
If \fIselection\fR exists anywhere on \fIwindow\fR's display, clear it
so that no window owns the selection anymore. \fISelection\fR
specifies the X selection that should be cleared, and should be an
-atom name such as PRIMARY or CLIPBOARD; see the Inter-Client
+atom name such as \fBPRIMARY\fR or \fBCLIPBOARD\fR; see the Inter-Client
Communication Conventions Manual for complete details.
-\fISelection\fR defaults to PRIMARY and \fIwindow\fR defaults to
+\fISelection\fR defaults to \fBPRIMARY\fR and \fIwindow\fR defaults to
.QW . .
Returns an empty string.
.TP
\fBselection get\fR ?\fB\-displayof\fR \fIwindow\fR? ?\fB\-selection\fR \fIselection\fR? ?\fB\-type\fR \fItype\fR?
+.
Retrieves the value of \fIselection\fR from \fIwindow\fR's display and
-returns it as a result. \fISelection\fR defaults to PRIMARY and
+returns it as a result. \fISelection\fR defaults to \fBPRIMARY\fR and
\fIwindow\fR defaults to
.QW . .
\fIType\fR specifies the form in which the selection is to be returned
(the desired
.QW target
for conversion, in ICCCM terminology), and
-should be an atom name such as STRING or FILE_NAME; see the
+should be an atom name such as \fBSTRING\fR or \fBFILE_NAME\fR; see the
Inter-Client Communication Conventions Manual for complete details.
-\fIType\fR defaults to STRING. The selection owner may choose to
+\fIType\fR defaults to \fBSTRING\fR. The selection owner may choose to
return the selection in any of several different representation
-formats, such as STRING, UTF8_STRING, ATOM, INTEGER, etc. (this format
-is different
+formats, such as \fBSTRING\fR, \fBUTF8_STRING\fR, \fBATOM\fR,
+\fBINTEGER\fR, etc. (this format is different
than the selection type; see the ICCCM for all the confusing details).
-If the selection is returned in a non-string format, such as INTEGER
-or ATOM, the \fBselection\fR command converts it to string format as a
+If the selection is returned in a non-string format, such as \fBINTEGER\fR
+or \fBATOM\fR, the \fBselection\fR command converts it to string format as a
collection of fields separated by spaces: atoms are converted to their
textual names, and anything else is converted to hexadecimal integers.
Note that \fBselection get\fR does not retrieve the selection in the
-UTF8_STRING format unless told to.
+\fBUTF8_STRING\fR format unless told to.
.TP
\fBselection handle\fR ?\fB\-selection\fR \fIs\fR? ?\fB\-type\fR \fIt\fR? ?\fB\-format\fR \fIf\fR? \fIwindow command\fR
+.
Creates a handler for selection requests, such that \fIcommand\fR will
be executed whenever selection \fIs\fR is owned by \fIwindow\fR and
someone attempts to retrieve it in the form given by type \fIt\fR
(e.g. \fIt\fR is specified in the \fBselection get\fR command).
-\fIS\fR defaults to PRIMARY, \fIt\fR defaults to STRING, and
-\fIf\fR defaults to STRING. If \fIcommand\fR is an empty string
+\fIS\fR defaults to \fBPRIMARY\fR, \fIt\fR defaults to \fBSTRING\fR, and
+\fIf\fR defaults to \fBSTRING\fR. If \fIcommand\fR is an empty string
then any existing handler for \fIwindow\fR, \fIt\fR, and
\fIs\fR is removed.
-Note that when the selection is handled as type STRING it is also
-automatically handled as type UTF8_STRING as well.
+Note that when the selection is handled as type \fBSTRING\fR it is also
+automatically handled as type \fBUTF8_STRING\fR as well.
.RS
.PP
When \fIselection\fR is requested, \fIwindow\fR is the selection owner,
@@ -99,12 +100,12 @@ just as if the selection did not exist at all.
.PP
The \fIformat\fR argument specifies the representation that should be
used to transmit the selection to the requester (the second column of
-Table 2 of the ICCCM), and defaults to STRING. If \fIformat\fR is
-STRING, the selection is transmitted as 8-bit ASCII characters (i.e.
+Table 2 of the ICCCM), and defaults to \fBSTRING\fR. If \fIformat\fR is
+\fBSTRING\fR, the selection is transmitted as 8-bit ASCII characters (i.e.
just in the form returned by \fIcommand\fR, in the system \fBencoding\fR;
-the UTF8_STRING format always uses UTF-8 as its encoding).
+the \fBUTF8_STRING\fR format always uses UTF-8 as its encoding).
If \fIformat\fR is
-ATOM, then the return value from \fIcommand\fR is divided into fields
+\fBATOM\fR, then the return value from \fIcommand\fR is divided into fields
separated by white space; each field is converted to its atom value,
and the 32-bit atom value is transmitted instead of the atom name.
For any other \fIformat\fR, the return value from \fIcommand\fR is
@@ -122,12 +123,14 @@ irrelevant.
\fBselection own\fR ?\fB\-displayof\fR \fIwindow\fR? ?\fB\-selection\fR \fIselection\fR?
.TP
\fBselection own\fR ?\fB\-command\fR \fIcommand\fR? ?\fB\-selection\fR \fIselection\fR? \fIwindow\fR
+.
The first form of \fBselection own\fR returns the path name of the
window in this application that owns \fIselection\fR on the display
containing \fIwindow\fR, or an empty string if no window in this
-application owns the selection. \fISelection\fR defaults to PRIMARY and
+application owns the selection. \fISelection\fR defaults to \fBPRIMARY\fR and
\fIwindow\fR defaults to
.QW . .
+.RS
.PP
The second form of \fBselection own\fR causes \fIwindow\fR to become
the new owner of \fIselection\fR on \fIwindow\fR's display, returning
@@ -136,16 +139,20 @@ that it has lost the selection.
If \fIcommand\fR is specified, it is a Tcl script to execute when
some other window claims ownership of the selection away from
\fIwindow\fR. \fISelection\fR defaults to PRIMARY.
+.RE
.SH EXAMPLES
+.PP
On X11 platforms, one of the standard selections available is the
-SECONDARY selection. Hardly anything uses it, but here is how to read
+\fBSECONDARY\fR selection. Hardly anything uses it, but here is how to read
it using Tk:
+.PP
.CS
set selContents [\fBselection get\fR \-selection SECONDARY]
.CE
.PP
Many different types of data may be available for a selection; the
-special type TARGETS allows you to get a list of available types:
+special type \fBTARGETS\fR allows you to get a list of available types:
+.PP
.CS
foreach type [\fBselection get\fR \-type TARGETS] {
puts "Selection PRIMARY supports type $type"
@@ -153,14 +160,14 @@ foreach type [\fBselection get\fR \-type TARGETS] {
.CE
.PP
To claim the selection, you must first set up a handler to supply the
-data for the selection. Then you have to claim the selection...
+data for the selection. Then you have to claim the selection...
.CS
# Set up the data handler ready for incoming requests
set foo "This is a string with some data in it... blah blah"
\fBselection handle\fR \-selection SECONDARY . getData
proc getData {offset maxChars} {
puts "Retrieving selection starting at $offset"
- return [string range $::foo $offset [expr {$offset+$maxChars}]]
+ return [string range $::foo $offset [expr {$offset+$maxChars-1}]]
}
# Now we grab the selection itself
@@ -174,3 +181,6 @@ proc lost {} {
clipboard(n)
.SH KEYWORDS
clear, format, handler, ICCCM, own, selection, target, type
+'\" Local Variables:
+'\" mode: nroff
+'\" End:
diff --git a/doc/send.n b/doc/send.n